| | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.panzhihua.common.model.dtos.partybuilding.ComDataStatisticsOrgDto; |
| | | import com.panzhihua.common.model.dtos.partybuilding.PageComDataStatisticsMemberDto; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | return R.ok(memberPage); |
| | | } |
| | | |
| | | @Override |
| | | public R getOrgDataStatistics(ComDataStatisticsOrgDto statisticsOrgDto) { |
| | | List<Long> orgIds = new ArrayList<>(); |
| | | Long communityId = statisticsOrgDto.getCommunityId(); |
| | | ComDataStatisticsOrgVo statisticsOrgVo = new ComDataStatisticsOrgVo(); |
| | | ComPbOrgDO pbOrgDO = comPbOrgDAO.selectById(statisticsOrgDto.getOrgId()); |
| | | if(pbOrgDO == null){ |
| | | return R.fail("未查询到党组织"); |
| | | } |
| | | //拼接党组织id |
| | | if(pbOrgDO.getOneId() != null){ |
| | | orgIds.add(pbOrgDO.getOneId()); |
| | | } |
| | | if(pbOrgDO.getTwoId() != null){ |
| | | orgIds.add(pbOrgDO.getTwoId()); |
| | | } |
| | | if(pbOrgDO.getThirdId() != null){ |
| | | orgIds.add(pbOrgDO.getThirdId()); |
| | | } |
| | | if(pbOrgDO.getFourId() != null){ |
| | | orgIds.add(pbOrgDO.getFourId()); |
| | | } |
| | | if(pbOrgDO.getFiveId() != null){ |
| | | orgIds.add(pbOrgDO.getFiveId()); |
| | | } |
| | | //拼接查询开始结束时间 |
| | | String startTime = statisticsOrgDto.getYear() + "-01-01 00:00:00"; |
| | | String endTime = statisticsOrgDto.getYear() + "-12-31 23:59:59"; |
| | | |
| | | ComDataStatisticsOrgVo statisticsVo = new ComDataStatisticsOrgVo(); |
| | | //查询统计左上数据 |
| | | statisticsVo = comPbMemberDAO.getOrgDataStatistics(communityId,orgIds); |
| | | if(statisticsVo != null){ |
| | | BeanUtils.copyProperties(statisticsVo,statisticsOrgVo); |
| | | } |
| | | |
| | | //查询左下数据 |
| | | statisticsVo = comPbMemberDAO.getOrgDataStatisticsLeftDown(communityId,orgIds,startTime,endTime); |
| | | if(statisticsVo != null){ |
| | | BeanUtils.copyProperties(statisticsVo,statisticsOrgVo); |
| | | } |
| | | |
| | | //查询党员数据 |
| | | IPage<PartyBuildingMemberVO> partyMemberPage = comPbMemberDAO.getOrgDataStatisticsMember(new Page(statisticsOrgDto.getPageNum() |
| | | ,statisticsOrgDto.getPageSize()),communityId,orgIds); |
| | | if(partyMemberPage.getRecords() != null && !partyMemberPage.getRecords().isEmpty()){ |
| | | statisticsOrgVo.setPartyMemberList(partyMemberPage.getRecords()); |
| | | } |
| | | |
| | | List<String> startDateList = DateUtils.getYearFirstMonths(statisticsOrgDto.getYear()); |
| | | List<String> endDateList = DateUtils.getYearLastMonths(statisticsOrgDto.getYear()); |
| | | List<String> completeWishList = new ArrayList<>(); |
| | | List<String> cumulativeWishList = new ArrayList<>(); |
| | | List<String> completeEasyList = new ArrayList<>(); |
| | | List<String> cumulativeEasyList = new ArrayList<>(); |
| | | for (int i = 0; i < startDateList.size(); i++) { |
| | | Map<String,Object> statisticsMap = comPbMemberDAO.getOrgDataStatisticsRightDown(communityId,orgIds, startDateList.get(i), endDateList.get(i)); |
| | | if(statisticsMap != null){ |
| | | completeWishList.add(statisticsMap.get("completeWishNum").toString()); |
| | | cumulativeWishList.add(statisticsMap.get("cumulativeWishNum").toString()); |
| | | completeEasyList.add(statisticsMap.get("completeEasyNum").toString()); |
| | | cumulativeEasyList.add(statisticsMap.get("completeEasyNum").toString()); |
| | | } |
| | | } |
| | | statisticsOrgVo.setCompleteEasyList(completeEasyList); |
| | | statisticsOrgVo.setCompleteWishList(completeWishList); |
| | | statisticsOrgVo.setCumulativeWishList(cumulativeWishList); |
| | | statisticsOrgVo.setCumulativeEasyList(cumulativeEasyList); |
| | | return R.ok(statisticsOrgVo); |
| | | } |
| | | |
| | | } |