浏览代码

拉去0120分支

yousongbo 3 周之前
父节点
当前提交
1969c30150

+ 1 - 1
suishenbang-quartz/src/main/java/com/dgtly/quartz/task/RyTask.java

@@ -126,7 +126,7 @@ public class RyTask
 
     /**HANA已冻结经销商**/
     public void hanaFreezeCustomer()throws Exception{
-        hanaOrderComponent.hanaFreezeCustomer();
+        hanaOrderComponent.hanaFreezeCustomer("");
     }
 
 

+ 34 - 17
suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/service/HanaOrderComponent.java

@@ -3,6 +3,7 @@ package com.dgtly.sync.service;
 import cn.hutool.core.date.DateTime;
 import com.dgtly.common.config.Global;
 import com.dgtly.common.utils.DateUtils;
+import com.dgtly.common.utils.StringUtils;
 import com.dgtly.common.utils.http.HttpUtils;
 import com.dgtly.system.service.IMetaHanaDeliverSignService;
 import com.dgtly.system.service.ISysUserOrderAuthorService;
@@ -689,24 +690,40 @@ public class HanaOrderComponent {
     }
 
     /**HANA已冻结经销商**/
-    public void hanaFreezeCustomer()throws Exception{
+    public void hanaFreezeCustomer(String  customer)throws Exception{
         Connection con = this.getHanaConnection();
-        PreparedStatement pstmt = con.prepareStatement(" select a.KUNNR from (SELECT   s.KUNNR \n" +
-                "                FROM ERP.KNVV s \n" +
-                "                WHERE \n" +
-                "                 (s.SPART = (case   when  SPART='14' then '14' \n" +
-                "                                 when SPART='15' then '15'    when SPART='16' then '16'  \n" +
-                "               when SPART='19' then '19' \n" +
-                "               when SPART='29' then '29' \n" +
-                "                                 else  '39' end )   and (s.LIFSD IS NULL or s.LIFSD = '')  AND s.VTWEG = 'D9'and s.VKORG = 'S200' and s.KVGR3 not in ('D03')) or (s.KVGR3 = 'D03'  and (s.LIFSD IS NULL or s.LIFSD = '') AND s.VTWEG = 'D9' )order by s.SPART asc)a \n" +
-                "                 group by a.KUNNR  ");
-        Long startTime = System.currentTimeMillis();
-        ResultSet rs = pstmt.executeQuery();
-        Long endTime = System.currentTimeMillis();
-        log.info("NotFreezeCustomer查询用时:" + (endTime - startTime)+"毫秒");
-        this.createFreezeCustomerTxt(rs);
-        this.runLoadFreezeCustomer();
-        this.closeConnection(con, pstmt);
+        if (StringUtils.isNotEmpty(customer)){
+            PreparedStatement pstmt = con.prepareStatement(" select a.KUNNR from (SELECT   s.KUNNR \n" +
+                    "                FROM ERP.KNVV s \n" +
+                    "                WHERE \n" +
+                    "                 (s.SPART = (case   when  SPART='14' then '14' \n" +
+                    "                                 when SPART='15' then '15'    when SPART='16' then '16'  \n" +
+                    "               when SPART='19' then '19' \n" +
+                    "               when SPART='29' then '29' \n" +
+                    "                                 else  '39' end )   and (s.LIFSD IS NULL or s.LIFSD = '')  AND s.VTWEG = 'D9'and s.VKORG = 'S200' and s.KVGR3 not in ('D03')) or (s.KVGR3 = 'D03'  and (s.LIFSD IS NULL or s.LIFSD = '') AND s.VTWEG = 'D9' )order by s.SPART asc)a \n" +
+                    "                 group by a.KUNNR  ");
+            Long startTime = System.currentTimeMillis();
+            ResultSet rs = pstmt.executeQuery();
+            Long endTime = System.currentTimeMillis();
+            log.info("NotFreezeCustomer查询用时:" + (endTime - startTime)+"毫秒");
+        }else {
+            PreparedStatement pstmt = con.prepareStatement(" select a.KUNNR from (SELECT   s.KUNNR \n" +
+                    "                FROM ERP.KNVV s \n" +
+                    "                WHERE \n" +
+                    "                 (s.SPART = (case   when  SPART='14' then '14' \n" +
+                    "                                 when SPART='15' then '15'    when SPART='16' then '16'  \n" +
+                    "               when SPART='19' then '19' \n" +
+                    "               when SPART='29' then '29' \n" +
+                    "                                 else  '39' end )   and (s.LIFSD IS NULL or s.LIFSD = '')  AND s.VTWEG = 'D9'and s.VKORG = 'S200' and s.KVGR3 not in ('D03')) or (s.KVGR3 = 'D03'  and (s.LIFSD IS NULL or s.LIFSD = '') AND s.VTWEG = 'D9' )order by s.SPART asc)a \n" +
+                    "                 group by a.KUNNR  ");
+            Long startTime = System.currentTimeMillis();
+            ResultSet rs = pstmt.executeQuery();
+            Long endTime = System.currentTimeMillis();
+            log.info("NotFreezeCustomer查询用时:" + (endTime - startTime)+"毫秒");
+            this.createFreezeCustomerTxt(rs);
+            this.runLoadFreezeCustomer();
+            this.closeConnection(con, pstmt);
+        }
     }
 
     /**HANA已复核线下月底手动过账的交货单仍需自提同步*/