|
@@ -11,17 +11,16 @@ import com.gree.mall.miniapp.bean.policy.PolicyDetail;
|
|
import com.gree.mall.miniapp.bean.policy.PolicyOrderDetail;
|
|
import com.gree.mall.miniapp.bean.policy.PolicyOrderDetail;
|
|
import com.gree.mall.miniapp.bean.policy.WorkerRemind;
|
|
import com.gree.mall.miniapp.bean.policy.WorkerRemind;
|
|
import com.gree.mall.miniapp.bean.user.CurrentCompanyWechat;
|
|
import com.gree.mall.miniapp.bean.user.CurrentCompanyWechat;
|
|
|
|
+import com.gree.mall.miniapp.bean.worker.WorkerSignResultBean;
|
|
import com.gree.mall.miniapp.constant.Constant;
|
|
import com.gree.mall.miniapp.constant.Constant;
|
|
-import com.gree.mall.miniapp.enums.ExamineWorkerStatusEnum;
|
|
|
|
-import com.gree.mall.miniapp.enums.IsYesNoEnum;
|
|
|
|
-import com.gree.mall.miniapp.enums.PolicyOrderStutasEnum;
|
|
|
|
-import com.gree.mall.miniapp.enums.UserTypeEnum;
|
|
|
|
|
|
+import com.gree.mall.miniapp.enums.*;
|
|
import com.gree.mall.miniapp.exception.RemoteServiceException;
|
|
import com.gree.mall.miniapp.exception.RemoteServiceException;
|
|
import com.gree.mall.miniapp.logic.common.CommonLogic;
|
|
import com.gree.mall.miniapp.logic.common.CommonLogic;
|
|
import com.gree.mall.miniapp.logic.common.outside.WechatLogic;
|
|
import com.gree.mall.miniapp.logic.common.outside.WechatLogic;
|
|
import com.gree.mall.miniapp.plus.entity.*;
|
|
import com.gree.mall.miniapp.plus.entity.*;
|
|
import com.gree.mall.miniapp.plus.service.*;
|
|
import com.gree.mall.miniapp.plus.service.*;
|
|
import com.gree.mall.miniapp.utils.IpUtil;
|
|
import com.gree.mall.miniapp.utils.IpUtil;
|
|
|
|
+import com.gree.mall.miniapp.utils.RedisUtil;
|
|
import com.gree.mall.miniapp.utils.StringUtil;
|
|
import com.gree.mall.miniapp.utils.StringUtil;
|
|
import com.gree.mall.miniapp.utils.ocr.OCRUtil;
|
|
import com.gree.mall.miniapp.utils.ocr.OCRUtil;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -87,6 +86,12 @@ public class WorkerLogic {
|
|
@Autowired
|
|
@Autowired
|
|
WorkerSignConfirmService workerSignConfirmService;
|
|
WorkerSignConfirmService workerSignConfirmService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ WorkerSignConfirmManualService workerSignConfirmManualService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ RedisUtil redisUtil;
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
public List<WorkerRemind> remind() {
|
|
public List<WorkerRemind> remind() {
|
|
@@ -616,7 +621,8 @@ public class WorkerLogic {
|
|
return new ArrayList<>();
|
|
return new ArrayList<>();
|
|
}
|
|
}
|
|
|
|
|
|
- public Boolean ocrHandwriting(MultipartFile joinFile, MultipartFile signFile, String signFile2, String type) throws Exception {
|
|
|
|
|
|
+ public WorkerSignResultBean ocrHandwriting(MultipartFile joinFile, MultipartFile signFile, String signFile2, String type) throws Exception {
|
|
|
|
+ WorkerSignResultBean bean = new WorkerSignResultBean();
|
|
CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat();
|
|
CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat();
|
|
final User user = currentCompanyWechat.getUser();
|
|
final User user = currentCompanyWechat.getUser();
|
|
if (!user.getType().equals(UserTypeEnum.WORKER.getKey())) {
|
|
if (!user.getType().equals(UserTypeEnum.WORKER.getKey())) {
|
|
@@ -625,7 +631,7 @@ public class WorkerLogic {
|
|
|
|
|
|
String code = type.equals("gz") ? Constant.gree.GUANGZHOUXIAOSI : Constant.gree.FOSHANXIAOSI;
|
|
String code = type.equals("gz") ? Constant.gree.GUANGZHOUXIAOSI : Constant.gree.FOSHANXIAOSI;
|
|
String companyName = type.equals("gz") ? "广州" : "佛山";
|
|
String companyName = type.equals("gz") ? "广州" : "佛山";
|
|
- final Integer count = workerSignConfirmService.lambdaQuery()
|
|
|
|
|
|
+ Integer count = workerSignConfirmService.lambdaQuery()
|
|
.eq(WorkerSignConfirm::getCompanyWechatId, currentCompanyWechat.getCurrentCompanyWechatId())
|
|
.eq(WorkerSignConfirm::getCompanyWechatId, currentCompanyWechat.getCurrentCompanyWechatId())
|
|
.eq(WorkerSignConfirm::getBelongCompanyCode, code)
|
|
.eq(WorkerSignConfirm::getBelongCompanyCode, code)
|
|
.eq(WorkerSignConfirm::getWorkerNumber, currentCompanyWechat.getUser().getWorkerNumber())
|
|
.eq(WorkerSignConfirm::getWorkerNumber, currentCompanyWechat.getUser().getWorkerNumber())
|
|
@@ -633,6 +639,16 @@ public class WorkerLogic {
|
|
if (count > 0) {
|
|
if (count > 0) {
|
|
throw new RemoteServiceException("已签" + companyName + "的确认书");
|
|
throw new RemoteServiceException("已签" + companyName + "的确认书");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ count = workerSignConfirmManualService.lambdaQuery()
|
|
|
|
+ .eq(WorkerSignConfirmManual::getCompanyWechatId, currentCompanyWechat.getCurrentCompanyWechatId())
|
|
|
|
+ .eq(WorkerSignConfirmManual::getBelongCompanyCode, code)
|
|
|
|
+ .eq(WorkerSignConfirmManual::getWorkerNumber, currentCompanyWechat.getUser().getWorkerNumber())
|
|
|
|
+ .eq(WorkerSignConfirmManual::getStatus, ExamineStatusEnum.WAIT.getKey())
|
|
|
|
+ .count();
|
|
|
|
+ if (count > 0) {
|
|
|
|
+ throw new RemoteServiceException("待人工审核" + companyName + "的确认书");
|
|
|
|
+ }
|
|
// String path = System.getProperty("user.dir");
|
|
// String path = System.getProperty("user.dir");
|
|
// 生成的文件的存放路径
|
|
// 生成的文件的存放路径
|
|
|
|
|
|
@@ -666,8 +682,32 @@ public class WorkerLogic {
|
|
// final String name = ocrUtil.handwritingORC(new ByteArrayInputStream(baos.toByteArray()));
|
|
// final String name = ocrUtil.handwritingORC(new ByteArrayInputStream(baos.toByteArray()));
|
|
String name = ocrUtil.handwritingORC(signFile2);
|
|
String name = ocrUtil.handwritingORC(signFile2);
|
|
log.info("OCR识别名称:" + name + ", 师傅名称:" + user.getNickName());
|
|
log.info("OCR识别名称:" + name + ", 师傅名称:" + user.getNickName());
|
|
|
|
+
|
|
|
|
+ final String key = Constant.RedisPrefix.WORKER_SIGN_CONFIRM + user.getWorkerNumber();
|
|
if (!StrUtil.equals(name, user.getNickName().replace(" ", ""))) {
|
|
if (!StrUtil.equals(name, user.getNickName().replace(" ", ""))) {
|
|
- return false;
|
|
|
|
|
|
+ final long signFailCount = redisUtil.incr(key, 1);
|
|
|
|
+ redisUtil.expire(key, 24 * 60 * 60);
|
|
|
|
+ if (signFailCount > 5) {
|
|
|
|
+ final CommonFile commonFile = commonLogic.uploadWorkerConfirmFile(joinFile);
|
|
|
|
+ WorkerSignConfirmManual confirmManual = new WorkerSignConfirmManual();
|
|
|
|
+ confirmManual.setCompanyWechatId(currentCompanyWechat.getCompanyWechatId())
|
|
|
|
+ .setBelongCompanyCode(code)
|
|
|
|
+ .setBelongCompanyName(companyName)
|
|
|
|
+ .setWorkerNumber(user.getWorkerNumber())
|
|
|
|
+ .setNickName(user.getNickName())
|
|
|
|
+ .setMobile(user.getMobile())
|
|
|
|
+ .setIdCard(user.getIdCard())
|
|
|
|
+ .setName(type.equals("gz") ? "广州嘉讯茂辅材费用确认书" : "佛山嘉讯茂辅材费用确认书")
|
|
|
|
+ .setUrl(commonFile.getUrl())
|
|
|
|
+ .setStatus(ExamineStatusEnum.WAIT.getKey())
|
|
|
|
+ .insert();
|
|
|
|
+ bean.setStatus(false);
|
|
|
|
+ bean.setReason("手写文字识别结果:" + name + ", 5次识别失败转人工审核");
|
|
|
|
+ return bean;
|
|
|
|
+ }
|
|
|
|
+ bean.setStatus(false);
|
|
|
|
+ bean.setReason("手写文字识别结果:" + name);
|
|
|
|
+ return bean;
|
|
}
|
|
}
|
|
|
|
|
|
final CommonFile commonFile = commonLogic.uploadWorkerConfirmFile(joinFile);
|
|
final CommonFile commonFile = commonLogic.uploadWorkerConfirmFile(joinFile);
|
|
@@ -680,13 +720,16 @@ public class WorkerLogic {
|
|
.setName(type.equals("gz") ? "广州嘉讯茂辅材费用确认书" : "佛山嘉讯茂辅材费用确认书")
|
|
.setName(type.equals("gz") ? "广州嘉讯茂辅材费用确认书" : "佛山嘉讯茂辅材费用确认书")
|
|
.setUrl(commonFile.getUrl())
|
|
.setUrl(commonFile.getUrl())
|
|
.insert();
|
|
.insert();
|
|
|
|
+
|
|
|
|
+ redisUtil.del(key);
|
|
// userService.lambdaUpdate()
|
|
// userService.lambdaUpdate()
|
|
// .set(type.equals("gz"), User::getWorkerSignGz, commonFile.getUrl())
|
|
// .set(type.equals("gz"), User::getWorkerSignGz, commonFile.getUrl())
|
|
// .set(type.equals("fs"), User::getWorkerSignFs, commonFile.getUrl())
|
|
// .set(type.equals("fs"), User::getWorkerSignFs, commonFile.getUrl())
|
|
// .eq(User::getUserId, user.getUserId())
|
|
// .eq(User::getUserId, user.getUserId())
|
|
// .update();
|
|
// .update();
|
|
|
|
|
|
- return true;
|
|
|
|
|
|
+ bean.setStatus(true);
|
|
|
|
+ return bean;
|
|
}
|
|
}
|
|
|
|
|
|
public List<WorkerSignConfirm> signConfirm() {
|
|
public List<WorkerSignConfirm> signConfirm() {
|
|
@@ -696,4 +739,19 @@ public class WorkerLogic {
|
|
.eq(WorkerSignConfirm::getWorkerNumber, currentCompanyWechat.getUser().getWorkerNumber())
|
|
.eq(WorkerSignConfirm::getWorkerNumber, currentCompanyWechat.getUser().getWorkerNumber())
|
|
.list();
|
|
.list();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public Boolean checkManualSignConfirm(String type) {
|
|
|
|
+ CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat();
|
|
|
|
+ String code = type.equals("gz") ? Constant.gree.GUANGZHOUXIAOSI : Constant.gree.FOSHANXIAOSI;
|
|
|
|
+ Integer count = workerSignConfirmManualService.lambdaQuery()
|
|
|
|
+ .eq(WorkerSignConfirmManual::getCompanyWechatId, currentCompanyWechat.getCurrentCompanyWechatId())
|
|
|
|
+ .eq(WorkerSignConfirmManual::getBelongCompanyCode, code)
|
|
|
|
+ .eq(WorkerSignConfirmManual::getWorkerNumber, currentCompanyWechat.getUser().getWorkerNumber())
|
|
|
|
+ .eq(WorkerSignConfirmManual::getStatus, ExamineStatusEnum.WAIT.getKey())
|
|
|
|
+ .count();
|
|
|
|
+ if (count > 0) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
}
|
|
}
|