a0c024ef 康伟

kangwei :指挥中心-运行负荷率分析-处理水量详情

1 个父辈 d8f9987d
1 package com.skua.modules.algorithm.controller; 1 package com.skua.modules.algorithm.controller;
2 2
3 import com.alibaba.fastjson.JSONObject;
4 import com.skua.core.api.vo.Result; 3 import com.skua.core.api.vo.Result;
5 import com.skua.core.aspect.annotation.AutoLog; 4 import com.skua.core.aspect.annotation.AutoLog;
5 import com.skua.core.context.BaseContextHandler;
6 import com.skua.modules.algorithm.service.ICommandCentreService; 6 import com.skua.modules.algorithm.service.ICommandCentreService;
7 import com.skua.modules.algorithm.vo.*; 7 import com.skua.modules.algorithm.vo.*;
8 import com.skua.modules.guest.util.DateUtil; 8 import com.skua.modules.guest.util.DateUtil;
...@@ -14,14 +14,10 @@ import com.skua.tool.util.DigitalUtils; ...@@ -14,14 +14,10 @@ import com.skua.tool.util.DigitalUtils;
14 import io.swagger.annotations.Api; 14 import io.swagger.annotations.Api;
15 import io.swagger.annotations.ApiOperation; 15 import io.swagger.annotations.ApiOperation;
16 import lombok.extern.slf4j.Slf4j; 16 import lombok.extern.slf4j.Slf4j;
17 import org.apache.commons.lang3.StringUtils;
18 import org.springframework.beans.factory.annotation.Autowired; 17 import org.springframework.beans.factory.annotation.Autowired;
19 import org.springframework.web.bind.annotation.GetMapping; 18 import org.springframework.web.bind.annotation.GetMapping;
20 import org.springframework.web.bind.annotation.RequestBody;
21 import org.springframework.web.bind.annotation.RequestMapping; 19 import org.springframework.web.bind.annotation.RequestMapping;
22 import org.springframework.web.bind.annotation.RestController; 20 import org.springframework.web.bind.annotation.RestController;
23
24 import javax.servlet.http.HttpServletRequest;
25 import java.time.LocalDate; 21 import java.time.LocalDate;
26 import java.time.YearMonth; 22 import java.time.YearMonth;
27 import java.time.format.DateTimeFormatter; 23 import java.time.format.DateTimeFormatter;
...@@ -561,4 +557,16 @@ public class SysCommandCentreController { ...@@ -561,4 +557,16 @@ public class SysCommandCentreController {
561 return result; 557 return result;
562 } 558 }
563 559
560 //指挥中心----运行负荷率分析----处理水量详情
561 @AutoLog(value = "指挥中心-药剂趋势")
562 @ApiOperation(value="指挥中心-运行负荷率分析-处理水量详情", notes="指挥中心-运行负荷率分析-处理水量详情")
563 @GetMapping("/getCLSLXQ")
564 public Result<List<WaterTreatmentVO>> getCLSLXQ(String time){
565 Result<List<WaterTreatmentVO>> result = new Result<>();
566 //String departIds = "1818215093192753152,1818214519948836864,1818214145808531456";
567 List<WaterTreatmentVO> waterTrendVOList = commandCentreService.statisticsCLSLXQ(time, BaseContextHandler.getDeparts());
568 result.setResult(waterTrendVOList );
569 return result;
570 }
571
564 } 572 }
......
1 package com.skua.modules.algorithm.service; 1 package com.skua.modules.algorithm.service;
2 2
3 import com.skua.modules.algorithm.vo.WaterTreatmentVO;
3 import com.skua.modules.report.entity.FReportItemv; 4 import com.skua.modules.report.entity.FReportItemv;
4 import com.skua.modules.report.vo.*; 5 import com.skua.modules.report.vo.*;
5 6
...@@ -82,4 +83,11 @@ public interface ICommandCentreService { ...@@ -82,4 +83,11 @@ public interface ICommandCentreService {
82 * @return 83 * @return
83 */ 84 */
84 DepartDrugResult getYhTotal(String month); 85 DepartDrugResult getYhTotal(String month);
86
87 /***
88 * 指挥中心----运行负荷率分析----处理水量详情
89 * @param time
90 * @return
91 */
92 List<WaterTreatmentVO> statisticsCLSLXQ(String time ,String departIds);
85 } 93 }
......
1 package com.skua.modules.algorithm.service.impl; 1 package com.skua.modules.algorithm.service.impl;
2 2
3 import com.skua.common.report.ReportViewUtil; 3 import com.skua.common.report.ReportViewUtil;
4 import com.skua.core.context.SpringContextUtils;
5 import com.skua.core.util.ConvertUtils;
4 import com.skua.modules.algorithm.service.ICommandCentreService; 6 import com.skua.modules.algorithm.service.ICommandCentreService;
7 import com.skua.modules.algorithm.vo.WaterTreatmentVO;
8 import com.skua.modules.common.vo.DateVO;
9 import com.skua.modules.quartz.util.BaseUtil;
5 import com.skua.modules.report.entity.FReportItem; 10 import com.skua.modules.report.entity.FReportItem;
6 import com.skua.modules.report.entity.FReportItemv; 11 import com.skua.modules.report.entity.FReportItemv;
7 import com.skua.modules.report.mapper.FReportItemMapper; 12 import com.skua.modules.report.mapper.FReportItemMapper;
8 import com.skua.modules.report.vo.*; 13 import com.skua.modules.report.vo.*;
9 import com.skua.modules.report.mapper.FReportItemvMapper; 14 import com.skua.modules.report.mapper.FReportItemvMapper;
10 import com.skua.tool.util.DateUtils; 15 import com.skua.tool.util.DateUtils;
16 import org.springframework.jdbc.core.BeanPropertyRowMapper;
17 import org.springframework.jdbc.core.JdbcTemplate;
11 import org.springframework.stereotype.Service; 18 import org.springframework.stereotype.Service;
12 19
13 import javax.annotation.Resource; 20 import javax.annotation.Resource;
14 import java.time.YearMonth; 21 import java.time.YearMonth;
15 import java.time.format.DateTimeFormatter; 22 import java.time.format.DateTimeFormatter;
16 import java.util.ArrayList; 23 import java.util.ArrayList;
24 import java.util.HashMap;
17 import java.util.List; 25 import java.util.List;
26 import java.util.Map;
18 27
19 /** 28 /**
20 * <pre> 29 * <pre>
...@@ -31,6 +40,9 @@ public class CommandCentreServiceImpl implements ICommandCentreService { ...@@ -31,6 +40,9 @@ public class CommandCentreServiceImpl implements ICommandCentreService {
31 40
32 @Resource 41 @Resource
33 private FReportItemMapper reportItemMapper; 42 private FReportItemMapper reportItemMapper;
43
44 String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";// 水 COD TP TN NH3H
45 String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";//能耗报表
34 /** 46 /**
35 * 指挥中心---运行负荷率分析 47 * 指挥中心---运行负荷率分析
36 * @param reportItemvParam 48 * @param reportItemvParam
...@@ -146,6 +158,86 @@ public class CommandCentreServiceImpl implements ICommandCentreService { ...@@ -146,6 +158,86 @@ public class CommandCentreServiceImpl implements ICommandCentreService {
146 return departDrugResult; 158 return departDrugResult;
147 } 159 }
148 160
161
162 private JdbcTemplate getJdbcTemplate(){
163 JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
164 return masterDB;
165 }
166
167
168
169 /***
170 * 指挥中心----运行负荷率分析----处理水量详情
171 * @param time
172 * @return
173 */
174 public List<WaterTreatmentVO> statisticsCLSLXQ(String time, String departIds){
175 List<WaterTreatmentVO> dateList = null;
176 DateVO dateVO = new DateVO(time);//转换后的时间参数
177
178 long differenceDay = DateUtils.differenceDay(dateVO.getNowMonthStartDate(), dateVO.getNowMonthEndDate());
179 String departIdssss = BaseUtil.quoteEach(departIds , ",");
180 System.out.println("departIds = "+departIds);
181 //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+")";
182 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+")";
183 //水厂部门编号集合
184 departIds =getJdbcTemplate().queryForObject(factorySql,String.class);
185
186 //月产水量
187 Map<String,String> cslMap = commonQueryCsl(departIds, dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
188
189 String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departIds, dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
190 String sql = "select aaa.CSL 'csl' ,aaa.depart_id , d.depart_name, fi.pro_scale*10000 'pro_scale' from "+ dataViewName2119 +" aaa";
191 sql += " left join sys_factory_info fi on fi.depart_id = aaa.depart_id";
192 sql += " left join sys_depart d on d.id = aaa.depart_id";
193 sql += " order by aaa.CSL desc ";
194 dateList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<WaterTreatmentVO>(WaterTreatmentVO.class));
195
196
197 //环比:月产水量
198 Map<String,String> hbCslMap = commonQueryCsl(departIds, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime());
199 //同比:月产水量
200 Map<String,String> tbCslMap = commonQueryCsl(departIds, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());
201
202 int index =1;
203 if(dateList != null ){
204 for(WaterTreatmentVO waterTreatmentVO : dateList){
205 waterTreatmentVO.setRank(index++);//设置排名
206 if(waterTreatmentVO.getCSL() != null ){
207 waterTreatmentVO.setDayCsl( waterTreatmentVO.getCSL() / differenceDay );
208 }
209 /* waterTreatmentVO.setRank( index++);//设置排名
210 if(cslMap.get(waterTreatmentVO.getDepartId()) != null ){
211 waterTreatmentVO.setCsl(Double.parseDouble(cslMap.get(waterTreatmentVO.getDepartId())) );
212 waterTreatmentVO.setDayCsl( waterTreatmentVO.getCsl() / differenceDay );
213 }*/
214 if(hbCslMap.get(waterTreatmentVO.getDepartId()) != null ){
215 waterTreatmentVO.setHbcsl(Double.parseDouble(hbCslMap.get(waterTreatmentVO.getDepartId())) );
216 }
217 if(tbCslMap.get(waterTreatmentVO.getDepartId()) != null ){
218 waterTreatmentVO.setTbcsl(Double.parseDouble(tbCslMap.get(waterTreatmentVO.getDepartId())) );
219 }
220 }
221 }
222 return dateList;
223 }
224 //通用csl查询,返回Map<部门编号,CSL出水量>
225 public Map<String,String> commonQueryCsl(String departIds ,String startTime ,String endTime){
226 Map<String,String> cslMap = new HashMap<>();
227 String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departIds, startTime,endTime);
228 // System.out.println("dataViewName2119 ="+dataViewName2119 );
229 List<Map<String, Object>> dataMapList = getJdbcTemplate().queryForList(dataViewName2119);
230 if(dataMapList != null){
231 for(Map<String, Object> dataMap : dataMapList){
232 cslMap.put(ConvertUtils.getString(dataMap.get("depart_id")) ,ConvertUtils.getString(dataMap.get("CSL")));
233 }
234 }
235 return cslMap;
236 }
237
238
239
240
149 /** 241 /**
150 * 同比 242 * 同比
151 * @param month 243 * @param month
......
1 package com.skua.modules.algorithm.vo;
2
3 import io.swagger.annotations.ApiModel;
4 import io.swagger.annotations.ApiModelProperty;
5 import lombok.Data;
6
7 @Data
8 @ApiModel(value="指挥中心:运行负荷率分析:处理水量详情", description="指挥中心:运行负荷率分析:处理水量详情)")
9 public class WaterTreatmentVO {
10 @ApiModelProperty(value = "厂站编号")
11 private String departId;
12 @ApiModelProperty(value = "厂站名称")
13 private String departName;
14 @ApiModelProperty(value = "设计规模")
15 private Double proScale;
16
17 @ApiModelProperty(value = "处理水量")
18 private Double CSL;
19 @ApiModelProperty(value = "环比:处理水量")
20 private Double hbcsl;
21 @ApiModelProperty(value = "同比:处理水量")
22 private Double tbcsl;
23
24 @ApiModelProperty(value = "日均处理水量")
25 private Double dayCsl;
26
27 @ApiModelProperty(value = "环比:处理水量比例")
28 private Double hbcslbl;
29 @ApiModelProperty(value = "同比:处理水量比例")
30 private Double tbcslbl;
31
32 @ApiModelProperty(value = "负荷率")
33 private Double fhl;
34
35 @ApiModelProperty(value = "排名")
36 private Integer rank;
37
38 public Double getFhl() {
39 if(this.getCSL() != null && this.getProScale() != null && this.getProScale().doubleValue() > 0 ){
40 fhl = this.getCSL() / this.getProScale();
41 }
42 return fhl;
43 }
44
45 public Double getHbcslbl() {
46 if(this.getCSL() != null && this.getHbcsl() != null && this.getHbcsl().doubleValue() > 0){
47 hbcslbl = (this.getCSL() - this.getHbcsl()) * 100 / this.getHbcsl() ;
48 }
49 return hbcslbl;
50 }
51
52 public Double getTbcslbl() {
53 if(this.getCSL() != null && this.getTbcsl() != null && this.getTbcsl().doubleValue() > 0){
54 tbcslbl = (this.getCSL() - this.getTbcsl())*100 / this.getTbcsl() ;
55 }
56 return tbcslbl;
57 }
58 }
...@@ -3,6 +3,7 @@ package com.skua.modules.equipment.service.impl; ...@@ -3,6 +3,7 @@ package com.skua.modules.equipment.service.impl;
3 import com.google.common.collect.Maps; 3 import com.google.common.collect.Maps;
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;
6 import com.skua.modules.common.vo.DateVO; 7 import com.skua.modules.common.vo.DateVO;
7 import com.skua.modules.equipment.dto.*; 8 import com.skua.modules.equipment.dto.*;
8 import com.skua.modules.equipment.mapper.ComprehensiveSupervisionMapper; 9 import com.skua.modules.equipment.mapper.ComprehensiveSupervisionMapper;
...@@ -36,6 +37,14 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly ...@@ -36,6 +37,14 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
36 JdbcTemplate masterDB = (JdbcTemplate)SpringContextUtils.getBean("master"); 37 JdbcTemplate masterDB = (JdbcTemplate)SpringContextUtils.getBean("master");
37 return masterDB; 38 return masterDB;
38 } 39 }
40 private Map<String,Object> queryForMap(String sql){
41 List<Map<String, Object>> mapList = getJdbcTemplate().queryForList(sql);
42 if(mapList != null && !mapList.isEmpty()){
43 return mapList.get(0);
44 }else{
45 return new HashMap<>();
46 }
47 }
39 //数据展示 48 //数据展示
40 public DrugConsumptionDisplayVO dataDisplay(String time, String departId){ 49 public DrugConsumptionDisplayVO dataDisplay(String time, String departId){
41 DrugConsumptionDisplayVO displayVO = null; 50 DrugConsumptionDisplayVO displayVO = null;
...@@ -66,7 +75,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly ...@@ -66,7 +75,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
66 sql.append(" from "+dataViewName3a24+" aaa group by DATE_FORMAT(aaa.time,'%Y-%m') ) ddd ") ; 75 sql.append(" from "+dataViewName3a24+" aaa group by DATE_FORMAT(aaa.time,'%Y-%m') ) ddd ") ;
67 sql.append(" where ccc.time = ddd.time order by ( ddd.YH /ccc.CSL ) asc limit 1 ") ; 76 sql.append(" where ccc.time = ddd.time order by ( ddd.YH /ccc.CSL ) asc limit 1 ") ;
68 77
69 Map<String, Object> dsyhMap = getJdbcTemplate().queryForMap(sql.toString()); 78 Map<String, Object> dsyhMap = queryForMap(sql.toString());// getJdbcTemplate().queryForMap(sql.toString());
70 if(dsyhMap != null ){ 79 if(dsyhMap != null ){
71 displayVO.setLszddsyh( dsyhMap.get("dsyh")+"" ); 80 displayVO.setLszddsyh( dsyhMap.get("dsyh")+"" );
72 displayVO.setLszddsyhyf( dsyhMap.get("time")+"" ); 81 displayVO.setLszddsyhyf( dsyhMap.get("time")+"" );
...@@ -141,9 +150,10 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly ...@@ -141,9 +150,10 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
141 if(dataList != null ){ 150 if(dataList != null ){
142 for (Map<String,Object> map : dataList){ 151 for (Map<String,Object> map : dataList){
143 chartVO = new DrugConsumptionTrendChartVO(); 152 chartVO = new DrugConsumptionTrendChartVO();
144 chartVO.setTime( map.get("time")+""); 153 chartVO.setTime( ConvertUtils.getString( map.get("time")) );
145 if(map.get("dsyh") != null )chartVO.setDsyh( map.get("dsyh")+""); 154
146 if(map.get("YH") != null ) chartVO.setZyh( Double.parseDouble(map.get("YH")+"") ); 155 chartVO.setDsyh( ConvertUtils.getString(map.get("dsyh") ));
156 chartVO.setZyh( ConvertUtils.getDouble(map.get("YH"),0d) );
147 chartVOMap.put( chartVO.getTime(),chartVO ); 157 chartVOMap.put( chartVO.getTime(),chartVO );
148 } 158 }
149 } 159 }
...@@ -171,7 +181,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly ...@@ -171,7 +181,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
171 List<Map<String, Object>> dataMapList = getJdbcTemplate().queryForList(dataViewName2119); 181 List<Map<String, Object>> dataMapList = getJdbcTemplate().queryForList(dataViewName2119);
172 if(dataMapList != null ){ 182 if(dataMapList != null ){
173 for(Map<String, Object> dataMap : dataMapList){ 183 for(Map<String, Object> dataMap : dataMapList){
174 if( dataMap.get("CSL") != null) nowMonthCSL = Double.parseDouble(dataMap.get("CSL") +""); 184 nowMonthCSL = ConvertUtils.getDouble(dataMap.get("CSL") ,0,2);
175 } 185 }
176 } 186 }
177 187
...@@ -181,7 +191,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly ...@@ -181,7 +191,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
181 dataMapList = getJdbcTemplate().queryForList(dataViewName2119); 191 dataMapList = getJdbcTemplate().queryForList(dataViewName2119);
182 if(dataMapList != null ){ 192 if(dataMapList != null ){
183 for(Map<String, Object> dataMap : dataMapList){ 193 for(Map<String, Object> dataMap : dataMapList){
184 if( dataMap.get("CSL") != null) hbsyCsl = Double.parseDouble(dataMap.get("CSL") +""); 194 hbsyCsl = ConvertUtils.getDouble(dataMap.get("CSL") ,0,2);
185 } 195 }
186 } 196 }
187 //同比处理水量 197 //同比处理水量
...@@ -190,7 +200,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly ...@@ -190,7 +200,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
190 dataMapList = getJdbcTemplate().queryForList(dataViewName2119); 200 dataMapList = getJdbcTemplate().queryForList(dataViewName2119);
191 if(dataMapList != null ){ 201 if(dataMapList != null ){
192 for(Map<String, Object> dataMap : dataMapList){ 202 for(Map<String, Object> dataMap : dataMapList){
193 if( dataMap.get("CSL") != null) tbqnCsl = Double.parseDouble(dataMap.get("CSL") +""); 203 tbqnCsl = ConvertUtils.getDouble(dataMap.get("CSL") ,0,2);
194 } 204 }
195 } 205 }
196 206
...@@ -199,13 +209,13 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly ...@@ -199,13 +209,13 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
199 209
200 //本月药剂 总药耗 210 //本月药剂 总药耗
201 String dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,fileds, departId, dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate()); 211 String dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,fileds, departId, dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
202 Map<String, Object> nowMonthDataMap = getJdbcTemplate().queryForMap(dataViewName3a24); 212 Map<String, Object> nowMonthDataMap =queryForMap(dataViewName3a24);// getJdbcTemplate().queryForMap(dataViewName3a24);
203 //环比:上月药剂 总药耗 213 //环比:上月药剂 总药耗
204 dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,fileds, departId, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime()); 214 dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,fileds, departId, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime());
205 Map<String, Object> lastMonthDataMap = getJdbcTemplate().queryForMap(dataViewName3a24); 215 Map<String, Object> lastMonthDataMap = queryForMap(dataViewName3a24);//getJdbcTemplate().queryForMap(dataViewName3a24);
206 //同比:去年本月药剂: 总药耗 216 //同比:去年本月药剂: 总药耗
207 dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,fileds, departId, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime()); 217 dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,fileds, departId, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());
208 Map<String, Object> lastYearMonthDataMap = getJdbcTemplate().queryForMap(dataViewName3a24); 218 Map<String, Object> lastYearMonthDataMap = queryForMap(dataViewName3a24);//getJdbcTemplate().queryForMap(dataViewName3a24);
209 219
210 String filedsSql = "select item_code ,item_alias from f_report_item where item_code in ('PAMZ','PAMF','PAMRJ','SCLPAMZ','SCLPAMF','NACLO','PACGT','PACYT','FESO4G','FESO4Y','H2O2','CH3COOH','SH','FECL3','HXT','PFS','CH3COONA','GXCLJ','YWL','RYXNJ','FHTY') "; 220 String filedsSql = "select item_code ,item_alias from f_report_item where item_code in ('PAMZ','PAMF','PAMRJ','SCLPAMZ','SCLPAMF','NACLO','PACGT','PACYT','FESO4G','FESO4Y','H2O2','CH3COOH','SH','FECL3','HXT','PFS','CH3COONA','GXCLJ','YWL','RYXNJ','FHTY') ";
211 List<Map<String, Object>> filedsDataList = getJdbcTemplate().queryForList(filedsSql); 221 List<Map<String, Object>> filedsDataList = getJdbcTemplate().queryForList(filedsSql);
...@@ -220,13 +230,14 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly ...@@ -220,13 +230,14 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
220 //整理数据 230 //整理数据
221 if(filedsDataList != null ){ 231 if(filedsDataList != null ){
222 for( Map<String,Object> filedsMap : filedsDataList){ 232 for( Map<String,Object> filedsMap : filedsDataList){
223 drugCode = filedsMap.get("item_code")+""; 233 drugCode = ConvertUtils.getString(filedsMap.get("item_code") );
224 //Double CSL, Double tbqnCsl, Double hbsyCsl, Double zyh, Double hbsyzyh, Double tbqnzyh 234 //Double CSL, Double tbqnCsl, Double hbsyCsl, Double zyh, Double hbsyzyh, Double tbqnzyh
225 zyh = nowMonthDataMap.get(drugCode) != null ? Double.parseDouble(nowMonthDataMap.get(drugCode) +""):null; 235 zyh = ConvertUtils.getDouble(nowMonthDataMap.get(drugCode),0,2);
226 hbsyzyh = lastMonthDataMap.get(drugCode) != null ? Double.parseDouble(lastMonthDataMap.get(drugCode) +""):null; 236 hbsyzyh = ConvertUtils.getDouble(lastMonthDataMap.get(drugCode),0,2);
227 tbqnzyh = lastYearMonthDataMap.get(drugCode) != null ? Double.parseDouble(lastYearMonthDataMap.get(drugCode) +""):null; 237 tbqnzyh = ConvertUtils.getDouble(lastYearMonthDataMap.get(drugCode),0,2);
238
228 displayVO = new DrugConsumptionDisplayVO(nowMonthCSL,tbqnCsl,hbsyCsl,zyh ,hbsyzyh ,tbqnzyh ); 239 displayVO = new DrugConsumptionDisplayVO(nowMonthCSL,tbqnCsl,hbsyCsl,zyh ,hbsyzyh ,tbqnzyh );
229 displayVO.setDrugCode(drugCode);displayVO.setDrugName(filedsMap.get("item_alias")+""); 240 displayVO.setDrugCode(drugCode);displayVO.setDrugName(ConvertUtils.getString(filedsMap.get("item_alias")));
230 drugConsumptionDisplayList.add( displayVO ); 241 drugConsumptionDisplayList.add( displayVO );
231 } 242 }
232 } 243 }
...@@ -241,9 +252,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly ...@@ -241,9 +252,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
241 DrugConsumptionDisplayVO displayVO = null; 252 DrugConsumptionDisplayVO displayVO = null;
242 if(filedsDataList != null ){ 253 if(filedsDataList != null ){
243 for( Map<String,Object> filedsMap : filedsDataList){ 254 for( Map<String,Object> filedsMap : filedsDataList){
244 displayVO = new DrugConsumptionDisplayVO(); 255 displayVO = new DrugConsumptionDisplayVO(ConvertUtils.getString(filedsMap.get("item_code")) ,ConvertUtils.getString( filedsMap.get("item_alias") ));
245 if(filedsMap.get("item_code") != null ) displayVO.setDrugCode(filedsMap.get("item_code")+"");
246 if(filedsMap.get("item_alias") != null ) displayVO.setDrugName(filedsMap.get("item_alias")+"");
247 drugConsumptionDisplayList.add( displayVO ); 256 drugConsumptionDisplayList.add( displayVO );
248 } 257 }
249 } 258 }
...@@ -265,7 +274,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly ...@@ -265,7 +274,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
265 List<Map<String, Object>> dataList = getJdbcTemplate().queryForList(sql); 274 List<Map<String, Object>> dataList = getJdbcTemplate().queryForList(sql);
266 if(dataList != null){ 275 if(dataList != null){
267 for(Map<String,Object> map : dataList){ 276 for(Map<String,Object> map : dataList){
268 jsssDataMap.put(map.get("time")+"",map.get("JSSS")+""); 277 jsssDataMap.put(ConvertUtils.getString(map.get("time")),ConvertUtils.getString(map.get("JSSS")));
269 } 278 }
270 } 279 }
271 280
...@@ -275,11 +284,12 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly ...@@ -275,11 +284,12 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
275 CorrelationAnalysisVO correlationAnalysisVO = null; 284 CorrelationAnalysisVO correlationAnalysisVO = null;
276 if(dataList != null){ 285 if(dataList != null){
277 for(Map<String,Object> map : dataList){ 286 for(Map<String,Object> map : dataList){
278 correlationAnalysisVO = new CorrelationAnalysisVO(); 287 //String time, String zyh, String dnhl, String wnl, String wnhsl
279 if(map.get("time") != null ) correlationAnalysisVO.setTime(map.get("time") +""); 288 correlationAnalysisVO = new CorrelationAnalysisVO(ConvertUtils.getString(map.get("time")),ConvertUtils.getString(map.get("zyh")),ConvertUtils.getString(map.get("wnl")),ConvertUtils.getString(map.get("wnhsl")));
289 /* if(map.get("time") != null ) correlationAnalysisVO.setTime(map.get("time") +"");
280 if(map.get("zyh") != null ) correlationAnalysisVO.setZyh(map.get("zyh") +""); 290 if(map.get("zyh") != null ) correlationAnalysisVO.setZyh(map.get("zyh") +"");
281 if(map.get("wnl") != null ) correlationAnalysisVO.setWnl(map.get("wnl") +""); 291 if(map.get("wnl") != null ) correlationAnalysisVO.setWnl(map.get("wnl") +"");
282 if(map.get("wnhsl") != null ) correlationAnalysisVO.setWnhsl(map.get("wnhsl") +""); 292 if(map.get("wnhsl") != null ) correlationAnalysisVO.setWnhsl(map.get("wnhsl") +"");*/
283 zyhMap.put(map.get("time").toString(),correlationAnalysisVO); 293 zyhMap.put(map.get("time").toString(),correlationAnalysisVO);
284 } 294 }
285 } 295 }
...@@ -314,10 +324,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly ...@@ -314,10 +324,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
314 List<Map<String, Object>> mapList = getJdbcTemplate().queryForList(sql2.toString()); 324 List<Map<String, Object>> mapList = getJdbcTemplate().queryForList(sql2.toString());
315 String YH = null; 325 String YH = null;
316 for(Map<String,Object> map : mapList ){ 326 for(Map<String,Object> map : mapList ){
317 if(map.get("YH") != null ){ 327 YH = ConvertUtils.getString(map.get("YH"));
318 YH = map.get("YH").toString();
319 }
320
321 } 328 }
322 return YH!=null ? Double.parseDouble(YH) : null; 329 return YH!=null ? Double.parseDouble(YH) : null;
323 } 330 }
...@@ -327,9 +334,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly ...@@ -327,9 +334,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
327 List<Map<String, Object>> mapList = getJdbcTemplate().queryForList(dataViewName2119); 334 List<Map<String, Object>> mapList = getJdbcTemplate().queryForList(dataViewName2119);
328 String csl = null; 335 String csl = null;
329 for(Map<String,Object> map : mapList ){ 336 for(Map<String,Object> map : mapList ){
330 if(map.get("CSL") != null ){ 337 csl = ConvertUtils.getString(map.get("CSL"));
331 csl = map.get("CSL").toString();
332 }
333 } 338 }
334 return csl!=null ? Double.parseDouble(csl) : null; 339 return csl!=null ? Double.parseDouble(csl) : null;
335 } 340 }
...@@ -346,7 +351,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly ...@@ -346,7 +351,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
346 * @return 351 * @return
347 */ 352 */
348 private String getMonthBytime(int month,String time) { 353 private String getMonthBytime(int month,String time) {
349 SimpleDateFormat format=new SimpleDateFormat("yyyy-MM"); 354 SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
350 Calendar calendar = Calendar.getInstance(); 355 Calendar calendar = Calendar.getInstance();
351 try { 356 try {
352 calendar.setTime(format.parse(time)); 357 calendar.setTime(format.parse(time));
......
...@@ -33,6 +33,16 @@ public class CorrelationAnalysisVO { ...@@ -33,6 +33,16 @@ public class CorrelationAnalysisVO {
33 @ApiModelProperty(value = "污泥含水量") 33 @ApiModelProperty(value = "污泥含水量")
34 private String wnhsl; 34 private String wnhsl;
35 35
36 public CorrelationAnalysisVO() {
37 }
38
39 public CorrelationAnalysisVO(String time, String zyh, String wnl, String wnhsl) {
40 this.time = time;
41 this.zyh = zyh;
42 this.wnl = wnl;
43 this.wnhsl = wnhsl;
44 }
45
36 ////吨泥耗量=絮凝剂总量/干污泥总量 46 ////吨泥耗量=絮凝剂总量/干污泥总量
37 //干污泥量=产泥量*(1-污泥含水率) 47 //干污泥量=产泥量*(1-污泥含水率)
38 public String getDnhl() { 48 public String getDnhl() {
......
...@@ -74,6 +74,11 @@ public class DrugConsumptionDisplayVO { ...@@ -74,6 +74,11 @@ public class DrugConsumptionDisplayVO {
74 public DrugConsumptionDisplayVO() { 74 public DrugConsumptionDisplayVO() {
75 } 75 }
76 76
77 public DrugConsumptionDisplayVO(String drugCode, String drugName) {
78 this.drugCode = drugCode;
79 this.drugName = drugName;
80 }
81
77 public DrugConsumptionDisplayVO(Double CSL, Double tbqnCsl, Double hbsyCsl, Double zyh, Double hbsyzyh, Double tbqnzyh) { 82 public DrugConsumptionDisplayVO(Double CSL, Double tbqnCsl, Double hbsyCsl, Double zyh, Double hbsyzyh, Double tbqnzyh) {
78 this.CSL = CSL; 83 this.CSL = CSL;
79 this.tbqnCsl = tbqnCsl; 84 this.tbqnCsl = tbqnCsl;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!