yaozhixue 1 year ago
parent
commit
5e5ad9c366

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

@@ -2181,7 +2181,7 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
             if (cppjly){
                 OrderAppraise oldoat = orderAppraiseService.lambdaQuery()
                         .eq(OrderAppraise::getOrderBaseId,orderBase.getId())
-                        .ne(OrderAppraise::getAppraiseStatus,"A").one();
+                        .ne(OrderAppraise::getAppraiseStatus,"A").last("limit 1").one();
                 if (oldoat==null){
                     canappeal=1;
                 }

+ 126 - 27
src/main/java/com/zfire/jiasm/syncdata/service/impl/GLPPWXGQueryAddServiceImpl.java

@@ -1957,6 +1957,81 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
         return zjinfo;
     }
 
+    // 25号后 ljf改
+/*
+    @Transactional(rollbackFor = Exception.class)
+    public void wxgCategoryQueryAddBak(ItfTblWangdianWxgDownload wxgDownload,
+                                    Map<String, List<WorkerBrandAccount>> workerBrandAccountsMap,
+                                    Map<String,List<WorkerServiceCategoryDetail>> workerServiceCategoryDetailMap,
+                                    SysDict sysDict,Map<String, List<SysDictRef>> sysDictRefMap,
+                                    List<String> workerServiceCategoryDetailList) throws Exception {
+        Map<String,Object> req = new HashMap<>();
+        WangdianWxgVos wvos = new WangdianWxgVos();
+        Map<String, List<WorkerServiceCategoryDetail>> wxgCategoryTypeRecs = new HashMap<>();
+        List<WorkerServiceCategory> wscList = new ArrayList<>();
+        List<WorkerServiceCategoryDetail> wscdList = new ArrayList<>();
+        // 提取本地商户师傅信息 网点|师傅编号不存在不处理 修改处已做了处理 这里只新增(前提是找到师傅所在网点信息)
+        for (WorkerBrandAccount workerBrandAccount:workerBrandAccountsMap.get(String.valueOf(wxgDownload.getWxgid()))){
+
+            // 师傅对应的网点服务类目信息已存在不处理 只做插入
+            if (workerServiceCategoryDetailMap.containsKey(workerBrandAccount.getWebsitWorkerId())){
+                continue;
+            }
+
+            // 师傅对应的网点服务类目信息已存在不处理 只做插入
+            if (workerServiceCategoryDetailList.contains(workerBrandAccount.getWebsitWorkerId())){
+                continue;
+            }
+
+            // 参数 获取网点维修工信息
+            getParameter(wxgDownload.getWdno(), wxgDownload.getWxgno(), req);
+            try {
+                // 格力总部查询工程师信息
+                GreeResponseHelper response = greeLogic.greePost(wdqyapi, JSONObject.toJSONString(req), publicService.getCompanyId(wxgDownload.getWdno()));
+                if (response.getStatus() == 200){
+                    WxgQueryInfo resultDatax = JSONObject.parseObject(response.getData().toString(), WxgQueryInfo.class);
+                    // 无信息不处理
+                    if ( resultDatax.getWangdianWxgVos().size()<1){
+                        continue;
+                    }
+
+                    wvos = resultDatax.getWangdianWxgVos().get(0);
+
+                    // 提取师傅的服务大类信息 先内存中查询
+                    if (workerServiceCategoryDetailMap.containsKey(String.valueOf(wxgDownload.getWxgid()))){
+                        wxgCategoryTypeRecs = workerServiceCategoryDetailMap.get(workerBrandAccount.getWebsitWorkerId()).stream().
+                                collect(Collectors.groupingBy(WorkerServiceCategoryDetail::getType));
+                    } else {
+                        List<WorkerServiceCategoryDetail> wxgCategoryRecs = workerServiceCategoryDetailService.lambdaQuery()
+                                .eq(WorkerServiceCategoryDetail::getWebsitWorkerId, workerBrandAccount.getWebsitWorkerId()).list();
+
+                        // 服务类型 INSTALL=安装 REPAIR=维修  DELIVERY=配送
+                        if (CollectionUtils.isNotEmpty(wxgCategoryRecs)){
+                            wxgCategoryTypeRecs = wxgCategoryRecs.stream().
+                                    collect(Collectors.groupingBy(WorkerServiceCategoryDetail::getType));
+                        }
+                    }
+                    // 同步-师傅服务的类目信息 无则插入
+                    getServiceCategory(wvos, wscList, wscdList, sysDict, wxgDownload, wxgCategoryTypeRecs,
+                            sysDictRefMap, workerBrandAccount, workerServiceCategoryDetailList);
+                    // 新增或修改(师傅服务的类目)
+                    addDataCategory(wscList, wscdList);
+
+                    // 清理缓存,把新增的服务类目加到缓存中
+                    extractedCaretory(wscList, wscdList, workerServiceCategoryDetailMap, workerBrandAccount);
+                }  else {
+                    log.info("工程师信息同步失败:{}", JSONObject.toJSONString(req));
+                    log.info("msg:{}", response.getMsg());
+                }
+            } catch (Exception ex) {
+                log.info("工程师信息同步失败:{}", ex);
+            }
+
+        }
+    }
+    */
+
+
     /**
      * 同步师傅服务类目、品类、工单类型等信息
      * @param wxgDownload 师傅信息
@@ -1971,11 +2046,6 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
                                     List<WorkerBrandAccount> workerBrandAccounts,
                                     List<WorkerServiceCategoryDetail> workerServiceCategoryDetails,
                                     SysDict serviceCategoryDict,Map<String, List<SysDictRef>> sysDictRefMap) throws Exception {
-
-//        if(!StringUtils.equals(wxgDownload.getWxgmc(),"王志兵") && !StringUtils.equals(wxgDownload.getWxgmc(),"黄逸辉")){
-//            return;
-//        }
-
         Map<String,Object> req = new HashMap<>();
         WangdianWxgVos wvos = new WangdianWxgVos();
         Map<String, List<WorkerServiceCategoryDetail>> wxgCategoryTypeRecs = new HashMap<>();
@@ -2011,23 +2081,18 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
             try {
                 // 格力总部查询工程师信息
                 GreeResponseHelper response = greeLogic.greePost(wdqyapi, JSONObject.toJSONString(req), publicService.getCompanyId(wxgDownload.getWdno()));
-                /*if (brandWorkerIdo.equals(workerBrandAccount.getBrandWorkerId()) || brandWorkerIdt.equals(workerBrandAccount.getBrandWorkerId())){
-                    log.info("response {}",JSONObject.toJSONString(response));
-                }*/
-                if(response.getStatus() != 200 ){
-                    log.error("工程师信息同步失败:{}", JSONObject.toJSONString(req));
-                    log.error("工程师信息同步失败msg:{}", response.getMsg());
-                }
 
-                WxgQueryInfo resultDatax = JSONObject.parseObject(response.getData().toString(), WxgQueryInfo.class);
-                // 无信息不处理
-                if ( resultDatax.getWangdianWxgVos().size()<1){
-                    continue;
-                }
-                //网点维修工基础资料
-                wvos = resultDatax.getWangdianWxgVos().get(0);
+                if (response.getStatus() == 200){
 
-                // 提取师傅的服务大类信息 先内存中查询
+                    WxgQueryInfo resultDatax = JSONObject.parseObject(response.getData().toString(), WxgQueryInfo.class);
+                    // 无信息不处理
+                    if ( resultDatax.getWangdianWxgVos().size()<1){
+                        continue;
+                    }
+                    //网点维修工基础资料
+                    wvos = resultDatax.getWangdianWxgVos().get(0);
+
+                    // 提取师傅的服务大类信息 先内存中查询
 //                if (workerServiceCategoryDetailMap.containsKey(String.valueOf(wxgDownload.getWxgid()))){
 //                    wxgCategoryTypeRecs = workerServiceCategoryDetailMap.get(workerBrandAccount.getWebsitWorkerId()).stream().
 //                            collect(Collectors.groupingBy(WorkerServiceCategoryDetail::getType));
@@ -2041,16 +2106,20 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
 //                                collect(Collectors.groupingBy(WorkerServiceCategoryDetail::getType));
 //                    }
 //                }
-                // 同步-师傅服务的类目信息 无则插入
-                getServiceCategory(wvos, serviceCategoryDict, wxgDownload, wxgCategoryTypeRecs,
-                        sysDictRefMap, workerBrandAccount);
+                    // 同步-师傅服务的类目信息 无则插入
+                    getServiceCategory(wvos, serviceCategoryDict, wxgDownload, wxgCategoryTypeRecs,
+                            sysDictRefMap, workerBrandAccount);
 
-                // 新增或修改(师傅服务的类目)
-                //addDataCategory(wscList, wscdList);
+                    // 新增或修改(师傅服务的类目)
+                    //addDataCategory(wscList, wscdList);
 
-                // 清理缓存,把新增的服务类目加到缓存中
-                //extractedCaretory(wscList, wscdList, workerServiceCategoryDetailMap, workerBrandAccount);
+                    // 清理缓存,把新增的服务类目加到缓存中
+                    //extractedCaretory(wscList, wscdList, workerServiceCategoryDetailMap, workerBrandAccount);
 
+                } else {
+                    log.error("工程师服务类目信息同步失败:{}", JSONObject.toJSONString(req));
+                    log.error("工程师服务类目信息同步失败msg:{}", response.getMsg());
+                }
             } catch (Exception ex) {
                 log.info("工程师信息同步失败:{}", ex);
             }
@@ -2083,6 +2152,36 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
 //    }
 
 
+    /*private void getServiceCategoryBak(WangdianWxgVos wvos, List<WorkerServiceCategory> wscList, List<WorkerServiceCategoryDetail> wscdList,
+                                    SysDict sysDict, ItfTblWangdianWxgDownload wxg,
+                                    Map<String,List<WorkerServiceCategoryDetail>> wxgCategoryTypeRecs,
+                                    Map<String, List<SysDictRef>> sysDictRefMap,WorkerBrandAccount workerBrandAccount,
+                                    List<String> workerServiceCategoryDetailList) {
+        List<String> complete = new ArrayList<>();
+        // 先处理商用
+        for (SignSplb syitem: wvos.getSySignSplbList()){
+            // 扫描每个大类
+            for (String s :syitem.getFwlbList()){
+                // 师傅服务的大类中查看是否存在 不存在新增
+                extracted(wscList, wscdList, complete, sysDict, wxg, wxgCategoryTypeRecs,
+                        syitem, s, ServiceCategoryEnum.COMMERCIAL_TYPE.getCode(), sysDictRefMap,
+                        workerBrandAccount, workerServiceCategoryDetailList);
+            }
+        }
+        complete.clear();
+
+        // 处理家用
+        for (SignSplb syitem: wvos.getJySignSplbList()){
+            // 扫描每个大类
+            for (String s :syitem.getFwlbList()){
+                // 师傅服务的大类中查看是否存在 不存在新增
+                extracted(wscList, wscdList, complete, sysDict, wxg, wxgCategoryTypeRecs,
+                        syitem, s,ServiceCategoryEnum.HOME_TYPE.getCode(), sysDictRefMap,
+                        workerBrandAccount, workerServiceCategoryDetailList);
+            }
+        }
+    }*/
+
     private void getServiceCategory(WangdianWxgVos wvos,
                                     SysDict sysDict, ItfTblWangdianWxgDownload wxg,
                                     Map<String,List<WorkerServiceCategoryDetail>> wxgCategoryTypeRecs,