Browse Source

bi大屏接口

develop
bobol 6 months ago
parent
commit
7cc08085d8
  1. 9
      lzbi-common/src/main/java/com/lzbi/common/constant/BizConstants.java
  2. 210
      lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenMainController.java
  3. 32
      lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenNewController.java
  4. 38
      lzbi-module/src/main/java/com/lzbi/bi/mapper/DcBusiDataScreenMainMapper.java
  5. 430
      lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiDataScreenMainService.java
  6. 66
      lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiDataScreenNewService.java
  7. 2
      lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamDraftDay.java
  8. 24
      lzbi-module/src/main/java/com/lzbi/draft/domain/dto/SomeOrgSomedayMultiReportDataDTO.java
  9. 33
      lzbi-module/src/main/java/com/lzbi/draft/domain/dto/SomeTypeChildrenOrgSomedayMultiReportDataDTO.java
  10. 8
      lzbi-module/src/main/java/com/lzbi/draft/domain/req/ReportDataReq.java
  11. 29
      lzbi-module/src/main/java/com/lzbi/draft/domain/vo/ChildrenOrgSomedaySomeReportDataVO.java
  12. 21
      lzbi-module/src/main/java/com/lzbi/draft/domain/vo/SomeOrgSomeReportYearlyDataVO.java
  13. 24
      lzbi-module/src/main/java/com/lzbi/draft/domain/vo/SomeOrgSomedayMultiReportDataVO.java
  14. 22
      lzbi-module/src/main/java/com/lzbi/draft/domain/vo/SomeOrgSomedaySomeReportDataVO.java
  15. 8
      lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiParamDraftDayMapper.java
  16. 9
      lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftDaynewMapper.java
  17. 6
      lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftMonthMapper.java
  18. 8
      lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetDraftDaynewService.java
  19. 18
      lzbi-module/src/main/java/com/lzbi/external/service/ParamsService.java
  20. 2
      lzbi-module/src/main/java/com/lzbi/report/service/AjReportService.java
  21. 123
      lzbi-module/src/main/resources/mapper/DcBusiDataScreenMainMapper.xml
  22. 8
      lzbi-module/src/main/resources/mapper/asset/DcBusiParamDraftDayMapper.xml
  23. 6
      lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftDaynewMapper.xml
  24. 2
      lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftMonthMapper.xml

9
lzbi-common/src/main/java/com/lzbi/common/constant/BizConstants.java

@ -120,7 +120,10 @@ public interface BizConstants {
* 部门类别 * 部门类别
*/ */
interface DcDeptAttr { interface DcDeptAttr {
/**
* 集团
*/
String BLOC = "1001";
/** /**
* 公司 * 公司
*/ */
@ -130,6 +133,10 @@ public interface BizConstants {
* 热源 * 热源
*/ */
String HEAT_SOURCE = "1003"; String HEAT_SOURCE = "1003";
/**
* 供热部
*/
String HEATING_DEPARTMENT = "1005";
} }
/** /**

210
lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenMainController.java

@ -1,35 +1,27 @@
package com.lzbi.bi.controller; package com.lzbi.bi.controller;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.lzbi.bi.domain.DcBusiDataScreenVo;
import com.lzbi.bi.service.DcBusiDataScreenMainService; import com.lzbi.bi.service.DcBusiDataScreenMainService;
import com.lzbi.common.core.controller.BaseController; import com.lzbi.common.core.controller.BaseController;
import com.lzbi.common.core.domain.AjaxResult; import com.lzbi.common.core.domain.AjaxResult;
import com.lzbi.common.core.domain.TreeSelect; import com.lzbi.common.core.domain.TreeSelect;
import com.lzbi.common.core.domain.entity.SysDept; import com.lzbi.common.core.domain.entity.SysDept;
import com.lzbi.common.enums.ReportNameEnum; import com.lzbi.draft.domain.req.ReportDataReq;
import com.lzbi.common.utils.StringUtils;
import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo;
import com.lzbi.system.service.impl.SysDeptServiceImpl; import com.lzbi.system.service.impl.SysDeptServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* 主数据大屏的页面接口 * 主数据大屏的页面接口
@ -41,17 +33,7 @@ import java.util.stream.Stream;
@RestController @RestController
@RequestMapping("/assetData/dataScreenMain") @RequestMapping("/assetData/dataScreenMain")
public class DcBusiDataScreenMainController extends BaseController{ public class DcBusiDataScreenMainController extends BaseController{
// {
// "code": "200",
// "data": {
// "list": [
// ["product", "合力供热站", "浑南热力", "国润低碳", "新环保", "节能环保"],
// ["计划数", 41.1, 30.4, 65.1, 53.3, 69],
// ["实际数", 35.5, 92.1, 85.7, 83.1, 72]
// ]
// },
// "msg": "seccess"
// }
@Autowired @Autowired
private DcBusiDataScreenMainService dcBusiDataScreenMainService; private DcBusiDataScreenMainService dcBusiDataScreenMainService;
@ -59,40 +41,75 @@ public class DcBusiDataScreenMainController extends BaseController{
private SysDeptServiceImpl sysDeptService; private SysDeptServiceImpl sysDeptService;
/** /**
* 大屏数据煤耗 * 获取某个组织某天的某个图表数据
* @param reportDataReq
* @return * @return
*/ */
@PostMapping("/coalLostRate") @PostMapping("/getSomeOrgSomedaySomeReportData")
public AjaxResult getCoalLostRate(@RequestBody TargetDraftDaynewReqVo vo) public AjaxResult selectSomeOrgSomedaySomeReportData(@Validated @RequestBody ReportDataReq reportDataReq) {
{ return AjaxResult.success(dcBusiDataScreenMainService.selectSomeOrgSomedaySomeReportData(reportDataReq));
return AjaxResult.success(dcBusiDataScreenMainService.getCoalLostRate(vo));
} }
/** /**
* 总发电量和总耗电量 * 查询下级组织某天的某个图表数据列表
* * @param reportDataReq
* */ * @return
@PostMapping("/powerInfoAll") */
public AjaxResult getPowerInfoAll(@RequestBody TargetDraftDaynewReqVo vo) @PostMapping("/getChildrenOrgSomedaySomeReportDataList")
{ public AjaxResult selectChildrenOrgSomedaySomeReportDataList(@Validated @RequestBody ReportDataReq reportDataReq) {
return AjaxResult.success(dcBusiDataScreenMainService.selectPowerAll(vo)); return AjaxResult.success(dcBusiDataScreenMainService.selectChildrenOrgSomedaySomeReportDataList(reportDataReq));
}
/**
* 查询下级组织某天的某个图表的图形数据
* @param reportDataReq
* @return
*/
@PostMapping("/getChildrenOrgSomedaySomeReportDataEchart")
public AjaxResult selectChildrenOrgSomedaySomeReportDataEchart(@Validated @RequestBody ReportDataReq reportDataReq) {
return AjaxResult.success(dcBusiDataScreenMainService.selectChildrenOrgSomedaySomeReportDataEchart(reportDataReq));
} }
/** /**
* 供热公司面积 * 查询某组织某天的多个图表数据列表
* * @param reportDataReq
* */ * @return
@PostMapping("/squareInfoCompany") */
public AjaxResult getSquareInfoCompany(@RequestBody TargetDraftDaynewReqVo vo) @PostMapping("/getSomeOrgSomedayMultiReportDataList")
{ public AjaxResult selectSomeOrgSomedayMultiReportDataList(@Validated @RequestBody ReportDataReq reportDataReq) {
return AjaxResult.success(dcBusiDataScreenMainService.getSquareInfoCompany(vo)); return AjaxResult.success(dcBusiDataScreenMainService.selectSomeOrgSomedayMultiReportDataList(reportDataReq));
} }
/** /**
* 集团面积饼状图 * 查询某类型的下级组织某天的多图表数据--多柱形图
* */ * @param reportDataReq
@PostMapping("/squareInfoGroup") * @return
public AjaxResult getSquareInfoGroup(@RequestBody TargetDraftDaynewReqVo vo) */
{ @PostMapping("/getChildrenOrgSomedayMultiReportDataBar")
return AjaxResult.success(dcBusiDataScreenMainService.getSquareInfoGroup(vo)); public AjaxResult selectSomeTypeChildrenOrgSomedayMultiReportDataBar(@Validated @RequestBody ReportDataReq reportDataReq) {
return AjaxResult.success(dcBusiDataScreenMainService.selectChildrenOrgSomedayMultiReportDataBar(reportDataReq));
} }
/**
* 查询下级组织某天的某个图表的堆叠图形数据
* @param reportDataReq
* @return
*/
@PostMapping("/getChildrenOrgSomedaySomeReportDataEchartStacking")
public AjaxResult selectChildrenOrgSomedaySomeReportDataEchartStacking(@Validated @RequestBody ReportDataReq reportDataReq) {
return AjaxResult.success(dcBusiDataScreenMainService.selectChildrenOrgSomedaySomeReportDataEchartStacking(reportDataReq));
}
/**
* 查询某组织某个图表年度数据列表
* @param reportDataReq
* @return
*/
@PostMapping("/getSomeOrgSomeReportYearlyDataList")
public AjaxResult selectSomeOrgSomeReportYearlyDataList(@Validated @RequestBody ReportDataReq reportDataReq) {
return AjaxResult.success(dcBusiDataScreenMainService.selectSomeOrgSomeReportYearlyDataList(reportDataReq));
}
/** /**
* 获取天气信息 * 获取天气信息
*/ */
@ -138,39 +155,13 @@ public class DcBusiDataScreenMainController extends BaseController{
} }
return AjaxResult.success(ret); return AjaxResult.success(ret);
} }
/**
* 获取电耗
* */
@PostMapping("/powerLostRate")
public AjaxResult getPowerLostRate(@RequestBody TargetDraftDaynewReqVo vo){
return AjaxResult.success(dcBusiDataScreenMainService.getPowerLostRate(vo));
}
/**
* 获取水耗
* */
@PostMapping("/waterInfo")
public AjaxResult getWaterInfo(@RequestBody TargetDraftDaynewReqVo vo){
return AjaxResult.success(dcBusiDataScreenMainService.getWaterInfo(vo));
}
@PostMapping("/mapInfo") @PostMapping("/mapInfo")
public AjaxResult getMapInfo(@RequestBody TargetDraftDaynewReqVo vo){ public AjaxResult getMapInfo(@RequestBody ReportDataReq vo){
return AjaxResult.success(dcBusiDataScreenMainService.getMapInfo(vo)); 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}") @GetMapping("/company/tree/{depId}")
public AjaxResult getCompanyTreeList(@Nullable @PathVariable Long depId){ public AjaxResult getCompanyTreeList(@Nullable @PathVariable Long depId){
if(depId==0){ if(depId==0){
@ -181,76 +172,3 @@ public class DcBusiDataScreenMainController extends BaseController{
return AjaxResult.success( treeSelects) ; return AjaxResult.success( treeSelects) ;
} }
} }
/**
* {
* "nums": 0,
* "cityid": "101190101",
* "city": "南京",
* "update_time": "2023-11-16 20:13:34",
* "data": [
* {
* "date": "2023-11-16",
* "wea": "雾转晴",
* "wea_img": "qing",
* "tem_day": "14",
* "tem_night": "4",
* "win": "西北风",
* "win_speed": "3-4级"
* },
* {
* "date": "2023-11-17",
* "wea": "晴",
* "wea_img": "qing",
* "tem_day": "14",
* "tem_night": "1",
* "win": "西北风",
* "win_speed": "4-5级转<3级"
* },
* {
* "date": "2023-11-18",
* "wea": "多云转晴",
* "wea_img": "yun",
* "tem_day": "13",
* "tem_night": "4",
* "win": "西南风",
* "win_speed": "3-4级转<3级"
* },
* {
* "date": "2023-11-19",
* "wea": "晴",
* "wea_img": "qing",
* "tem_day": "19",
* "tem_night": "4",
* "win": "西南风",
* "win_speed": "3-4级转<3级"
* },
* {
* "date": "2023-11-20",
* "wea": "晴",
* "wea_img": "qing",
* "tem_day": "19",
* "tem_night": "6",
* "win": "东南风",
* "win_speed": "<3级"
* },
* {
* "date": "2023-11-21",
* "wea": "晴",
* "wea_img": "qing",
* "tem_day": "20",
* "tem_night": "7",
* "win": "东南风",
* "win_speed": "<3级"
* },
* {
* "date": "2023-11-22",
* "wea": "多云转阴",
* "wea_img": "yun",
* "tem_day": "21",
* "tem_night": "8",
* "win": "西风",
* "win_speed": "4-5级转3-4级"
* }
* ]
* }
* */

32
lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenNewController.java

@ -3,7 +3,7 @@ package com.lzbi.bi.controller;
import com.lzbi.bi.service.DcBusiDataScreenNewService; import com.lzbi.bi.service.DcBusiDataScreenNewService;
import com.lzbi.common.core.controller.BaseController; import com.lzbi.common.core.controller.BaseController;
import com.lzbi.common.core.domain.AjaxResult; import com.lzbi.common.core.domain.AjaxResult;
import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo; import com.lzbi.draft.domain.req.ReportDataReq;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -28,7 +28,7 @@ public class DcBusiDataScreenNewController extends BaseController {
* @return * @return
*/ */
@PostMapping("/userOverview") @PostMapping("/userOverview")
public AjaxResult userOverview (@RequestBody TargetDraftDaynewReqVo vo) { public AjaxResult userOverview (@RequestBody ReportDataReq vo) {
return success(dcBusiDataScreenNewService.getUserOverview(vo)); return success(dcBusiDataScreenNewService.getUserOverview(vo));
} }
@ -38,7 +38,7 @@ public class DcBusiDataScreenNewController extends BaseController {
* @return * @return
*/ */
@PostMapping("/provideAnswerWaterAverageTemperature") @PostMapping("/provideAnswerWaterAverageTemperature")
public AjaxResult provideAnswerWaterAverageTemperature(@RequestBody TargetDraftDaynewReqVo vo) { public AjaxResult provideAnswerWaterAverageTemperature(@RequestBody ReportDataReq vo) {
return success(dcBusiDataScreenNewService.getProvideAnswerWaterAverageTemperature(vo)); return success(dcBusiDataScreenNewService.getProvideAnswerWaterAverageTemperature(vo));
} }
@ -47,49 +47,49 @@ public class DcBusiDataScreenNewController extends BaseController {
* @return * @return
*/ */
@PostMapping("/boilerStatistics") @PostMapping("/boilerStatistics")
public AjaxResult boilerStatistics(@RequestBody TargetDraftDaynewReqVo vo) { public AjaxResult boilerStatistics(@RequestBody ReportDataReq vo) {
return success(dcBusiDataScreenNewService.getBoilerStatistics(vo)); return success(dcBusiDataScreenNewService.getBoilerStatistics(vo));
} }
/** /**
* 消耗 * 消耗
* @param targetDraftDaynewReqVo * @param reportDataReq
* @return * @return
*/ */
@PostMapping("/consumeStatistics") @PostMapping("/consumeStatistics")
public AjaxResult consumeStatistics(@Validated @RequestBody TargetDraftDaynewReqVo targetDraftDaynewReqVo) { public AjaxResult consumeStatistics(@Validated @RequestBody ReportDataReq reportDataReq) {
return success(dcBusiDataScreenNewService.getConsumesStatistics(targetDraftDaynewReqVo)); return success(dcBusiDataScreenNewService.getConsumesStatistics(reportDataReq));
} }
/** /**
* 发热量 * 发热量
* @param targetDraftDaynewReqVo * @param reportDataReq
* @return * @return
*/ */
@PostMapping("/calorificValue") @PostMapping("/calorificValue")
public AjaxResult calorificValue(@Validated @RequestBody TargetDraftDaynewReqVo targetDraftDaynewReqVo) { public AjaxResult calorificValue(@Validated @RequestBody ReportDataReq reportDataReq) {
return success(dcBusiDataScreenNewService.getCalorificValue(targetDraftDaynewReqVo)); return success(dcBusiDataScreenNewService.getCalorificValue(reportDataReq));
} }
/** /**
* 完成率 * 完成率
* @param targetDraftDaynewReqVo * @param reportDataReq
* @return * @return
*/ */
@PostMapping("/finishingRate") @PostMapping("/finishingRate")
public AjaxResult finishingRate(@Validated @RequestBody TargetDraftDaynewReqVo targetDraftDaynewReqVo) { public AjaxResult finishingRate(@Validated @RequestBody ReportDataReq reportDataReq) {
return success(dcBusiDataScreenNewService.getFinishingRate(targetDraftDaynewReqVo)); return success(dcBusiDataScreenNewService.getFinishingRate(reportDataReq));
} }
/** /**
* 公司统计 * 公司统计
* @param targetDraftDaynewReqVo * @param reportDataReq
* @return * @return
*/ */
@PostMapping("/corporateStatistics") @PostMapping("/corporateStatistics")
public AjaxResult corporateStatistics(@Validated @RequestBody TargetDraftDaynewReqVo targetDraftDaynewReqVo) { public AjaxResult corporateStatistics(@Validated @RequestBody ReportDataReq reportDataReq) {
return success(dcBusiDataScreenNewService.getCorporateStatistics(targetDraftDaynewReqVo)); return success(dcBusiDataScreenNewService.getCorporateStatistics(reportDataReq));
} }
} }

38
lzbi-module/src/main/java/com/lzbi/bi/mapper/DcBusiDataScreenMainMapper.java

@ -4,9 +4,14 @@ import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lzbi.bi.domain.DcBusiDataScreenDto; import com.lzbi.bi.domain.DcBusiDataScreenDto;
import com.lzbi.bi.domain.DcBusiDataScreenVo; import com.lzbi.bi.domain.DcBusiDataScreenVo;
import com.lzbi.draft.domain.dto.SomeOrgSomedayMultiReportDataDTO;
import com.lzbi.draft.domain.dto.SomeTypeChildrenOrgSomedayMultiReportDataDTO;
import com.lzbi.draft.domain.req.ReportDataReq;
import com.lzbi.draft.domain.vo.ChildrenOrgSomedaySomeReportDataVO;
import com.lzbi.draft.domain.vo.SomeOrgSomeReportYearlyDataVO;
import com.lzbi.draft.domain.vo.SomeOrgSomedaySomeReportDataVO;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
@ -26,7 +31,38 @@ public interface DcBusiDataScreenMainMapper extends BaseMapper<DcBusiDataScreenD
List<DcBusiDataScreenVo> selectSquareSelfDetail(String qdate); List<DcBusiDataScreenVo> selectSquareSelfDetail(String qdate);
List<DcBusiDataScreenVo> selectSquareGroup(String qdate); List<DcBusiDataScreenVo> selectSquareGroup(String qdate);
/**
* 查询某个组织某天的某个图表数据
* @param reportDataReq
* @return
*/
SomeOrgSomedaySomeReportDataVO selectSomeOrgSomedaySomeReportData(ReportDataReq reportDataReq);
/**
* 查询下级组织某天的某个图表数据列表
* @param reportDataReq
* @return
*/
List<ChildrenOrgSomedaySomeReportDataVO> selectChildrenOrgSomedaySomeReportDataList(ReportDataReq reportDataReq);
/**
* 查询某组织某天多图表数据列表
* @param reportDataReq
* @return
*/
List<SomeOrgSomedayMultiReportDataDTO> selectSomeOrgSomedayMultiReportDataList(ReportDataReq reportDataReq);
/**
* 查询某类型的下级组织某天的多图表数据列表
* @param reportDataReq
* @return
*/
List<SomeTypeChildrenOrgSomedayMultiReportDataDTO> selectSomeTypeChildrenOrgSomedayMultiReportDataList(ReportDataReq reportDataReq);
/**
* 查询某组织某个图表年度数据列表
* @param reportDataReq
* @return
*/
List<SomeOrgSomeReportYearlyDataVO> selectSomeOrgSomeReportYearlyDataList(ReportDataReq reportDataReq);
} }

430
lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiDataScreenMainService.java

@ -1,32 +1,26 @@
package com.lzbi.bi.service; package com.lzbi.bi.service;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lzbi.bi.domain.DcBusiDataScreenDto; import com.lzbi.bi.domain.DcBusiDataScreenDto;
import com.lzbi.bi.domain.DcBusiDataScreenVo;
import com.lzbi.bi.domain.SysDeptLocation; import com.lzbi.bi.domain.SysDeptLocation;
import com.lzbi.bi.mapper.DcBusiDataScreenMainMapper; import com.lzbi.bi.mapper.DcBusiDataScreenMainMapper;
import com.lzbi.common.constant.BizConstants; import com.lzbi.common.constant.BizConstants;
import com.lzbi.common.core.domain.entity.SysDept; import com.lzbi.common.core.domain.entity.SysDept;
import com.lzbi.common.enums.HeatingPeriodEnum;
import com.lzbi.common.enums.ReportNameEnum; import com.lzbi.common.enums.ReportNameEnum;
import com.lzbi.common.utils.StringUtils; import com.lzbi.draft.domain.dto.SomeOrgSomedayMultiReportDataDTO;
import com.lzbi.draft.domain.vo.TargetDraftDayRangeResVo; import com.lzbi.draft.domain.dto.SomeTypeChildrenOrgSomedayMultiReportDataDTO;
import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo; import com.lzbi.draft.domain.req.ReportDataReq;
import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo; import com.lzbi.draft.domain.vo.*;
import com.lzbi.draft.service.DcBusiTargetDraftDaynewService; import com.lzbi.draft.service.DcBusiTargetDraftDaynewService;
import com.lzbi.system.service.ISysDeptService; import com.lzbi.system.service.ISysDeptService;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -51,222 +45,194 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
@Resource @Resource
private DcBusiTargetDraftDaynewService dcBusiTargetDraftDaynewService; private DcBusiTargetDraftDaynewService dcBusiTargetDraftDaynewService;
public List<DcBusiDataScreenVo> selectCoalLostByDate(String qdate){ /**
return baseMapper.selectCoalLostByDate(qdate); * 查询某个组织某天的某个图表数据
* @param reportDataReq
* @return
*/
public SomeOrgSomedaySomeReportDataVO selectSomeOrgSomedaySomeReportData(ReportDataReq reportDataReq) {
this.buildReportDataReq(reportDataReq);
return baseMapper.selectSomeOrgSomedaySomeReportData(reportDataReq);
} }
public List<DcBusiDataScreenVo> selectDatainTaget(String qdate){
return baseMapper.selectDataPowerLost(qdate); /**
} * 查询下级组织某天的某个图表数据列表
public List<DcBusiDataScreenVo> selectDataPowerLost(String qdate){ * @param reportDataReq
return baseMapper.selectDataPowerLost(qdate); * @return
} */
public List<DcBusiDataScreenVo> selectDataWaterLostFirst(String qdate){ public List<ChildrenOrgSomedaySomeReportDataVO> selectChildrenOrgSomedaySomeReportDataList(ReportDataReq reportDataReq) {
return baseMapper.selectDataWaterLostFirst(qdate); this.buildChildrenOrgReportDataReq(reportDataReq);
} return baseMapper.selectChildrenOrgSomedaySomeReportDataList(reportDataReq);
public List<DcBusiDataScreenVo> selectDataWaterLostSecond(String qdate){
return baseMapper.selectDataWaterLostSecond(qdate);
}
public List<DcBusiDataScreenVo> selectDataWaterLostStationAll(String qdate){
return baseMapper.selectDataWaterLostStationAll(qdate);
} }
public JSONObject selectPowerAll(TargetDraftDaynewReqVo vo){
JSONObject ret=new JSONObject(); public List<JSONArray> selectChildrenOrgSomedaySomeReportDataEchart(ReportDataReq reportDataReq) {
List<String> reportNames = Stream.of(ReportNameEnum.TOTAL_GENERATING_CAPACITY.getName(), ReportNameEnum.TOTAL_ELECTRICITY_CONSUMPTION.getName()).collect(Collectors.toList()); List<JSONArray> result = new ArrayList<>();
vo.setAssetType("0").setAssetLevel("0").setReportNames(reportNames).setOrgIds(Stream.of(vo.getOrgId()).collect(Collectors.toList())); List<ChildrenOrgSomedaySomeReportDataVO> data = this.selectChildrenOrgSomedaySomeReportDataList(reportDataReq);
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(vo); if (!CollectionUtils.isEmpty(data)) {
if (CollUtil.isEmpty(targetDraftDaynewResVos)) { JSONArray head = new JSONArray();
return ret; JSONArray body = new JSONArray();
data.forEach(item -> {
head.add(item.getOrgName());
body.add(item.getValueResult());
});
result.add(head);
result.add(body);
} }
JSONArray list=new JSONArray(); return result;
targetDraftDaynewResVos.forEach(item->{
JSONObject jsb=new JSONObject();
jsb.put("name",item.getReportName());
jsb.put("value", item.getValueResult().toString());
jsb.put("unit",item.getTargetUnit());
list.add(jsb);
});
ret.put("source",list);
return ret;
} }
public JSONObject getSquareInfoCompany(TargetDraftDaynewReqVo vo){
JSONObject ret=new JSONObject(); public List<JSONArray> selectChildrenOrgSomedaySomeReportDataEchartStacking(ReportDataReq reportDataReq) {
List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.COMANY).build()); List<JSONArray> result = new ArrayList<>();
if (CollUtil.isEmpty(sysDepts)) { JSONArray head = new JSONArray();
return ret; head.add("product");
} head.add("实际");
List<String> reportNames = Stream.of(ReportNameEnum.OPENING_AREA.getName(), ReportNameEnum.HEATING_AREA.getName()).collect(Collectors.toList()); head.add("指标");
List<Long> orgIds = sysDepts.stream().map(SysDept::getDeptId).distinct().collect(Collectors.toList()); result.add(head);
vo.setAssetType("0").setAssetLevel("10").setReportNames(reportNames).setOrgIds(orgIds); List<ChildrenOrgSomedaySomeReportDataVO> data = this.selectChildrenOrgSomedaySomeReportDataList(reportDataReq);
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(vo); if (!CollectionUtils.isEmpty(data)) {
if (CollUtil.isEmpty(targetDraftDaynewResVos)) { data.forEach(item -> {
return ret; JSONArray body = new JSONArray();
} body.add(item.getOrgName());
JSONArray product=new JSONArray(); body.add(item.getValueResult());
JSONArray realcost=new JSONArray(); body.add(item.getValuePlan());
JSONArray realcost_2=new JSONArray(); result.add(body);
product.add("real_name"); });
realcost.add(ReportNameEnum.OPENING_AREA.getName());
realcost_2.add(ReportNameEnum.HEATING_AREA.getName());
targetDraftDaynewResVos.stream().collect(Collectors.toList()).sort(Comparator.comparing(TargetDraftDaynewResVo::getOrganizeName));
product.addAll(targetDraftDaynewResVos.stream().map(TargetDraftDaynewResVo::getOrganizeName).distinct().collect(Collectors.toList()));
for (int i = 1; i < product.size(); i++) {
int finalI = i;
realcost.add(targetDraftDaynewResVos.stream().filter(t->ReportNameEnum.OPENING_AREA.getName().equals(t.getReportName())&&t.getOrganizeName().equals(product.get(finalI))).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult());
realcost_2.add(targetDraftDaynewResVos.stream().filter(t->ReportNameEnum.HEATING_AREA.getName().equals(t.getReportName())&&t.getOrganizeName().equals(product.get(finalI))).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult());
} }
JSONArray list=new JSONArray(); return result;
list.add(product);
list.add(realcost);
list.add(realcost_2);
ret.put("source",list);
ret.put("unit",targetDraftDaynewResVos.get(0).getTargetUnit());
ret.put("concatSquare",targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.OPENING_AREA.getName().equals(x.getReportName())).map(TargetDraftDaynewResVo::getValueResult).reduce(BigDecimal.ZERO,BigDecimal::add));
ret.put("realSquare",targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.HEATING_AREA.getName().equals(x.getReportName())).map(TargetDraftDaynewResVo::getValueResult).reduce(BigDecimal.ZERO,BigDecimal::add));
return ret;
} }
public JSONObject getSquareInfoGroup(TargetDraftDaynewReqVo vo){ /**
JSONObject ret=new JSONObject(); * 查询某组织某天多图表数据列表
List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.COMANY).build()); * @param reportDataReq
if (CollUtil.isEmpty(sysDepts)) { * @return
return ret; */
public List<SomeOrgSomedayMultiReportDataVO> selectSomeOrgSomedayMultiReportDataList(ReportDataReq reportDataReq) {
List<SomeOrgSomedayMultiReportDataDTO> someOrgSomedayMultiReportDataDTOS = this.selectSomeOrgSomedayMultiReportDataDTOList(reportDataReq);
if (!CollectionUtils.isEmpty(someOrgSomedayMultiReportDataDTOS)) {
return JSONArray.parseArray(JSONArray.toJSONString(someOrgSomedayMultiReportDataDTOS), SomeOrgSomedayMultiReportDataVO.class);
} }
List<String> reportNames = Stream.of(ReportNameEnum.OPENING_AREA.getName(), ReportNameEnum.HEATING_AREA.getName()).collect(Collectors.toList()); return new ArrayList<>();
List<Long> orgIds = sysDepts.stream().map(SysDept::getDeptId).distinct().collect(Collectors.toList());
vo.setAssetType("0").setAssetLevel("10").setReportNames(reportNames).setOrgIds(orgIds);
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(vo);
if (CollUtil.isEmpty(targetDraftDaynewResVos)) {
return ret;
}
JSONArray inCircle=new JSONArray();
JSONArray outCircle=new JSONArray();
targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.OPENING_AREA.getName().equals(x.getReportName())).forEach(x->{
JSONObject jo = new JSONObject();
jo.put("name", x.getOrganizeName());
jo.put("unit", x.getTargetUnit());
jo.put("value", x.getValueResult());
inCircle.add(jo);
});
targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.HEATING_AREA.getName().equals(x.getReportName())).forEach(x->{
JSONObject jo = new JSONObject();
jo.put("name", x.getOrganizeName());
jo.put("unit", x.getTargetUnit());
jo.put("value", x.getValueResult());
outCircle.add(jo);
});;
ret.put("inCircle",inCircle);
ret.put("outCircle",outCircle);
JSONObject allJo=new JSONObject();
allJo.put("unit",targetDraftDaynewResVos.get(0).getTargetUnit());
allJo.put("concatSquare",targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.OPENING_AREA.getName().equals(x.getReportName())).map(TargetDraftDaynewResVo::getValueResult).reduce(BigDecimal.ZERO,BigDecimal::add));
allJo.put("realSquare",targetDraftDaynewResVos.stream().filter(x->ReportNameEnum.HEATING_AREA.getName().equals(x.getReportName())).map(TargetDraftDaynewResVo::getValueResult).reduce(BigDecimal.ZERO,BigDecimal::add));
ret.put("all", allJo);
return ret;
} }
public JSONObject getCoalLostRate(TargetDraftDaynewReqVo vo){ public List<JSONArray> selectChildrenOrgSomedayMultiReportDataBar(ReportDataReq reportDataReq) {
JSONObject ret=new JSONObject(); List<JSONArray> result = new ArrayList<>();
List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.COMANY).build()); List<String> reportNames = reportDataReq.getReportNames();
if (CollUtil.isEmpty(sysDepts)) { JSONArray head = new JSONArray();
return ret; head.add("product");
} head.addAll(reportNames);
List<String> reportNames = Stream.of(ReportNameEnum.COAL_CONSUMPTION.getName(), ReportNameEnum.COAL_CONSUMPTION_PER_UNIT.getName()).collect(Collectors.toList()); result.add(head);
List<Long> orgIds = sysDepts.stream().map(SysDept::getDeptId).distinct().collect(Collectors.toList()); this.buildChildrenOrgReportDataReq(reportDataReq);
vo.setAssetType("0").setAssetLevel("10").setReportNames(reportNames).setOrgIds(orgIds); List<SomeTypeChildrenOrgSomedayMultiReportDataDTO> data = this.selectSomeTypeChildrenOrgSomedayMultiReportDataDTOList(reportDataReq);
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(vo); if (!CollectionUtils.isEmpty(data)) {
if (CollUtil.isEmpty(targetDraftDaynewResVos)) { Map<Long, List<SomeTypeChildrenOrgSomedayMultiReportDataDTO>> orgIdGroupMap = data.stream().collect(groupingBy(SomeTypeChildrenOrgSomedayMultiReportDataDTO::getOrgId));
return ret; orgIdGroupMap.forEach((orgId, orgDataList) -> {
} JSONArray body = new JSONArray();
JSONArray product=new JSONArray(); body.add(orgDataList.get(0).getOrgName());
JSONArray realcost=new JSONArray(); Map<String, BigDecimal> reportValueMap = orgDataList.stream().collect(Collectors.toMap(SomeTypeChildrenOrgSomedayMultiReportDataDTO::getReportName, SomeTypeChildrenOrgSomedayMultiReportDataDTO::getValueResult, (v1, v2) -> v2));
JSONArray realcost_2=new JSONArray(); reportNames.forEach(reportName -> {
product.add("name"); body.add(reportValueMap.get(reportName));
realcost.add(ReportNameEnum.COAL_CONSUMPTION.getName()); });
realcost_2.add(ReportNameEnum.COAL_CONSUMPTION_PER_UNIT.getName()); result.add(body);
targetDraftDaynewResVos.stream().collect(Collectors.toList()).sort(Comparator.comparing(TargetDraftDaynewResVo::getOrganizeName)); });
product.addAll(targetDraftDaynewResVos.stream().map(TargetDraftDaynewResVo::getOrganizeName).distinct().collect(Collectors.toList()));
for (int i = 1; i < product.size(); i++) {
int finalI = i;
realcost.add(targetDraftDaynewResVos.stream().filter(t->ReportNameEnum.COAL_CONSUMPTION.getName().equals(t.getReportName())&&t.getOrganizeName().equals(product.get(finalI))).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult());
realcost_2.add(targetDraftDaynewResVos.stream().filter(t->ReportNameEnum.COAL_CONSUMPTION_PER_UNIT.getName().equals(t.getReportName())&&t.getOrganizeName().equals(product.get(finalI))).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult());
} }
JSONArray list=new JSONArray(); return result;
list.add(product);
list.add(realcost);
list.add(realcost_2);
ret.put("source",list);
ret.put("unit",targetDraftDaynewResVos.get(0).getTargetUnit());
return ret;
} }
public JSONObject getWaterInfo(TargetDraftDaynewReqVo vo){ /**
JSONObject ret=new JSONObject(); * 查询某组织某天多图表数据DTO列表
List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.COMANY).build()); * @param reportDataReq
if (CollUtil.isEmpty(sysDepts)) { * @return
return ret; */
private List<SomeOrgSomedayMultiReportDataDTO> selectSomeOrgSomedayMultiReportDataDTOList(ReportDataReq reportDataReq) {
this.buildReportDataReq(reportDataReq);
return baseMapper.selectSomeOrgSomedayMultiReportDataList(reportDataReq);
}
/**
* 查询某类型的下级组织某天的多图表数据列表
* @param reportDataReq
* @return
*/
private List<SomeTypeChildrenOrgSomedayMultiReportDataDTO> selectSomeTypeChildrenOrgSomedayMultiReportDataDTOList(ReportDataReq reportDataReq) {
return baseMapper.selectSomeTypeChildrenOrgSomedayMultiReportDataList(reportDataReq);
}
/**
* 查询某组织某个图表年度数据列表
* @param reportDataReq
* @return
*/
public List<SomeOrgSomeReportYearlyDataVO> selectSomeOrgSomeReportYearlyDataList(ReportDataReq reportDataReq) {
this.buildReportDataReq(reportDataReq);
return baseMapper.selectSomeOrgSomeReportYearlyDataList(reportDataReq);
}
/**
* 构建统计单元级别和类型
* @param reportDataReq
*/
private void buildReportDataReq(ReportDataReq reportDataReq) {
Long orgId = reportDataReq.getOrgId();
if (orgId == null) {
return;
} }
List<String> reportNames = Stream.of(ReportNameEnum.FIRST_NETWORK_WATER_CONSUMPTION_RATE.getName(), ReportNameEnum.SECOND_NETWORK_WATER_CONSUMPTION_RATE.getName(), SysDept sysDept = iSysDeptService.selectDeptById(orgId);
ReportNameEnum.PRIMARY_NET_RECHARGE_WATER.getName(), ReportNameEnum.DATANG_PRIMARY_NET_RECHARGE_WATER.getName(), ReportNameEnum.WATER_CONSUMPTION_OF_SECONDARY_NETWORK.getName()).collect(Collectors.toList()); if (null != sysDept) {
List<Long> orgIds = sysDepts.stream().map(SysDept::getDeptId).distinct().collect(Collectors.toList()); String orgType = sysDept.getOrgType();
vo.setAssetType("0").setAssetLevel("10").setReportNames(reportNames).setOrgIds(orgIds); switch (orgType) {
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(vo); case BizConstants.DcDeptAttr.BLOC:
if (CollUtil.isEmpty(targetDraftDaynewResVos)) { reportDataReq.setAssetLevel("0");
return ret; reportDataReq.setAssetType("0");
break;
case BizConstants.DcDeptAttr.COMANY:
reportDataReq.setAssetLevel("10");
reportDataReq.setAssetType("0");
break;
case BizConstants.DcDeptAttr.HEAT_SOURCE:
reportDataReq.setAssetLevel("20");
reportDataReq.setAssetType("0");
break;
default:
break;
}
} }
JSONArray list=new JSONArray();
targetDraftDaynewResVos.stream().collect(groupingBy(TargetDraftDaynewResVo::getOrganizeName)).entrySet().forEach(entry->{
JSONObject jo = new JSONObject();
jo.put("name", entry.getKey());
jo.put("field1", entry.getValue().stream().filter(x -> x.getReportName().equals(ReportNameEnum.FIRST_NETWORK_WATER_CONSUMPTION_RATE.getName())).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult());
jo.put("field2", entry.getValue().stream().filter(x -> x.getReportName().equals(ReportNameEnum.SECOND_NETWORK_WATER_CONSUMPTION_RATE.getName())).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult());
BigDecimal primary_net_recharge_water_value = entry.getValue().stream().filter(x -> x.getReportName().equals(ReportNameEnum.PRIMARY_NET_RECHARGE_WATER.getName())).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult();
BigDecimal datang_primary_net_recharge_water_value = entry.getValue().stream().filter(x -> x.getReportName().equals(ReportNameEnum.PRIMARY_NET_RECHARGE_WATER.getName())).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult();
primary_net_recharge_water_value = ObjUtil.isNotEmpty(primary_net_recharge_water_value)?primary_net_recharge_water_value:BigDecimal.ZERO;
datang_primary_net_recharge_water_value = ObjUtil.isNotEmpty(datang_primary_net_recharge_water_value)?datang_primary_net_recharge_water_value:BigDecimal.ZERO;
jo.put("field3", primary_net_recharge_water_value.add(datang_primary_net_recharge_water_value));
jo.put("field4", entry.getValue().stream().filter(x -> x.getReportName().equals(ReportNameEnum.WATER_CONSUMPTION_OF_SECONDARY_NETWORK.getName())).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult());
list.add(jo);
});
ret.put("source",list);
return ret;
} }
public JSONObject getPowerLostRate(TargetDraftDaynewReqVo vo){ /**
JSONObject ret=new JSONObject(); * 构建下级组织的统计单元级别和类型
List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.COMANY).build()); * @param reportDataReq
if (CollUtil.isEmpty(sysDepts)) { */
return ret; private void buildChildrenOrgReportDataReq(ReportDataReq reportDataReq) {
} Long orgId = reportDataReq.getOrgId();
List<String> reportNames = Stream.of(ReportNameEnum.POWER_CONSUMPTION_RATE_OF_HEAT_SOURCE_PLANT.getName(), ReportNameEnum.TOTAL_ELECTRICITY_CONSUMPTION.getName()).collect(Collectors.toList()); if (orgId == null) {
List<Long> orgIds = sysDepts.stream().map(SysDept::getDeptId).distinct().collect(Collectors.toList()); return;
vo.setAssetType("0").setAssetLevel("10").setReportNames(reportNames).setOrgIds(orgIds);
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(vo);
if (CollUtil.isEmpty(targetDraftDaynewResVos)) {
return ret;
} }
JSONArray product=new JSONArray(); SysDept sysDept = iSysDeptService.selectDeptById(orgId);
JSONArray realcost=new JSONArray(); if (null != sysDept) {
JSONArray realcost_2=new JSONArray(); switch (sysDept.getOrgType()) {
product.add("name"); case BizConstants.DcDeptAttr.BLOC:
realcost.add(ReportNameEnum.POWER_CONSUMPTION_RATE_OF_HEAT_SOURCE_PLANT.getName()); reportDataReq.setAssetLevel("10");
realcost_2.add(ReportNameEnum.TOTAL_ELECTRICITY_CONSUMPTION.getName()); reportDataReq.setAssetType("0");
targetDraftDaynewResVos.stream().collect(Collectors.toList()).sort(Comparator.comparing(TargetDraftDaynewResVo::getOrganizeName)); reportDataReq.setOrgType(BizConstants.DcDeptAttr.COMANY);
product.addAll(targetDraftDaynewResVos.stream().map(TargetDraftDaynewResVo::getOrganizeName).distinct().collect(Collectors.toList())); break;
for (int i = 1; i < product.size(); i++) { case BizConstants.DcDeptAttr.COMANY:
int finalI = i; reportDataReq.setAssetLevel("20");
realcost.add(targetDraftDaynewResVos.stream().filter(t->ReportNameEnum.POWER_CONSUMPTION_RATE_OF_HEAT_SOURCE_PLANT.getName().equals(t.getReportName())&&t.getOrganizeName().equals(product.get(finalI))).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult()); reportDataReq.setAssetType("0");
realcost_2.add(targetDraftDaynewResVos.stream().filter(t->ReportNameEnum.TOTAL_ELECTRICITY_CONSUMPTION.getName().equals(t.getReportName())&&t.getOrganizeName().equals(product.get(finalI))).findFirst().orElse(new TargetDraftDaynewResVo()).getValueResult()); reportDataReq.setOrgType(BizConstants.DcDeptAttr.HEAT_SOURCE);
break;
case BizConstants.DcDeptAttr.HEAT_SOURCE:
reportDataReq.setAssetLevel("30");
reportDataReq.setAssetType("0");
reportDataReq.setOrgType(BizConstants.DcDeptAttr.HEAT_SOURCE);
break;
default:
break;
}
} }
JSONArray list=new JSONArray();
list.add(product);
list.add(realcost);
list.add(realcost_2);
ret.put("source",list);
ret.put("unit",targetDraftDaynewResVos.get(0).getTargetUnit());
return ret;
} }
public JSONObject getMapInfo(TargetDraftDaynewReqVo vo){ public JSONObject getMapInfo(ReportDataReq vo){
JSONObject ret=new JSONObject(); JSONObject ret=new JSONObject();
List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.COMANY).build()); List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.COMANY).build());
if (CollUtil.isEmpty(sysDepts)) { if (CollUtil.isEmpty(sysDepts)) {
@ -305,54 +271,4 @@ public class DcBusiDataScreenMainService extends ServiceImpl<DcBusiDataScreenMai
ret.put("source", jsonArray); ret.put("source", jsonArray);
return ret; return ret;
} }
public List<DcBusiDataScreenVo> selectSquareRealDetail(String qdate) {
return baseMapper.selectSquareRealDetail(qdate);
}
public List<DcBusiDataScreenVo> selectSquareSelfDetail(String qdate){
return baseMapper.selectSquareSelfDetail(qdate);
}
public List<DcBusiDataScreenVo> selectSquareGroup(String qdate){
return baseMapper.selectSquareGroup(qdate);
}
public List<TargetDraftDayRangeResVo> getHeatingPeriodData(TargetDraftDaynewReqVo vo){
List<TargetDraftDayRangeResVo> res = Lists.newArrayList();
if (!HeatingPeriodEnum.HEATING_ALL_PERIOD.getMonths().contains(Integer.parseInt(vo.getDateMonth()))) {
return res;
}
List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.COMANY).build());
if (CollUtil.isEmpty(sysDepts)) {
return res;
}
List<Long> 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()));
List<TargetDraftDayRangeResVo> list = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewRangeList(vo);
List<SysDept> depts = sysDepts.stream().filter(x -> list.stream().map(TargetDraftDayRangeResVo::getCname).distinct().collect(Collectors.toList()).contains(x.getDeptName())).collect(Collectors.toList());
List<TargetDraftDayRangeResVo> totalList = Lists.newArrayList();
list.stream().collect(groupingBy(TargetDraftDayRangeResVo::getCdate)).entrySet().forEach(entry->{
depts.forEach(dept->{
TargetDraftDayRangeResVo dayVo = entry.getValue().stream().filter(x -> x.getCname().equals(dept.getDeptName())).findFirst().orElse(null);
if (ObjectUtil.isNull(dayVo)) {
totalList.add(TargetDraftDayRangeResVo.builder().cdate(entry.getKey()).cname(dept.getDeptName()).valueResult(BigDecimal.ZERO).build());
} else {
totalList.add(dayVo);
}
});
});
totalList.stream().collect(groupingBy(TargetDraftDayRangeResVo::getCdate)).entrySet().forEach(entry->{
res.add(TargetDraftDayRangeResVo.builder().cdate(entry.getKey())
.cut(CollectionUtil.join(entry.getValue().stream().map(TargetDraftDayRangeResVo::getValueResult).collect(Collectors.toList()), ","))
.cname(CollectionUtil.join(entry.getValue().stream().map(TargetDraftDayRangeResVo::getCname).collect(Collectors.toList()), ","))
.build());
});
res.sort(Comparator.comparing(TargetDraftDayRangeResVo::getCdate));
return res;
}
} }

66
lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiDataScreenNewService.java

@ -6,7 +6,7 @@ import com.lzbi.common.constant.BizConstants;
import com.lzbi.common.core.domain.entity.SysDept; import com.lzbi.common.core.domain.entity.SysDept;
import com.lzbi.common.enums.ReportNameEnum; import com.lzbi.common.enums.ReportNameEnum;
import com.lzbi.draft.domain.vo.TargetDraftDaynewAggregateResVo; import com.lzbi.draft.domain.vo.TargetDraftDaynewAggregateResVo;
import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo; import com.lzbi.draft.domain.req.ReportDataReq;
import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo; import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo;
import com.lzbi.draft.domain.vo.TargetDraftMonthAggregateResVo; import com.lzbi.draft.domain.vo.TargetDraftMonthAggregateResVo;
import com.lzbi.draft.mapper.DcBusiTargetDraftMonthMapper; import com.lzbi.draft.mapper.DcBusiTargetDraftMonthMapper;
@ -47,7 +47,7 @@ public class DcBusiDataScreenNewService {
@Resource @Resource
private ISysDeptService iSysDeptService; private ISysDeptService iSysDeptService;
public List<UserIOverViewVO> getUserOverview(TargetDraftDaynewReqVo vo) { public List<UserIOverViewVO> getUserOverview(ReportDataReq vo) {
List<UserIOverViewVO> list = new ArrayList<>(); List<UserIOverViewVO> list = new ArrayList<>();
List<String> reportNames = Stream.of(ReportNameEnum.OPENING_AREA.getName(), ReportNameEnum.HEATING_AREA.getName()).collect(Collectors.toList()); List<String> reportNames = Stream.of(ReportNameEnum.OPENING_AREA.getName(), ReportNameEnum.HEATING_AREA.getName()).collect(Collectors.toList());
vo.setAssetType("0").setAssetLevel("10").setReportNames(reportNames).setOrgIds(Stream.of(vo.getOrgId()).collect(Collectors.toList())); vo.setAssetType("0").setAssetLevel("10").setReportNames(reportNames).setOrgIds(Stream.of(vo.getOrgId()).collect(Collectors.toList()));
@ -63,7 +63,7 @@ public class DcBusiDataScreenNewService {
return list; return list;
} }
public ProvideAnswerWaterAverageTemperatureVO getProvideAnswerWaterAverageTemperature(TargetDraftDaynewReqVo vo) { public ProvideAnswerWaterAverageTemperatureVO getProvideAnswerWaterAverageTemperature(ReportDataReq vo) {
ProvideAnswerWaterAverageTemperatureVO resVO = new ProvideAnswerWaterAverageTemperatureVO(); ProvideAnswerWaterAverageTemperatureVO resVO = new ProvideAnswerWaterAverageTemperatureVO();
List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.HEAT_SOURCE).build()); List<SysDept> sysDepts = iSysDeptService.selecttList(SysDept.builder().parentId(vo.getOrgId()).orgType(BizConstants.DcDeptAttr.HEAT_SOURCE).build());
if (CollUtil.isEmpty(sysDepts)) { if (CollUtil.isEmpty(sysDepts)) {
@ -90,7 +90,7 @@ public class DcBusiDataScreenNewService {
return resVO; return resVO;
} }
public List<BoilerStatisticsVO> getBoilerStatistics(TargetDraftDaynewReqVo vo) { public List<BoilerStatisticsVO> getBoilerStatistics(ReportDataReq vo) {
List<BoilerStatisticsVO> list = new ArrayList<>(); List<BoilerStatisticsVO> list = new ArrayList<>();
List<String> reportNames = Stream.of(ReportNameEnum.NUMBER_OF_STEAM_FURNACES_IN_OPERATION.getName(), ReportNameEnum.NUMBER_OF_WATER_FURNACES_IN_OPERATION.getName()).collect(Collectors.toList()); List<String> reportNames = Stream.of(ReportNameEnum.NUMBER_OF_STEAM_FURNACES_IN_OPERATION.getName(), ReportNameEnum.NUMBER_OF_WATER_FURNACES_IN_OPERATION.getName()).collect(Collectors.toList());
vo.setAssetType("0").setAssetLevel("10").setReportNames(reportNames).setOrgIds(Stream.of(vo.getOrgId()).collect(Collectors.toList())); vo.setAssetType("0").setAssetLevel("10").setReportNames(reportNames).setOrgIds(Stream.of(vo.getOrgId()).collect(Collectors.toList()));
@ -109,10 +109,10 @@ public class DcBusiDataScreenNewService {
return list; return list;
} }
public List<ConsumesStatisticsVO> getConsumesStatistics(TargetDraftDaynewReqVo targetDraftDaynewReqVo) { public List<ConsumesStatisticsVO> getConsumesStatistics(ReportDataReq reportDataReq) {
List<ConsumesStatisticsVO> list = new ArrayList<>(); List<ConsumesStatisticsVO> list = new ArrayList<>();
SysDept deptParams = new SysDept(); SysDept deptParams = new SysDept();
deptParams.setParentId(targetDraftDaynewReqVo.getOrgId()); deptParams.setParentId(reportDataReq.getOrgId());
deptParams.setOrgType(BizConstants.DcDeptAttr.HEAT_SOURCE); deptParams.setOrgType(BizConstants.DcDeptAttr.HEAT_SOURCE);
List<SysDept> childrenDept = iSysDeptService.selecttList(deptParams); List<SysDept> childrenDept = iSysDeptService.selecttList(deptParams);
if (CollectionUtils.isEmpty(childrenDept)) { if (CollectionUtils.isEmpty(childrenDept)) {
@ -124,11 +124,11 @@ public class DcBusiDataScreenNewService {
names.add(ReportNameEnum.DATANG_PRIMARY_NET_RECHARGE_WATER.getName()); names.add(ReportNameEnum.DATANG_PRIMARY_NET_RECHARGE_WATER.getName());
names.add(ReportNameEnum.TOTAL_ELECTRICITY_CONSUMPTION.getName()); names.add(ReportNameEnum.TOTAL_ELECTRICITY_CONSUMPTION.getName());
names.add(ReportNameEnum.COAL_CONSUMPTION.getName()); names.add(ReportNameEnum.COAL_CONSUMPTION.getName());
targetDraftDaynewReqVo.setReportNames(names); reportDataReq.setReportNames(names);
targetDraftDaynewReqVo.setAssetLevel(BizConstants.DcAssetLevel.HEAT_SOURCE); reportDataReq.setAssetLevel(BizConstants.DcAssetLevel.HEAT_SOURCE);
targetDraftDaynewReqVo.setAssetType(BizConstants.DcAssetType.REPORT); reportDataReq.setAssetType(BizConstants.DcAssetType.REPORT);
targetDraftDaynewReqVo.setOrgIds(orgIds); reportDataReq.setOrgIds(orgIds);
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(targetDraftDaynewReqVo); List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(reportDataReq);
if (CollectionUtils.isNotEmpty(targetDraftDaynewResVos)) { if (CollectionUtils.isNotEmpty(targetDraftDaynewResVos)) {
Map<String, List<TargetDraftDaynewResVo>> orgNameMap = targetDraftDaynewResVos.stream().collect(Collectors.groupingBy(TargetDraftDaynewResVo::getOrganizeName)); Map<String, List<TargetDraftDaynewResVo>> orgNameMap = targetDraftDaynewResVos.stream().collect(Collectors.groupingBy(TargetDraftDaynewResVo::getOrganizeName));
orgNameMap.forEach((orgName, targetDraftDaynewResVoList) -> { orgNameMap.forEach((orgName, targetDraftDaynewResVoList) -> {
@ -155,10 +155,10 @@ public class DcBusiDataScreenNewService {
return list; return list;
} }
public List<CalorificValueVO> getCalorificValue(TargetDraftDaynewReqVo targetDraftDaynewReqVo) { public List<CalorificValueVO> getCalorificValue(ReportDataReq reportDataReq) {
List<CalorificValueVO> list = new ArrayList<>(); List<CalorificValueVO> list = new ArrayList<>();
SysDept deptParams = new SysDept(); SysDept deptParams = new SysDept();
deptParams.setParentId(targetDraftDaynewReqVo.getOrgId()); deptParams.setParentId(reportDataReq.getOrgId());
deptParams.setOrgType(BizConstants.DcDeptAttr.HEAT_SOURCE); deptParams.setOrgType(BizConstants.DcDeptAttr.HEAT_SOURCE);
List<SysDept> childrenDept = iSysDeptService.selecttList(deptParams); List<SysDept> childrenDept = iSysDeptService.selecttList(deptParams);
if (CollectionUtils.isEmpty(childrenDept)) { if (CollectionUtils.isEmpty(childrenDept)) {
@ -167,11 +167,11 @@ public class DcBusiDataScreenNewService {
List<Long> orgIds = childrenDept.stream().map(SysDept::getDeptId).collect(Collectors.toList()); List<Long> orgIds = childrenDept.stream().map(SysDept::getDeptId).collect(Collectors.toList());
List<String> names = new ArrayList<>(); List<String> names = new ArrayList<>();
names.add(ReportNameEnum.TOTAL_HEAT_PRODUCTION.getName()); names.add(ReportNameEnum.TOTAL_HEAT_PRODUCTION.getName());
targetDraftDaynewReqVo.setReportNames(names); reportDataReq.setReportNames(names);
targetDraftDaynewReqVo.setAssetLevel(BizConstants.DcAssetLevel.HEAT_SOURCE); reportDataReq.setAssetLevel(BizConstants.DcAssetLevel.HEAT_SOURCE);
targetDraftDaynewReqVo.setAssetType(BizConstants.DcAssetType.REPORT); reportDataReq.setAssetType(BizConstants.DcAssetType.REPORT);
targetDraftDaynewReqVo.setOrgIds(orgIds); reportDataReq.setOrgIds(orgIds);
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(targetDraftDaynewReqVo); List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(reportDataReq);
if (CollectionUtils.isNotEmpty(targetDraftDaynewResVos)) { if (CollectionUtils.isNotEmpty(targetDraftDaynewResVos)) {
final BigDecimal[] sum = {new BigDecimal(0)}; final BigDecimal[] sum = {new BigDecimal(0)};
targetDraftDaynewResVos.stream().forEach(item -> sum[0] = sum[0].add(item.getValueResult())); targetDraftDaynewResVos.stream().forEach(item -> sum[0] = sum[0].add(item.getValueResult()));
@ -197,7 +197,7 @@ public class DcBusiDataScreenNewService {
return list; return list;
} }
public FinishingRate getFinishingRate(TargetDraftDaynewReqVo targetDraftDaynewReqVo) { public FinishingRate getFinishingRate(ReportDataReq reportDataReq) {
FinishingRate finishingRate = new FinishingRate(); FinishingRate finishingRate = new FinishingRate();
List<String> names = new ArrayList<>(); List<String> names = new ArrayList<>();
names.add(ReportNameEnum.FIRST_NETWORK_WATER_CONSUMPTION_RATE.getName()); names.add(ReportNameEnum.FIRST_NETWORK_WATER_CONSUMPTION_RATE.getName());
@ -205,18 +205,18 @@ public class DcBusiDataScreenNewService {
names.add(ReportNameEnum.POWER_CONSUMPTION_RATE_OF_HEAT_SOURCE_PLANT.getName()); names.add(ReportNameEnum.POWER_CONSUMPTION_RATE_OF_HEAT_SOURCE_PLANT.getName());
names.add(ReportNameEnum.SECOND_NETWORK_ELECTRICITY_CONSUMPTION_RATE.getName()); names.add(ReportNameEnum.SECOND_NETWORK_ELECTRICITY_CONSUMPTION_RATE.getName());
names.add(ReportNameEnum.COAL_CONSUMPTION_PER_UNIT.getName()); names.add(ReportNameEnum.COAL_CONSUMPTION_PER_UNIT.getName());
targetDraftDaynewReqVo.setReportNames(names); reportDataReq.setReportNames(names);
targetDraftDaynewReqVo.setAssetLevel(BizConstants.DcAssetLevel.COMPANY); reportDataReq.setAssetLevel(BizConstants.DcAssetLevel.COMPANY);
targetDraftDaynewReqVo.setAssetType(BizConstants.DcAssetType.REPORT); reportDataReq.setAssetType(BizConstants.DcAssetType.REPORT);
List<Long> orgIds = new ArrayList<>(); List<Long> orgIds = new ArrayList<>();
orgIds.add(targetDraftDaynewReqVo.getOrgId()); orgIds.add(reportDataReq.getOrgId());
targetDraftDaynewReqVo.setOrgIds(orgIds); reportDataReq.setOrgIds(orgIds);
List<TargetDraftDaynewAggregateResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewAggregateList(targetDraftDaynewReqVo); List<TargetDraftDaynewAggregateResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewAggregateList(reportDataReq);
if (CollectionUtils.isEmpty(targetDraftDaynewResVos)) { if (CollectionUtils.isEmpty(targetDraftDaynewResVos)) {
log.error("日底稿无数据"); log.error("日底稿无数据");
throw new RuntimeException("无数据"); throw new RuntimeException("无数据");
} }
List<TargetDraftMonthAggregateResVo> targetDraftMonthAggregateResVos = dcBusiTargetDraftMonthMapper.selectDcBusiTargetDraftMontAggregateList(targetDraftDaynewReqVo); List<TargetDraftMonthAggregateResVo> targetDraftMonthAggregateResVos = dcBusiTargetDraftMonthMapper.selectDcBusiTargetDraftMontAggregateList(reportDataReq);
if (CollectionUtils.isEmpty(targetDraftMonthAggregateResVos)) { if (CollectionUtils.isEmpty(targetDraftMonthAggregateResVos)) {
log.error("月底稿无数据"); log.error("月底稿无数据");
throw new RuntimeException("无数据"); throw new RuntimeException("无数据");
@ -240,20 +240,20 @@ public class DcBusiDataScreenNewService {
return finishingRate; return finishingRate;
} }
public CorporateStatisticsVO getCorporateStatistics(TargetDraftDaynewReqVo targetDraftDaynewReqVo) { public CorporateStatisticsVO getCorporateStatistics(ReportDataReq reportDataReq) {
CorporateStatisticsVO corporateStatisticsVO = new CorporateStatisticsVO(); CorporateStatisticsVO corporateStatisticsVO = new CorporateStatisticsVO();
List<String> names = new ArrayList<>(); List<String> names = new ArrayList<>();
names.add(ReportNameEnum.HEATING_AREA.getName()); names.add(ReportNameEnum.HEATING_AREA.getName());
names.add(ReportNameEnum.TOTAL_GENERATING_CAPACITY.getName()); names.add(ReportNameEnum.TOTAL_GENERATING_CAPACITY.getName());
names.add(ReportNameEnum.TOTAL_HEAT_PRODUCTION.getName()); names.add(ReportNameEnum.TOTAL_HEAT_PRODUCTION.getName());
names.add(ReportNameEnum.TOTAL_HEAT_SUPPLIED.getName()); names.add(ReportNameEnum.TOTAL_HEAT_SUPPLIED.getName());
targetDraftDaynewReqVo.setReportNames(names); reportDataReq.setReportNames(names);
targetDraftDaynewReqVo.setAssetLevel(BizConstants.DcAssetLevel.COMPANY); reportDataReq.setAssetLevel(BizConstants.DcAssetLevel.COMPANY);
targetDraftDaynewReqVo.setAssetType(BizConstants.DcAssetType.REPORT); reportDataReq.setAssetType(BizConstants.DcAssetType.REPORT);
List<Long> orgIds = new ArrayList<>(); List<Long> orgIds = new ArrayList<>();
orgIds.add(targetDraftDaynewReqVo.getOrgId()); orgIds.add(reportDataReq.getOrgId());
targetDraftDaynewReqVo.setOrgIds(orgIds); reportDataReq.setOrgIds(orgIds);
List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(targetDraftDaynewReqVo); List<TargetDraftDaynewResVo> targetDraftDaynewResVos = dcBusiTargetDraftDaynewService.selectTargetDraftDaynewList(reportDataReq);
if (CollectionUtils.isNotEmpty(targetDraftDaynewResVos)) { if (CollectionUtils.isNotEmpty(targetDraftDaynewResVos)) {
Map<String, BigDecimal> reportMap = targetDraftDaynewResVos.stream().collect(Collectors.toMap(TargetDraftDaynewResVo::getReportName, TargetDraftDaynewResVo::getValueResult)); Map<String, BigDecimal> reportMap = targetDraftDaynewResVos.stream().collect(Collectors.toMap(TargetDraftDaynewResVo::getReportName, TargetDraftDaynewResVo::getValueResult));
corporateStatisticsVO.setAcreage(reportMap.get(ReportNameEnum.HEATING_AREA.getName())); corporateStatisticsVO.setAcreage(reportMap.get(ReportNameEnum.HEATING_AREA.getName()));

2
lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiParamDraftDay.java

@ -59,7 +59,7 @@ public class DcBusiParamDraftDay extends BaseModuleEntity
private String targetUint; private String targetUint;
/** 统计日期[ */ /** 统计日期[ */
@Excel(name = "统计日期[") @Excel(name = "统计日期")
private String countDate; private String countDate;
/** 均值 */ /** 均值 */

24
lzbi-module/src/main/java/com/lzbi/draft/domain/dto/SomeOrgSomedayMultiReportDataDTO.java

@ -0,0 +1,24 @@
package com.lzbi.draft.domain.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* 某组织某天多图表数据
*/
@Data
public class SomeOrgSomedayMultiReportDataDTO {
/**
* 图表名称
*/
private String reportName;
/**
* 结果值
*/
private BigDecimal valueResult;
/**
* 计划值
*/
private BigDecimal valuePlan;
}

33
lzbi-module/src/main/java/com/lzbi/draft/domain/dto/SomeTypeChildrenOrgSomedayMultiReportDataDTO.java

@ -0,0 +1,33 @@
package com.lzbi.draft.domain.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* 某类型的下级组织某天的多图表数据
*/
@Data
public class SomeTypeChildrenOrgSomedayMultiReportDataDTO {
/**
* 下级组织id
*/
private Long orgId;
/**
* 下级组织名称
*/
private String orgName;
/**
* 图表名称
*/
private String reportName;
/**
* 结果值
*/
private BigDecimal valueResult;
/**
* 计划值
*/
private BigDecimal valuePlan;
}

8
lzbi-module/src/main/java/com/lzbi/draft/domain/vo/TargetDraftDaynewReqVo.java → lzbi-module/src/main/java/com/lzbi/draft/domain/req/ReportDataReq.java

@ -1,4 +1,4 @@
package com.lzbi.draft.domain.vo; package com.lzbi.draft.domain.req;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
@ -14,10 +14,12 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
public class TargetDraftDaynewReqVo { public class ReportDataReq {
private List<String> reportNames; private List<String> reportNames;
private String reportName;
@NotNull @NotNull
private String dateYear; private String dateYear;
@ -40,4 +42,6 @@ public class TargetDraftDaynewReqVo {
private String endDate; private String endDate;
private String orgType;
} }

29
lzbi-module/src/main/java/com/lzbi/draft/domain/vo/ChildrenOrgSomedaySomeReportDataVO.java

@ -0,0 +1,29 @@
package com.lzbi.draft.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* 下级组织某日某图表数据
*/
@Data
public class ChildrenOrgSomedaySomeReportDataVO {
/**
* 下级组织id
*/
private Long orgId;
/**
* 下级组织名称
*/
private String orgName;
/**
* 结果值
*/
private BigDecimal valueResult;
/**
* 计划值
*/
private BigDecimal valuePlan;
}

21
lzbi-module/src/main/java/com/lzbi/draft/domain/vo/SomeOrgSomeReportYearlyDataVO.java

@ -0,0 +1,21 @@
package com.lzbi.draft.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* 某组织某报告某年度数据
*/
@Data
public class SomeOrgSomeReportYearlyDataVO {
/**
*
*/
private String dateYear;
/**
* 最大实际值
*/
private BigDecimal maxValueResult;
}

24
lzbi-module/src/main/java/com/lzbi/draft/domain/vo/SomeOrgSomedayMultiReportDataVO.java

@ -0,0 +1,24 @@
package com.lzbi.draft.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* 某组织某天多图表数据
*/
@Data
public class SomeOrgSomedayMultiReportDataVO {
/**
* 图表名称
*/
private String reportName;
/**
* 结果值
*/
private BigDecimal valueResult;
/**
* 计划值
*/
private BigDecimal valuePlan;
}

22
lzbi-module/src/main/java/com/lzbi/draft/domain/vo/SomeOrgSomedaySomeReportDataVO.java

@ -0,0 +1,22 @@
package com.lzbi.draft.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* 某个组织某天某个图表数据
*/
@Data
public class SomeOrgSomedaySomeReportDataVO {
/**
* 实际值
*/
private BigDecimal valueResult;
/**
* 计划值
*/
private BigDecimal valuePlan;
}

8
lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiParamDraftDayMapper.java

@ -35,12 +35,14 @@ public interface DcBusiParamDraftDayMapper extends BaseMapper<DcBusiParamDraftDa
/** /**
* 查询最后一天的参数底稿 * 查询最后一天的参数底稿
* @param assetCodeList * @param assetCodeList 统计单元编码列表
* @param paramsModelCode * @param paramsModelCode 参数模板编码
* @param countDate 统计日期
* @return * @return
*/ */
List<DcBusiParamDraftDay> selectLastDataByAssetCodeListAndParamsModelCode(@Param("assetCodeList") List<String> assetCodeList, List<DcBusiParamDraftDay> selectLastDataByAssetCodeListAndParamsModelCode(@Param("assetCodeList") List<String> assetCodeList,
@Param("paramsModelCode") String paramsModelCode); @Param("paramsModelCode") String paramsModelCode,
@Param("countDate") String countDate);
/** /**
* 查询参数数据底稿列表 * 查询参数数据底稿列表
* *

9
lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftDaynewMapper.java

@ -5,12 +5,11 @@ import com.lzbi.bill.domain.DcBusiTargetInputMaster;
import com.lzbi.draft.domain.DcBusiTargetDraftDaynew; import com.lzbi.draft.domain.DcBusiTargetDraftDaynew;
import com.lzbi.draft.domain.vo.TargetDraftDayRangeResVo; import com.lzbi.draft.domain.vo.TargetDraftDayRangeResVo;
import com.lzbi.draft.domain.vo.TargetDraftDaynewAggregateResVo; import com.lzbi.draft.domain.vo.TargetDraftDaynewAggregateResVo;
import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo; import com.lzbi.draft.domain.req.ReportDataReq;
import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo; import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 指标数据底稿日-新结构Mapper接口 * 指标数据底稿日-新结构Mapper接口
@ -75,9 +74,9 @@ public interface DcBusiTargetDraftDaynewMapper extends BaseMapper<DcBusiTargetDr
*/ */
public int deleteDcBusiTargetDraftDaynewByIds(String[] ids); public int deleteDcBusiTargetDraftDaynewByIds(String[] ids);
List<TargetDraftDaynewResVo> selectTargetDraftDaynewList(TargetDraftDaynewReqVo vo); List<TargetDraftDaynewResVo> selectTargetDraftDaynewList(ReportDataReq vo);
List<TargetDraftDayRangeResVo> selectTargetDraftDaynewRangeList(TargetDraftDaynewReqVo vo); List<TargetDraftDayRangeResVo> selectTargetDraftDaynewRangeList(ReportDataReq vo);
List<TargetDraftDaynewAggregateResVo> selectTargetDraftDaynewAggregateList(TargetDraftDaynewReqVo vo); List<TargetDraftDaynewAggregateResVo> selectTargetDraftDaynewAggregateList(ReportDataReq vo);
} }

6
lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftMonthMapper.java

@ -5,7 +5,7 @@ import java.util.List;
import com.lzbi.bill.domain.DcBusiTargetInputMaster; import com.lzbi.bill.domain.DcBusiTargetInputMaster;
import com.lzbi.draft.domain.DcBusiTargetDraftMonth; import com.lzbi.draft.domain.DcBusiTargetDraftMonth;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo; import com.lzbi.draft.domain.req.ReportDataReq;
import com.lzbi.draft.domain.vo.TargetDraftMonthAggregateResVo; import com.lzbi.draft.domain.vo.TargetDraftMonthAggregateResVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -36,10 +36,10 @@ public interface DcBusiTargetDraftMonthMapper extends BaseMapper<DcBusiTargetDra
/** /**
* 查询月指标累计值 * 查询月指标累计值
* @param targetDraftDaynewReqVo * @param reportDataReq
* @return * @return
*/ */
List<TargetDraftMonthAggregateResVo> selectDcBusiTargetDraftMontAggregateList(TargetDraftDaynewReqVo targetDraftDaynewReqVo); List<TargetDraftMonthAggregateResVo> selectDcBusiTargetDraftMontAggregateList(ReportDataReq reportDataReq);
/** /**
* 根据录入单查询 * 根据录入单查询

8
lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetDraftDaynewService.java

@ -6,7 +6,7 @@ import com.lzbi.common.utils.DateUtils;
import com.lzbi.draft.domain.DcBusiTargetDraftDaynew; import com.lzbi.draft.domain.DcBusiTargetDraftDaynew;
import com.lzbi.draft.domain.vo.TargetDraftDayRangeResVo; import com.lzbi.draft.domain.vo.TargetDraftDayRangeResVo;
import com.lzbi.draft.domain.vo.TargetDraftDaynewAggregateResVo; import com.lzbi.draft.domain.vo.TargetDraftDaynewAggregateResVo;
import com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo; import com.lzbi.draft.domain.req.ReportDataReq;
import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo; import com.lzbi.draft.domain.vo.TargetDraftDaynewResVo;
import com.lzbi.draft.mapper.DcBusiTargetDraftDaynewMapper; import com.lzbi.draft.mapper.DcBusiTargetDraftDaynewMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -94,15 +94,15 @@ public class DcBusiTargetDraftDaynewService extends ServiceImpl<DcBusiTargetDraf
return baseMapper.deleteDcBusiTargetDraftDaynewById(id); return baseMapper.deleteDcBusiTargetDraftDaynewById(id);
} }
public List<TargetDraftDaynewResVo> selectTargetDraftDaynewList(TargetDraftDaynewReqVo vo){ public List<TargetDraftDaynewResVo> selectTargetDraftDaynewList(ReportDataReq vo){
return baseMapper.selectTargetDraftDaynewList(vo); return baseMapper.selectTargetDraftDaynewList(vo);
} }
public List<TargetDraftDayRangeResVo> selectTargetDraftDaynewRangeList(TargetDraftDaynewReqVo vo){ public List<TargetDraftDayRangeResVo> selectTargetDraftDaynewRangeList(ReportDataReq vo){
return baseMapper.selectTargetDraftDaynewRangeList(vo); return baseMapper.selectTargetDraftDaynewRangeList(vo);
} }
public List<TargetDraftDaynewAggregateResVo> selectTargetDraftDaynewAggregateList(TargetDraftDaynewReqVo vo){ public List<TargetDraftDaynewAggregateResVo> selectTargetDraftDaynewAggregateList(ReportDataReq vo){
return baseMapper.selectTargetDraftDaynewAggregateList(vo); return baseMapper.selectTargetDraftDaynewAggregateList(vo);
} }
} }

18
lzbi-module/src/main/java/com/lzbi/external/service/ParamsService.java

@ -1,6 +1,7 @@
package com.lzbi.external.service; package com.lzbi.external.service;
import com.lzbi.common.constant.ParamsModelCodeConstants; import com.lzbi.common.constant.ParamsModelCodeConstants;
import com.lzbi.common.utils.StringUtils;
import com.lzbi.draft.domain.DcBusiParamDraftDay; import com.lzbi.draft.domain.DcBusiParamDraftDay;
import com.lzbi.draft.mapper.DcBusiParamDraftDayMapper; import com.lzbi.draft.mapper.DcBusiParamDraftDayMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -27,7 +28,22 @@ public class ParamsService {
if (CollectionUtils.isEmpty(assetCodeList)) { if (CollectionUtils.isEmpty(assetCodeList)) {
throw new RuntimeException("资产编码列表不能为空"); throw new RuntimeException("资产编码列表不能为空");
} }
List<DcBusiParamDraftDay> list = dcBusiParamDraftDayMapper.selectLastDataByAssetCodeListAndParamsModelCode(assetCodeList, ParamsModelCodeConstants.供暖面积); List<DcBusiParamDraftDay> list = dcBusiParamDraftDayMapper.selectLastDataByAssetCodeListAndParamsModelCode(assetCodeList, ParamsModelCodeConstants.供暖面积, null);
if (CollectionUtils.isEmpty(list)) {
log.warn("暂无数据");
return new HashMap<>();
}
return list.stream().collect(Collectors.toMap(DcBusiParamDraftDay::getAssetCode, DcBusiParamDraftDay::getValLast));
}
public Map<String, Double> getMultipleAssetSupplyArea(List<String> assetCodeList, String countDate) {
if (CollectionUtils.isEmpty(assetCodeList)) {
throw new RuntimeException("资产编码列表不能为空");
}
if (StringUtils.isBlank(countDate)) {
throw new RuntimeException("统计日期不能为空");
}
List<DcBusiParamDraftDay> list = dcBusiParamDraftDayMapper.selectLastDataByAssetCodeListAndParamsModelCode(assetCodeList, ParamsModelCodeConstants.供暖面积, countDate);
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
log.warn("暂无数据"); log.warn("暂无数据");
return new HashMap<>(); return new HashMap<>();

2
lzbi-module/src/main/java/com/lzbi/report/service/AjReportService.java

@ -175,7 +175,7 @@ public class AjReportService {
Map<String, List<ReportDTO>> reportDataMap = reportDataList.stream().collect(Collectors.groupingBy(item -> StringUtils.join(item.getAssetCode(), "-", item.getPartition()))); Map<String, List<ReportDTO>> reportDataMap = reportDataList.stream().collect(Collectors.groupingBy(item -> StringUtils.join(item.getAssetCode(), "-", item.getPartition())));
List<String> assetCodeList = reportDataList.stream().map(ReportDTO::getAssetCode).collect(Collectors.toList()); List<String> assetCodeList = reportDataList.stream().map(ReportDTO::getAssetCode).collect(Collectors.toList());
// 获取供热面积 // 获取供热面积
Map<String, Double> multipleAssetSupplyArea = paramsService.getMultipleAssetSupplyArea(assetCodeList); Map<String, Double> multipleAssetSupplyArea = paramsService.getMultipleAssetSupplyArea(assetCodeList, reportQuery.getCountDate());
assetAndPartitionList.forEach(assetAndPartition -> { assetAndPartitionList.forEach(assetAndPartition -> {
if (reportDataMap.containsKey(assetAndPartition)) { if (reportDataMap.containsKey(assetAndPartition)) {
Map<String, Object> reportVO = new HashMap<>(); Map<String, Object> reportVO = new HashMap<>();

123
lzbi-module/src/main/resources/mapper/DcBusiDataScreenMainMapper.xml

@ -313,4 +313,127 @@
and target_name in ('供暖面积-自管开栓面积', '实际自管供热面积') and target_name in ('供暖面积-自管开栓面积', '实际自管供热面积')
group by count_date, target_unit group by count_date, target_unit
</select> </select>
<select id="selectSomeOrgSomedaySomeReportData"
parameterType="com.lzbi.draft.domain.req.ReportDataReq"
resultType="com.lzbi.draft.domain.vo.SomeOrgSomedaySomeReportDataVO">
SELECT
t1.value_result,
t1.value_plan
FROM
dc_busi_target_draft_daynew t1
INNER JOIN dc_base_asset_target t2 ON t1.target_code = t2.target_code
INNER JOIN dc_busi_report_target_config t3 ON t2.target_model_code = t3.target_model_code
AND t3.report_name = #{reportName}
INNER JOIN dc_base_asset_info t4 ON t2.asset_code = t4.asset_code
AND t4.org_id = #{orgId}
AND t4.asset_level = #{assetLevel}
AND t4.asset_type = #{assetType}
WHERE
t1.date_year = #{dateYear}
AND t1.date_month = #{dateMonth}
AND t1.date_day = #{dateDay}
</select>
<select id="selectChildrenOrgSomedaySomeReportDataList"
parameterType="com.lzbi.draft.domain.req.ReportDataReq"
resultType="com.lzbi.draft.domain.vo.ChildrenOrgSomedaySomeReportDataVO">
SELECT
t5.dept_id as "orgId",
t5.dept_name as "orgName",
t1.value_result
FROM
dc_busi_target_draft_daynew t1
INNER JOIN dc_base_asset_target t2 ON t1.target_code = t2.target_code
INNER JOIN dc_busi_report_target_config t3 ON t2.target_model_code = t3.target_model_code
AND t3.report_name = #{reportName}
INNER JOIN dc_base_asset_info t4 ON t2.asset_code = t4.asset_code
AND t4.asset_level = #{assetLevel}
AND t4.asset_type = #{assetType}
INNER JOIN sys_dept t5 ON t4.org_id = t5.dept_id
AND t5.parent_id = #{orgId}
WHERE
t1.date_year = #{dateYear}
AND t1.date_month = #{dateMonth}
AND t1.date_day = #{dateDay}
ORDER BY t5.dept_id
</select>
<select id="selectSomeOrgSomedayMultiReportDataList"
parameterType="com.lzbi.draft.domain.req.ReportDataReq"
resultType="com.lzbi.draft.domain.dto.SomeOrgSomedayMultiReportDataDTO">
SELECT
t3.report_name,
t1.value_result,
t1.value_plan
FROM
dc_busi_target_draft_daynew t1
INNER JOIN dc_base_asset_target t2 ON t1.target_code = t2.target_code
INNER JOIN dc_busi_report_target_config t3 ON t2.target_model_code = t3.target_model_code
AND t3.report_name IN
<foreach collection="reportNames" item="reportName" open="(" separator="," close=")">
#{reportName}
</foreach>
INNER JOIN dc_base_asset_info t4 ON t2.asset_code = t4.asset_code
AND t4.org_id = #{orgId}
AND t4.asset_level = #{assetLevel}
AND t4.asset_type = #{assetType}
WHERE
t1.date_year = #{dateYear}
AND t1.date_month = #{dateMonth}
AND t1.date_day = #{dateDay}
ORDER BY
t3.report_name
</select>
<select id="selectSomeTypeChildrenOrgSomedayMultiReportDataList"
parameterType="com.lzbi.draft.domain.req.ReportDataReq"
resultType="com.lzbi.draft.domain.dto.SomeTypeChildrenOrgSomedayMultiReportDataDTO">
SELECT
t4.org_id,
t5.dept_name AS "orgName",
t3.report_name,
t1.value_result,
t1.value_plan
FROM
dc_busi_target_draft_daynew t1
INNER JOIN dc_base_asset_target t2 ON t1.target_code = t2.target_code
INNER JOIN dc_busi_report_target_config t3 ON t2.target_model_code = t3.target_model_code
AND t3.report_name IN
<foreach collection="reportNames" item="reportName" open="(" separator="," close=")">
#{reportName}
</foreach>
INNER JOIN dc_base_asset_info t4 ON t2.asset_code = t4.asset_code
AND t4.asset_level = #{assetLevel}
AND t4.asset_type = #{assetType}
INNER JOIN sys_dept t5 ON t4.org_id = t5.dept_id
AND FIND_IN_SET( #{orgId}, t5.ancestors )
AND t5.org_type = #{orgType}
WHERE
t1.date_year = #{dateYear}
AND t1.date_month = #{dateMonth}
AND t1.date_day = #{dateDay}
ORDER BY
t5.dept_id,
t3.report_name
</select>
<select id="selectSomeOrgSomeReportYearlyDataList"
parameterType="com.lzbi.draft.domain.req.ReportDataReq"
resultType="com.lzbi.draft.domain.vo.SomeOrgSomeReportYearlyDataVO">
SELECT
t1.date_year,
max( t1.value_result ) as "maxValueResult"
FROM
dc_busi_target_draft_daynew t1
INNER JOIN dc_base_asset_target t2 ON t1.target_code = t2.target_code
INNER JOIN dc_busi_report_target_config t3 ON t2.target_model_code = t3.target_model_code
AND t3.report_name = #{reportName}
INNER JOIN dc_base_asset_info t4 ON t2.asset_code = t4.asset_code
AND t4.org_id = #{orgId}
AND t4.asset_level = #{assetLevel}
AND t4.asset_type = #{assetType}
GROUP BY
t1.date_year
</select>
</mapper> </mapper>

8
lzbi-module/src/main/resources/mapper/asset/DcBusiParamDraftDayMapper.xml

@ -124,15 +124,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM FROM
dc_busi_param_draft_day t1 dc_busi_param_draft_day t1
INNER JOIN dc_base_asset_target t2 ON t1.param_code = t2.target_code INNER JOIN dc_base_asset_target t2 ON t1.param_code = t2.target_code
WHERE <where>
t2.target_model_code = #{paramsModelCode} t2.target_model_code = #{paramsModelCode}
AND t2.asset_code IN AND t2.asset_code IN
<foreach collection="assetCodeList" item="assetCode" open="(" separator="," close=")"> <foreach collection="assetCodeList" item="assetCode" open="(" separator="," close=")">
#{assetCode} #{assetCode}
</foreach> </foreach>
<if test="countDate != null and countDate != ''">
AND t1.count_date = #{countDate}
</if>
AND t2.column_type = "P" AND t2.column_type = "P"
</where>
GROUP BY GROUP BY
t1.asset_code t1.asset_code
) tt1 ) tt1
ON t.id = tt1.id ON t.id = tt1.id
</select> </select>

6
lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftDaynewMapper.xml

@ -221,7 +221,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</delete> </delete>
<select id="selectTargetDraftDaynewList" parameterType="com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo" resultType="com.lzbi.draft.domain.vo.TargetDraftDaynewResVo"> <select id="selectTargetDraftDaynewList" parameterType="com.lzbi.draft.domain.req.ReportDataReq" resultType="com.lzbi.draft.domain.vo.TargetDraftDaynewResVo">
select select
d.organize_name, d.organize_id, c.report_name, d.value_result, m.target_unit d.organize_name, d.organize_id, c.report_name, d.value_result, m.target_unit
from from
@ -273,7 +273,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectTargetDraftDaynewRangeList" parameterType="com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo" resultType="com.lzbi.draft.domain.vo.TargetDraftDayRangeResVo"> <select id="selectTargetDraftDaynewRangeList" parameterType="com.lzbi.draft.domain.req.ReportDataReq" resultType="com.lzbi.draft.domain.vo.TargetDraftDayRangeResVo">
select select
d.organize_name as cname, d.organize_name as cname,
d.value_result as value_result, d.value_result as value_result,
@ -328,7 +328,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by md.max_date order by md.max_date
</select> </select>
<select id="selectTargetDraftDaynewAggregateList" parameterType="com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo" resultType="com.lzbi.draft.domain.vo.TargetDraftDaynewAggregateResVo"> <select id="selectTargetDraftDaynewAggregateList" parameterType="com.lzbi.draft.domain.req.ReportDataReq" resultType="com.lzbi.draft.domain.vo.TargetDraftDaynewAggregateResVo">
select select
d.organize_name, d.organize_name,
d.organize_id, d.organize_id,

2
lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftMonthMapper.xml

@ -62,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</select> </select>
<select id="selectDcBusiTargetDraftMontAggregateList" parameterType="com.lzbi.draft.domain.vo.TargetDraftDaynewReqVo" resultType="com.lzbi.draft.domain.vo.TargetDraftMonthAggregateResVo"> <select id="selectDcBusiTargetDraftMontAggregateList" parameterType="com.lzbi.draft.domain.req.ReportDataReq" resultType="com.lzbi.draft.domain.vo.TargetDraftMonthAggregateResVo">
select select
d.org_name, d.org_name,
d.org_id, d.org_id,

Loading…
Cancel
Save