This commit is contained in:
parent
84e4a21064
commit
203332e232
|
|
@ -724,8 +724,8 @@ public class MemberService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Result returnAccount(String flowId, String remark,String amount) {
|
public Result returnAccount(String flowId, String remark, String amount) {
|
||||||
if (ObjectUtil.isEmpty(flowId) || ObjectUtil.isNull(flowId)||ObjectUtil.isNull(amount)||ObjectUtil.isEmpty(amount)) {
|
if (ObjectUtil.isEmpty(flowId) || ObjectUtil.isNull(flowId) || ObjectUtil.isNull(amount) || ObjectUtil.isEmpty(amount)) {
|
||||||
return Result.fail(CodeEnum.PARAM);
|
return Result.fail(CodeEnum.PARAM);
|
||||||
}
|
}
|
||||||
TbShopUserFlow flow = tbShopUserFlowMapper.selectByPrimaryKey(Integer.valueOf(flowId));
|
TbShopUserFlow flow = tbShopUserFlowMapper.selectByPrimaryKey(Integer.valueOf(flowId));
|
||||||
|
|
@ -737,35 +737,28 @@ public class MemberService {
|
||||||
return Result.fail(CodeEnum.ORDERRETURN);
|
return Result.fail(CodeEnum.ORDERRETURN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(N.gt(new BigDecimal(amount),flow.getAmount())){
|
if (N.gt(new BigDecimal(amount), flow.getAmount())) {
|
||||||
return Result.fail(CodeEnum.INPURAMOUNTERROR);
|
return Result.fail(CodeEnum.INPURAMOUNTERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TbShopUser user = tbShopUserMapper.selectByPrimaryKey(flow.getShopUserId());
|
TbShopUser user = tbShopUserMapper.selectByPrimaryKey(flow.getShopUserId());
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(user) || ObjectUtil.isNull(user)) {
|
if (ObjectUtil.isEmpty(user) || ObjectUtil.isNull(user)) {
|
||||||
return Result.fail(CodeEnum.ACCOUNTEIXST);
|
return Result.fail(CodeEnum.ACCOUNTEIXST);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(N.gt(new BigDecimal(amount),user.getAmount())){
|
if (N.gt(new BigDecimal(amount), user.getAmount())) {
|
||||||
return Result.fail(CodeEnum.ACCOUNTBALANCEERROR);
|
return Result.fail(CodeEnum.ACCOUNTBALANCEERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(user.getShopId()));
|
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(user.getShopId()));
|
||||||
if (ObjectUtil.isEmpty(shopInfo) || ObjectUtil.isNull(shopInfo)) {
|
if (ObjectUtil.isEmpty(shopInfo) || ObjectUtil.isNull(shopInfo)) {
|
||||||
return Result.fail(CodeEnum.MERCHANTEIXST);
|
return Result.fail(CodeEnum.MERCHANTEIXST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ("scanMemberIn".equals(flow.getBizCode())) {
|
if ("scanMemberIn".equals(flow.getBizCode())) {
|
||||||
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(shopInfo.getMerchantId()));
|
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(shopInfo.getMerchantId()));
|
||||||
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
|
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
|
||||||
|
|
@ -774,7 +767,7 @@ public class MemberService {
|
||||||
|
|
||||||
String no = DateUtils.getSsdfTimes();
|
String no = DateUtils.getSsdfTimes();
|
||||||
|
|
||||||
PublicResp<OrderReturnResp> publicResp = thirdPayService.returnOrder(url, thirdApply.getAppId(), no, null, flow.getRemark(), "充值退款",new BigDecimal(amount).setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(), callBack, null, thirdApply.getAppToken());
|
PublicResp<OrderReturnResp> publicResp = thirdPayService.returnOrder(url, thirdApply.getAppId(), no, null, flow.getRemark(), "充值退款", new BigDecimal(amount).setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(), callBack, null, thirdApply.getAppToken());
|
||||||
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
|
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
|
||||||
if ("000000".equals(publicResp.getCode())) {
|
if ("000000".equals(publicResp.getCode())) {
|
||||||
if (!"SUCCESS".equals(publicResp.getObjData().getState()) && !publicResp.getObjData().getState().equals("ING")) {
|
if (!"SUCCESS".equals(publicResp.getObjData().getState()) && !publicResp.getObjData().getState().equals("ING")) {
|
||||||
|
|
@ -800,6 +793,19 @@ public class MemberService {
|
||||||
tbShopUserFlowMapper.updateByPrimaryKey(flow);
|
tbShopUserFlowMapper.updateByPrimaryKey(flow);
|
||||||
|
|
||||||
|
|
||||||
|
TbShopUserFlow userFlow = new TbShopUserFlow();
|
||||||
|
userFlow.setShopUserId(user.getId());
|
||||||
|
userFlow.setBizCode("memberReturn");
|
||||||
|
userFlow.setBizName("会员退款");
|
||||||
|
userFlow.setType("-");
|
||||||
|
userFlow.setAmount(new BigDecimal(amount));
|
||||||
|
userFlow.setBalance(user.getAmount());
|
||||||
|
userFlow.setCreateTime(new Date());
|
||||||
|
userFlow.setIsReturn("1");
|
||||||
|
userFlow.setRemark(flowId);
|
||||||
|
|
||||||
|
tbShopUserFlowMapper.insert(userFlow);
|
||||||
|
|
||||||
JSONObject baObj = new JSONObject();
|
JSONObject baObj = new JSONObject();
|
||||||
baObj.put("userId", user.getUserId());
|
baObj.put("userId", user.getUserId());
|
||||||
baObj.put("shopId", user.getId());
|
baObj.put("shopId", user.getId());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue