Browse Source

大屏接口

develop
bobol 11 months ago
parent
commit
e6cd12b40e
  1. 12
      lzbi-admin/src/main/resources/application-dev.yml
  2. 50
      lzbi-common/src/main/java/com/lzbi/common/config/TargetModelConfig.java
  3. 2
      lzbi-module/src/main/java/com/lzbi/bi/domain/CalorificValueVO.java
  4. 32
      lzbi-module/src/main/java/com/lzbi/bi/domain/ConsumesStatisticsDTO.java
  5. 36
      lzbi-module/src/main/java/com/lzbi/bi/domain/CorporateStatisticsDTO.java
  6. 14
      lzbi-module/src/main/java/com/lzbi/bi/domain/HeatSuppliedVO.java
  7. 28
      lzbi-module/src/main/java/com/lzbi/bi/domain/ProvideAnswerWaterAverageTemperatureReq.java
  8. 204
      lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiDataScreenNewService.java
  9. 6
      lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiTargetDraftDay.java
  10. 10
      lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiTargetDraftMonth.java
  11. 19
      lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftDayMapper.java
  12. 1
      lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftMonthMapper.java
  13. 34
      lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftMonthMapper.xml
  14. 159
      lzbi-module/src/main/resources/mapper/draft/DcBusiTargetDraftDayMapper.xml

12
lzbi-admin/src/main/resources/application-dev.yml

@ -108,4 +108,14 @@ logging:
org.springframework: warn
# 指标模板
target-model:
user: TM00051
user: TM000YH # 用户
boiler: TM000GL # 锅炉
electricityConsumes: TM000DH #电耗
waterConsumes: TM000SH # 水耗
coalConsumes: TM000MH # 煤耗
calorific: TM000FRL # 发热量
heatSupplied: TM000GRL # 供热量
acreage: MJ01 # 面积
outputOfPlant: TM000FDL # 发电量
provideWaterAverageTemperature: TM000GSJW # 供水均温
answerWaterAverageTemperature: TM000HSJW # 回水均温

50
lzbi-common/src/main/java/com/lzbi/common/config/TargetModelConfig.java

@ -16,4 +16,54 @@ public class TargetModelConfig {
* 用户
*/
private String user;
/**
* 锅炉
*/
private String boiler;
/**
* 电耗
*/
private String electricityConsumes;
/**
* 水耗
*/
private String waterConsumes;
/**
* 煤耗
*/
private String coalConsumes;
/**
* 发热量
*/
private String calorific;
/**
* 供热量
*/
private String heatSupplied;
/**
* 面积
*/
private String acreage;
/**
* 发电量
*/
private String outputOfPlant;
/**
* 供水均温
*/
private String provideWaterAverageTemperature;
/**
* 回水均温
*/
private String answerWaterAverageTemperature;
}

2
lzbi-module/src/main/java/com/lzbi/bi/domain/CalorificValueVO.java

@ -24,5 +24,5 @@ public class CalorificValueVO {
/**
* 百分比
*/
private double percentage;
private int percentage;
}

32
lzbi-module/src/main/java/com/lzbi/bi/domain/ConsumesStatisticsDTO.java

@ -0,0 +1,32 @@
package com.lzbi.bi.domain;
import lombok.Data;
@Data
public class ConsumesStatisticsDTO {
/**
* 公司id
*/
private Long companyId;
/**
*
*/
private String year;
/**
*
*/
private String month;
/**
* 电耗指标模板
*/
private String electricityConsumes;
/**
* 水耗指标模板
*/
private String waterConsumes;
/**
* 煤耗指标模板
*/
private String coalConsumes;
}

36
lzbi-module/src/main/java/com/lzbi/bi/domain/CorporateStatisticsDTO.java

@ -0,0 +1,36 @@
package com.lzbi.bi.domain;
import lombok.Data;
@Data
public class CorporateStatisticsDTO {
/**
* 公司id
*/
private Long companyId;
/**
*
*/
private String year;
/**
*
*/
private String month;
/**
* 面积
*/
private String acreage;
/**
* 发电量
*/
private String outputOfPlant;
/**
* 发热量
*/
private String calorificValue;
/**
* 供热量
*/
private String heatSupplied;
}

14
lzbi-module/src/main/java/com/lzbi/bi/domain/HeatSuppliedVO.java

@ -1,6 +1,8 @@
package com.lzbi.bi.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.List;
@ -11,7 +13,17 @@ import java.util.List;
@Data
public class HeatSuppliedVO {
private List<String> labelArr;
private List<Label> labelArr;
private List<BigDecimal> valueArr;
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class Label {
private String name;
private BigDecimal max;
}
}

28
lzbi-module/src/main/java/com/lzbi/bi/domain/ProvideAnswerWaterAverageTemperatureReq.java

@ -0,0 +1,28 @@
package com.lzbi.bi.domain;
import lombok.Data;
@Data
public class ProvideAnswerWaterAverageTemperatureReq {
/**
* 公司id
*/
private Long companyId;
/**
*
*/
private String year;
/**
*
*/
private String month;
/**
* 供水均温
*/
private String provideWaterAverageTemperature;
/**
* 回水均温
*/
private String answerWaterAverageTemperature;
}

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

@ -4,7 +4,9 @@ import com.lzbi.bi.domain.*;
import com.lzbi.common.config.TargetModelConfig;
import com.lzbi.common.utils.bean.BeanUtils;
import com.lzbi.draft.domain.DcBusiTargetDraftDay;
import com.lzbi.draft.domain.DcBusiTargetDraftMonth;
import com.lzbi.draft.mapper.DcBusiTargetDraftDayMapper;
import com.lzbi.draft.mapper.DcBusiTargetDraftMonthMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -15,6 +17,7 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
@ -31,19 +34,20 @@ public class DcBusiDataScreenNewService {
@Resource
private DcBusiTargetDraftDayMapper dcBusiTargetDraftDayMapper;
@Resource
private DcBusiTargetDraftMonthMapper dcBusiTargetDraftMonthMapper;
public List<UserIOverViewVO> getUserOverview(DcBusDataScreenNewReq dcBusDataScreenNewReq) {
List<UserIOverViewVO> list = new ArrayList<>();
// list.add(new UserIOverViewVO("热源1", BigDecimal.valueOf(10000), BigDecimal.valueOf(8000)));
// list.add(new UserIOverViewVO("热源2", BigDecimal.valueOf(10000), BigDecimal.valueOf(8000)));
// list.add(new UserIOverViewVO("热源3", BigDecimal.valueOf(10000), BigDecimal.valueOf(8000)));
// list.add(new UserIOverViewVO("热源4", BigDecimal.valueOf(10000), BigDecimal.valueOf(8000)));
DcBusiTargetDraftDay params = new DcBusiTargetDraftDay();
BeanUtils.copyBeanProp(params, dcBusDataScreenNewReq);
String yearMonthDay = dcBusDataScreenNewReq.getYearMonthDay();
String[] yearMonthDayArr = yearMonthDay.split("-");
if (yearMonthDayArr.length > 1) {
params.setCountYear(yearMonthDayArr[0]);
params.setCountMonth(yearMonthDayArr[1]);
params.setTargetCode(targetModelConfig.getUser());
}
params.setTargetModelCode(targetModelConfig.getUser());
List<DcBusiTargetDraftDay> dcBusiTargetDraftDayList = dcBusiTargetDraftDayMapper.selectDcBusiTargetDraftDayList(params);
if (CollectionUtils.isNotEmpty(dcBusiTargetDraftDayList)) {
Map<Object, List<DcBusiTargetDraftDay>> map;
@ -52,7 +56,6 @@ public class DcBusiDataScreenNewService {
} else {
map = dcBusiTargetDraftDayList.stream().collect(Collectors.groupingBy(DcBusiTargetDraftDay::getAssetCode));
}
Class<DcBusiTargetDraftDay> dcBusiTargetDraftMonthClass = DcBusiTargetDraftDay.class;
map.forEach((key, value) -> {
UserIOverViewVO userIOverViewVO = new UserIOverViewVO();
if (ObjectUtils.isEmpty(dcBusDataScreenNewReq.getOrgId())) {
@ -76,11 +79,17 @@ public class DcBusiDataScreenNewService {
public ProvideAnswerWaterAverageTemperatureVO getProvideAnswerWaterAverageTemperature(DcBusDataScreenNewReq dcBusDataScreenNewReq) {
ProvideAnswerWaterAverageTemperatureVO provideAnswerWaterAverageTemperatureVO = new ProvideAnswerWaterAverageTemperatureVO();
ProvideAnswerWaterAverageTemperatureReq params = new ProvideAnswerWaterAverageTemperatureReq();
params.setCompanyId(dcBusDataScreenNewReq.getCompanyId());
String yearMonthDay = dcBusDataScreenNewReq.getYearMonthDay();
String[] yearMonthDayArr = yearMonthDay.split("-");
dcBusDataScreenNewReq.setYear(yearMonthDayArr[0]);
dcBusDataScreenNewReq.setMonth(yearMonthDayArr[1]);
List<ProvideAnswerWaterAverageTemperatureDTO> provideAnswerWaterAverageTemperatureDTOS = dcBusiTargetDraftDayMapper.selectProvideAnswerWaterAverageTemperatureList(dcBusDataScreenNewReq);
if (yearMonthDayArr.length > 1) {
params.setYear(yearMonthDayArr[0]);
params.setMonth(yearMonthDayArr[1]);
}
params.setProvideWaterAverageTemperature(targetModelConfig.getProvideWaterAverageTemperature());
params.setAnswerWaterAverageTemperature(targetModelConfig.getAnswerWaterAverageTemperature());
List<ProvideAnswerWaterAverageTemperatureDTO> provideAnswerWaterAverageTemperatureDTOS = dcBusiTargetDraftDayMapper.selectProvideAnswerWaterAverageTemperatureList(params);
if (CollectionUtils.isNotEmpty(provideAnswerWaterAverageTemperatureDTOS)) {
List<String> xArr = new ArrayList<>();
List<BigDecimal> yArr1 = new ArrayList<>();
@ -99,56 +108,169 @@ public class DcBusiDataScreenNewService {
public List<BoilerStatisticsVO> getBoilerStatistics(DcBusDataScreenNewReq dcBusDataScreenNewReq) {
List<BoilerStatisticsVO> list = new ArrayList<>();
list.add(new BoilerStatisticsVO("热源1", BigDecimal.valueOf(248776)));
list.add(new BoilerStatisticsVO("热源2", BigDecimal.valueOf(248776)));
list.add(new BoilerStatisticsVO("热源3", BigDecimal.valueOf(248776)));
// list.add(new BoilerStatisticsVO("热源1", BigDecimal.valueOf(248776)));
// list.add(new BoilerStatisticsVO("热源2", BigDecimal.valueOf(248776)));
// list.add(new BoilerStatisticsVO("热源3", BigDecimal.valueOf(248776)));
DcBusiTargetDraftMonth params = new DcBusiTargetDraftMonth();
BeanUtils.copyBeanProp(params, dcBusDataScreenNewReq);
String yearMonthDay = dcBusDataScreenNewReq.getYearMonthDay();
String[] yearMonthDayArr = yearMonthDay.split("-");
if (yearMonthDayArr.length > 1) {
params.setCountYear(yearMonthDayArr[0]);
params.setCountMonth(yearMonthDayArr[1]);
}
params.setTargetModelCode(targetModelConfig.getBoiler());
List<DcBusiTargetDraftMonth> dcBusiTargetDraftMonths = dcBusiTargetDraftMonthMapper.selectDcBusiTargetDraftMonthList(params);
if (CollectionUtils.isNotEmpty(dcBusiTargetDraftMonths)) {
Map<Object, List<DcBusiTargetDraftMonth>> map;
if (ObjectUtils.isEmpty(dcBusDataScreenNewReq.getOrgId())) {
map = dcBusiTargetDraftMonths.stream().collect(Collectors.groupingBy(DcBusiTargetDraftMonth::getOrgId));
} else {
map = dcBusiTargetDraftMonths.stream().collect(Collectors.groupingBy(DcBusiTargetDraftMonth::getAssetCode));
}
map.forEach((key, value) -> {
BoilerStatisticsVO boilerStatisticsVO = new BoilerStatisticsVO();
if (ObjectUtils.isEmpty(dcBusDataScreenNewReq.getOrgId())) {
boilerStatisticsVO.setLabel(value.get(0).getOrgName());
} else {
boilerStatisticsVO.setLabel(value.get(0).getAssetName());
}
BigDecimal sum = new BigDecimal(0);
for (int i = 0, len = value.size(); i < len; i++) {
sum = sum.add(value.get(i).getValOriginal());
}
boilerStatisticsVO.setValue(sum);
list.add(boilerStatisticsVO);
});
}
return list;
}
public List<ConsumesStatisticsVO> getConsumesStatistics(DcBusDataScreenNewReq dcBusDataScreenNewReq) {
List<ConsumesStatisticsVO> list = new ArrayList<>();
list.add(new ConsumesStatisticsVO("热源1", BigDecimal.valueOf(458.14), BigDecimal.valueOf(1.25), BigDecimal.valueOf(37.57) ));
list.add(new ConsumesStatisticsVO("热源2", BigDecimal.valueOf(458.14), BigDecimal.valueOf(1.25), BigDecimal.valueOf(37.57) ));
list.add(new ConsumesStatisticsVO("热源3", BigDecimal.valueOf(458.14), BigDecimal.valueOf(1.25), BigDecimal.valueOf(37.57) ));
list.add(new ConsumesStatisticsVO("热源4", BigDecimal.valueOf(458.14), BigDecimal.valueOf(1.25), BigDecimal.valueOf(37.57) ));
list.add(new ConsumesStatisticsVO("热源5", BigDecimal.valueOf(458.14), BigDecimal.valueOf(1.25), BigDecimal.valueOf(37.57) ));
return list;
ConsumesStatisticsDTO consumesStatisticsDTO = new ConsumesStatisticsDTO();
consumesStatisticsDTO.setCompanyId(dcBusDataScreenNewReq.getCompanyId());
String yearMonthDay = dcBusDataScreenNewReq.getYearMonthDay();
String[] yearMonthDayArr = yearMonthDay.split("-");
if (yearMonthDayArr.length > 1) {
consumesStatisticsDTO.setYear(yearMonthDayArr[0]);
consumesStatisticsDTO.setMonth(yearMonthDayArr[1]);
}
consumesStatisticsDTO.setElectricityConsumes(targetModelConfig.getElectricityConsumes());
consumesStatisticsDTO.setWaterConsumes(targetModelConfig.getWaterConsumes());
consumesStatisticsDTO.setCoalConsumes(targetModelConfig.getCoalConsumes());
return dcBusiTargetDraftDayMapper.getConsumesStatistics(consumesStatisticsDTO);
}
public List<CalorificValueVO> getCalorificValue(DcBusDataScreenNewReq dcBusDataScreenNewReq) {
List<CalorificValueVO> list = new ArrayList<>();
list.add(new CalorificValueVO("热源1", BigDecimal.valueOf(7897), 17));
list.add(new CalorificValueVO("热源2", BigDecimal.valueOf(9766), 21));
list.add(new CalorificValueVO("热源3", BigDecimal.valueOf(5571), 12));
list.add(new CalorificValueVO("热源4", BigDecimal.valueOf(7897), 17));
list.add(new CalorificValueVO("热源5", BigDecimal.valueOf(9766), 21));
list.add(new CalorificValueVO("热源6", BigDecimal.valueOf(5571), 12));
DcBusiTargetDraftDay params = new DcBusiTargetDraftDay();
BeanUtils.copyBeanProp(params, dcBusDataScreenNewReq);
String yearMonthDay = dcBusDataScreenNewReq.getYearMonthDay();
String[] yearMonthDayArr = yearMonthDay.split("-");
if (yearMonthDayArr.length > 1) {
params.setCountYear(yearMonthDayArr[0]);
params.setCountMonth(yearMonthDayArr[1]);
}
params.setTargetModelCode(targetModelConfig.getCalorific());
List<DcBusiTargetDraftDay> dcBusiTargetDraftDayList = dcBusiTargetDraftDayMapper.selectDcBusiTargetDraftDayList(params);
if (CollectionUtils.isNotEmpty(dcBusiTargetDraftDayList)) {
Map<Object, List<DcBusiTargetDraftDay>> map;
if (ObjectUtils.isEmpty(dcBusDataScreenNewReq.getOrgId())) {
map = dcBusiTargetDraftDayList.stream().collect(Collectors.groupingBy(DcBusiTargetDraftDay::getOrgId));
} else {
map = dcBusiTargetDraftDayList.stream().collect(Collectors.groupingBy(DcBusiTargetDraftDay::getAssetCode));
}
AtomicReference<BigDecimal> total = new AtomicReference<>(new BigDecimal(0));
map.forEach((key, value) -> {
CalorificValueVO calorificValueVO = new CalorificValueVO();
if (ObjectUtils.isEmpty(dcBusDataScreenNewReq.getOrgId())) {
calorificValueVO.setLabel(value.get(0).getOrgName());
} else {
calorificValueVO.setLabel(value.get(0).getAssetName());
}
BigDecimal sum = new BigDecimal(0);
for (int i = 0, len = value.size(); i < len; i++) {
sum = sum.add(value.get(i).getValAccumulative());
total.set(total.get().add(value.get(i).getValAccumulative()));
}
calorificValueVO.setValue(sum);
list.add(calorificValueVO);
});
BigDecimal percentageSum = BigDecimal.valueOf(100);
for (int i = 0, len = list.size(); i < len; i++) {
CalorificValueVO item = list.get(i);
BigDecimal percentage = item.getValue().divide(total.get(), 2, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100));
if (i < len - 1) {
percentageSum = percentageSum.subtract(percentage);
item.setPercentage(percentage.intValue());
} else {
item.setPercentage(percentageSum.intValue());
}
}
}
return list;
}
public HeatSuppliedVO getHeatSupplied(DcBusDataScreenNewReq dcBusDataScreenNewReq) {
HeatSuppliedVO heatSuppliedVO = new HeatSuppliedVO();
List<String> labelArr = new ArrayList<>();
DcBusiTargetDraftDay params = new DcBusiTargetDraftDay();
BeanUtils.copyBeanProp(params, dcBusDataScreenNewReq);
String yearMonthDay = dcBusDataScreenNewReq.getYearMonthDay();
String[] yearMonthDayArr = yearMonthDay.split("-");
if (yearMonthDayArr.length > 1) {
params.setCountYear(yearMonthDayArr[0]);
params.setCountMonth(yearMonthDayArr[1]);
}
params.setTargetModelCode(targetModelConfig.getHeatSupplied());
List<DcBusiTargetDraftDay> dcBusiTargetDraftDayList = dcBusiTargetDraftDayMapper.selectDcBusiTargetDraftDayList(params);
if (CollectionUtils.isNotEmpty(dcBusiTargetDraftDayList)) {
Map<Object, List<DcBusiTargetDraftDay>> map;
if (ObjectUtils.isEmpty(dcBusDataScreenNewReq.getOrgId())) {
map = dcBusiTargetDraftDayList.stream().collect(Collectors.groupingBy(DcBusiTargetDraftDay::getOrgId));
} else {
map = dcBusiTargetDraftDayList.stream().collect(Collectors.groupingBy(DcBusiTargetDraftDay::getAssetCode));
}
List<HeatSuppliedVO.Label> labelArray = new ArrayList<>();
List<BigDecimal> valueArr = new ArrayList<>();
labelArr.add("热源1");
labelArr.add("热源2");
labelArr.add("热源3");
labelArr.add("热源4");
labelArr.add("热源5");
labelArr.add("热源6");
valueArr.add(BigDecimal.valueOf(300));
valueArr.add(BigDecimal.valueOf(500));
valueArr.add(BigDecimal.valueOf(300));
valueArr.add(BigDecimal.valueOf(100));
valueArr.add(BigDecimal.valueOf(500));
valueArr.add(BigDecimal.valueOf(100));
heatSuppliedVO.setLabelArr(labelArr);
final BigDecimal[] max = {new BigDecimal(0)};
map.forEach((key, value) -> {
HeatSuppliedVO.Label label = new HeatSuppliedVO.Label();
if (ObjectUtils.isEmpty(dcBusDataScreenNewReq.getOrgId())) {
label.setName(value.get(0).getOrgName());
} else {
label.setName(value.get(0).getAssetName());
}
BigDecimal sum = new BigDecimal(0);
for (int i = 0, len = value.size(); i < len; i++) {
sum = sum.add(value.get(i).getValAccumulative());
}
valueArr.add(sum);
if (max[0].compareTo(sum) < 0) {
max[0] = sum;
}
labelArray.add(label);
});
labelArray.stream().forEach(label -> label.setMax(max[0]));
heatSuppliedVO.setLabelArr(labelArray);
heatSuppliedVO.setValueArr(valueArr);
}
return heatSuppliedVO;
}
public CorporateStatisticsVO getCorporateStatistics(DcBusDataScreenNewReq dcBusDataScreenNewReq) {
CorporateStatisticsVO corporateStatisticsVO = new CorporateStatisticsVO();
return new CorporateStatisticsVO(BigDecimal.valueOf(3820), BigDecimal.valueOf(3820), BigDecimal.valueOf(3820), BigDecimal.valueOf(3820));
CorporateStatisticsDTO corporateStatisticsDTO = new CorporateStatisticsDTO();
corporateStatisticsDTO.setCompanyId(dcBusDataScreenNewReq.getCompanyId());
String yearMonthDay = dcBusDataScreenNewReq.getYearMonthDay();
String[] yearMonthDayArr = yearMonthDay.split("-");
if (yearMonthDayArr.length > 1) {
corporateStatisticsDTO.setYear(yearMonthDayArr[0]);
corporateStatisticsDTO.setMonth(yearMonthDayArr[1]);
}
corporateStatisticsDTO.setAcreage(targetModelConfig.getAcreage());
corporateStatisticsDTO.setOutputOfPlant(targetModelConfig.getOutputOfPlant());
corporateStatisticsDTO.setCalorificValue(targetModelConfig.getCalorific());
corporateStatisticsDTO.setHeatSupplied(targetModelConfig.getHeatSupplied());
CorporateStatisticsVO corporateStatisticsVO = dcBusiTargetDraftDayMapper.getCorporateStatistics(corporateStatisticsDTO);
return corporateStatisticsVO;
}
}

6
lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiTargetDraftDay.java

@ -77,6 +77,10 @@ public class DcBusiTargetDraftDay extends BaseModuleEntity
@Excel(name = "月")
private String countMonth;
/** 累计值 */
@Excel(name = "累计值")
private BigDecimal valAccumulative;
/** 和值 */
@Excel(name = "和值")
private BigDecimal valSum;
@ -229,4 +233,6 @@ public class DcBusiTargetDraftDay extends BaseModuleEntity
@Excel(name = "31日")
private BigDecimal valP31;
private String targetModelCode;
}

10
lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiTargetDraftMonth.java

@ -71,6 +71,14 @@ public class DcBusiTargetDraftMonth extends BaseModuleEntity
@Excel(name = "年月日【yyyy-mm-dd】")
private String countDate;
/** 年 */
@Excel(name = "年")
private String countYear;
/** 月 */
@Excel(name = "月")
private String countMonth;
/** 原值 */
@Excel(name = "原值")
private BigDecimal valOriginal;
@ -87,4 +95,6 @@ public class DcBusiTargetDraftMonth extends BaseModuleEntity
@Excel(name = "计划值")
private String valPlan;
private String targetModelCode;
}

19
lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftDayMapper.java

@ -2,8 +2,7 @@ package com.lzbi.draft.mapper;
import java.util.List;
import com.lzbi.bi.domain.DcBusDataScreenNewReq;
import com.lzbi.bi.domain.ProvideAnswerWaterAverageTemperatureDTO;
import com.lzbi.bi.domain.*;
import com.lzbi.draft.domain.DcBusiTargetDraftDay;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lzbi.draft.entity.dto.TargetDraftMonthReportValueDTO;
@ -35,7 +34,21 @@ public interface DcBusiTargetDraftDayMapper extends BaseMapper<DcBusiTargetDraft
*/
public List<DcBusiTargetDraftDay> selectDcBusiTargetDraftDayList(DcBusiTargetDraftDay dcBusiTargetDraftDay);
List<ProvideAnswerWaterAverageTemperatureDTO> selectProvideAnswerWaterAverageTemperatureList(DcBusDataScreenNewReq dcBusDataScreenNewReq);
/**
* 获取公司统计
* @param corporateStatisticsDTO
* @return
*/
CorporateStatisticsVO getCorporateStatistics(CorporateStatisticsDTO corporateStatisticsDTO);
/**
* 获取能耗统计列表
* @param consumesStatisticsDTO
* @return
*/
List<ConsumesStatisticsVO> getConsumesStatistics(ConsumesStatisticsDTO consumesStatisticsDTO);
List<ProvideAnswerWaterAverageTemperatureDTO> selectProvideAnswerWaterAverageTemperatureList(ProvideAnswerWaterAverageTemperatureReq provideAnswerWaterAverageTemperatureReq);
/**
* 新增指标数据底稿()

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

@ -4,6 +4,7 @@ import java.util.List;
import com.lzbi.draft.domain.DcBusiTargetDraftMonth;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* 指标数据底稿()Mapper接口

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

@ -19,6 +19,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="targetCode" column="target_code" />
<result property="targetUint" column="target_uint" />
<result property="countDate" column="count_date" />
<result property="countYear" column="count_year" />
<result property="countMonth" column="count_month" />
<result property="valOriginal" column="val_original" />
<result property="valAdjust" column="val_adjust" />
<result property="valResult" column="val_result" />
@ -33,19 +35,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDcBusiTargetDraftMonthVo">
select id, company_name, company_id, org_id, org_name, asset_code, asset_name, field_code, field_name, target_name_alias, target_name, target_code, target_uint, count_date, val_original, val_adjust, val_result, tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time from dc_busi_target_draft_day
select id, company_name, company_id, org_id, org_name, asset_code, asset_name, field_code, field_name, target_name_alias, target_name, target_code, target_uint, count_date, count_year, count_month val_original, val_adjust, val_result, tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time from dc_busi_target_draft_month
</sql>
<select id="selectDcBusiTargetDraftMonthList" parameterType="DcBusiTargetDraftMonth" resultMap="DcBusiTargetDraftMonthResult">
<include refid="selectDcBusiTargetDraftMonthVo"/>
select t.id, t.company_name, t.company_id, t.org_id, t.org_name, t.asset_code, t.asset_name, t.field_code, t.field_name, t.target_name_alias, t.target_name, t.target_code, t.target_uint, t.count_date, t.count_year, t.count_month, t.val_original, t.val_adjust, t.val_result
from dc_busi_target_draft_month t
<if test="targetModelCode != null and targetModelCode != ''">
inner join dc_base_asset_target t1 on t.target_code = t1.target_code and t.asset_code = t1.asset_code and t1.target_model_code = #{targetModelCode}
</if>
<where>
<if test="companyId != null "> and company_id = #{companyId}</if>
<if test="orgId != null "> and org_id = #{orgId}</if>
<if test="assetCode != null and assetCode != ''"> and asset_code = #{assetCode}</if>
<if test="fieldCode != null and fieldCode != ''"> and field_code = #{fieldCode}</if>
<if test="targetName != null and targetName != ''"> and target_name like concat('%', #{targetName}, '%')</if>
<if test="targetCode != null and targetCode != ''"> and target_code = #{targetCode}</if>
<if test="countDate != null and countDate != ''"> and count_date = #{countDate}</if>
<if test="companyId != null "> and t.company_id = #{companyId}</if>
<if test="orgId != null "> and t.org_id = #{orgId}</if>
<if test="assetCode != null and assetCode != ''"> and t.asset_code = #{assetCode}</if>
<if test="fieldCode != null and fieldCode != ''"> and t.field_code = #{fieldCode}</if>
<if test="targetName != null and targetName != ''"> and t.target_name like concat('%', #{targetName}, '%')</if>
<if test="targetCode != null and targetCode != ''"> and t.target_code = #{targetCode}</if>
<if test="countDate != null and countDate != ''"> and t.count_date = #{countDate}</if>
<if test="countYear != null and countYear != ''"> and t.count_year = #{countYear}</if>
<if test="countMonth != null and countMonth != ''"> and t.count_month = #{countMonth}</if>
</where>
</select>
@ -55,7 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertDcBusiTargetDraftMonth" parameterType="DcBusiTargetDraftMonth" useGeneratedKeys="true" keyProperty="id">
insert into dc_busi_target_draft_day
insert into dc_busi_target_draft_month
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="companyName != null">company_name,</if>
<if test="companyId != null">company_id,</if>
@ -111,7 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateDcBusiTargetDraftMonth" parameterType="DcBusiTargetDraftMonth">
update dc_busi_target_draft_day
update dc_busi_target_draft_month
<trim prefix="SET" suffixOverrides=",">
<if test="companyName != null">company_name = #{companyName},</if>
<if test="companyId != null">company_id = #{companyId},</if>
@ -142,11 +150,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteDcBusiTargetDraftMonthById" parameterType="Long">
delete from dc_busi_target_draft_day where id = #{id}
delete from dc_busi_target_draft_month where id = #{id}
</delete>
<delete id="deleteDcBusiTargetDraftMonthByIds" parameterType="String">
delete from dc_busi_target_draft_day where id in
delete from dc_busi_target_draft_month where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>

159
lzbi-module/src/main/resources/mapper/draft/DcBusiTargetDraftMonthMapper.xml → lzbi-module/src/main/resources/mapper/draft/DcBusiTargetDraftDayMapper.xml

@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="countYear" column="count_year" />
<result property="countMonth" column="count_month" />
<result property="valSum" column="val_sum" />
<result property="valAccumulative" column="val_accumulative" />
<result property="valAvgAll" column="val_avg_all" />
<result property="valAvgNull" column="val_avg_null" />
<result property="valPlan" column="val_plan" />
@ -66,11 +67,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDcBusiTargetDraftDayVo">
select id, company_name, company_id, org_id, org_name, asset_code, asset_name, field_code, field_name, target_name_alias, target_name, target_code, target_uint, count_year, count_month, val_sum, val_avg_all, val_avg_null, val_plan, tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time, val_p1, val_p2, val_p3, val_p4, val_p5, val_p6, val_p7, val_p8, val_p9, val_p10, val_p11, val_p12, val_p13, val_p14, val_p15, val_p16, val_p17, val_p18, val_p19, val_p20, val_p21, val_p22, val_p23, val_p24, val_p25, val_p26, val_p27, val_p28, val_p29, val_p30, val_p31 from dc_busi_target_draft_day
select id, company_name, company_id, org_id, org_name, asset_code, asset_name, field_code, field_name, target_name_alias, target_name, target_code, target_uint, count_year, count_month, val_accumulative, val_sum, val_avg_all, val_avg_null, val_plan, tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time, val_p1, val_p2, val_p3, val_p4, val_p5, val_p6, val_p7, val_p8, val_p9, val_p10, val_p11, val_p12, val_p13, val_p14, val_p15, val_p16, val_p17, val_p18, val_p19, val_p20, val_p21, val_p22, val_p23, val_p24, val_p25, val_p26, val_p27, val_p28, val_p29, val_p30, val_p31 from dc_busi_target_draft_day
</sql>
<select id="selectDcBusiTargetDraftDayList" parameterType="DcBusiTargetDraftDay" resultMap="DcBusiTargetDraftDayResult">
<include refid="selectDcBusiTargetDraftDayVo"/>
select t.id, t.company_name, t.company_id, t.org_id, t.org_name, t.asset_code, t.asset_name, t.field_code, t.field_name, t.target_name_alias, t.target_name, t.target_code, t.target_uint, t.count_year, t.count_month, t.val_accumulative, t.val_sum, t.val_avg_all, t.val_avg_null, t.val_plan, t.tenant_id, t.revision, t.created_by, t.created_time, t.updated_by, t.updated_time, t.delete_by, t.delete_time, t.val_p1, t.val_p2, t.val_p3, t.val_p4, t.val_p5, t.val_p6, t.val_p7, t.val_p8, t.val_p9, t.val_p10, t.val_p11, t.val_p12, t.val_p13, t.val_p14, t.val_p15, t.val_p16, t.val_p17, t.val_p18, t.val_p19, t.val_p20, t.val_p21, t.val_p22, t.val_p23, t.val_p24, t.val_p25, t.val_p26, t.val_p27, t.val_p28, t.val_p29, t.val_p30, t.val_p31
from dc_busi_target_draft_day t
<if test="targetModelCode != null and targetModelCode != ''">
inner join dc_base_asset_target t1 on t.target_code = t1.target_code and t.asset_code = t1.asset_code and t1.target_model_code = #{targetModelCode}
</if>
<where>
<if test="companyId != null "> and company_id = #{companyId}</if>
<if test="orgId != null "> and org_id = #{orgId}</if>
@ -84,93 +89,130 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="getCorporateStatistics" parameterType="com.lzbi.bi.domain.CorporateStatisticsDTO" resultType="com.lzbi.bi.domain.CorporateStatisticsVO">
SELECT
(
SELECT
SUM( t1.val_accumulative )
FROM
dc_busi_target_draft_day t1
INNER JOIN dc_base_asset_target t2 ON t1.target_code = t2.target_code
AND t1.asset_code = t2.asset_code
AND t2.target_model_code = 'MJ01'
WHERE
t1.company_id = t.company_id
) AS "acreage",
(
SELECT
SUM( t1.val_accumulative )
FROM
dc_busi_target_draft_day t1
INNER JOIN dc_base_asset_target t2 ON t1.target_code = t2.target_code
AND t1.asset_code = t2.asset_code
AND t2.target_model_code = 'TM000FDL'
WHERE
t1.company_id = t.company_id
) AS "outputOfPlant",
(
SELECT
SUM( t1.val_accumulative )
FROM
dc_busi_target_draft_day t1
INNER JOIN dc_base_asset_target t2 ON t1.target_code = t2.target_code
AND t1.asset_code = t2.asset_code
AND t2.target_model_code = 'TM000FRL'
WHERE
t1.company_id = t.company_id
) AS "calorificValue",
(
SELECT
SUM( t1.val_accumulative )
FROM
dc_busi_target_draft_day t1
INNER JOIN dc_base_asset_target t2 ON t1.target_code = t2.target_code
AND t1.asset_code = t2.asset_code
AND t2.target_model_code = 'TM000GRL'
WHERE
t1.company_id = t.company_id
) AS "heatSupplied"
FROM
dc_busi_target_draft_day t
WHERE
t.company_id = #{companyId}
AND t.count_year = #{year}
AND t.count_month = #{month}
GROUP BY
t.company_id
</select>
<select id="getConsumesStatistics"
parameterType="com.lzbi.bi.domain.ConsumesStatisticsDTO"
resultType="com.lzbi.bi.domain.ConsumesStatisticsVO">
SELECT
t.org_name AS "label",
(SELECT SUM(t1.val_accumulative) FROM dc_busi_target_draft_day t1 INNER JOIN dc_base_asset_target t2 ON t1.target_code = t2.target_code AND t1.asset_code = t2.asset_code AND t2.target_model_code = #{electricityConsumes} WHERE t1.org_id = t.org_id) as "water",
(SELECT SUM(t1.val_accumulative) FROM dc_busi_target_draft_day t1 INNER JOIN dc_base_asset_target t2 ON t1.target_code = t2.target_code AND t1.asset_code = t2.asset_code AND t2.target_model_code = #{waterConsumes} WHERE t1.org_id = t.org_id) as "electricity",
(SELECT SUM(t1.val_accumulative) FROM dc_busi_target_draft_day t1 INNER JOIN dc_base_asset_target t2 ON t1.target_code = t2.target_code AND t1.asset_code = t2.asset_code AND t2.target_model_code = #{coalConsumes} WHERE t1.org_id = t.org_id) as "coal"
FROM
dc_busi_target_draft_day t
WHERE
t.company_id = #{companyId}
AND
t.count_year = #{year}
AND
t.count_month = #{month}
GROUP BY
t.org_id, t.org_name
</select>
<select id="selectProvideAnswerWaterAverageTemperatureList"
parameterType="com.lzbi.bi.domain.DcBusDataScreenNewReq"
parameterType="com.lzbi.bi.domain.ProvideAnswerWaterAverageTemperatureReq"
resultType="com.lzbi.bi.domain.ProvideAnswerWaterAverageTemperatureDTO">
SELECT
<choose>
<when test="orgId != null">
t1.asset_name AS "title",
</when>
<otherwise>
t1.org_name AS "title",
</otherwise>
</choose>
t1.provideWaterAverageTemperature,
t2.answerWaterAverageTemperature
FROM
(
SELECT
t.company_id,
t.company_name,
t.org_id,
t.org_name
<if test="orgId != null">
,t.asset_code
,t.asset_name
</if>
<choose>
<when test="day != null and day != ''">
,AVG( t.${day} ) AS "provideWaterAverageTemperature"
</when>
<otherwise>
,AVG( t.val_avg_null ) AS "provideWaterAverageTemperature"
</otherwise>
</choose>
FROM
`dc_busi_target_draft_day` t
INNER JOIN
dc_base_asset_target t1
on t.target_code = t1.target_code
and t.asset_code = t1.asset_code
and t1.target_model_code = #{provideWaterAverageTemperature}
WHERE
t.target_code = 'TM00039'
AND t.count_year = #{year}
t.count_year = #{year}
AND t.count_month = #{month}
AND t.company_id = #{companyId}
GROUP BY
t.company_id,
t.company_name,
t.org_id,
t.org_name
<if test="orgId != null">
,t.asset_code
,t.asset_name
</if>
) t1
LEFT JOIN (
SELECT
t.company_id,
t.company_name,
t.org_id,
t.org_name
<if test="orgId != null">
,t.asset_code
,t.asset_name
</if>
<choose>
<when test="day != null and day != ''">
,AVG( t.${day} ) AS "answerWaterAverageTemperature"
</when>
<otherwise>
,AVG( t.val_avg_null ) AS "answerWaterAverageTemperature"
</otherwise>
</choose>
FROM
`dc_busi_target_draft_day` t
INNER JOIN
dc_base_asset_target t1
on t.target_code = t1.target_code
and t.asset_code = t1.asset_code
and t1.target_model_code = #{answerWaterAverageTemperature}
WHERE
t.target_code = 'TM00040'
AND t.count_year = #{year}
t.count_year = #{year}
AND t.count_month = #{month}
AND t.company_id = #{companyId}
GROUP BY
t.company_id,
t.company_name,
t.org_id,
t.org_name
<if test="orgId != null">
,t.asset_code
,t.asset_name
</if>
) t2 ON t1.company_id = t2.company_id
AND t1.org_id = t2.org_id
<if test="orgId != null">
AND t1.asset_code = t2.asset_code
</if>
) t2 ON t1.org_id = t2.org_id
</select>
<select id="selectDcBusiTargetDraftDayById" parameterType="Long" resultMap="DcBusiTargetDraftDayResult">
@ -230,6 +272,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="targetUint != null">target_uint,</if>
<if test="countYear != null">count_year,</if>
<if test="countMonth != null">count_month,</if>
<if test="valAccumulative != null">val_accumulative,</if>
<if test="valSum != null">val_sum,</if>
<if test="valAvgAll != null">val_avg_all,</if>
<if test="valAvgNull != null">val_avg_null,</if>
@ -289,6 +332,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="targetUint != null">#{targetUint},</if>
<if test="countYear != null">#{countYear},</if>
<if test="countMonth != null">#{countMonth},</if>
<if test="valAccumulative != null">#{valAccumulative},</if>
<if test="valSum != null">#{valSum},</if>
<if test="valAvgAll != null">#{valAvgAll},</if>
<if test="valAvgNull != null">#{valAvgNull},</if>
@ -352,6 +396,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="targetUint != null">target_uint = #{targetUint},</if>
<if test="countYear != null">count_year = #{countYear},</if>
<if test="countMonth != null">count_month = #{countMonth},</if>
<if test="valAccumulative != null">val_accumulative = #{valAccumulative},</if>
<if test="valSum != null">val_sum = #{valSum},</if>
<if test="valAvgAll != null">val_avg_all = #{valAvgAll},</if>
<if test="valAvgNull != null">val_avg_null = #{valAvgNull},</if>
Loading…
Cancel
Save