kangwei: 吨水电耗
正在显示
2 个修改的文件
包含
30 行增加
和
7 行删除
... | @@ -7,6 +7,7 @@ import java.util.Map; | ... | @@ -7,6 +7,7 @@ import java.util.Map; |
7 | import com.skua.common.constant.ReportConstant; | 7 | import com.skua.common.constant.ReportConstant; |
8 | import com.skua.common.report.vo.ReportItemVO; | 8 | import com.skua.common.report.vo.ReportItemVO; |
9 | import com.skua.tool.util.DateUtils; | 9 | import com.skua.tool.util.DateUtils; |
10 | import com.skua.tool.util.JSUtils; | ||
10 | import org.apache.commons.lang.StringUtils; | 11 | import org.apache.commons.lang.StringUtils; |
11 | import org.springframework.format.annotation.DateTimeFormat; | 12 | import org.springframework.format.annotation.DateTimeFormat; |
12 | import org.springframework.jdbc.core.BeanPropertyRowMapper; | 13 | import org.springframework.jdbc.core.BeanPropertyRowMapper; |
... | @@ -346,6 +347,25 @@ public class ReportViewUtil { | ... | @@ -346,6 +347,25 @@ public class ReportViewUtil { |
346 | return reportItemVO; | 347 | return reportItemVO; |
347 | } | 348 | } |
348 | 349 | ||
350 | |||
351 | |||
352 | public static String getValueByDSDH( String departIds , String startTime , String endTime){ | ||
353 | |||
354 | String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportConstant.view3a24,"DLHJ", departIds, startTime,endTime); | ||
355 | String dataViewName2119 = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departIds, startTime,endTime); | ||
356 | String sql = "select round( ifnull(avg( aaaa.dh/bbbb.csl ),0),2) dsdh from sys_depart d "; | ||
357 | sql += " left join ( select aaa.depart_id , ifnull(sum(aaa.DLHJ),0) dh from " +dataViewName3a24+" aaa group by aaa.depart_id )aaaa on aaaa.depart_id = d.id "; | ||
358 | sql += " left join ( select bb.depart_id , ifnull(sum(bb.CSL),0) csl from "+dataViewName2119+" bb group by bb.depart_id ) bbbb on bbbb.depart_id = d.id "; | ||
359 | sql += " where d.depart_type = 1 "; | ||
360 | if(StringUtils.isNotEmpty(departIds)){ | ||
361 | sql += " and d.id in ("+ JSUtils.quoteEach(departIds,",") +")"; | ||
362 | } | ||
363 | sql += " and ifnull(aaaa.dh,0) > 0 and ifnull(bbbb.csl , 0 ) > 0 "; | ||
364 | JdbcTemplate masterDB = (JdbcTemplate)SpringContextUtils.getBean("master"); | ||
365 | String dsdh = masterDB.queryForObject(sql,String.class); | ||
366 | return dsdh; | ||
367 | } | ||
368 | |||
349 | /*** | 369 | /*** |
350 | * 某一个字段的时间+吨水消耗 | 370 | * 某一个字段的时间+吨水消耗 |
351 | * @param reportId | 371 | * @param reportId | ... | ... |
... | @@ -82,21 +82,24 @@ public class ReportItemvService { | ... | @@ -82,21 +82,24 @@ public class ReportItemvService { |
82 | */ | 82 | */ |
83 | public List<FRportlCommandCenterVO> statisticsByElectricity(String departId, String startTime, String endTime) { | 83 | public List<FRportlCommandCenterVO> statisticsByElectricity(String departId, String startTime, String endTime) { |
84 | List<FRportlCommandCenterVO> fRportlCommandCenterVOList = new ArrayList<>(); | 84 | List<FRportlCommandCenterVO> fRportlCommandCenterVOList = new ArrayList<>(); |
85 | DateVO dateVO = new DateVO(startTime); | 85 | // DateVO dateVO = new DateVO(startTime); |
86 | // String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportConstant.view3a24,"DLHJ", departId, startTime,endTime); | 86 | // String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportConstant.view3a24,"DLHJ", departId, startTime,endTime); |
87 | // String sql = "select ROUND( SUM( IFNULL(aaa.DLHJ,0) ), 2 ) AS DLHJ from " + dataViewName3a24+ "aaa"; | 87 | // String sql = "select ROUND( SUM( IFNULL(aaa.DLHJ,0) ), 2 ) AS DLHJ from " + dataViewName3a24+ "aaa"; |
88 | 88 | ||
89 | ReportItemVO dlhjData = ReportViewUtil.getSumValueByTBHB(ReportConstant.view3a24, "DLHJ", departId, startTime, endTime); | 89 | ReportItemVO dlhjData = ReportViewUtil.getSumValueByTBHB(ReportConstant.view3a24, "DLHJ", departId, startTime, endTime); |
90 | 90 | ||
91 | 91 | ||
92 | String dlhj_avg_value = getAvgDLHJ(departId,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate()); | 92 | String dlhj_avg_value = getAvgDLHJ(departId,startTime, endTime); |
93 | String dlhj_avg_valueHB = getAvgDLHJ(departId, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime()); | 93 | String dlhj_avg_valueHB = getAvgDLHJ(departId, DateUtils.getHbDate(startTime),DateUtils.getHbDate(endTime)); |
94 | String dlhj_avg_valueTB = getAvgDLHJ(departId, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime()); | 94 | String dlhj_avg_valueTB = getAvgDLHJ(departId, DateUtils.getTbDate(startTime),DateUtils.getTbDate(endTime)); |
95 | 95 | ||
96 | String csl_avg_value = getSumCSL(departId,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate()); | 96 | /* String csl_avg_value = getSumCSL(departId,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate()); |
97 | String csl_avg_valueHB = getSumCSL(departId, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime()); | 97 | String csl_avg_valueHB = getSumCSL(departId, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime()); |
98 | String csl_avg_valueTB = getSumCSL(departId, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime()); | 98 | String csl_avg_valueTB = getSumCSL(departId, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());*/ |
99 | 99 | ||
100 | String dsdh_value = ReportViewUtil.getValueByDSDH(departId,startTime, endTime) ; | ||
101 | String dsdh_value_Hb = ReportViewUtil.getValueByDSDH(departId,DateUtils.getHbDate(startTime),DateUtils.getHbDate(endTime)) ; | ||
102 | String dsdh_value_Tb = ReportViewUtil.getValueByDSDH(departId,DateUtils.getTbDate(startTime),DateUtils.getTbDate(endTime)) ; | ||
100 | // long nowDifferDay = DateUtils.differenceDay(dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate()); | 103 | // long nowDifferDay = DateUtils.differenceDay(dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate()); |
101 | // long lastMonthDifferDay = DateUtils.differenceDay(dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime()); | 104 | // long lastMonthDifferDay = DateUtils.differenceDay(dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime()); |
102 | // long lastYearDifferDay = DateUtils.differenceDay(dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime()); | 105 | // long lastYearDifferDay = DateUtils.differenceDay(dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime()); |
... | @@ -106,7 +109,7 @@ public class ReportItemvService { | ... | @@ -106,7 +109,7 @@ public class ReportItemvService { |
106 | //日均数据:/环比/同比 | 109 | //日均数据:/环比/同比 |
107 | FRportlCommandCenterVO lastMonthVO = new FRportlCommandCenterVO("日均电耗",dlhj_avg_value ,dlhj_avg_valueHB,dlhj_avg_valueTB ); | 110 | FRportlCommandCenterVO lastMonthVO = new FRportlCommandCenterVO("日均电耗",dlhj_avg_value ,dlhj_avg_valueHB,dlhj_avg_valueTB ); |
108 | //吨水消耗 | 111 | //吨水消耗 |
109 | FRportlCommandCenterVO lastYearVo = new FRportlCommandCenterVO("吨水电耗",JSUtils.divide( dlhj_avg_value ,csl_avg_value ) ,JSUtils.divide( dlhj_avg_valueHB ,csl_avg_valueHB ),JSUtils.divide( dlhj_avg_valueTB ,csl_avg_valueTB )); | 112 | FRportlCommandCenterVO lastYearVo = new FRportlCommandCenterVO("吨水电耗",dsdh_value ,dsdh_value_Hb ,dsdh_value_Tb); |
110 | fRportlCommandCenterVOList.add( nowMonthVO) ; | 113 | fRportlCommandCenterVOList.add( nowMonthVO) ; |
111 | fRportlCommandCenterVOList.add( lastMonthVO) ; | 114 | fRportlCommandCenterVOList.add( lastMonthVO) ; |
112 | fRportlCommandCenterVOList.add( lastYearVo) ; | 115 | fRportlCommandCenterVOList.add( lastYearVo) ; | ... | ... |
-
请 注册 或 登录 后发表评论