huanghongfa
2021-09-02 177249c76aeea0b4bf8d8816d4994e3b445b45ce
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/DisabledPersonsServiceImpl.java
@@ -1,5 +1,14 @@
package com.panzhihua.service_community.service.impl;
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.model.dtos.community.DisabledPersonsDTO;
@@ -10,13 +19,6 @@
import com.panzhihua.service_community.model.dos.DisabledPersonsDO;
import com.panzhihua.service_community.service.ComMngPopulationService;
import com.panzhihua.service_community.service.DisabledPersonsService;
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 java.util.List;
/**
 * 残疾人服务
@@ -25,7 +27,8 @@
 * @date 2021/6/11 16:05
 */
@Service
public class DisabledPersonsServiceImpl extends ServiceImpl<DisablePersonDAO, DisabledPersonsDO> implements DisabledPersonsService {
public class DisabledPersonsServiceImpl extends ServiceImpl<DisablePersonDAO, DisabledPersonsDO>
    implements DisabledPersonsService {
    @Value("${domain.aesKey:}")
    private String aesKey;
@@ -36,8 +39,9 @@
    /**
     * description 批量保存重点人群人员信息
     *
     * @param list 重点人群信息
     * @return R  保存结果
     * @param list
     *            重点人群信息
     * @return R 保存结果
     * @author manailin
     * @date 2021/6/10 17:00
     */
@@ -46,12 +50,13 @@
    public R saveBatchDisabledPerson(List<DisabledPersonsDTO> list) {
        list.forEach(disabledPersonsDTO -> {
            DisabledPersonsDO dbKeyPerson = checkExistFromDb(disabledPersonsDTO);
            ComMngPopulationDO population = comMngPopulationService.getPopulationByCardNo(disabledPersonsDTO.getCardNo());
            ComMngPopulationDO population =
                comMngPopulationService.getPopulationByCardNo(disabledPersonsDTO.getCardNo());
            if (population != null) {
                disabledPersonsDTO.setUserId(population.getId());
            }
            if (dbKeyPerson != null) {
                //已经存在数据,进行数据更新操作
                // 已经存在数据,进行数据更新操作
                DisabledPersonsDO disabledPersonsDO = new DisabledPersonsDO();
                BeanUtils.copyProperties(disabledPersonsDTO, disabledPersonsDO);
                disabledPersonsDO.setId(dbKeyPerson.getId());
@@ -75,15 +80,11 @@
        return R.ok();
    }
    private DisabledPersonsDO checkExistFromDb(DisabledPersonsDTO DisabledPersonsDO) {
        try {
            String aesCardNo = AESUtil.encrypt128(DisabledPersonsDO.getCardNo(), aesKey);
            return baseMapper.selectOne(
                    new QueryWrapper<DisabledPersonsDO>()
                            .eq("act_id", DisabledPersonsDO.getActId())
                            .eq("card_no", aesCardNo)
            );
            return baseMapper.selectOne(new QueryWrapper<DisabledPersonsDO>().eq("act_id", DisabledPersonsDO.getActId())
                .eq("card_no", aesCardNo));
        } catch (Exception e) {
            log.error("根据身份证查询残疾人群业务-加密证件信息出错");
        }