From 26a50f50f4f49b28e5d554de39fc9f41019ca867 Mon Sep 17 00:00:00 2001 From: yinq Date: Wed, 5 Jun 2024 15:58:19 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20add=E6=97=A5=E6=9C=88=E5=B9=B4?= =?UTF-8?q?=E8=83=BD=E8=80=97=E7=BB=9F=E8=AE=A1=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/EmsReportController.java | 55 +++++++++ .../domain/EnergyStatisticalReport.java | 114 ++++++++++++++++++ .../os/ems/report/mapper/EmsReportMapper.java | 24 ++++ .../ems/report/service/IEmsReportService.java | 23 ++++ .../service/impl/EmsReportServiceImpl.java | 38 ++++++ .../mapper/ems/report/EmsReportMapper.xml | 29 +++++ 6 files changed, 283 insertions(+) create mode 100644 os-ems/src/main/java/com/os/ems/report/controller/EmsReportController.java create mode 100644 os-ems/src/main/java/com/os/ems/report/domain/EnergyStatisticalReport.java create mode 100644 os-ems/src/main/java/com/os/ems/report/mapper/EmsReportMapper.java create mode 100644 os-ems/src/main/java/com/os/ems/report/service/IEmsReportService.java create mode 100644 os-ems/src/main/java/com/os/ems/report/service/impl/EmsReportServiceImpl.java create mode 100644 os-ems/src/main/resources/mapper/ems/report/EmsReportMapper.xml diff --git a/os-ems/src/main/java/com/os/ems/report/controller/EmsReportController.java b/os-ems/src/main/java/com/os/ems/report/controller/EmsReportController.java new file mode 100644 index 0000000..dc35ec8 --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/report/controller/EmsReportController.java @@ -0,0 +1,55 @@ +package com.os.ems.report.controller; + +import com.os.common.annotation.Log; +import com.os.common.core.controller.BaseController; +import com.os.common.core.domain.AjaxResult; +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.service.IEmsReportPointDnbService; +import com.os.ems.report.service.IEmsReportService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * import java.util.List;Controller + * + * @author Yinq + * @date 2024-05-22 + */ +@RestController +@RequestMapping("/ems/report") +public class EmsReportController extends BaseController { + + @Autowired + private IEmsReportService emsReportService; + + /** + * 统计能耗报表 + * @param hashMap + * @return + */ + @GetMapping("/energyStatisticalReportList") + public TableDataInfo energyStatisticalReportList(@RequestParam(required = false) Map hashMap) { + startPage(); + List list = emsReportService.energyStatisticalReportList(hashMap); + return getDataTable(list); + } + + /** + * 导出统计能耗报表 + */ + @PostMapping("/energyStatisticalReportList/export" ) + public void export(HttpServletResponse response, @RequestParam(required = false) Map hashMap) { + List list = emsReportService.energyStatisticalReportList(hashMap); + ExcelUtil util = new ExcelUtil<>(EnergyStatisticalReport. class); + util.exportExcel(response, list, "统计能耗报表" ); + } + +} diff --git a/os-ems/src/main/java/com/os/ems/report/domain/EnergyStatisticalReport.java b/os-ems/src/main/java/com/os/ems/report/domain/EnergyStatisticalReport.java new file mode 100644 index 0000000..ee2ef18 --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/report/domain/EnergyStatisticalReport.java @@ -0,0 +1,114 @@ +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 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 + '\'' + + '}'; + } +} diff --git a/os-ems/src/main/java/com/os/ems/report/mapper/EmsReportMapper.java b/os-ems/src/main/java/com/os/ems/report/mapper/EmsReportMapper.java new file mode 100644 index 0000000..76f659a --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/report/mapper/EmsReportMapper.java @@ -0,0 +1,24 @@ +package com.os.ems.report.mapper; + + +import com.os.ems.report.domain.EnergyStatisticalReport; + +import java.util.List; +import java.util.Map; + +/** + * 能源报表Mapper接口 + * + * @author Yinq + * @date 2024-05-22 + */ +public interface EmsReportMapper +{ + + /** + * 统计能耗报表 + * @param hashMap + * @return + */ + List energyStatisticalReportList(Map hashMap); +} diff --git a/os-ems/src/main/java/com/os/ems/report/service/IEmsReportService.java b/os-ems/src/main/java/com/os/ems/report/service/IEmsReportService.java new file mode 100644 index 0000000..47c686a --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/report/service/IEmsReportService.java @@ -0,0 +1,23 @@ +package com.os.ems.report.service; + + +import com.os.ems.report.domain.EnergyStatisticalReport; + +import java.util.List; +import java.util.Map; + +/** + * 能源报表Service接口 + * + * @author Yinq + * @date 2024-05-22 + */ +public interface IEmsReportService { + + /** + * 统计能耗报表 + * @param hashMap + * @return + */ + List energyStatisticalReportList(Map hashMap); +} diff --git a/os-ems/src/main/java/com/os/ems/report/service/impl/EmsReportServiceImpl.java b/os-ems/src/main/java/com/os/ems/report/service/impl/EmsReportServiceImpl.java new file mode 100644 index 0000000..a9a3a59 --- /dev/null +++ b/os-ems/src/main/java/com/os/ems/report/service/impl/EmsReportServiceImpl.java @@ -0,0 +1,38 @@ +package com.os.ems.report.service.impl; + +import com.os.ems.report.domain.EnergyStatisticalReport; +import com.os.ems.report.mapper.EmsReportMapper; +import com.os.ems.report.service.IEmsReportService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + + +/** + * 能源报表Service业务层处理 + * + * @author Yinq + * @date 2024-05-22 + */ +@Service +public class EmsReportServiceImpl implements IEmsReportService { + @Autowired + private EmsReportMapper emsReportMapper; + + + /** + * 统计能耗报表 + * @param hashMap + * @return + */ + @Override + public List energyStatisticalReportList(Map hashMap) { + if (!hashMap.containsKey("dateType")){ + return null; + } + hashMap.put("timeSub", Integer.parseInt(String.valueOf(hashMap.get("dateType")))); + return emsReportMapper.energyStatisticalReportList(hashMap); + } +} diff --git a/os-ems/src/main/resources/mapper/ems/report/EmsReportMapper.xml b/os-ems/src/main/resources/mapper/ems/report/EmsReportMapper.xml new file mode 100644 index 0000000..9248b3d --- /dev/null +++ b/os-ems/src/main/resources/mapper/ems/report/EmsReportMapper.xml @@ -0,0 +1,29 @@ + + + + + + + \ No newline at end of file