diff --git a/lzbi-common/src/main/java/com/lzbi/common/enums/HeatingPeriodEnum.java b/lzbi-common/src/main/java/com/lzbi/common/enums/HeatingPeriodEnum.java new file mode 100644 index 0000000..4ec4aff --- /dev/null +++ b/lzbi-common/src/main/java/com/lzbi/common/enums/HeatingPeriodEnum.java @@ -0,0 +1,19 @@ +package com.lzbi.common.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +@Getter +@AllArgsConstructor +public enum HeatingPeriodEnum +{ + HEATING_ALL_PERIOD(Stream.of(1,2,3,11,12).collect(Collectors.toList())), + HEATING_NEXT_YREA_PERIOD(Stream.of(1,2,3).collect(Collectors.toList())), + HEATING_CURRENT_YREA_PERIOD(Stream.of(11,12).collect(Collectors.toList())); + + private final List months; +} diff --git a/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenMainController.java b/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenMainController.java index e4edc73..c3b6a17 100644 --- a/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenMainController.java +++ b/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenMainController.java @@ -12,6 +12,7 @@ import com.lzbi.common.core.controller.BaseController; import com.lzbi.common.core.domain.AjaxResult; import com.lzbi.common.core.domain.TreeSelect; import com.lzbi.common.core.domain.entity.SysDept; +import com.lzbi.common.enums.ReportNameEnum; import com.lzbi.common.utils.StringUtils; import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo; import com.lzbi.system.service.impl.SysDeptServiceImpl; @@ -27,6 +28,8 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; +import java.util.stream.Stream; /** * 主数据大屏的页面接口 @@ -156,6 +159,18 @@ public class DcBusiDataScreenMainController extends BaseController{ return AjaxResult.success(dcBusiDataScreenMainService.getMapInfo(vo)); } + @PostMapping("/heatRateRange") + public AjaxResult getHeatRateRange(@RequestBody TargetDraftDaynewReqVo vo){ + vo.setReportNames(Stream.of(ReportNameEnum.HEAT_RATE.getName()).collect(Collectors.toList())); + return AjaxResult.success(dcBusiDataScreenMainService.getHeatingPeriodData(vo)); + } + + @PostMapping("/coalConsumptionRange") + public AjaxResult getCoalConsumptionRange(@RequestBody TargetDraftDaynewReqVo vo){ + vo.setReportNames(Stream.of(ReportNameEnum.COAL_CONSUMPTION_PER_UNIT.getName()).collect(Collectors.toList())); + return AjaxResult.success(dcBusiDataScreenMainService.getHeatingPeriodData(vo)); + } + @GetMapping("/company/tree/{depId}") public AjaxResult getCompanyTreeList(@Nullable @PathVariable Long depId){ if(depId==0){ diff --git a/lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiDataScreenMainService.java b/lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiDataScreenMainService.java index 0954763..0e7c17d 100644 --- a/lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiDataScreenMainService.java +++ b/lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiDataScreenMainService.java @@ -1,6 +1,8 @@ package com.lzbi.bi.service; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjUtil; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; @@ -13,15 +15,19 @@ import com.lzbi.bi.domain.SysDeptLocation; import com.lzbi.bi.mapper.DcBusiDataScreenMainMapper; import com.lzbi.common.constant.BizConstants; import com.lzbi.common.core.domain.entity.SysDept; +import com.lzbi.common.enums.HeatingPeriodEnum; import com.lzbi.common.enums.ReportNameEnum; +import com.lzbi.common.utils.StringUtils; import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo; import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo; import com.lzbi.draft.service.DcBusiTargetDraftDaynewService; import com.lzbi.system.service.ISysDeptService; +import org.apache.commons.compress.utils.Lists; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; +import java.util.Calendar; import java.util.Comparator; import java.util.List; import java.util.Map; @@ -308,4 +314,25 @@ public class DcBusiDataScreenMainService extends ServiceImpl selectSquareGroup(String qdate){ return baseMapper.selectSquareGroup(qdate); } + + public List getHeatingPeriodData(TargetDraftDaynewReqVo vo){ + List res = Lists.newArrayList(); + if (!HeatingPeriodEnum.HEATING_ALL_PERIOD.getMonths().contains(Integer.parseInt(vo.getDateMonth()))) { + return res; + } + List sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.COMANY).build()); + if (CollUtil.isEmpty(sysDepts)) { + return res; + } + List orgIds = sysDepts.stream().map(SysDept::getDeptId).distinct().collect(Collectors.toList()); + vo.setAssetType("0").setAssetLevel("10").setOrgIds(orgIds); + String dateYear = vo.getDateYear(); + if (HeatingPeriodEnum.HEATING_NEXT_YREA_PERIOD.getMonths().contains(Integer.parseInt(vo.getDateMonth()))) { + dateYear = String.valueOf(Integer.parseInt(vo.getDateYear())-1); + } + vo.setBeginDate(StringUtils.join(dateYear, "1101")).setAssetType("0").setAssetLevel("10").setOrgIds(orgIds) + .setEndDate(StringUtils.join(vo.getDateYear(),vo.getDateMonth(),vo.getDateDay())); + res = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewRangeList(vo); + return res; + } } \ No newline at end of file diff --git a/lzbi-module/src/main/java/com/lzbi/draft/domain/vo/TargetDraftDaynewReqVo.java b/lzbi-module/src/main/java/com/lzbi/draft/domain/vo/TargetDraftDaynewReqVo.java index 8b0d591..bd6df37 100644 --- a/lzbi-module/src/main/java/com/lzbi/draft/domain/vo/TargetDraftDaynewReqVo.java +++ b/lzbi-module/src/main/java/com/lzbi/draft/domain/vo/TargetDraftDaynewReqVo.java @@ -36,4 +36,8 @@ public class TargetDraftDaynewReqVo { private String assetType; + private String beginDate; + + private String endDate; + } diff --git a/lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftDaynewMapper.java b/lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftDaynewMapper.java index 1d54617..5fb52e5 100644 --- a/lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftDaynewMapper.java +++ b/lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftDaynewMapper.java @@ -11,6 +11,7 @@ import com.lzbi.wechat.domain.vo.TargetResultVO; import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; /** * 指标数据底稿日-新结构Mapper接口 @@ -91,5 +92,7 @@ public interface DcBusiTargetDraftDaynewMapper extends BaseMapper selectTargetDraftDaynewList(TargetDraftDaynewReqVo vo); + List selectTargetDraftDaynewRangeList(TargetDraftDaynewReqVo vo); + List selectTargetDraftDaynewAggregateList(TargetDraftDaynewReqVo vo); } diff --git a/lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetDraftDaynewService.java b/lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetDraftDaynewService.java index 0855a04..da94535 100644 --- a/lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetDraftDaynewService.java +++ b/lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetDraftDaynewService.java @@ -1,6 +1,8 @@ package com.lzbi.draft.service; import java.util.List; +import java.util.Map; + import com.lzbi.common.utils.DateUtils; import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo; import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo; @@ -94,4 +96,8 @@ public class DcBusiTargetDraftDaynewService extends ServiceImpl selectTargetDraftDaynewList(TargetDraftDaynewReqVo vo){ return baseMapper.selectTargetDraftDaynewList(vo); } + + public List selectTargetDraftDaynewRangeList(TargetDraftDaynewReqVo vo){ + return baseMapper.selectTargetDraftDaynewRangeList(vo); + } } diff --git a/lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftDaynewMapper.xml b/lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftDaynewMapper.xml index 81702ca..8482bff 100644 --- a/lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftDaynewMapper.xml +++ b/lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftDaynewMapper.xml @@ -321,6 +321,65 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + +