From b9fab8fa18eed7a0b8207db76c5bc0ffa2e9cd15 Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期一, 27 九月 2021 11:00:06 +0800
Subject: [PATCH] bug修复

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComElderAuthRecordsServiceImpl.java |   60 +++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComElderAuthRecordsServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComElderAuthRecordsServiceImpl.java
index 6e53bfb..919fa11 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComElderAuthRecordsServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComElderAuthRecordsServiceImpl.java
@@ -1,19 +1,20 @@
 package com.panzhihua.service_community.service.impl;
 
-import cn.hutool.core.util.IdcardUtil;
+import static com.panzhihua.common.enums.IdentityApprovalStatusEnum.PASS_THROUGH;
+import static com.panzhihua.common.enums.IdentityApprovalStatusEnum.PENDING_REVIEW;
+import static com.panzhihua.common.enums.IdentityAuthMethodEnum.FACE_AUTH;
+import static com.panzhihua.common.enums.IdentityAuthStatusEnum.CERTIFIED;
+
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 
 import javax.annotation.Resource;
 
-import com.panzhihua.common.model.vos.community.ComElderAuthRecordExcleVO;
-import com.panzhihua.common.model.vos.community.ComElderAuthRecordImportExcelVO;
-import com.panzhihua.common.model.vos.community.ComElderAuthRecordImportMistakeExcelVO;
-import com.panzhihua.common.model.vos.community.ComElderAuthRecordStatisticExcleVO;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -24,21 +25,24 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.google.common.base.Joiner;
-import com.panzhihua.common.constants.Constants;
-import com.panzhihua.common.enums.*;
-import com.panzhihua.common.enums.PopulHouseUseEnum;
 import com.panzhihua.common.model.dtos.community.AddIdentityAuthDTO;
 import com.panzhihua.common.model.dtos.community.PageElderAuthRecordsDTO;
-import com.panzhihua.common.model.dtos.community.elder.PageElderAuthStatisticDTO;
 import com.panzhihua.common.model.dtos.community.PageIdentityAuthRecordDTO;
+import com.panzhihua.common.model.dtos.community.elder.PageElderAuthStatisticDTO;
 import com.panzhihua.common.model.helper.AESUtil;
 import com.panzhihua.common.model.vos.R;
+import com.panzhihua.common.model.vos.community.ComElderAuthRecordExcleVO;
+import com.panzhihua.common.model.vos.community.ComElderAuthRecordImportExcelVO;
+import com.panzhihua.common.model.vos.community.ComElderAuthRecordImportMistakeExcelVO;
+import com.panzhihua.common.model.vos.community.ComElderAuthRecordStatisticExcleVO;
 import com.panzhihua.common.model.vos.community.ComElderAuthRecordVO;
 import com.panzhihua.common.utlis.AgeUtils;
 import com.panzhihua.common.utlis.DateUtils;
 import com.panzhihua.common.utlis.Snowflake;
 import com.panzhihua.common.utlis.StringUtils;
+import com.panzhihua.common.utlis.WxUtil;
+import com.panzhihua.common.utlis.WxXCXTempSend;
+import com.panzhihua.service_community.dao.ComActActSignDAO;
 import com.panzhihua.service_community.dao.ComActDAO;
 import com.panzhihua.service_community.dao.ComElderAuthElderliesDAO;
 import com.panzhihua.service_community.dao.ComElderAuthRecordsDAO;
@@ -51,12 +55,8 @@
 import com.panzhihua.service_community.model.dos.ComMngPopulationDO;
 import com.panzhihua.service_community.service.ComElderAuthRecordsService;
 
+import cn.hutool.core.util.IdcardUtil;
 import lombok.extern.slf4j.Slf4j;
-
-import static com.panzhihua.common.enums.IdentityApprovalStatusEnum.PASS_THROUGH;
-import static com.panzhihua.common.enums.IdentityApprovalStatusEnum.PENDING_REVIEW;
-import static com.panzhihua.common.enums.IdentityAuthMethodEnum.FACE_AUTH;
-import static com.panzhihua.common.enums.IdentityAuthStatusEnum.CERTIFIED;
 
 /**
  * title: ComElderAuthRecordsServiceImpl  社区政务》高龄老人认证》认证记录表服务实现类
@@ -82,6 +82,8 @@
     private ComActDAO comActDAO;
     @Resource
     private ComEldersAuthStatisticsMapper comEldersAuthStatisticsMapper;
+    @Resource
+    private ComActActSignDAO comActActSignDAO;
     @Value("${domain.aesKey:}")
     private String aesKey;
 
@@ -113,6 +115,11 @@
     public R detailElderAuthRecords(Long authRecordId) {
         ComElderAuthRecordVO comElderAuthRecordVO = comElderAuthRecordsDAO.detailElderAuthRecords(authRecordId);
         comElderAuthRecordVO.setNextIds(comElderAuthRecordsDAO.getNextIds(comElderAuthRecordVO.getCommunityId(),authRecordId));
+        try {
+            comElderAuthRecordVO.setAge(IdcardUtil.getAgeByIdCard(comElderAuthRecordVO.getIdCard()));
+        }catch (Exception e){
+            log.error("身份证转换失败");
+        }
         return R.ok(comElderAuthRecordVO);
     }
 
@@ -135,6 +142,9 @@
         comElderAuthRecordsDO.setApprovalDate(nowDate);
         if (comElderAuthRecordVO.getApprovalStatus().equals(ComElderAuthRecordsDO.approvalStatus.tg)) {
             comElderAuthRecordsDO.setAuthStatus(ComElderAuthRecordsDO.authStatus.yrz);
+            sendAuthSubscribe(comElderAuthRecordsDO.getSubmitUserId(), "高龄认证", "认证成功!");
+        } else {
+            sendAuthSubscribe(comElderAuthRecordsDO.getSubmitUserId(), "高龄认证", comElderAuthRecordVO.getRejectReason());
         }
         comElderAuthRecordsDO.setApprovalDate(new Date());
         int nub = comElderAuthRecordsDAO.updateById(comElderAuthRecordsDO);
@@ -142,6 +152,23 @@
             return R.fail("审核失败");
         }
         return R.ok();
+    }
+
+    private void sendAuthSubscribe(Long userId, String name, String result) {
+        //发送订阅通知
+        Map<String, String> map = comActActSignDAO.getUserOpenId(userId);
+        if (map != null) {
+            String openid = map.get("openid");
+            try {
+                WxXCXTempSend util = new WxXCXTempSend();
+                String accessToken = util.getAppAccessToken();
+                WxUtil.sendSubscribeRZSH(openid, accessToken, name,
+                        DateUtils.format(new Date(), DateUtils.ymdhms_format),
+                        result);
+            } catch (Exception e) {
+                log.error("推送审核状态订阅消息失败,失败原因:" + e.getMessage());
+            }
+        }
     }
 
     @Override
@@ -441,6 +468,9 @@
         if (this.baseMapper.insert(comElderAuthRecordsDO) < 0) {
             return R.fail("认证失败,请重新尝试");
         }
+        if (addIdentityAuthDTO.getAuthMethod().intValue() == FACE_AUTH.getMethod()) {
+            sendAuthSubscribe(addIdentityAuthDTO.getSubmitUserId(), "高龄认证", "认证成功!");
+        }
         return R.ok();
     }
 

--
Gitblit v1.7.1