change - 峰平谷耗量报表

main
yinq 5 months ago
parent d7ddafc370
commit 20ff254a9d

@ -7,6 +7,7 @@ import com.os.common.core.page.TableDataInfo;
import com.os.common.enums.BusinessType;
import com.os.common.utils.poi.ExcelUtil;
import com.os.ems.report.domain.EnergyStatisticalReport;
import com.os.ems.report.domain.PeaksValleysConsumptionReport;
import com.os.ems.report.service.IEmsReportPointDnbService;
import com.os.ems.report.service.IEmsReportService;
import org.springframework.beans.factory.annotation.Autowired;
@ -46,10 +47,32 @@ public class EmsReportController extends BaseController {
*
*/
@PostMapping("/energyStatisticalReportList/export" )
public void export(HttpServletResponse response, @RequestParam(required = false) Map hashMap) {
public void energyStatisticalReportListExport(HttpServletResponse response, @RequestParam(required = false) Map hashMap) {
List<EnergyStatisticalReport> list = emsReportService.energyStatisticalReportList(hashMap);
ExcelUtil<EnergyStatisticalReport> util = new ExcelUtil<>(EnergyStatisticalReport. class);
util.exportExcel(response, list, "统计能耗报表" );
}
/**
*
* @param hashMap
* @return
*/
@GetMapping("/peaksValleysConsumptionReportList")
public TableDataInfo peaksValleysConsumptionReportList(@RequestParam(required = false) Map hashMap) {
startPage();
List<PeaksValleysConsumptionReport> list = emsReportService.peaksValleysConsumptionReportList(hashMap);
return getDataTable(list);
}
/**
*
*/
@PostMapping("/peaksValleysConsumptionReportList/export" )
public void peaksValleysConsumptionReportListExport(HttpServletResponse response, @RequestParam(required = false) Map hashMap) {
List<PeaksValleysConsumptionReport> list = emsReportService.peaksValleysConsumptionReportList(hashMap);
ExcelUtil<PeaksValleysConsumptionReport> util = new ExcelUtil<>(PeaksValleysConsumptionReport. class);
util.exportExcel(response, list, "峰平谷耗量报表" );
}
}

@ -0,0 +1,113 @@
package com.os.ems.report.domain;
import com.os.common.annotation.Excel;
import com.os.common.core.domain.BaseEntity;
import java.math.BigDecimal;
/**
*
*
* @author Yinq
* @date 2023-10-12
*/
public class PeaksValleysConsumptionReport extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
@Excel(name = "统计单元编号")
private String workUnitCode;
/**
*
*/
@Excel(name = "统计单元名称")
private String workUnitName;
/**
*
*/
@Excel(name = "统计日期")
private String pointTime;
/**
*
*/
@Excel(name = "分时类型")
private String priceType;
/**
* (kwh)
*/
@Excel(name = "耗量(kwh)")
private BigDecimal expend;
/**
*
*/
@Excel(name = "价格")
private BigDecimal price;
public String getWorkUnitCode() {
return workUnitCode;
}
public void setWorkUnitCode(String workUnitCode) {
this.workUnitCode = workUnitCode;
}
public String getWorkUnitName() {
return workUnitName;
}
public void setWorkUnitName(String workUnitName) {
this.workUnitName = workUnitName;
}
public String getPointTime() {
return pointTime;
}
public void setPointTime(String pointTime) {
this.pointTime = pointTime;
}
public String getPriceType() {
return priceType;
}
public void setPriceType(String priceType) {
this.priceType = priceType;
}
public BigDecimal getExpend() {
return expend;
}
public void setExpend(BigDecimal expend) {
this.expend = expend;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
@Override
public String toString() {
return "PeaksValleysConsumptionReport{" +
"workUnitCode='" + workUnitCode + '\'' +
", workUnitName='" + workUnitName + '\'' +
", pointTime='" + pointTime + '\'' +
", priceType='" + priceType + '\'' +
", expend=" + expend +
'}';
}
}

@ -2,6 +2,7 @@ package com.os.ems.report.mapper;
import com.os.ems.report.domain.EnergyStatisticalReport;
import com.os.ems.report.domain.PeaksValleysConsumptionReport;
import java.util.List;
import java.util.Map;
@ -21,4 +22,11 @@ public interface EmsReportMapper
* @return
*/
List<EnergyStatisticalReport> energyStatisticalReportList(Map hashMap);
/**
*
* @param hashMap
* @return
*/
List<PeaksValleysConsumptionReport> peaksValleysConsumptionReportList(Map hashMap);
}

@ -2,6 +2,7 @@ package com.os.ems.report.service;
import com.os.ems.report.domain.EnergyStatisticalReport;
import com.os.ems.report.domain.PeaksValleysConsumptionReport;
import java.util.List;
import java.util.Map;
@ -20,4 +21,11 @@ public interface IEmsReportService {
* @return
*/
List<EnergyStatisticalReport> energyStatisticalReportList(Map hashMap);
/**
*
* @param hashMap
* @return
*/
List<PeaksValleysConsumptionReport> peaksValleysConsumptionReportList(Map hashMap);
}

@ -1,6 +1,7 @@
package com.os.ems.report.service.impl;
import com.os.ems.report.domain.EnergyStatisticalReport;
import com.os.ems.report.domain.PeaksValleysConsumptionReport;
import com.os.ems.report.mapper.EmsReportMapper;
import com.os.ems.report.service.IEmsReportService;
import org.springframework.beans.factory.annotation.Autowired;
@ -35,4 +36,14 @@ public class EmsReportServiceImpl implements IEmsReportService {
hashMap.put("timeSub", Integer.parseInt(String.valueOf(hashMap.get("dateType"))));
return emsReportMapper.energyStatisticalReportList(hashMap);
}
/**
*
* @param hashMap
* @return
*/
@Override
public List<PeaksValleysConsumptionReport> peaksValleysConsumptionReportList(Map hashMap) {
return emsReportMapper.peaksValleysConsumptionReportList(hashMap);
}
}

@ -26,4 +26,38 @@
GROUP BY WU.WORK_UNIT_CODE, WU.WORK_UNIT_NAME, SUBSTRING(FORMAT(RPD.BEGIN_TIME, 'yyyy-MM-dd HH:mm:ss'), 1, DT.TIMESUB)
ORDER BY beginTime, workUnitCode
</select>
<select id="peaksValleysConsumptionReportList"
resultType="com.os.ems.report.domain.PeaksValleysConsumptionReport" parameterType="java.util.HashMap">
SELECT ebwu.work_unit_code workUnitCode, ebwu.work_unit_name workUnitName,
dnb.pointTime, dnb.priceType, sum(expend) expend,
sum(expend * dnb_price) price
FROM (
SELECT erpd.monitor_code,
CONVERT(VARCHAR(10), erpd.begin_time, 120) pointTime,
NULLIF(erpd.expend, 0) expend,
case
when ebsp.price_type = 0 then '尖峰'
when ebsp.price_type = 1 then '高峰'
when ebsp.price_type = 2 then '平段'
when ebsp.price_type = 3 then '低谷'
when ebsp.price_type = 4 then '深谷' END priceType,
ebsp.dnb_price
FROM ems_report_point_dnb erpd
join ems_base_share_price ebsp
on LEFT(CONVERT(VARCHAR, erpd.begin_time, 23), 7) = ebsp.year_month_date
and CAST(erpd.begin_time AS time) >= CAST(ebsp.start_hour AS time)
and CAST(erpd.begin_time AS time) &lt; CAST(ebsp.end_hour AS time)
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
WHERE FORMAT(erpd.begin_time, 'yyyy-MM-dd') between #{beginCollectTime} and #{endCollectTime}
</if>
) dnb
LEFT JOIN ems_base_monitor_info ebmi on ebmi.monitor_code = dnb.monitor_code
LEFT JOIN ems_base_monitor_work_unit ebmwu on ebmi.monitor_code = ebmwu.monitor_code
LEFT JOIN ems_base_work_unit ebwu on ebwu.work_unit_code = ebmwu.work_unit_code
WHERE 1=1
<if test="workUnitCode != null and workUnitCode != ''">and ebwu.WORK_UNIT_CODE = #{workUnitCode}</if>
GROUP BY ebwu.work_unit_code, ebwu.work_unit_name, dnb.pointTime, dnb.priceType
ORDER BY ebwu.work_unit_code, ebwu.work_unit_name, dnb.pointTime, dnb.priceType
</select>
</mapper>
Loading…
Cancel
Save