|
@@ -6,7 +6,11 @@ import com.gree.mall.miniapp.bean.PayDetail;
|
|
|
import com.gree.mall.miniapp.bean.policy.PolicyDetail;
|
|
|
import com.gree.mall.miniapp.bean.policy.PolicyOrderDetail;
|
|
|
import com.gree.mall.miniapp.bean.policy.WorkerRemind;
|
|
|
+import com.gree.mall.miniapp.bean.user.CurrentCompanyWechat;
|
|
|
+import com.gree.mall.miniapp.constant.Constant;
|
|
|
+import com.gree.mall.miniapp.exception.RemoteServiceException;
|
|
|
import com.gree.mall.miniapp.helper.ResponseHelper;
|
|
|
+import com.gree.mall.miniapp.logic.common.CommonLogic;
|
|
|
import com.gree.mall.miniapp.logic.policy.WorkerLogic;
|
|
|
import com.gree.mall.miniapp.plus.entity.*;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -14,6 +18,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.integration.redis.util.RedisLockRegistry;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
@@ -23,6 +28,8 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.text.ParseException;
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
+import java.util.concurrent.locks.Lock;
|
|
|
|
|
|
@Slf4j
|
|
|
@RestController
|
|
@@ -32,6 +39,10 @@ public class WorkerController {
|
|
|
|
|
|
@Autowired
|
|
|
WorkerLogic workerLogic;
|
|
|
+ @Autowired
|
|
|
+ CommonLogic commonLogic;
|
|
|
+ @Autowired
|
|
|
+ RedisLockRegistry redisLockRegistry;
|
|
|
|
|
|
|
|
|
@PostMapping("/remind")
|
|
@@ -148,8 +159,22 @@ public class WorkerController {
|
|
|
@ApiParam(required = true, value = "签名附件base64") @RequestParam String signFile2,
|
|
|
@ApiParam(required = true, value = "地区 gz=广州 fs=佛山") @RequestParam String type
|
|
|
) throws Exception {
|
|
|
- Boolean result = workerLogic.ocrHandwriting(file, signFile, signFile2, type);
|
|
|
- return ResponseHelper.success(result);
|
|
|
+ CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat();
|
|
|
+ Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_ORDER + currentCompanyWechat.getUserId());
|
|
|
+ if (!obtain.tryLock(10, TimeUnit.SECONDS)) {
|
|
|
+ throw new RemoteServiceException("请稍候提交...");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ Boolean result = workerLogic.ocrHandwriting(file, signFile, signFile2, type);
|
|
|
+ return ResponseHelper.success(result);
|
|
|
+ } catch(Exception e) {
|
|
|
+ log.error("【师傅签名手写OCR识别处理】失败", e);
|
|
|
+ throw e;
|
|
|
+ } finally {
|
|
|
+ obtain.unlock();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@PostMapping("/sign/confirm")
|