| | |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.common.enums.PopulCultureLevelEnum; |
| | | import com.panzhihua.common.enums.PopulMarriageEnum; |
| | | import com.panzhihua.common.enums.PopulPoliticalOutlookEnum; |
| | | import com.panzhihua.common.enums.PopulRelationEnum; |
| | | import com.panzhihua.common.model.dtos.property.CommonPage; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComActFourMemberVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngPopulationDetailVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngPopulationVO; |
| | | import com.panzhihua.common.model.vos.community.FourMemberDetailVO; |
| | | import com.panzhihua.common.model.vos.partybuilding.ComPbMemberVO; |
| | | import com.panzhihua.common.model.vos.user.AdministratorsUserVO; |
| | | import com.panzhihua.common.model.vos.user.ComHouseMemberVo; |
| | | import com.panzhihua.common.model.vos.user.ComMngHouseVo; |
| | | import com.panzhihua.common.service.partybuilding.PartyBuildingService; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.service_community.dao.ComMngBuildingDAO; |
| | | import com.panzhihua.common.utlis.AgeUtils; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.service_community.dao.*; |
| | | import com.panzhihua.service_community.entity.ComActCommittee; |
| | | import com.panzhihua.service_community.entity.ComActFourMember; |
| | | import com.panzhihua.service_community.dao.ComActFourMemberDao; |
| | | import com.panzhihua.service_community.model.dos.ComMngBuildingDO; |
| | | import com.panzhihua.service_community.model.dos.ComMngPopulationDO; |
| | | import com.panzhihua.service_community.model.dos.ComMngPopulationHouseUserDO; |
| | | import com.panzhihua.service_community.model.dos.ComPbMemberDO; |
| | | import com.panzhihua.service_community.service.ComActFourMemberService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | |
| | | private ComMngBuildingDAO comMngBuildingDAO; |
| | | @Resource |
| | | private UserService userService; |
| | | @Resource |
| | | private ComMngPopulationDAO comMngPopulationDAO; |
| | | @Resource |
| | | private ComPbMemberDAO comPbMemberDAO; |
| | | @Resource |
| | | private ComMngPopulationHouseUserDAO comMngPopulationHouseUserDAO; |
| | | @Resource |
| | | private ComMngPopulationHouseDAO comMngPopulationHouseDAO; |
| | | @Override |
| | | public R pageList(CommonPage commonPage) { |
| | | return R.ok(comActFourMemberDao.pageList(new Page(commonPage.getPage(),commonPage.getSize()),commonPage)); |
| | |
| | | public R get(Integer id) { |
| | | return R.ok(comActFourMemberDao.getById(id)); |
| | | } |
| | | |
| | | @Override |
| | | public R selectByMember(CommonPage commonPage) { |
| | | IPage<ComMngPopulationVO> comMngPopulationDOIPage=this.comMngPopulationDAO.query(new Page<ComMngPopulationDO>(commonPage.getPage(),commonPage.getSize()),commonPage); |
| | | if (!comMngPopulationDOIPage.getRecords().isEmpty()) { |
| | | comMngPopulationDOIPage.getRecords().forEach(populDO -> { |
| | | if (StringUtils.isNotEmpty(populDO.getBirthday())) { |
| | | populDO.setAge(AgeUtils.getAgeFromBirthTimes(populDO.getBirthday())); |
| | | } |
| | | }); |
| | | } |
| | | return R.ok(comMngPopulationDOIPage); |
| | | } |
| | | |
| | | @Override |
| | | public R selectById(Long id) { |
| | | FourMemberDetailVO fourMemberDetailVO=new FourMemberDetailVO(); |
| | | ComMngPopulationDO comMngPopulationDO = comMngPopulationDAO.selectById(id); |
| | | if (ObjectUtils.isEmpty(comMngPopulationDO)) { |
| | | return R.fail("用户信息不存在"); |
| | | } |
| | | // if(StringUtils.isNotEmpty(comMngPopulationDO.getBirthday())){//计算年龄 |
| | | // comMngPopulationDO.setAge(AgeUtils.getAgeFromBirthTimes(comMngPopulationDO.getBirthday())); |
| | | // } |
| | | |
| | | ComMngPopulationVO comMngPopulationVO = new ComMngPopulationVO(); |
| | | BeanUtils.copyProperties(comMngPopulationDO, comMngPopulationVO); |
| | | |
| | | // 查询户主关系信息 |
| | | // List<ComHouseMemberVo> comMngFamilyInfoVOS = |
| | | // populationDAO.listHouseMermberByUserId(comMngPopulationDO.getHouseId(),comMngPopulationDO.getId()); |
| | | // if (!comMngFamilyInfoVOS.isEmpty()) { |
| | | // comMngPopulationVO.setComMngFamilyInfoVOS(comMngFamilyInfoVOS); |
| | | // } |
| | | // 查询户主关系信息 |
| | | List<ComHouseMemberVo> comMngFamilyInfoVOS = comMngPopulationDAO.listHouseMermberByPopuId(comMngPopulationDO.getId()); |
| | | if (!comMngFamilyInfoVOS.isEmpty()) { |
| | | for (ComHouseMemberVo comHouseMemberVo : comMngFamilyInfoVOS) { |
| | | comHouseMemberVo.setAge(AgeUtils.getAgeFromBirthTimes(comHouseMemberVo.getBirthDay())); |
| | | } |
| | | comMngPopulationVO.setComMngFamilyInfoVOS(comMngFamilyInfoVOS); |
| | | } |
| | | // 设置户主关系 |
| | | List<ComMngPopulationHouseUserDO> comMngPopulationHouseUserDOS = |
| | | comMngPopulationHouseUserDAO.selectList((new QueryWrapper<ComMngPopulationHouseUserDO>().lambda() |
| | | .eq(ComMngPopulationHouseUserDO::getPopulId, id))); |
| | | if (!comMngPopulationHouseUserDOS.isEmpty()) { |
| | | comMngPopulationVO |
| | | .setRelation(comMngPopulationHouseUserDOS.get(comMngPopulationHouseUserDOS.size() - 1).getRelation()); |
| | | } |
| | | // 设置年龄 |
| | | if (StringUtils.isNotEmpty(comMngPopulationVO.getBirthday())) { |
| | | comMngPopulationVO.setAge(AgeUtils.getAgeFromBirthTimes(comMngPopulationVO.getBirthday())); |
| | | } |
| | | // 查询当前用户房屋信息 |
| | | List<ComMngHouseVo> houseList = comMngPopulationHouseDAO.getPopulHouseListByPopulId(id); |
| | | if (!houseList.isEmpty()) { |
| | | houseList.forEach(house -> { |
| | | |
| | | }); |
| | | comMngPopulationVO.setHouseList(houseList); |
| | | } |
| | | |
| | | if(comMngPopulationVO!=null&&StringUtils.isNotEmpty(comMngPopulationVO.getPhone())){ |
| | | fourMemberDetailVO.setComMngPopulationVO(comMngPopulationVO); |
| | | ComPbMemberVO comPbMemberDO=comPbMemberDAO.selectById(comMngPopulationVO.getPhone()); |
| | | if(comPbMemberDO!=null){ |
| | | fourMemberDetailVO.setPartyBuildingMemberVO(comPbMemberDO); |
| | | } |
| | | } |
| | | return R.ok(fourMemberDetailVO); |
| | | } |
| | | } |