|
@@ -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时不处理
|