|
@@ -2,7 +2,7 @@ package com.zfire.jiasm.syncdata.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.zfire.jiasm.syncdata.base.BaseService;
|
|
|
import com.zfire.jiasm.syncdata.constant.DictTypeEnum;
|
|
|
import com.zfire.jiasm.syncdata.constant.ServiceCategoryEnum;
|
|
@@ -24,6 +24,7 @@ import com.zfire.jiasm.syncdata.utils.oss.OSSUtil;
|
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -680,14 +681,9 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
|
|
|
@Override
|
|
|
public void extractedAddCategory() throws Exception {
|
|
|
List<WorkerBrandAccount> workerBrandAccounts = new ArrayList<>();
|
|
|
- Map<String, List<WorkerBrandAccount>> workerBrandAccountsMap = new HashMap<>();
|
|
|
Map<String,List<Worker>> Worker_Idcards = new HashMap<>();
|
|
|
- Map<String, List<WorkerServiceCategoryDetail>> workerServiceCategoryDetailMap = new HashMap<>();
|
|
|
Map<String, List<SysDictRef>> sysDictRefMap = new HashMap<>();
|
|
|
List<SysDictRef> sysDictRef = new ArrayList<>();
|
|
|
- List<WorkerServiceCategoryDetail> wxgCategoryRec = new ArrayList<>();
|
|
|
- List<String> workerServiceCategoryDetailList = new ArrayList<>();
|
|
|
-
|
|
|
// 提取品牌信息
|
|
|
Brand brand = baseService.getBrand();
|
|
|
if (brand == null) {
|
|
@@ -706,12 +702,12 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
|
|
|
}
|
|
|
|
|
|
// 字典表中查出ID 格力只有-家电售后
|
|
|
- SysDict sysDict = sysDictService.lambdaQuery()
|
|
|
+ SysDict serviceCategoryDict = sysDictService.lambdaQuery()
|
|
|
.eq(SysDict::getDictType, ServiceCategoryEnum.DICT_TYPE_SERVICE_CATEGORY.getCode())
|
|
|
.eq(SysDict::getDictValue,ServiceCategoryEnum.DICT_TYPE_SERVICE_CATEGORY.getText())
|
|
|
.last("limit 1")
|
|
|
.one();
|
|
|
- if (sysDict == null) {
|
|
|
+ if (serviceCategoryDict == null) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -721,6 +717,8 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
|
|
|
Worker_Idcards = oldWorkerRec.stream().collect(Collectors.groupingBy(Worker::getIdcard));
|
|
|
}
|
|
|
|
|
|
+ List<WorkerServiceCategoryDetail> workerServiceCategoryDetailList = workerServiceCategoryDetailService.list();
|
|
|
+
|
|
|
// 提取格力现有的网点师傅数据信息
|
|
|
List<ItfTblWangdianWxgDownload> wxgRecs = itfTblWangdianWxgDownloadService.lambdaQuery()
|
|
|
.select(ItfTblWangdianWxgDownload::getWxgid,
|
|
@@ -744,22 +742,24 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
|
|
|
.isNotNull(WorkerBrandAccount::getBrandWorkerNumber)
|
|
|
.isNotNull(WorkerBrandAccount::getBrandWebsitId)
|
|
|
.list();
|
|
|
- if (CollectionUtils.isNotEmpty(workerBrandAccounts)){
|
|
|
- workerBrandAccountsMap = workerBrandAccounts.stream().collect(Collectors.groupingBy(WorkerBrandAccount::getBrandWorkerId));
|
|
|
- workerBrandAccounts.clear();
|
|
|
- }
|
|
|
+// if (CollectionUtils.isNotEmpty(workerBrandAccounts)){
|
|
|
+// workerBrandAccountsMap = workerBrandAccounts.stream().collect(Collectors.groupingBy(WorkerBrandAccount::getBrandWorkerId));
|
|
|
+// workerBrandAccounts.clear();
|
|
|
+// }
|
|
|
// 这里提取对应的商户网点信息
|
|
|
|
|
|
// 提取所有师傅的服务大类信息 先内存中查询
|
|
|
- wxgCategoryRec = workerServiceCategoryDetailService.lambdaQuery().list();
|
|
|
- if (CollectionUtils.isNotEmpty(wxgCategoryRec)){
|
|
|
- workerServiceCategoryDetailMap = wxgCategoryRec.stream().collect(Collectors.groupingBy(WorkerServiceCategoryDetail::getWebsitWorkerId));
|
|
|
- }
|
|
|
-
|
|
|
- for (ItfTblWangdianWxgDownload wxgDownload :wxgRecs){
|
|
|
- if (!workerBrandAccountsMap.containsKey(String.valueOf(wxgDownload.getWxgid()))){
|
|
|
+// wxgCategoryRec = workerServiceCategoryDetailService.lambdaQuery().list();
|
|
|
+// if (CollectionUtils.isNotEmpty(wxgCategoryRec)){
|
|
|
+// workerServiceCategoryDetailMap = wxgCategoryRec.stream().collect(Collectors.groupingBy(WorkerServiceCategoryDetail::getWebsitWorkerId));
|
|
|
+// }
|
|
|
+
|
|
|
+ for (final ItfTblWangdianWxgDownload wxgDownload :wxgRecs){
|
|
|
+ long count = workerBrandAccounts.stream()
|
|
|
+ .filter(v -> StringUtils.equals(v.getBrandWebsitId(), String.valueOf(wxgDownload.getWxgid()))).count();
|
|
|
+ if(count == 0)
|
|
|
continue;
|
|
|
- }
|
|
|
+
|
|
|
// 状态无效不处理
|
|
|
if (wxgDownload.getFlag() != null){
|
|
|
if (!wxgDownload.getFlag().trim().equals(DictTypeEnum.DICT_TYPE_FLAG_ON.getCode())){
|
|
@@ -772,17 +772,8 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- wxgCategoryQueryAdd(wxgDownload,workerBrandAccountsMap,workerServiceCategoryDetailMap,sysDict,
|
|
|
- sysDictRefMap, workerServiceCategoryDetailList);
|
|
|
+ wxgCategoryQueryAdd(wxgDownload,workerBrandAccounts,workerServiceCategoryDetailList,serviceCategoryDict,sysDictRefMap);
|
|
|
}
|
|
|
-
|
|
|
- Worker_Idcards.clear();
|
|
|
- workerServiceCategoryDetailMap.clear();
|
|
|
- sysDictRefMap.clear();
|
|
|
- sysDictRef.clear();
|
|
|
- wxgCategoryRec.clear();
|
|
|
- workerServiceCategoryDetailList.clear();
|
|
|
- workerBrandAccountsMap.clear();
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -1986,20 +1977,41 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
|
|
|
return zjinfo;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 同步师傅服务类目、品类、工单类型等信息
|
|
|
+ * @param wxgDownload 师傅信息
|
|
|
+ * @param workerBrandAccounts 对应的师傅信息
|
|
|
+ * @param workerServiceCategoryDetails 对应的师傅服务类目资质
|
|
|
+ * @param serviceCategoryDict 服务类目字典
|
|
|
+ * @param sysDictRefMap 服务类目对应字典(暂不用)
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void wxgCategoryQueryAdd(ItfTblWangdianWxgDownload wxgDownload,
|
|
|
- Map<String, List<WorkerBrandAccount>> workerBrandAccountsMap,
|
|
|
- Map<String,List<WorkerServiceCategoryDetail>> workerServiceCategoryDetailMap,
|
|
|
- SysDict sysDict,Map<String, List<SysDictRef>> sysDictRefMap,
|
|
|
- List<String> workerServiceCategoryDetailList) throws Exception {
|
|
|
+ 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<>();
|
|
|
- List<WorkerServiceCategory> wscList = new ArrayList<>();
|
|
|
- List<WorkerServiceCategoryDetail> wscdList = new ArrayList<>();
|
|
|
+// List<WorkerServiceCategory> wscList = new ArrayList<>();
|
|
|
+// List<WorkerServiceCategoryDetail> wscdList = new ArrayList<>();
|
|
|
|
|
|
- String brandWorkerIdo = "294773";
|
|
|
- String brandWorkerIdt = "990003185";
|
|
|
+ //brandWorkerId = wxgid
|
|
|
+ //师傅对应关系 key = brandWorkerId value = 师傅对应关系列表
|
|
|
+ Map<String, List<WorkerBrandAccount>> workerBrandAccountsMap = workerBrandAccounts.stream()
|
|
|
+ .collect(Collectors.groupingBy(WorkerBrandAccount::getBrandWorkerId));
|
|
|
+
|
|
|
+ //师傅服务资质 key = 网点师傅id,value=资质明细
|
|
|
+ Map<String, List<WorkerServiceCategoryDetail>> workerServiceCategoryDetailMap = workerServiceCategoryDetails
|
|
|
+ .stream().collect(Collectors.groupingBy(WorkerServiceCategoryDetail::getWebsitWorkerId));
|
|
|
+// String brandWorkerIdo = "294773";
|
|
|
+// String brandWorkerIdt = "990003185";
|
|
|
|
|
|
// 提取本地商户师傅信息 网点|师傅编号不存在不处理 修改处已做了处理 这里只新增(前提是找到师傅所在网点信息)
|
|
|
for (WorkerBrandAccount workerBrandAccount:workerBrandAccountsMap.get(String.valueOf(wxgDownload.getWxgid()))){
|
|
@@ -2009,11 +2021,6 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- // 师傅对应的网点服务类目信息已存在不处理 只做插入
|
|
|
- if (workerServiceCategoryDetailList.contains(workerBrandAccount.getWebsitWorkerId())){
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
/*if (brandWorkerIdo.equals(workerBrandAccount.getBrandWorkerId()) || brandWorkerIdt.equals(workerBrandAccount.getBrandWorkerId())){
|
|
|
log.info("workerBrandAccount {}",workerBrandAccount);
|
|
|
log.info("wxgDownload {}",wxgDownload);
|
|
@@ -2024,56 +2031,46 @@ 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));
|
|
|
- } 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);
|
|
|
-
|
|
|
- /*if (brandWorkerIdo.equals(workerBrandAccount.getBrandWorkerId()) || brandWorkerIdt.equals(workerBrandAccount.getBrandWorkerId())){
|
|
|
- log.info("wscList {}",JSONObject.toJSONString(wscList));
|
|
|
- log.info("wscdList {}",JSONObject.toJSONString(wscdList));
|
|
|
- }*/
|
|
|
-
|
|
|
- // 新增或修改(师傅服务的类目)
|
|
|
- addDataCategory(wscList, wscdList);
|
|
|
+ // 提取师傅的服务大类信息 先内存中查询
|
|
|
+// 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, serviceCategoryDict, wxgDownload, wxgCategoryTypeRecs,
|
|
|
+ sysDictRefMap, workerBrandAccount);
|
|
|
+
|
|
|
+ // 新增或修改(师傅服务的类目)
|
|
|
+ //addDataCategory(wscList, wscdList);
|
|
|
+
|
|
|
+ // 清理缓存,把新增的服务类目加到缓存中
|
|
|
+ //extractedCaretory(wscList, wscdList, workerServiceCategoryDetailMap, workerBrandAccount);
|
|
|
|
|
|
- // 清理缓存,把新增的服务类目加到缓存中
|
|
|
- extractedCaretory(wscList, wscdList, workerServiceCategoryDetailMap, workerBrandAccount);
|
|
|
- } else {
|
|
|
- log.info("工程师信息同步失败:{}", JSONObject.toJSONString(req));
|
|
|
- log.info("msg:{}", response.getMsg());
|
|
|
- }
|
|
|
} catch (Exception ex) {
|
|
|
log.info("工程师信息同步失败:{}", ex);
|
|
|
}
|
|
@@ -2081,61 +2078,79 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void extractedCaretory(List<WorkerServiceCategory> wscList, List<WorkerServiceCategoryDetail> wscdList,
|
|
|
- Map<String, List<WorkerServiceCategoryDetail>> oldWxgCategoryRecMap, WorkerBrandAccount workerBrandAccount) {
|
|
|
- if (!oldWxgCategoryRecMap.containsKey(workerBrandAccount.getWebsitWorkerId())){
|
|
|
- oldWxgCategoryRecMap.put(workerBrandAccount.getWebsitWorkerId(),wscdList);
|
|
|
- }
|
|
|
-
|
|
|
- wscList.clear();
|
|
|
- wscdList.clear();
|
|
|
- }
|
|
|
-
|
|
|
- public void addDataCategory(List<WorkerServiceCategory> wscList, List<WorkerServiceCategoryDetail> wscdList) {
|
|
|
-
|
|
|
-
|
|
|
- // 师傅服务类目新增
|
|
|
- if (wscList.size()>0){
|
|
|
- workerServiceCategoryService.saveBatch(wscList);
|
|
|
- wscList.clear();
|
|
|
- }
|
|
|
- if (wscdList.size()>0){
|
|
|
- workerServiceCategoryDetailService.saveBatch(wscdList);
|
|
|
- wscdList.clear();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private void getServiceCategory(WangdianWxgVos wvos, List<WorkerServiceCategory> wscList, List<WorkerServiceCategoryDetail> wscdList,
|
|
|
+// private void extractedCaretory(List<WorkerServiceCategory> wscList, List<WorkerServiceCategoryDetail> wscdList,
|
|
|
+// Map<String, List<WorkerServiceCategoryDetail>> oldWxgCategoryRecMap, WorkerBrandAccount workerBrandAccount) {
|
|
|
+// if (!oldWxgCategoryRecMap.containsKey(workerBrandAccount.getWebsitWorkerId())){
|
|
|
+// oldWxgCategoryRecMap.put(workerBrandAccount.getWebsitWorkerId(),wscdList);
|
|
|
+// }
|
|
|
+//
|
|
|
+// wscList.clear();
|
|
|
+// wscdList.clear();
|
|
|
+// }
|
|
|
+//
|
|
|
+// public void addDataCategory(List<WorkerServiceCategory> wscList, List<WorkerServiceCategoryDetail> wscdList) {
|
|
|
+//
|
|
|
+//
|
|
|
+// // 师傅服务类目新增
|
|
|
+// if (wscList.size()>0){
|
|
|
+// workerServiceCategoryService.saveBatch(wscList);
|
|
|
+// wscList.clear();
|
|
|
+// }
|
|
|
+// if (wscdList.size()>0){
|
|
|
+// workerServiceCategoryDetailService.saveBatch(wscdList);
|
|
|
+// wscdList.clear();
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ private void getServiceCategory(WangdianWxgVos wvos,
|
|
|
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);
|
|
|
+ Map<String, List<SysDictRef>> sysDictRefMap,WorkerBrandAccount workerBrandAccount) {
|
|
|
+ Map<String,List<SignSplb>> signSplbMap = new HashMap<>();
|
|
|
+ signSplbMap.put(ServiceCategoryEnum.COMMERCIAL_TYPE.getCode(),wvos.getSySignSplbList());
|
|
|
+ signSplbMap.put(ServiceCategoryEnum.HOME_TYPE.getCode(),wvos.getJySignSplbList());
|
|
|
+
|
|
|
+ List<WorkerServiceCategory> workerServiceCategoryList = new ArrayList<>();
|
|
|
+ List<WorkerServiceCategoryDetail> workerServiceCategoryDetailList = new ArrayList<>();
|
|
|
+ // 新增或修改(师傅服务的类目)
|
|
|
+ //addDataCategory(wscList, wscdList);
|
|
|
+
|
|
|
+ //处理家用和商用的品类
|
|
|
+ for (String serviceFlag: signSplbMap.keySet()){
|
|
|
+ List<SignSplb> signSplbs = signSplbMap.get(serviceFlag);
|
|
|
+ if(CollectionUtils.isEmpty(signSplbs)){
|
|
|
+ continue;
|
|
|
}
|
|
|
- }
|
|
|
- complete.clear();
|
|
|
+ for(SignSplb syitem : signSplbs) {
|
|
|
+ //中文名的工单类型
|
|
|
+ List<String> orderTypeTexts = syitem.getFwlbList().stream().distinct().collect(Collectors.toList());
|
|
|
+ // 扫描每个工单类型
|
|
|
+ for (String s : orderTypeTexts) {
|
|
|
+ // 师傅服务的大类中查看是否存在 不存在新增
|
|
|
+ ServiceCategoryEnum serviceCategoryEnum = ServiceCategoryEnum.valueToEnum(s);
|
|
|
+ if (serviceCategoryEnum == null) {
|
|
|
+ log.error("【同步师傅服务资质】工单类型枚举匹配失败," + s);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 提取品牌商对应的大类信息
|
|
|
+ SysDictRef sysDictRef = sysDictRefMap.get(String.valueOf(syitem.getSpdl())).get(0);
|
|
|
|
|
|
- // 处理家用
|
|
|
- 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);
|
|
|
+ this.getAddInfo(workerServiceCategoryList,workerServiceCategoryDetailList,sysDict,wxgCategoryTypeRecs,
|
|
|
+ sysDictRef, serviceCategoryEnum.getCode(), serviceFlag, workerBrandAccount);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ if(CollectionUtils.isNotEmpty(workerServiceCategoryList))
|
|
|
+ workerServiceCategoryService.saveBatch(workerServiceCategoryList);
|
|
|
+ if(CollectionUtils.isNotEmpty(workerServiceCategoryDetailList))
|
|
|
+ workerServiceCategoryDetailService.saveBatch(workerServiceCategoryDetailList);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
private void getParameter(String wdno, String wxgno, Map<String, Object> req) {
|
|
|
req.put("wdno", wdno);
|
|
|
req.put("wxgno", wxgno);
|
|
@@ -2158,116 +2173,85 @@ public class GLPPWXGQueryAddServiceImpl implements GLPPWXGQueryAddService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void extracted(List<WorkerServiceCategory> wscList, List<WorkerServiceCategoryDetail> wscdList,
|
|
|
- List<String> complete, SysDict sysDict, ItfTblWangdianWxgDownload wxg,
|
|
|
- Map<String,List<WorkerServiceCategoryDetail>> wxgCategoryTypeRecs, SignSplb syitem,
|
|
|
- String s, String type,Map<String, List<SysDictRef>> sysDictRefMap,
|
|
|
- WorkerBrandAccount workerBrandAccount, List<String> workerServiceCategoryDetailList) {
|
|
|
- if ( !complete.contains(s + syitem.getSpdl())){
|
|
|
- // 提取品牌商对应的大类信息
|
|
|
- SysDictRef sysDictRef = sysDictRefMap.get(String.valueOf(syitem.getSpdl())).get(0);
|
|
|
-
|
|
|
- if (s.equals(ServiceCategoryEnum.INSTALL_TYPE.getText())){
|
|
|
- getAddInfo(wscList, wscdList, sysDict, wxg, wxgCategoryTypeRecs,
|
|
|
- sysDictRef,ServiceCategoryEnum.INSTALL_TYPE.getCode(),
|
|
|
- type,workerBrandAccount,workerServiceCategoryDetailList);
|
|
|
- } else if (s.equals(ServiceCategoryEnum.REPAIR_TYPE.getText())){
|
|
|
- getAddInfo(wscList, wscdList, sysDict, wxg, wxgCategoryTypeRecs,
|
|
|
- sysDictRef,ServiceCategoryEnum.REPAIR_TYPE.getCode(),
|
|
|
- type,workerBrandAccount,workerServiceCategoryDetailList);
|
|
|
- } else if (s.equals(ServiceCategoryEnum.DELIVERY_TYPE.getText())){
|
|
|
- getAddInfo(wscList, wscdList, sysDict, wxg, wxgCategoryTypeRecs,
|
|
|
- sysDictRef,ServiceCategoryEnum.DELIVERY_TYPE.getCode(),
|
|
|
- type,workerBrandAccount,workerServiceCategoryDetailList);
|
|
|
- }
|
|
|
- // 新增过的无需再次新增
|
|
|
- complete.add(s + syitem.getSpdl());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void getAddInfo(List<WorkerServiceCategory> wscList, List<WorkerServiceCategoryDetail> wscdList, SysDict sysDict,
|
|
|
- ItfTblWangdianWxgDownload wxg, Map<String, List<WorkerServiceCategoryDetail>> wxgCategoryTypeRecs,
|
|
|
- SysDictRef sysDictRef, String code, String type, WorkerBrandAccount workerBrandAccount,
|
|
|
- List<String> workerServiceCategoryDetailList) {
|
|
|
- Boolean include = Boolean.FALSE;
|
|
|
- // 看师傅是否已有(服务类型 INSTALL=安装 REPAIR=维修 DELIVERY=配送)对应的大类信息 如有不做任何处理
|
|
|
- if (wxgCategoryTypeRecs !=null && wxgCategoryTypeRecs.size()>0){
|
|
|
- if (wxgCategoryTypeRecs.containsKey(code)){
|
|
|
- for (WorkerServiceCategoryDetail category : wxgCategoryTypeRecs.get(code)){
|
|
|
- if (category.getMainId().equals(sysDictRef.getDictCode())){
|
|
|
- include = Boolean.TRUE;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// private void extracted(List<WorkerServiceCategory> wscList, List<WorkerServiceCategoryDetail> wscdList,
|
|
|
+// List<String> complete, SysDict sysDict, ItfTblWangdianWxgDownload wxg,
|
|
|
+// Map<String,List<WorkerServiceCategoryDetail>> wxgCategoryTypeRecs, SignSplb syitem,
|
|
|
+// ServiceCategoryEnum serviceCategoryEnum,String type,Map<String, List<SysDictRef>> sysDictRefMap,
|
|
|
+// WorkerBrandAccount workerBrandAccount) {
|
|
|
+// if ( !complete.contains(serviceCategoryEnum.getText() + syitem.getSpdl())){
|
|
|
+// // 提取品牌商对应的大类信息
|
|
|
+// SysDictRef sysDictRef = sysDictRefMap.get(String.valueOf(syitem.getSpdl())).get(0);
|
|
|
+//
|
|
|
+// this.getAddInfo(wscList, wscdList, sysDict, wxg, wxgCategoryTypeRecs,
|
|
|
+// sysDictRef,serviceCategoryEnum.getCode(),
|
|
|
+// type,workerBrandAccount);
|
|
|
+//
|
|
|
+//// if (s.equals(ServiceCategoryEnum.INSTALL_TYPE.getText())){
|
|
|
+//// getAddInfo(wscList, wscdList, sysDict, wxg, wxgCategoryTypeRecs,
|
|
|
+//// sysDictRef,ServiceCategoryEnum.INSTALL_TYPE.getCode(),
|
|
|
+//// type,workerBrandAccount);
|
|
|
+//// } else if (s.equals(ServiceCategoryEnum.REPAIR_TYPE.getText())){
|
|
|
+//// getAddInfo(wscList, wscdList, sysDict, wxg, wxgCategoryTypeRecs,
|
|
|
+//// sysDictRef,ServiceCategoryEnum.REPAIR_TYPE.getCode(),
|
|
|
+//// type,workerBrandAccount);
|
|
|
+//// } else if (s.equals(ServiceCategoryEnum.DELIVERY_TYPE.getText())){
|
|
|
+//// getAddInfo(wscList, wscdList, sysDict, wxg, wxgCategoryTypeRecs,
|
|
|
+//// sysDictRef,ServiceCategoryEnum.DELIVERY_TYPE.getCode(),
|
|
|
+//// type,workerBrandAccount);
|
|
|
+//// }
|
|
|
+// // 新增过的无需再次新增
|
|
|
+// complete.add(serviceCategoryEnum.getText() + syitem.getSpdl());
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ private void getAddInfo(List<WorkerServiceCategory> wscList,List<WorkerServiceCategoryDetail> wscdList,
|
|
|
+ SysDict sysDict,Map<String, List<WorkerServiceCategoryDetail>> wxgCategoryDetails,
|
|
|
+ SysDictRef sysDictRef, String code, String type, WorkerBrandAccount workerBrandAccount) {
|
|
|
+ // 新增
|
|
|
+ // 看 worker_service_category 有无数据,无数据新增
|
|
|
+ if(wxgCategoryDetails != null && wxgCategoryDetails.containsKey(code)){
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
- if (!include){
|
|
|
- // 新增
|
|
|
- // 看 worker_service_category 有无数据,无数据新增
|
|
|
- if (wxgCategoryTypeRecs ==null || wxgCategoryTypeRecs.size()<1 || !wxgCategoryTypeRecs.containsKey(code) ){
|
|
|
-
|
|
|
- //去重,判断是否存在
|
|
|
- List<WorkerServiceCategory> hasWorkerServiceCategory = wscList.stream().filter(v ->
|
|
|
- org.apache.commons.lang3.StringUtils.equals(v.getWebsitWorkerId(), workerBrandAccount.getWebsitWorkerId())
|
|
|
- && org.apache.commons.lang3.StringUtils.equals(v.getFlag(), type)
|
|
|
- && org.apache.commons.lang3.StringUtils.equals(v.getType(), code)
|
|
|
- ).collect(Collectors.toList());
|
|
|
-
|
|
|
- WorkerServiceCategory wsc = null;
|
|
|
- if(CollectionUtils.isNotEmpty(hasWorkerServiceCategory)){
|
|
|
- wsc = hasWorkerServiceCategory.get(0);
|
|
|
- }else {
|
|
|
- wsc = new WorkerServiceCategory();
|
|
|
- wsc.setId(IdWorker.getIdStr());
|
|
|
- wsc.setWorkerId(workerBrandAccount.getWorkerId());
|
|
|
- wsc.setWebsitId(workerBrandAccount.getWebsitId());
|
|
|
- wsc.setWebsitWorkerId(workerBrandAccount.getWebsitWorkerId());
|
|
|
- wsc.setServiceCategoryId(sysDict.getDictCode());
|
|
|
- wsc.setServiceCategoryName(sysDict.getDictValue());
|
|
|
- wsc.setFlag(type);
|
|
|
- wsc.setType(code);
|
|
|
- wsc.setCreateTime(new Date());
|
|
|
- wscList.add(wsc);
|
|
|
- }
|
|
|
-
|
|
|
- // WorkerServiceCategoryDetail 新增
|
|
|
- WorkerServiceCategoryDetail wscd = new WorkerServiceCategoryDetail();
|
|
|
- wscd.setId(IdWorker.getIdStr());
|
|
|
- wscd.setWorkerServiceCategoryId(wsc.getId());
|
|
|
- wscd.setWorkerId(workerBrandAccount.getWorkerId());
|
|
|
- wscd.setWebsitId(workerBrandAccount.getWebsitId());
|
|
|
- wscd.setWebsitWorkerId(workerBrandAccount.getWebsitWorkerId());
|
|
|
- wscd.setServiceCategoryId(sysDict.getDictCode());
|
|
|
- wscd.setServiceCategoryName(sysDict.getDictValue());
|
|
|
- wscd.setFlag(type);
|
|
|
- wscd.setType(code);
|
|
|
- wscd.setMainId(sysDictRef.getDictCode());
|
|
|
- wscd.setMainName(sysDictRef.getDictValue());
|
|
|
- wscd.setCreateTime(new Date());
|
|
|
-
|
|
|
- wscdList.add(wscd);
|
|
|
-
|
|
|
- workerServiceCategoryDetailList.add(workerBrandAccount.getWebsitWorkerId());
|
|
|
-
|
|
|
- } else {
|
|
|
- // WorkerServiceCategoryDetail 新增
|
|
|
- WorkerServiceCategoryDetail wscd = new WorkerServiceCategoryDetail();
|
|
|
- wscd.setId(IdWorker.getIdStr());
|
|
|
- wscd.setWorkerServiceCategoryId(wxgCategoryTypeRecs.get(code).get(0).getWorkerServiceCategoryId());
|
|
|
- wscd.setWorkerId(workerBrandAccount.getWorkerId());
|
|
|
- wscd.setWebsitId(workerBrandAccount.getWebsitId());
|
|
|
- wscd.setWebsitWorkerId(workerBrandAccount.getWebsitWorkerId());
|
|
|
- wscd.setServiceCategoryId(sysDict.getDictCode());
|
|
|
- wscd.setServiceCategoryName(sysDict.getDictValue());
|
|
|
- wscd.setFlag(type);
|
|
|
- wscd.setType(code);
|
|
|
- wscd.setMainId(sysDictRef.getDictCode());
|
|
|
- wscd.setMainName(sysDictRef.getDictValue());
|
|
|
- wscd.setCreateTime(new Date());
|
|
|
- wscdList.add(wscd);
|
|
|
- workerServiceCategoryDetailList.add(workerBrandAccount.getWebsitWorkerId());
|
|
|
- }
|
|
|
- }
|
|
|
+ //去重,判断是否存在
|
|
|
+ List<WorkerServiceCategory> hasWorkerServiceCategory = wscList.stream().filter(v ->
|
|
|
+ org.apache.commons.lang3.StringUtils.equals(v.getWebsitWorkerId(), workerBrandAccount.getWebsitWorkerId())
|
|
|
+ && org.apache.commons.lang3.StringUtils.equals(v.getFlag(), type)
|
|
|
+ && org.apache.commons.lang3.StringUtils.equals(v.getType(), code)
|
|
|
+ ).collect(Collectors.toList());
|
|
|
+
|
|
|
+ WorkerServiceCategory wsc = null;
|
|
|
+ if(CollectionUtils.isNotEmpty(hasWorkerServiceCategory)){
|
|
|
+ wsc = hasWorkerServiceCategory.get(0);
|
|
|
+ }else {
|
|
|
+ wsc = new WorkerServiceCategory();
|
|
|
+ wsc.setId(IdWorker.getIdStr());
|
|
|
+ wsc.setWorkerId(workerBrandAccount.getWorkerId());
|
|
|
+ wsc.setWebsitId(workerBrandAccount.getWebsitId());
|
|
|
+ wsc.setWebsitWorkerId(workerBrandAccount.getWebsitWorkerId());
|
|
|
+ wsc.setServiceCategoryId(sysDict.getDictCode());
|
|
|
+ wsc.setServiceCategoryName(sysDict.getDictValue());
|
|
|
+ wsc.setFlag(type);
|
|
|
+ wsc.setType(code);
|
|
|
+ wsc.setCreateTime(new Date());
|
|
|
+ wscList.add(wsc);
|
|
|
+ }
|
|
|
+
|
|
|
+ // WorkerServiceCategoryDetail 新增
|
|
|
+ WorkerServiceCategoryDetail wscd = new WorkerServiceCategoryDetail();
|
|
|
+ wscd.setId(IdWorker.getIdStr());
|
|
|
+ wscd.setWorkerServiceCategoryId(wsc.getId());
|
|
|
+ wscd.setWorkerId(workerBrandAccount.getWorkerId());
|
|
|
+ wscd.setWebsitId(workerBrandAccount.getWebsitId());
|
|
|
+ wscd.setWebsitWorkerId(workerBrandAccount.getWebsitWorkerId());
|
|
|
+ wscd.setServiceCategoryId(sysDict.getDictCode());
|
|
|
+ wscd.setServiceCategoryName(sysDict.getDictValue());
|
|
|
+ wscd.setFlag(type);
|
|
|
+ wscd.setType(code);
|
|
|
+ wscd.setMainId(sysDictRef.getDictCode());
|
|
|
+ wscd.setMainName(sysDictRef.getDictValue());
|
|
|
+ wscd.setCreateTime(new Date());
|
|
|
+
|
|
|
+ wscdList.add(wscd);
|
|
|
}
|
|
|
}
|