From bb9ee0164a6bf83a3bbf60809313fe6aaf4627e8 Mon Sep 17 00:00:00 2001
From: puhanshu <a9236326>
Date: 星期二, 14 九月 2021 14:02:20 +0800
Subject: [PATCH] 添加枚举类&&规范代码

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/IdentityAuthApi.java |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/IdentityAuthApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/IdentityAuthApi.java
index bea36e1..f179451 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/IdentityAuthApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/IdentityAuthApi.java
@@ -1,5 +1,8 @@
 package com.panzhihua.service_community.api;
 
+import static com.panzhihua.common.enums.IdentityAuthMethodEnum.FACE_AUTH;
+import static com.panzhihua.common.enums.IdentityAuthTypeEnum.ELDER_AUTH;
+import static com.panzhihua.common.enums.IdentityAuthTypeEnum.PENSION_AUTH;
 import static java.util.Objects.nonNull;
 import static org.apache.commons.lang3.StringUtils.isBlank;
 
@@ -88,13 +91,13 @@
                 log.error("人脸核验失败,错误原因:" + textObject.toJSONString());
                 return R.fail("核验失败");
             }
-            addIdentityAuthDTO.setType(2);
+            addIdentityAuthDTO.setAuthMethod(FACE_AUTH.getMethod());
             addIdentityAuthDTO.setVerificationResult(object.toJSONString());
         }
         int authType = addIdentityAuthDTO.getAuthType().intValue();
-        if (authType == 1) {
+        if (authType == ELDER_AUTH.getType()) {
             return comElderAuthRecordsService.addElderAuth(addIdentityAuthDTO);
-        } else if (authType == 2) {
+        } else if (authType == PENSION_AUTH.getType()) {
             return comPensionAuthRecordService.addPensionAuth(addIdentityAuthDTO);
         } else {
             return R.fail("请核对需要认证的类型");
@@ -108,10 +111,10 @@
      */
     @PostMapping("/record/page")
     public R queryRecordWithPage(@RequestBody PageIdentityAuthRecordDTO pageIdentityAuthRecordDTO) {
-        Integer authType = pageIdentityAuthRecordDTO.getAuthType();
-        if (nonNull(authType) && authType.intValue() == 1) {
+        int authType = pageIdentityAuthRecordDTO.getAuthType().intValue();
+        if (authType == ELDER_AUTH.getType()) {
             return comElderAuthRecordsService.queryRecordWithPage(pageIdentityAuthRecordDTO);
-        } else if (nonNull(authType) && authType.intValue() == 2) {
+        } else if (authType == PENSION_AUTH.getType()) {
             return comPensionAuthRecordService.queryRecordWithPage(pageIdentityAuthRecordDTO);
         } else {
             return R.fail("请核对需要查询的身份认证类型");
@@ -127,9 +130,9 @@
     @GetMapping("/detail")
     public R retrieveIdentityAuthDetail(@RequestParam("authType") Integer authType,
                                         @RequestParam("identityAuthId") Long identityAuthId) {
-        if (authType.intValue() == 1) {
+        if (authType.intValue() == ELDER_AUTH.getType()) {
             return comElderAuthRecordsService.retrieveElderAuthDetail(identityAuthId);
-        } else if (authType.intValue() == 2) {
+        } else if (authType.intValue() == PENSION_AUTH.getType()) {
             return comPensionAuthRecordService.retrievePensionAuthDetail(identityAuthId);
         } else {
             return R.fail("请核对认证类型");
@@ -146,10 +149,10 @@
     public R getIdentityAuthMode(@RequestParam(value = "communityId") Long communityId,
                                  @RequestParam(value = "identityAuthType") Integer identityAuthType) {
         String identityCode;
-        if (identityAuthType.intValue() ==1) {
+        if (identityAuthType.intValue() == ELDER_AUTH.getType()) {
             //高龄认证
             identityCode = ELDER_AUTH_TYPE_PREFIX + communityId;
-        } else if (identityAuthType.intValue() ==2) {
+        } else if (identityAuthType.intValue() == PENSION_AUTH.getType()) {
             //养老认证
             identityCode = PENSION_AUTH_TYPE_PREFIX + communityId;
         } else {
@@ -181,12 +184,12 @@
             log.error("加密失败【{}】", e.getMessage());
             return R.fail("认证失败,请重新尝试");
         }
-        if (getIdentityEidTokenDTO.getAuthType().intValue() == 1) {
+        if (getIdentityEidTokenDTO.getAuthType().intValue() == ELDER_AUTH.getType()) {
             //高龄认证
             isExist = comElderAuthElderliesDAO.selectCount(new QueryWrapper<ComElderAuthElderliesDO>()
                     .lambda().eq(ComElderAuthElderliesDO::getName, getIdentityEidTokenDTO.getName())
                     .eq(ComElderAuthElderliesDO::getIdCard, idCard));
-        } else if (getIdentityEidTokenDTO.getAuthType().intValue() == 2) {
+        } else if (getIdentityEidTokenDTO.getAuthType().intValue() == PENSION_AUTH.getType()) {
             //养老认证
             isExist = comPensionAuthPensionerDAO.selectCount(new QueryWrapper<ComPensionAuthPensionerDO>()
                     .lambda().eq(ComPensionAuthPensionerDO::getName, getIdentityEidTokenDTO.getName())

--
Gitblit v1.7.1