浏览代码

赋值sku长宽高脚本

24282 1 年之前
父节点
当前提交
b8b05ddd15

+ 44 - 0
sd-starter/src/test/java/SyncSpec.java

@@ -0,0 +1,44 @@
+import cn.hutool.core.convert.Convert;
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
+import com.sd.SdApplication;
+import com.sd.business.entity.sku.po.SkuSpec;
+import com.sd.business.service.sku.SkuSpecService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 赋值sku规格长宽高
+ */
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SdApplication.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
+public class SyncSpec {
+
+    @Autowired
+    private SkuSpecService skuSpecService;
+
+    @DSTransactional
+    @Test
+    public void test() {
+        List<SkuSpec> list = skuSpecService.list();
+
+        for (SkuSpec skuSpec : list) {
+
+            String name = skuSpec.getName();
+            String[] split = name.split("\\*");
+
+            skuSpec.setLength(Convert.toBigDecimal(split[0].substring(split[0].indexOf(":") + 1)));
+            skuSpec.setWidth(Convert.toBigDecimal(split[1].replace("cm", "")));
+            skuSpec.setHeight(Convert.toBigDecimal(split[2].substring(0, split[2].indexOf("mm"))).divide(BigDecimal.TEN));
+
+        }
+
+        skuSpecService.updateBatchById(list);
+    }
+
+}

+ 12 - 12
sd-wln/src/main/java/com/sd/wln/service/impl/WlnOrderServiceImpl.java

@@ -161,7 +161,7 @@ public class WlnOrderServiceImpl implements WlnOrderService {
         OrderInfo orderInfo = new OrderInfo();
         orderInfo.setId(IdWorker.getId());
         orderInfo.setSource(2);
-        orderInfo.setTaxRate(new BigDecimal("10.00"));
+        orderInfo.setTaxRate(BigDecimal.TEN);
         orderInfo.setTag("0");
         orderInfo.setSettlementStatus(1);
         orderInfo.setType(1);
@@ -194,18 +194,7 @@ public class WlnOrderServiceImpl implements WlnOrderService {
         orderInfo.setPackingLabor(BigDecimal.ZERO);
         orderInfo.setManagementFee(BigDecimal.ZERO);
         orderInfo.setPackagingMaterialCost(BigDecimal.ZERO);
-
-        // 赋值订单异常类型
         orderInfo.setExceptionType(OrderExceptionTypeEnum.NORMAL.getKey().toString());
-        if (orderInfo.getWlnStatus() == 10) {
-            addExceptionType(orderInfo, OrderExceptionTypeEnum.ORDER_CLOSURE);
-        }
-        if (orderInfo.getWlnStatus() == 11) {
-            addExceptionType(orderInfo, OrderExceptionTypeEnum.ORDER_ABORT);
-        }
-        if (orderInfo.getWlnStatus() == 12) {
-            addExceptionType(orderInfo, OrderExceptionTypeEnum.ORDER_EXCEPTION_HANDLING);
-        }
 
         // 事业部id
         Department department = context.getDepartment();
@@ -222,6 +211,17 @@ public class WlnOrderServiceImpl implements WlnOrderService {
             orderInfo.setStatus(OrderStatusEnum.UNDER_REVIEW.getKey());
         }
 
+        // 赋值订单异常类型
+        if (orderInfo.getWlnStatus() == 10) {
+            addExceptionType(orderInfo, OrderExceptionTypeEnum.ORDER_CLOSURE);
+        }
+        if (orderInfo.getWlnStatus() == 11) {
+            addExceptionType(orderInfo, OrderExceptionTypeEnum.ORDER_ABORT);
+        }
+        if (orderInfo.getWlnStatus() == 12) {
+            addExceptionType(orderInfo, OrderExceptionTypeEnum.ORDER_EXCEPTION_HANDLING);
+        }
+
         return orderInfo;
     }
 

+ 4 - 0
sd-wln/src/main/java/com/sd/wln/util/WlnUtil.java

@@ -32,6 +32,7 @@ public class WlnUtil {
 
     /**
      * 获取sku分类
+     * { @link <a href="https://open-doc.hupun.com/#/apidetial/215049398424697496/676664580630525341/%E5%95%86%E5%93%81"/> }
      */
     public static List<JSONObject> getSkuClassifyList() throws Exception {
         SkuClassifyParam param = new SkuClassifyParam();
@@ -50,6 +51,7 @@ public class WlnUtil {
 
     /**
      * 获取sku列表
+     * { @link <a href="https://open-doc.hupun.com/#/apidetial/406602329304549469/712989787127325553/%E5%9F%BA%E7%A1%80%E4%BF%A1%E6%81%AF"/a> }
      */
     public static List<JSONObject> getSkuList(Integer page, Integer limit, Long modifyTime) throws Exception {
         GoodsSpecParam param = new GoodsSpecParam();
@@ -72,6 +74,7 @@ public class WlnUtil {
 
     /**
      * 获取订单
+     * { @link <a href="https://open-doc.hupun.com/#/apidetial/771605118380008557/160966424263944454/%E9%94%80%E5%94%AE"/a> }
      */
     public static List<JSONObject> getOrderList(Integer page, Integer limit, Long startTime, Long endTime, String warehouseCode) throws Exception {
         TradesParam param = new TradesParam();
@@ -141,6 +144,7 @@ public class WlnUtil {
 
     /**
      * 获取出库单
+     * { @link <a href="https://open-doc.hupun.com/#/apidetial/771605118380008557/204222651687169249/%E9%94%80%E5%94%AE"/a>}
      */
     public static List<JSONObject> getOutboundOrder(Integer page, Integer limit, Long startTime, Long endTime) throws IOException {
         StockParam param = new StockParam();