This commit is contained in:
牛叉闪闪 2024-08-29 17:31:20 +08:00
parent 84e4a21064
commit 203332e232
1 changed files with 18 additions and 12 deletions

View File

@ -724,8 +724,8 @@ public class MemberService {
}
public Result returnAccount(String flowId, String remark,String amount) {
if (ObjectUtil.isEmpty(flowId) || ObjectUtil.isNull(flowId)||ObjectUtil.isNull(amount)||ObjectUtil.isEmpty(amount)) {
public Result returnAccount(String flowId, String remark, String amount) {
if (ObjectUtil.isEmpty(flowId) || ObjectUtil.isNull(flowId) || ObjectUtil.isNull(amount) || ObjectUtil.isEmpty(amount)) {
return Result.fail(CodeEnum.PARAM);
}
TbShopUserFlow flow = tbShopUserFlowMapper.selectByPrimaryKey(Integer.valueOf(flowId));
@ -737,35 +737,28 @@ public class MemberService {
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);
}
TbShopUser user = tbShopUserMapper.selectByPrimaryKey(flow.getShopUserId());
if (ObjectUtil.isEmpty(user) || ObjectUtil.isNull(user)) {
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);
}
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(user.getShopId()));
if (ObjectUtil.isEmpty(shopInfo) || ObjectUtil.isNull(shopInfo)) {
return Result.fail(CodeEnum.MERCHANTEIXST);
}
if ("scanMemberIn".equals(flow.getBizCode())) {
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(shopInfo.getMerchantId()));
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
@ -774,7 +767,7 @@ public class MemberService {
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 ("000000".equals(publicResp.getCode())) {
if (!"SUCCESS".equals(publicResp.getObjData().getState()) && !publicResp.getObjData().getState().equals("ING")) {
@ -800,6 +793,19 @@ public class MemberService {
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();
baObj.put("userId", user.getUserId());
baObj.put("shopId", user.getId());