change - add统计能耗报表

master
yinq 6 months ago
parent d3f66e9127
commit fdc6c881cc

@ -1,19 +1,15 @@
package com.aucma.report.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.aucma.common.utils.DateUtils;
import com.aucma.report.domain.EnergyStatisticalReport;
import com.aucma.report.domain.ProductTraceabilityReport;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.aucma.common.annotation.Log;
import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult;
@ -100,4 +96,26 @@ public class ReportDayDnbController extends BaseController {
public AjaxResult remove(@PathVariable Long[] objIds) {
return toAjax(reportDayDnbService.deleteReportDayDnbByObjIds(objIds));
}
/**
*
* @param hashMap
* @return
*/
@GetMapping("/energyStatisticalReportList")
public TableDataInfo energyStatisticalReportList(@RequestParam(required = false) Map hashMap) {
startPage();
List<EnergyStatisticalReport> list = reportDayDnbService.energyStatisticalReportList(hashMap);
return getDataTable(list);
}
/**
*
*/
@PostMapping("/energyStatisticalReportList/export" )
public void export(HttpServletResponse response, @RequestParam(required = false) Map hashMap) {
List<EnergyStatisticalReport> list = reportDayDnbService.energyStatisticalReportList(hashMap);
ExcelUtil<EnergyStatisticalReport> util = new ExcelUtil<>(EnergyStatisticalReport. class);
util.exportExcel(response, list, "统计能耗报表" );
}
}

@ -0,0 +1,113 @@
package com.aucma.report.domain;
import com.aucma.common.annotation.Excel;
import com.aucma.common.core.domain.BaseEntity;
import java.math.BigDecimal;
/**
*
*
* @author Yinq
* @date 2023-10-12
*/
public class EnergyStatisticalReport extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
@Excel(name = "统计单元编号")
private String workUnitCode;
/**
*
*/
@Excel(name = "统计单元名称")
private String workUnitName;
/**
* (kwh)
*/
@Excel(name = "耗量(kwh)")
private BigDecimal expend;
/**
*
*/
@Excel(name = "开始日期")
private String beginTime;
/**
*
*/
@Excel(name = "结束日期")
private String endTime;
/**
* (kwh)
*/
@Excel(name = "仪表值(kwh)")
private BigDecimal instrumentValue;
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 BigDecimal getInstrumentValue() {
return instrumentValue;
}
public void setInstrumentValue(BigDecimal instrumentValue) {
this.instrumentValue = instrumentValue;
}
public BigDecimal getExpend() {
return expend;
}
public void setExpend(BigDecimal expend) {
this.expend = expend;
}
public String getBeginTime() {
return beginTime;
}
public void setBeginTime(String beginTime) {
this.beginTime = beginTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
@Override
public String toString() {
return "EnergyStatisticalReport{" +
"workUnitCode='" + workUnitCode + '\'' +
", workUnitName='" + workUnitName + '\'' +
", instrumentValue=" + instrumentValue +
", expend=" + expend +
", beginTime='" + beginTime + '\'' +
", endTime='" + endTime + '\'' +
'}';
}
}

@ -1,6 +1,9 @@
package com.aucma.report.mapper;
import java.util.List;
import java.util.Map;
import com.aucma.report.domain.EnergyStatisticalReport;
import com.aucma.report.domain.ReportDayDnb;
/**
@ -58,4 +61,11 @@ public interface ReportDayDnbMapper
* @return
*/
public int deleteReportDayDnbByObjIds(Long[] objIds);
/**
*
* @param hashMap
* @return
*/
List<EnergyStatisticalReport> energyStatisticalReportList(Map hashMap);
}

@ -1,6 +1,10 @@
package com.aucma.report.service;
import java.util.List;
import java.util.Map;
import com.aucma.report.domain.EnergyStatisticalReport;
import com.aucma.report.domain.ProductTraceabilityReport;
import com.aucma.report.domain.ReportDayDnb;
/**
@ -58,4 +62,11 @@ public interface IReportDayDnbService
* @return
*/
public int deleteReportDayDnbByObjId(Long objId);
/**
*
* @param hashMap
* @return
*/
List<EnergyStatisticalReport> energyStatisticalReportList(Map hashMap);
}

@ -1,6 +1,9 @@
package com.aucma.report.service.impl;
import java.util.List;
import java.util.Map;
import com.aucma.report.domain.EnergyStatisticalReport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aucma.report.mapper.ReportDayDnbMapper;
@ -90,4 +93,18 @@ public class ReportDayDnbServiceImpl implements IReportDayDnbService
{
return reportDayDnbMapper.deleteReportDayDnbByObjId(objId);
}
/**
*
* @param hashMap
* @return
*/
@Override
public List<EnergyStatisticalReport> energyStatisticalReportList(Map hashMap) {
if (!hashMap.containsKey("dateType")){
return null;
}
hashMap.put("timeSub", Integer.parseInt(String.valueOf(hashMap.get("dateType"))));
return reportDayDnbMapper.energyStatisticalReportList(hashMap);
}
}

@ -122,4 +122,26 @@
#{objId}
</foreach>
</delete>
<select id="energyStatisticalReportList" resultType="com.aucma.report.domain.EnergyStatisticalReport"
parameterType="java.util.HashMap">
WITH DT AS (SELECT #{timeSub} TIMESUB FROM DUAL)
SELECT WU.WORK_UNIT_CODE workUnitCode,
WU.WORK_UNIT_NAME workUnitName,
MAX(RPD.INSTRUMENT_VALUE) instrumentValue,
SUM(RPD.EXPEND) expend,
SUBSTR(RPD.BEGIN_TIME, 1, DT.TIMESUB) beginTime,
SUBSTR(RPD.BEGIN_TIME, 1, DT.TIMESUB) endTime
FROM BASE_WORK_UNIT WU
LEFT JOIN BASE_MONITOR_WORK_UNIT MWU ON MWU.WORK_UNIT_CODE = WU.WORK_UNIT_CODE
LEFT JOIN REPORT_POINT_DNB RPD ON RPD.MONITOR_CODE = MWU.MONITOR_CODE
CROSS JOIN DT
WHERE RPD.EXPEND IS NOT NULL
<if test="beginCollectTime != null and beginCollectTime != '' and endCollectTime != null and endCollectTime != ''">
and SUBSTR(RPD.begin_time, 1, 10) between #{beginCollectTime} and #{endCollectTime}
</if>
<if test="workUnitCode != null and workUnitCode != ''">and WU.WORK_UNIT_CODE = #{workUnitCode}</if>
GROUP BY WU.WORK_UNIT_CODE, WU.WORK_UNIT_NAME, SUBSTR(RPD.BEGIN_TIME, 1, DT.TIMESUB)
ORDER BY beginTime, workUnitCode
</select>
</mapper>
Loading…
Cancel
Save