From 9fdd4862e4f28b1068ed02fedbec71038a637f1f Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期四, 24 六月 2021 18:23:14 +0800 Subject: [PATCH] 修改bug --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java | 73 +++++++++++++++++++++++++++++++++--- 1 files changed, 66 insertions(+), 7 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java index 1f0d48a..c385ad5 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java @@ -1,5 +1,6 @@ package com.panzhihua.service_community.service.impl; +import cn.hutool.core.util.IdcardUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -11,9 +12,11 @@ import com.panzhihua.common.enums.PopulCultureLevelEnum; import com.panzhihua.common.enums.PopulHouseUseEnum; import com.panzhihua.common.enums.PopulIsOksEnum; +import com.panzhihua.common.enums.PopulMarriageEnum; import com.panzhihua.common.exceptions.ServiceException; import com.panzhihua.common.model.dtos.community.*; import com.panzhihua.common.model.dtos.community.bigscreen.BigScreenEventDetailDTO; +import com.panzhihua.common.model.dtos.grid.PagePopulationListDTO; import com.panzhihua.common.model.dtos.user.PageInputUserDTO; import com.panzhihua.common.model.helper.AESUtil; import com.panzhihua.common.model.vos.R; @@ -27,6 +30,8 @@ import com.panzhihua.common.model.vos.community.screen.index.*; import com.panzhihua.common.model.vos.grid.EventGridDataVO; import com.panzhihua.common.model.vos.grid.EventResourceVO; +import com.panzhihua.common.model.vos.grid.PopulationDetailVO; +import com.panzhihua.common.model.vos.grid.PopulationListVO; import com.panzhihua.common.model.vos.screen.ComActPopulationCultureVO; import com.panzhihua.common.model.vos.screen.ComActPopulationScreenVO; import com.panzhihua.common.model.vos.screen.ComMngPopulationAgeVO; @@ -371,11 +376,11 @@ .eq(ComMngPopulationDO::getCardNo, cardNoAES)); if (populationDO == null) { //不存在实有人口,则新增 - populationDO = savePopulationDO(vo, comActDO, comMngVillageDO, cardNoAES); + populationDO = savePopulationDO(vo, comActDO, comMngVillageDO); } else { //如果存在人口信息,且是自用房,则更新人口默认的房屋信息 if (vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) { - populationDO = updatePopulationHouseUse(vo, populationDO, cardNoAES); + populationDO = updatePopulationHouseUse(vo, populationDO); } } @@ -408,22 +413,23 @@ return R.ok(); } - private ComMngPopulationDO updatePopulationHouseUse(ComMngPopulationServeExcelVO vo, ComMngPopulationDO populationDO, String cardNoAES) throws Exception { + private ComMngPopulationDO updatePopulationHouseUse(ComMngPopulationServeExcelVO vo, ComMngPopulationDO populationDO) throws Exception { populationDO.setRoad(vo.getRoad()); populationDO.setDoorNo(vo.getDoorNo()); populationDO.setFloor(vo.getFloor()); populationDO.setUnitNo(vo.getUnitNo()); populationDO.setHouseNo(vo.getHouseNo()); - populationDO.setCardNo(cardNoAES); + populationDO.setCardNo(vo.getCardNo()); populationDO.setCardNoStr(vo.getCardNo()); if (StringUtils.isNotEmpty(populationDO.getPhone())) { - populationDO.setPhone(AESUtil.encrypt128(populationDO.getPhone(), aesKey)); +// populationDO.setPhone(AESUtil.encrypt128(populationDO.getPhone(), aesKey)); + populationDO.setPhone(populationDO.getPhone()); } this.baseMapper.updateById(populationDO); return populationDO; } - private ComMngPopulationDO savePopulationDO(ComMngPopulationServeExcelVO vo, ComActDO comActDO, ComMngVillageDO comMngVillageDO, String cardNoAES) { + private ComMngPopulationDO savePopulationDO(ComMngPopulationServeExcelVO vo, ComActDO comActDO, ComMngVillageDO comMngVillageDO) { ComMngPopulationDO populationDO = new ComMngPopulationDO(); BeanUtils.copyProperties(vo, populationDO); populationDO.setId(Snowflake.getId()); @@ -433,7 +439,7 @@ populationDO.setStreetId(comActDO.getStreetId()); populationDO.setLabel(Joiner.on(",").join(userTag)); populationDO.setVillageName(comMngVillageDO.getGroupAt()); - populationDO.setCardNo(cardNoAES); + populationDO.setCardNo(vo.getCardNo()); populationDO.setCardNoStr(vo.getCardNo()); populationDO.setUpdateAt(new Date()); this.baseMapper.insert(populationDO); @@ -1415,11 +1421,64 @@ //查询事件流转记录 List<EventTransferRecordVO> transferRecordList = this.baseMapper.getEventScreenEventTransList(eventDetailDTO.getEventId()); + if(!transferRecordList.isEmpty()){ + transferRecordList.forEach(transfer -> { + if(transfer.getFromType().equals(EventTransferRecordVO.fromType.wgy)){ + //查询上级网格信息 + EventTransferRecordDetailVO transferRecordDetailVO = this.baseMapper.getEventScreenEventTransDetail(transfer.getEventId()); + transfer.setSuperiorRelationship(transferRecordDetailVO.getStreetName() + "-" + + transferRecordDetailVO.getCommunityName() + "-" + transferRecordDetailVO.getGridName()); + }else if(transfer.getFromType().equals(EventTransferRecordVO.fromType.sq)){ + //查询上级社区信息 + EventTransferRecordDetailVO transferRecordDetailVO = this.baseMapper.getEventScreenEventTransDetailByCommunityId(transfer.getFromId()); + transfer.setSuperiorRelationship(transferRecordDetailVO.getStreetName() + "-" + + transferRecordDetailVO.getCommunityName()); + } + }); + } statisticsVO.setTransferRecordList(transferRecordList); } } return R.ok(statisticsVO); } + @Override + public R pagePopulationListApp(PagePopulationListDTO populationListDTO){ + IPage<PopulationListVO> pagePopulationList = this.baseMapper.pagePopulationListApp(new Page(populationListDTO.getPageNum(),populationListDTO.getPageSize()),populationListDTO); + if(!pagePopulationList.getRecords().isEmpty()){ + pagePopulationList.getRecords().forEach(population -> { + population.setAge(IdcardUtil.getAgeByIdCard(population.getCardNo())); + }); + } + return R.ok(pagePopulationList); + } + + @Override + public R getPopulationDetailApp(Long populationId){ + PopulationDetailVO detail = this.baseMapper.getPopulationDetailApp(populationId); + if(detail != null){ + detail.setAge(IdcardUtil.getAgeByIdCard(detail.getCardNo())); + if(StringUtils.isNotEmpty(detail.getCultureLevel())){ + detail.setCultureLevel(PopulCultureLevelEnum.getCnDescByName(Integer.parseInt(detail.getCultureLevel()))); + } + if(StringUtils.isNotEmpty(detail.getMarriage())){ + detail.setMarriage(PopulMarriageEnum.getCnDescByName(Integer.parseInt(detail.getMarriage()))); + } + } + return R.ok(detail); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public R getPopulationRepairByApp(){ + List<ComMngPopulationDO> populationDOList = this.baseMapper.selectList(new QueryWrapper<ComMngPopulationDO>()); + if(!populationDOList.isEmpty()){ + populationDOList.forEach(population -> { + this.baseMapper.updateById(population); + }); + } + return R.ok(); + } + } \ No newline at end of file -- Gitblit v1.7.1