de88b37b 康伟

kangwei: 解决:吨水药费,吨水电费数据不显示问题

1 个父辈 661ee733
...@@ -6,6 +6,7 @@ import java.util.Map; ...@@ -6,6 +6,7 @@ import java.util.Map;
6 6
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.modules.common.vo.DateVO;
9 import com.skua.tool.util.DateUtils; 10 import com.skua.tool.util.DateUtils;
10 import com.skua.tool.util.JSUtils; 11 import com.skua.tool.util.JSUtils;
11 import org.apache.commons.lang.StringUtils; 12 import org.apache.commons.lang.StringUtils;
...@@ -324,9 +325,10 @@ public class ReportViewUtil { ...@@ -324,9 +325,10 @@ public class ReportViewUtil {
324 325
325 public static ReportItemVO getSumValueByTBHB(String reportId, String fields, String departIds , String startTime , String endTime,String operatorSign){ 326 public static ReportItemVO getSumValueByTBHB(String reportId, String fields, String departIds , String startTime , String endTime,String operatorSign){
326 ReportItemVO reportItemVO = null; 327 ReportItemVO reportItemVO = null;
328 DateVO dateVO = new DateVO(startTime);
327 String dataViewName3a24_value = ReportViewUtil.buildViewLike(reportId,fields, departIds, startTime,endTime,operatorSign); 329 String dataViewName3a24_value = ReportViewUtil.buildViewLike(reportId,fields, departIds, startTime,endTime,operatorSign);
328 String dataViewName3a24_valueHB = ReportViewUtil.buildViewLike(reportId,fields, departIds, DateUtils.getHbDate(startTime),DateUtils.getHbMonthDate(endTime)+"-31",operatorSign); 330 String dataViewName3a24_valueHB = ReportViewUtil.buildViewLike(reportId,fields, departIds, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime(),operatorSign);
329 String dataViewName3a24_valueTB = ReportViewUtil.buildViewLike(reportId,fields, departIds, DateUtils.getTbDate(startTime),DateUtils.getHbMonthDate(endTime)+"-31",operatorSign); 331 String dataViewName3a24_valueTB = ReportViewUtil.buildViewLike(reportId,fields, departIds, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime(),operatorSign);
330 332
331 String fieldsSql = ""; 333 String fieldsSql = "";
332 if(StringUtils.isNotEmpty(fields)) { 334 if(StringUtils.isNotEmpty(fields)) {
...@@ -338,18 +340,25 @@ public class ReportViewUtil { ...@@ -338,18 +340,25 @@ public class ReportViewUtil {
338 } 340 }
339 String sql = "select "; 341 String sql = "select ";
340 sql += "(select ROUND("+fieldsSql+",2) 'value' from " + dataViewName3a24_value+ "aaa) 'value',"; 342 sql += "(select ROUND("+fieldsSql+",2) 'value' from " + dataViewName3a24_value+ "aaa) 'value',";
341 sql += "(select ROUND("+fieldsSql+",2) 'value' from " + dataViewName3a24_valueHB+ "aaa) 'valueHB',"; 343 sql += "(select ROUND("+fieldsSql+",2) 'value' from " + dataViewName3a24_valueHB+ "aaa) 'valueHb',";
342 sql += "(select ROUND("+fieldsSql+",2) 'value' from " + dataViewName3a24_valueTB+ "aaa) 'valueTB' "; 344 sql += "(select ROUND("+fieldsSql+",2) 'value' from " + dataViewName3a24_valueTB+ "aaa) 'valueTb' ";
343 345
344 sql += " from dual"; 346 sql += " from dual";
345 JdbcTemplate masterDB = (JdbcTemplate)SpringContextUtils.getBean("master"); 347 JdbcTemplate masterDB = (JdbcTemplate)SpringContextUtils.getBean("master");
348 /*
349 Map<String, Object> dataMap = masterDB.queryForMap(sql);
350 reportItemVO = new ReportItemVO();
351 reportItemVO.setValue(dataMap.get("value").toString());
352 reportItemVO.setValueHb(dataMap.get("valueHb").toString());
353 reportItemVO.setValueTb(dataMap.get("valueTb").toString());*/
346 354
347 List<ReportItemVO> dataList = masterDB.query(sql,new BeanPropertyRowMapper<ReportItemVO>(ReportItemVO.class)); 355 List<ReportItemVO> dataList = masterDB.query(sql,new BeanPropertyRowMapper<ReportItemVO>(ReportItemVO.class));
348 if(dataList != null && !dataList.isEmpty()){ 356 if( dataList!= null && !dataList.isEmpty()){
349 reportItemVO = dataList.get(0); 357 reportItemVO = dataList.get(0);
350 }else{ 358 }else{
351 reportItemVO = new ReportItemVO(); 359 reportItemVO = new ReportItemVO();
352 } 360 }
361
353 return reportItemVO; 362 return reportItemVO;
354 } 363 }
355 364
......
...@@ -397,11 +397,11 @@ public class ReportItemvService { ...@@ -397,11 +397,11 @@ public class ReportItemvService {
397 ReportItemVO csl_reportVO = ReportViewUtil.getSumValueByTBHB(ReportConstant.view2119,ReportConstant.field_CSL, departId, startTime, endTime); 397 ReportItemVO csl_reportVO = ReportViewUtil.getSumValueByTBHB(ReportConstant.view2119,ReportConstant.field_CSL, departId, startTime, endTime);
398 398
399 //当月数据/环比、同比 399 //当月数据/环比、同比
400 FRportlCommandCenterVO nowMonthVO = new FRportlCommandCenterVO("月总电耗(万kwh)", "万kwh",JSUtils.divide(dlhjData.getValue(),10000), JSUtils.divide(dlhjData.getValueTb(),10000), JSUtils.divide(dlhjData.getValueHb(),10000)); 400 FRportlCommandCenterVO nowMonthVO = new FRportlCommandCenterVO("月总电耗", "万kwh",JSUtils.divide(dlhjData.getValue(),10000), JSUtils.divide(dlhjData.getValueTb(),10000), JSUtils.divide(dlhjData.getValueHb(),10000));
401 //日均数据:/环比/同比 401 //日均数据:/环比/同比
402 FRportlCommandCenterVO lastMonthVO = new FRportlCommandCenterVO("吨水电费(元/t)","元/t",JSUtils.divide(dfValue,csl_reportVO.getValue()) ,JSUtils.divide(dfTBValue,csl_reportVO.getValueTb()) ,JSUtils.divide(dfHBValue,csl_reportVO.getValueHb())); 402 FRportlCommandCenterVO lastMonthVO = new FRportlCommandCenterVO("吨水电费","元/t",JSUtils.divide(dfValue,csl_reportVO.getValue()) ,JSUtils.divide(dfTBValue,csl_reportVO.getValueTb()) ,JSUtils.divide(dfHBValue,csl_reportVO.getValueHb()));
403 //吨水消耗 403 //吨水消耗
404 FRportlCommandCenterVO lastYearVo = new FRportlCommandCenterVO("吨水电耗(kwh/t)","kwh/t",dsdh_value ,dsdh_value_Tb,dsdh_value_Hb ); 404 FRportlCommandCenterVO lastYearVo = new FRportlCommandCenterVO("吨水电耗","kwh/t",dsdh_value ,dsdh_value_Tb,dsdh_value_Hb );
405 fRportlCommandCenterVOList.add( nowMonthVO) ; 405 fRportlCommandCenterVOList.add( nowMonthVO) ;
406 fRportlCommandCenterVOList.add( lastMonthVO) ; 406 fRportlCommandCenterVOList.add( lastMonthVO) ;
407 fRportlCommandCenterVOList.add( lastYearVo) ; 407 fRportlCommandCenterVOList.add( lastYearVo) ;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!