kangwei:重构电耗分析的,数据展示接口
正在显示
6 个修改的文件
包含
224 行增加
和
62 行删除
... | @@ -29,7 +29,7 @@ public interface ReportConstant { | ... | @@ -29,7 +29,7 @@ public interface ReportConstant { |
29 | 29 | ||
30 | //水量字段 | 30 | //水量字段 |
31 | public static final String fieldClsl = "CSL,JSL"; | 31 | public static final String fieldClsl = "CSL,JSL"; |
32 | 32 | public static final String field_CSL= "CSL"; | |
33 | //电字段 | 33 | //电字段 |
34 | public static final String fieldDl = "DLHJ"; | 34 | public static final String fieldDl = "DLHJ"; |
35 | 35 | ... | ... |
1 | package com.skua.common.report; | 1 | package com.skua.common.report; |
2 | 2 | ||
3 | import java.text.DateFormat; | ||
3 | import java.util.List; | 4 | import java.util.List; |
4 | import java.util.Map; | 5 | import java.util.Map; |
5 | 6 | ||
7 | import com.skua.common.constant.ReportConstant; | ||
8 | import com.skua.common.report.vo.ReportItemVO; | ||
9 | import com.skua.tool.util.DateUtils; | ||
6 | import org.apache.commons.lang.StringUtils; | 10 | import org.apache.commons.lang.StringUtils; |
11 | import org.springframework.format.annotation.DateTimeFormat; | ||
12 | import org.springframework.jdbc.core.BeanPropertyRowMapper; | ||
7 | import org.springframework.jdbc.core.JdbcTemplate; | 13 | import org.springframework.jdbc.core.JdbcTemplate; |
8 | 14 | ||
9 | import com.skua.core.context.SpringContextUtils; | 15 | import com.skua.core.context.SpringContextUtils; |
... | @@ -300,4 +306,80 @@ public class ReportViewUtil { | ... | @@ -300,4 +306,80 @@ public class ReportViewUtil { |
300 | return sb.toString(); | 306 | return sb.toString(); |
301 | } | 307 | } |
302 | 308 | ||
309 | |||
310 | /*** | ||
311 | * 某一个字段的同比环比 | ||
312 | * @param reportId | ||
313 | * @param fields | ||
314 | * @param departIds | ||
315 | * @param startTime | ||
316 | * @param endTime | ||
317 | * @return | ||
318 | */ | ||
319 | public static ReportItemVO getSumValueByTBHB(String reportId, String fields, String departIds , String startTime , String endTime){ | ||
320 | ReportItemVO reportItemVO = null; | ||
321 | String dataViewName3a24_value = ReportViewUtil.buildViewLike(reportId,fields, departIds, startTime,endTime); | ||
322 | String dataViewName3a24_valueHB = ReportViewUtil.buildViewLike(reportId,fields, departIds, DateUtils.getHbDate(startTime),DateUtils.getHbDate(startTime)); | ||
323 | String dataViewName3a24_valueTB = ReportViewUtil.buildViewLike(reportId,fields, departIds, DateUtils.getTbDate(startTime),DateUtils.getTbDate(startTime)); | ||
324 | |||
325 | String fieldsSql = ""; | ||
326 | if(StringUtils.isNotEmpty(fields)) { | ||
327 | String[] fieldArray = fields.split(","); | ||
328 | for (String field : fieldArray) { | ||
329 | if(StringUtils.isNotEmpty(fieldsSql) ) fieldsSql+="+"; | ||
330 | fieldsSql += " sum(IFNULL(aaa."+field+",0) ) "; | ||
331 | } | ||
332 | } | ||
333 | String sql = "select "; | ||
334 | sql += "(select ROUND("+fieldsSql+",2) 'value' from " + dataViewName3a24_value+ "aaa) 'value',"; | ||
335 | sql += "(select ROUND("+fieldsSql+",2) 'value' from " + dataViewName3a24_valueHB+ "aaa) 'valueHB',"; | ||
336 | sql += "(select ROUND("+fieldsSql+",2) 'value' from " + dataViewName3a24_valueTB+ "aaa) 'valueTB' "; | ||
337 | |||
338 | sql += " from dual"; | ||
339 | JdbcTemplate masterDB = (JdbcTemplate)SpringContextUtils.getBean("master"); | ||
340 | List<ReportItemVO> dataList = masterDB.query(sql,new BeanPropertyRowMapper<ReportItemVO>(ReportItemVO.class)); | ||
341 | if(dataList != null && !dataList.isEmpty()){ | ||
342 | reportItemVO = dataList.get(0); | ||
343 | }else{ | ||
344 | reportItemVO = new ReportItemVO(); | ||
345 | } | ||
346 | return reportItemVO; | ||
347 | } | ||
348 | |||
349 | /*** | ||
350 | * 某一个字段的时间+吨水消耗 | ||
351 | * @param reportId | ||
352 | * @param fields | ||
353 | * @param departIds | ||
354 | * @param timeType :时间类型 timeType =1 yyyy-MM ,timeType =2 yyyy-MM-dd | ||
355 | * @param isLowFlag isLowFlag = true 只显示最低值 | ||
356 | * @return | ||
357 | */ | ||
358 | public static List<ReportItemVO> getDateValueByDS(String reportId, String fields, String departIds , String startTime , String endTime, Integer timeType,boolean isLowFlag){ | ||
359 | if(timeType == null) timeType =1; | ||
360 | String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,ReportConstant.field_CSL, departIds, startTime, endTime); | ||
361 | String dataViewName3a24 = ReportViewUtil.buildView(reportId,fields, departIds, startTime,endTime); | ||
362 | String sql = " select bbb.time,round(IFNULL( bbb."+fields+"/ddd.CLSL,0 ),2) as 'dsValue' ,round(IFNULL( bbb."+fields+",0 ),2) as 'value' from ( "; | ||
363 | if(timeType ==1){ | ||
364 | sql += " select DATE_FORMAT(aaa.time,'%Y-%m') 'time' , ROUND(sum(aaa."+fields+"),2) "+fields+" from "+dataViewName3a24 +" aaa group by DATE_FORMAT(aaa.time,'%Y-%m') "; | ||
365 | }else{ | ||
366 | sql += " select aaa.time , ROUND(sum(aaa."+fields+"),2) "+fields+" from "+dataViewName3a24 +" aaa group by aaa.time "; | ||
367 | } | ||
368 | sql += " )bbb "; | ||
369 | sql += " left join ( "; | ||
370 | if(timeType ==1){ | ||
371 | sql += " select DATE_FORMAT(ccc.time,'%Y-%m') 'time' , ROUND(sum(ccc."+ReportConstant.field_CSL+"),2) CLSL from "+dataViewName2119 +" ccc group by DATE_FORMAT(ccc.time,'%Y-%m') "; | ||
372 | }else{ | ||
373 | sql += " select ccc.time , ROUND(sum(ccc."+ReportConstant.field_CSL+"),2) CLSL from "+dataViewName2119 +" ccc ccc.time "; | ||
374 | } | ||
375 | sql += " )ddd on bbb.time = ddd.time "; | ||
376 | if(isLowFlag ){ | ||
377 | sql += " order by (bbb."+fields+" - ddd.CLSL) limit 1"; | ||
378 | } | ||
379 | JdbcTemplate masterDB = (JdbcTemplate)SpringContextUtils.getBean("master"); | ||
380 | List<ReportItemVO> dataList = masterDB.query(sql,new BeanPropertyRowMapper<ReportItemVO>(ReportItemVO.class)); | ||
381 | return dataList; | ||
382 | } | ||
383 | |||
384 | |||
303 | } | 385 | } | ... | ... |
1 | package com.skua.common.report.vo; | ||
2 | |||
3 | import com.skua.core.util.ConvertUtils; | ||
4 | import com.skua.tool.util.JSUtils; | ||
5 | import io.swagger.annotations.ApiModel; | ||
6 | import io.swagger.annotations.ApiModelProperty; | ||
7 | import lombok.Data; | ||
8 | |||
9 | @Data | ||
10 | @ApiModel(value="指挥中心:ReportItemVO", description="指挥中心:ReportItemVO详情类)") | ||
11 | public class ReportItemVO { | ||
12 | |||
13 | @ApiModelProperty(value = "厂站编号") | ||
14 | private String departId; | ||
15 | @ApiModelProperty(value = "厂站名称") | ||
16 | private String departName; | ||
17 | |||
18 | @ApiModelProperty(value = "时间") | ||
19 | private String time; | ||
20 | @ApiModelProperty(value = "label描述") | ||
21 | private String label; | ||
22 | |||
23 | @ApiModelProperty(value = "code") | ||
24 | private String code; | ||
25 | |||
26 | @ApiModelProperty(value = "结果") | ||
27 | private String value; | ||
28 | @ApiModelProperty(value = "日均数据") | ||
29 | private String avgDayValue; | ||
30 | |||
31 | @ApiModelProperty(value = "同比") | ||
32 | private String valueTb; | ||
33 | @ApiModelProperty(value = "同比比例") | ||
34 | private String valueTbBl; | ||
35 | |||
36 | /* @ApiModelProperty(value = "同比差值") | ||
37 | private String valueTbDifference;*/ | ||
38 | @ApiModelProperty(value = "环比") | ||
39 | private String valueHb; | ||
40 | @ApiModelProperty(value = "环比比例") | ||
41 | private String valueHbBl; | ||
42 | |||
43 | @ApiModelProperty(value = "吨水消耗") | ||
44 | private String dsValue; | ||
45 | |||
46 | /* @ApiModelProperty(value = "环比差值") | ||
47 | private String valueHbDifference; | ||
48 | @ApiModelProperty(value = "单位") | ||
49 | private String unit; | ||
50 | */ | ||
51 | |||
52 | public ReportItemVO(){ | ||
53 | |||
54 | } | ||
55 | |||
56 | public ReportItemVO(String label, String code, String value, String valueHb, String valueTb) { | ||
57 | this.label = label; | ||
58 | this.code = code; | ||
59 | this.value = value; | ||
60 | this.valueTb = valueTb; | ||
61 | this.valueHb = valueHb; | ||
62 | } | ||
63 | |||
64 | public ReportItemVO(String value, String valueTb, String valueHb) { | ||
65 | this.value = ConvertUtils.getString(value,"0.0"); | ||
66 | this.valueTb = ConvertUtils.getString(valueTb,"0.0"); | ||
67 | this.valueHb = ConvertUtils.getString(valueHb,"0.0"); | ||
68 | } | ||
69 | |||
70 | public String getValueTbBl() { | ||
71 | valueTbBl = JSUtils.executeExpression("("+this.getValue() + " - " + this.getValueTb() + ") / " +this.getValueTb(),"0.0") ; | ||
72 | return valueTbBl; | ||
73 | } | ||
74 | |||
75 | public String getValueHbBl() { | ||
76 | valueHbBl = JSUtils.executeExpression("("+this.getValue() + " - " + this.getValueHb() + ") / " +this.getValueHb(),"0.0") ; | ||
77 | return valueHbBl; | ||
78 | } | ||
79 | } | ||
80 |
... | @@ -3,6 +3,7 @@ package com.skua.modules.equipment.controller; | ... | @@ -3,6 +3,7 @@ package com.skua.modules.equipment.controller; |
3 | 3 | ||
4 | import com.skua.core.api.vo.Result; | 4 | import com.skua.core.api.vo.Result; |
5 | import com.skua.core.aspect.annotation.AutoLog; | 5 | import com.skua.core.aspect.annotation.AutoLog; |
6 | import com.skua.core.context.BaseContextHandler; | ||
6 | import com.skua.modules.equipment.service.IPowerConsumptionAnalysisService; | 7 | import com.skua.modules.equipment.service.IPowerConsumptionAnalysisService; |
7 | import com.skua.modules.equipment.vo.AnysisParamsVO; | 8 | import com.skua.modules.equipment.vo.AnysisParamsVO; |
8 | import io.swagger.annotations.Api; | 9 | import io.swagger.annotations.Api; |
... | @@ -31,6 +32,7 @@ public class PowerConsumptionAnalysisController { | ... | @@ -31,6 +32,7 @@ public class PowerConsumptionAnalysisController { |
31 | @RequestMapping(value = "/data/display", method = RequestMethod.GET) | 32 | @RequestMapping(value = "/data/display", method = RequestMethod.GET) |
32 | public Result<Map<String, Object>> dataDisplay(AnysisParamsVO anysisParamsVO) { | 33 | public Result<Map<String, Object>> dataDisplay(AnysisParamsVO anysisParamsVO) { |
33 | Result<Map<String, Object>> result = new Result<>(); | 34 | Result<Map<String, Object>> result = new Result<>(); |
35 | anysisParamsVO.setFactoryId(BaseContextHandler.getDeparts()); | ||
34 | Map<String, Object> data = powerConsumptionAnalysisService.dataDisplay(anysisParamsVO); | 36 | Map<String, Object> data = powerConsumptionAnalysisService.dataDisplay(anysisParamsVO); |
35 | result.setResult(data); | 37 | result.setResult(data); |
36 | result.setSuccess(true); | 38 | result.setSuccess(true); | ... | ... |
1 | package com.skua.modules.equipment.service.impl; | 1 | package com.skua.modules.equipment.service.impl; |
2 | 2 | ||
3 | import com.google.common.collect.Maps; | 3 | import com.google.common.collect.Maps; |
4 | import com.skua.common.constant.ReportConstant; | ||
5 | import com.skua.common.report.ReportViewUtil; | ||
6 | import com.skua.common.report.vo.ReportItemVO; | ||
4 | import com.skua.core.context.SpringContextUtils; | 7 | import com.skua.core.context.SpringContextUtils; |
8 | import com.skua.modules.common.mapper.CommonSqlMapper; | ||
5 | import com.skua.modules.equipment.dto.*; | 9 | import com.skua.modules.equipment.dto.*; |
6 | import com.skua.modules.equipment.mapper.ComprehensiveSupervisionMapper; | 10 | import com.skua.modules.equipment.mapper.ComprehensiveSupervisionMapper; |
7 | import com.skua.modules.equipment.service.IPowerConsumptionAnalysisService; | 11 | import com.skua.modules.equipment.service.IPowerConsumptionAnalysisService; |
8 | import com.skua.modules.equipment.vo.AnysisParamsVO; | 12 | import com.skua.modules.equipment.vo.AnysisParamsVO; |
9 | import com.skua.modules.equipment.vo.MetricVo; | 13 | import com.skua.modules.equipment.vo.MetricVo; |
14 | import com.skua.modules.system.service.ReportViewService; | ||
15 | import com.skua.tool.util.JSUtils; | ||
10 | import lombok.extern.slf4j.Slf4j; | 16 | import lombok.extern.slf4j.Slf4j; |
11 | import org.apache.shiro.dao.DataAccessException; | 17 | import org.apache.shiro.dao.DataAccessException; |
12 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
... | @@ -26,14 +32,17 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna | ... | @@ -26,14 +32,17 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna |
26 | 32 | ||
27 | @Resource | 33 | @Resource |
28 | private ComprehensiveSupervisionMapper comprehensiveSupervisionMapper; | 34 | private ComprehensiveSupervisionMapper comprehensiveSupervisionMapper; |
29 | 35 | @Resource | |
36 | private CommonSqlMapper commonSqlMapper; | ||
30 | @Override | 37 | @Override |
31 | public Map<String, Object> dataDisplay(AnysisParamsVO anysisParamsVO) { | 38 | public Map<String, Object> dataDisplay(AnysisParamsVO anysisParamsVO) { |
32 | String time = anysisParamsVO.getTime(); | 39 | String time = anysisParamsVO.getTime(); |
33 | String factoryId = anysisParamsVO.getFactoryId(); | 40 | String factoryId = anysisParamsVO.getFactoryId(); |
41 | String startTime = time+"-01" ; | ||
42 | String endTime = time + "-31"; | ||
34 | Map<String, Object> result = Maps.newHashMap(); | 43 | Map<String, Object> result = Maps.newHashMap(); |
35 | //目标吨水电耗 | 44 | //目标吨水电耗 |
36 | result.put("mbdsdh","0.5"); | 45 | result.put("mbdsdh","0.65"); |
37 | if(anysisParamsVO.getFactoryId()==null||"".equals(anysisParamsVO.getFactoryId())){ | 46 | if(anysisParamsVO.getFactoryId()==null||"".equals(anysisParamsVO.getFactoryId())){ |
38 | result.put("zhdl","-"); | 47 | result.put("zhdl","-"); |
39 | result.put("dsdh","-"); | 48 | result.put("dsdh","-"); |
... | @@ -56,61 +65,29 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna | ... | @@ -56,61 +65,29 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna |
56 | //总耗电量 | 65 | //总耗电量 |
57 | List<String> months=new ArrayList<>(); | 66 | List<String> months=new ArrayList<>(); |
58 | months.add(time); | 67 | months.add(time); |
59 | List<AlarmDto> current=comprehensiveSupervisionMapper.selectDhByMonths(months,factoryId); | 68 | //String dataViewName3a24_value = ReportViewUtil.buildViewLike(ReportConstant.view2119,fields, departIds, startTime,endTime); |
60 | if (current.size()>0){ | 69 | ReportItemVO dlhjReportVO = ReportViewUtil.getSumValueByTBHB(ReportConstant.view3a24,ReportConstant.fieldDl, factoryId, startTime,endTime); |
61 | result.put("zhdl",this.getValue(Double.parseDouble(current.get(0).getV())/10000)); | 70 | result.put("zhdl", JSUtils.divide(dlhjReportVO.getValue(),10000)); |
62 | } | 71 | result.put("tbqnzhdl",JSUtils.divide(dlhjReportVO.getValueTb(),10000)); |
72 | result.put("hbsyzhdl",JSUtils.divide(dlhjReportVO.getValueHb(),10000)); | ||
73 | |||
63 | //吨水电耗 | 74 | //吨水电耗 |
64 | List<Map<String, Object>> monitorList = comprehensiveSupervisionMapper.selectClslByMonths(months,factoryId); | 75 | ReportItemVO cslReportVO = ReportViewUtil.getSumValueByTBHB(ReportConstant.view2119,ReportConstant.field_CSL, factoryId, startTime,endTime);//出水量 |
65 | if (monitorList.size()>0){ | 76 | result.put("dsdh", JSUtils.divide(dlhjReportVO.getValue(),cslReportVO.getValue())); |
66 | //吨水电耗 本月累计电耗量[kW·h]/本月累计处理水量[吨] | 77 | result.put("tbqndsdh", JSUtils.divide(dlhjReportVO.getValue(),cslReportVO.getValueTb())); |
67 | if (current.size()>0) { | 78 | result.put("hbsydsdh", JSUtils.divide(dlhjReportVO.getValue(),cslReportVO.getValueHb())); |
68 | result.put("dsdh", this.getValue(Double.parseDouble(current.get(0).getV()) / Double.parseDouble(monitorList.get(0).get("v").toString()))); | 79 | |
69 | } | ||
70 | } | ||
71 | //同比去年总耗电量 | ||
72 | String lastYear=this.getMonthBytime(-12,time); | ||
73 | months.clear(); | ||
74 | months.add(lastYear); | ||
75 | List<AlarmDto> last=comprehensiveSupervisionMapper.selectDhByMonths(months,factoryId); | ||
76 | if (last.size()>0){ | ||
77 | result.put("tbqnzhdl",this.getValue(Double.parseDouble(last.get(0).getV())/10000)); | ||
78 | } | ||
79 | //同比去年吨水电耗 | ||
80 | List<Map<String, Object>> monitorList2 = comprehensiveSupervisionMapper.selectClslByMonths(months,factoryId); | ||
81 | if (monitorList2.size()>0){ | ||
82 | //吨水电耗 累计电耗量[kW·h]/本月累计处理水量[吨] | ||
83 | if (last.size()>0) { | ||
84 | result.put("tbqndsdh", this.getValue(Double.parseDouble(last.get(0).getV()) / Double.parseDouble(monitorList2.get(0).get("v").toString()))); | ||
85 | } | ||
86 | } | ||
87 | //环比上月总耗电量 | ||
88 | String lastMonth=this.getMonthBytime(-1,time); | ||
89 | months.clear(); | ||
90 | months.add(lastMonth); | ||
91 | List<AlarmDto> lastMon=comprehensiveSupervisionMapper.selectDhByMonths(months,factoryId); | ||
92 | if (lastMon.size()>0){ | ||
93 | result.put("hbsyzhdl",this.getValue(Double.parseDouble(lastMon.get(0).getV())/10000)); | ||
94 | } | ||
95 | //环比上月吨水电耗 | ||
96 | List<Map<String, Object>> monitorList3 = comprehensiveSupervisionMapper.selectClslByMonths(months,factoryId); | ||
97 | if (monitorList3.size()>0){ | ||
98 | //吨水电耗 累计电耗量[kW·h]/本月累计处理水量[吨] | ||
99 | if (lastMon.size()>0) { | ||
100 | result.put("hbsydsdh", this.getValue(Double.parseDouble(lastMon.get(0).getV()) / Double.parseDouble(monitorList3.get(0).get("v").toString()))); | ||
101 | } | ||
102 | } | ||
103 | 80 | ||
104 | Map<String,Object> lowerMap=this.getLower(factoryId); | 81 | //4 历史最低吨水电耗 |
105 | //历史最低吨水电耗 | 82 | List<ReportItemVO> dsdhList = ReportViewUtil.getDateValueByDS(ReportConstant.view3a24,ReportConstant.fieldDl, factoryId, startTime,endTime,1,true);//吨水电耗集合 |
106 | if (lowerMap.get("mindsdh")!=null){ | 83 | if(dsdhList != null && !dsdhList.isEmpty()){ |
107 | result.put("mindsdh",this.getValue(Double.parseDouble(lowerMap.get("mindsdh")+""))); | 84 | result.put("mindsdh",dsdhList.get(0).getDsValue()); |
108 | result.put("mindsdhyf",lowerMap.get("mintime")); | 85 | result.put("mindsdhyf",dsdhList.get(0).getTime()); |
109 | }else { | ||
110 | result.put("mindsdh",""); | ||
111 | result.put("mindsdhyf",""); | ||
112 | } | 86 | } |
113 | if (result.get("zhdl")!=null&&result.get("tbqnzhdl")!=null){ | 87 | result.put("tbqnzhdlsl", JSUtils.subtract(result.get("zhdl"),result.get("tbqnzhdl"))); |
88 | result.put("tbqnzhdlbl",JSUtils.divide( result.get("tbqnzhdlsl") , result.get("tbqnzhdl"))); | ||
89 | |||
90 | /*if (result.get("zhdl")!=null&&result.get("tbqnzhdl")!=null){ | ||
114 | Double dsdh=Double.parseDouble(result.get("zhdl")+""); | 91 | Double dsdh=Double.parseDouble(result.get("zhdl")+""); |
115 | Double tbqnzhdl=Double.parseDouble(result.get("tbqnzhdl")+""); | 92 | Double tbqnzhdl=Double.parseDouble(result.get("tbqnzhdl")+""); |
116 | result.put("tbqnzhdlsl",this.getValue(dsdh-tbqnzhdl)); | 93 | result.put("tbqnzhdlsl",this.getValue(dsdh-tbqnzhdl)); |
... | @@ -119,8 +96,11 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna | ... | @@ -119,8 +96,11 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna |
119 | } else { | 96 | } else { |
120 | result.put("tbqnzhdlbl",this.getValue(((dsdh-tbqnzhdl)/tbqnzhdl)*100)); | 97 | result.put("tbqnzhdlbl",this.getValue(((dsdh-tbqnzhdl)/tbqnzhdl)*100)); |
121 | } | 98 | } |
122 | } | 99 | }*/ |
123 | if (result.get("zhdl")!=null&&result.get("hbsyzhdl")!=null){ | 100 | result.put("hbsyzhdlsl", JSUtils.subtract(result.get("zhdl"),result.get("hbsyzhdl"))); |
101 | result.put("hbsyzhdlbl",JSUtils.divide( result.get("hbsyzhdlbl") , result.get("hbsyzhdl"))); | ||
102 | |||
103 | /*if (result.get("zhdl")!=null&&result.get("hbsyzhdl")!=null){ | ||
124 | Double dsdh=Double.parseDouble(result.get("zhdl")+""); | 104 | Double dsdh=Double.parseDouble(result.get("zhdl")+""); |
125 | Double hbsyzhdl=Double.parseDouble(result.get("hbsyzhdl")+""); | 105 | Double hbsyzhdl=Double.parseDouble(result.get("hbsyzhdl")+""); |
126 | result.put("hbsyzhdlsl",this.getValue(dsdh-hbsyzhdl)); | 106 | result.put("hbsyzhdlsl",this.getValue(dsdh-hbsyzhdl)); |
... | @@ -129,8 +109,12 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna | ... | @@ -129,8 +109,12 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna |
129 | } else { | 109 | } else { |
130 | result.put("hbsyzhdlbl",this.getValue(((dsdh-hbsyzhdl)/hbsyzhdl)*100)); | 110 | result.put("hbsyzhdlbl",this.getValue(((dsdh-hbsyzhdl)/hbsyzhdl)*100)); |
131 | } | 111 | } |
132 | } | 112 | }*/ |
133 | if (result.get("dsdh")!=null&&result.get("tbqndsdh")!=null){ | 113 | |
114 | result.put("tbqndsdhsl", JSUtils.subtract(result.get("dsdh"),result.get("tbqndsdh"))); | ||
115 | result.put("tbqndsdhbl",JSUtils.multiply(JSUtils.divide( result.get("tbqndsdhsl") , result.get("tbqndsdh")),100)); | ||
116 | |||
117 | /*if (result.get("dsdh")!=null&&result.get("tbqndsdh")!=null){ | ||
134 | Double dsdh=Double.parseDouble(result.get("dsdh")+""); | 118 | Double dsdh=Double.parseDouble(result.get("dsdh")+""); |
135 | Double tbqndsdh=Double.parseDouble(result.get("tbqndsdh")+""); | 119 | Double tbqndsdh=Double.parseDouble(result.get("tbqndsdh")+""); |
136 | result.put("tbqndsdhsl",this.getValue(dsdh-tbqndsdh)); | 120 | result.put("tbqndsdhsl",this.getValue(dsdh-tbqndsdh)); |
... | @@ -139,8 +123,11 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna | ... | @@ -139,8 +123,11 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna |
139 | } else { | 123 | } else { |
140 | result.put("tbqndsdhbl",this.getValue(((dsdh-tbqndsdh)/tbqndsdh)*100)); | 124 | result.put("tbqndsdhbl",this.getValue(((dsdh-tbqndsdh)/tbqndsdh)*100)); |
141 | } | 125 | } |
142 | } | 126 | }*/ |
143 | if (result.get("dsdh")!=null&&result.get("hbsydsdh")!=null){ | 127 | |
128 | result.put("hbsydsdhsl", JSUtils.subtract(result.get("dsdh"),result.get("hbsydsdh"))); | ||
129 | result.put("hbsydsdhbl",JSUtils.multiply(JSUtils.divide( result.get("hbsydsdhsl") , result.get("hbsydsdh")),100)); | ||
130 | /*if (result.get("dsdh")!=null&&result.get("hbsydsdh")!=null){ | ||
144 | Double dsdh=Double.parseDouble(result.get("dsdh")+""); | 131 | Double dsdh=Double.parseDouble(result.get("dsdh")+""); |
145 | Double hbqndsdh=Double.parseDouble(result.get("hbsydsdh")+""); | 132 | Double hbqndsdh=Double.parseDouble(result.get("hbsydsdh")+""); |
146 | result.put("hbsydsdhsl",this.getValue(dsdh-hbqndsdh)); | 133 | result.put("hbsydsdhsl",this.getValue(dsdh-hbqndsdh)); |
... | @@ -149,7 +136,7 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna | ... | @@ -149,7 +136,7 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna |
149 | } else { | 136 | } else { |
150 | result.put("hbsydsdhbl",this.getValue(((dsdh-hbqndsdh)/hbqndsdh)*100)); | 137 | result.put("hbsydsdhbl",this.getValue(((dsdh-hbqndsdh)/hbqndsdh)*100)); |
151 | } | 138 | } |
152 | } | 139 | }*/ |
153 | return result; | 140 | return result; |
154 | } | 141 | } |
155 | 142 | ... | ... |
-
请 注册 或 登录 后发表评论