瀏覽代碼

打印加签字符串,更改查询库存 SQL

lvjian 2 年之前
父節點
當前提交
1f3e60fb20

+ 3 - 3
eccs-biz/src/main/java/com/emato/biz/mapper/warehouse/WbInveMngMapper.java

@@ -29,10 +29,10 @@ public interface WbInveMngMapper {
     void saveOrUpdate(OWbInveMng oWbInveMng);
 
     /**
-     * 根据 SKU 查询库存数量
+     * 根据条件查询库存数量
      *
-     * @param sku
+     * @param query
      * @return
      */
-    OWbInveMng selectBySku(String sku);
+    OWbInveMng selectOne(OWbInveMng query);
 }

+ 4 - 1
eccs-biz/src/main/java/com/emato/biz/service/impl/InventoryServiceImpl.java

@@ -100,8 +100,11 @@ public class InventoryServiceImpl implements InventoryService {
             List<InventoryDataPushVo> inventoryData = inventoryDataDB.stream().map(inventoryDataDTO -> {
                 // 将展示 sku 转为跨境电商 sku 查询库存
                 String kjdsSku = inventoryDataDTO.getSku().replace("ISZWCW", "ISCWCN");
+                OWbInveMng query = new OWbInveMng();
+                query.setSku(kjdsSku);
+                query.setMerchSn("mhbs764449385500180480");
                 // 查询 sku
-                OWbInveMng wbInveMng = wbInveMngMapper.selectBySku(kjdsSku);
+                OWbInveMng wbInveMng = wbInveMngMapper.selectOne(query);
                 if (Objects.nonNull(wbInveMng)) {
                     int validNum = Math.toIntExact(wbInveMng.getValidNum());
                     inventoryDataDTO.seteMatou(inventoryDataDTO.geteMatou() + validNum);

+ 13 - 17
eccs-biz/src/main/resources/mapper/biz/mall/InventoryDataMapper.xml

@@ -38,14 +38,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             t2.valid_num
         FROM
             wb_merch_shop_inve t
-            INNER JOIN mall_goods t1 ON t.sku = t1.sku
-            LEFT JOIN wb_inve_mng t2 ON t2.sku = t.sku
-        <where>
-            t.is_valid = '0'
-            AND t2.inve_status = '0'
-            AND t2.is_valid = '0'
-            AND t1.is_delete = '0'
-        </where>
+                INNER JOIN mall_goods t1 ON t.sku = t1.sku
+                AND t.is_valid = '0'
+                AND t1.is_delete = '0'
+                LEFT JOIN wb_inve_mng t2 ON t2.sku = t.sku
+                AND t2.inve_status = '0'
+                AND t2.is_valid = '0'
         <if test="pageIndex != null and pageSize != null">
             limit #{pageIndex}, #{pageSize}
         </if>
@@ -54,17 +52,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <!-- 查询库存数据总条数 -->
     <select id="selectInventoryTotal" resultType="int">
         SELECT
-            COUNT(1)
+            count( 1 )
         FROM
             wb_merch_shop_inve t
-            INNER JOIN mall_goods t1 ON t.sku = t1.sku
-            LEFT JOIN wb_inve_mng t2 ON t2.sku = t.sku
-        <where>
-            t.is_valid = '0'
-            AND t2.inve_status = '0'
-            AND t2.is_valid = '0'
-            AND t1.is_delete = '0'
-        </where>
+                INNER JOIN mall_goods t1 ON t.sku = t1.sku
+                AND t.is_valid = '0'
+                AND t1.is_delete = '0'
+                LEFT JOIN wb_inve_mng t2 ON t2.sku = t.sku
+                AND t2.inve_status = '0'
+                AND t2.is_valid = '0'
     </select>
 
     <select id="getInventoryTotal" resultType="java.lang.Integer">

+ 11 - 4
eccs-biz/src/main/resources/mapper/biz/warehouse/WbInveMngMapper.xml

@@ -65,14 +65,21 @@
             t.mod_time
     </sql>
 
-    <!-- 根据 sku 查询库存 -->
-    <select id="selectBySku" resultMap="OWbInveMngResult">
+    <!-- 根据条件查询库存 -->
+    <select id="selectOne" resultMap="OWbInveMngResult" resultType="com.emato.biz.domain.warehouse.OWbInveMng">
         <include refid="selectOWbInveMngColumn"/>
         FROM
             wb_inve_mng t
-        WHERE
+        <where>
             t.is_valid = '0'
-            AND t.sku = #{sku}
+            <if test="merchSn != null  and merchSn != ''"> and t.merch_sn = #{merchSn}</if>
+            <if test="thirdMerchSn != null and thirdMerchSn != ''">or t.third_merch_sn = #{thirdMerchSn}</if>
+            <if test="merchName != null  and merchName != ''"> and merch_name like concat('%', #{merchName}, '%')</if>
+            <if test="emsClassCode != null  and emsClassCode != ''"> and ems_class_code = #{emsClassCode}</if>
+            <if test="sku != null  and sku != ''"> and sku = #{sku}</if>
+            <if test="inveStatus != null  and inveStatus != ''"> and inve_status = #{inveStatus}</if>
+            <if test="wareSn != null  and wareSn != ''"> and ware_sn = #{wareSn}</if>
+        </where>
     </select>
 
     <!-- 查询仓库库存 -->

+ 5 - 0
eccs-common/src/main/java/com/emato/common/utils/oms/request/OmsSign.java

@@ -1,6 +1,9 @@
 package com.emato.common.utils.oms.request;
 
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.util.*;
 
 /**
@@ -10,6 +13,7 @@ import java.util.*;
  */
 public class OmsSign {
 
+    private static final Logger log = LoggerFactory.getLogger(OmsSign.class);
 
     /**
      * 加签
@@ -30,6 +34,7 @@ public class OmsSign {
             sign.append(m.getKey()+ m.getValue());
         }
         sign.insert(0,secretKey);
+        log.info("加签字符串 => {}", sign);
         return MD5Util.getMd5(sign.toString());
     }