|
@@ -118,100 +118,111 @@ public class UploadWorkerTOGree {
|
|
recs = getWorkerUploads();
|
|
recs = getWorkerUploads();
|
|
|
|
|
|
for (OutWorkerUpload item:recs){
|
|
for (OutWorkerUpload item:recs){
|
|
- WorkUploadInfo req = new WorkUploadInfo();
|
|
|
|
- WorkerCertificateInfo workerCertificateInfo = new WorkerCertificateInfo();
|
|
|
|
|
|
+ try{
|
|
|
|
+ WorkUploadInfo req = new WorkUploadInfo();
|
|
|
|
+ WorkerCertificateInfo workerCertificateInfo = new WorkerCertificateInfo();
|
|
|
|
|
|
- // 获取师傅信息
|
|
|
|
- if (!workersMap.containsKey(item.getWorkerId())){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- worker = workersMap.get(item.getWorkerId()).get(0);
|
|
|
|
-
|
|
|
|
- // 查看师傅是否已选中品牌商 先同步状态为无效状态
|
|
|
|
- workerBrandAccount = getWorkerBrandAccount(brand, item, worker);
|
|
|
|
- if (workerBrandAccount == null || workerBrandAccount.size()<1) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 格力一个师傅最多三个有效网点超3个网点不能同步
|
|
|
|
- if (checkWebsitSum(workerBrandAccount,item)){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 查看师傅服务区域
|
|
|
|
- workerStreet = getWorkerStreet(item, worker);
|
|
|
|
- if (workerStreet == null) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ // 获取师傅信息
|
|
|
|
+ if (!workersMap.containsKey(item.getWorkerId())){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ worker = workersMap.get(item.getWorkerId()).get(0);
|
|
|
|
|
|
- // 提取师傅证件信息,未同步时不处理
|
|
|
|
- if (getCertificateInfo(workerCertificateInfo, worker.getWorkerId())){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ // 查看师傅是否已选中品牌商 先同步状态为无效状态
|
|
|
|
+ workerBrandAccount = getWorkerBrandAccount(brand, item, worker);
|
|
|
|
+ if (workerBrandAccount == null || workerBrandAccount.size()<1) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
- // 必要条件必须满足,否则不进行数据上传动作
|
|
|
|
- if (checkNecessary(worker, item, workerCertificateInfo)){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ // 格力一个师傅最多三个有效网点超3个网点不能同步
|
|
|
|
+ if (checkWebsitSum(workerBrandAccount,item)){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
- // 获取签约品类
|
|
|
|
- if (getCategory(brand, jySignSplbList, sySignSplbList, worker, item)){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ // 查看师傅服务区域
|
|
|
|
+ workerStreet = getWorkerStreet(item, worker);
|
|
|
|
+ if (workerStreet == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
- // 生成数据对象 证件
|
|
|
|
- getreq(workerCertificateInfo, req, worker);
|
|
|
|
-
|
|
|
|
- // 按网点同步
|
|
|
|
- for (WorkerBrandAccount dot: workerBrandAccount){
|
|
|
|
- //网点未签约品类时该网点师傅信息不同步
|
|
|
|
- GreeResponseHelper response = getwdqylbxx(wdqyapi,dot.getBrandWebsitNumber());
|
|
|
|
- if (response.getStatus() == 200){
|
|
|
|
- // 获取网点签约的品类信息
|
|
|
|
- websitqypl = JSONObject.parseObject(response.getData().toString(), WebsitQXLB.class);
|
|
|
|
- } else {
|
|
|
|
- // 写入表备注信息
|
|
|
|
- updateWorkerUploadLag(item,"获取网点签约的品类信息失败");
|
|
|
|
- break;
|
|
|
|
|
|
+ // 提取师傅证件信息,未同步时不处理
|
|
|
|
+ if (getCertificateInfo(workerCertificateInfo, worker.getWorkerId())){
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
|
|
|
|
- // 从网点签约的品类信息中过滤师傅的品类信息
|
|
|
|
- extracted(jySignSplbList, sySignSplbList, jyList, syList, websitqypl);
|
|
|
|
|
|
+ // 必要条件必须满足,否则不进行数据上传动作
|
|
|
|
+ if (checkNecessary(worker, item, workerCertificateInfo)){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
- // 过滤后无品类,不能上传
|
|
|
|
- if (jyList.size()<1 && syList.size()<1){
|
|
|
|
- // 写入表备注信息
|
|
|
|
- updateWorkerUploadLag(item,"师傅签约品类过滤后不能同时为空");
|
|
|
|
|
|
+ // 获取签约品类
|
|
|
|
+ if (getCategory(brand, jySignSplbList, sySignSplbList, worker, item)){
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
- // 按网点过滤师傅的类别信息
|
|
|
|
- req.setJySignSplbList(jyList);
|
|
|
|
- req.setSySignSplbList(syList);
|
|
|
|
|
|
+ // 生成数据对象 证件
|
|
|
|
+ getreq(workerCertificateInfo, req, worker);
|
|
|
|
|
|
- // 服务人员编号(不填值为新增,填值为修改)
|
|
|
|
- if (StringUtils.isNotEmpty(dot.getBrandWorkerNumber())){
|
|
|
|
- req.setWxgno(dot.getBrandWorkerNumber());
|
|
|
|
- // 重值部分数据 以格力门店数据为准
|
|
|
|
- resetParameter(wdwxgMap, req);
|
|
|
|
- } else {
|
|
|
|
- // 省份-城市-区县-乡镇
|
|
|
|
- if (extractedPCAS(req, workerStreet,brand.getBrandId(),item)){
|
|
|
|
|
|
+ // 按网点同步
|
|
|
|
+ for (WorkerBrandAccount dot: workerBrandAccount){
|
|
|
|
+ //网点未签约品类时该网点师傅信息不同步
|
|
|
|
+ GreeResponseHelper response = getwdqylbxx(wdqyapi,dot.getBrandWebsitNumber());
|
|
|
|
+ if (response.getStatus() == 200){
|
|
|
|
+ // 获取网点签约的品类信息
|
|
|
|
+ websitqypl = JSONObject.parseObject(response.getData().toString(), WebsitQXLB.class);
|
|
|
|
+ } else {
|
|
|
|
+ // 写入表备注信息
|
|
|
|
+ updateWorkerUploadLag(item,"获取网点签约的品类信息失败");
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 从网点签约的品类信息中过滤师傅的品类信息
|
|
|
|
+ extracted(jySignSplbList, sySignSplbList, jyList, syList, websitqypl);
|
|
|
|
+
|
|
|
|
+ // 过滤后无品类,不能上传
|
|
|
|
+ if (jyList.size()<1 && syList.size()<1){
|
|
|
|
+ // 写入表备注信息
|
|
|
|
+ updateWorkerUploadLag(item,"师傅签约品类过滤后不能同时为空");
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- }
|
|
|
|
- // 所属网点
|
|
|
|
- req.setWdno(dot.getBrandWebsitNumber());
|
|
|
|
|
|
|
|
- // 日志
|
|
|
|
- log.info("报文:{}",JSONObject.toJSONString(req));
|
|
|
|
|
|
+ // 按网点过滤师傅的类别信息
|
|
|
|
+ req.setJySignSplbList(jyList);
|
|
|
|
+ req.setSySignSplbList(syList);
|
|
|
|
|
|
- // 同步
|
|
|
|
- syncData(dot.getId(), wxgaddapi, item, req);
|
|
|
|
|
|
+ // 服务人员编号(不填值为新增,填值为修改)
|
|
|
|
+ if (StringUtils.isNotEmpty(dot.getBrandWorkerNumber())){
|
|
|
|
+ req.setWxgno(dot.getBrandWorkerNumber());
|
|
|
|
+ // 重值部分数据 以格力门店数据为准
|
|
|
|
+ resetParameter(wdwxgMap, req);
|
|
|
|
+ } else {
|
|
|
|
+ // 省份-城市-区县-乡镇
|
|
|
|
+ if (extractedPCAS(req, workerStreet,brand.getBrandId(),item)){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 所属网点
|
|
|
|
+ req.setWdno(dot.getBrandWebsitNumber());
|
|
|
|
|
|
- jyList.clear();
|
|
|
|
- syList.clear();
|
|
|
|
- }
|
|
|
|
|
|
+ // 日志
|
|
|
|
+ log.info("报文:{}",JSONObject.toJSONString(req));
|
|
|
|
+
|
|
|
|
+ // 同步
|
|
|
|
+ syncData(dot.getId(), wxgaddapi, item, req);
|
|
|
|
+
|
|
|
|
+ jyList.clear();
|
|
|
|
+ syList.clear();
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ String msg ="同步失败";
|
|
|
|
+ if (ex.getMessage() != null){
|
|
|
|
+ msg = ex.getMessage();
|
|
|
|
+ }
|
|
|
|
+ if (ex.getMessage() != null && ex.getMessage().trim().length() > 255) {
|
|
|
|
+ msg = ex.getMessage().substring(0, 255);
|
|
|
|
+ }
|
|
|
|
+ updateWorkerUploadLag(item,msg);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
log.info("同步师傅信息到格力总部完成: \uF0B7{}",sdf.format(new Date()));
|
|
log.info("同步师傅信息到格力总部完成: \uF0B7{}",sdf.format(new Date()));
|
|
@@ -247,7 +258,7 @@ public class UploadWorkerTOGree {
|
|
List<String> jyfwlbList = new ArrayList<>();
|
|
List<String> jyfwlbList = new ArrayList<>();
|
|
|
|
|
|
// 过滤商用品类
|
|
// 过滤商用品类
|
|
- if (websitqypl.getSySignSplbList().size()>0){
|
|
|
|
|
|
+ if (websitqypl.getSySignSplbList().size()>0 && sySignSplbList.size()>0){
|
|
// 大类名称 取交集
|
|
// 大类名称 取交集
|
|
websitqypl.getSySignSplbList().get(0).getFwlbList().retainAll(sySignSplbList.get(0).getFwlbList());
|
|
websitqypl.getSySignSplbList().get(0).getFwlbList().retainAll(sySignSplbList.get(0).getFwlbList());
|
|
syfwlbList.addAll(websitqypl.getSySignSplbList().get(0).getFwlbList());
|
|
syfwlbList.addAll(websitqypl.getSySignSplbList().get(0).getFwlbList());
|
|
@@ -268,14 +279,14 @@ public class UploadWorkerTOGree {
|
|
}
|
|
}
|
|
|
|
|
|
// 过滤家用品类
|
|
// 过滤家用品类
|
|
- if (websitqypl.getJySignSplbList().size()>0){
|
|
|
|
|
|
+ if (websitqypl.getJySignSplbList().size()>0 && jySignSplbList.size()>0){
|
|
// 大类名称 取交集
|
|
// 大类名称 取交集
|
|
websitqypl.getJySignSplbList().get(0).getFwlbList().retainAll(jySignSplbList.get(0).getFwlbList());
|
|
websitqypl.getJySignSplbList().get(0).getFwlbList().retainAll(jySignSplbList.get(0).getFwlbList());
|
|
jyfwlbList.addAll(websitqypl.getJySignSplbList().get(0).getFwlbList());
|
|
jyfwlbList.addAll(websitqypl.getJySignSplbList().get(0).getFwlbList());
|
|
// 品类
|
|
// 品类
|
|
for (SignSplb sy : jySignSplbList){
|
|
for (SignSplb sy : jySignSplbList){
|
|
for (SignSplb wdjy: websitqypl.getJySignSplbList()){
|
|
for (SignSplb wdjy: websitqypl.getJySignSplbList()){
|
|
- if (wdjy.getSpdl().equals(sy.getSpdl()) && wdjy.getSpxl().equals(sy.getSpxl())){
|
|
|
|
|
|
+ /*if (wdjy.getSpdl().equals(sy.getSpdl()) && wdjy.getSpxl().equals(sy.getSpxl())){
|
|
SignSplb one = new SignSplb();
|
|
SignSplb one = new SignSplb();
|
|
one.setFwlbList(syfwlbList);
|
|
one.setFwlbList(syfwlbList);
|
|
one.setSpdl(wdjy.getSpdl());
|
|
one.setSpdl(wdjy.getSpdl());
|
|
@@ -283,6 +294,25 @@ public class UploadWorkerTOGree {
|
|
one.setSpxl(wdjy.getSpxl());
|
|
one.setSpxl(wdjy.getSpxl());
|
|
one.setSpxlName(wdjy.getSpxlName());
|
|
one.setSpxlName(wdjy.getSpxlName());
|
|
jyList.add(one);
|
|
jyList.add(one);
|
|
|
|
+ }*/
|
|
|
|
+ if (wdjy.getSpdl().equals(sy.getSpdl())){
|
|
|
|
+ if (wdjy.getSpxl() !=null){
|
|
|
|
+ if (wdjy.getSpxl().equals(sy.getSpxl())){
|
|
|
|
+ SignSplb one = new SignSplb();
|
|
|
|
+ one.setFwlbList(syfwlbList);
|
|
|
|
+ one.setSpdl(wdjy.getSpdl());
|
|
|
|
+ one.setSpdlName(wdjy.getSpdlName());
|
|
|
|
+ one.setSpxl(wdjy.getSpxl());
|
|
|
|
+ one.setSpxlName(wdjy.getSpxlName());
|
|
|
|
+ jyList.add(one);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ SignSplb one = new SignSplb();
|
|
|
|
+ one.setFwlbList(syfwlbList);
|
|
|
|
+ one.setSpdl(wdjy.getSpdl());
|
|
|
|
+ one.setSpdlName(wdjy.getSpdlName());
|
|
|
|
+ jyList.add(one);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -658,6 +688,7 @@ public class UploadWorkerTOGree {
|
|
.eq(BrandLbsRelate::getLbsCityId,workerStreet.getCityId())
|
|
.eq(BrandLbsRelate::getLbsCityId,workerStreet.getCityId())
|
|
.eq(BrandLbsRelate::getLbsDistrictId,workerStreet.getAreaId())
|
|
.eq(BrandLbsRelate::getLbsDistrictId,workerStreet.getAreaId())
|
|
.eq(BrandLbsRelate::getBrandId,brandId).list();
|
|
.eq(BrandLbsRelate::getBrandId,brandId).list();
|
|
|
|
+ log.info("workerStreet: {}",workerStreet);
|
|
if (braa != null && braa.size()>0){
|
|
if (braa != null && braa.size()>0){
|
|
Area c = areaService.lambdaQuery()
|
|
Area c = areaService.lambdaQuery()
|
|
.eq(Area::getAreaId,braa.get(0).getAreaId()).one();
|
|
.eq(Area::getAreaId,braa.get(0).getAreaId()).one();
|