101captain
2021-11-09 e7f03acfa5ee4ad4fd6d1ee9e9ae9a5655488f6d
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;
@@ -80,21 +83,21 @@
            String result = TencentUtils.getEidResult(eidToken);
            JSONObject object = JSON.parseObject(result);
            if (object == null) {
                return R.fail("核验失败");
                return R.fail("人脸信息与所填信息不符,请检查所填写信息");
            }
            JSONObject textObject = object.getJSONObject("Text");
            String code = textObject.getString("ErrCode");
            if (!code.equals("0")) {
                log.error("人脸核验失败,错误原因:" + textObject.toJSONString());
                return R.fail("核验失败");
                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())