| | |
| | | import com.panzhihua.common.model.dtos.community.acid.BatchCheckAcidRecordDTO; |
| | | import com.panzhihua.common.model.dtos.community.acid.ComActAcidRecordDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.StatisticsPhotoVO; |
| | | import com.panzhihua.common.model.vos.community.acid.*; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.common.utlis.DateUtils; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNotEmpty; |
| | | import static com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNull; |
| | |
| | | public R insertRecord(ComActAcidRecordVO comActAcidRecordVO) { |
| | | Integer count= this.baseMapper.selectCount(new QueryWrapper<ComActAcidRecord>().lambda().eq(ComActAcidRecord::getIsDel,0).eq(ComActAcidRecord::getIdCard,comActAcidRecordVO.getIdCard()).ge(ComActAcidRecord::getCreateTime, DateUtils.getCurrentDate(DateUtils.yyyyMMdd_format))); |
| | | if(count>0){ |
| | | return R.fail("请勿重复提交"); |
| | | return R.fail("您的社区报备信息已填写完整,请勿重复提交!"); |
| | | } |
| | | if(StringUtils.isEmpty(comActAcidRecordVO.getLocalCity())){ |
| | | rabbitTemplate.convertAndSend("huacheng.acid.exchange", "huacheng.acid.key", comActAcidRecordVO, message -> { |
| | |
| | | //未填住址人员 |
| | | saveAcidDangerMember(comActAcidRecordVO, comActAcidRecord.getId(), 2, null); |
| | | } |
| | | return R.ok(comActAcidRecord.getId()); |
| | | return R.ok(comActAcidRecord.getId().toString()); |
| | | } |
| | | |
| | | return R.fail("操作失败,请重新尝试"); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public R checkCommit(Long userId) { |
| | | if(userId!=null){ |
| | | List<ComActAcidRecord> comActAcidRecords= this.baseMapper.selectList(new QueryWrapper<ComActAcidRecord>().lambda().eq(ComActAcidRecord::getIsDel,0).eq(ComActAcidRecord::getUserId,userId).ge(ComActAcidRecord::getCreateTime, DateUtils.getCurrentDate(DateUtils.yyyyMMdd_format)).isNull(ComActAcidRecord::getColorImage)); |
| | | return R.ok(comActAcidRecords); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | public static void areaCheck(ComCun area,ComStreetDO comStreetDO){ |
| | | switch (area.getArea()){ |
| | | case "西区": comStreetDO.setAreaCode(510423); break; |
| | |
| | | } |
| | | return 3; |
| | | } |
| | | |
| | | /** |
| | | * 统计红黄绿码 |
| | | * @return |
| | | */ |
| | | public R selectColorMarkGroup(){ |
| | | //所有 |
| | | List<ComActAcidColorChartsVO> comActAcidColorChartsVOS = this.baseMapper.selectColorMarkGroup(); |
| | | int all = comActAcidColorChartsVOS.stream().mapToInt(ComActAcidColorChartsVO::getCountNum).sum(); |
| | | for (ComActAcidColorChartsVO comActAcidColorChartsVO : comActAcidColorChartsVOS) { |
| | | if (0!=all){ |
| | | BigDecimal countNum = new BigDecimal(comActAcidColorChartsVO.getCountNum()); |
| | | BigDecimal allDecimal = new BigDecimal(all); |
| | | BigDecimal percent = countNum.divide(allDecimal,4, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal(100)); |
| | | comActAcidColorChartsVO.setPercent(percent); |
| | | } |
| | | } |
| | | // Map<String, ComActAcidColorChartsVO> circleMap = comActAcidColorChartsVOS |
| | | // .stream() |
| | | // .collect(Collectors.toMap(ComActAcidColorChartsVO::getColorMark, Function.identity())); |
| | | |
| | | //月份 |
| | | List<ComActAcidColorChartsVO> comActAcidColorChartsVOS1 = this.baseMapper.selectColorMarkGroupByMonth(); |
| | | //按颜色分组求和 |
| | | Map<String, IntSummaryStatistics> colorCollect = comActAcidColorChartsVOS1 |
| | | .stream() |
| | | .collect(Collectors.groupingBy(ComActAcidColorChartsVO::getColorMark, |
| | | Collectors.summarizingInt(ComActAcidColorChartsVO::getCountNum))); |
| | | |
| | | for (ComActAcidColorChartsVO comActAcidColorChartsVO : comActAcidColorChartsVOS1) { |
| | | String colorMark = comActAcidColorChartsVO.getColorMark(); |
| | | if (colorCollect.containsKey(colorMark)){ |
| | | IntSummaryStatistics intSummaryStatistics = colorCollect.get(colorMark); |
| | | long sum = intSummaryStatistics.getSum(); |
| | | if (0L!=sum) { |
| | | BigDecimal countNum = new BigDecimal(comActAcidColorChartsVO.getCountNum()); |
| | | BigDecimal sumDecimal = new BigDecimal(sum); |
| | | BigDecimal percent = countNum.divide(sumDecimal, 4, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal(100)); |
| | | comActAcidColorChartsVO.setPercent(percent); |
| | | } |
| | | } |
| | | } |
| | | Map<String, Map<String, ComActAcidColorChartsVO>> colletMap = comActAcidColorChartsVOS1 |
| | | .stream() |
| | | .collect(Collectors.groupingBy(ComActAcidColorChartsVO::getCountName, |
| | | Collectors.toMap(ComActAcidColorChartsVO::getColorMark, Function.identity()))); |
| | | |
| | | String[] statusArr = {"红码","黄码","绿码"}; |
| | | List<String> latest5Month = DateUtils.getLatest12Month(LocalDate.now(), 5); |
| | | for (String month : latest5Month) { |
| | | Map<String, ComActAcidColorChartsVO> map1; |
| | | if(colletMap.containsKey(month)){ |
| | | map1 = colletMap.get(month); |
| | | }else { |
| | | map1 = new HashMap<>(); |
| | | } |
| | | for (String status : statusArr) { |
| | | if (!map1.containsKey(status)){ |
| | | ComActAcidColorChartsVO comActAcidColorChartsVO = new ComActAcidColorChartsVO(); |
| | | comActAcidColorChartsVO.setCountNum(0); |
| | | comActAcidColorChartsVO.setCountName(month); |
| | | comActAcidColorChartsVO.setColorMark(status); |
| | | comActAcidColorChartsVOS1.add(comActAcidColorChartsVO); |
| | | map1.put(status,comActAcidColorChartsVO); |
| | | } |
| | | } |
| | | colletMap.put(month,map1); |
| | | } |
| | | |
| | | |
| | | Map<String, List<ComActAcidColorChartsVO>> chartMap = comActAcidColorChartsVOS1 |
| | | .stream().sorted(Comparator.comparing(ComActAcidColorChartsVO::getCountName)) |
| | | .collect(Collectors.groupingBy(ComActAcidColorChartsVO::getColorMark)); |
| | | |
| | | Map<String,Object> retMap = new HashMap<>(); |
| | | retMap.put("comActAcidColorChartsVOS",comActAcidColorChartsVOS); |
| | | retMap.put("chartMap",chartMap); |
| | | |
| | | return R.ok(retMap); |
| | | } |
| | | } |