|
@@ -229,6 +229,29 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
wcgs.add(awc);
|
|
|
}
|
|
|
|
|
|
+ private void getWorkerCertGreeOtherInfo(String outFile, String outFilet,
|
|
|
+ List<WorkerCertGree> wcgs, WorkerCert item,
|
|
|
+ OutWorkerUpload owu) {
|
|
|
+ WorkerCertGree awc = new WorkerCertGree();
|
|
|
+ awc.setWorkerCertGreeId(IdWorker.getIdStr());
|
|
|
+ awc.setWorkerId(owu.getWorkerId());
|
|
|
+ awc.setBrandWebsitId(owu.getBrandWebsitId());
|
|
|
+ awc.setCertName(item.getCertName());
|
|
|
+ awc.setCertNo(item.getCertNo());
|
|
|
+ awc.setStartTime(item.getStartTime());
|
|
|
+ awc.setExpireTime(item.getExpireTime());
|
|
|
+ awc.setReviewTime(item.getReviewTime());
|
|
|
+ awc.setCreateTime(new Date());
|
|
|
+ if (StringUtils.isNotEmpty(outFile)){
|
|
|
+ awc.setOutFileUrl(outFile);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(outFilet)){
|
|
|
+ awc.setOutFileUrl2(outFilet);
|
|
|
+ }
|
|
|
+ publicService.setCertFlag(item.getCertName(), awc);
|
|
|
+ wcgs.add(awc);
|
|
|
+ }
|
|
|
+
|
|
|
private void setWorkerCertGreeIdbak(WorkerBrandAccount wdno, WorkerCertGree awc) {
|
|
|
WorkerCertGree wcg = workerCertGreeService.lambdaQuery()
|
|
|
.eq(WorkerCertGree::getWorkerId, wdno.getWorkerId())
|
|
@@ -281,6 +304,8 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
// 存在保险才同步
|
|
|
if (StringUtils.isEmpty(item.getInsureFiles()) &&
|
|
|
StringUtils.isEmpty(item.getInsureFiles().trim())){
|
|
|
+ owu.setSyncStatus(99);
|
|
|
+ updateOutWorkerUploadError(owu,"师傅保险信息不存在");
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
|
|
|
@@ -292,6 +317,7 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
|
|
|
// 未选择品牌商
|
|
|
if (wbaRecord ==null ){
|
|
|
+ owu.setSyncStatus(99);
|
|
|
updateOutWorkerUploadError(owu,"师傅未选择格力品牌商信息");
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
@@ -303,6 +329,7 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
fileo = uploadInsureBx(item,wbaRecord);
|
|
|
// 同步失败
|
|
|
if (StringUtils.isEmpty(fileo)){
|
|
|
+ updateOutWorkerUploadError(owu,"同步师傅保险证件失败");
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
|
// 生成网点保险数据实体
|
|
@@ -320,6 +347,7 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
msg = msg + ex.getMessage();
|
|
|
}
|
|
|
updateOutWorkerUploadError(owu,msg);
|
|
|
+ return Boolean.FALSE;
|
|
|
}
|
|
|
|
|
|
return Boolean.TRUE;
|
|
@@ -330,7 +358,7 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
List<WorkerCertGree> workerbx = new ArrayList<>();
|
|
|
List<String> workerbxList = new ArrayList<>();
|
|
|
Boolean isok = Boolean.TRUE;
|
|
|
-
|
|
|
+ List<WorkerCertGree> wcgs = new ArrayList<>();
|
|
|
|
|
|
// 提取师傅的证件数据
|
|
|
List<WorkerCert> recs = workerCertService.lambdaQuery()
|
|
@@ -340,7 +368,6 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 提取指定网点、师傅的证件数据
|
|
|
workerbx = workerCertGreeService.lambdaQuery()
|
|
|
.eq(WorkerCertGree::getWorkerId,owu.getWorkerId())
|
|
@@ -353,8 +380,6 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
workerbx.clear();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
for (WorkerCert item :recs){
|
|
|
isok = Boolean.FALSE;
|
|
|
// 证件已同步无需再次同步或是更新
|
|
@@ -378,146 +403,79 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
}
|
|
|
|
|
|
// 证件同步到总部对应的网点
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ if (!extractedUpCert(owu, wcgs, item)){
|
|
|
+ return Boolean.FALSE;
|
|
|
+ }
|
|
|
}
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- List<WorkerBrandAccount> workerWdnos = new ArrayList<>();
|
|
|
+ private Boolean extractedUpCert(OutWorkerUpload owu, List<WorkerCertGree> wcgs, WorkerCert item) {
|
|
|
String filePatho ="";
|
|
|
String filePatht ="";
|
|
|
String fileIdo ="";
|
|
|
String fileIdt ="";
|
|
|
- Integer count = 0;
|
|
|
Boolean upf=Boolean.TRUE;
|
|
|
String outFile="";
|
|
|
String outFilet="";
|
|
|
- List<WorkerCertGree> wcgs = new ArrayList<>();
|
|
|
- Map<String,String> wcgids = new HashMap<>();
|
|
|
-
|
|
|
- // 提取品牌信息 用于多品牌数据同步目前仅格力,可以先不用做
|
|
|
- Brand brand = baseService.getBrand();
|
|
|
- if (brand == null) {
|
|
|
- return Boolean.FALSE;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- List<WorkerCertGree> wcgsold = workerCertGreeService.lambdaQuery().list();
|
|
|
- if (CollectionUtils.isNotEmpty(wcgsold)){
|
|
|
- wcgsold.stream().forEach(event->{
|
|
|
- wcgids.put(event.getWorkerId() + event.getBrandWebsitId() + event.getCertName(),event.getWorkerCertGreeId());
|
|
|
- });
|
|
|
- wcgsold.clear();
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
- // 获取待同步到格力总部师傅的证件信息
|
|
|
- recs = getWorkerUploads();
|
|
|
-
|
|
|
- // 测试用
|
|
|
- // recs = getWorkerUploadstest();
|
|
|
+ try{
|
|
|
|
|
|
- for (WorkerCert item:recs){
|
|
|
- count = 0;
|
|
|
+ // 生成图片 System.getProperty("java.io.tmpdir")
|
|
|
+ if (StringUtils.isNotEmpty(item.getFileUrl()) && (StringUtils.isEmpty(item.getOutFileUrl()))){
|
|
|
+ fileIdo = IdWorker.getIdStr() + ".jpeg";
|
|
|
+ filePatho = publicService.pathToGree(fileIdo);
|
|
|
+ File nFile = publicService.createf(filePatho);
|
|
|
+ // 下载文件生成新文件 fid1
|
|
|
+ baseService.saveToFile(ossUtil.getUrlWw(item.getFileUrl()),nFile);
|
|
|
|
|
|
- try{
|
|
|
- // 证件已同步无需再次同步或是更新
|
|
|
- if ((StringUtils.isNotEmpty(item.getFileUrl()) && (StringUtils.isNotEmpty(item.getOutFileUrl()))) &&
|
|
|
- (StringUtils.isNotEmpty(item.getFileUrl2()) && (StringUtils.isNotEmpty(item.getOutFileUrl2())))){
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 查看师傅是否已选中品牌商网点(这里只提取选中格力品牌商的师傅数据)
|
|
|
- workerWdnos = workerBrandAccountService.lambdaQuery()
|
|
|
- .eq(WorkerBrandAccount::getWorkerId, item.getWorkerId())
|
|
|
- .eq(WorkerBrandAccount::getBrandWorkerStatus,"ON")
|
|
|
- .eq(WorkerBrandAccount::getDel,0)
|
|
|
- .eq(WorkerBrandAccount::getGroupCompanyId, brand.getBrandId()).list();
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(item.getFileUrl2()) && (StringUtils.isEmpty(item.getOutFileUrl2()))){
|
|
|
+ fileIdt = IdWorker.getIdStr() + ".jpeg";
|
|
|
+ filePatht = publicService.pathToGree(fileIdt);
|
|
|
+ File nFile = publicService.createf(filePatht);
|
|
|
+ // 下载文件生成新文件 fid2
|
|
|
+ baseService.saveToFile(ossUtil.getUrlWw(item.getFileUrl2()),nFile);
|
|
|
+ }
|
|
|
|
|
|
- // 未选择品牌商
|
|
|
- if (workerWdnos.size()<1){
|
|
|
- updateWorkCertificateerror(item,"师傅未选择格力品牌商信息");
|
|
|
- continue;
|
|
|
- }
|
|
|
|
|
|
- // 判断师傅入驻的商户网点
|
|
|
- count = getCount(workerWdnos, count);
|
|
|
- if (count.equals(workerWdnos.size())){
|
|
|
- updateWorkCertificateerror(item,"师傅未入驻品牌商网点");
|
|
|
- continue;
|
|
|
+ // 上传图片 按网点上传
|
|
|
+ if (StringUtils.isNotEmpty(filePatho)){
|
|
|
+ outFile = uploadWdnoFile(owu.getBrandWebsitId(), item, filePatho, fileIdo);
|
|
|
+ if (StringUtils.isEmpty(outFile)){
|
|
|
+ upf=Boolean.FALSE;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- // 生成图片 System.getProperty("java.io.tmpdir")
|
|
|
- if (StringUtils.isNotEmpty(item.getFileUrl()) && (StringUtils.isEmpty(item.getOutFileUrl()))){
|
|
|
- fileIdo = IdWorker.getIdStr() + ".jpeg";
|
|
|
- filePatho = publicService.pathToGree(fileIdo);
|
|
|
- File nFile = publicService.createf(filePatho);
|
|
|
- // 下载文件生成新文件 fid1
|
|
|
- baseService.saveToFile(ossUtil.getUrlWw(item.getFileUrl()),nFile);
|
|
|
-
|
|
|
+ if (StringUtils.isNotEmpty(filePatht)){
|
|
|
+ outFilet = uploadWdnoFile(owu.getBrandWebsitId(), item, filePatht, fileIdt);
|
|
|
+ if (StringUtils.isEmpty(outFilet)){
|
|
|
+ upf=Boolean.FALSE;
|
|
|
}
|
|
|
- if (StringUtils.isNotEmpty(item.getFileUrl2()) && (StringUtils.isEmpty(item.getOutFileUrl2()))){
|
|
|
- fileIdt = IdWorker.getIdStr() + ".jpeg";
|
|
|
- filePatht = publicService.pathToGree(fileIdt);
|
|
|
- File nFile = publicService.createf(filePatht);
|
|
|
- // 下载文件生成新文件 fid2
|
|
|
- baseService.saveToFile(ossUtil.getUrlWw(item.getFileUrl2()),nFile);
|
|
|
- }
|
|
|
-
|
|
|
- // 上传图片 按网点上传
|
|
|
- for (WorkerBrandAccount wdno: workerWdnos){
|
|
|
- outFile="";
|
|
|
- outFilet="";
|
|
|
- upf=Boolean.TRUE;
|
|
|
-
|
|
|
- if (StringUtils.isEmpty(wdno.getBrandWebsitId())){
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- if (StringUtils.isNotEmpty(filePatho)){
|
|
|
- outFile = uploadWdnoFile(wdno.getBrandWebsitId(), item, filePatho, fileIdo);
|
|
|
- if (StringUtils.isEmpty(outFile)){
|
|
|
- upf=Boolean.FALSE;
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(filePatht)){
|
|
|
- outFilet = uploadWdnoFile(wdno.getBrandWebsitId(), item, filePatht, fileIdt);
|
|
|
- if (StringUtils.isEmpty(outFilet)){
|
|
|
- upf=Boolean.FALSE;
|
|
|
- }
|
|
|
- }
|
|
|
- // 网点上传成功 生成对像
|
|
|
- if (upf){
|
|
|
- getWorkerCertGreeInfo(outFile, outFilet, wcgs, item, wdno, wcgids);
|
|
|
- }
|
|
|
- }
|
|
|
- // 上传完后师傅所在网点的证件保存,并写入更新表待师傅证件修改
|
|
|
- // 保存最后网点图,目的下次无需再同步图片
|
|
|
- extractedEnd(wcgs, item, outFile, outFilet);
|
|
|
+ // 网点上传成功 生成对像
|
|
|
+ if (upf){
|
|
|
+ getWorkerCertGreeOtherInfo(outFile, outFilet, wcgs, item, owu);
|
|
|
+ }
|
|
|
+ // 保存网点证件,目的下次无需再同步图片
|
|
|
+ if (wcgs.size()>0){
|
|
|
+ workerCertGreeService.saveOrUpdateBatch(wcgs);
|
|
|
+ wcgs.clear();
|
|
|
+ }
|
|
|
|
|
|
- // 文件清除
|
|
|
- delfile(filePatho, filePatht, "");
|
|
|
+ // 文件清除
|
|
|
+ delfile(filePatho, filePatht, "");
|
|
|
|
|
|
- } catch (Exception ex) {
|
|
|
- ex.printStackTrace();
|
|
|
- log.info("同步师傅证件失败:【" + item.getId() + "】");
|
|
|
- String msg = "同步师傅证件失败:";
|
|
|
- if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotEmpty(ex.getMessage())){
|
|
|
- msg = msg + ex.getMessage();
|
|
|
- }
|
|
|
- updateWorkCertificateerror(item,msg);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ log.info("同步师傅入驻新网点证件失败:【" + item.getId() + "】");
|
|
|
+ String msg = "同步师傅入驻新网点证件失败:";
|
|
|
+ if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotEmpty(ex.getMessage())){
|
|
|
+ msg = msg + ex.getMessage();
|
|
|
}
|
|
|
+ updateOutWorkerUploadError(owu,msg);
|
|
|
+ return Boolean.FALSE;
|
|
|
}
|
|
|
return Boolean.TRUE;
|
|
|
}
|