This commit is contained in:
parent
40b8198c7e
commit
adb1c28bb8
|
|
@ -98,8 +98,9 @@ public class MemberController {
|
|||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestParam("flowId") String flowId,
|
||||
@RequestParam("remark") String remark
|
||||
@RequestParam("remark") String remark,
|
||||
@RequestParam("amount") String amount
|
||||
){
|
||||
return memberService.returnAccount(flowId,remark);
|
||||
return memberService.returnAccount(flowId,remark,amount);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -724,8 +724,8 @@ public class MemberService {
|
|||
}
|
||||
|
||||
|
||||
public Result returnAccount(String flowId, String remark) {
|
||||
if (ObjectUtil.isEmpty(flowId) || ObjectUtil.isNull(flowId)) {
|
||||
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,6 +737,11 @@ public class MemberService {
|
|||
return Result.fail(CodeEnum.ORDERRETURN);
|
||||
}
|
||||
|
||||
if(N.gt(new BigDecimal(amount),flow.getAmount())){
|
||||
return Result.fail(CodeEnum.INPURAMOUNTERROR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
TbShopUser user = tbShopUserMapper.selectByPrimaryKey(flow.getShopUserId());
|
||||
|
||||
|
|
@ -744,15 +749,8 @@ public class MemberService {
|
|||
return Result.fail(CodeEnum.ACCOUNTEIXST);
|
||||
}
|
||||
|
||||
|
||||
BigDecimal amount=BigDecimal.ZERO;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
if(N.gt(flow.getAmount(),user.getAmount())){
|
||||
amount=user.getAmount();
|
||||
}else {
|
||||
amount=flow.getAmount();
|
||||
if(N.gt(new BigDecimal(amount),user.getAmount())){
|
||||
return Result.fail(CodeEnum.ACCOUNTBALANCEERROR);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -776,7 +774,7 @@ public class MemberService {
|
|||
|
||||
String no = DateUtils.getSsdfTimes();
|
||||
|
||||
PublicResp<OrderReturnResp> publicResp = thirdPayService.returnOrder(url, thirdApply.getAppId(), no, null, flow.getRemark(), "充值退款",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")) {
|
||||
|
|
@ -793,7 +791,7 @@ public class MemberService {
|
|||
} else {
|
||||
return Result.fail(CodeEnum.OPARETIONERROR);
|
||||
}
|
||||
user.setAmount(user.getAmount().subtract(amount));
|
||||
user.setAmount(user.getAmount().subtract(new BigDecimal(amount)));
|
||||
user.setUpdatedAt(System.currentTimeMillis());
|
||||
tbShopUserMapper.updateByPrimaryKey(user);
|
||||
|
||||
|
|
|
|||
|
|
@ -805,6 +805,9 @@ public class PayService {
|
|||
return Result.fail("余额不足或扣除余额失败");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
TbShopUserFlow userFlow = new TbShopUserFlow();
|
||||
userFlow.setAmount((payAmount != null && discountAmount != null) ? payAmount : orderInfo.getOrderAmount());
|
||||
userFlow.setBalance(shopUser.getAmount());
|
||||
|
|
|
|||
|
|
@ -118,6 +118,11 @@ public enum CodeEnum {
|
|||
ACCOUNTAMOUNT("100043",false,"账户余额不足","fail"),
|
||||
|
||||
|
||||
INPURAMOUNTERROR("100044",false,"输入金额不允许大于订单原始金额","fail"),
|
||||
|
||||
|
||||
|
||||
ACCOUNTBALANCEERROR("100045",false,"账户余额不足","fail"),
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue