f674f251 张雷

化验日报和生产日报修改

1 个父辈 549362dd
1 package com.skua.modules.custom.handle.impl;
2
3 import com.skua.common.constant.ReportConstant;
4 import com.skua.common.report.ReportViewUtil;
5 import com.skua.common.report.entity.ValueEntity;
6 import com.skua.core.util.ConvertUtils;
7 import com.skua.modules.common.service.ICommonSqlService;
8 import com.skua.modules.custom.handle.ICustomHandle;
9 import com.skua.modules.custom.service.IFCustomReportDatasetService;
10 import com.skua.modules.custom.vo.FCustomReportDatasetVO;
11 import com.skua.modules.dataAnalysis.service.IFactoryCenterService;
12 import com.skua.modules.dataAnalysis.vo.WaterQualityMonitoringDetailVO;
13 import org.apache.commons.lang.StringUtils;
14 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.stereotype.Component;
16
17 import javax.annotation.Resource;
18 import java.util.*;
19
20 /**
21 * <pre>
22 * 生产日报自定义逻辑
23 * </pre>
24 * @author zhanglei
25 * @version V0.1, 2024年11月17日 上午9:40:17
26 */
27 @Component("hyrbReportHandle")
28 public class HyrbReportHandle implements ICustomHandle{
29 @Autowired
30 private IFCustomReportDatasetService fCustomReportDatasetService;
31 @Resource
32 private IFactoryCenterService factoryCenterService;
33 @Autowired
34 private ICommonSqlService commonSqlService;
35
36 @Override
37 public Map<String, List<Map<String, ValueEntity>>> buildDataMap(String reportId, String startTime, String endTime,
38 String departId,String indexCode) {
39 Map<String, Object> levelMap = factoryCenterService.getMonitorThreshold(departId);
40 Map<String,List<Map<String,ValueEntity>>> dataMap = new HashMap<String,List<Map<String,ValueEntity>>>();
41 //获取数据集
42 //获取填报数据及报表数据项信息,组装报表所需数据机构
43 List<Map<String,ValueEntity>> list = new ArrayList<Map<String,ValueEntity>>();
44 //根据数据集id获取数据项及填报数据
45 Map<String,String> dataFieldDict = new HashMap<String,String>();
46 List<FCustomReportDatasetVO> dataFieldList = fCustomReportDatasetService.getDataField(ReportConstant.view9bff);
47 for(FCustomReportDatasetVO dataField : dataFieldList) {
48 dataFieldDict.put(dataField.getDatasetId(), dataField.getDatasetName());
49 }
50 //添加厂站、时间字段
51 dataFieldDict.put("depart_name", "厂站名称");
52 dataFieldDict.put("time", "时间");
53 dataFieldDict.put("paramTime", "参数时间");
54 String dataViewName9bff = ReportViewUtil.buildView(ReportConstant.view9bff,"", departId, startTime, endTime);
55 //结果集
56 List<Map<String, Object>> szMapList = fCustomReportDatasetService.queryHyReport(dataViewName9bff, startTime, endTime, departId);
57 list = changeDataList(szMapList,list,startTime,dataFieldDict);
58 List<Map<String,ValueEntity>> dList = new ArrayList<>();
59 Map<String,ValueEntity> newDataMap = new HashMap<>();
60 List<WaterQualityMonitoringDetailVO> realDataList = factoryCenterService.queryMonitoringData(departId,null);
61 for (WaterQualityMonitoringDetailVO waterQualityMonitoring : realDataList) {
62 if("in".equals(waterQualityMonitoring.getParmType())){
63 ValueEntity inCodEntity = new ValueEntity();
64 inCodEntity.setValue(waterQualityMonitoring.getCodVal());
65 newDataMap.put("在线进水COD", inCodEntity);
66
67 ValueEntity inNh3nEntity = new ValueEntity();
68 inNh3nEntity.setValue(waterQualityMonitoring.getNh3Val());
69 newDataMap.put("在线进水氨氮", inNh3nEntity);
70
71 ValueEntity inTnEntity = new ValueEntity();
72 inTnEntity.setValue(waterQualityMonitoring.getTnVal());
73 newDataMap.put("在线进水总氮", inTnEntity);
74
75 ValueEntity inTpEntity = new ValueEntity();
76 inTpEntity.setValue(waterQualityMonitoring.getTpVal());
77 newDataMap.put("在线进水总磷", inTpEntity);
78
79 ValueEntity inPhEntity = new ValueEntity();
80 inPhEntity.setValue(waterQualityMonitoring.getPhVal());
81 newDataMap.put("在线进水PH", inPhEntity);
82
83 ValueEntity inSsEntity = new ValueEntity();
84 inSsEntity.setValue(waterQualityMonitoring.getZdVal());
85 newDataMap.put("在线进水SS", inSsEntity);
86
87 ValueEntity inBodEntity = new ValueEntity();
88 inBodEntity.setValue(waterQualityMonitoring.getCodVal());
89 newDataMap.put("在线进水BOD", inBodEntity);
90 }
91 if("out".equals(waterQualityMonitoring.getParmType())){
92 ValueEntity outCodEntity = new ValueEntity();
93 outCodEntity.setValue(waterQualityMonitoring.getCodVal());
94 newDataMap.put("在线出水COD", outCodEntity);
95
96 ValueEntity outNh3nEntity = new ValueEntity();
97 outNh3nEntity.setValue(waterQualityMonitoring.getNh3Val());
98 newDataMap.put("在线出水氨氮", outNh3nEntity);
99
100 ValueEntity outTnEntity = new ValueEntity();
101 outTnEntity.setValue(waterQualityMonitoring.getTnVal());
102 newDataMap.put("在线出水总氮", outTnEntity);
103
104 ValueEntity outTpEntity = new ValueEntity();
105 outTpEntity.setValue(waterQualityMonitoring.getTpVal());
106 newDataMap.put("在线出水总磷", outTpEntity);
107
108 ValueEntity outPhEntity = new ValueEntity();
109 outPhEntity.setValue(waterQualityMonitoring.getPhVal());
110 newDataMap.put("在线出水PH", outPhEntity);
111
112 ValueEntity outSsEntity = new ValueEntity();
113 outSsEntity.setValue(waterQualityMonitoring.getZdVal());
114 newDataMap.put("在线出水SS", outSsEntity);
115
116 ValueEntity outBodEntity = new ValueEntity();
117 outBodEntity.setValue(waterQualityMonitoring.getCodVal());
118 newDataMap.put("在线出水BOD", outBodEntity);
119 }
120 }
121 ValueEntity valueEntity = new ValueEntity();
122 valueEntity.setValue(startTime);
123 newDataMap.put("时间", valueEntity);
124 Map<String,ValueEntity> dMap = new HashMap<>();
125 if(list.size() > 0){
126 dMap = list.get(0);
127 if(levelMap!=null){
128 dMap = changeDataColor(dMap,levelMap);
129 }
130 newDataMap.putAll(dMap);
131 }else{
132 for (Map.Entry<String, String> data : dataFieldDict.entrySet()) {
133 ValueEntity dataEntity = new ValueEntity();
134 dataEntity.setValue(null);
135 newDataMap.put(data.getValue(), dataEntity);
136 }
137 for (Map.Entry<String, Object> level : levelMap.entrySet()) {
138 ValueEntity levelEntity = new ValueEntity();
139 levelEntity.setValue(level.getValue().toString());
140 if("JSBOD".equals(level.getKey())){
141 newDataMap.put("化验进水BOD标准", levelEntity);
142 continue;
143 }
144 if("CSBOD".equals(level.getKey())){
145 newDataMap.put("化验出水BOD标准", levelEntity);
146 continue;
147 }
148 if("JSCOD".equals(level.getKey())){
149 newDataMap.put("化验进水COD标准", levelEntity);
150 continue;
151 }
152 if("CSCOD".equals(level.getKey())){
153 newDataMap.put("化验出水COD标准", levelEntity);
154 continue;
155 }
156 if("JSNH3N".equals(level.getKey())){
157 newDataMap.put("化验进水氨氮标准", levelEntity);
158 continue;
159 }
160 if("CSNH3N".equals(level.getKey())){
161 newDataMap.put("化验出水氨氮标准", levelEntity);
162 }
163 if("JSTN".equals(level.getKey())){
164 newDataMap.put("化验进水总氮标准", levelEntity);
165 continue;
166 }
167 if("CSTN".equals(level.getKey())){
168 newDataMap.put("化验出水总氮标准", levelEntity);
169 continue;
170 }
171 if("JSTP".equals(level.getKey())){
172 newDataMap.put("化验进水总磷标准", levelEntity);
173 continue;
174 }
175 if("CSTP".equals(level.getKey())){
176 newDataMap.put("化验出水总磷标准", levelEntity);
177 continue;
178 }
179 if("JSPH".equals(level.getKey())){
180 newDataMap.put("化验进水PH标准", levelEntity);
181 continue;
182 }
183 if("CSPH".equals(level.getKey())){
184 newDataMap.put("化验出水PH标准", levelEntity);
185 continue;
186 }
187 if("JSSS".equals(level.getKey())){
188 newDataMap.put("化验进水SS标准", levelEntity);
189 continue;
190 }
191 if("CSSS".equals(level.getKey())){
192 newDataMap.put("化验出水SS标准", levelEntity);
193 continue;
194 }
195 }
196 }
197 dList.add(newDataMap);
198 dataMap.put("化验数据日报表", dList);
199 return dataMap;
200 }
201 @Override
202 public String buildWaterQualityAlarmValue(String reportId, String departId, String json) {
203 return json;
204 }
205
206 /**
207 * 构造LIST
208 * @param szMapList
209 * @param list
210 * @param startTime
211 * @param dataFieldDict
212 * @return
213 */
214 private List<Map<String, ValueEntity>> changeDataList(List<Map<String, Object>> szMapList, List<Map<String, ValueEntity>> list,
215 String startTime, Map<String, String> dataFieldDict) {
216 for(Map<String,Object> valueMap : szMapList) {
217 Map<String,ValueEntity> handleMap = new HashMap<String,ValueEntity>();
218 //添加时间参数
219 ValueEntity startTimeValueEntity = new ValueEntity();
220 startTimeValueEntity.setValue(startTime);
221 handleMap.put("参数时间", startTimeValueEntity);
222 Set<String> keySet = valueMap.keySet();
223 for(String key : keySet) {
224 if(!StringUtils.isEmpty(dataFieldDict.get(key))) {
225 ValueEntity valueEntity = new ValueEntity();
226 valueEntity.setValue(ConvertUtils.getString(valueMap.get(key)));
227 handleMap.put(dataFieldDict.get(key),valueEntity);
228 }
229 }
230 list.add(handleMap);
231 }
232 return list;
233 }
234
235 /**
236 * 指标变色
237 * @param map
238 * @param levelMap
239 * @return
240 */
241 public Map<String,ValueEntity> changeDataColor(Map<String,ValueEntity> map,Map<String, Object> levelMap){
242 Map<String,ValueEntity> result = new HashMap<>();
243 for (Map.Entry<String, ValueEntity> entry : map.entrySet()) {
244 ValueEntity levelEntity = new ValueEntity();
245 String key = entry.getKey();
246 ValueEntity value = entry.getValue();
247 if("化验进水COD".equals(key)){
248 if(ConvertUtils.isNotEmpty(levelMap.get("JSCOD"))){
249 if(ConvertUtils.isNotEmpty(value.getValue())){
250 double v = Double.parseDouble(value.getValue());
251 double l = Double.parseDouble(levelMap.get("JSCOD").toString());
252 if(v > l){
253 value.setDataSourceColor("red");
254 value.setTitle("超过上限"+l+"mg/L");
255 }
256 levelEntity.setValue(levelMap.get("JSCOD").toString());
257 }
258 }
259 }
260 if("化验出水COD".equals(key)){
261 if(ConvertUtils.isNotEmpty(levelMap.get("CSCOD"))){
262 if(ConvertUtils.isNotEmpty(value.getValue())){
263 double v = Double.parseDouble(value.getValue());
264 double l = Double.parseDouble(levelMap.get("CSCOD").toString());
265 if(v > l){
266 value.setDataSourceColor("red");
267 value.setTitle("超过上限"+l+"mg/L");
268 }
269 levelEntity.setValue(levelMap.get("CSCOD").toString());
270 }
271 }
272 }
273 if("化验进水BOD".equals(key)){
274 if(ConvertUtils.isNotEmpty(levelMap.get("JSBOD"))){
275 if(ConvertUtils.isNotEmpty(value.getValue())){
276 double v = Double.parseDouble(value.getValue());
277 double l = Double.parseDouble(levelMap.get("JSBOD").toString());
278 if(v > l){
279 value.setDataSourceColor("red");
280 value.setTitle("超过上限"+l+"mg/L");
281 }
282 levelEntity.setValue(levelMap.get("JSBOD").toString());
283 }
284 }
285 }
286 if("化验出水BOD".equals(key)){
287 if(ConvertUtils.isNotEmpty(levelMap.get("CSBOD"))){
288 if(ConvertUtils.isNotEmpty(value.getValue())){
289 double v = Double.parseDouble(value.getValue());
290 double l = Double.parseDouble(levelMap.get("CSBOD").toString());
291 if(v > l){
292 value.setDataSourceColor("red");
293 value.setTitle("超过上限"+l+"mg/L");
294 }
295 levelEntity.setValue(levelMap.get("CSBOD").toString());
296 }
297 }
298 }
299 if("化验进水氨氮".equals(key)){
300 if(ConvertUtils.isNotEmpty(levelMap.get("JSNH3N"))){
301 if(ConvertUtils.isNotEmpty(value.getValue())){
302 double v = Double.parseDouble(value.getValue());
303 double l = Double.parseDouble(levelMap.get("JSNH3N").toString());
304 if(v > l){
305 value.setDataSourceColor("red");
306 value.setTitle("超过上限"+l+"mg/L");
307 }
308 levelEntity.setValue(levelMap.get("JSNH3N").toString());
309 }
310 }
311 }
312 if("化验出水氨氮".equals(key)){
313 if(ConvertUtils.isNotEmpty(levelMap.get("CSNH3N"))){
314 if(ConvertUtils.isNotEmpty(value.getValue())){
315 double v = Double.parseDouble(value.getValue());
316 double l = Double.parseDouble(levelMap.get("CSNH3N").toString());
317 if(v > l){
318 value.setDataSourceColor("red");
319 value.setTitle("超过上限"+l+"mg/L");
320 }
321 levelEntity.setValue(levelMap.get("CSNH3N").toString());
322 }
323 }
324 }
325 if("化验进水总氮".equals(key)){
326 if(ConvertUtils.isNotEmpty(levelMap.get("JSTN"))){
327 if(ConvertUtils.isNotEmpty(value.getValue())){
328 double v = Double.parseDouble(value.getValue());
329 double l = Double.parseDouble(levelMap.get("JSTN").toString());
330 if(v > l){
331 value.setDataSourceColor("red");
332 value.setTitle("超过上限"+l+"mg/L");
333 }
334 levelEntity.setValue(levelMap.get("JSTN").toString());
335 }
336 }
337 }
338 if("化验出水总氮".equals(key)){
339 if(ConvertUtils.isNotEmpty(levelMap.get("CSTN"))){
340 if(ConvertUtils.isNotEmpty(value.getValue())){
341 double v = Double.parseDouble(value.getValue());
342 double l = Double.parseDouble(levelMap.get("CSTN").toString());
343 if(v > l){
344 value.setDataSourceColor("red");
345 value.setTitle("超过上限"+l+"mg/L");
346 }
347 levelEntity.setValue(levelMap.get("CSTN").toString());
348 }
349 }
350 }
351 if("化验进水总磷".equals(key)){
352 if(ConvertUtils.isNotEmpty(levelMap.get("JSTP"))){
353 if(ConvertUtils.isNotEmpty(value.getValue())){
354 double v = Double.parseDouble(value.getValue());
355 double l = Double.parseDouble(levelMap.get("JSTP").toString());
356 if(v > l){
357 value.setDataSourceColor("red");
358 value.setTitle("超过上限"+l+"mg/L");
359 }
360 levelEntity.setValue(levelMap.get("JSTP").toString());
361 }
362 }
363 }
364 if("化验出水总磷".equals(key)){
365 if(ConvertUtils.isNotEmpty(levelMap.get("CSTP"))){
366 if(ConvertUtils.isNotEmpty(value.getValue())){
367 double v = Double.parseDouble(value.getValue());
368 double l = Double.parseDouble(levelMap.get("CSTP").toString());
369 if(v > l){
370 value.setDataSourceColor("red");
371 value.setTitle("超过上限"+l+"mg/L");
372 }
373 levelEntity.setValue(levelMap.get("CSTP").toString());
374 }
375 }
376 }
377 if("化验进水PH".equals(key)){
378 if(ConvertUtils.isNotEmpty(levelMap.get("JSPH"))){
379 if(ConvertUtils.isNotEmpty(value.getValue())){
380 double v = Double.parseDouble(value.getValue());
381 double l = Double.parseDouble(levelMap.get("JSPH").toString());
382 if(v > l){
383 value.setDataSourceColor("red");
384 value.setTitle("超过上限"+l);
385 }
386 levelEntity.setValue(levelMap.get("JSPH").toString());
387 }
388 }
389 }
390 if("化验出水PH".equals(key)){
391 if(ConvertUtils.isNotEmpty(levelMap.get("CSPH"))){
392 if(ConvertUtils.isNotEmpty(value.getValue())){
393 double v = Double.parseDouble(value.getValue());
394 double l = Double.parseDouble(levelMap.get("CSPH").toString());
395 if(v > l){
396 value.setDataSourceColor("red");
397 value.setTitle("超过上限"+l);
398 }
399 levelEntity.setValue(levelMap.get("CSPH").toString());
400 }
401 }
402 }
403 if("化验进水SS".equals(key)){
404 if(ConvertUtils.isNotEmpty(levelMap.get("JSSS"))){
405 if(ConvertUtils.isNotEmpty(value.getValue())){
406 double v = Double.parseDouble(value.getValue());
407 double l = Double.parseDouble(levelMap.get("JSSS").toString());
408 if(v > l){
409 value.setDataSourceColor("red");
410 value.setTitle("超过上限"+l+"mg/L");
411 }
412 levelEntity.setValue(levelMap.get("JSSS").toString());
413 }
414 }
415 }
416 if("化验出水SS".equals(key)){
417 if(ConvertUtils.isNotEmpty(levelMap.get("CSSS"))){
418 if(ConvertUtils.isNotEmpty(value.getValue())){
419 double v = Double.parseDouble(value.getValue());
420 double l = Double.parseDouble(levelMap.get("CSSS").toString());
421 if(v > l){
422 value.setDataSourceColor("red");
423 value.setTitle("超过上限"+l+"mg/L");
424 }
425 levelEntity.setValue(levelMap.get("CSSS").toString());
426 }
427 }
428 }
429 result.put(key,value);
430 result.put(key+"标准", levelEntity);
431 }
432 return result;
433 }
434
435 }
1 package com.skua.modules.custom.handle.impl;
2
3 import com.skua.common.constant.ReportConstant;
4 import com.skua.common.report.ReportViewUtil;
5 import com.skua.common.report.entity.ValueEntity;
6 import com.skua.core.util.ConvertUtils;
7 import com.skua.modules.common.service.ICommonSqlService;
8 import com.skua.modules.custom.handle.ICustomHandle;
9 import com.skua.modules.custom.service.IFCustomReportDatasetService;
10 import com.skua.modules.custom.vo.FCustomReportDatasetVO;
11 import com.skua.modules.dataAnalysis.service.IFactoryCenterService;
12 import com.skua.tool.util.DateUtils;
13 import org.apache.commons.lang.StringUtils;
14 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.stereotype.Component;
16
17 import javax.annotation.Resource;
18 import java.util.*;
19
20 /**
21 * <pre>
22 * 生产日报自定义逻辑
23 * </pre>
24 * @author zhanglei
25 * @version V0.1, 2024年11月17日 上午9:40:17
26 */
27 @Component("scrbReportHandle")
28 public class ScrbReportHandle implements ICustomHandle{
29 @Autowired
30 private IFCustomReportDatasetService fCustomReportDatasetService;
31 @Resource
32 private IFactoryCenterService factoryCenterService;
33 @Autowired
34 private ICommonSqlService commonSqlService;
35
36 @Override
37 public Map<String, List<Map<String, ValueEntity>>> buildDataMap(String reportId, String startTime, String endTime,
38 String departId,String indexCode) {
39 Map<String, Object> levelMap = factoryCenterService.getMonitorThreshold(departId);
40 String departIds = commonSqlService.getChildDepartId(departId);
41 Map<String,List<Map<String,ValueEntity>>> dataMap = new HashMap<String,List<Map<String,ValueEntity>>>();
42 //获取数据集
43 //获取填报数据及报表数据项信息,组装报表所需数据机构
44 List<Map<String,ValueEntity>> list = new ArrayList<Map<String,ValueEntity>>();
45 //根据数据集id获取数据项及填报数据
46 Map<String,String> dataFieldDict = new HashMap<String,String>();
47 List<FCustomReportDatasetVO> dataFieldList = fCustomReportDatasetService.getDataField(ReportConstant.view2119);
48 for(FCustomReportDatasetVO dataField : dataFieldList) {
49 dataFieldDict.put(dataField.getDatasetId(), dataField.getDatasetName());
50 }
51 //添加厂站、时间字段
52 dataFieldDict.put("depart_name", "厂站名称");
53 dataFieldDict.put("time", "时间");
54 dataFieldDict.put("paramTime", "参数时间");
55 String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,"", departIds, startTime, endTime);
56 //结果集
57 List<Map<String, Object>> szMapList = fCustomReportDatasetService.querySzYyybReport(dataViewName2119, startTime, endTime, departIds);
58 list = changeDataList(szMapList,list,startTime,dataFieldDict);
59 List<Map<String,ValueEntity>> dList = new ArrayList<>();
60 Map<String,ValueEntity> newDataMap = new HashMap<>();
61 ValueEntity valueEntity = new ValueEntity();
62 valueEntity.setValue(startTime);
63 newDataMap.put("时间", valueEntity);
64 Map<String,ValueEntity> dMap = new HashMap<>();
65 if(list.size() > 0){
66 dMap = list.get(0);
67 if(levelMap!=null){
68 dMap = changeDataColor(dMap,levelMap);
69 }
70 newDataMap.putAll(dMap);
71 }else{
72 for (Map.Entry<String, String> data : dataFieldDict.entrySet()) {
73 ValueEntity dataEntity = new ValueEntity();
74 dataEntity.setValue(null);
75 newDataMap.put(data.getValue(), dataEntity);
76 }
77 for (Map.Entry<String, Object> level : levelMap.entrySet()) {
78 ValueEntity levelEntity = new ValueEntity();
79 levelEntity.setValue(level.getValue().toString());
80 if("JSCOD".equals(level.getKey())){
81 newDataMap.put("进水COD标准", levelEntity);
82 continue;
83 }
84 if("CSCOD".equals(level.getKey())){
85 newDataMap.put("出水COD标准", levelEntity);
86 continue;
87 }
88 if("JSNH3N".equals(level.getKey())){
89 newDataMap.put("进水氨氮标准", levelEntity);
90 continue;
91 }
92 if("CSNH3N".equals(level.getKey())){
93 newDataMap.put("出水氨氮标准", levelEntity);
94 }
95 if("JSTN".equals(level.getKey())){
96 newDataMap.put("进水总氮标准", levelEntity);
97 continue;
98 }
99 if("CSTN".equals(level.getKey())){
100 newDataMap.put("出水总氮标准", levelEntity);
101 continue;
102 }
103 if("JSTP".equals(level.getKey())){
104 newDataMap.put("进水总磷标准", levelEntity);
105 continue;
106 }
107 if("CSTP".equals(level.getKey())){
108 newDataMap.put("出水总磷标准", levelEntity);
109 continue;
110 }
111 if("JSPH".equals(level.getKey())){
112 newDataMap.put("进水pH标准", levelEntity);
113 continue;
114 }
115 if("CSPH".equals(level.getKey())){
116 newDataMap.put("出水pH标准", levelEntity);
117 continue;
118 }
119 if("JSSS".equals(level.getKey())){
120 newDataMap.put("进水SS标准", levelEntity);
121 continue;
122 }
123 if("CSSS".equals(level.getKey())){
124 newDataMap.put("出水SS标准", levelEntity);
125 continue;
126 }
127 }
128 }
129 dList.add(newDataMap);
130 dataMap.put("水质水量日报表", dList);
131 return dataMap;
132 }
133 @Override
134 public String buildWaterQualityAlarmValue(String reportId, String departId, String json) {
135 return json;
136 }
137
138 /**
139 * 构造LIST
140 * @param szMapList
141 * @param list
142 * @param startTime
143 * @param dataFieldDict
144 * @return
145 */
146 private List<Map<String, ValueEntity>> changeDataList(List<Map<String, Object>> szMapList, List<Map<String, ValueEntity>> list,
147 String startTime, Map<String, String> dataFieldDict) {
148 for(Map<String,Object> valueMap : szMapList) {
149 Map<String,ValueEntity> handleMap = new HashMap<String,ValueEntity>();
150 //添加时间参数
151 ValueEntity startTimeValueEntity = new ValueEntity();
152 startTimeValueEntity.setValue(startTime);
153 handleMap.put("参数时间", startTimeValueEntity);
154 Set<String> keySet = valueMap.keySet();
155 for(String key : keySet) {
156 if(!StringUtils.isEmpty(dataFieldDict.get(key))) {
157 ValueEntity valueEntity = new ValueEntity();
158 valueEntity.setValue(ConvertUtils.getString(valueMap.get(key)));
159 handleMap.put(dataFieldDict.get(key),valueEntity);
160 }
161 }
162 list.add(handleMap);
163 }
164 return list;
165 }
166
167 /**
168 * 指标变色
169 * @param map
170 * @param levelMap
171 * @return
172 */
173 public Map<String,ValueEntity> changeDataColor(Map<String,ValueEntity> map,Map<String, Object> levelMap){
174 Map<String,ValueEntity> result = new HashMap<>();
175 for (Map.Entry<String, ValueEntity> entry : map.entrySet()) {
176 ValueEntity levelEntity = new ValueEntity();
177 String key = entry.getKey();
178 ValueEntity value = entry.getValue();
179 if("进水COD".equals(key)){
180 if(ConvertUtils.isNotEmpty(levelMap.get("JSCOD"))){
181 if(ConvertUtils.isNotEmpty(value.getValue())){
182 double v = Double.parseDouble(value.getValue());
183 double l = Double.parseDouble(levelMap.get("JSCOD").toString());
184 if(v > l){
185 value.setDataSourceColor("red");
186 value.setTitle("超过上限"+l+"mg/L");
187 }
188 levelEntity.setValue(levelMap.get("JSCOD").toString());
189 }
190 }
191 }
192 if("出水COD".equals(key)){
193 if(ConvertUtils.isNotEmpty(levelMap.get("CSCOD"))){
194 if(ConvertUtils.isNotEmpty(value.getValue())){
195 double v = Double.parseDouble(value.getValue());
196 double l = Double.parseDouble(levelMap.get("CSCOD").toString());
197 if(v > l){
198 value.setDataSourceColor("red");
199 value.setTitle("超过上限"+l+"mg/L");
200 }
201 levelEntity.setValue(levelMap.get("CSCOD").toString());
202 }
203 }
204 }
205 if("进水氨氮".equals(key)){
206 if(ConvertUtils.isNotEmpty(levelMap.get("JSNH3N"))){
207 if(ConvertUtils.isNotEmpty(value.getValue())){
208 double v = Double.parseDouble(value.getValue());
209 double l = Double.parseDouble(levelMap.get("JSNH3N").toString());
210 if(v > l){
211 value.setDataSourceColor("red");
212 value.setTitle("超过上限"+l+"mg/L");
213 }
214 levelEntity.setValue(levelMap.get("JSNH3N").toString());
215 }
216 }
217 }
218 if("出水氨氮".equals(key)){
219 if(ConvertUtils.isNotEmpty(levelMap.get("CSNH3N"))){
220 if(ConvertUtils.isNotEmpty(value.getValue())){
221 double v = Double.parseDouble(value.getValue());
222 double l = Double.parseDouble(levelMap.get("CSNH3N").toString());
223 if(v > l){
224 value.setDataSourceColor("red");
225 value.setTitle("超过上限"+l+"mg/L");
226 }
227 levelEntity.setValue(levelMap.get("CSNH3N").toString());
228 }
229 }
230 }
231 if("进水总氮".equals(key)){
232 if(ConvertUtils.isNotEmpty(levelMap.get("JSTN"))){
233 if(ConvertUtils.isNotEmpty(value.getValue())){
234 double v = Double.parseDouble(value.getValue());
235 double l = Double.parseDouble(levelMap.get("JSTN").toString());
236 if(v > l){
237 value.setDataSourceColor("red");
238 value.setTitle("超过上限"+l+"mg/L");
239 }
240 levelEntity.setValue(levelMap.get("JSTN").toString());
241 }
242 }
243 }
244 if("出水总氮".equals(key)){
245 if(ConvertUtils.isNotEmpty(levelMap.get("CSTN"))){
246 if(ConvertUtils.isNotEmpty(value.getValue())){
247 double v = Double.parseDouble(value.getValue());
248 double l = Double.parseDouble(levelMap.get("CSTN").toString());
249 if(v > l){
250 value.setDataSourceColor("red");
251 value.setTitle("超过上限"+l+"mg/L");
252 }
253 levelEntity.setValue(levelMap.get("CSTN").toString());
254 }
255 }
256 }
257 if("进水总磷".equals(key)){
258 if(ConvertUtils.isNotEmpty(levelMap.get("JSTP"))){
259 if(ConvertUtils.isNotEmpty(value.getValue())){
260 double v = Double.parseDouble(value.getValue());
261 double l = Double.parseDouble(levelMap.get("JSTP").toString());
262 if(v > l){
263 value.setDataSourceColor("red");
264 value.setTitle("超过上限"+l+"mg/L");
265 }
266 levelEntity.setValue(levelMap.get("JSTP").toString());
267 }
268 }
269 }
270 if("出水总磷".equals(key)){
271 if(ConvertUtils.isNotEmpty(levelMap.get("CSTP"))){
272 if(ConvertUtils.isNotEmpty(value.getValue())){
273 double v = Double.parseDouble(value.getValue());
274 double l = Double.parseDouble(levelMap.get("CSTP").toString());
275 if(v > l){
276 value.setDataSourceColor("red");
277 value.setTitle("超过上限"+l+"mg/L");
278 }
279 levelEntity.setValue(levelMap.get("CSTP").toString());
280 }
281 }
282 }
283 if("进水pH".equals(key)){
284 if(ConvertUtils.isNotEmpty(levelMap.get("JSPH"))){
285 if(ConvertUtils.isNotEmpty(value.getValue())){
286 double v = Double.parseDouble(value.getValue());
287 double l = Double.parseDouble(levelMap.get("JSPH").toString());
288 if(v > l){
289 value.setDataSourceColor("red");
290 value.setTitle("超过上限"+l);
291 }
292 levelEntity.setValue(levelMap.get("JSPH").toString());
293 }
294 }
295 }
296 if("出水pH".equals(key)){
297 if(ConvertUtils.isNotEmpty(levelMap.get("CSPH"))){
298 if(ConvertUtils.isNotEmpty(value.getValue())){
299 double v = Double.parseDouble(value.getValue());
300 double l = Double.parseDouble(levelMap.get("CSPH").toString());
301 if(v > l){
302 value.setDataSourceColor("red");
303 value.setTitle("超过上限"+l);
304 }
305 levelEntity.setValue(levelMap.get("CSPH").toString());
306 }
307 }
308 }
309 if("进水SS".equals(key)){
310 if(ConvertUtils.isNotEmpty(levelMap.get("JSSS"))){
311 if(ConvertUtils.isNotEmpty(value.getValue())){
312 double v = Double.parseDouble(value.getValue());
313 double l = Double.parseDouble(levelMap.get("JSSS").toString());
314 if(v > l){
315 value.setDataSourceColor("red");
316 value.setTitle("超过上限"+l+"mg/L");
317 }
318 levelEntity.setValue(levelMap.get("JSSS").toString());
319 }
320 }
321 }
322 if("出水SS".equals(key)){
323 if(ConvertUtils.isNotEmpty(levelMap.get("CSSS"))){
324 if(ConvertUtils.isNotEmpty(value.getValue())){
325 double v = Double.parseDouble(value.getValue());
326 double l = Double.parseDouble(levelMap.get("CSSS").toString());
327 if(v > l){
328 value.setDataSourceColor("red");
329 value.setTitle("超过上限"+l+"mg/L");
330 }
331 levelEntity.setValue(levelMap.get("CSSS").toString());
332 }
333 }
334 }
335 result.put(key,value);
336 result.put(key+"标准", levelEntity);
337 }
338 return result;
339 }
340
341 }
...@@ -144,4 +144,8 @@ public interface FCustomReportDatasetMapper extends BaseMapper<FCustomReportData ...@@ -144,4 +144,8 @@ public interface FCustomReportDatasetMapper extends BaseMapper<FCustomReportData
144 List<Map<String, Object>> queryNhYyrbReport(@Param(value="dataViewName3a24") String dataViewName3a24, 144 List<Map<String, Object>> queryNhYyrbReport(@Param(value="dataViewName3a24") String dataViewName3a24,
145 @Param(value="startTime") String startTime, @Param(value="endTime") String endTime, 145 @Param(value="startTime") String startTime, @Param(value="endTime") String endTime,
146 @Param(value="departId") String departId); 146 @Param(value="departId") String departId);
147
148 List<Map<String, Object>> queryHyReport(@Param(value="dataViewName9bff") String dataViewName9bff,
149 @Param(value="startTime") String startTime, @Param(value="endTime") String endTime,
150 @Param(value="departId") String departId);
147 } 151 }
......
...@@ -763,4 +763,49 @@ ...@@ -763,4 +763,49 @@
763 AND v3.time &lt;= #{endTime} 763 AND v3.time &lt;= #{endTime}
764 GROUP BY v3.depart_id 764 GROUP BY v3.depart_id
765 </select> 765 </select>
766
767 <select id="queryHyReport" resultType="java.util.HashMap">
768 SELECT
769 ROUND( AVG( v.SW ), 2 ) AS `SW`,
770 ROUND( AVG( v.FYHGMLSS ), 2 ) AS `FYHGMLSS`,
771 ROUND( AVG( v.EYHGMLSS ), 2 ) AS `EYHGMLSS`,
772 ROUND( AVG( v.DYHGMLSS ), 2 ) AS `DYHGMLSS`,
773 ROUND( AVG( v.BYHGMLSS ), 2 ) AS `BYHGMLSS`,
774 ROUND( AVG( v.CYHGMLSS ), 2 ) AS `CYHGMLSS`,
775 ROUND( AVG( v.AYHGMLSS ), 2 ) AS `AYHGMLSS`,
776 ROUND( AVG( v.FYHGCJB ), 2 ) AS `FYHGCJB`,
777 ROUND( AVG( v.EYHGCJB ), 2 ) AS `EYHGCJB`,
778 ROUND( AVG( v.DYHGCJB ), 2 ) AS `DYHGCJB`,
779 ROUND( AVG( v.BYHGCJB ), 2 ) AS `BYHGCJB`,
780 ROUND( AVG( v.CYHGCJB ), 2 ) AS `CYHGCJB`,
781 ROUND( AVG( v.AYHGCJB ), 2 ) AS `AYHGCJB`,
782 ROUND( AVG( v.JSCODHY ), 2 ) AS `JSCODHY`,
783 ROUND( AVG( v.CSCODHY ), 2 ) AS `CSCODHY`,
784 ROUND( AVG( v.JSADHY ), 2 ) AS `JSADHY`,
785 ROUND( AVG( v.CSADHY ), 2 ) AS `CSADHY`,
786 ROUND( AVG( v.CSTNHY ), 2 ) AS `CSTNHY`,
787 ROUND( AVG( v.JSZDHY ), 2 ) AS `JSZDHY`,
788 ROUND( AVG( v.JSZLHY ), 2 ) AS `JSZLHY`,
789 ROUND( AVG( v.CSZLHY ), 2 ) AS `CSZLHY`,
790 ROUND( AVG( v.JSSSHY ), 2 ) AS `JSSSHY`,
791 ROUND( AVG( v.CSSSHY ), 2 ) AS `CSSSHY`,
792 ROUND( AVG( v.JSPHHY ), 2 ) AS `JSPHHY`,
793 ROUND( AVG( v.CSPHHY ), 2 ) AS `CSPHHY`,
794 ROUND( AVG( v.CSBODHY ), 2 ) AS `CSBODHY`,
795 ROUND( AVG( v.JSBODHY ), 2 ) AS `JSBODHY`,
796 v.depart_id,
797 d.depart_name as depart_name,
798 v.time
799 FROM
800 ${dataViewName9bff} v
801 LEFT JOIN sys_depart d ON v.depart_id = d.id
802 WHERE
803 v.depart_id IN
804 <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
805 '${item}'
806 </foreach>
807 AND v.time &gt;= #{startTime}
808 AND v.time &lt;= #{endTime}
809 GROUP BY v.depart_id
810 </select>
766 </mapper> 811 </mapper>
......
...@@ -140,4 +140,6 @@ public interface IFCustomReportDatasetService extends IService<FCustomReportData ...@@ -140,4 +140,6 @@ public interface IFCustomReportDatasetService extends IService<FCustomReportData
140 List<Map<String, Object>> querySzYyrbReport(String dataViewName2119, String startTime, String endTime, String departId); 140 List<Map<String, Object>> querySzYyrbReport(String dataViewName2119, String startTime, String endTime, String departId);
141 141
142 List<Map<String, Object>> queryNhYyrbReport(String dataViewName3a24, String startTime, String endTime, String departId); 142 List<Map<String, Object>> queryNhYyrbReport(String dataViewName3a24, String startTime, String endTime, String departId);
143
144 List<Map<String, Object>> queryHyReport(String dataViewName9bff, String startTime, String endTime, String departIds);
143 } 145 }
......
...@@ -466,6 +466,12 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa ...@@ -466,6 +466,12 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
466 return list; 466 return list;
467 } 467 }
468 468
469 @Override
470 public List<Map<String, Object>> queryHyReport(String dataViewName9bff, String startTime, String endTime, String departId) {
471 List<Map<String, Object>> list = mapper.queryHyReport(dataViewName9bff, startTime, endTime, departId);
472 return list;
473 }
474
469 /**转换为Map<部门编号,JnhbReportData> */ 475 /**转换为Map<部门编号,JnhbReportData> */
470 private Map<String,JnhbReportData> convertJnhbReportDataMap(List<JnhbReportData> dataList){// Map<部门编号,JnhbReportData> 476 private Map<String,JnhbReportData> convertJnhbReportDataMap(List<JnhbReportData> dataList){// Map<部门编号,JnhbReportData>
471 Map<String,JnhbReportData> dataMap = new HashMap<>(); 477 Map<String,JnhbReportData> dataMap = new HashMap<>();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!