Sfoglia il codice sorgente

获取数据范围调整到上个月(不统计当月)

linzhiwei 4 anni fa
parent
commit
0bb28cb2ab

+ 5 - 0
src/main/java/com/tofly/nb/sew/model/vo/SludgeJuneInfoVo.java

@@ -29,4 +29,9 @@ public class SludgeJuneInfoVo implements Serializable {
      */
     @ApiModelProperty(value = "污泥月处理量")
     private BigDecimal ywnczl;
+    /**
+     * 污泥月脱水处理量
+     */
+    @ApiModelProperty(value = "污泥月脱水处理量")
+    private BigDecimal ytswncl;
 }

+ 19 - 12
src/main/java/com/tofly/nb/sew/service/impl/SsBbMonthServiceImpl.java

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.tofly.nb.sew.model.po.SsBbMonth;
 import com.tofly.nb.sew.mapper.SsBbMonthMapper;
 import com.tofly.nb.sew.model.po.SsYywsclc;
-import com.tofly.nb.sew.model.po.SsYywsclcCczb;
 import com.tofly.nb.sew.model.vo.*;
 import com.tofly.nb.sew.service.ISsBbMonthService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -36,8 +35,8 @@ public class SsBbMonthServiceImpl extends ServiceImpl<SsBbMonthMapper, SsBbMonth
 
     @Override
     public List<SsBbMonth> getYearDetail() {
-        // 获取当前时间12个月的污水数据
-        LocalDateTime now = LocalDateTime.now();
+        // 获取上个月月末时间 12个月的污水数据
+        LocalDateTime now = LocalDateTime.now().minusMonths(1);
         LocalDateTime fixValue = now.minusMonths(12);
 
         String lostDate = DateTimeUtil.getLocalDateTime(now, DateTimeUtil.MONTHS_YEARS_FORMAT);
@@ -45,8 +44,8 @@ public class SsBbMonthServiceImpl extends ServiceImpl<SsBbMonthMapper, SsBbMonth
         QueryWrapper<SsBbMonth> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("SHBZ", "1");
         queryWrapper.eq("JHZT", "1");
-        queryWrapper.lt("UMONTH", lostDate);
-        queryWrapper.gt("UMONTH", beginDate);
+        queryWrapper.le("UMONTH", lostDate);
+        queryWrapper.ge("UMONTH", beginDate);
         return monthMapper.selectList(queryWrapper);
     }
 
@@ -128,7 +127,7 @@ public class SsBbMonthServiceImpl extends ServiceImpl<SsBbMonthMapper, SsBbMonth
         BigDecimal totalSewageTreatment = monthGroupMap.values().stream().reduce(BigDecimal.ZERO, BigDecimal::add);
 
         // 总年度占比=上月污水处理总量/统计上月以及以前11月的污水处理总量
-        BigDecimal totalAccountedRate = bigDecimal.divide(totalSewageTreatment, 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
+        BigDecimal totalAccountedRate = bigDecimal.divide(totalSewageTreatment, 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
 
         productionStatisticsVo.setTotalSewLastMonth(bigDecimal);
         productionStatisticsVo.setTotalSewageTreatment(totalSewageTreatment);
@@ -161,7 +160,7 @@ public class SsBbMonthServiceImpl extends ServiceImpl<SsBbMonthMapper, SsBbMonth
         }
 
 
-        return decimal.multiply(BigDecimal.valueOf(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
+        return decimal.multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
     }
 
 
@@ -196,7 +195,7 @@ public class SsBbMonthServiceImpl extends ServiceImpl<SsBbMonthMapper, SsBbMonth
         informationVo.setDealWaterSupply(dealWaterSupply.get());
         informationVo.setTotalDissipatedPower(totalDissipatedPower.get());
         // 水质达标率(本年度) DBL 合计平均=达标排放天数总和SUM(DBPFTS)/正常运行天数总和SUM(ZCYXTS)*100%
-        informationVo.setDbl(BigDecimal.valueOf(standard.get()).divide(BigDecimal.valueOf(normal.get()), 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2,BigDecimal.ROUND_HALF_UP));
+        informationVo.setDbl(BigDecimal.valueOf(standard.get()).divide(BigDecimal.valueOf(normal.get()), 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
 
         return informationVo;
     }
@@ -205,19 +204,26 @@ public class SsBbMonthServiceImpl extends ServiceImpl<SsBbMonthMapper, SsBbMonth
     @Override
     public List<SludgeJuneInfoVo> juneSludgeInfo(List<SsBbMonth> list) {
         Map<String, BigDecimal> map = new HashMap<>(12);
+        Map<String, BigDecimal> dehydrationMap = new HashMap<>(12);
         int now = Integer.parseInt(Objects.requireNonNull(DateTimeUtil.getLocalDateTime(LocalDateTime.now(), DateTimeUtil.MONTHS_YEARS_FORMAT)));
         int begin = Integer.parseInt(Objects.requireNonNull(DateTimeUtil.getLocalDateTime(LocalDateTime.now().minusMonths(6), DateTimeUtil.MONTHS_YEARS_FORMAT)));
 
-        // 先过滤内容为近6个月数据 按数据月份分组获取污泥处理量
+        // 先过滤内容为近6个月数据 按数据月份分组获取污泥处理量/脱水污泥处理量
         list.stream().filter(dto -> begin <= Integer.parseInt(dto.getUmonth()) && Integer.parseInt(dto.getUmonth()) <= now).
                 forEach(dto -> {
                     String umonth = dto.getUmonth();
                     BigDecimal ywnczl = dto.getYclsl() == null ? BigDecimal.ZERO : BigDecimal.valueOf(dto.getYwnczl());
+                    BigDecimal ytswncl = dto.getYtswncl() == null ? BigDecimal.ZERO : BigDecimal.valueOf(dto.getYtswncl());
+
                     if (map.containsKey(umonth)) {
                         BigDecimal decimal = map.get(umonth);
+                        BigDecimal bigDecimal = dehydrationMap.get(umonth);
                         decimal = decimal.add(ywnczl);
+                        bigDecimal = bigDecimal.add(ytswncl);
                         map.put(umonth, decimal);
+                        dehydrationMap.put(umonth, bigDecimal);
                     } else {
+                        dehydrationMap.put(umonth, ytswncl);
                         map.put(umonth, ywnczl);
                     }
                 });
@@ -226,9 +232,10 @@ public class SsBbMonthServiceImpl extends ServiceImpl<SsBbMonthMapper, SsBbMonth
             SludgeJuneInfoVo vo = new SludgeJuneInfoVo();
             vo.setUmonth(k);
             vo.setYwnczl(map.get(k));
+            vo.setYtswncl(dehydrationMap.get(k));
             result.add(vo);
         });
-        return result.stream().sorted(Comparator.comparing(SludgeJuneInfoVo::getUmonth).reversed()).collect(Collectors.toList());
+        return result.stream().sorted(Comparator.comparing(SludgeJuneInfoVo::getUmonth)).collect(Collectors.toList());
     }
 
     @Override
@@ -258,12 +265,12 @@ public class SsBbMonthServiceImpl extends ServiceImpl<SsBbMonthMapper, SsBbMonth
             Integer dbpfts = saveDbpfts.get(k);
             Integer zcyxts = saveZcyxts.get(k);
             vo.setUmonth(k);
-            vo.setDbl(BigDecimal.valueOf(dbpfts).divide(BigDecimal.valueOf(zcyxts), 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2,BigDecimal.ROUND_HALF_UP));
+            vo.setDbl(BigDecimal.valueOf(dbpfts).divide(BigDecimal.valueOf(zcyxts), 4, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
             waterQualityJuneInfoVoList.add(vo);
         });
 
 
-        return waterQualityJuneInfoVoList.stream().sorted(Comparator.comparing(WaterQualityJuneInfoVo::getUmonth).reversed()).collect(Collectors.toList());
+        return waterQualityJuneInfoVoList.stream().sorted(Comparator.comparing(WaterQualityJuneInfoVo::getUmonth)).collect(Collectors.toList());
     }
 
 

+ 3 - 3
src/main/java/com/tofly/nb/sew/service/impl/StpOverviewServiceImpl.java

@@ -33,13 +33,13 @@ public class StpOverviewServiceImpl implements IStpOverviewService {
     @Override
     public ResultOverviewInformationVo getOverviewInformation() {
         ResultOverviewInformationVo result = new ResultOverviewInformationVo();
-        // 获取当前时间12个月
-        LocalDateTime now = LocalDateTime.now();
+        // 获取当前时间-1月 的12个月时间范围
+        LocalDateTime now = LocalDateTime.now().minusMonths(1);
         LocalDateTime fixValue = now.minusMonths(12);
 
         String lostDate = DateTimeUtil.getLocalDateTime(now, DateTimeUtil.MONTHS_YEARS_FORMAT);
         String beginDate = DateTimeUtil.getLocalDateTime(fixValue, DateTimeUtil.MONTHS_YEARS_FORMAT);
-        // 上一个月
+
         String onLostDate = DateTimeUtil.getLocalDateTime(now.minusMonths(1), DateTimeUtil.MONTHS_YEARS_FORMAT);
 
         List<SsBbMonth> yearDetail = iSsBbMonthService.getYearDetail();