|
@@ -84,7 +84,7 @@ public class PayShopServiceImpl implements PayShopService {
|
|
|
// 本次付款金额 + 付采美 + 原来已经付过的金额
|
|
|
BigDecimal payedFee = MathUtil.add(MathUtil.add(record.getPayAmount(), record.getPayCmAmount()), shopOrder.getPayedShopAmount());
|
|
|
// 总共要付的金额
|
|
|
- BigDecimal shouldPayFee = MathUtil.add(shopOrder.getShouldPayShopAmount(),shopOrder.getShouldPayCmAmount());
|
|
|
+ BigDecimal shouldPayFee = MathUtil.add(shopOrder.getShouldPayShopAmount(), shopOrder.getShouldPayCmAmount());
|
|
|
|
|
|
if (MathUtil.compare(payedFee, shouldPayFee) == -1) {
|
|
|
// (本次付款金额 + 付采美 + 原来已经付过的金额) < 总共要付的金额
|
|
@@ -417,6 +417,40 @@ public class PayShopServiceImpl implements PayShopService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ @Transactional(readOnly = false, rollbackFor = Exception.class)
|
|
|
+ @Override
|
|
|
+ public ResponseJson backPay(Integer id) {
|
|
|
+ //回滚付款单审核通过的所有操作
|
|
|
+ List<OrderPayShopRecord> records = payShopDao.findPayShopRecords(id);
|
|
|
+ List<Integer> status = new ArrayList<>();
|
|
|
+ AtomicReference<Integer> orderId = new AtomicReference<>();
|
|
|
+ for (OrderPayShopRecord record : records) {
|
|
|
+ NewShopOrder shopOrder = newShopOrderDao.get(record.getShopOrderId());
|
|
|
+ orderId.set(shopOrder.getOrderId());
|
|
|
+ shopOrder.setPayedShopAmount(shopOrder.getPayedShopAmount() - record.getPayAmount());
|
|
|
+ if (shopOrder.getPayedShopAmount() == 0D) {
|
|
|
+ // 已付 - 撤回 = 0
|
|
|
+ shopOrder.setPayStatus(1);
|
|
|
+ } else if (shopOrder.getPayedShopAmount() > 0D) {
|
|
|
+ // 已付 - 撤回 > 0
|
|
|
+ shopOrder.setPayStatus(2);
|
|
|
+ } else {
|
|
|
+ log.info("rollBackApply ----> 付款金额异常, 付款金额大于待付款金额");
|
|
|
+ return ResponseJson.error("付款金额异常, 退款金额大于已付款金额");
|
|
|
+ }
|
|
|
+ //进入付款进行状态
|
|
|
+ shopOrder.setPaying(1);
|
|
|
+ newShopOrderDao.update(shopOrder);
|
|
|
+ status.add(shopOrder.getPayStatus());
|
|
|
+ }
|
|
|
+ payShopDao.backPayRecord(id);
|
|
|
+ Integer orderStatus = status.contains(2) ? 2 : 1;
|
|
|
+ payShopDao.backPayShop(id);
|
|
|
+ newOrderDao.updatePayStatus(orderStatus, orderId.get());
|
|
|
+ return ResponseJson.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public void setSplitAccountDetail(NewShopOrder shopOrder, PayParamBo payParam, List<SplitAccountPo> list) {
|
|
|
// 待分账总金额 = 本次支付金额,单位/元
|
|
|
double splitAmount = payParam.getAllPay();
|