yaozhixue 1 年之前
父節點
當前提交
faddf4194a

+ 14 - 5
src/main/java/com/zfire/jiasm/syncdata/download/order/InstallBusinessApi.java

@@ -1,5 +1,6 @@
 package com.zfire.jiasm.syncdata.download.order;
 
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.zfire.jiasm.syncdata.base.BaseService;
 import com.zfire.jiasm.syncdata.constant.DictTypeEnum;
@@ -8,9 +9,11 @@ import com.zfire.jiasm.syncdata.constant.TaskConfigEnum;
 import com.zfire.jiasm.syncdata.plus.entity.*;
 import com.zfire.jiasm.syncdata.plus.service.ItfTblAzAssignLcLsDownloadService;
 import com.zfire.jiasm.syncdata.plus.service.OrderBaseService;
+import com.zfire.jiasm.syncdata.plus.service.ProductService;
 import com.zfire.jiasm.syncdata.plus.service.SysDictRefService;
 import com.zfire.jiasm.syncdata.service.AddInstallBusiness;
 import com.zfire.jiasm.syncdata.service.JiasmApi;
+import com.zfire.jiasm.syncdata.service.PublicService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -44,6 +47,9 @@ public class InstallBusinessApi {
     AddInstallBusiness addInstallBusiness;
     @Resource
     SysDictRefService sysDictRefService;
+    @Resource
+    PublicService publicService;
+
 
     // 3:工单落入本地表
     @Scheduled(fixedDelayString = "${installin}")
@@ -54,12 +60,10 @@ public class InstallBusinessApi {
 
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         List<ItfTblAzAssignLcLsDownload> lcls = new ArrayList<>();
-        List<String> lclslist = new ArrayList<>();
-        List<OrderBase> orderBasesRecs = new ArrayList<>();
-        List<String> orderBaselist = new ArrayList<>();
         Map<String, List<SysDictRef>> sysDictRefDLMap = new HashMap<>();
         Map<String, List<SysDictRef>> sysDictRefXLMap = new HashMap<>();
         Map<String, List<SysDictRef>> sysDictRefXiLieMap = new HashMap<>();
+        Map<String,String> productMap = new HashMap<>();
 
         // 提取品牌信息
         Brand brand = baseService.getBrand();
@@ -73,6 +77,9 @@ public class InstallBusinessApi {
         // 提取品牌商对应的系列信息
         sysDictRefXiLieMap = getMap(brand);
 
+        // 提取现有数据
+        publicService.getProductId(productMap);
+
         // 提取待落本地表的数据
         lcls = itfTblAzAssignLcLsDownloadService.lambdaQuery()
                 .eq(ItfTblAzAssignLcLsDownload::getSynStatus, SynStatusEnum.UN_SYN.getCode())
@@ -102,10 +109,12 @@ public class InstallBusinessApi {
             try{
                 if (oldorder !=null){
                     // 修改 TL_SynDataFrom_tbl_az_assign_lc_ls_batch
-                    addInstallBusiness.updateOrderApi(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, brand, item,Boolean.FALSE);
+                    addInstallBusiness.updateOrderApi(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap,
+                            brand, item, Boolean.FALSE, productMap);
                 } else {
                     // 新增 TL_SynDataFrom_tbl_az_assign_lc_ls_batch
-                    addInstallBusiness.addOrderApi(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, brand, item,Boolean.TRUE);
+                    addInstallBusiness.addOrderApi(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap,
+                            brand, item,Boolean.TRUE, productMap);
                 }
             } catch (Exception ex) {
                 ex.printStackTrace();

+ 13 - 2
src/main/java/com/zfire/jiasm/syncdata/download/order/InstallBusinessApiT.java

@@ -11,6 +11,7 @@ import com.zfire.jiasm.syncdata.plus.service.OrderBaseService;
 import com.zfire.jiasm.syncdata.plus.service.SysDictRefService;
 import com.zfire.jiasm.syncdata.service.AddInstallBusiness;
 import com.zfire.jiasm.syncdata.service.JiasmApi;
+import com.zfire.jiasm.syncdata.service.PublicService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -44,6 +45,10 @@ public class InstallBusinessApiT {
     AddInstallBusiness addInstallBusiness;
     @Resource
     SysDictRefService sysDictRefService;
+    @Resource
+    PublicService publicService;
+
+
 
     // 3:工单落入本地表
     @Scheduled(fixedDelayString = "${installin}")
@@ -60,6 +65,7 @@ public class InstallBusinessApiT {
         Map<String, List<SysDictRef>> sysDictRefDLMap = new HashMap<>();
         Map<String, List<SysDictRef>> sysDictRefXLMap = new HashMap<>();
         Map<String, List<SysDictRef>> sysDictRefXiLieMap = new HashMap<>();
+        Map<String,String> productMap = new HashMap<>();
 
         // 提取品牌信息
         Brand brand = baseService.getBrand();
@@ -73,6 +79,9 @@ public class InstallBusinessApiT {
         // 提取品牌商对应的系列信息
         sysDictRefXiLieMap = getMap(brand);
 
+        // 提取现有数据
+        publicService.getProductId(productMap);
+
         // 提取待落本地表的数据
         lcls = itfTblAzAssignLcLsDownloadService.lambdaQuery()
                 .eq(ItfTblAzAssignLcLsDownload::getSynStatus, SynStatusEnum.UN_SYN.getCode())
@@ -102,10 +111,12 @@ public class InstallBusinessApiT {
             try{
                 if (oldorder !=null){
                     // 修改 TL_SynDataFrom_tbl_az_assign_lc_ls_batch
-                    addInstallBusiness.updateOrderApi(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, brand, item,Boolean.FALSE);
+                    addInstallBusiness.updateOrderApi(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap,
+                            brand, item,Boolean.FALSE, productMap);
                 } else {
                     // 新增 TL_SynDataFrom_tbl_az_assign_lc_ls_batch
-                    addInstallBusiness.addOrderApi(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, brand, item,Boolean.TRUE);
+                    addInstallBusiness.addOrderApi(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap,
+                            brand, item,Boolean.TRUE, productMap);
                 }
             } catch (Exception ex) {
                 ex.printStackTrace();

+ 7 - 11
src/main/java/com/zfire/jiasm/syncdata/download/order/RepairBusinessApi.java

@@ -17,10 +17,7 @@ import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /** 接口方式生成工单
@@ -52,13 +49,9 @@ public class RepairBusinessApi {
         if (repairinc.equals(TaskConfigEnum.FALSE.getCode())){
             return;
         }
-
-
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         List<ItfTblAssignDownload> repairRec = new ArrayList<>();
-        List<Long> pgids = new ArrayList<>();
-        List<OrderBase> orderBasesRecs = new ArrayList<>();
-        List<String> orderBaselist = new ArrayList<>();
+        Map<String,String> productMap = new HashMap<>();
 
         // 提取品牌信息
         Brand brand = baseService.getBrand();
@@ -66,6 +59,9 @@ public class RepairBusinessApi {
             return;
         }
 
+        // 提取现有数据
+        publicService.getProductId(productMap);
+
         // 提取品牌商对应的大类信息
         Map<String, List<SysDictRef>> sysDictRefDLMap = publicService.getStringListMap(brand);
         // 提取品牌商对应的小类信息
@@ -109,11 +105,11 @@ public class RepairBusinessApi {
                 if (oldorder !=null){
                     // 修改
                     addRepairBusinessService.updateRepairOrderApi(brand, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, item,
-                            sysDictRefDLMapXq, sysDictRefXLMapXq,Boolean.FALSE);
+                            sysDictRefDLMapXq, sysDictRefXLMapXq,Boolean.FALSE, productMap);
                 } else {
                     // 新增 TL_SynDataFrom_tbl_assign_batch
                     addRepairBusinessService.addRapairOrderApi(brand, item, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap,
-                            sysDictRefDLMapXq, sysDictRefXLMapXq,Boolean.TRUE);
+                            sysDictRefDLMapXq, sysDictRefXLMapXq,Boolean.TRUE, productMap);
                 }
             }catch (Exception ex) {
                 ex.printStackTrace();

+ 7 - 9
src/main/java/com/zfire/jiasm/syncdata/download/order/RepairBusinessApiT.java

@@ -17,10 +17,7 @@ import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /** 接口方式生成工单
@@ -56,9 +53,7 @@ public class RepairBusinessApiT {
 
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         List<ItfTblAssignDownload> repairRec = new ArrayList<>();
-        List<Long> pgids = new ArrayList<>();
-        List<OrderBase> orderBasesRecs = new ArrayList<>();
-        List<String> orderBaselist = new ArrayList<>();
+        Map<String,String> productMap = new HashMap<>();
 
         // 提取品牌信息
         Brand brand = baseService.getBrand();
@@ -66,6 +61,9 @@ public class RepairBusinessApiT {
             return;
         }
 
+        // 提取现有数据
+        publicService.getProductId(productMap);
+
         // 提取品牌商对应的大类信息
         Map<String, List<SysDictRef>> sysDictRefDLMap = publicService.getStringListMap(brand);
         // 提取品牌商对应的小类信息
@@ -109,11 +107,11 @@ public class RepairBusinessApiT {
                 if (oldorder !=null){
                     // 修改
                     addRepairBusinessService.updateRepairOrderApi(brand, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, item,
-                            sysDictRefDLMapXq, sysDictRefXLMapXq,Boolean.FALSE);
+                            sysDictRefDLMapXq, sysDictRefXLMapXq,Boolean.FALSE, productMap);
                 } else {
                     // 新增 TL_SynDataFrom_tbl_assign_batch
                     addRepairBusinessService.addRapairOrderApi(brand, item, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap,
-                            sysDictRefDLMapXq, sysDictRefXLMapXq,Boolean.TRUE);
+                            sysDictRefDLMapXq, sysDictRefXLMapXq,Boolean.TRUE, productMap);
                 }
             }catch (Exception ex) {
                 ex.printStackTrace();

+ 6 - 3
src/main/java/com/zfire/jiasm/syncdata/service/AddInstallBusiness.java

@@ -9,15 +9,18 @@ import java.util.Map;
 
 public interface AddInstallBusiness {
     void addOrder(Map<String, List<SysDictRef>> sysDictRefDLMap, Map<String, List<SysDictRef>> sysDictRefXLMap,
-                  Map<String, List<SysDictRef>> sysDictRefXiLieMap, Brand brand, ItfTblAzAssignLcLsDownload item);
+                  Map<String, List<SysDictRef>> sysDictRefXiLieMap, Brand brand,
+                  ItfTblAzAssignLcLsDownload item, Map<String,String> productMap);
 
     void UpdateOrder(Map<String, List<SysDictRef>> sysDictRefDLMap, Map<String, List<SysDictRef>> sysDictRefXLMap,
                      Map<String, List<SysDictRef>> sysDictRefXiLieMap, Brand brand, ItfTblAzAssignLcLsDownload item);
 
     void addOrderApi(Map<String, List<SysDictRef>> sysDictRefDLMap, Map<String, List<SysDictRef>> sysDictRefXLMap,
-                  Map<String, List<SysDictRef>> sysDictRefXiLieMap, Brand brand, ItfTblAzAssignLcLsDownload item, Boolean flag) throws Exception;
+                  Map<String, List<SysDictRef>> sysDictRefXiLieMap, Brand brand,
+                     ItfTblAzAssignLcLsDownload item, Boolean flag, Map<String,String> productMap) throws Exception;
 
     void updateOrderApi(Map<String, List<SysDictRef>> sysDictRefDLMap, Map<String, List<SysDictRef>> sysDictRefXLMap,
-                     Map<String, List<SysDictRef>> sysDictRefXiLieMap, Brand brand, ItfTblAzAssignLcLsDownload item, Boolean flag) throws Exception;
+                     Map<String, List<SysDictRef>> sysDictRefXiLieMap, Brand brand, ItfTblAzAssignLcLsDownload item,
+                        Boolean flag, Map<String,String> productMap) throws Exception;
 
     }

+ 6 - 4
src/main/java/com/zfire/jiasm/syncdata/service/AddRepairBusinessService.java

@@ -13,28 +13,30 @@ public interface AddRepairBusinessService {
                   Map<String, List<SysDictRef>> sysDictRefXLMap,
                   Map<String, List<SysDictRef>> sysDictRefXiLieMap,
                   Map<String, List<SysDictRef>> sysDictRefDLMapXq,
-                  Map<String, List<SysDictRef>> sysDictRefXLMapXq);
+                  Map<String, List<SysDictRef>> sysDictRefXLMapXq, Map<String,String> productMap);
 
     void updateRapairOrder(Brand brand, Map<String, List<SysDictRef>> sysDictRefDLMap,
                            Map<String, List<SysDictRef>> sysDictRefXLMap,
                            Map<String, List<SysDictRef>> sysDictRefXiLieMap,
                            ItfTblAssignDownload item,
                            Map<String, List<SysDictRef>> sysDictRefDLMapXq,
-                           Map<String, List<SysDictRef>> sysDictRefXLMapXq);
+                           Map<String, List<SysDictRef>> sysDictRefXLMapXq, Map<String,String> productMap);
 
     Boolean addRapairOrderApi(Brand brand, ItfTblAssignDownload item,
                   Map<String, List<SysDictRef>> sysDictRefDLMap,
                   Map<String, List<SysDictRef>> sysDictRefXLMap,
                   Map<String, List<SysDictRef>> sysDictRefXiLieMap,
                   Map<String, List<SysDictRef>> sysDictRefDLMapXq,
-                  Map<String, List<SysDictRef>> sysDictRefXLMapXq,Boolean flag) throws Exception;
+                  Map<String, List<SysDictRef>> sysDictRefXLMapXq,
+                  Boolean flag, Map<String,String> productMap) throws Exception;
 
     Boolean updateRepairOrderApi(Brand brand, Map<String, List<SysDictRef>> sysDictRefDLMap,
                      Map<String, List<SysDictRef>> sysDictRefXLMap,
                      Map<String, List<SysDictRef>> sysDictRefXiLieMap,
                      ItfTblAssignDownload item,
                      Map<String, List<SysDictRef>> sysDictRefDLMapXq,
-                     Map<String, List<SysDictRef>> sysDictRefXLMapXq,Boolean flag) throws Exception;
+                     Map<String, List<SysDictRef>> sysDictRefXLMapXq,
+                                 Boolean flag, Map<String,String> productMap) throws Exception;
 
     Boolean csfun() throws Exception;
 }

+ 2 - 0
src/main/java/com/zfire/jiasm/syncdata/service/PublicService.java

@@ -155,6 +155,8 @@ public interface PublicService {
     Date getYearLastDay(Date date) throws ParseException;
     void setWorkerCertGreeId(WorkerCertGree awc, Map<String,String> wcgids);
     void setCertFlag(String certName, WorkerCertGree awc);
+    void setUserLevel(OrderBase order);
+    void getProductId(Map<String,String> productMap);
 
 
 }

+ 43 - 20
src/main/java/com/zfire/jiasm/syncdata/service/impl/AddInstallBusinessImpl.java

@@ -96,7 +96,7 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void addOrder(Map<String, List<SysDictRef>> sysDictRefDLMap, Map<String, List<SysDictRef>> sysDictRefXLMap,
-                         Map<String, List<SysDictRef>> sysDictRefXiLieMap, Brand brand, ItfTblAzAssignLcLsDownload item) {
+                         Map<String, List<SysDictRef>> sysDictRefXiLieMap, Brand brand, ItfTblAzAssignLcLsDownload item, Map<String,String> productMap) {
         List<OrderReAppointment> oa = new ArrayList<>();
         List<OrderAppraise> oanew = new ArrayList<>();
         List<OrderProduct> orderProducts = new ArrayList<>();
@@ -143,7 +143,8 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
         // 获取工单师傅信息
         OrderWorker orderWorker = getOrderWorker(orderBase);
         // 获取工单机型 + 生成采集明细数据+附件数据
-        getOrderProduct(orderBase, orderProducts, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, orderMx,oids,odfs);
+        getOrderProduct(orderBase, orderProducts, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap,
+                orderMx,oids,odfs, productMap);
         // 获取工单操作明细- 操作日志表
         List<OrderInstallOperatingLog> oiolList = getOrderInstallOperatingLogs(fkmxs, orderBase,item);
         // 获取安装费用清单 - 对应扩展表
@@ -176,7 +177,8 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void addOrderApi(Map<String, List<SysDictRef>> sysDictRefDLMap, Map<String, List<SysDictRef>> sysDictRefXLMap,
-                         Map<String, List<SysDictRef>> sysDictRefXiLieMap, Brand brand, ItfTblAzAssignLcLsDownload item, Boolean flag) throws Exception {
+                         Map<String, List<SysDictRef>> sysDictRefXiLieMap, Brand brand,
+                            ItfTblAzAssignLcLsDownload item, Boolean flag, Map<String,String> productMap) throws Exception {
         List<OrderReAppointment> oa = new ArrayList<>();
         List<OrderAppraise> oanew = new ArrayList<>();
         List<OrderProduct> orderProducts = new ArrayList<>();
@@ -216,7 +218,8 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
         // 获取工单师傅信息
         OrderWorker orderWorker = getOrderWorker(orderBase);
         // 获取工单机型 + 生成采集明细数据+附件数据
-        getOrderProduct(orderBase, orderProducts, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, orderMx,oids,odfs);
+        getOrderProduct(orderBase, orderProducts, sysDictRefDLMap, sysDictRefXLMap,
+                sysDictRefXiLieMap, orderMx,oids,odfs, productMap);
 
         // 获取工单操作明细- 操作日志表
         List<OrderInstallOperatingLog> oiolList = getOrderInstallOperatingLogs(fkmxs, orderBase, item);
@@ -341,8 +344,8 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
         OrderWorker own =getOrderWorkerUpdate(old.getId(), upInfo, newLCLS);
 
         // 获取产品明细要同步的数据 -只存在修改,减少与增加的情况不存在
-        getOrderProductsUpdate(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, old, newLCLS,
-                item.getDownloadTaskNo(),mxsynreqids,orderProductsUpdate,oids,delOrderInstallDetail,odfs,delOrderProduct);
+        /*getOrderProductsUpdate(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, old, newLCLS,
+                item.getDownloadTaskNo(),mxsynreqids,orderProductsUpdate,oids,delOrderInstallDetail,odfs,delOrderProduct);*/
 
         // 获取操作明细同步数据,即反馈明细
         addoiolList = getOrderInstallOperatingLogsadd(item, old, newLCLS, synreqids);
@@ -380,7 +383,8 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void updateOrderApi(Map<String, List<SysDictRef>> sysDictRefDLMap, Map<String, List<SysDictRef>> sysDictRefXLMap,
-                               Map<String, List<SysDictRef>> sysDictRefXiLieMap, Brand brand, ItfTblAzAssignLcLsDownload item, Boolean flag) throws Exception {
+                               Map<String, List<SysDictRef>> sysDictRefXiLieMap, Brand brand,
+                               ItfTblAzAssignLcLsDownload item, Boolean flag, Map<String,String> productMap) throws Exception {
         List<Long> synReqYfYyIds = new ArrayList<>();
         List<OrderReAppointment> addoalists = new ArrayList<>();
         List<ItfTblAzAssignMxDownload> mxsynreqids = new ArrayList<>();
@@ -426,7 +430,8 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
 
         // 获取产品明细要同步的数据 -只存在修改,减少与增加的情况不存在
         getOrderProductsUpdate(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, old, newLCLS,
-                item.getDownloadTaskNo(),mxsynreqids,orderProductsUpdate,oids,delOrderInstallDetail,odfs,delOrderProduct);
+                item.getDownloadTaskNo(),mxsynreqids,orderProductsUpdate,oids,delOrderInstallDetail,
+                odfs,delOrderProduct, productMap);
 
         // 获取操作明细同步数据,即反馈明细
         addoiolList = getOrderInstallOperatingLogsadd(item, old, newLCLS, synreqids);
@@ -944,7 +949,7 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
                                         List<OrderProduct> orderProductsUpdate,
                                         List<OrderInstallDetail> oids,List<String> oiddels,
                                         List<OrderDetailFile> odfs,
-                                        List<String> delOrderProduct) {
+                                        List<String> delOrderProduct, Map<String,String> productMap) {
         List<OrderProduct> orderProductsOld = new ArrayList<>();
         List<String> orderMxList = new ArrayList<>();
 
@@ -964,7 +969,7 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
 
         // 新增或是修改
         if (addOrUp(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, old, newLCLS, synreqids,
-                orderProductsUpdate, oids, oiddels, odfs, orderProductsOld,orderMx)){
+                orderProductsUpdate, oids, oiddels, odfs, orderProductsOld,orderMx, productMap)){
             return;
         }
 
@@ -991,7 +996,7 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
                             List<ItfTblAzAssignMxDownload> synreqids, List<OrderProduct> orderProductsUpdate,
                             List<OrderInstallDetail> oids, List<String> oiddels, List<OrderDetailFile> odfs,
                             List<OrderProduct> orderProductsOld,
-                            List<ItfTblAzAssignMxDownload> orderMx) {
+                            List<ItfTblAzAssignMxDownload> orderMx, Map<String,String> productMap) {
         // 提取现有的采集明细数据
         List<OrderInstallDetail> oldOids = new ArrayList<>();
         Map<String,List<OrderProduct>> oldProductMap = new HashMap<>();
@@ -1005,7 +1010,8 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
         for (ItfTblAzAssignMxDownload mx: orderMx){
             // 这里做法为重新生成新的产品机型,然后与本地比较是新增还是修改
             // 生成工单产品对象 获取新同步的工单机型
-            OrderProduct n = getProductInfo(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, newLCLS, mx);
+            OrderProduct n = getProductInfo(sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap,
+                    newLCLS, mx, productMap);
             // 存在修改 不存在新增
             for (OrderProduct o : orderProductsOld) {
                 if (n.getPgmxid().equals(o.getPgmxid())) {
@@ -1116,7 +1122,8 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
     private OrderProduct getProductInfo(Map<String, List<SysDictRef>> sysDictRefDLMap,
                                         Map<String, List<SysDictRef>> sysDictRefXLMap,
                                         Map<String, List<SysDictRef>> sysDictRefXiLieMap,
-                                        OrderBase newLCLS, ItfTblAzAssignMxDownload mx) {
+                                        OrderBase newLCLS, ItfTblAzAssignMxDownload mx,
+                                        Map<String,String> productMap) {
         OrderProduct op = new OrderProduct();
         op.setId(publicService.getUUID());
         op.setOrderBaseId(newLCLS.getId());
@@ -1146,7 +1153,13 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
             }
         }
 
-        op.setProductId(mx.getJxno());
+        // 改成 product 表中的 product_id
+        // op.setProductId(mx.getJxno());
+        op.setProductId("");
+        if (productMap.containsKey(mx.getJxno())){
+            op.setProductId(productMap.get(mx.getJxno()));
+        }
+
         op.setProductName(mx.getJxmc());
         op.setInsideCode(mx.getNjtm());
         op.setOutCode(mx.getWjtm());
@@ -2594,10 +2607,10 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
 
         // pgmxid主键
         // 生成工单产品对象
-        for (ItfTblAzAssignMxDownload mx:orderMx){
+        /*for (ItfTblAzAssignMxDownload mx:orderMx){
             OrderProduct op = getOrderProduct(orderBase, orderProducts, sysDictRefDLMap, sysDictRefXLMap,
                     sysDictRefXiLieMap, mx);
-        }
+        }*/
     }
 
 
@@ -2605,7 +2618,7 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
             List<SysDictRef>> sysDictRefDLMap, Map<String, List<SysDictRef>> sysDictRefXLMap,
                                  Map<String, List<SysDictRef>> sysDictRefXiLieMap,
                                  List<ItfTblAzAssignMxDownload> orderMx,List<OrderInstallDetail> oids,
-                                 List<OrderDetailFile> odfs) {
+                                 List<OrderDetailFile> odfs, Map<String,String> productMap) {
         int insertnum=1;
         int outid=1;
 
@@ -2614,7 +2627,7 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
             insertnum=1;
             outid=1;
             // 生成工单产品对象
-            OrderProduct op = getOrderProduct(orderBase, orderProducts, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, mx);
+            OrderProduct op = getOrderProduct(orderBase, orderProducts, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, mx, productMap);
             // 生成采集明细数据+附件数据
             // 总数量一条条插入,内外机数量不再拆分
             // extracted(orderBase, oids, odfs, insertnum, outid, mx, op);
@@ -2649,7 +2662,7 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
 
     private OrderProduct getOrderProduct(OrderBase orderBase, List<OrderProduct> orderProducts,
                                  Map<String, List<SysDictRef>> sysDictRefDLMap, Map<String, List<SysDictRef>> sysDictRefXLMap,
-                                 Map<String, List<SysDictRef>> sysDictRefXiLieMap, ItfTblAzAssignMxDownload mx) {
+                                 Map<String, List<SysDictRef>> sysDictRefXiLieMap, ItfTblAzAssignMxDownload mx, Map<String,String> productMap) {
         OrderProduct op = new OrderProduct();
         op.setId(publicService.getUUID());
         op.setOrderBaseId(orderBase.getId());
@@ -2678,7 +2691,12 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
         }
 
         // 改成 product 表中的 product_id
-        op.setProductId(mx.getJxno());
+        // op.setProductId(mx.getJxno());
+        op.setProductId("");
+        if (productMap.containsKey(mx.getJxno())){
+            op.setProductId(productMap.get(mx.getJxno()));
+        }
+
         op.setProductName(mx.getJxmc());
         op.setInsideCode(mx.getNjtm());
         op.setOutCode(mx.getWjtm());
@@ -2845,6 +2863,9 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
 
         // 生成工单基础表 对象
         orderBase = azGDLcLsDownloadMapper.getOrderBase(orderPar);
+        // 处理用户等级
+        publicService.setUserLevel(orderBase);
+
         // 未完成数据修改 如果工单关闭就用wwsl,否则用安装数量
         if (!(item.getDqjd().equals(1304) || item.getDqjd().equals(1309))){
             orderBase.setUndoneNum(item.getAzsl());
@@ -2924,6 +2945,8 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
         orderPar.setBrandId(brand.getBrandId());
         // 生成工单基础表 对象
         orderBase = azGDLcLsDownloadMapper.getOrderBase(orderPar);
+        // 处理用户等级
+        publicService.setUserLevel(orderBase);
 
         // 总部的为 1302 无对应关系,根据工单的过程处理
         if (StringUtils.isEmpty(orderBase.getOrderStatus())){

+ 38 - 13
src/main/java/com/zfire/jiasm/syncdata/service/impl/AddRepairBusinessServiceImpl.java

@@ -109,7 +109,7 @@ public class AddRepairBusinessServiceImpl implements AddRepairBusinessService {
                          Map<String, List<SysDictRef>> sysDictRefXLMap,
                          Map<String, List<SysDictRef>> sysDictRefXiLieMap,
                          Map<String, List<SysDictRef>> sysDictRefDLMapXq,
-                         Map<String, List<SysDictRef>> sysDictRefXLMapXq) {
+                         Map<String, List<SysDictRef>> sysDictRefXLMapXq, Map<String,String> productMap) {
         List<ItfTblAssignXzydDownload> yds = itfTblAssignXzydDownloadService.lambdaQuery()
                 .eq(ItfTblAssignXzydDownload::getDownloadTaskNo,item.getDownloadTaskNo()).list();
 
@@ -140,7 +140,7 @@ public class AddRepairBusinessServiceImpl implements AddRepairBusinessService {
                             Map<String, List<SysDictRef>> sysDictRefXiLieMap,
                             ItfTblAssignDownload item,
                             Map<String, List<SysDictRef>> sysDictRefDLMapXq,
-                            Map<String, List<SysDictRef>> sysDictRefXLMapXq) {
+                            Map<String, List<SysDictRef>> sysDictRefXLMapXq, Map<String,String> productMap) {
         List<ItfTblAssignXzydDownload> yds = itfTblAssignXzydDownloadService.lambdaQuery()
                 .eq(ItfTblAssignXzydDownload::getDownloadTaskNo, item.getDownloadTaskNo()).list();
 
@@ -160,7 +160,7 @@ public class AddRepairBusinessServiceImpl implements AddRepairBusinessService {
         // 工单扩展信息更新
         getOrderInstall(item, order,sysDictRefXLMapXq);
         // 维修单明细表更新 TL_SynDataFrom_tbl_assign_mx
-        generateMxUpdate(brand, item, order, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap);
+        generateMxUpdate(brand, item, order, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, productMap);
         // 处理维修单过程反馈(只新增不修改)  放入操作日志表 TL_SynDataFrom_tbl_assign_fkmx
         generateFkmxUpdate(item, order);
         // 处理用户评价数据 TL_SynDataFrom_tbl_assign_satisfaction
@@ -178,7 +178,8 @@ public class AddRepairBusinessServiceImpl implements AddRepairBusinessService {
                          Map<String, List<SysDictRef>> sysDictRefXLMap,
                          Map<String, List<SysDictRef>> sysDictRefXiLieMap,
                          Map<String, List<SysDictRef>> sysDictRefDLMapXq,
-                         Map<String, List<SysDictRef>> sysDictRefXLMapXq,Boolean flag) throws Exception {
+                         Map<String, List<SysDictRef>> sysDictRefXLMapXq,
+                                     Boolean flag, Map<String,String> productMap) throws Exception {
         OrderWorker orderWorker = new OrderWorker();
         OrderRepair or = new OrderRepair();
         List<OrderProduct> addmx = new ArrayList<>();
@@ -206,7 +207,8 @@ public class AddRepairBusinessServiceImpl implements AddRepairBusinessService {
         // 获取工单扩展信息 需求大小类在这里处理
         getOrderInstallApi(item, order, sysDictRefDLMapXq, sysDictRefXLMapXq,or);
         // 处理维修单明细表 TL_SynDataFrom_tbl_assign_mx
-        generateMxApi(brand, item, order, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, addmx, ups);
+        generateMxApi(brand, item, order, sysDictRefDLMap, sysDictRefXLMap,
+                sysDictRefXiLieMap, addmx, ups, productMap);
         // 处理维修单过程反馈表 放入操作日志表 TL_SynDataFrom_tbl_assign_fkmx
         generateFkmxApi(item, fkmxups, orols, order);
         // 处理用户评价数据 TL_SynDataFrom_tbl_assign_satisfaction
@@ -232,7 +234,7 @@ public class AddRepairBusinessServiceImpl implements AddRepairBusinessService {
                             Map<String, List<SysDictRef>> sysDictRefXiLieMap,
                             ItfTblAssignDownload item,
                             Map<String, List<SysDictRef>> sysDictRefDLMapXq,
-                            Map<String, List<SysDictRef>> sysDictRefXLMapXq,Boolean flag) throws Exception {
+                            Map<String, List<SysDictRef>> sysDictRefXLMapXq,Boolean flag, Map<String,String> productMap) throws Exception {
         String orderStatus="";
         List<OrderProduct> addmx = new ArrayList<>();
         List<ItfTblAssignMxDownload> upMxd = new ArrayList<>();
@@ -276,7 +278,7 @@ public class AddRepairBusinessServiceImpl implements AddRepairBusinessService {
         // 工单扩展信息更新
         getOrderInstallApi(item, order,sysDictRefDLMapXq,sysDictRefXLMapXq,or);
         // 维修单明细表更新 TL_SynDataFrom_tbl_assign_mx
-        generateMxUpdateApi(brand, item, order, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, addmx, upMxd );
+        generateMxUpdateApi(brand, item, order, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, addmx, upMxd , productMap);
         // 处理维修单过程反馈(只新增不修改)  放入操作日志表 TL_SynDataFrom_tbl_assign_fkmx
         generateFkmxUpdateApi(item, order, orols, fkmxd);
 
@@ -1130,6 +1132,8 @@ public class AddRepairBusinessServiceImpl implements AddRepairBusinessService {
         orderPar.setSynReqId(item.getSynReqId());
         orderPar.setBrandId(brand.getBrandId());
         OrderBase upOrder = repairDownloadMapper.getUpOrderBase(orderPar);
+        // 处理用户等级
+        publicService.setUserLevel(upOrder);
 
         // 消息来源不能为空,为空时默认电话
         if (StringUtils.isEmpty(upOrder.getInfoSource())){
@@ -2523,7 +2527,7 @@ public class AddRepairBusinessServiceImpl implements AddRepairBusinessService {
                             Map<String, List<SysDictRef>> sysDictRefXLMap,
                             Map<String, List<SysDictRef>> sysDictRefXiLieMap,
                                List<OrderProduct> addmx,
-                               List<ItfTblAssignMxDownload> ups) {
+                               List<ItfTblAssignMxDownload> ups, Map<String,String> productMap) {
         List<ItfTblAssignMxDownload> mxRec = new ArrayList<>();
         WebsitFWS websitFWS = new WebsitFWS();
 
@@ -2539,6 +2543,14 @@ public class AddRepairBusinessServiceImpl implements AddRepairBusinessService {
             mxreq.setSynReqId(Long.valueOf(rec.getSynReqId()));
             mxreq.setBrandId(brand.getBrandId());
             OrderProduct op = repairMxDownloadMapper.getMx(mxreq);
+
+            // 改成 product 表中的 product_id
+            if (productMap.containsKey(op.getProductId())){
+                op.setProductId(productMap.get(op.getProductId()));
+            } else {
+                op.setProductId("");
+            }
+
             // 销售单位处理 sale_websit
             websitFWS = publicService.shxswdToptxswd(op.getSaleWebsit(),order);
             op.setSaleWebsit(websitFWS.getWebsitId());
@@ -2585,7 +2597,7 @@ public class AddRepairBusinessServiceImpl implements AddRepairBusinessService {
     private void generateMxUpdate(Brand brand, ItfTblAssignDownload item, OrderBase order,
                                   Map<String, List<SysDictRef>> sysDictRefDLMap,
                                   Map<String, List<SysDictRef>> sysDictRefXLMap,
-                                  Map<String, List<SysDictRef>> sysDictRefXiLieMap) {
+                                  Map<String, List<SysDictRef>> sysDictRefXiLieMap, Map<String,String> productMap) {
         List<ItfTblAssignMxDownload> mxRec = new ArrayList<>();
         List<OrderProduct> addmx = new ArrayList<>();
         List<OrderProduct> upmx = new ArrayList<>();
@@ -2610,7 +2622,8 @@ public class AddRepairBusinessServiceImpl implements AddRepairBusinessService {
             OrderPar mxreq = new OrderPar();
             mxreq.setSynReqId(Long.valueOf(rec.getSynReqId()));
             mxreq.setBrandId(brand.getBrandId());
-            OrderProduct op = getOrderProduct(item, order, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, rec, mxreq);
+            OrderProduct op = getOrderProduct(item, order, sysDictRefDLMap, sysDictRefXLMap,
+                    sysDictRefXiLieMap, rec, mxreq, productMap);
 
             // 存在修改
             if (opsMap.containsKey(op.getPgmxid())){
@@ -2646,7 +2659,7 @@ public class AddRepairBusinessServiceImpl implements AddRepairBusinessService {
                                   Map<String, List<SysDictRef>> sysDictRefXLMap,
                                   Map<String, List<SysDictRef>> sysDictRefXiLieMap,
                                      List<OrderProduct> addmx,
-                                     List<ItfTblAssignMxDownload> upMxd) {
+                                     List<ItfTblAssignMxDownload> upMxd, Map<String,String> productMap) {
         List<ItfTblAssignMxDownload> mxRec = new ArrayList<>();
 
         // 提取明细表数据
@@ -2661,7 +2674,8 @@ public class AddRepairBusinessServiceImpl implements AddRepairBusinessService {
             OrderPar mxreq = new OrderPar();
             mxreq.setSynReqId(Long.valueOf(rec.getSynReqId()));
             mxreq.setBrandId(brand.getBrandId());
-            OrderProduct op = getOrderProduct(item, order, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap, rec, mxreq);
+            OrderProduct op = getOrderProduct(item, order, sysDictRefDLMap, sysDictRefXLMap, sysDictRefXiLieMap,
+                    rec, mxreq, productMap);
             addmx.add(op);
 
             ItfTblAssignMxDownload up = new ItfTblAssignMxDownload();
@@ -2697,10 +2711,17 @@ public class AddRepairBusinessServiceImpl implements AddRepairBusinessService {
                                          Map<String, List<SysDictRef>> sysDictRefDLMap,
                                          Map<String, List<SysDictRef>> sysDictRefXLMap,
                                          Map<String, List<SysDictRef>> sysDictRefXiLieMap,
-                                         ItfTblAssignMxDownload rec, OrderPar mxreq) {
+                                         ItfTblAssignMxDownload rec, OrderPar mxreq, Map<String,String> productMap) {
         WebsitFWS websitFWS = new WebsitFWS();
         OrderProduct op = repairMxDownloadMapper.getMx(mxreq);
 
+        // 改成 product 表中的 product_id
+        if (productMap.containsKey(op.getProductId())){
+            op.setProductId(productMap.get(op.getProductId()));
+        } else {
+            op.setProductId("");
+        }
+
         // 其他部分参数赋值
         // 销售单位处理 sale_websit
         websitFWS = publicService.shxswdToptxswd(op.getSaleWebsit(),order);
@@ -2788,6 +2809,10 @@ public class AddRepairBusinessServiceImpl implements AddRepairBusinessService {
         orderPar.setSynReqId(item.getSynReqId());
         orderPar.setBrandId(brand.getBrandId());
         OrderBase order = repairDownloadMapper.getOrderBase(orderPar);
+        // 处理用户等级
+        publicService.setUserLevel(order);
+
+
         order.setId("G" + IdWorker.getIdStr());
         if (isChildInfo){
             order.setIsChildInfo("YES");

+ 1 - 0
src/main/java/com/zfire/jiasm/syncdata/service/impl/GLPPLeiBieServiceImpl.java

@@ -682,6 +682,7 @@ public class GLPPLeiBieServiceImpl implements GLPPLeiBieService {
         v.setProductBrandId(brandRec.getBrandId());
         v.setProductBrandName(brandRec.getBrand());
         v.setName(item.getJxmc());
+        // 对应三方工单产品表的jxno
         v.setJxid(item.getJxid());
         v.setMainId(String.valueOf(item.getSpid()));
         v.setMainName(item.getSpmc());

+ 38 - 0
src/main/java/com/zfire/jiasm/syncdata/service/impl/PublicServiceImpl.java

@@ -117,6 +117,8 @@ public class PublicServiceImpl implements PublicService {
     InsureService insureService;
     @Resource
     OrderDetailFileService orderDetailFileService;
+    @Resource
+    ProductService productService;
 
 
 
@@ -1754,6 +1756,42 @@ public class PublicServiceImpl implements PublicService {
         }
     }
 
+    @Override
+    public void setUserLevel(OrderBase order){
+        Map<String,String> userLevel = new HashMap<>();
+        if (StringUtils.isEmpty(order.getVip())){
+            return;
+        }
+
+        List<SysDict> sysDicts = sysDictService.lambdaQuery()
+                .eq(SysDict::getDictType, DictTypeEnum.DICT_TYPE_USER_LEVEL.getCode()).list();
+        if (CollectionUtils.isNotEmpty(sysDicts)){
+            sysDicts.stream().forEach(event->{
+                userLevel.put(event.getDictValue(),event.getDictCode());
+            });
+            sysDicts.clear();
+        }
+
+        if (userLevel.containsKey(order.getVip())){
+            order.setVip(userLevel.get(order.getVip()));
+        }
+    }
+
+    @Override
+    public void getProductId(Map<String,String> productMap){
+        Brand brand = baseService.getBrand();
+        // 提取现有数据
+        List<Product> oldSysProduct = productService.lambdaQuery()
+                .eq(Product::getProductBrandId, brand.getBrandId()).list();
+        if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isNotEmpty(oldSysProduct)){
+            oldSysProduct.stream().forEach(event->{
+                productMap.put(event.getJxid(), event.getProductId());
+            });
+            oldSysProduct.clear();
+        }
+    }
+
+
     private void setLocationByAddress(OrderBase orderBase) {
         if (StringUtils.isEmpty(orderBase.getLng()) || StringUtils.isEmpty(orderBase.getLat())) {
             String add = "";

+ 4 - 1
src/main/resources/mapper/GDOrderBaseMapper.xml

@@ -66,7 +66,10 @@
           case when length(a.lat) >12  then left(a.lat,12) else IFNULL(a.lat,'') end as weidu,
           IFNULL(a.pgguid, '') as pgguid,q.demand_type_id as xxlbid,
           IFNULL(a.user_attr_id, 1) as yhsxid,IFNULL(a.out_wxcount,1) as wxcount,
-          '1' as extjson5,IFNULL(a.vip,'')  as vip
+          '1' as extjson5,
+          case when a.vip = '1' then 'VIP1' when a.vip = '2' then 'VIP2' when a.vip = '3' then 'VIP3'
+                    when a.vip = '4' then 'VIP4' when a.vip = '5' then 'VIP5'
+                    else a.vip end as vip
         from order_base a
             left join sys_dict_ref c on c.dict_code=a.main_id and c.brand_id = #{request.brandId} and c.dict_type='MAIN_TYPE'
             left join order_state_contrast m on m.order_state=a.order_status and m.state_type=60 and m.brand_id = #{request.brandId} and m.flag=1

+ 1 - 1
src/main/resources/mapper/RepairDownloadMapper.xml

@@ -42,7 +42,7 @@
 
     <select id="getUpOrderBase" parameterType="com.zfire.jiasm.syncdata.parameter.OrderPar" resultType="com.zfire.jiasm.syncdata.plus.entity.OrderBase">
         select a.yhmc as user_name,a.quhao as area_code,a.yddh as user_mobile,a.dhhm as tel_phone,
-               a.email,a.yddh2 as user_mobile2,
+               a.email,a.yddh2 as user_mobile2,a.vip,
                a.sfen as province,a.cshi as city,a.xian as area,a.xzhen as street,
                a.sfenid as province_id,a.cshiid as city_id,a.xianid as area_id,a.xzhenid as street_id,
                a.dizi as address,a.beiz as remark,IFNULL(a.last_modified_date,a.zjczsj) as update_time,