Bläddra i källkod

拉取iBOSS功能发布test

sh4wmoo 3 år sedan
förälder
incheckning
622a3046ff

+ 13 - 23
src/main/java/com/dk/mnls_mp/infrastructure/web/Scheduler.java

@@ -1,8 +1,10 @@
 package com.dk.mnls_mp.infrastructure.web;
 
+import com.dk.mnls_mp.constant.Constant;
 import com.dk.mnls_mp.infrastructure.base.ResponseCodeEnum;
 import com.dk.mnls_mp.mapper.basic.WCFinfoMapper;
 import com.dk.mnls_mp.service.basic.SynchFacService;
+import com.dk.mnls_mp.service.iboss.PullIbossDataService;
 import com.dk.mnls_mp.service.synchCode.SynchCodeService;
 import com.dongke.base.exceptionHandler.ResponseResultVO;
 import lombok.extern.slf4j.Slf4j;
@@ -24,6 +26,8 @@ public class Scheduler {
     @Autowired
     private SynchCodeService synchCodeService;
 
+    @Autowired
+    PullIbossDataService pullIbossDataService;
 
     /**
      * @author :    sh4wmoo
@@ -34,10 +38,10 @@ public class Scheduler {
      * 4.调用同步iBOSS产品编码。
      * 5.调用同步iBOSS bom方法。
      */
-    @Scheduled(cron = "0 0 3 * * ?")
-    public void syncGoodsData() {
-        Date startTime;
-        String type = "";
+//    @Scheduled(cron = "0 0 0 * * ?")
+//    public void syncGoodsData() {
+//        Date startTime;
+//        String type = "";
 
 //        4.调用抓取crm层级方法。
 //        startTime = new Date();
@@ -66,31 +70,17 @@ public class Scheduler {
 //        ResponseResultVO res7 = synchCodeService.synchCode(map);
 //        checkRes(res7, type, startTime);
 
-    }
+//    }
 
     /**
      * @author : sh4wmoo
      * @date : 2021-9-6 10:09
      * @desc : 独立定时任务 拉取iBOSS单据信息
      */
-//    @Scheduled(cron = "0 0 0 * * ?")
-//    public void pullIBOSSData() {
-//        asyncService.AsyncPullIbossData(Constant.PullDataType.ORGANIZATION);
-//        asyncService.AsyncPullIbossData(Constant.PullDataType.STAFF);
-//        asyncService.AsyncPullIbossData(Constant.PullDataType.STAFF_COMMISSION);
-//        asyncService.AsyncPullIbossData(Constant.PullDataType.SALES_MARGIN);
-//        asyncService.AsyncPullIbossData(Constant.PullDataType.RECEIVE);
-//        asyncService.AsyncPullIbossData(Constant.PullDataType.PRESTORED);
-//        asyncService.AsyncPullIbossData(Constant.PullDataType.SALES_AMOUNT);
-//        asyncService.AsyncPullIbossData(Constant.PullDataType.INVENTORY_CHECK_DETAIL);
-//        asyncService.AsyncPullIbossData(Constant.PullDataType.OUT_ORDER_DETAIL);
-//        asyncService.AsyncPullIbossData(Constant.PullDataType.SALES_RETURN);
-//        asyncService.AsyncPullIbossData(Constant.PullDataType.SALES_ORDER_UPDATE);
-//        asyncService.AsyncPullIbossData(Constant.PullDataType.SALES_ORDER);
-//        asyncService.AsyncPullIbossData(Constant.PullDataType.OUT_ORDER);
-//        asyncService.AsyncPullIbossData(Constant.PullDataType.INVENTORY);
-//        asyncService.AsyncPullIbossData(Constant.PullDataType.ORDER_DETAIL);
-//    }
+    @Scheduled(cron = "30 0 0 * * ?")
+    public void pullIBOSSData() {
+        pullIbossDataService.pullIbossData(Constant.PullDataType.INVENTORY,null);
+    }
 
     /**
      * @author : sh4wmoo

+ 4 - 30
src/main/java/com/dk/mnls_mp/service/iboss/PullIbossDataService.java

@@ -41,39 +41,13 @@ public class PullIbossDataService {
 
         PullOrderDetail pullOrderDetail = new PullOrderDetail();
         List<Customer> customers = new ArrayList<>();
-        Boolean flag = (Boolean) map.get("flag");
-        if (type.isTruncation() != null && !flag) {
-            if (type.isTruncation()) {
-                //截断表
-                pullOrderDetailService.deleteAll(type);
-            } else {
-                //根据系统参数删除历史数据
-                pullOrderDetailService.deleteBatch(type);
-            }
-        }
 
         //插入履历总单
         pullOrderDetail.setPullTime(new Date());
-        pullOrderDetailMapper.insertDate(pullOrderDetail);//返回履历总单id
-
-        if (flag) {
-            pullOrderDetail.setPullFlag(flag);
-            pullOrderDetail.setAccountDateFrom((String) map.get("accountDateFrom"));
-            pullOrderDetail.setAccountDateTo((String) map.get("accountDateTo"));
-            customers = customerMapper.selectPullcus(map.get("customerid"));//没有时间,不关联履历
-        } else {
-            pullOrderDetail.setPullFlag(flag);
-            //是否与时间有关
-            if (type.isTruncation() != null && type.isTruncation()) {
-                customers = customerMapper.selectAllCusForPullDetail();//没有时间,不关联履历
-            } else {
-                customers = customerMapper.selectAllCusAndPullTime(new HashMap<String, Object>() {{
-                    put("type", type.getId());
-                }});
-            }
-        }
-
-
+        //返回履历总单id
+        pullOrderDetailMapper.insertDate(pullOrderDetail);
+        //没有时间,不关联履历
+        customers = customerMapper.selectAllCusForPullDetail();
         //循环调用
         for (Customer it : customers) {
             ResponseResultVO r = pullOrderDetailService.callWebService(it, pullOrderDetail, type);

+ 2 - 0
src/main/java/com/dk/mnls_mp/service/pullDetail/PullOrderDetailService.java

@@ -177,6 +177,8 @@ public class PullOrderDetailService {
                 ibossDataService.insert(IBOSSData);
                 //修改状态为成功
                 status=1;
+            }else{
+                log.error("调用iBOSS接口异常,返回值=>{}",resultVO);
             }
 
             //记录履历

+ 6 - 1
src/main/java/com/dk/mnls_mp/test/ApiTest.java

@@ -44,9 +44,14 @@ public class ApiTest {
         Customer customer=customerMapper.selectById(212);
         pullOrderDetailService.callWebService(customer, null,Constant.PullDataType.INVENTORY);
     }
+    /**
+     * @desc   : 拉去iBOSS库存信息
+     * @author : 张潇木
+     * @date   : 2022/9/26 15:06
+     */
     @Test
     public void pullIbossData() {
-        pullIbossDataService.pullIbossData(Constant.PullDataType.INVENTORY,new HashMap(){{put("flag",false);}});
+        pullIbossDataService.pullIbossData(Constant.PullDataType.INVENTORY,null);
     }
 
     @Test