提交 f364bdf4 作者: 刘明祎-运维用途

优化保存购买课程金额支付接口

上级 861fd0a8
流水线 #7477 已通过 于阶段
in 2 分 25 秒
......@@ -99,7 +99,7 @@ public class PayWalletController extends BaseController {
@ApiOperation(value = "feign——课程订单钱包流水记录")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("feignCurriculumOrderLog")
public ResultBody payUavWallet2(HttpServletRequest request,@RequestBody CurriculumOrderLogVO param) {
public ResultBody feignCurriculumOrderLog(HttpServletRequest request,@RequestBody CurriculumOrderLogVO param) {
return payWalletService.feignCurriculumOrderLog(this.getUserLoginInfoFromRedis(request).getUserAccountId(),param);
}
}
......@@ -26,8 +26,8 @@ public class CurriculumOrderLogVO {
public PayLogDO buildPayLog() {
return PayLogDO.builder().userAccountId(this.userAccountId)
.cashAmtPaid(this.cashAmtPaid)
.salaryAmtPaid(this.salaryAmtPaid)
.cashAmtPaid(this.cashAmtPaid != null ? this.cashAmtPaid.negate() : BigDecimal.ZERO)
.salaryAmtPaid(this.salaryAmtPaid != null ? this.salaryAmtPaid.negate() : BigDecimal.ZERO)
.payNo(this.orderNo)
.build();
}
......
......@@ -636,11 +636,17 @@ public class PayWalletServiceImpl implements PayWalletService {
@Override
public ResultBody feignCurriculumOrderLog(Integer userId, CurriculumOrderLogVO param) {
PayWalletDO payWalletByUser = payWalletDao.getPayWalletByUser(param.getUserAccountId());
PayWalletDO payWalletByUser = payWalletDao.getPayWalletByUser(userId);
//需要扣除的云享金
BigDecimal cashAmtPaid = param.getCashAmtPaid();
BigDecimal cashAmtPaid = param.getCashAmtPaid() == null ? BigDecimal.ZERO : param.getCashAmtPaid();
//需要扣除的佣金
BigDecimal salaryAmtPaid = param.getSalaryAmtPaid();
BigDecimal salaryAmtPaid = param.getSalaryAmtPaid() == null ? BigDecimal.ZERO : param.getSalaryAmtPaid();
//如果需要扣除的云享金和佣金是0的话直接返回成功
if(cashAmtPaid.compareTo(BigDecimal.ZERO) == 0 && salaryAmtPaid.compareTo(BigDecimal.ZERO) == 0){
return ResultBody.success();
}
// 这是扣钱的接口 如果小于0表示加钱 不行
if(cashAmtPaid.compareTo(BigDecimal.ZERO) < 0 || salaryAmtPaid.compareTo(BigDecimal.ZERO) < 0){
return ResultBody.error("需要扣除的金额不能为负");
......@@ -663,7 +669,7 @@ public class PayWalletServiceImpl implements PayWalletService {
PayLogDO payLogDO = param.buildPayLog();
payLogDO.setOperateUser(userId);
payLogDO.setPayMethod(1400);
payLogDO.setPayMethod(1900);
payWalletDao.insertPayLogDO(payLogDO);
return ResultBody.success();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论