README.md | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
readme/img/image-yc.png | 补丁 | 查看 | 原始文档 | blame | 历史 | |
readme/img/image-zhuoyue.png | 补丁 | 查看 | 原始文档 | blame | 历史 | |
readme/logo-chinese.png | 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhitan-admin/src/main/java/com/zhitan/web/controller/keyequipment/DailyKeyEquipmenteController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhitan-admin/src/main/java/com/zhitan/web/controller/keyequipment/MonthlyKeyEquipmentController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhitan-admin/src/main/java/com/zhitan/web/controller/keyequipment/YearKeyEquipmentController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
README.md
@@ -3,9 +3,13 @@ </div> <h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">智碳能源管理系统</h1> <p align="center">基于SpringBoot和若依框架开发</p> <p align="center">能碳平台后台展示&接口已完全开源,代码完备,功能齐全,运行正常</p> <p align="center">数采和数据清洗部分网上开源的库很多,学习者可以参考友商集成</p> <p align="center"><span style="color: red;">通过本项目,学习者可以掌握能源管理行业的功能和业务,以及技术架构。</span></p> <p align="center"> <a href='https://gitee.com/zhitan-ems/zhitan-ems/stargazers'><img src='https://gitee.com/zhitan-ems/zhitan-ems/badge/star.svg?theme=dark' alt='star'></img></a> <a href='https://gitee.com/zhitan-ems/zhitan-ems/members'><img src='https://gitee.com/zhitan-ems/zhitan-ems/badge/fork.svg?theme=dark' alt='fork'></img></a> <a href='https://gitee.com/liulingling1993/zhitan-ems/stargazers'><img src='https://gitee.com/liulingling1993/zhitan-ems/badge/star.svg?theme=dark' alt='star'></img></a> <a href='https://gitee.com/liulingling1993/zhitan-ems/members'><img src='https://gitee.com/liulingling1993/zhitan-ems/badge/fork.svg?theme=dark' alt='fork'></img></a> </p> ## 介绍 @@ -14,7 +18,17 @@ 针对客户场景:政府、园区、企业、工矿、公共建筑等。 ## 请大家有问题提issue吧。。。 ## 【注意】完整能碳管理平台包含三个部分,<span style="color: red;">本仓库只包含能碳平台展示端</span> ##### 能碳平台展示端:<span style="color: red;">也即本项目能碳平台后台展示部分,代码完备,运行正常。通过本项目,学习者可以掌握能源管理行业的功能和业务,以及技术架构。</span> ##### 数据采集程序:也即mqtt➡️时序库功能,市面上开源库非常多,可参考thingsjs等知名项目,或者自己用netty自己实现。 ##### 数据清洗服务:也即时序库➡️关系库,学习者可以使用java自带的XXL job等计划任务工具自己按照业务功能,来实现数据清洗服务。 ## 关于问题答疑 ##### 因总是有人恶意举报我们仓库,说我们做商业推广,顾我已经删除了所有联系方式和交流群 ##### 演示demo、logo、截图等也换成了中性的名字,去掉了所有有可能涉及到涉嫌推广的字眼(我们也不知道git被举报的规则是什么。。。) ##### 所以大家如果有问题,提issue吧。。。 ## ## 在线体验 readme/img/image-yc.png
readme/img/image-zhuoyue.pngreadme/logo-chinese.pngzhitan-admin/src/main/java/com/zhitan/web/controller/keyequipment/DailyKeyEquipmenteController.java
@@ -3,7 +3,6 @@ import com.zhitan.basicdata.domain.FacilityArchives; import com.zhitan.common.core.controller.BaseController; import com.zhitan.common.core.domain.AjaxResult; import com.zhitan.common.core.page.TableDataInfo; import com.zhitan.keyequipment.domain.DailyKeyEquipment; import com.zhitan.keyequipment.service.IDailyKeyEquipmentService; import com.zhitan.model.domain.EnergyIndex; @@ -43,14 +42,14 @@ @GetMapping("/list") @ApiOperation(value = "重点设备能耗分析(日)列表") public TableDataInfo list(DataItem dataItem) throws ParseException { public AjaxResult list(DataItem dataItem) throws ParseException { List<ModelNode> nodeId = modelNodeService.getModelNodeByModelCode(dataItem.getIndexCode()); if(CollectionUtils.isEmpty(nodeId)){ return getDataTable(new ArrayList<>()); return success(new ArrayList<>()); } List<EnergyIndex> energyList = modelNodeService.getSettingIndex(nodeId.get(0).getNodeId()); if(CollectionUtils.isEmpty(energyList)){ return getDataTable(new ArrayList<>()); return success(new ArrayList<>()); } List<String> indexIds = energyList.stream().map(EnergyIndex::getIndexId).collect(Collectors.toList()); List<DailyKeyEquipment> dataList=new ArrayList<>(); @@ -74,9 +73,10 @@ dataList.add(report); i++; }; startPage(); List<DailyKeyEquipment> list = dailykeyEquipment.getdailyKeyEquipmentList(indexIds, dataList,dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getEnergyType()); return getDataTable(list); return success(list); } @GetMapping("/listChart") @@ -93,7 +93,7 @@ } /*所有设备*/ @GetMapping("/getFacilityArchives") @ApiOperation(value = "查询所有设备列表") @ApiOperation(value = "查询重点设备列表") public AjaxResult getFacilityArchives() { try { List<FacilityArchives> list=dailykeyEquipment.getFacilityArchives(); zhitan-admin/src/main/java/com/zhitan/web/controller/keyequipment/MonthlyKeyEquipmentController.java
@@ -1,7 +1,6 @@ package com.zhitan.web.controller.keyequipment; import com.github.pagehelper.PageInfo; import com.zhitan.common.core.controller.BaseController; import com.zhitan.common.core.domain.AjaxResult; import com.zhitan.keyequipment.domain.MonthlyKeyEquipment; @@ -25,14 +24,14 @@ import java.util.stream.Collectors; /** *重点设备能耗统计 月 * 重点设备能耗统计 月 * * @author sys * @date 2021-01-11 */ @RestController @RequestMapping("/keyEquipment/MonthlyKeyEquipment") @Api(value = "重点设备能耗统计(月)",tags = {"设备单耗分析"}) @Api(value = "重点设备能耗统计(月)", tags = {"设备单耗分析"}) public class MonthlyKeyEquipmentController extends BaseController { @Autowired @@ -42,59 +41,49 @@ @GetMapping("/list") @ApiOperation(value = "重点设备能耗统计(月)列表") public AjaxResult list(DataItem dataItem) { try { List<MonthlyKeyEquipment> dataList=new ArrayList<>(); public AjaxResult list(DataItem dataItem) throws ParseException { List<MonthlyKeyEquipment> dataList = new ArrayList<>(); Map tableColumn =new HashMap<>();//表数据 DateFormat df = new SimpleDateFormat("yyyy-MM"); SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String aa= df.format(dataItem.getDataTime()); String bb=""; int i = 1; String beginTime=aa+"-01 00:00:00"; dataItem.setBeginTime(sf.parse(beginTime)); String endTime=aa+"-"+Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length()-2))+" 00:00:00"; dataItem.setEndTime(sf.parse(endTime)); while (i <= Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length()-2))) { if(i>9){ bb=aa+"-"+i+" 00:00:00"; }else{ bb=aa+"-0"+i+" 00:00:00"; } MonthlyKeyEquipment report=new MonthlyKeyEquipment(); report.setDataTime(sf.parse(bb)); report.setValue("value"+i); dataList.add(report); tableColumn.put("value"+i,String.valueOf(i)+"日"); i++; Map tableColumn = new HashMap<>();//表数据 DateFormat df = new SimpleDateFormat("yyyy-MM"); SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String aa = df.format(dataItem.getDataTime()); String bb = ""; int i = 1; String beginTime = aa + "-01 00:00:00"; dataItem.setBeginTime(sf.parse(beginTime)); String endTime = aa + "-" + Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2)) + " 00:00:00"; dataItem.setEndTime(sf.parse(endTime)); while (i <= Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2))) { if (i > 9) { bb = aa + "-" + i + " 00:00:00"; } else { bb = aa + "-0" + i + " 00:00:00"; } List<Map> table=new ArrayList<>(); MonthlyKeyEquipment reportList =new MonthlyKeyEquipment(); table.add(tableColumn); reportList.setTablehead(table); List<ModelNode> nodeId = modelNodeService.getModelNodeByModelCode(dataItem.getIndexCode()); if(CollectionUtils.isEmpty(nodeId)){ return AjaxResult.success(reportList); } List<EnergyIndex> energyList = modelNodeService.getSettingIndex(nodeId.get(0).getNodeId()); if(CollectionUtils.isEmpty(energyList)){ return AjaxResult.success(reportList); } List<String> indexIds = energyList.stream().map(EnergyIndex::getIndexId).collect(Collectors.toList()); startPage(); List<MonthlyKeyEquipment> list = monthlyKeyEquipmentService.getMonthlyKeyEquipmentList(indexIds, dataList,dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getEnergyType()); int count=Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length()-2)); list.forEach(monthlyReport -> monthlyReport.setCount(count)); reportList.setTabledata(list); reportList.setTotal(new PageInfo(list).getTotal()); return AjaxResult.success(reportList); } catch (Exception ex) { logger.error("获取出错!", ex); return AjaxResult.error("获取出错!"); MonthlyKeyEquipment report = new MonthlyKeyEquipment(); report.setDataTime(sf.parse(bb)); report.setValue("value" + i); dataList.add(report); tableColumn.put("value" + i, String.valueOf(i) + "日"); i++; } List<Map> table = new ArrayList<>(); MonthlyKeyEquipment reportList = new MonthlyKeyEquipment(); table.add(tableColumn); reportList.setTablehead(table); List<ModelNode> nodeId = modelNodeService.getModelNodeByModelCode(dataItem.getIndexCode()); if (CollectionUtils.isEmpty(nodeId)) { return success(new ArrayList<>()); } List<EnergyIndex> energyList = modelNodeService.getSettingIndex(nodeId.get(0).getNodeId()); if (CollectionUtils.isEmpty(energyList)) { return success(new ArrayList<>()); } List<String> indexIds = energyList.stream().map(EnergyIndex::getIndexId).collect(Collectors.toList()); List<MonthlyKeyEquipment> list = monthlyKeyEquipmentService.getMonthlyKeyEquipmentList(indexIds, dataList, dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(), dataItem.getEnergyType()); return success(list); } @GetMapping("/listChart") @@ -102,14 +91,15 @@ public AjaxResult listChart(DataItem dataItem) throws ParseException { DateFormat df = new SimpleDateFormat("yyyy-MM"); SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String aa= df.format(dataItem.getDataTime()); String beginTime=aa+"-01 00:00:00"; String aa = df.format(dataItem.getDataTime()); String beginTime = aa + "-01 00:00:00"; dataItem.setBeginTime(sf.parse(beginTime)); String endTime=aa+"-"+Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length()-2))+" 00:00:00"; String endTime = aa + "-" + Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2)) + " 00:00:00"; dataItem.setEndTime(sf.parse(endTime)); List<MonthlyKeyEquipment> list = monthlyKeyEquipmentService.getListChart(dataItem.getIndexId(),dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getEnergyType()); List<MonthlyKeyEquipment> list = monthlyKeyEquipmentService.getListChart(dataItem.getIndexId(), dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(), dataItem.getEnergyType()); return AjaxResult.success(list); } public static String getLastDayOfMonth(String yearMonth) { int year = Integer.parseInt(yearMonth.split("-")[0]); //年 int month = Integer.parseInt(yearMonth.split("-")[1]); //月 zhitan-admin/src/main/java/com/zhitan/web/controller/keyequipment/YearKeyEquipmentController.java
@@ -3,7 +3,6 @@ import cn.hutool.core.date.DateUtil; import com.zhitan.common.core.controller.BaseController; import com.zhitan.common.core.domain.AjaxResult; import com.zhitan.common.core.page.TableDataInfo; import com.zhitan.keyequipment.domain.YearKeyEquipment; import com.zhitan.keyequipment.service.IYearKeyEquipmentService; import com.zhitan.model.domain.EnergyIndex; @@ -43,14 +42,14 @@ @GetMapping("/list") @ApiOperation(value = "重点设备能耗统计(年)列表") public TableDataInfo list(DataItem dataItem) throws ParseException { public AjaxResult list(DataItem dataItem) throws ParseException { List<ModelNode> nodeId = modelNodeService.getModelNodeByModelCode(dataItem.getIndexCode()); if(CollectionUtils.isEmpty(nodeId)){ return getDataTable(new ArrayList<>()); return success(new ArrayList<>()); } List<EnergyIndex> energyList = modelNodeService.getSettingIndex(nodeId.get(0).getNodeId()); if(CollectionUtils.isEmpty(energyList)){ return getDataTable(new ArrayList<>()); return success(new ArrayList<>()); } List<String> indexIds = energyList.stream().map(EnergyIndex::getIndexId).collect(Collectors.toList()); List<YearKeyEquipment> dataList=new ArrayList<>(); @@ -75,9 +74,9 @@ dataList.add(report); i++; } startPage(); List<YearKeyEquipment> list = yearKeyEquipmentService.getYearKeyEquipmentList(indexIds, dataList,dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getEnergyType()); return getDataTable(list); return success(list); } @GetMapping("/listChart")