CeDo
2021-05-12 f54378818bfd525dd9857dafb29fe79d0804cfe1
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -20,6 +20,7 @@
import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO;
import com.panzhihua.common.model.vos.user.InputUserInfoVO;
import com.panzhihua.common.model.vos.user.UserElectronicFileVO;
import com.panzhihua.common.utlis.AgeUtils;
import com.panzhihua.service_community.dao.ComActDAO;
import com.panzhihua.service_community.dao.ComActVillageDAO;
import com.panzhihua.service_community.dao.ComMngPopulationDAO;
@@ -173,6 +174,12 @@
        page.setSize(pageSize);
        page.setCurrent(pageNum);
        IPage<ComMngPopulationVO> iPage = populationDAO.pagePopulation(page, comMngPopulationVO);
        iPage.getRecords().forEach(vo->{
            //获取用户生日
            String birthday = vo.getCardNo().substring(6, 14);
            //设置用户年龄
            vo.setBirthday(birthday);
        });
        return R.ok(iPage);
    }
@@ -416,10 +423,11 @@
        if(populationDO==null){
            return R.fail();
        }
        String cardNo = populationDO.getCardNo();
        BeanUtils.copyProperties(vo,populationDO);
        try {
            //TODO 修改拦截器时候需要维护加密操作
            if(!populationDO.getCardNo().equals(vo.getCardNo())){//判断是否修改身份证号码
            if(!cardNo.equals(vo.getCardNo())){//判断是否修改身份证号码
                //判断要修改的身份证号码是否已存在
                ComMngPopulationDO cardNoDO = populationDAO.selectOne(new QueryWrapper<ComMngPopulationDO>()
                        .lambda().eq(ComMngPopulationDO::getCardNo,vo.getCardNo()));
@@ -427,8 +435,10 @@
                    return R.fail("您输入的身份证已存在,请重新输入");
                }
                populationDO.setCardNo(AESUtil.encrypt128(vo.getCardNo(), aesKey));
                populationDO.setPhone(AESUtil.encrypt128(vo.getPhone(), aesKey));
            }else{
                populationDO.setCardNo(AESUtil.encrypt128(cardNo, aesKey));
            }
            populationDO.setPhone(AESUtil.encrypt128(vo.getPhone(), aesKey));
        } catch (Exception e) {
            e.printStackTrace();
            return R.fail();
@@ -500,4 +510,14 @@
        }
        return R.ok();
    }
    @Override
    public R editUserElectronicFile(UserElectronicFileVO userElectronicFileVO) {
        UserElectronicFileVO electronicFileVO = populationDAO.getSysUserById(userElectronicFileVO.getUserId());
        if(electronicFileVO==null){
            return R.fail("id有误!");
        }
         populationDAO.updateSysUserElectronicFile(userElectronicFileVO);
        return R.ok();
    }
}