Quellcode durchsuchen

修改制单金额业务

wjj vor 9 Stunden
Ursprung
Commit
17db210fe6

+ 8 - 6
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreOrderScrmServiceImpl.java

@@ -768,8 +768,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
             FsStoreOrderScrm storeOrder = new FsStoreOrderScrm();
             //扣减金额
             if (ObjectUtil.isNotNull(param.getReceipt())) {
-                storeOrder.setReceiptId(param.getReceipt().getId());
-                storeOrder.setDeductionPrice(param.getReceipt().getTotalFee());
+
                 //收款记录更新
                 try {
                       FsCompanyExternalPayReceipt receipt = new FsCompanyExternalPayReceipt();
@@ -913,15 +912,17 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
                     }
                     storeOrder.setStatus(0);
                     storeOrder.setPayPrice(param.getPrepaidAmount());
+                    storeOrder.setPayDelivery(storeOrder.getTotalPrice().subtract(storeOrder.getPayPrice()));
                     storeOrder.setPayType("2");
                 }
                 if (receipt != null) {
+                    storeOrder.setReceiptId(param.getReceipt().getId());
+                    storeOrder.setDeductionPrice(param.getReceipt().getTotalFee());
                     int compareTo = receipt.getTotalFee().compareTo(storeOrder.getPayPrice());
                     if(param.getPayType().equals("1")) {
                         //全款
                         if (compareTo < 0) {
-                            storeOrder.setTotalPrice(storeOrder.getTotalPrice().subtract(receipt.getTotalFee()));
-                            storeOrder.setPayPrice(storeOrder.getPayPrice().subtract(receipt.getTotalFee()));
+                            storeOrder.setPayPrice(storeOrder.getTotalPrice().subtract(receipt.getTotalFee()));
                             storeOrder.setDeductionPrice(receipt.getTotalFee());
                             storeOrder.setStatus(0);
                         } else {
@@ -934,11 +935,11 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
                     } else if (param.getPayType().equals("2")) {
                         //物流代收
                         if (compareTo < 0) {
-                            storeOrder.setTotalPrice(storeOrder.getTotalPrice().subtract(receipt.getTotalFee()));
-                            storeOrder.setPayPrice(storeOrder.getPayPrice().subtract(receipt.getTotalFee()));
+                            storeOrder.setPayPrice(storeOrder.getTotalPrice().subtract(receipt.getTotalFee()));
                             storeOrder.setPayMoney(receipt.getTotalFee());
                             storeOrder.setDeductionPrice(receipt.getTotalFee());
                             storeOrder.setStatus(1);
+                            storeOrder.setPayDelivery(storeOrder.getTotalPrice().subtract(storeOrder.getPayPrice()));
                         } else {
                             storeOrder.setPayType("1");
                             storeOrder.setPayMoney(storeOrder.getTotalPrice());
@@ -949,6 +950,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
                     //物理代收付款
                     if (param.getPayType().equals("2")) {
                         storeOrder.setPaid(1);
+                        storeOrder.setPayDelivery(storeOrder.getTotalPrice());
                     }
                 }
             }