yaozhixue 1 year ago
parent
commit
a25fd9948b
34 changed files with 560 additions and 267 deletions
  1. 23 4
      src/main/java/com/zfire/jiasm/syncdata/download/worker/GLPPWXGQueryAdd.java
  2. 4 1
      src/main/java/com/zfire/jiasm/syncdata/service/GLPPWXGQueryAddService.java
  3. 2 1
      src/main/java/com/zfire/jiasm/syncdata/service/PublicService.java
  4. 484 225
      src/main/java/com/zfire/jiasm/syncdata/service/impl/GLPPWXGQueryAddServiceImpl.java
  5. 27 0
      src/main/java/com/zfire/jiasm/syncdata/service/impl/PublicServiceImpl.java
  6. 8 32
      src/main/java/com/zfire/jiasm/syncdata/service/impl/UploadWorkeCertificateServiceImpl.java
  7. 2 2
      src/main/java/com/zfire/jiasm/syncdata/service/impl/UploadWorkerTOGreeServiceImpl.java
  8. 2 0
      src/main/resources/bootstrap-dev.properties
  9. 2 0
      src/main/resources/bootstrap-prd.properties
  10. 4 2
      src/main/resources/bootstrap-prdt.properties
  11. 2 0
      src/main/resources/bootstrap-test.properties
  12. 0 0
      syncdata/202309/DispatchFiles/IdentityImgs/S21006890028/[192.13.182.37_7006]5b32ee7be5b0435a95447686508d72da.jpg
  13. 0 0
      syncdata/202309/DispatchFiles/IdentityImgs/S21065170001/[10.2.46.192_7006]a21d3602821f4e0e9bca1bc058c54a9a.jpg
  14. 0 0
      syncdata/202309/DispatchFiles/IdentityImgs/S92198070017/[10.2.46.190_7006]bcbe5b5463594035b7ffb155d5c6bd0e.jpg
  15. 0 0
      syncdata/202309/pgxtwxguploadfile/201804/S2100689201804gkzy001524878645030.jpg
  16. 0 0
      syncdata/202309/pgxtwxguploadfile/201804/S2100689201804zgzh001524902918498.jpg
  17. 0 0
      syncdata/202309/pgxtwxguploadfile/201805/S2100603201805zgzh001525856000269.jpg
  18. 0 0
      syncdata/202309/pgxtwxguploadfile/201805/S2100689201805gkzy001525751308606.jpg
  19. 0 0
      syncdata/202309/pgxtwxguploadfile/201805/S2100689201805zgzh001525750946077.jpg
  20. 0 0
      syncdata/202309/pgxtwxguploadfile/201901/S2106141201901gkzy001546567078254.doc
  21. 0 0
      syncdata/202309/pgxtwxguploadfile/201901/S2106141201901zgzh001546567107239.docx
  22. 0 0
      syncdata/202309/pgxtwxguploadfile/201903/S2100603201903zgzh001553062999175.jpg
  23. 0 0
      syncdata/202309/pgxtwxguploadfile/201904/S2101511201904gkzy001555832070235.jpg
  24. 0 0
      syncdata/202309/pgxtwxguploadfile/201904/S2101511201904zgzh001555832110732.jpg
  25. 0 0
      syncdata/202309/pgxtwxguploadfile/201907/S2101289201907gkzy001564541409425.jpg
  26. 0 0
      syncdata/202309/pgxtwxguploadfile/201907/S2101289201907zgzh001564541469563.jpg
  27. 0 0
      syncdata/202309/pgxtwxguploadfile/201909/S2106517201909gkzy001569386832037.jpg
  28. 0 0
      syncdata/202309/pgxtwxguploadfile/201910/S2106533201910gkzy001572504283654.jpg
  29. 0 0
      syncdata/202309/pgxtwxguploadfile/202004/S2106141202004zgzh001588124410235.jpg
  30. 0 0
      syncdata/202309/pgxtwxguploadfile/202004/S2106533202004zgzh001586591398067.jpg
  31. 0 0
      syncdata/202309/pgxtwxguploadfile/202006/S2105261202006gkzy001591842715939.jpg
  32. 0 0
      syncdata/202309/pgxtwxguploadfile/202006/S2106141202006gkzy001592292107583.jpg
  33. 0 0
      syncdata/202309/pgxtwxguploadfile/202009/S2106732202009gkzy001599270581046.jpg
  34. 0 0
      syncdata/202309/pgxtwxguploadfile/202010/S2100689202010gkzy001603001293799.jpg

+ 23 - 4
src/main/java/com/zfire/jiasm/syncdata/download/worker/GLPPWXGQueryAdd.java

@@ -36,16 +36,15 @@ public class GLPPWXGQueryAdd {
     private String wxgwztc = "";
     @Value("${zjzbxc}")
     private String zjzbxc = "";
+    @Value("${sfzjxxc}")
+    private String sfzjxxc = "";
+
     @Resource
     GLPPWXGQueryAddService glppwxgQueryAddService;
 
 
 
 
-
-
-
-
     /**
      * 从格力总部同步师傅的证件照
      * 只做新增(王总的要求)
@@ -150,6 +149,26 @@ public class GLPPWXGQueryAdd {
 
 
 
+    // 从总部生成平台网点证件数据
+    @Scheduled(fixedDelayString = "${sfzjxx}")
+    public void processsfzj() throws Exception {
+        if (sfzjxxc.equals(TaskConfigEnum.FALSE.getCode())){
+            return;
+        }
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+        log.info("开始同步获取总部网点师傅证件信息: \uF0B7{}",sdf.format(new Date()));
+        try {
+            glppwxgQueryAddService.extractedCertGreeInfo();
+            log.info("同步获取总部网点师傅证件信息结束: \uF0B7{}",sdf.format(new Date()));
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            log.info("同步获取总部网点师傅证件信息失败: \uF0B7{}",sdf.format(new Date()));
+        }
+    }
+
+
 
 
 

+ 4 - 1
src/main/java/com/zfire/jiasm/syncdata/service/GLPPWXGQueryAddService.java

@@ -2,9 +2,10 @@ package com.zfire.jiasm.syncdata.service;
 
 public interface GLPPWXGQueryAddService {
 
-    void extractedCertInfoBak() throws Exception;
     void extractedCertInfo() throws Exception;
 
+
+
     void extractedAddCategory() throws Exception;
 
     void extractedwxgQueryAdd() throws Exception;
@@ -18,4 +19,6 @@ public interface GLPPWXGQueryAddService {
     void extractedMXFile();
     void extractedTMSYFile();
 
+    void extractedCertGreeInfo() throws Exception;
+
 }

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

@@ -153,7 +153,8 @@ public interface PublicService {
 
     Date getYearFirstDay(Date date) throws ParseException;
     Date getYearLastDay(Date date) throws ParseException;
-
+    void setWorkerCertGreeId(WorkerCertGree awc, Map<String,String> wcgids);
+    void setCertFlag(String certName, WorkerCertGree awc);
 
 
 }

+ 484 - 225
src/main/java/com/zfire/jiasm/syncdata/service/impl/GLPPWXGQueryAddServiceImpl.java

@@ -92,72 +92,41 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
     OrderDetailFileService orderDetailFileService;
     @Resource
     OrderInstallDetailCodeService orderInstallDetailCodeService;
+    @Resource
+    WorkerCertGreeService workerCertGreeService;
+
 
 
     @Override
-    public void extractedCertInfo() throws Exception {
+    public void extractedCertGreeInfo() throws Exception {
         WangdianWxgVos wvos = new WangdianWxgVos();
-        List<WorkerCert> addList = new ArrayList<>();
         Map<String,Object> req = new HashMap<>();
         Map<String,List<Worker>> workerIdcardMap = new HashMap<>();
-        Map<String,List<Worker>> workerWorkeridMap = new HashMap<>();
-        Map<String,List<WorkerCert>> WorkerCertWorkerIdMaps = new HashMap<>();
         List<ItfTblWangdianWxgDownload> wxgDownladRecs = new ArrayList<>();
-        List<String> workerIdandNames = new ArrayList<>();
-        List<InsureWorkerCommercial> insurecs = new ArrayList<>();
-        List<InsureWorkerCommercialFile> insurefiles = new ArrayList<>();
-        List<String> bxWorkerIdWebsitIds = new ArrayList<>();
-        Map<String,List<WebsitWorker>> websitWorderwidwdidMap = new HashMap<>();
-        Map<String,List<WebsitWorker>> addBxWorkers = new HashMap<>();
-        List<WebsitWorker> upWebsitWorkers = new ArrayList<>();
-
-        // 提取品牌信息
-        Brand brand = baseService.getBrand();
-        if (brand == null) {
-            return;
+        List<WorkerCertGree> wcgs = new ArrayList<>();
+        Map<String,String> wcgids = new HashMap<>();
+        Map<String,String> wcgzjs = new HashMap<>();
+
+
+        List<WorkerCertGree> wcgsold = workerCertGreeService.lambdaQuery().list();
+        if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isNotEmpty(wcgsold)){
+            wcgsold.stream().forEach(event->{
+                wcgids.put(event.getWorkerId() + event.getBrandWebsitId() + event.getCertName(),
+                        event.getWorkerCertGreeId());
+                wcgzjs.put(event.getWorkerId() + event.getBrandWebsitId() + event.getCertName(),
+                        event.getOutFileUrl() + event.getOutFileUrl2());
+            });
+            wcgsold.clear();
         }
 
+
         List<Worker> oldWorkerRec =  workerService.lambdaQuery()
                 .select(Worker::getIdcard,Worker::getWorkerId,Worker::getWorkerName,Worker::getMobile).list();
         if (CollectionUtils.isNotEmpty(oldWorkerRec)){
             workerIdcardMap = oldWorkerRec.stream().collect(Collectors.groupingBy(Worker::getIdcard));
-            workerWorkeridMap = oldWorkerRec.stream().collect(Collectors.groupingBy(Worker::getWorkerId));
             oldWorkerRec.clear();
         }
 
-        // 提取待同步获取保险信息的师傅数据
-        List<WebsitWorker> wwrecords = websitWorkerService.lambdaQuery()
-                .isNull(WebsitWorker::getOutZjlj)
-                .list();
-        if (CollectionUtils.isNotEmpty(wwrecords)){
-            addBxWorkers = wwrecords.stream().collect(Collectors.groupingBy(WebsitWorker::getWorkerId));
-
-            /*wwrecords.stream().forEach(event->{
-                bxWorkerIdWebsitIds.add(event.getWorkerId()+event.getWebsitId());
-            });*/
-
-            wwrecords.clear();
-        }
-
-
-
-        /*List<WebsitWorker> iwcs = websitWorkerService.lambdaQuery()
-                .eq(WebsitWorker::getInsureStatus,2).list();
-        if (CollectionUtils.isNotEmpty(iwcs)){
-            iwcs.stream().forEach(event->{
-                bxWorkerIdWebsitIds.add(event.getWorkerId()+event.getWebsitId());
-            });
-            iwcs.clear();
-        }*/
-
-        Insure insure = publicService.getWebsitWorkerByWorkerAndWebsit("意外险");
-
-        List<WebsitWorker> wws = publicService.getWebsitWorkerByWorkerAndWebsit();
-        if (CollectionUtils.isNotEmpty(wws)){
-            websitWorderwidwdidMap = wws.stream().collect(Collectors.groupingBy(WebsitWorker::getWorkerId));
-            wws.clear();
-        }
-
         // 提取格力现有的网点师傅数据信息
         wxgDownladRecs =  itfTblWangdianWxgDownloadService.lambdaQuery()
                 .select(ItfTblWangdianWxgDownload::getWxgid,
@@ -167,25 +136,17 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
                         ItfTblWangdianWxgDownload::getWxgmc,
                         ItfTblWangdianWxgDownload::getYddh,
                         ItfTblWangdianWxgDownload::getFlag)
-                // .eq(ItfTblWangdianWxgDownload::getSfzen,"430422198107105010")// 测试用
+                // .eq(ItfTblWangdianWxgDownload::getSfzen,"421022197809157619")// 测试用
                 .like(ItfTblWangdianWxgDownload::getWdno,"S%").list();
 
-        // 提取现有已存在的证件信息的师傅信息(待回传同步的证件不处理)
-        List<WorkerCert> wc = workerCertService.lambdaQuery()
-                .eq(WorkerCert::getOutSyncStatus,1).list();
-        if (CollectionUtils.isNotEmpty(wc)){
-            WorkerCertWorkerIdMaps = wc.stream().collect(Collectors.groupingBy(WorkerCert::getWorkerId));
-            wc.clear();
-        }
-
 
         for (ItfTblWangdianWxgDownload wxg :wxgDownladRecs){
             // 无效的数据不新增
-            if (wxg.getFlag() != null){
-                if (!wxg.getFlag().trim().equals(DictTypeEnum.DICT_TYPE_FLAG_ON.getCode())){
+            /*if (wxg.getFlag() != null){
+                if (wxg.getFlag().trim().equals(DictTypeEnum.DICT_TYPE_FLAG_OFF.getCode())){
                     continue;
                 }
-            }
+            }*/
             // 平台师傅信息不包含格力总部的数据不处理(包含的为格力的师傅信息同步时已生成了worker)
             // 这里用身份证来做包含关系(测试环境身份证隐藏* 需加名称及手机号)
             String workerId = checkIsGreeWroker(workerIdcardMap, wxg);
@@ -193,22 +154,11 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
                 continue;
             }
 
-            // 有证件信息的师傅不再新增
-            /*if (WorkerCertWorkerIdMaps.containsKey(workerId)){
-                continue;
-            }*/
-
             // 参数 获取网点维修工信息
             getParameter(wxg.getWdno(), wxg.getWxgno(), req);
-            log.info("总部获取的工程师证件照信息wdno :{}", wxg.getWdno());
-
             try {
                 // 格力总部查询工程师信息
                 GreeResponseHelper response = greeLogic.greePost(wdqyapi, JSONObject.toJSONString(req), publicService.getCompanyId(wxg.getWdno()));
-
-                log.info("总部获取的工程师证件照信息 response :{}", JSONObject.toJSONString(response));
-
-
                 // 失败不处理
                 if (response.getStatus() == 200){
                     WxgQueryInfo resultDatax = JSONObject.parseObject(response.getData().toString(), WxgQueryInfo.class);
@@ -216,36 +166,159 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
                     if ( resultDatax.getWangdianWxgVos().size()<1){
                         continue;
                     }
-
                     wvos = resultDatax.getWangdianWxgVos().get(0);
 
-                    log.info("总部获取的工程师证件照信息wvos:{}", JSONObject.toJSONString(wvos));
                     // 同步-新增证件信息
-                    getCertInfo(wvos, addList, workerId, WorkerCertWorkerIdMaps,wxg.getWdno(),workerIdandNames,
-                            workerWorkeridMap,insurecs,insurefiles, bxWorkerIdWebsitIds,
-                            websitWorderwidwdidMap, insure,addBxWorkers, upWebsitWorkers);
-                    // 新增或修改(证件)
-                    addDataCert(addList);
-                    // 修改保险信息
-                    upWebsitWorker(upWebsitWorkers);
+                    for (ZJInfo zj: wvos.getZjInfoList()){
+                        // 保险证
+                        if (zj.getZjmc().trim().equals("保险证")){
+                            // 获取保险证件数据
+                            getgetWorkerCertGreeBx(wcgs, wcgids, wxg, workerId, zj, wcgzjs);
+                            continue;
+                        }
+                                               
+                        // 生成其他证件信息
+                        getWorkerCertGreeOther(wcgs, wcgids, wcgzjs, wxg, workerId, zj);                        
+                    }
+
+                    if (wcgs.size()>0){
+                        workerCertGreeService.saveOrUpdateBatch(wcgs);
+                        wcgs.clear();
+                    }
 
-                    log.info("工程师证件照信息同步成功-师傅证件信息:{}", wxg.getSfzen());
                 } else {
-                    log.info("获取工程师证件照信息失败-师傅证件信息:{}", wxg.getSfzen());
+                    log.info("同步获取总部网点师傅证件信息失败-师傅证件信息:{}", wxg.getSfzen());
                     log.info("msg:{}", response.getMsg());
                 }
             } catch (Exception ex) {
                 ex.printStackTrace();
-                log.info("工程师证件照信息同步失败-师傅证件信息:{}", wxg.getSfzen());
-                throw new Exception("工程师证件照信息同步失败");
+                log.info("同步获取总部网点师傅证件信息失败-师傅证件信息:{}", wxg.getSfzen());
+                throw new Exception("同步获取总部网点师傅证件信息失败");
 
             }
         }
+    }
+
+    private void getWorkerCertGreeOther(List<WorkerCertGree> wcgs, Map<String, String> wcgids, Map<String, String> wcgzjs, ItfTblWangdianWxgDownload wxg, String workerId, ZJInfo zj) throws ParseException {
+        // 证件无变化时不修改
+        if (wcgzjs.containsKey(workerId + wxg.getWdno() + zj.getZjmc()) &&
+                wcgzjs.get(workerId + wxg.getWdno() + zj.getZjmc()).equals(zj.getZjlj())){
+            return;
+        }
+
+        // 平台数据不存在且源数据无数据时不新增
+        if (! wcgzjs.containsKey(workerId + wxg.getWdno() + zj.getZjmc()) && StringUtils.isEmpty(zj.getZjlj())){
+            return;
+        }
+
+        // 生成其他证件对像
+        workerCertGreeOther(wcgs, wcgids, wxg, workerId, zj);
+    }
+
+    private void workerCertGreeOther(List<WorkerCertGree> wcgs, Map<String, String> wcgids, ItfTblWangdianWxgDownload wxg, String workerId, ZJInfo zj) throws ParseException {
+        String files="";
+        WorkerCertGree  awc = new WorkerCertGree();
+        awc.setWorkerCertGreeId(IdWorker.getIdStr());
+        awc.setWorkerId(workerId);
+        awc.setBrandWebsitId(wxg.getWdno());
+        awc.setCertName(zj.getZjmc());
+        if (zj.getZjbh().contains("/")){
+            List<String> result = Arrays.asList(zj.getZjbh().split("/"));
+            awc.setCertNo(result.get(1));
+        } else {
+            awc.setCertNo(zj.getZjbh());
+        }
+        if (StringUtils.isNotEmpty(zj.getZjyxq())){
+            awc.setStartTime(publicService.subOneYear(baseService.utcToDateStr(zj.getZjyxq())));
+            awc.setExpireTime(baseService.utcToDateStr(zj.getZjyxq()));
+        }
+        if (StringUtils.isNotEmpty(zj.getZjfssj())){
+            awc.setReviewTime(baseService.utcToDateStr(zj.getZjfssj()));
+        }
+
+        awc.setCreateTime(new Date());
+        if (zj.getZjlj().contains(",")){
+            List<String> result = Arrays.asList(zj.getZjlj().split(","));
+            awc.setOutFileUrl(result.get(0));
+            if (result.size() == 2){
+                awc.setOutFileUrl2(result.get(1));
+            } else {
+                for (int i=1;i<result.size();i++){
+                    files = files + result.get(i) + ",";
+                }
+                awc.setOutFileUrl2(files.substring(0,files.length()-1));
+            }
+        } else {
+            awc.setOutFileUrl(zj.getZjlj());
+        }
+
+        publicService.setCertFlag(zj.getZjmc(), awc);
+        // 存在进行修改
+        publicService.setWorkerCertGreeId(awc, wcgids);
+        wcgs.add(awc);
+    }
+
+    private void getgetWorkerCertGreeBx(List<WorkerCertGree> wcgs,
+                                        Map<String, String> wcgids, ItfTblWangdianWxgDownload wxg,
+                                        String workerId, ZJInfo zj, Map<String,String> wcgzjs) throws ParseException {
+        // 证件无变化时不修改
+        if (wcgzjs.containsKey(workerId + wxg.getWdno() + zj.getZjmc()) &&
+                wcgzjs.get(workerId + wxg.getWdno() + zj.getZjmc()).equals(zj.getZjlj())){
+            return;
+        }
+        
+        // 平台数据不存在且源数据无数据时不新增
+        if (! wcgzjs.containsKey(workerId + wxg.getWdno() + zj.getZjmc()) && StringUtils.isEmpty(zj.getZjlj())){
+            return;
+        }
+        
+        // 生成保险证件数据对像
+        WorkerCertGreeBx(wcgs, wcgids, wxg, workerId, zj);
+    }
+
+    private void WorkerCertGreeBx(List<WorkerCertGree> wcgs, Map<String, String> wcgids,
+                                  ItfTblWangdianWxgDownload wxg, String workerId, ZJInfo zj) throws ParseException {
+        WorkerCertGree  awc = new WorkerCertGree();
+        awc.setWorkerCertGreeId(IdWorker.getIdStr());
+        awc.setWorkerId(workerId);
+        awc.setBrandWebsitId(wxg.getWdno());
+        awc.setCertName("保险证");
+        awc.setSafeCompany("人保");
+        // 保险公司及编号
+        if (zj.getZjbh().contains("/")){
+            List<String> result = Arrays.asList(zj.getZjbh().split("/"));
+            awc.setSafeCompany(result.get(0));
+            awc.setCertNo(result.get(1));
+        } else {
+            awc.setCertNo(zj.getZjbh());
+        }
+
+        // 有效期
+        awc.setStartTime(publicService.getYearFirstDay(new Date()));
+        awc.setExpireTime(publicService.getYearLastDay(new Date()));
+        awc.setReviewTime(publicService.getYearLastDay(new Date()));
+        if (StringUtils.isNotEmpty(zj.getZjyxq())){
+            awc.setStartTime(publicService.subOneYear(baseService.utcToDateStr(zj.getZjyxq())));
+            awc.setExpireTime(baseService.utcToDateStr(zj.getZjyxq()));
+        }
+        if (StringUtils.isNotEmpty(zj.getZjfssj())){
+            awc.setReviewTime(baseService.utcToDateStr(zj.getZjfssj()));
+        }
 
+        awc.setCreateTime(new Date());
+        if (StringUtils.isNotEmpty(zj.getZjlj())){
+            awc.setOutFileUrl(zj.getZjlj());
+        }
+        // 保险证
+        awc.setCertFlag(2);
+        // 存在进行修改
+        publicService.setWorkerCertGreeId(awc, wcgids);
+        wcgs.add(awc);
     }
 
+
     @Override
-    public void extractedCertInfoBak(){
+    public void extractedCertInfo() throws Exception {
         WangdianWxgVos wvos = new WangdianWxgVos();
         List<WorkerCert> addList = new ArrayList<>();
         Map<String,Object> req = new HashMap<>();
@@ -253,12 +326,14 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
         Map<String,List<Worker>> workerWorkeridMap = new HashMap<>();
         Map<String,List<WorkerCert>> WorkerCertWorkerIdMaps = new HashMap<>();
         List<ItfTblWangdianWxgDownload> wxgDownladRecs = new ArrayList<>();
-        List<WebsitWorker> websitWorkerUp = new ArrayList<>();
-        List<String> workerIdandNames = new ArrayList<>();
+        Map<String,String> workerIdCertNamesIdMaps = new HashMap<>();
+        Map<String,WorkerCert> workerIdCertNamesObjMaps = new HashMap<>();
         List<InsureWorkerCommercial> insurecs = new ArrayList<>();
         List<InsureWorkerCommercialFile> insurefiles = new ArrayList<>();
-        List<String> insureworkeridandWebsitids = new ArrayList<>();
-        Map<String,List<WebsitWorker>> websitWorderwidwdidMap = new HashMap<>();
+        List<String> bxWorkerIdWebsitIds = new ArrayList<>();
+        Map<String,WebsitWorker> websitWorderwidwdidMap = new HashMap<>();
+        Map<String,List<WebsitWorker>> addBxWorkers = new HashMap<>();
+        List<WebsitWorker> upWebsitWorkers = new ArrayList<>();
 
         // 提取品牌信息
         Brand brand = baseService.getBrand();
@@ -266,6 +341,21 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
             return;
         }
 
+
+
+
+
+
+        // 提取现有的师傅证件信息
+        List<WorkerCert> wcs = workerCertService.lambdaQuery().list();
+        if (CollectionUtils.isNotEmpty(wcs)){
+            wcs.stream().forEach(event->{
+                workerIdCertNamesIdMaps.put(event.getWorkerId() + event.getCertName(),event.getId());
+                workerIdCertNamesObjMaps.put(event.getWorkerId() + event.getCertName(),event);
+            });
+            wcs.clear();
+        }
+
         List<Worker> oldWorkerRec =  workerService.lambdaQuery()
                 .select(Worker::getIdcard,Worker::getWorkerId,Worker::getWorkerName,Worker::getMobile).list();
         if (CollectionUtils.isNotEmpty(oldWorkerRec)){
@@ -274,21 +364,38 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
             oldWorkerRec.clear();
         }
 
-        // 提取师傅所有的保险(有效的) 防重复添加
-        List<InsureWorkerCommercial> iwcs = insureWorkerCommercialService.lambdaQuery()
-                .eq(InsureWorkerCommercial::getStatus,"ON").list();
+        // 提取待同步获取保险信息的师傅数据
+        List<WebsitWorker> wwrecords = websitWorkerService.lambdaQuery()
+                .isNull(WebsitWorker::getOutZjlj)
+                .list();
+        if (CollectionUtils.isNotEmpty(wwrecords)){
+            addBxWorkers = wwrecords.stream().collect(Collectors.groupingBy(WebsitWorker::getWorkerId));
+
+            /*wwrecords.stream().forEach(event->{
+                bxWorkerIdWebsitIds.add(event.getWorkerId()+event.getWebsitId());
+            });*/
+
+            wwrecords.clear();
+        }
+
+
+
+        /*List<WebsitWorker> iwcs = websitWorkerService.lambdaQuery()
+                .eq(WebsitWorker::getInsureStatus,2).list();
         if (CollectionUtils.isNotEmpty(iwcs)){
             iwcs.stream().forEach(event->{
-                insureworkeridandWebsitids.add(event.getWorkerId()+event.getWebsitId());
+                bxWorkerIdWebsitIds.add(event.getWorkerId()+event.getWebsitId());
             });
             iwcs.clear();
-        }
+        }*/
 
         Insure insure = publicService.getWebsitWorkerByWorkerAndWebsit("意外险");
 
-        List<WebsitWorker> wws = publicService.getWebsitWorkerByWorkerAndWebsit();
+        List<WebsitWorker> wws = websitWorkerService.lambdaQuery().list();
         if (CollectionUtils.isNotEmpty(wws)){
-            websitWorderwidwdidMap = wws.stream().collect(Collectors.groupingBy(WebsitWorker::getWorkerId));
+            wws.stream().forEach(event->{
+                websitWorderwidwdidMap.put(event.getWorkerId() + event.getWebsitId(),event);
+            });
             wws.clear();
         }
 
@@ -312,13 +419,15 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
             wc.clear();
         }
 
+
         for (ItfTblWangdianWxgDownload wxg :wxgDownladRecs){
             // 无效的数据不新增
-            if (wxg.getFlag() != null){
+            /*if (wxg.getFlag() != null){
                 if (!wxg.getFlag().trim().equals(DictTypeEnum.DICT_TYPE_FLAG_ON.getCode())){
                     continue;
                 }
-            }
+            }*/
+
             // 平台师傅信息不包含格力总部的数据不处理(包含的为格力的师傅信息同步时已生成了worker)
             // 这里用身份证来做包含关系(测试环境身份证隐藏* 需加名称及手机号)
             String workerId = checkIsGreeWroker(workerIdcardMap, wxg);
@@ -333,10 +442,15 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
 
             // 参数 获取网点维修工信息
             getParameter(wxg.getWdno(), wxg.getWxgno(), req);
+            log.info("总部获取的工程师证件照信息wdno :{}", wxg.getWdno());
 
             try {
                 // 格力总部查询工程师信息
                 GreeResponseHelper response = greeLogic.greePost(wdqyapi, JSONObject.toJSONString(req), publicService.getCompanyId(wxg.getWdno()));
+
+                log.info("总部获取的工程师证件照信息 response :{}", JSONObject.toJSONString(response));
+
+
                 // 失败不处理
                 if (response.getStatus() == 200){
                     WxgQueryInfo resultDatax = JSONObject.parseObject(response.getData().toString(), WxgQueryInfo.class);
@@ -346,15 +460,16 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
                     }
 
                     wvos = resultDatax.getWangdianWxgVos().get(0);
+                    // log.info("总部获取的工程师证件照信息wvos:{}", JSONObject.toJSONString(wvos));
 
-                    log.info("总部获取的工程师证件照信息wvos:{}", JSONObject.toJSONString(wvos));
                     // 同步-新增证件信息
-                    getCertInfoBak(wvos, addList, workerId, WorkerCertWorkerIdMaps,wxg.getWdno(),workerIdandNames,
-                            workerWorkeridMap,insurecs,insurefiles, insureworkeridandWebsitids,websitWorderwidwdidMap, insure);
+                    getCertInfo(wvos, addList, workerId, wxg.getWdno(),
+                            workerWorkeridMap, bxWorkerIdWebsitIds,
+                            websitWorderwidwdidMap, insure,addBxWorkers, upWebsitWorkers, workerIdCertNamesObjMaps);
                     // 新增或修改(证件)
                     addDataCert(addList);
                     // 修改保险信息
-                    addBxInfoBak(insurecs, insurefiles);
+                    upWebsitWorker(upWebsitWorkers);
 
                     log.info("工程师证件照信息同步成功-师傅证件信息:{}", wxg.getSfzen());
                 } else {
@@ -362,11 +477,10 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
                     log.info("msg:{}", response.getMsg());
                 }
             } catch (Exception ex) {
-                addDataCert(addList);
-                upWebsitWorker(websitWorkerUp);
-                addBxInfoBak(insurecs, insurefiles);
                 ex.printStackTrace();
                 log.info("工程师证件照信息同步失败-师傅证件信息:{}", wxg.getSfzen());
+                throw new Exception("工程师证件照信息同步失败");
+
             }
         }
 
@@ -1107,6 +1221,9 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
 
 
     private void processCertInfo(WorkerCert workerCert) throws Exception {
+        String files = "";
+        String fileos = "";
+        String id2 = "";
         if (workerCert.getOutZjlj().contains(",")){
             Boolean flag = Boolean.TRUE;
             List<String> result = Arrays.asList(workerCert.getOutZjlj().split(","));
@@ -1122,13 +1239,33 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
                 }
             }
             if (StringUtils.isNotEmpty(result.get(1)) && StringUtils.isEmpty(workerCert.getFileUrl2())){
-                String id2 = putCert(result.get(1));
-                if (StringUtils.isNotEmpty(id2)){
-                    workerCert.setFileUrl2(id2);
-                    workerCert.setOutFileUrl2(result.get(1));
-                    new File(id2).delete();
+                // 这里可能存在多个证件
+                if (result.size() == 2){
+                    id2 = putCert(result.get(1));
+                    if (StringUtils.isNotEmpty(id2)){
+                        workerCert.setFileUrl2(id2);
+                        workerCert.setOutFileUrl2(result.get(1));
+                        new File(id2).delete();
+                    } else {
+                        flag = Boolean.FALSE;
+                    }
                 } else {
-                    flag = Boolean.FALSE;
+                    for (int i=1;i<result.size();i++){
+                        id2 = putCert(result.get(i));
+                        if (StringUtils.isNotEmpty(id2)){
+                            files = files + id2 + ",";
+                            fileos = fileos + result.get(i);
+                            new File(id2).delete();
+                        } else {
+                            flag = Boolean.FALSE;
+                            break;
+                        }
+
+                    }
+                    if (flag){
+                        workerCert.setFileUrl2(files.substring(0,files.length()-1));
+                        workerCert.setOutFileUrl2(fileos.substring(0,fileos.length()-1));
+                    }
                 }
             }
 
@@ -1137,7 +1274,7 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
             }
             workerCert.setOutSyncTime(new Date());
         } else {
-            if (StringUtils.isNotEmpty(workerCert.getOutZjlj())){
+            if (StringUtils.isNotEmpty(workerCert.getOutZjlj()) && StringUtils.isEmpty(workerCert.getFileUrl())){
                 String id = putCert(workerCert.getOutZjlj());
                 if (StringUtils.isNotEmpty(id)){
                     workerCert.setFileUrl(id);
@@ -1267,122 +1404,104 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
         add.setOutSyncTime(new Date());
     }
 
-
-    private void getCertInfobak(WangdianWxgVos wvos, List<WorkerCert> addList, String workerId,
-                             String workerName, Map<String,List<WorkerCert>> WorkerCertWorkerIdMaps,
-                             List<WebsitWorker> websitWorkerUp,String wdno,
-                             Map<String,List<WebsitWorker>> websitWorkerWorkerIdMap) throws Exception {
-        // 同步-新增证件信息
-        for (ZJInfo zj: wvos.getZjInfoList()){
-            // 保险证单独处理 只有修改无需新增操作
-            // websit.category_type决定保险类型 自建+不为商用(家用)其他商用
-            // 家用 insure_worker_record
-            // 商用 insure_worker_commercial 商用才操作,最有效期最后的那个
-            // websit_worker
-
-
-                if (zj.getZjmc().trim().equals("保险证")){
-                    ZJInfoBX bx = checkBxCertInfo(workerId, websitWorkerWorkerIdMap,zj, wdno);
-                    if (bx == null){
-                        continue;
-                    }
-                    workerBXAdd(bx, websitWorkerUp);
-                    continue;
-                }
-            // 校验证件是否需要新增同步
-            ZJInfoC addZj =checkCertInfo(workerId,WorkerCertWorkerIdMaps,zj);
-            if (addZj.getZjInfo()!=null){
-                workercertAdd(wvos, addList, workerId, addZj, workerName);
-            }
-        }
-    }
-
-
-    private void getCertInfoBak(WangdianWxgVos wvos, List<WorkerCert> addList, String workerId,
-                             Map<String,List<WorkerCert>> WorkerCertWorkerIdMaps,
-                             String wdno, List<String> workerIdandNames,Map<String,List<Worker>> workerWorkeridMap,
-                             List<InsureWorkerCommercial> insurecs,
-                             List<InsureWorkerCommercialFile> insurefiles,
-                             List<String> insureworkeridandWebsitids,
-                             Map<String,List<WebsitWorker>> websitWorderwidwdidMap, Insure insure) throws ParseException {
-        // 同步-新增证件信息
-        for (ZJInfo zj: wvos.getZjInfoList()){
-            // 保除证
-            if (zj.getZjmc().trim().equals("保险证")){
-                if (insure == null){
-                    continue;
-                }
-                if (produceBXInfoBak(workerId, wdno, workerWorkeridMap, insurecs, insurefiles,
-                        insureworkeridandWebsitids, zj,websitWorderwidwdidMap, insure)){
-                    continue;
-                }
-
-                continue;
-            }
-
-            // 生成其他证件信息
-            produceCert(wvos, addList, workerId, WorkerCertWorkerIdMaps, workerIdandNames, workerWorkeridMap, zj);
-        }
-    }
-
     private void getCertInfo(WangdianWxgVos wvos, List<WorkerCert> addList, String workerId,
-                             Map<String,List<WorkerCert>> WorkerCertWorkerIdMaps,
-                             String wdno, List<String> workerIdandNames,Map<String,List<Worker>> workerWorkeridMap,
-                             List<InsureWorkerCommercial> insurecs,
-                             List<InsureWorkerCommercialFile> insurefiles,
+                             String wdno, Map<String,List<Worker>> workerWorkeridMap,
                              List<String> bxWorkerIdWebsitIds,
-                             Map<String,List<WebsitWorker>> websitWorderwidwdidMap,
+                             Map<String,WebsitWorker> websitWorderwidwdidMap,
                              Insure insure,Map<String,List<WebsitWorker>> addBxWorkers,
-                             List<WebsitWorker> upWebsitWorkers) throws ParseException {
+                             List<WebsitWorker> upWebsitWorkers, Map<String,WorkerCert> workerIdCertNamesObjMaps) throws ParseException {
         // 同步-新增证件信息
         for (ZJInfo zj: wvos.getZjInfoList()){
-            // 保
+            // 保险证
             if (zj.getZjmc().trim().equals("保险证")){
                 if (insure == null){
                     continue;
                 }
-                // 师傅所在网点数据未下载保险证件时才可以下载
+                /*// 师傅所在网点数据未下载保险证件时才可以下载
                 if (!addBxWorkers.containsKey(workerId)){
                     continue;
-                }
+                }*/
 
                 // 获取保险证件数据
-                produceBXInfo(workerId, wdno, workerWorkeridMap, insurecs, insurefiles,
-                        bxWorkerIdWebsitIds, zj,websitWorderwidwdidMap, insure, addBxWorkers, upWebsitWorkers);
+                produceBXInfo(workerId, wdno, bxWorkerIdWebsitIds, zj,websitWorderwidwdidMap,
+                        addBxWorkers, upWebsitWorkers);
 
                 continue;
             }
 
             // 生成其他证件信息
-            produceCert(wvos, addList, workerId, WorkerCertWorkerIdMaps, workerIdandNames, workerWorkeridMap, zj);
+            produceCert(wvos, addList, workerId, workerWorkeridMap, zj, workerIdCertNamesObjMaps);
         }
     }
 
-    private void produceCert(WangdianWxgVos wvos, List<WorkerCert> addList, String workerId, Map<String,
-            List<WorkerCert>> WorkerCertWorkerIdMaps, List<String> workerIdandNames,
-                             Map<String, List<Worker>> workerWorkeridMap, ZJInfo zj) throws ParseException {
-        Boolean addFlag = Boolean.FALSE;
 
-        // workerid+证件名称锁定不重复
-        if (workerIdandNames.contains(workerId + zj.getZjmc().trim())){
-            return;
-        }
 
-        // 历史数据存在不新增
-        if (WorkerCertWorkerIdMaps.containsKey(workerId)){
-            for (WorkerCert item: WorkerCertWorkerIdMaps.get(workerId)){
-                // 名称相同 即表中已存在,不新增
-                if (item.getCertName().equals(zj.getZjmc().trim())){
-                    addFlag = Boolean.TRUE;
-                    break;
-                }
+    private void produceCert(WangdianWxgVos wvos, List<WorkerCert> addList, String workerId,
+                             Map<String, List<Worker>> workerWorkeridMap, ZJInfo zj,
+                             Map<String,WorkerCert> workerIdCertNamesObjMaps) throws ParseException {
+
+        // 证件名称锁定重复   证件照相同,有效期相同不更新
+        // 这里的证件有总部的,也有平台自建的,总部同步的一定会放在OutZjlj,自建的一定是file_url有值OutZjlj为空
+        if (workerIdCertNamesObjMaps.containsKey(workerId + zj.getZjmc())){
+            if (checkParameter(workerId, zj, workerIdCertNamesObjMaps)) {
+                return;
             }
         }
-        if (addFlag){
-            return;
+        // 新增或修改
+        addNewWorkerCert(wvos, addList, workerId, workerWorkeridMap.get(workerId).get(0).getWorkerName(), workerIdCertNamesObjMaps, zj);
+    }
+
+    private boolean checkParameter(String workerId, ZJInfo zj, Map<String, WorkerCert> workerIdCertNamesObjMaps) throws ParseException {
+        // 证件内容相同有效期相同不同步
+        WorkerCert wc = workerIdCertNamesObjMaps.get(workerId + zj.getZjmc());
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String ptzjlj = "";
+        String ptzjbh = "";
+        String ptzjfssj = "";
+        String ptzjyxq = "";
+        String zjbh = "";
+        String zjfssj = "";
+        String zjyxq = "";
+        if (StringUtils.isNotEmpty(wc.getOutZjlj())){
+            ptzjlj = wc.getOutZjlj();
+        }
+        if (StringUtils.isNotEmpty(wc.getCertNo())){
+            ptzjbh = wc.getCertNo();
+        }
+        if (wc.getReviewTime() != null){
+            ptzjfssj = sdf.format(wc.getReviewTime());
         }
-        // 新增
-        addNewWorkerCert(wvos, addList, workerId, workerWorkeridMap.get(workerId).get(0).getWorkerName(), workerIdandNames, zj);
+        if (StringUtils.isNotEmpty(zj.getZjfssj())){
+            zjfssj = sdf.format(baseService.utcToDateStr(zj.getZjfssj()));
+        }
+        if (wc.getExpireTime() != null){
+            ptzjyxq = sdf.format(wc.getExpireTime());
+        }
+        if (StringUtils.isNotEmpty(zj.getZjyxq())){
+            zjyxq = sdf.format(baseService.utcToDateStr(zj.getZjyxq()));
+        }
+        if (zj.getZjbh().contains("/")){
+            List<String> result = Arrays.asList(zj.getZjbh().split("/"));
+            zjbh = result.get(1);
+        } else {
+            zjbh = zj.getZjbh();
+        }
+
+        // 总部有证件,平台有自建证件
+        // 总同步下来的证件 如无变动不更新   (OutZjlj有值即来自总部)
+        // 1:OutZjlj有值;2:证件相同;3:证件编号相同;4:证件复审时间;5:证件有效期
+        if (StringUtils.isNotEmpty(ptzjlj) &&
+                StringUtils.isNotEmpty(zj.getZjlj()) && zj.getZjlj().equals(ptzjlj) &&
+                ptzjbh.equals(zjbh) &&
+                ptzjfssj.equals(zjfssj) &&
+                ptzjyxq.equals(zjyxq)){
+            return true;
+        }
+        // 若存在有效期,有效期需变大才可以更新
+        if (ptzjyxq.compareTo(zjyxq)>=0){
+            return true;
+        }
+        return false;
     }
 
     /**
@@ -1397,7 +1516,7 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
     private boolean produceBXInfoBak(String workerId, String wdno, Map<String, List<Worker>> workerWorkeridMap,
                                   List<InsureWorkerCommercial> insurecs, List<InsureWorkerCommercialFile> insurefiles,
                                   List<String> insureworkeridandWebsitids, ZJInfo zj,
-                                  Map<String, List<WebsitWorker>> websitWorderwidwdidMap, Insure insure) throws ParseException {
+                                  Map<String, WebsitWorker> websitWorderwidwdidMap, Insure insure) throws ParseException {
         // 提取商户售后网点对应的平台售后网点信息 存在一对多的关系 无对应关系退出不处理
         List<WebsitOrderSign> wos = publicService.shShwdToptshwdByBrandWebsitNo(wdno);
         if (CollectionUtils.isEmpty(wos)){
@@ -1428,11 +1547,10 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
         return false;
     }
 
-    private void produceBXInfo(String workerId, String wdno, Map<String, List<Worker>> workerWorkeridMap,
-                                  List<InsureWorkerCommercial> insurecs, List<InsureWorkerCommercialFile> insurefiles,
+    private void produceBXInfo(String workerId, String wdno,
                                   List<String> bxWorkerIdWebsitIds, ZJInfo zj,
-                                  Map<String, List<WebsitWorker>> websitWorderwidwdidMap,
-                                  Insure insure, Map<String,List<WebsitWorker>> addBxWorkers,
+                                  Map<String, WebsitWorker> websitWorderwidwdidMap,
+                                  Map<String,List<WebsitWorker>> addBxWorkers,
                                   List<WebsitWorker> upWebsitWorkers) throws ParseException {
         // 提取商户售后网点对应的平台售后网点信息 存在一对多的关系 无对应关系退出不处理
         List<WebsitOrderSign> wos = publicService.shShwdToptshwdByBrandWebsitNo(wdno);
@@ -1442,10 +1560,10 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
 
         // 生成保险对像 网点多对1时每个网点放一份
         for (WebsitOrderSign item : wos){
-            // 防重
-            if (bxWorkerIdWebsitIds.contains(workerId +item.getWebsitId())){
+            // 防重  进行修改
+            /*if (bxWorkerIdWebsitIds.contains(workerId +item.getWebsitId())){
                 continue;
-            }
+            }*/
 
             // 对于在商户网点师傅都为无效的状态时在平台网点师傅表中可能是不存在的 需要排除掉
             String websitWorkerId = checkWebsitWorker(workerId, websitWorderwidwdidMap, item);
@@ -1453,7 +1571,7 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
                 continue;
             }
 
-            // 提取师傅所在网点数据进行修改
+            /*// 提取师傅所在网点数据进行修改
             for (WebsitWorker w:addBxWorkers.get(workerId)){
                 // 网点对应
                 if (w.getWebsitId().equals(item.getWebsitId())){
@@ -1461,13 +1579,79 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
                     getWebsitWorkerInfo(zj, upWebsitWorkers, w);
                     break;
                 }
+            }*/
+
+            ///////////////////////////////////////////////////
+            // 保险数据无变化时不处理
+            WebsitWorker ww = getWebsitWorker(workerId, zj, websitWorderwidwdidMap, item);
+            if (ww == null) {
+                continue;
             }
 
-            bxWorkerIdWebsitIds.add(workerId +item.getWebsitId());
+            // 获取师傅保险信息
+            getWebsitWorkerInfo(zj, upWebsitWorkers, ww, websitWorderwidwdidMap);
+            //////////////////////////////////////////////////////
         }
     }
 
-    private void getWebsitWorkerInfo(ZJInfo zj, List<WebsitWorker> upWebsitWorkers, WebsitWorker w) throws ParseException {
+    @Nullable
+    private WebsitWorker getWebsitWorker(String workerId, ZJInfo zj, Map<String, WebsitWorker> websitWorderwidwdidMap, WebsitOrderSign item) throws ParseException {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String ptzjlj = "";
+        String ptzjbh = "";
+        String ptSafeCompany = "";
+        String ptzjyxq = "";
+        String zjbh = "";
+        String safeCompany = "";
+        String zjyxq = "";
+
+        WebsitWorker ww = websitWorderwidwdidMap.get(workerId + item.getWebsitId());
+
+        if (StringUtils.isNotEmpty(ww.getOutZjlj())){
+            ptzjlj = ww.getOutZjlj();
+        }
+        if (StringUtils.isNotEmpty(ww.getSafeNo())){
+            ptzjbh = ww.getSafeNo();
+        }
+        if (StringUtils.isNotEmpty(ww.getSafeCompany())){
+            ptSafeCompany = ww.getSafeCompany();
+        }
+        if (ww.getGmbxyxq() != null){
+            ptzjyxq = sdf.format(ww.getGmbxyxq());
+        }
+
+
+        if (zj.getZjbh().contains("/")){
+            List<String> result = Arrays.asList(zj.getZjbh().split("/"));
+            safeCompany = result.get(0);
+            zjbh = result.get(1);
+        } else {
+            zjbh = zj.getZjbh();
+        }
+        if (StringUtils.isNotEmpty(zj.getZjyxq())){
+            zjyxq = sdf.format(baseService.utcToDateStr(zj.getZjyxq()));
+        }
+
+        // 保险数据无变化时不处理
+        // 总部有,平台有自建
+        // 总同步下来的无变动不更新 (OutZjlj有值即来自总部)
+        // 1:OutZjlj有值;2:证件相同;3:证件编号相同;4:保险公司相同;5:证件有效期
+        if (StringUtils.isNotEmpty(ww.getOutZjlj()) &&
+                StringUtils.isNotEmpty(zj.getZjlj()) && zj.getZjlj().equals(ptzjlj) &&
+                ptzjbh.equals(zjbh) &&
+                ptSafeCompany.equals(safeCompany) &&
+                ptzjyxq.equals(zjyxq)){
+            return null;
+        }
+        // 若存在有效期,有效期需变大才可以更新
+        if (ptzjyxq.compareTo(zjyxq)>=0){
+            return null;
+        }
+        return ww;
+    }
+
+    private void getWebsitWorkerInfo(ZJInfo zj, List<WebsitWorker> upWebsitWorkers, WebsitWorker w,
+                                     Map<String, WebsitWorker> websitWorderwidwdidMap) throws ParseException {
         WebsitWorker upwwinfo = new WebsitWorker();
         MyBeanUtils.copyProperties(w,upwwinfo);
 
@@ -1503,23 +1687,53 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
             upwwinfo.setOutZjljProcess(0);
         }
 
+        // 看证件图是否需要更新
+        setOutZjljProcess(zj, w, upwwinfo);
+
+        // 更新或添加进来
+        websitWorderwidwdidMap.put(w.getWorkerId() + w.getWebsitId(),upwwinfo);
+
         upWebsitWorkers.add(upwwinfo);
     }
 
+    private void setOutZjljProcess(ZJInfo zj, WebsitWorker w, WebsitWorker upwwinfo) {
+        String ptzjlj = "";
+        String zjlj = "";
+        // 取证件信息 ptzjlj
+        // outZjlj为空可能为平台自建或是自建已上传总部取 out_insure_cert值与总部返回的值比较相同不修改图
+        if (StringUtils.isEmpty(w.getOutZjlj())){
+            if (StringUtils.isNotEmpty(w.getOutInsureCert())) {
+                ptzjlj = w.getOutInsureCert();
+            }
+        } else {
+            ptzjlj = w.getOutZjlj();
+        }
+        if (StringUtils.isNotEmpty(zj.getZjlj())){
+            zjlj = zj.getZjlj();
+        }
+
+        // 不相同 就修改
+        if (! zjlj.equals(ptzjlj)){
+            upwwinfo.setOutZjlj(zj.getZjlj());
+            upwwinfo.setOutZjljProcess(0);
+        } else {
+            upwwinfo.setOutZjlj(zj.getZjlj());
+            upwwinfo.setOutZjljProcess(1);
+        }
+    }
+
     @Nullable
-    private String checkWebsitWorker(String workerId, Map<String, List<WebsitWorker>> websitWorderwidwdidMap,
+    private String checkWebsitWorker(String workerId, Map<String, WebsitWorker> websitWorderwidwdidMap,
                                      WebsitOrderSign item) {
         String websitWorkerId="";
-        if (!websitWorderwidwdidMap.containsKey(workerId)){
+        if (!websitWorderwidwdidMap.containsKey(workerId + item.getWebsitId())){
             return null;
         }
         // 提取 websitWorkerId
-        for (WebsitWorker w : websitWorderwidwdidMap.get(workerId)){
-            if (w.getWebsitId().equals(item.getWebsitId())){
-                websitWorkerId=w.getWebsitWorkerId();
-                break;
-            }
+        if (websitWorderwidwdidMap.get(workerId + item.getWebsitId()).getWebsitId().equals(item.getWebsitId())){
+            websitWorkerId=websitWorderwidwdidMap.get(workerId + item.getWebsitId()).getWebsitWorkerId();
         }
+
         if (StringUtils.isEmpty(websitWorkerId)){
             return null;
         }
@@ -1592,11 +1806,11 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
     }
 
     private void addNewWorkerCert(WangdianWxgVos wvos, List<WorkerCert> addList, String workerId, String workerName,
-                                  List<String> workerIdandNames, ZJInfo zj) throws ParseException {
+                                  Map<String,WorkerCert> workerIdCertNamesObjMaps, ZJInfo zj) throws ParseException {
         WorkerCert add = new WorkerCert();
         add.setId(publicService.getUUID());
         add.setWorkerId(workerId);
-        add.setCertName(zj.getZjmc().trim());
+        add.setCertName(zj.getZjmc());
         add.setName(workerName);
         if (StringUtils.isNotEmpty(zj.getZjlj())){
             add.setOutZjlj(zj.getZjlj());
@@ -1621,8 +1835,53 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
         add.setSex(wvos.getXingb());
         add.setOutSyncStatus(1);
         add.setOutSyncTime(new Date());
+
+        // 看新增还是修改
+        if (workerIdCertNamesObjMaps.containsKey(workerId + zj.getZjmc())){
+            // 看证件图是否需要更新
+            setOutZjljProcessOther(workerId, workerIdCertNamesObjMaps, zj, add);
+            add.setId(workerIdCertNamesObjMaps.get(workerId + zj.getZjmc()).getId());
+        }
+
+        workerIdCertNamesObjMaps.put(workerId + zj.getZjmc(),add);
+
         addList.add(add);
-        workerIdandNames.add(workerId + zj.getZjmc().trim());
+    }
+
+    private void setOutZjljProcessOther(String workerId, Map<String, WorkerCert> workerIdCertNamesObjMaps, ZJInfo zj, WorkerCert add) {
+        String ptzjlj = "";
+        String zjlj = "";
+        WorkerCert wc = workerIdCertNamesObjMaps.get(workerId + zj.getZjmc());
+
+        // 取证件信息 ptzjlj
+        // outZjlj为空可能为平台自建或是自建已上传总部取 out_insure_cert值与总部返回的值比较相同不修改图
+        if (StringUtils.isEmpty(wc.getOutZjlj())){
+            if (StringUtils.isNotEmpty(wc.getOutFileUrl())) {
+                ptzjlj = wc.getOutFileUrl();
+                if (StringUtils.isNotEmpty(wc.getOutFileUrl2())) {
+                    ptzjlj = ptzjlj+ "," + wc.getOutFileUrl2();
+                }
+            } else {
+                if (StringUtils.isNotEmpty(wc.getOutFileUrl2())) {
+                    ptzjlj = wc.getOutFileUrl2();
+                }
+            }
+        } else {
+            ptzjlj = wc.getOutZjlj();
+        }
+        if (StringUtils.isNotEmpty(zj.getZjlj())){
+            zjlj = zj.getZjlj();
+        }
+
+        // 不相同 就修改
+        if (! zjlj.equals(ptzjlj)){
+            add.setOutZjlj(zj.getZjlj());
+            add.setFileUrl("");
+            add.setFileUrl2("");
+            add.setOutFileUrl("");
+            add.setOutFileUrl2("");
+            add.setOutZjljProcess(0);
+        }
     }
 
     // 返回null时不处理

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

@@ -1726,6 +1726,33 @@ public class PublicServiceImpl implements PublicService {
         return sdf.parse(sdf.format(calendar.getTime()));
     }
 
+    @Override
+    public void setWorkerCertGreeId(WorkerCertGree awc, Map<String,String> wcgids){
+        if (wcgids.containsKey(awc.getWorkerId() + awc.getBrandWebsitId() + awc.getCertName())){
+            awc.setWorkerCertGreeId(wcgids.get(awc.getWorkerId() + awc.getBrandWebsitId() + awc.getCertName()));
+        } else {
+            wcgids.put(awc.getWorkerId() + awc.getBrandWebsitId() + awc.getCertName(),awc.getWorkerCertGreeId());
+        }
+    }
+
+    @Override
+    public void setCertFlag(String certName, WorkerCertGree awc){
+        if ("身份证".equals(certName)) {
+            awc.setCertFlag(1);
+        } else if ("保险证".equals(certName)) {
+            awc.setCertFlag(2);
+        } else if ("高空作业证".equals(certName) || "高空证".equals(certName)) {
+            awc.setCertFlag(3);
+            awc.setCertName("高空作业证");
+        } else if ("上岗证".equals(certName)) {
+            awc.setCertFlag(4);
+        } else if ("制冷证".equals(certName)) {
+            awc.setCertFlag(5);
+        } else if ("驾驶证".equals(certName)) {
+            awc.setCertFlag(6);
+        }
+    }
+
     private void setLocationByAddress(OrderBase orderBase) {
         if (StringUtils.isEmpty(orderBase.getLng()) || StringUtils.isEmpty(orderBase.getLat())) {
             String add = "";

+ 8 - 32
src/main/java/com/zfire/jiasm/syncdata/service/impl/UploadWorkeCertificateServiceImpl.java

@@ -91,10 +91,10 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
 
 
         // 获取待同步到格力总部师傅的证件信息
-        // recs = getWorkerUploads();
+        recs = getWorkerUploads();
 
         // 测试用
-        recs =  getWorkerUploadstest();
+        // recs =  getWorkerUploadstest();
 
         for (WorkerCert item:recs){
             count = 0;
@@ -223,9 +223,9 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
         if (StringUtils.isNotEmpty(outFilet)){
             awc.setOutFileUrl2(outFilet);
         }
-        setCertFlag(item.getCertName(), awc);
+        publicService.setCertFlag(item.getCertName(), awc);
         // 存在进行修改
-        setWorkerCertGreeId(wdno, awc, wcgids);
+        publicService.setWorkerCertGreeId(awc, wcgids);
         wcgs.add(awc);
     }
 
@@ -240,30 +240,6 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
         }
     }
 
-    private void setWorkerCertGreeId(WorkerBrandAccount wdno, WorkerCertGree awc, Map<String,String> wcgids) {
-        if (wcgids.containsKey(awc.getWorkerId() + awc.getBrandWebsitId() + awc.getCertName())){
-            awc.setWorkerCertGreeId(wcgids.get(awc.getWorkerId() + awc.getBrandWebsitId() + awc.getCertName()));
-        } else {
-            wcgids.put(awc.getWorkerId() + awc.getBrandWebsitId() + awc.getCertName(),awc.getWorkerCertGreeId());
-        }
-    }
-
-    private void setCertFlag(String certName, WorkerCertGree awc) {
-        if ("身份证".equals(certName)) {
-            awc.setCertFlag(1);
-        } else if ("保险证".equals(certName)) {
-            awc.setCertFlag(2);
-        } else if ("高空作业证".equals(certName) || "高空证".equals(certName)) {
-            awc.setCertFlag(3);
-            awc.setCertName("高空作业证");
-        } else if ("上岗证".equals(certName)) {
-            awc.setCertFlag(4);
-        } else if ("制冷证".equals(certName)) {
-            awc.setCertFlag(5);
-        } else if ("驾驶证".equals(certName)) {
-            awc.setCertFlag(6);
-        }
-    }
 
     @Override
     public void procesUploadWorkeBx() {
@@ -291,10 +267,10 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
         }
 
         // 获取待同步到格力总部师傅的保除证件信息
-        // wws = getWorkerUploadsBx();
+        wws = getWorkerUploadsBx();
 
         // 测试使用
-        wws = getWorkerUploadsBxtext();
+        // wws = getWorkerUploadsBxtext();
 
         for (WebsitWorker item:wws){
             fileo ="";
@@ -381,9 +357,9 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
         awc.setCreateTime(new Date());
         awc.setOutFileUrl(item.getOutInsureCert());
         awc.setSafeCompany("人保");
-        setCertFlag("保险证", awc);
+        publicService.setCertFlag("保险证", awc);
         // 存在进行修改
-        setWorkerCertGreeId(wdno, awc, wcgids);
+        publicService.setWorkerCertGreeId(awc, wcgids);
         wcgs.add(awc);
     }
 

+ 2 - 2
src/main/java/com/zfire/jiasm/syncdata/service/impl/UploadWorkerTOGreeServiceImpl.java

@@ -112,10 +112,10 @@ public class UploadWorkerTOGreeServiceImpl implements UploadWorkerTOGreeService
         }
 
         // 获取待同步数据
-        // recs = getWorkerUploads();
+        recs = getWorkerUploads();
 
         // 测试用
-        recs = getWorkerUploadstest();
+        // recs = getWorkerUploadstest();
 
         for (OutWorkerUpload item:recs){
             try{

+ 2 - 0
src/main/resources/bootstrap-dev.properties

@@ -274,6 +274,7 @@ jdzpgpwd=30000
 jdzfqx=30000
 jdbwg=30000
 jdzpgpry=30000
+sfzjxx=300000
 #格力商城
 glsc=2000
 #天猫商城
@@ -385,6 +386,7 @@ wxgxgc=FALSE
 wxgwztc=FALSE
 zjzbxc=FALSE
 cjfilec=FALSE
+sfzjxxc=FALSE
 #京东商城 预约改约、指派改派网点、作废取消、报完工、指派改派人员
 jdyygyc=FALSE
 jdzpgpwdc=FALSE

+ 2 - 0
src/main/resources/bootstrap-prd.properties

@@ -259,6 +259,7 @@ wxgwzt=600000
 wdwxgt=300000
 zjzbx=300000
 cjfile=5000
+sfzjxx=300000
 #京东商城 预约改约、指派改派网点、作废取消、报完工、指派改派人员
 jdyygy=30000
 jdzpgpwd=30000
@@ -376,6 +377,7 @@ wxgxgc=FALSE
 wxgwztc=TRUE
 zjzbxc=TRUE
 cjfilec=TRUE
+sfzjxxc=FALSE
 #京东商城 预约改约、指派改派网点、作废取消、报完工、指派改派人员
 jdyygyc=TRUE
 jdzpgpwdc=TRUE

+ 4 - 2
src/main/resources/bootstrap-prdt.properties

@@ -259,6 +259,7 @@ wxgwzt=60000
 wdwxgt=600000
 zjzbx=600000
 cjfile=60000
+sfzjxx=300000
 #京东商城 预约改约、指派改派网点、作废取消、报完工、指派改派人员
 jdyygy=30000
 jdzpgpwd=30000
@@ -294,7 +295,7 @@ greesms=10000
 SMSSelf_marketing_Rate=5000
 ######################## 同步定时任务配置 ########################
 #师傅 证件、师傅、工单子表信息
-workercertificatec=TRUE
+workercertificatec=FALSE
 workerceruploadc=FALSE
 detaildownc=FALSE
 workercertbxc=FALSE
@@ -369,13 +370,14 @@ ththhgxc=FALSE
 wxzjsc=FALSE
 wxzjscxc=FALSE
 #网点维修工 证件照,服务类目,位置、新增同步到本地、修改、保险、总部下载的采集图
-zjzxxc=FALSE
+zjzxxc=TRUE
 lmxxc=FALSE
 wxgwzc=FALSE
 wxgxgc=FALSE
 wxgwztc=FALSE
 zjzbxc=FALSE
 cjfilec=FALSE
+sfzjxxc=FALSE
 #京东商城 预约改约、指派改派网点、作废取消、报完工、指派改派人员
 jdyygyc=FALSE
 jdzpgpwdc=FALSE

+ 2 - 0
src/main/resources/bootstrap-test.properties

@@ -267,6 +267,7 @@ wxgwzt=600000
 wdwxgt=600000
 zjzbx=600000
 cjfile=60000
+sfzjxx=300000
 #京东商城 预约改约、指派改派网点、作废取消、报完工、指派改派人员
 jdyygy=30000
 jdzpgpwd=30000
@@ -384,6 +385,7 @@ wxgxgc=FALSE
 wxgwztc=TRUE
 zjzbxc=TRUE
 cjfilec=TRUE
+sfzjxxc=TRUE
 #京东商城 预约改约、指派改派网点、作废取消、报完工、指派改派人员
 jdyygyc=TRUE
 jdzpgpwdc=TRUE

+ 0 - 0
syncdata/202309/DispatchFiles/IdentityImgs/S21006890028/[192.13.182.37_7006]5b32ee7be5b0435a95447686508d72da.jpg


+ 0 - 0
syncdata/202309/DispatchFiles/IdentityImgs/S21065170001/[10.2.46.192_7006]a21d3602821f4e0e9bca1bc058c54a9a.jpg


+ 0 - 0
syncdata/202309/DispatchFiles/IdentityImgs/S92198070017/[10.2.46.190_7006]bcbe5b5463594035b7ffb155d5c6bd0e.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/201804/S2100689201804gkzy001524878645030.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/201804/S2100689201804zgzh001524902918498.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/201805/S2100603201805zgzh001525856000269.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/201805/S2100689201805gkzy001525751308606.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/201805/S2100689201805zgzh001525750946077.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/201901/S2106141201901gkzy001546567078254.doc


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/201901/S2106141201901zgzh001546567107239.docx


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/201903/S2100603201903zgzh001553062999175.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/201904/S2101511201904gkzy001555832070235.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/201904/S2101511201904zgzh001555832110732.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/201907/S2101289201907gkzy001564541409425.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/201907/S2101289201907zgzh001564541469563.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/201909/S2106517201909gkzy001569386832037.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/201910/S2106533201910gkzy001572504283654.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/202004/S2106141202004zgzh001588124410235.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/202004/S2106533202004zgzh001586591398067.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/202006/S2105261202006gkzy001591842715939.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/202006/S2106141202006gkzy001592292107583.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/202009/S2106732202009gkzy001599270581046.jpg


+ 0 - 0
syncdata/202309/pgxtwxguploadfile/202010/S2100689202010gkzy001603001293799.jpg