Quellcode durchsuchen

完善聚水潭[兔灵]erp回调接口

cgp vor 1 Woche
Ursprung
Commit
36bf42b932

+ 10 - 5
fs-admin/src/main/java/com/fs/his/controller/JstOrderSyncController.java

@@ -81,16 +81,21 @@ public class JstOrderSyncController {
 
         // 5. 根据 method 反序列化并处理
         try {
-            if ("logistics.upload".equals(method)) {
-                JstLogisticsPushDTO req = objectMapper.readValue(rawBody, JstLogisticsPushDTO.class);
-                jstErpHttpService.jSTanErpLogisticsCallback(req);
-            } else if ("inventory.upload".equals(method)) {
+            if ("inventory.upload".equals(method)) {
+                log.info("处理聚水潭库存同步回调");
                 JstInventoryPushDTO req = objectMapper.readValue(rawBody, JstInventoryPushDTO.class);
                 jstErpHttpService.jSTanErpInventoryCallback(req);
             } else if ("cancel.order".equals(method)) {
+                log.info("处理聚水潭取消订单回调");
                 JstCancelOrderDTO req = objectMapper.readValue(rawBody, JstCancelOrderDTO.class);
                 jstErpHttpService.jSTanErpCancelOrderCallback(req);
-            } else if ("refund.goods".equals(method)) {
+            }
+            else if ("logistics.upload".equals(method)) {
+                log.info("处理聚水潭物流同步回调");
+                JstLogisticsPushDTO req = objectMapper.readValue(rawBody, JstLogisticsPushDTO.class);
+                jstErpHttpService.jSTanErpLogisticsCallback(req);
+            }else if ("refund.goods".equals(method)) {
+                log.info("处理聚水潭售后收货回调");
                 JstRefundGoodsDTO req = objectMapper.readValue(rawBody, JstRefundGoodsDTO.class);
                 jstErpHttpService.jSTanErpRefundGoodsCallback(req);
             } else {

+ 11 - 11
fs-service/src/main/java/com/fs/erp/utils/TlOrderConverter.java

@@ -38,9 +38,9 @@ public class TlOrderConverter {
         //与联系电话字段二者必填一项
         //item.setReceiverMobile(shopOrder.getReceiverPhone());
 
-        // 金额(元 → 
-        item.setPayAmount(toFen(shopOrder.getPayAmount()));
-        item.setFreight(toFen(shopOrder.getFreight()));
+        // 金额(元 → 
+        item.setPayAmount(toYuan(shopOrder.getPayAmount()));
+        item.setFreight(toYuan(shopOrder.getFreight()));
 
         // 其他
         item.setRemark(shopOrder.getRemark());
@@ -90,9 +90,9 @@ public class TlOrderConverter {
         detail.setShopSkuId(dto.getShopSkuId());
 
         // 金额转换:元 → 分(Integer)
-        detail.setAmount(toFen(dto.getAmount()));           // BigDecimal → Integer
-        detail.setPrice(toFen(dto.getPrice()));             // BigDecimal → Integer
-        detail.setBasePrice(toFen(dto.getBasePrice()));     // Double → Integer
+        detail.setAmount(toYuan(dto.getAmount()));           // BigDecimal → Integer
+        detail.setPrice(toYuan(dto.getPrice()));             // BigDecimal → Integer
+        detail.setBasePrice(toYuan(dto.getBasePrice()));     // Double → Integer
 
         detail.setQty(dto.getQty());
         detail.setName(dto.getName());
@@ -118,7 +118,7 @@ public class TlOrderConverter {
         // 如果聚水潭实际要求整数,请将 TlPayDetail.amount 改为 Integer,并用 toFen()
         // 目前按你定义的 Double 处理:假设 dto.getAmount() 是“元”,需转为“分”的 Double
         if (dto.getAmount() != null) {
-            pay.setAmount(toFen(dto.getAmount()));// 元 → 分(Double)
+            pay.setAmount(toYuan(dto.getAmount()));// 元 → 分(Double)
         } else {
             pay.setAmount(null);
         }
@@ -127,14 +127,14 @@ public class TlOrderConverter {
     }
 
     // =============== 工具方法 ===============
-    private static Integer toFen(Double yuan) {
+    private static Integer toYuan(Double yuan) {
         if (yuan == null) return null;
-        return (int) Math.round(yuan * 100);
+        return (int) Math.round(yuan * 1);
     }
 
-    private static Integer toFen(BigDecimal yuan) {
+    private static Integer toYuan(BigDecimal yuan) {
         if (yuan == null) return null;
-        return yuan.multiply(BigDecimal.valueOf(100)).intValue();
+        return yuan.multiply(BigDecimal.valueOf(1)).intValue();
     }
 
     private static Integer safeLongToInt(Long value) {