| | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 残疾人服务 |
| | |
| | | * @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; |
| | |
| | | /** |
| | | * description 批量保存重点人群人员信息 |
| | | * |
| | | * @param list 重点人群信息 |
| | | * @return R 保存结果 |
| | | * @param list |
| | | * 重点人群信息 |
| | | * @return R 保存结果 |
| | | * @author manailin |
| | | * @date 2021/6/10 17:00 |
| | | */ |
| | |
| | | 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()); |
| | |
| | | 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("根据身份证查询残疾人群业务-加密证件信息出错"); |
| | | } |