From 70d2a5d0f9c6951b2d4cac954041ed73582ff7eb Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期一, 09 六月 2025 11:54:00 +0800
Subject: [PATCH] 6.9新增登录失败冻结逻辑

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/KeyPersonInfoServiceImpl.java |   80 ++++++++++++++++++++--------------------
 1 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/KeyPersonInfoServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/KeyPersonInfoServiceImpl.java
index 49bc10d..53fef7e 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/KeyPersonInfoServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/KeyPersonInfoServiceImpl.java
@@ -1,5 +1,15 @@
 package com.panzhihua.service_community.service.impl;
 
+import java.util.Date;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.panzhihua.common.enums.KeyPersonLabelEnum;
@@ -12,42 +22,28 @@
 import com.panzhihua.service_community.model.dos.KeyPersonInfoDO;
 import com.panzhihua.service_community.service.ComMngPopulationService;
 import com.panzhihua.service_community.service.KeyPersonInfoService;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-import javax.crypto.BadPaddingException;
-import javax.crypto.IllegalBlockSizeException;
-import javax.crypto.NoSuchPaddingException;
-import java.io.UnsupportedEncodingException;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.util.List;
 
 /**
- * program 攀枝花智慧社区项目
- * description 特殊人群管理API
+ * program 攀枝花智慧社区项目 description 特殊人群管理API
  *
- * @author manailin
- * Date 2021-01-22 15:30
+ * @author manailin Date 2021-01-22 15:30
  **/
 @Service
-public class KeyPersonInfoServiceImpl extends ServiceImpl<KeyPersonInfoDAO, KeyPersonInfoDO> implements KeyPersonInfoService {
+public class KeyPersonInfoServiceImpl extends ServiceImpl<KeyPersonInfoDAO, KeyPersonInfoDO>
+    implements KeyPersonInfoService {
 
     @Resource
     private ComMngPopulationService comMngPopulationService;
 
     @Value("${domain.aesKey:}")
     private String aesKey;
+
     /**
-     * description 批量保存重点人群人员信息
-     * 处理逻辑:同一个人的信息可以被多个社区重复录入
-     * 一个人的信息如果被同一个社区重复导入。以最新的导入数据为准。将之前的数据进行更新操作。
+     * description 批量保存重点人群人员信息 处理逻辑:同一个人的信息可以被多个社区重复录入 一个人的信息如果被同一个社区重复导入。以最新的导入数据为准。将之前的数据进行更新操作。
      *
-     * @param list 重点人群信息
-     * @return R  保存结果
+     * @param list
+     *            重点人群信息
+     * @return R 保存结果
      * @author manailin
      * @date 2021/6/10 17:00
      */
@@ -56,8 +52,12 @@
     public R saveBatchKeyPerson(List<KeyPersonInfoDTO> list) {
         list.forEach(keyPersonInfoDTO -> {
             KeyPersonInfoDO dbKeyPerson = checkExistFromDb(keyPersonInfoDTO);
+            ComMngPopulationDO population = comMngPopulationService.getPopulationByCardNo(keyPersonInfoDTO.getCardNo());
+            if (population != null) {
+                keyPersonInfoDTO.setUserId(population.getId());
+            }
             if (dbKeyPerson != null) {
-                //已经存在数据,进行数据更新操作
+                // 已经存在数据,进行数据更新操作
                 KeyPersonInfoDO keyPersonInfoDO = new KeyPersonInfoDO();
                 BeanUtils.copyProperties(keyPersonInfoDTO, keyPersonInfoDO);
                 keyPersonInfoDO.setId(dbKeyPerson.getId());
@@ -65,22 +65,26 @@
                 comMngPopulationTagCardNoDTO.setCardNo(dbKeyPerson.getCardNo());
                 comMngPopulationTagCardNoDTO.setLabel(calculateLabel(dbKeyPerson));
                 comMngPopulationService.editTagPopulationByCardNo(comMngPopulationTagCardNoDTO);
-                ComMngPopulationDO population=comMngPopulationService.getPopulationByCardNo(keyPersonInfoDO.getCardNo());
-                if(population !=null){
-                    keyPersonInfoDO.setUserId(population.getId());
+                try {
+                    String aesCardNo = AESUtil.encrypt128(keyPersonInfoDTO.getCardNo(), aesKey);
+                    String phone = AESUtil.encrypt128(keyPersonInfoDTO.getPhone(), aesKey);
+                    String guardianPhone = AESUtil.encrypt128(keyPersonInfoDTO.getGuardianPhone(), aesKey);
+                    keyPersonInfoDO.setCardNo(aesCardNo);
+                    keyPersonInfoDO.setPhone(phone);
+                    keyPersonInfoDO.setGuardianPhone(guardianPhone);
+                    keyPersonInfoDO.setVisiterType(Integer.parseInt(keyPersonInfoDTO.getVisiterType()));
+                    keyPersonInfoDO.setInvalid(false);
+                    keyPersonInfoDO.setSubmitDate(new Date());
+                    updateById(keyPersonInfoDO);
+                } catch (Exception e) {
+                    log.error("根据身份证查询残疾人群业务-加密证件信息出错");
                 }
-                keyPersonInfoDO.setVisiterType(Integer.parseInt(keyPersonInfoDTO.getVisiterType()));
-                keyPersonInfoDO.setInvalid(false);
-                updateById(keyPersonInfoDO);
             } else {
                 KeyPersonInfoDO keyPersonInfoDO = new KeyPersonInfoDO();
                 BeanUtils.copyProperties(keyPersonInfoDTO, keyPersonInfoDO);
-                ComMngPopulationDO population=comMngPopulationService.getPopulationByCardNo(keyPersonInfoDO.getCardNo());
-                if(population !=null){
-                    keyPersonInfoDO.setUserId(population.getId());
-                }
                 keyPersonInfoDO.setVisiterType(Integer.parseInt(keyPersonInfoDTO.getVisiterType()));
                 keyPersonInfoDO.setInvalid(false);
+                keyPersonInfoDO.setSubmitDate(new Date());
                 save(keyPersonInfoDO);
             }
         });
@@ -107,12 +111,8 @@
     private KeyPersonInfoDO checkExistFromDb(KeyPersonInfoDTO keyPersonInfoDTO) {
         try {
             String aesCardNo = AESUtil.encrypt128(keyPersonInfoDTO.getCardNo(), aesKey);
-            return baseMapper.selectOne(
-                    new QueryWrapper<KeyPersonInfoDO>()
-                            .eq("act_id", keyPersonInfoDTO.getActId())
-                            .eq("card_no",aesCardNo)
-                            .eq("visiter_type", keyPersonInfoDTO.getVisiterType())
-            );
+            return baseMapper.selectOne(new QueryWrapper<KeyPersonInfoDO>().eq("act_id", keyPersonInfoDTO.getActId())
+                .eq("card_no", aesCardNo).eq("visiter_type", keyPersonInfoDTO.getVisiterType()));
         } catch (Exception e) {
             log.error("根据身份证查询特殊人群业务-加密证件信息出错");
         }

--
Gitblit v1.7.1