提交 c26be54c 作者: 张小凤

Requirements(update)

上级 94afe77f
......@@ -172,7 +172,7 @@ public class RequirementsController extends BaseController {
}
@ApiModelProperty(value = "new--小程序————飞手端确认结算")
@ApiOperation(value = "new--小程序————飞手端确认结算")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("confirmSettlement")
public ResultBody confirmSettlement(HttpServletRequest request) {
......
......@@ -935,121 +935,6 @@ public class RequirementsServiceImpl implements RequirementsService {
//表示订单计算完成,需要支付的钱都算出来了
walletFlowVO.toString();
System.out.println(walletFlowVO);
/* orderNumberDTO.setWeChatPay(walletFlowVO.getWeChat());
if (orderNumberDTO.getWeChatPay() != null) {
orderNumberDTO.setPaymentOrderNumber(randomOrderCode());
}*/
// return ResultBody.success(orderNumberDTO);
/* //云享金
BigDecimal cashAmount = requirementsInfoDO.getCashAmount();
//佣金
BigDecimal salaryAmount = requirementsInfoDO.getSalaryAmount();
//微信金额
BigDecimal weChat = requirementsInfoDO.getWeChat();
//需要支付的总金额
BigDecimal totalAmount = requirementsInfoDO.getTotalAmount();
System.out.println(totalAmount);
totalAmount = totalAmount.multiply(new BigDecimal(0.3));
//云享金
BigDecimal cashAmt = payWalletDTO.getCashAmt();
//佣金
BigDecimal salaryAmt = payWalletDTO.getSalaryAmt();
String json = stringRedisTemplate.opsForValue().get(requirementsInfoDO.getWechatPayOrderNumber() + requirementsInfoDO.getUserAccountId());
GetOrderNumberDTO orderNumberDTO = JSONObject.parseObject(json, GetOrderNumberDTO.class);
if (cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
return ResultBody.error(ResultEnum.PLEASE_SELECT_PAYMENT);
}
if (!cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
//总金额大于云享金剩余的金额
if (totalAmount.compareTo(cashAmt) == 1) {
return ResultBody.error(ResultEnum.OVER_THE_TOTAL);
}
//总金额小于云享金剩余的金额
if (totalAmount.compareTo(cashAmt) == -1) {
walletFlowVO.setCashAmount(totalAmount);
}
walletFlowVO.setCashAmount(totalAmount.negate());
//冻结云享金
extracted(walletFlowVO, requirementsInfoDO);
}
if (cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
//总金额大于佣金剩余的金额
if (totalAmount.compareTo(salaryAmt) == 1) {
return ResultBody.error(ResultEnum.SALARY_PAYMENT_FAILURE);
}
//总金额小于佣金剩余的金额
if (totalAmount.compareTo(salaryAmount) == -1) {
walletFlowVO.setSalaryAmount(totalAmount);
}
walletFlowVO.setSalaryAmount(totalAmount.negate());
extracted(walletFlowVO, requirementsInfoDO);
}
//单独微信制度 可以进行支付
if (cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal weChatPay = orderNumberDTO.getWeChatPay().negate();
walletFlowVO.setWeChat(weChatPay);
extracted(walletFlowVO, requirementsInfoDO);
}
//云享金与佣金剩余金额足够及不足够
if (!cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
BigDecimal add = cashAmt.add(salaryAmt);
if (totalAmount.compareTo(add) == 1) {
return ResultBody.error(ResultEnum.CASH_SALARY_PAYMENT_FAILURE);
}
//云享金不足佣金可以补上
if (totalAmount.compareTo(add) == -1) {
BigDecimal cash = cashAmt.subtract(totalAmount);
if (cash.compareTo(BigDecimal.ZERO) <= 0) {
BigDecimal salary = salaryAmt.subtract(cash.negate());
System.out.println(salary);
//云享金
walletFlowVO.setCashAmount(cashAmt.negate());
walletFlowVO.setSalaryAmount(cashAmt.negate());
extracted(walletFlowVO, requirementsInfoDO);
}
//云享金足够 不扣除佣金剩余的金额
if (cash.compareTo(BigDecimal.ZERO) > 0) {
walletFlowVO.setCashAmount(cash.negate());
extracted(walletFlowVO, requirementsInfoDO);
}
}
}
//选择佣金或者微信支付
if (cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal salary = salaryAmt.subtract(totalAmount);
if (salary.compareTo(BigDecimal.ZERO) >= 0) {
walletFlowVO.setSalaryAmount(totalAmount);
extracted(walletFlowVO, requirementsInfoDO);
}
if (salary.compareTo(BigDecimal.ZERO) < 0) {
BigDecimal weChatPay = orderNumberDTO.getWeChatPay();
walletFlowVO.setSalaryAmount(salary);
walletFlowVO.setWeChat(weChatPay.negate());
extracted(walletFlowVO, requirementsInfoDO);
}
return ResultBody.success(orderNumberDTO);
}
if (!cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal cash = cashAmt.subtract(totalAmount);
BigDecimal salary = salaryAmt.subtract(cash.negate());
// 如果云享金充足
if (cash.compareTo(BigDecimal.ZERO) >= 0) {
walletFlowVO.setCashAmount(totalAmount);
}
if (cash.compareTo(BigDecimal.ZERO) < 0 && salary.compareTo(BigDecimal.ZERO) >= 0) {
walletFlowVO.setCashAmount(cashAmt.negate());
walletFlowVO.setSalaryAmount(cash);
extracted(walletFlowVO, requirementsInfoDO);
}
if (cash.compareTo(BigDecimal.ZERO) < 0 && salary.compareTo(BigDecimal.ZERO) < 0) {
walletFlowVO.setCashAmount(cashAmt);
walletFlowVO.setSalaryAmount(salaryAmt);
walletFlowVO.setWeChat(orderNumberDTO.getWeChatPay());
}
}*/
RequirementsServiceDO requirementsServiceDO = new RequirementsServiceDO(pilot, requirementsInfoDO);
requirementsServiceDO.setCashAmount(walletFlowVO.getCashAmount());
requirementsServiceDO.setSalaryAmount(walletFlowVO.getSalaryAmount());
......
......@@ -238,7 +238,8 @@
ra.total_amount,
ra.order_amount,
ra.update_order_amount,
ri.insurance
ri.insurance,
ri.publish
FROM requirements_info ri
left join requirements_amount ra
on ra.requirements_info_id = ri.id and ri.user_account_id = ra.user_account_id
......@@ -349,7 +350,7 @@
salary_amount,
wechat_pay_order_number, service_flow_id, preempt_total_amount)
VALUES (#{requirementsInfoId}, #{serviceDictionaryId}, #{pilotCertificationId}, #{pilotCertificationUserId},
#{teamId}, #{teamUserId}, #{cashAmount}, #{weChat}, #{salaryAmount}, #{wechatPayOrderNumber}, 200,
#{teamId}, #{teamUserId}, #{cashAmount}, #{weChat}, #{salaryAmount}, #{wechatPayOrderNumber}, 2,
preemptTotalAmount);
</insert>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论