瀏覽代碼

获取ocr秘钥接口

LiFei 2 年之前
父節點
當前提交
b20f577084

+ 27 - 0
happy-boot-module-flexjob/src/main/java/org/jeecg/modules/api/hwuser/HwUserControllerAPI.java

@@ -7,6 +7,7 @@ import org.jeecg.common.oss.OSSConfig;
 import org.jeecg.common.util.ErrorCode;
 import org.jeecg.modules.api.sys.BaseAppController;
 import org.jeecg.modules.hwuser.service.IHwUserService;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
@@ -25,6 +26,10 @@ import java.util.Map;
 public class HwUserControllerAPI extends BaseAppController {
     @Resource
     private IHwUserService hwUserService;
+    @Value("${jeecg.tencent.secretId}")
+    private String secretId;
+    @Value("${jeecg.tencent.secretKey}")
+    private String secretKey;
 
     private static final String BANNER1 = "/uploadfiles/banner/banner3.png";
     private static final String BANNER2 = "/uploadfiles/banner/banner2.png";
@@ -115,6 +120,28 @@ public class HwUserControllerAPI extends BaseAppController {
         return view;
     }
 
+    /**
+     * 获取ocr秘钥
+     */
+    @GetMapping(value = "/getOcrKey")
+    public ModelAndView getOcrKey(HttpServletRequest request, HttpServletResponse response) {
+        Map<String, Object> returnMap = new HashMap<String, Object>();
+        Map<String, Object> obj = null;
+        try {
+            returnMap.put("secretId", secretId);
+            returnMap.put("secretKey", secretKey);
+            obj = successResult(ErrorCode.code_1000, "实名认证成功", returnMap);
+
+        } catch (Exception e) {
+            System.out.println("Exception e:" + e);
+            e.printStackTrace();
+            obj = errorResult(ErrorCode.code_2006, "获取数据失败");
+            logError(request, e.getMessage(), e);
+        }
+
+        ModelAndView view = new ModelAndView(new MappingJackson2JsonView(), obj);
+        return view;
+    }
 
 
     /**

+ 8 - 5
happy-boot-module-flexjob/src/main/java/org/jeecg/modules/hwuser/service/impl/HwUserServiceImpl.java

@@ -37,6 +37,7 @@ import org.jeecg.modules.util.BirthUtils;
 import org.jeecg.modules.util.ExcelUtils;
 import org.jeecg.modules.util.TokenUtil;
 import org.jeecg.modules.util.txcloudutils.captcha.TxCaptchaUtils;
+import org.jeecg.modules.util.txcloudutils.faceid.TxIdentityUtils;
 import org.jeecg.modules.util.txcloudutils.sms.TxSmsEnum;
 import org.jeecg.modules.util.txcloudutils.sms.TxSmsUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -83,6 +84,8 @@ public class HwUserServiceImpl extends ServiceImpl<HwUserMapper, HwUser> impleme
     private TxCaptchaUtils txCaptchaUtils;
     @Autowired
     private TxSmsUtils txSmsUtils;
+    @Autowired
+    private TxIdentityUtils txIdentityUtils;
 
     /**
      * 通过手机号、姓名、身份证号匹配接单人
@@ -948,11 +951,11 @@ public class HwUserServiceImpl extends ServiceImpl<HwUserMapper, HwUser> impleme
                 return resultImg;
             }
             // 验证实名信息
-//            boolean ok = txIdentityUtils.IdCardVerification(name, idcardNumber);
-//            if (!ok) {
-//                resultImg.put("success","2010");
-//                return resultImg;
-//            }
+            boolean ok = txIdentityUtils.IdCardVerification(name, idcardNumber);
+            if (!ok) {
+                resultImg.put("success","2010");
+                return resultImg;
+            }
             HwUser hwmUser = this.getById(id);
             hwmUser.setName(name);
             hwmUser.setIdcardNumber(idcardNumber);