kangwei:节能环保大屏数据展示
正在显示
9 个修改的文件
包含
125 行增加
和
114 行删除
... | @@ -345,6 +345,27 @@ public class JSUtils { | ... | @@ -345,6 +345,27 @@ public class JSUtils { |
345 | return result; | 345 | return result; |
346 | } | 346 | } |
347 | 347 | ||
348 | /*** | ||
349 | * 分割字符串,然后拼接 | ||
350 | * @param str 带分隔字符串 | ||
351 | * @param splitStr 分割符号 | ||
352 | * @return | ||
353 | */ | ||
354 | public static String quoteEach(String str,String splitStr) { | ||
355 | if( str != null && str.length() > 0 ){ | ||
356 | String[] items = str.split(splitStr); | ||
357 | StringBuilder sb = new StringBuilder(); | ||
358 | for (int i = 0; i < items.length; i++) { | ||
359 | if (i > 0) { | ||
360 | sb.append(", "); | ||
361 | } | ||
362 | sb.append('\'').append(items[i]).append('\''); | ||
363 | } | ||
364 | return sb.toString(); | ||
365 | } | ||
366 | return str; | ||
367 | } | ||
368 | |||
348 | /* ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript"); | 369 | /* ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript"); |
349 | Object eval = null; | 370 | Object eval = null; |
350 | try { | 371 | try { | ... | ... |
... | @@ -361,7 +361,6 @@ public class SysCommandCentreController { | ... | @@ -361,7 +361,6 @@ public class SysCommandCentreController { |
361 | @GetMapping("/getCLSLXQ") | 361 | @GetMapping("/getCLSLXQ") |
362 | public Result<List<WaterTreatmentVO>> getCLSLXQ(@RequestParam(name = "time", required = true)String time){ | 362 | public Result<List<WaterTreatmentVO>> getCLSLXQ(@RequestParam(name = "time", required = true)String time){ |
363 | Result<List<WaterTreatmentVO>> result = new Result<>(); | 363 | Result<List<WaterTreatmentVO>> result = new Result<>(); |
364 | //String departIds = "1818215093192753152,1818214519948836864,1818214145808531456"; | ||
365 | List<WaterTreatmentVO> waterTrendVOList = commandCentreService.statisticsCLSLXQ(time, BaseContextHandler.getDeparts()); | 364 | List<WaterTreatmentVO> waterTrendVOList = commandCentreService.statisticsCLSLXQ(time, BaseContextHandler.getDeparts()); |
366 | result.setResult(waterTrendVOList ); | 365 | result.setResult(waterTrendVOList ); |
367 | return result; | 366 | return result; | ... | ... |
... | @@ -175,7 +175,6 @@ public class CommandCentreServiceImpl implements ICommandCentreService { | ... | @@ -175,7 +175,6 @@ public class CommandCentreServiceImpl implements ICommandCentreService { |
175 | 175 | ||
176 | long differenceDay = DateUtils.differenceDay(dateVO.getNowMonthStartDate(), dateVO.getNowMonthEndDate()); | 176 | long differenceDay = DateUtils.differenceDay(dateVO.getNowMonthStartDate(), dateVO.getNowMonthEndDate()); |
177 | String departIdssss = BaseUtil.quoteEach(departIds , ","); | 177 | String departIdssss = BaseUtil.quoteEach(departIds , ","); |
178 | System.out.println("departIds = "+departIds); | ||
179 | //String factorySql = "select fi.depart_id ,d.depart_name, fi.pro_scale*10000 'pro_scale' from sys_factory_info fi , sys_depart d where fi.depart_id = d.id and d.depart_type =1 and d.id in("+departIdssss+")"; | 178 | //String factorySql = "select fi.depart_id ,d.depart_name, fi.pro_scale*10000 'pro_scale' from sys_factory_info fi , sys_depart d where fi.depart_id = d.id and d.depart_type =1 and d.id in("+departIdssss+")"; |
180 | String factorySql = "select group_concat(fi.depart_id) from sys_factory_info fi , sys_depart d where fi.depart_id = d.id and d.depart_type =1 and d.id in("+departIdssss+")"; | 179 | String factorySql = "select group_concat(fi.depart_id) from sys_factory_info fi , sys_depart d where fi.depart_id = d.id and d.depart_type =1 and d.id in("+departIdssss+")"; |
181 | //水厂部门编号集合 | 180 | //水厂部门编号集合 | ... | ... |
... | @@ -45,12 +45,12 @@ public class ReportItemVO { | ... | @@ -45,12 +45,12 @@ public class ReportItemVO { |
45 | */ | 45 | */ |
46 | 46 | ||
47 | public String getValueTbBl() { | 47 | public String getValueTbBl() { |
48 | valueTbBl = JSUtils.executeExpression("("+this.getValue() + " - " + this.getValueTb() + ") / " +this.getValueTb(),"0.00") ; | 48 | valueTbBl = JSUtils.executeExpression("("+this.getValue() + " - " + this.getValueTb() + ") *100/ " +this.getValueTb(),"0.00") ; |
49 | return valueTbBl; | 49 | return valueTbBl; |
50 | } | 50 | } |
51 | 51 | ||
52 | public String getValueHbBl() { | 52 | public String getValueHbBl() { |
53 | valueHbBl = JSUtils.executeExpression("("+this.getValue() + " - " + this.getValueHb() + ") / " +this.getValueHb(),"0.00") ; | 53 | valueHbBl = JSUtils.executeExpression("("+this.getValue() + " - " + this.getValueHb() + ")*100/ " +this.getValueHb(),"0.00") ; |
54 | return valueHbBl; | 54 | return valueHbBl; |
55 | } | 55 | } |
56 | } | 56 | } | ... | ... |
... | @@ -111,5 +111,5 @@ public interface IFCustomReportDatasetService extends IService<FCustomReportData | ... | @@ -111,5 +111,5 @@ public interface IFCustomReportDatasetService extends IService<FCustomReportData |
111 | * 节能环保 大屏展示 | 111 | * 节能环保 大屏展示 |
112 | * @return | 112 | * @return |
113 | */ | 113 | */ |
114 | JnhbLargeScreenVO jnhbLargeScreenShow(DataVO dataVO); | 114 | JnhbLargeScreenVO jnhbLargeScreenShow(String departIds,String time); |
115 | } | 115 | } | ... | ... |
... | @@ -3,6 +3,8 @@ package com.skua.modules.custom.service.impl; | ... | @@ -3,6 +3,8 @@ package com.skua.modules.custom.service.impl; |
3 | import com.skua.common.constant.ReportConstant; | 3 | import com.skua.common.constant.ReportConstant; |
4 | import com.skua.common.report.ReportViewUtil; | 4 | import com.skua.common.report.ReportViewUtil; |
5 | import com.skua.core.context.SpringContextUtils; | 5 | import com.skua.core.context.SpringContextUtils; |
6 | import com.skua.core.util.ConvertUtils; | ||
7 | import com.skua.modules.common.vo.DateVO; | ||
6 | import com.skua.modules.custom.entity.FCustomReportDataset; | 8 | import com.skua.modules.custom.entity.FCustomReportDataset; |
7 | import com.skua.modules.custom.mapper.FCustomReportDatasetMapper; | 9 | import com.skua.modules.custom.mapper.FCustomReportDatasetMapper; |
8 | import com.skua.modules.custom.service.IFCustomReportDatasetService; | 10 | import com.skua.modules.custom.service.IFCustomReportDatasetService; |
... | @@ -16,7 +18,10 @@ import java.util.*; | ... | @@ -16,7 +18,10 @@ import java.util.*; |
16 | import com.skua.modules.report.vo.*; | 18 | import com.skua.modules.report.vo.*; |
17 | import com.skua.modules.report.vo.largeScreen.*; | 19 | import com.skua.modules.report.vo.largeScreen.*; |
18 | import com.skua.tool.util.DateUtils; | 20 | import com.skua.tool.util.DateUtils; |
21 | import com.skua.tool.util.JSUtils; | ||
22 | import org.apache.commons.lang.StringUtils; | ||
19 | import org.springframework.beans.factory.annotation.Autowired; | 23 | import org.springframework.beans.factory.annotation.Autowired; |
24 | import org.springframework.jdbc.core.BeanPropertyRowMapper; | ||
20 | import org.springframework.jdbc.core.JdbcTemplate; | 25 | import org.springframework.jdbc.core.JdbcTemplate; |
21 | import org.springframework.stereotype.Service; | 26 | import org.springframework.stereotype.Service; |
22 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 27 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
... | @@ -210,7 +215,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa | ... | @@ -210,7 +215,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa |
210 | } | 215 | } |
211 | return map; | 216 | return map; |
212 | } | 217 | } |
213 | 218 | //节能环保报表数据 | |
214 | @Override | 219 | @Override |
215 | public List<JnhbReportData> jnhbReportShow(String departId, String month) { | 220 | public List<JnhbReportData> jnhbReportShow(String departId, String month) { |
216 | String start = month.substring(0,4)+"-01-31"; | 221 | String start = month.substring(0,4)+"-01-31"; |
... | @@ -241,32 +246,29 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa | ... | @@ -241,32 +246,29 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa |
241 | return map; | 246 | return map; |
242 | } | 247 | } |
243 | 248 | ||
249 | //节能环保报表数据-部门+月数据 | ||
250 | private List<JnhbReportData> jnhbReportShowDepaetMonthDate(String departIds, String startTime, String endTime){ | ||
251 | int dayCount = (int)DateUtils.differenceDay(startTime,endTime); | ||
252 | String dataViewName2 = ReportViewUtil.buildView(ReportConstant.view2119,"CSL", departIds, startTime, endTime); | ||
253 | String dataViewName3 = ReportViewUtil.buildView(ReportConstant.view3a24,"DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", departIds, startTime, endTime); | ||
254 | List<JnhbReportData> list = mapper.getJnhbReport(dataViewName2, dataViewName3, startTime, endTime, departIds, dayCount); | ||
255 | return list; | ||
256 | } | ||
244 | //节能环保 大屏展示 | 257 | //节能环保 大屏展示 |
245 | public JnhbLargeScreenVO jnhbLargeScreenShow(DataVO dataVO){ | 258 | public JnhbLargeScreenVO jnhbLargeScreenShow(String departIds,String time){ |
259 | DateVO dateVO = new DateVO(time); | ||
246 | long startTime = System.nanoTime(); | 260 | long startTime = System.nanoTime(); |
247 | JnhbLargeScreenVO largeScreenVO = new JnhbLargeScreenVO(); | 261 | JnhbLargeScreenVO largeScreenVO = new JnhbLargeScreenVO(); |
248 | int dayCount = (int)DateUtils.differenceDay(dataVO.getNowStartTime(),dataVO.getNowEndTime()); | ||
249 | //当月数据 | 262 | //当月数据 |
250 | String dataViewName2 = ReportViewUtil.buildView(ReportConstant.view2119,"CSL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime()); | 263 | List<JnhbReportData> jnhbReportDataList = jnhbReportShowDepaetMonthDate(departIds,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate()); |
251 | String dataViewName3 = ReportViewUtil.buildView(ReportConstant.view3a24,"DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime()); | ||
252 | List<JnhbReportData> jnhbReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getNowStartTime(), | ||
253 | dataVO.getNowEndTime(),null, dayCount); | ||
254 | //System.out.println("1111---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds"); | 264 | //System.out.println("1111---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds"); |
255 | 265 | // 上月数据 环比 | |
256 | // 上月数据 同比 | 266 | List<JnhbReportData> lastMonthMapDataList = jnhbReportShowDepaetMonthDate(departIds,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate()); |
257 | dataViewName2 = ReportViewUtil.buildView(ReportConstant.view2119,"CSL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime()); | 267 | Map<String,JnhbReportData> lastMonthMapDataMap = convertJnhbReportDataMap(lastMonthMapDataList); |
258 | dataViewName3 = ReportViewUtil.buildView(ReportConstant.view3a24,"DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime()); | ||
259 | List<JnhbReportData> lastMonthReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getLastMonthStartTime(), | ||
260 | dataVO.getLastMonthEndTime(), null, dayCount); | ||
261 | |||
262 | //System.out.println("2222---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds"); | 268 | //System.out.println("2222---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds"); |
263 | Map<String,JnhbReportData> lastMonthMapData= convertJnhbReportDataMap(lastMonthReportDataList); | 269 | // 去年数据 同比 |
264 | // 去年数据 环比 | 270 | List<JnhbReportData> lastYearReportDataList = jnhbReportShowDepaetMonthDate(departIds,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate()); |
265 | dataViewName2 = ReportViewUtil.buildView(ReportConstant.view2119,"CSL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime()); | 271 | Map<String,JnhbReportData> lastYearMonthMapDataMap = convertJnhbReportDataMap(lastMonthMapDataList); |
266 | dataViewName3 = ReportViewUtil.buildView(ReportConstant.view3a24,"DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime()); | ||
267 | List<JnhbReportData> lastYearReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getLastYearStartTime(), | ||
268 | dataVO.getLastYearEndTime(), null, dayCount); | ||
269 | Map<String,JnhbReportData> lastYearMapData= convertJnhbReportDataMap(lastYearReportDataList); | ||
270 | 272 | ||
271 | //System.out.println("333333---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds"); | 273 | //System.out.println("333333---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds"); |
272 | LoadRateVO loadRateVO = null; | 274 | LoadRateVO loadRateVO = null; |
... | @@ -283,13 +285,8 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa | ... | @@ -283,13 +285,8 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa |
283 | ResultChartsVO energyConsumeChart = null; | 285 | ResultChartsVO energyConsumeChart = null; |
284 | JnhbLargeScreenExpressionVO largeScreenExpressionVO = new JnhbLargeScreenExpressionVO();//表达式 | 286 | JnhbLargeScreenExpressionVO largeScreenExpressionVO = new JnhbLargeScreenExpressionVO();//表达式 |
285 | for(JnhbReportData reportData : jnhbReportDataList){ | 287 | for(JnhbReportData reportData : jnhbReportDataList){ |
286 | //头部-数据统计:污水处理量、系统负荷率、电耗、汽油、薪水、综合能耗、C02,吨水 | 288 | lastMonthReportDataTemp = lastMonthMapDataMap.get(reportData.getDepartId());// 上月环比 |
287 | //largeScreenVO.setHeadStatisticsValue( reportData); | 289 | lastYearReportDataTemp = lastYearMonthMapDataMap.get(reportData.getDepartId());// 去年 同比 |
288 | //largeScreenExpressionVO.setHeadStatisticsValue(reportData); | ||
289 | largeScreenExpressionVO.setHeadStatisticsValue(reportData ); | ||
290 | |||
291 | lastMonthReportDataTemp = lastMonthMapData.get(reportData.getDepartId());// 上月环比 | ||
292 | lastYearReportDataTemp = lastYearMapData.get(reportData.getDepartId());// 去年 同比 | ||
293 | //各站点系统负荷率排名: | 290 | //各站点系统负荷率排名: |
294 | loadRateVO = new LoadRateVO(reportData.getDepartId(),reportData.getDepartName(),reportData.getWsclgm(),reportData.getWssjcll(),reportData.getWsfhl()); | 291 | loadRateVO = new LoadRateVO(reportData.getDepartId(),reportData.getDepartName(),reportData.getWsclgm(),reportData.getWssjcll(),reportData.getWsfhl()); |
295 | //各站点能源消耗排名: | 292 | //各站点能源消耗排名: |
... | @@ -302,10 +299,6 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa | ... | @@ -302,10 +299,6 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa |
302 | largeScreenExpressionVO.setReduceStatistics(reportData); | 299 | largeScreenExpressionVO.setReduceStatistics(reportData); |
303 | /*************同比环比数据设置****************/ | 300 | /*************同比环比数据设置****************/ |
304 | if ( lastMonthReportDataTemp != null ){ | 301 | if ( lastMonthReportDataTemp != null ){ |
305 | //头部-数据统计:污水处理量、系统负荷率、电耗、汽油、薪水、综合能耗、C02,吨水 | ||
306 | //largeScreenVO.setHeadStatisticsValueHB( lastMonthReportDataTemp); | ||
307 | largeScreenExpressionVO.setHeadStatisticsValueHB( lastMonthReportDataTemp); | ||
308 | |||
309 | loadRateVO.setValueHb(lastMonthReportDataTemp.getWsfhl() ); | 302 | loadRateVO.setValueHb(lastMonthReportDataTemp.getWsfhl() ); |
310 | powerConsumeVO.setValueHb(lastMonthReportDataTemp.getDsdh() ); | 303 | powerConsumeVO.setValueHb(lastMonthReportDataTemp.getDsdh() ); |
311 | c02NumberVO.setValueHb(lastMonthReportDataTemp.getCodxjl() ); | 304 | c02NumberVO.setValueHb(lastMonthReportDataTemp.getCodxjl() ); |
... | @@ -314,10 +307,6 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa | ... | @@ -314,10 +307,6 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa |
314 | largeScreenExpressionVO.setReduceStatisticsHB(reportData); | 307 | largeScreenExpressionVO.setReduceStatisticsHB(reportData); |
315 | } | 308 | } |
316 | if ( lastYearReportDataTemp != null ){ | 309 | if ( lastYearReportDataTemp != null ){ |
317 | //头部-数据统计:污水处理量、系统负荷率、电耗、汽油、薪水、综合能耗、C02,吨水 | ||
318 | //largeScreenVO.setHeadStatisticsValueTB( lastYearReportDataTemp); | ||
319 | largeScreenExpressionVO.setHeadStatisticsValueTB( lastYearReportDataTemp ); | ||
320 | |||
321 | loadRateVO.setValueHb(lastYearReportDataTemp.getWsfhl() ); | 310 | loadRateVO.setValueHb(lastYearReportDataTemp.getWsfhl() ); |
322 | powerConsumeVO.setValueHb(lastYearReportDataTemp.getDsdh() ); | 311 | powerConsumeVO.setValueHb(lastYearReportDataTemp.getDsdh() ); |
323 | c02NumberVO.setValueHb(lastYearReportDataTemp.getCodxjl() ); | 312 | c02NumberVO.setValueHb(lastYearReportDataTemp.getCodxjl() ); |
... | @@ -338,12 +327,6 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa | ... | @@ -338,12 +327,6 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa |
338 | energyConsumeChart.setDataByZhnyxhl(reportData); | 327 | energyConsumeChart.setDataByZhnyxhl(reportData); |
339 | largeScreenVO.getEnergyConsumeChartsList().add( energyConsumeChart ) ; | 328 | largeScreenVO.getEnergyConsumeChartsList().add( energyConsumeChart ) ; |
340 | 329 | ||
341 | //消减量统计 | ||
342 | /*largeScreenVO.setReduceStatistics(1,cod_NumberVO); | ||
343 | largeScreenVO.setReduceStatistics(2,nh3n_NumberVO); | ||
344 | largeScreenVO.setReduceStatistics(3,tp_NumberVO); | ||
345 | largeScreenVO.setReduceStatistics(4,tn_NumberVO);*/ | ||
346 | |||
347 | largeScreenExpressionVO.setReduceStatistics(reportData); | 330 | largeScreenExpressionVO.setReduceStatistics(reportData); |
348 | //CO2排放排名 | 331 | //CO2排放排名 |
349 | co2DataList.add( c02NumberVO ); | 332 | co2DataList.add( c02NumberVO ); |
... | @@ -353,20 +336,15 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa | ... | @@ -353,20 +336,15 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa |
353 | } | 336 | } |
354 | //设置计算表达式 | 337 | //设置计算表达式 |
355 | largeScreenVO.setLargeScreenExpressionVO( largeScreenExpressionVO ); | 338 | largeScreenVO.setLargeScreenExpressionVO( largeScreenExpressionVO ); |
356 | |||
357 | //头文件Head | ||
358 | //largeScreenVO.setHeadStatisticsValueTB(); | ||
359 | //头部-数据统计:污水处理量、系统负荷率、电耗、汽油、薪水、综合能耗、C02,吨水 | 339 | //头部-数据统计:污水处理量、系统负荷率、电耗、汽油、薪水、综合能耗、C02,吨水 |
360 | largeScreenVO.setHeadStatisticsValue( ); | 340 | //largeScreenVO.setHeadStatisticsValue( ); |
361 | 341 | largeScreenVO.setHeadStatisticsList( jnhbLargeScreenShowHead(departIds,time) ); | |
362 | //各站点能源消耗排名 | 342 | //各站点能源消耗排名 |
363 | largeScreenVO.setPowerConsumeVOList( powerConsumeVOList ); | 343 | largeScreenVO.setPowerConsumeVOList( powerConsumeVOList ); |
364 | //负荷率对象 | 344 | //负荷率对象 |
365 | largeScreenVO.setLoadRateVOList( loadRateVOList ); | 345 | largeScreenVO.setLoadRateVOList( loadRateVOList ); |
366 | |||
367 | //消减量统计 | 346 | //消减量统计 |
368 | largeScreenVO.setReduceStatistics(); | 347 | largeScreenVO.setReduceStatistics(); |
369 | |||
370 | //CO2排放排名 | 348 | //CO2排放排名 |
371 | largeScreenVO.setCo2DataList( co2DataList ) ; | 349 | largeScreenVO.setCo2DataList( co2DataList ) ; |
372 | 350 | ||
... | @@ -387,13 +365,83 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa | ... | @@ -387,13 +365,83 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa |
387 | /**转换为Map<部门编号,JnhbReportData> */ | 365 | /**转换为Map<部门编号,JnhbReportData> */ |
388 | private Map<String,JnhbReportData> convertJnhbReportDataMap(List<JnhbReportData> dataList){// Map<部门编号,JnhbReportData> | 366 | private Map<String,JnhbReportData> convertJnhbReportDataMap(List<JnhbReportData> dataList){// Map<部门编号,JnhbReportData> |
389 | Map<String,JnhbReportData> dataMap = new HashMap<>(); | 367 | Map<String,JnhbReportData> dataMap = new HashMap<>(); |
390 | |||
391 | for(JnhbReportData reportData : dataList){ | 368 | for(JnhbReportData reportData : dataList){ |
392 | dataMap.put( reportData.getDepartId(),reportData ); | 369 | dataMap.put( reportData.getDepartId(),reportData ); |
393 | } | 370 | } |
394 | return dataMap; | 371 | return dataMap; |
395 | } | 372 | } |
396 | 373 | ||
374 | private JnhbReportData getJnhbReportSumData(String departIds, String startTime ,String endTime){ | ||
375 | //头部统计数据 | ||
376 | String dataViewName2 = ReportViewUtil.buildView(ReportConstant.view2119,"CSL", departIds, startTime, endTime); | ||
377 | String dataViewName3 = ReportViewUtil.buildViewLike(ReportConstant.view3a24,"DLHJ,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", departIds, startTime, endTime); | ||
378 | System.out.println("dataViewName3 = "+dataViewName3); | ||
379 | if(StringUtils.isNotEmpty(departIds)){ | ||
380 | departIds = JSUtils.quoteEach(departIds,","); | ||
381 | } | ||
382 | String sql = " select sum(ddd.wssjcll) wssjcll,avg(ddd.wsfhl) wsfhl,sum(ddd.dh) dh,sum(ddd.qy) qy,sum(ddd.xssyl) xssyl,sum(ddd.zhnyxhl) zhnyxhl,sum(ddd.eyhtpfl) eyhtpfl,sum(ddd.dsdh) dsdh from ( "; | ||
383 | sql += " select d.depart_name , aaa.CSL ,f.pro_scale ,ROUND( aaa.CSL / 10000, 2 ) AS wssjcll,ROUND( 100 * ( aaa.CSL / ( f.pro_scale * 31 ) ), 2 ) AS wsfhl,"; | ||
384 | sql += " ROUND( v3.DLHJ / 10000, 2 ) AS dh,v3.qy,v3.ysl AS xssyl,ROUND(0.123*v3.DLHJ/10000 +1.4286*v3.qy,4) AS zhnyxhl ,ROUND(3*v3.qy+0.703*10*v3.DLHJ/1000,4) AS eyhtpfl,ROUND( v3.DLHJ / aaa.CSL, 2 ) AS dsdh"; | ||
385 | sql += " FROM sys_depart d "; | ||
386 | sql += " LEFT JOIN sys_factory_info f ON f.depart_id = d.id "; | ||
387 | sql += " left join (" +dataViewName2+ ") aaa on d.id = aaa.depart_id"; | ||
388 | sql += " left join ("+dataViewName3+") v3 on v3.depart_id = d.id"; | ||
389 | sql += " where d.depart_type = 1 "; | ||
390 | if(StringUtils.isNotEmpty(departIds)){ | ||
391 | sql += " and d.id in ("+departIds+")"; | ||
392 | } | ||
393 | sql += ") ddd"; | ||
394 | System.out.println("sql = "+sql); | ||
395 | List<JnhbReportData> dataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<JnhbReportData>(JnhbReportData.class)); | ||
396 | if( dataList != null && !dataList.isEmpty()){ | ||
397 | return dataList.get(0); | ||
398 | } | ||
399 | return new JnhbReportData(); | ||
400 | } | ||
401 | // wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh | ||
402 | ////污水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水 | ||
403 | public List<ResultNumberVO> jnhbLargeScreenShowHead(String departIds, String time) { | ||
404 | long startTime = System.currentTimeMillis(); | ||
405 | DateVO dataVO = new DateVO(time); | ||
406 | //头部统计数据 | ||
407 | JnhbReportData nowMonthData = getJnhbReportSumData(departIds,dataVO.getNowMonthStartDate(),dataVO.getNowMonthEndDate()); | ||
408 | JnhbReportData lastMonthData = getJnhbReportSumData(departIds,dataVO.getLastMonthStartTime(),dataVO.getLastMonthEndTime()); | ||
409 | JnhbReportData lastYearMonthData = getJnhbReportSumData(departIds,dataVO.getLastYearMonthStartTime(),dataVO.getLastYearMonthEndTime()); | ||
410 | |||
411 | List<ResultNumberVO> headStatisticsList = new ArrayList<>(); | ||
412 | // wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh | ||
413 | ////污水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水 | ||
414 | headStatisticsList.add( getResultNumberVO( "污水处理量","wssjcll","万吨", nowMonthData.getWssjcll() , lastMonthData.getWssjcll() , lastYearMonthData.getWssjcll() ));//污水处理量 | ||
415 | headStatisticsList.add( getResultNumberVO( "系统负荷率","wsfhl", "%",nowMonthData.getWsfhl() , lastMonthData.getWsfhl() , lastYearMonthData.getWsfhl()) );//系统负荷率 | ||
416 | headStatisticsList.add( getResultNumberVO( "电耗","dh","万千瓦时",nowMonthData.getDh() , lastMonthData.getDh() , lastYearMonthData.getDh()) );//电耗 | ||
417 | headStatisticsList.add( getResultNumberVO( "汽油","qy","吨",nowMonthData.getQy() , lastMonthData.getQy() , lastYearMonthData.getQy()) );//汽油 | ||
418 | headStatisticsList.add( getResultNumberVO( "新水使用量","xssyl", "吨" ,nowMonthData.getXssyl() , lastMonthData.getXssyl() , lastYearMonthData.getXssyl()) );//薪水 | ||
419 | headStatisticsList.add( getResultNumberVO( "综合能耗消费量","zhnyxhl","吨标准煤",nowMonthData.getZhnyxhl() , lastMonthData.getZhnyxhl() , lastYearMonthData.getZhnyxhl()) );//综合能耗 | ||
420 | headStatisticsList.add( getResultNumberVO( "二氧化碳排放量","eyhtpfl","吨CO2当量",nowMonthData.getEyhtpfl() , lastMonthData.getEyhtpfl() , lastYearMonthData.getEyhtpfl()) );//C02 | ||
421 | headStatisticsList.add( getResultNumberVO( "吨水电耗","dsdh","千瓦时/吨",nowMonthData.getDsdh() , lastMonthData.getDsdh() , lastYearMonthData.getDsdh()) );//吨水电耗 | ||
422 | |||
423 | // 执行计算方法 | ||
424 | long endTime = System.currentTimeMillis(); | ||
425 | long elapsedTime = endTime - startTime; | ||
426 | System.out.println("方法执行时间:" + elapsedTime + "毫秒"); | ||
427 | return headStatisticsList; | ||
428 | } | ||
429 | private ResultNumberVO getResultNumberVO(String name ,String code ,String unit ,String value ,String valueHb,String valueTb){ | ||
430 | ResultNumberVO head_wssjcll = new ResultNumberVO();//污水处理量 | ||
431 | head_wssjcll.setName( name); | ||
432 | head_wssjcll.setUnit( unit ); | ||
433 | head_wssjcll.setValue( ConvertUtils.getString(value,"0") ); | ||
434 | head_wssjcll.setValueHb( ConvertUtils.getString(valueHb,"0")); | ||
435 | head_wssjcll.setValueTb(ConvertUtils.getString(valueTb,"0") ); | ||
436 | return head_wssjcll; | ||
437 | } | ||
438 | |||
439 | private JdbcTemplate getJdbcTemplate(){ | ||
440 | //主库数据源 | ||
441 | JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); | ||
442 | return masterDB; | ||
443 | } | ||
444 | |||
397 | @Override | 445 | @Override |
398 | public Map<String, Object> reportWeekShow(String dataTime, String week) { | 446 | public Map<String, Object> reportWeekShow(String dataTime, String week) { |
399 | Map<String, Object> map = new HashMap<>(); | 447 | Map<String, Object> map = new HashMap<>(); | ... | ... |
... | @@ -5,6 +5,7 @@ import com.google.common.collect.Maps; | ... | @@ -5,6 +5,7 @@ import com.google.common.collect.Maps; |
5 | import com.skua.common.report.ReportViewUtil; | 5 | import com.skua.common.report.ReportViewUtil; |
6 | import com.skua.core.api.vo.Result; | 6 | import com.skua.core.api.vo.Result; |
7 | import com.skua.core.aspect.annotation.AutoLog; | 7 | import com.skua.core.aspect.annotation.AutoLog; |
8 | import com.skua.core.context.BaseContextHandler; | ||
8 | import com.skua.core.util.ConvertUtils; | 9 | import com.skua.core.util.ConvertUtils; |
9 | import com.skua.core.util.DateUtils; | 10 | import com.skua.core.util.DateUtils; |
10 | import com.skua.modules.custom.service.IFCustomReportDatasetService; | 11 | import com.skua.modules.custom.service.IFCustomReportDatasetService; |
... | @@ -194,8 +195,8 @@ public class ReportDataController { | ... | @@ -194,8 +195,8 @@ public class ReportDataController { |
194 | @GetMapping(value = "/jnhbLargeScreenShow") | 195 | @GetMapping(value = "/jnhbLargeScreenShow") |
195 | public Result<JnhbLargeScreenVO> jnhbLargeScreenShow( @RequestParam(name="time") String time) { //time | 196 | public Result<JnhbLargeScreenVO> jnhbLargeScreenShow( @RequestParam(name="time") String time) { //time |
196 | Result<JnhbLargeScreenVO> result = new Result<>(); | 197 | Result<JnhbLargeScreenVO> result = new Result<>(); |
197 | DataVO dataVO = new DataVO(time); | 198 | String departIds = BaseContextHandler.getDeparts(); |
198 | JnhbLargeScreenVO jnhbLargeScreenVO = fCustomReportDatasetService.jnhbLargeScreenShow(dataVO); | 199 | JnhbLargeScreenVO jnhbLargeScreenVO = fCustomReportDatasetService.jnhbLargeScreenShow(departIds,time); |
199 | result.setResult(jnhbLargeScreenVO); | 200 | result.setResult(jnhbLargeScreenVO); |
200 | return result; | 201 | return result; |
201 | } | 202 | } | ... | ... |
... | @@ -41,45 +41,6 @@ public class JnhbLargeScreenExpressionVO { | ... | @@ -41,45 +41,6 @@ public class JnhbLargeScreenExpressionVO { |
41 | private String head_eyhtpfl_expression_tb ="0";//C02 | 41 | private String head_eyhtpfl_expression_tb ="0";//C02 |
42 | private String head_dsdh_expression_tb = "0";//吨水电耗 | 42 | private String head_dsdh_expression_tb = "0";//吨水电耗 |
43 | 43 | ||
44 | public void setHeadStatisticsValue(JnhbReportData reportData){ | ||
45 | // wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh | ||
46 | ////水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水 | ||
47 | if(StringUtils.isNotEmpty( reportData.getWssjcll() )) head_wssjcll_expression = ConvertUtils.getString(reportData.getWssjcll() ,"0") +" + " + head_wssjcll_expression;//污水处理量 ; | ||
48 | if(StringUtils.isNotEmpty( reportData.getWsfhl() )) head_wsfhl_expression = ConvertUtils.getString(reportData.getWsfhl() ,"0") +" + " + head_wssjcll_expression;//系统负荷率 ; | ||
49 | if(StringUtils.isNotEmpty( reportData.getDh() )) head_dh_expression = ConvertUtils.getString(reportData.getDh() ,"0") +" + " + head_wssjcll_expression;//电耗 ; | ||
50 | if(StringUtils.isNotEmpty( reportData.getQy() )) head_qy_expression = ConvertUtils.getString(reportData.getQy() ,"0") +" + " + head_wssjcll_expression;//汽油 ; | ||
51 | if(StringUtils.isNotEmpty( reportData.getXssyl() )) head_xssyl_expression = ConvertUtils.getString(reportData.getXssyl() ,"0") +" + " + head_wssjcll_expression;//新水使用量 ; | ||
52 | if(StringUtils.isNotEmpty( reportData.getZhnyxhl() )) head_zhnyxhl_expression = ConvertUtils.getString(reportData.getZhnyxhl() ,"0") +" + " + head_wssjcll_expression;//综合能源消费量 ; | ||
53 | if(StringUtils.isNotEmpty( reportData.getEyhtpfl() )) head_eyhtpfl_expression = ConvertUtils.getString(reportData.getEyhtpfl() ,"0") +" + " + head_wssjcll_expression;//二氧化碳排放量CO2 ; | ||
54 | if(StringUtils.isNotEmpty( reportData.getDsdh() )) head_dsdh_expression = ConvertUtils.getString(reportData.getDsdh() ,"0") +" + " + head_wssjcll_expression;//吨水电耗 ; | ||
55 | } | ||
56 | |||
57 | public void setHeadStatisticsValueTB(JnhbReportData reportData){ | ||
58 | // wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh | ||
59 | ////水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水 | ||
60 | if(StringUtils.isNotEmpty( reportData.getWssjcll() )) head_wssjcll_expression_tb = ConvertUtils.getString(reportData.getWssjcll() ,"0") +" + " + head_wssjcll_expression_tb;//污水处理量 ; | ||
61 | if(StringUtils.isNotEmpty( reportData.getWsfhl() )) head_wsfhl_expression_tb = ConvertUtils.getString(reportData.getWsfhl() ,"0") +" + " + head_wssjcll_expression_tb;//系统负荷率 ; | ||
62 | if(StringUtils.isNotEmpty( reportData.getDh() )) head_dh_expression_tb = ConvertUtils.getString(reportData.getDh() ,"0") +" + " + head_wssjcll_expression_tb;//电耗 ; | ||
63 | if(StringUtils.isNotEmpty( reportData.getQy() )) head_qy_expression_tb = ConvertUtils.getString(reportData.getQy() ,"0") +" + " + head_wssjcll_expression_tb;//汽油 ; | ||
64 | if(StringUtils.isNotEmpty( reportData.getXssyl() )) head_xssyl_expression_tb = ConvertUtils.getString(reportData.getXssyl() ,"0") +" + " + head_wssjcll_expression_tb;//新水使用量 ; | ||
65 | if(StringUtils.isNotEmpty( reportData.getZhnyxhl() )) head_zhnyxhl_expression_tb = ConvertUtils.getString(reportData.getZhnyxhl() ,"0") +" + " + head_wssjcll_expression_tb;//综合能源消费量 ; | ||
66 | if(StringUtils.isNotEmpty( reportData.getEyhtpfl() )) head_eyhtpfl_expression_tb = ConvertUtils.getString(reportData.getEyhtpfl() ,"0") +" + " + head_wssjcll_expression_tb;//二氧化碳排放量CO2 ; | ||
67 | if(StringUtils.isNotEmpty( reportData.getDsdh() )) head_dsdh_expression_tb = ConvertUtils.getString(reportData.getDsdh() ,"0") +" + " + head_wssjcll_expression_tb;//吨水电耗 ; | ||
68 | } | ||
69 | public void setHeadStatisticsValueHB(JnhbReportData reportData){ | ||
70 | // wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh | ||
71 | ////水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水 | ||
72 | if(StringUtils.isNotEmpty( reportData.getWssjcll() )) head_wssjcll_expression_hb = ConvertUtils.getString(reportData.getWssjcll() ,"0") +" + " + head_wssjcll_expression_hb;//污水处理量 ; | ||
73 | if(StringUtils.isNotEmpty( reportData.getWsfhl() )) head_wsfhl_expression_hb = ConvertUtils.getString(reportData.getWsfhl() ,"0") +" + " + head_wssjcll_expression_hb;//系统负荷率 ; | ||
74 | if(StringUtils.isNotEmpty( reportData.getDh() )) head_dh_expression_hb = ConvertUtils.getString(reportData.getDh() ,"0") +" + " + head_wssjcll_expression_hb;//电耗 ; | ||
75 | if(StringUtils.isNotEmpty( reportData.getQy() )) head_qy_expression_hb = ConvertUtils.getString(reportData.getQy() ,"0") +" + " + head_wssjcll_expression_hb;//汽油 ; | ||
76 | if(StringUtils.isNotEmpty( reportData.getXssyl() )) head_xssyl_expression_hb = ConvertUtils.getString(reportData.getXssyl() ,"0") +" + " + head_wssjcll_expression_hb;//新水使用量 ; | ||
77 | if(StringUtils.isNotEmpty( reportData.getZhnyxhl() )) head_zhnyxhl_expression_hb = ConvertUtils.getString(reportData.getZhnyxhl() ,"0") +" + " + head_wssjcll_expression_hb;//综合能源消费量 ; | ||
78 | if(StringUtils.isNotEmpty( reportData.getEyhtpfl() )) head_eyhtpfl_expression_hb = ConvertUtils.getString(reportData.getEyhtpfl() ,"0") +" + " + head_wssjcll_expression_hb;//二氧化碳排放量CO2 ; | ||
79 | if(StringUtils.isNotEmpty( reportData.getDsdh() )) head_dsdh_expression_hb = ConvertUtils.getString(reportData.getDsdh() ,"0") +" + " + head_wssjcll_expression_hb;//吨水电耗 ; | ||
80 | } | ||
81 | |||
82 | |||
83 | 44 | ||
84 | /*** | 45 | /*** |
85 | * 消减量统计 | 46 | * 消减量统计 | ... | ... |
... | @@ -22,7 +22,6 @@ public class JnhbLargeScreenVO { | ... | @@ -22,7 +22,6 @@ public class JnhbLargeScreenVO { |
22 | @ApiModelProperty(value = "各站点能源消耗排名") | 22 | @ApiModelProperty(value = "各站点能源消耗排名") |
23 | private List<PowerConsumeVO> powerConsumeVOList = new ArrayList(); | 23 | private List<PowerConsumeVO> powerConsumeVOList = new ArrayList(); |
24 | 24 | ||
25 | |||
26 | @ApiModelProperty(value = "负荷率对象") | 25 | @ApiModelProperty(value = "负荷率对象") |
27 | private List<LoadRateVO> loadRateVOList = new ArrayList<>(); | 26 | private List<LoadRateVO> loadRateVOList = new ArrayList<>(); |
28 | 27 | ||
... | @@ -47,23 +46,6 @@ public class JnhbLargeScreenVO { | ... | @@ -47,23 +46,6 @@ public class JnhbLargeScreenVO { |
47 | private Integer equipmentL2; | 46 | private Integer equipmentL2; |
48 | 47 | ||
49 | private JnhbLargeScreenExpressionVO largeScreenExpressionVO; | 48 | private JnhbLargeScreenExpressionVO largeScreenExpressionVO; |
50 | /*** | ||
51 | * 设置头文件 | ||
52 | */ | ||
53 | |||
54 | public void setHeadStatisticsValue(){ | ||
55 | // wssjcll, wsfhl, dh, qy, xinshui, zhnyxhl, eyhtpfl, dsdh | ||
56 | ////污水处理量,系统负荷率,电耗,汽油,新水,综合能耗,C02,吨水 | ||
57 | this.getHeadStatisticsList().add( getResultNumberVO( "污水处理量","wssjcll","万吨", this.getLargeScreenExpressionVO().getHead_wssjcll_expression() , this.getLargeScreenExpressionVO().getHead_wssjcll_expression_hb() , this.getLargeScreenExpressionVO().getHead_wssjcll_expression_tb()) );//污水处理量 | ||
58 | this.getHeadStatisticsList().add( getResultNumberVO( "系统负荷率","wsfhl", "%",this.getLargeScreenExpressionVO().getHead_wsfhl_expression() , this.getLargeScreenExpressionVO().getHead_wsfhl_expression_hb() , this.getLargeScreenExpressionVO().getHead_wsfhl_expression_tb()) );//系统负荷率 | ||
59 | this.getHeadStatisticsList().add( getResultNumberVO( "电耗","dh","万千瓦时",this.getLargeScreenExpressionVO().getHead_dh_expression() , this.getLargeScreenExpressionVO().getHead_dh_expression_hb() , this.getLargeScreenExpressionVO().getHead_dh_expression_tb()) );//电耗 | ||
60 | this.getHeadStatisticsList().add( getResultNumberVO( "汽油","qy","吨",this.getLargeScreenExpressionVO().getHead_qy_expression() , this.getLargeScreenExpressionVO().getHead_qy_expression_hb() , this.getLargeScreenExpressionVO().getHead_qy_expression_tb()) );//汽油 | ||
61 | this.getHeadStatisticsList().add( getResultNumberVO( "新水使用量","xinshui", "吨" ,this.getLargeScreenExpressionVO().getHead_xssyl_expression() , this.getLargeScreenExpressionVO().getHead_xssyl_expression_hb() , this.getLargeScreenExpressionVO().getHead_xssyl_expression_tb()) );//薪水 | ||
62 | this.getHeadStatisticsList().add( getResultNumberVO( "综合能耗消费量","zhnyxhl","吨标准煤",this.getLargeScreenExpressionVO().getHead_zhnyxhl_expression() , this.getLargeScreenExpressionVO().getHead_zhnyxhl_expression_hb() , this.getLargeScreenExpressionVO().getHead_zhnyxhl_expression_tb()) );//综合能耗 | ||
63 | this.getHeadStatisticsList().add( getResultNumberVO( "二氧化碳排放量","eyhtpfl","吨CO2当量",this.getLargeScreenExpressionVO().getHead_eyhtpfl_expression() , this.getLargeScreenExpressionVO().getHead_eyhtpfl_expression_hb() , this.getLargeScreenExpressionVO().getHead_eyhtpfl_expression_tb()) );//C02 | ||
64 | this.getHeadStatisticsList().add( getResultNumberVO( "吨水电耗","dsdh","千瓦时/吨",this.getLargeScreenExpressionVO().getHead_dsdh_expression() , this.getLargeScreenExpressionVO().getHead_dsdh_expression_hb() , this.getLargeScreenExpressionVO().getHead_dsdh_expression_tb()) );//吨水电耗 | ||
65 | } | ||
66 | |||
67 | 49 | ||
68 | /*** | 50 | /*** |
69 | * 设置:消减统计记录 | 51 | * 设置:消减统计记录 | ... | ... |
-
请 注册 或 登录 后发表评论