|
@@ -499,10 +499,94 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public Boolean uploadWorkeFace(OutWorkerUpload owu){
|
|
|
+ List<WorkerCertGree> wcgs = new ArrayList<>();
|
|
|
+ String fileo = "";
|
|
|
+
|
|
|
+ // 查看指定网点、师傅的人脸面像数据是否已生成
|
|
|
+ WorkerCertGree workerbx = workerCertGreeService.lambdaQuery()
|
|
|
+ .eq(WorkerCertGree::getWorkerId,owu.getWorkerId())
|
|
|
+ .eq(WorkerCertGree::getBrandWebsitId,owu.getBrandWebsitId())
|
|
|
+ .eq(WorkerCertGree::getCertFlag,9)
|
|
|
+ .last("limit 1").one();
|
|
|
+ // 已存在 无需再同步
|
|
|
+ if (workerbx != null){
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 提取品牌信息 用于多品牌数据同步目前仅格力,可以先不用做
|
|
|
+ Brand brand = baseService.getBrand();
|
|
|
+ if (brand == null) {
|
|
|
+ updateOutWorkerUploadError(owu,"格力品牌信息不存在");
|
|
|
+ return Boolean.FALSE;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取指定师傅、网点的人脸面像
|
|
|
+ Worker item = workerService.lambdaQuery()
|
|
|
+ .eq(Worker::getWorkerId,owu.getWorkerId())
|
|
|
+ .one();
|
|
|
+
|
|
|
+ if (item == null){
|
|
|
+ updateOutWorkerUploadError(owu,"无人脸面像信息请核实Worker");
|
|
|
+ return Boolean.FALSE;
|
|
|
+ }
|
|
|
+ // 无人脸面像数据不处理
|
|
|
+ if (StringUtils.isEmpty(item.getOutAuthHeadImage())){
|
|
|
+ updateOutWorkerUploadError(owu,"师傅未人脸面像实名认证");
|
|
|
+ return Boolean.FALSE;
|
|
|
+ }
|
|
|
+ // 若存在待同步的暂不处理
|
|
|
+ if (StringUtils.isNotEmpty(item.getAuthHeadImage()) &&
|
|
|
+ StringUtils.isEmpty(item.getOutAuthHeadImage())){
|
|
|
+ updateOutWorkerUploadError(owu,"等待同步人脸面像信息信息");
|
|
|
+ return Boolean.FALSE;
|
|
|
+ }
|
|
|
+
|
|
|
+ try{
|
|
|
+ // 查看师傅是否已选中品牌商网点(这里只提取选中格力品牌商的师傅数据)
|
|
|
+ WorkerBrandAccount wbaRecord = workerBrandAccountService.lambdaQuery()
|
|
|
+ .eq(WorkerBrandAccount::getWorkerId, owu.getWorkerId())
|
|
|
+ .eq(WorkerBrandAccount::getBrandWebsitId, owu.getBrandWebsitId())
|
|
|
+ .eq(WorkerBrandAccount::getGroupCompanyId, brand.getBrandId()).last("limit 1").one();
|
|
|
+
|
|
|
+ // 未选择品牌商
|
|
|
+ if (wbaRecord ==null ){
|
|
|
+ owu.setSyncStatus(99);
|
|
|
+ updateOutWorkerUploadError(owu,"师傅未选择格力品牌商信息");
|
|
|
+ return Boolean.FALSE;
|
|
|
+ }
|
|
|
+ // 上传
|
|
|
+ fileo = uploadInsureFace(item,wbaRecord);
|
|
|
+ // 同步失败
|
|
|
+ if (StringUtils.isEmpty(fileo)){
|
|
|
+ updateOutWorkerUploadError(owu,"同步师傅人脸面像失败【"+owu.getWebsitId() + "】");
|
|
|
+ return Boolean.FALSE;
|
|
|
+ }
|
|
|
+ // 生成网点保险数据实体
|
|
|
+ getWorkerCertFaceGree(wcgs, item, wbaRecord);
|
|
|
+
|
|
|
+ // 保存本地表
|
|
|
+ extractedUploadBxEnd(wcgs);
|
|
|
+ // 文件清除
|
|
|
+ delfile("", "", fileo);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ log.info("同步师傅人脸面像失败:【" + item.getWorkerId() + "】");
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public Boolean UploadWorkeCert(OutWorkerUpload owu){
|
|
|
List<WorkerCertGree> workerbx = new ArrayList<>();
|
|
|
List<String> workerbxList = new ArrayList<>();
|
|
|
- Boolean isok = Boolean.TRUE;
|
|
|
List<WorkerCertGree> wcgs = new ArrayList<>();
|
|
|
|
|
|
// 提取师傅的证件数据
|
|
@@ -526,7 +610,6 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
}
|
|
|
|
|
|
for (WorkerCert item :recs){
|
|
|
- isok = Boolean.FALSE;
|
|
|
// 证件已同步无需再次同步或是更新
|
|
|
|
|
|
// 若存在待同步的暂不处理
|
|
@@ -757,6 +840,19 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
wcgs.add(awc);
|
|
|
}
|
|
|
|
|
|
+ private void getWorkerCertFaceGree(List<WorkerCertGree> wcgs, Worker item, WorkerBrandAccount wdno) {
|
|
|
+ WorkerCertGree awc = new WorkerCertGree();
|
|
|
+ awc.setWorkerCertGreeId(IdWorker.getIdStr());
|
|
|
+ awc.setWorkerId(wdno.getWorkerId());
|
|
|
+ awc.setBrandWebsitId(wdno.getBrandWebsitId());
|
|
|
+ awc.setCertName("人脸面像");
|
|
|
+ awc.setCertNo(item.getSafeNo());
|
|
|
+ awc.setCreateTime(new Date());
|
|
|
+ awc.setOutFileUrl(item.getOutAuthHeadImage());
|
|
|
+ publicService.setCertFlag(awc.getCertName(), awc);
|
|
|
+ wcgs.add(awc);
|
|
|
+ }
|
|
|
+
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void extractedBxEnd(List<WorkerCertGree> wcgs, WebsitWorker item) throws Exception {
|
|
|
try{
|
|
@@ -1053,6 +1149,29 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
return fileAdnPath;
|
|
|
}
|
|
|
|
|
|
+ private String uploadInsureFace(Worker item,WorkerBrandAccount wdno) throws Exception {
|
|
|
+ String fileAdnPath = "";
|
|
|
+ String outInsureCert = "";
|
|
|
+ String bxf="";
|
|
|
+ String fileId = "";
|
|
|
+
|
|
|
+ // 路径
|
|
|
+ fileId = IdWorker.getIdStr() + ".jpeg";
|
|
|
+ fileAdnPath = publicService.pathToGree(fileId);
|
|
|
+ // 新文件 方便写入
|
|
|
+ File nFile = publicService.createf(fileAdnPath);
|
|
|
+ baseService.saveToFile(ossUtil.getUrlWw(item.getAuthHeadImage()),nFile);
|
|
|
+ bxf = uploadInitFileFace(fileAdnPath, fileId, wdno.getBrandWebsitId());
|
|
|
+ if (StringUtils.isEmpty(bxf)){
|
|
|
+ return bxf;
|
|
|
+ }
|
|
|
+ outInsureCert = bxf;
|
|
|
+ nFile.delete();
|
|
|
+
|
|
|
+ item.setOutAuthHeadImage(outInsureCert);
|
|
|
+ return fileAdnPath;
|
|
|
+ }
|
|
|
+
|
|
|
private Boolean uploadFileexc(String fileo, String filet, String wdno,WorkerCert item) throws Exception {
|
|
|
Boolean uploadfile = Boolean.TRUE;
|
|
|
Boolean onlyone = Boolean.FALSE;
|
|
@@ -1371,7 +1490,6 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
// 生成对象
|
|
|
getSaveFileInfo(fidId, resultData, req);
|
|
|
GreeFileSaveHelper responses = greeLogic.greePostSaveFile(req);
|
|
|
-
|
|
|
if (responses.getStatusCode() == 200){
|
|
|
fileId = responses.getData().getId();
|
|
|
} else {
|
|
@@ -1389,6 +1507,40 @@ public class UploadWorkeCertificateServiceImpl implements UploadWorkeCertificate
|
|
|
return fileId;
|
|
|
}
|
|
|
|
|
|
+ private String uploadInitFileFace(String fileAdnPath, String fidId,String wdno) throws Exception {
|
|
|
+ String fileId="";
|
|
|
+ if (StringUtils.isNotEmpty(fileAdnPath)){
|
|
|
+ // 1: 获取签名信息
|
|
|
+ GreeFileResponseHelper response = greeLogic.ossGetSignt(wdno,"GET");
|
|
|
+ if (response.getStatusCode() == 200){
|
|
|
+ ResultData resultData = JSONObject.parseObject(response.getData().toString(), ResultData.class);
|
|
|
+ resultData.getExtData().setDir(resultData.getExtData().getDir()+"/"+fidId);
|
|
|
+ // 2:文件上传
|
|
|
+ PostObjectSample ossPostObject = new PostObjectSample();
|
|
|
+ String result = ossPostObject.PostObject(fileAdnPath, resultData.getExtData());
|
|
|
+ // 3: 保存文件
|
|
|
+ if (StringUtils.isEmpty(result.trim())){
|
|
|
+ Map<String,String>req = new HashMap<>();
|
|
|
+ // 生成对象
|
|
|
+ getSaveFileInfo(fidId, resultData, req);
|
|
|
+ GreeFileSaveHelper responses = greeLogic.greePostSaveFile(req);
|
|
|
+ if (responses.getStatusCode() == 200){
|
|
|
+ fileId = responses.getData().getId();
|
|
|
+ } else {
|
|
|
+ // 失败
|
|
|
+ log.info("保存人脸面像文件到格力总部失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.info("人脸面像上传图片到OSS失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.info("获取签名信息失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return fileId;
|
|
|
+ }
|
|
|
+
|
|
|
private Integer getCount(List<WorkerBrandAccount> workerWdnos, Integer count) {
|
|
|
for (WorkerBrandAccount w: workerWdnos){
|
|
|
if (StringUtils.isEmpty(w.getBrandWebsitId())){
|