Forráskód Böngészése

康年堂同步订单状态

yh 2 napja
szülő
commit
49c65d46e7

+ 36 - 1
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreOrderScrmServiceImpl.java

@@ -2034,7 +2034,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
 
     @Override
     @Transactional
-    //类型1支付回调 类型2货到付款
+    //类型1支付回调 类型2物流代收  3.货到付款
     public String payConfirm(Integer type, Long orderId, String payCode, String tradeNo, String bankTransactionId, String bankSerialNo) {
         //支付订单
 //        try {
@@ -2062,6 +2062,40 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
                 return "";
             }
         }else if (type.equals(2)) {
+            FsStorePaymentScrm storePayment = paymentService.selectFsStorePaymentByCode(payCode);
+            if (storePayment == null || !storePayment.getStatus().equals(0) || !(storePayment.getPayMoney().compareTo(BigDecimal.ZERO) > 0)) {
+                return "";
+            }
+            FsStorePaymentScrm storePaymentMap = new FsStorePaymentScrm();
+            storePaymentMap.setPaymentId(storePayment.getPaymentId());
+            storePaymentMap.setStatus(1);
+            storePaymentMap.setPayTime(new Date());
+            storePaymentMap.setTradeNo(tradeNo);
+            storePaymentMap.setBankSerialNo(bankSerialNo);
+            storePaymentMap.setBankTransactionId(bankTransactionId);
+            paymentService.updateFsStorePayment(storePaymentMap);
+
+            //货到付款
+            order = fsStoreOrderMapper.selectFsStoreOrderById(orderId);
+            if (!order.getStatus().equals(OrderInfoEnum.STATUS_0.getValue())) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return "";
+            }
+        } else if (type.equals(3)){
+            // 3.货到付款
+            FsStorePaymentScrm storePayment = paymentService.selectFsStorePaymentByCode(payCode);
+            if (storePayment == null || !storePayment.getStatus().equals(0) || !(storePayment.getPayMoney().compareTo(BigDecimal.ZERO) > 0)) {
+                return "";
+            }
+            FsStorePaymentScrm storePaymentMap = new FsStorePaymentScrm();
+            storePaymentMap.setPaymentId(storePayment.getPaymentId());
+            storePaymentMap.setStatus(1);
+            storePaymentMap.setPayTime(new Date());
+            storePaymentMap.setTradeNo(tradeNo);
+            storePaymentMap.setBankSerialNo(bankSerialNo);
+            storePaymentMap.setBankTransactionId(bankTransactionId);
+            paymentService.updateFsStorePayment(storePaymentMap);
+
             //货到付款
             order = fsStoreOrderMapper.selectFsStoreOrderById(orderId);
             if (!order.getStatus().equals(OrderInfoEnum.STATUS_0.getValue())) {
@@ -2069,6 +2103,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
                 return "";
             }
         }
+
         //写入公司佣金 当有归属公司时只进行公司分佣
         if (order.getCompanyId() != null && order.getCompanyId() > 0) {
             companyService.addCompanyTuiMoney(order);