b7173089 康伟

kangwei: 生产运营日报

1 个父辈 d94a49ed
...@@ -47,5 +47,7 @@ public interface ReportConstant { ...@@ -47,5 +47,7 @@ public interface ReportConstant {
47 public static final String fieldSz = "JSZL,CSZL,JSCOD,CSCOD,JSAD,CSAD,JSZD,CSTN,JSPH,JSSS,CSPH,CSSS"; 47 public static final String fieldSz = "JSZL,CSZL,JSCOD,CSCOD,JSAD,CSAD,JSZD,CSTN,JSPH,JSSS,CSPH,CSSS";
48 //出水字段 48 //出水字段
49 public static final String field_2119_CS = "CSZL,CSCOD,CSAD,CSTN,CSPH"; 49 public static final String field_2119_CS = "CSZL,CSCOD,CSAD,CSTN,CSPH";
50 //进水字段
51 public static final String field_2119_JS = "JSZL,JSCOD,JSAD,JSZD,JSPH";
50 52
51 } 53 }
......
...@@ -9,6 +9,7 @@ import com.skua.modules.common.vo.DepartVO; ...@@ -9,6 +9,7 @@ import com.skua.modules.common.vo.DepartVO;
9 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
10 10
11 import javax.annotation.Resource; 11 import javax.annotation.Resource;
12 import java.util.HashMap;
12 import java.util.List; 13 import java.util.List;
13 import java.util.Map; 14 import java.util.Map;
14 15
...@@ -24,7 +25,11 @@ public class CommonSqlServiceImpl implements ICommonSqlService { ...@@ -24,7 +25,11 @@ public class CommonSqlServiceImpl implements ICommonSqlService {
24 25
25 @Override 26 @Override
26 public Map<String, Object> queryForMap(String sql) { 27 public Map<String, Object> queryForMap(String sql) {
27 return commonSqlMapper.queryForMap(sql); 28 Map<String, Object> dataMap = commonSqlMapper.queryForMap(sql);
29 if(dataMap == null ){
30 dataMap = new HashMap<>();
31 }
32 return dataMap ;
28 } 33 }
29 34
30 @Override 35 @Override
......
...@@ -830,4 +830,27 @@ public class DateUtils { ...@@ -830,4 +830,27 @@ public class DateUtils {
830 calendar.setTime(currentDate); 830 calendar.setTime(currentDate);
831 return calendar.get(Calendar.MONTH)+1; 831 return calendar.get(Calendar.MONTH)+1;
832 } 832 }
833
834 /***
835 * 前几天时间
836 * @param dateString
837 * @param minusDays
838 * @return
839 */
840 public static String getPreviousDay(String dateString,Integer minusDays){
841 if(minusDays == null){
842 minusDays = 1;
843 }
844 // 假设这是你提供的日期字符串
845 //String dateString = "2023-03-15";
846 // 创建一个DateTimeFormatter来解析日期字符串
847 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
848 // 使用formatter将字符串解析为LocalDate对象
849 LocalDate date = LocalDate.parse(dateString, formatter);
850 // 获取前一天的日期
851 LocalDate previousDay = date.minusDays(minusDays);
852 // 将前一天的日期格式化为字符串
853 String previousDayString = previousDay.format(formatter);
854 return previousDayString;
855 }
833 } 856 }
......
...@@ -9,6 +9,8 @@ import java.math.BigDecimal; ...@@ -9,6 +9,8 @@ import java.math.BigDecimal;
9 import java.text.DecimalFormat; 9 import java.text.DecimalFormat;
10 import java.text.ParseException; 10 import java.text.ParseException;
11 import java.text.SimpleDateFormat; 11 import java.text.SimpleDateFormat;
12 import java.time.LocalDate;
13 import java.time.format.DateTimeFormatter;
12 import java.util.*; 14 import java.util.*;
13 import java.util.regex.Matcher; 15 import java.util.regex.Matcher;
14 import java.util.regex.Pattern; 16 import java.util.regex.Pattern;
...@@ -54,6 +56,8 @@ public class JSUtils { ...@@ -54,6 +56,8 @@ public class JSUtils {
54 return "0"; 56 return "0";
55 } 57 }
56 58
59
60
57 /*** 61 /***
58 * 格式化结果,保留两位小数 62 * 格式化结果,保留两位小数
59 * @param obj1 63 * @param obj1
......
...@@ -93,7 +93,7 @@ public class AjhPlanScheduleConfig { ...@@ -93,7 +93,7 @@ public class AjhPlanScheduleConfig {
93 this.configName = configName; 93 this.configName = configName;
94 } 94 }
95 95
96 public AjhPlanScheduleConfig(String departId, String year, String parentId, String configName, String completeTime, String responsibler) { 96 public AjhPlanScheduleConfig(String departId, String years, String parentId, String configName, String completeTime, String responsibler) {
97 this.departId = departId; 97 this.departId = departId;
98 this.years = years; 98 this.years = years;
99 this.parentId = parentId; 99 this.parentId = parentId;
......
...@@ -28,8 +28,8 @@ public class EventMapController { ...@@ -28,8 +28,8 @@ public class EventMapController {
28 @Autowired 28 @Autowired
29 private IEmergencyRiskEventService emergencyRiskEventService; 29 private IEmergencyRiskEventService emergencyRiskEventService;
30 30
31 @AutoLog(value = "风险库统计(数字)") 31 @AutoLog(value = "隐患事件统计(数字)")
32 @ApiOperation(value="风险库统计", notes="风险库统计") 32 @ApiOperation(value="隐患事件统计(数字)", notes="隐患事件统计(数字)")
33 @GetMapping(value = "/dangerEventStatistics") 33 @GetMapping(value = "/dangerEventStatistics")
34 public Result<DangerEventOverviewVO> dangerEventStatistics(String departIds, String startDate, String endDate){ 34 public Result<DangerEventOverviewVO> dangerEventStatistics(String departIds, String startDate, String endDate){
35 Result<DangerEventOverviewVO> result = new Result<>(); 35 Result<DangerEventOverviewVO> result = new Result<>();
...@@ -41,8 +41,8 @@ public class EventMapController { ...@@ -41,8 +41,8 @@ public class EventMapController {
41 result.setResult(eventOverview); 41 result.setResult(eventOverview);
42 return result; 42 return result;
43 } 43 }
44 @AutoLog(value = "安全检查列表") 44 @AutoLog(value = "隐患事件统计(列表)")
45 @ApiOperation(value="安全检查列表", notes="安全检查列表") 45 @ApiOperation(value="隐患事件统计(列表)", notes="隐患事件统计(列表)")
46 @GetMapping(value = "/dangerEventStatisticsList") 46 @GetMapping(value = "/dangerEventStatisticsList")
47 public Result<List<DangerEventOverviewVO>> dangerEventStatisticsList(String departIds,String startDate, String endDate){ 47 public Result<List<DangerEventOverviewVO>> dangerEventStatisticsList(String departIds,String startDate, String endDate){
48 Result<List<DangerEventOverviewVO>> result = new Result<>(); 48 Result<List<DangerEventOverviewVO>> result = new Result<>();
...@@ -57,7 +57,7 @@ public class EventMapController { ...@@ -57,7 +57,7 @@ public class EventMapController {
57 } 57 }
58 58
59 @AutoLog(value = "风险库统计(数字)") 59 @AutoLog(value = "风险库统计(数字)")
60 @ApiOperation(value="风险库统计", notes="风险库统计") 60 @ApiOperation(value="风险库统计(数字)", notes="风险库统计(数字)")
61 @GetMapping(value = "/riskLibraryStatistics") 61 @GetMapping(value = "/riskLibraryStatistics")
62 public Result<RiskDatabaseResult> riskLibraryStatistics(String departIds,String startDate, String endDate){ 62 public Result<RiskDatabaseResult> riskLibraryStatistics(String departIds,String startDate, String endDate){
63 Result<RiskDatabaseResult> result = new Result<>(); 63 Result<RiskDatabaseResult> result = new Result<>();
......
...@@ -181,7 +181,7 @@ public class EmergencyRiskEventServiceImpl extends ServiceImpl<EmergencyRiskEven ...@@ -181,7 +181,7 @@ public class EmergencyRiskEventServiceImpl extends ServiceImpl<EmergencyRiskEven
181 * @return 181 * @return
182 */ 182 */
183 public RiskDatabaseResult getRiskLibraryStatistics(String departIds, String startDate, String endDate){ 183 public RiskDatabaseResult getRiskLibraryStatistics(String departIds, String startDate, String endDate){
184 String sql = " select sum(ifnull(aa.count,0)) 'aqyhCount',sum(ifnull(bb.count,0) )'yhpcCount', sum(ifnull(cc.count,0)) 'ycCount', sum(ifnull(dd.count,0)) 'xjCount'"; 184 String sql = " select sum(ifnull(aa.count,0)) 'aqyhCount',sum(ifnull(bb.count,0) )'yhpcCount', sum(ifnull(ee.count,0)) 'yhpcSJCount', sum(ifnull(cc.count,0)) 'ycCount', sum(ifnull(dd.count,0)) 'xjCount'";
185 sql += getRiskLibraryStatisticsSql(departIds, startDate, endDate); 185 sql += getRiskLibraryStatisticsSql(departIds, startDate, endDate);
186 186
187 List<RiskDatabaseResult> dataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<RiskDatabaseResult>(RiskDatabaseResult.class)); 187 List<RiskDatabaseResult> dataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<RiskDatabaseResult>(RiskDatabaseResult.class));
...@@ -191,7 +191,7 @@ public class EmergencyRiskEventServiceImpl extends ServiceImpl<EmergencyRiskEven ...@@ -191,7 +191,7 @@ public class EmergencyRiskEventServiceImpl extends ServiceImpl<EmergencyRiskEven
191 return new RiskDatabaseResult(0,0,0,0,0); 191 return new RiskDatabaseResult(0,0,0,0,0);
192 } 192 }
193 public List<RiskDatabaseResult> getRiskLibraryStatisticsList(String departIds, String startDate, String endDate){ 193 public List<RiskDatabaseResult> getRiskLibraryStatisticsList(String departIds, String startDate, String endDate){
194 String sql = " select d.id 'dpart_id',d.depart_name , ifnull(aa.count,0) 'aqyhCount',ifnull(bb.count,0) 'yhpcCount', ifnull(cc.count,0) 'ycCount', ifnull(dd.count,0) 'xjCount'"; 194 String sql = " select d.id 'dpart_id',d.depart_name , ifnull(aa.count,0) 'aqyhCount',ifnull(bb.count,0) 'yhpcCount',ifnull(ee.count,0) 'yhpcSJCount', ifnull(cc.count,0) 'ycCount', ifnull(dd.count,0) 'xjCount'";
195 sql += getRiskLibraryStatisticsSql(departIds, startDate, endDate); 195 sql += getRiskLibraryStatisticsSql(departIds, startDate, endDate);
196 List<RiskDatabaseResult> dataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<RiskDatabaseResult>(RiskDatabaseResult.class)); 196 List<RiskDatabaseResult> dataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<RiskDatabaseResult>(RiskDatabaseResult.class));
197 return dataList; 197 return dataList;
...@@ -266,6 +266,9 @@ public class EmergencyRiskEventServiceImpl extends ServiceImpl<EmergencyRiskEven ...@@ -266,6 +266,9 @@ public class EmergencyRiskEventServiceImpl extends ServiceImpl<EmergencyRiskEven
266 sql += " left join ( select t.depart_id , count(1) 'count' from ajh_rectification_info t where t.rec_ord_report_date >='"+startDate+"' and t.rec_ord_report_date <='"+endDate+"' group by t.depart_id) aa on aa.depart_id = d.id"; 266 sql += " left join ( select t.depart_id , count(1) 'count' from ajh_rectification_info t where t.rec_ord_report_date >='"+startDate+"' and t.rec_ord_report_date <='"+endDate+"' group by t.depart_id) aa on aa.depart_id = d.id";
267 // 风险排查 267 // 风险排查
268 sql += " left join ( select depart_id ,count(id) 'count' from danger_inspection_record where report_date >= '"+startDate+" 00:00:00' and report_date <='"+endDate+" 23:59:59' group by depart_id ) bb on bb.depart_id = d.id "; 268 sql += " left join ( select depart_id ,count(id) 'count' from danger_inspection_record where report_date >= '"+startDate+" 00:00:00' and report_date <='"+endDate+" 23:59:59' group by depart_id ) bb on bb.depart_id = d.id ";
269 //实际完成数量
270 sql += " left join ( select depart_id ,count(id) 'count' from danger_inspection_record where status = '2' and end_date >= '"+startDate+" 00:00:00' and end_date <='"+endDate+" 23:59:59' group by depart_id ) eee on eee.depart_id = d.id ";
271
269 // 异常 272 // 异常
270 sql += " left join ( select t.depart_id , count(1) 'count' from problem_report_plan t where t.report_time >='"+startDate+"' and t.report_time <='"+endDate+"' group by t.depart_id) cc on cc.depart_id = d.id"; 273 sql += " left join ( select t.depart_id , count(1) 'count' from problem_report_plan t where t.report_time >='"+startDate+"' and t.report_time <='"+endDate+"' group by t.depart_id) cc on cc.depart_id = d.id";
271 //巡检 274 //巡检
......
...@@ -28,6 +28,8 @@ public class RiskDatabaseResult { ...@@ -28,6 +28,8 @@ public class RiskDatabaseResult {
28 @ApiModelProperty(value = "隐患排查数量") 28 @ApiModelProperty(value = "隐患排查数量")
29 private Integer yhpcCount; 29 private Integer yhpcCount;
30 30
31 @ApiModelProperty(value = "隐患排查:实际完成次数")
32 private Integer yhpcSJCount;
31 33
32 /**异常数*/ 34 /**异常数*/
33 @ApiModelProperty(value = "异常数") 35 @ApiModelProperty(value = "异常数")
......
1 package com.skua.modules.report.controller;
2
3 import com.skua.common.constant.ReportConstant;
4 import com.skua.common.report.ReportViewUtil;
5 import com.skua.core.api.vo.Result;
6 import com.skua.core.context.BaseContextHandler;
7 import com.skua.core.util.ConvertUtils;
8 import com.skua.modules.common.service.ICommonSqlService;
9 import com.skua.modules.report.vo.OperationDailyVO;
10 import com.skua.modules.system.service.ISysDepartService;
11 import com.skua.tool.util.DateUtils;
12 import com.skua.tool.util.JSUtils;
13 import io.swagger.annotations.Api;
14 import io.swagger.annotations.ApiOperation;
15 import lombok.extern.slf4j.Slf4j;
16 import org.springframework.beans.factory.annotation.Autowired;
17 import org.springframework.web.bind.annotation.GetMapping;
18 import org.springframework.web.bind.annotation.RequestMapping;
19 import org.springframework.web.bind.annotation.RestController;
20
21 import java.util.HashMap;
22 import java.util.Map;
23
24 /**
25 * @auther kangwei
26 * @create 2025-03-06-13:51
27 */
28 @Slf4j
29 @Api(tags = "生产运营日报")
30 @RestController
31 @RequestMapping("/v1/report")
32 public class OperationDailyController {
33 @Autowired
34 private ISysDepartService departService;
35
36 @Autowired
37 private ICommonSqlService commonSqlService;
38
39 @ApiOperation(value = "生产运营日报", notes = "生产运营日报")
40 @GetMapping("/operationDaily")
41 public Result<Map<String, OperationDailyVO>> operationDaily(String dateTIme) {
42 Result<Map<String,OperationDailyVO>> result = new Result<>();
43 Map<String,OperationDailyVO> dataMap = new HashMap<>();
44
45 // System.out.println("sql = "+sql);
46 OperationDailyVO njOperationDaily = getOperationDailyVOB( "1892199062790823936", dateTIme);//南京
47 OperationDailyVO whOperationDaily = getOperationDailyVOB( "1892199890272477184", dateTIme);//武汉
48 OperationDailyVO efhbOperationDaily = getOperationDailyVOB( "1818215543140909056", dateTIme);//恩菲环保
49
50 dataMap.put("njData",njOperationDaily);
51 dataMap.put("whData",whOperationDaily);
52 dataMap.put("efhbData",efhbOperationDaily);
53 result.setResult(dataMap);
54 result.setSuccess(true);
55 return result;
56 }
57
58
59 public OperationDailyVO getOperationDailyVOB(String departId,String dateTIme){
60 OperationDailyVO operationDailyVO = new OperationDailyVO();
61 Map<String, Object> dataMap = null;
62 String previousDay = DateUtils.getPreviousDay(dateTIme,1);//前天日期
63 // 获取departId 下有权限的部门集合字符串
64 String departIds = departService.getChildDepartId(BaseContextHandler.getDeparts(),departId,"1");
65 //1 处理水量合计 日均处理水量
66 String sql = "";
67 String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,"CSL", departIds, dateTIme,dateTIme);
68 sql = "select round(sum(ifnull(aaa.CSL,0))/10000,2) CSL_TOTAL, round(avg(ifnull(aaa.CSL,0))/10000,2) CSL_AVG from "+dataViewName2119+"aaa ";
69 dataMap = commonSqlService.queryForMap(sql);
70 operationDailyVO.setCslhj( ConvertUtils.getString(dataMap.get("CSL_TOTAL"),"0") );
71 operationDailyVO.setClsavg(ConvertUtils.getString(dataMap.get("CSL_AVG"),"0") );
72 //2 昨日增加水量
73 String dataViewName2119HB = ReportViewUtil.buildView(ReportConstant.view2119,"CSL", departIds, previousDay,previousDay);
74 sql = "select round(sum(ifnull(aaa.CSL,0))/10000,2) CSL from "+dataViewName2119HB+"aaa ";
75 dataMap = commonSqlService.queryForMap(sql);
76 operationDailyVO.setIncreaseCLS(JSUtils.subtract(operationDailyVO.getCslhj(), dataMap.get("CSL")));
77 //3 吨水电耗
78 String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24,"DLHJ,WNL", departIds, dateTIme,dateTIme);
79 sql ="select round(avg( ifnull(aaa.DLHJ/bbb.CSL ,0)),2) 'dsdh' ,round(sum( ifnull(aaa.WNL ,0)),2) 'WNL' from "+dataViewName3a24+ " aaa left join "+dataViewName2119+ " bbb on aaa.depart_id = bbb.depart_id and aaa.time = bbb.time ";
80 dataMap = commonSqlService.queryForMap(sql);
81 operationDailyVO.setWnl( ConvertUtils.getString(dataMap.get("WNL"),"0") );
82 operationDailyVO.setDsdh( ConvertUtils.getString(dataMap.get("dsdh"),"0") );
83
84 // 4 昨日新增吨水电耗
85 String dataViewName3a24HB = ReportViewUtil.buildView(ReportConstant.view3a24,"DLHJ", departIds, previousDay,previousDay);
86 sql ="select round(avg( ifnull(aaa.DLHJ/bbb.CSL ,0)),2) 'dsdh' from "+dataViewName3a24HB+ " aaa left join "+dataViewName2119HB+ " bbb on aaa.depart_id = bbb.depart_id and aaa.time = bbb.time ";
87 dataMap = commonSqlService.queryForMap(sql);
88 operationDailyVO.setIncreaseDsdh(JSUtils.subtract(operationDailyVO.getDsdh(), dataMap.get("dsdh")));
89
90 // 5 污泥脱水公司
91 dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24,"WNL", departIds, previousDay,previousDay);
92 sql = " select GROUP_CONCAT( d.depart_name SEPARATOR ',' ) AS depart_name from "+dataViewName3a24+ " aaa left join sys_depart d on d.id = aaa.depart_id where ifnull(aaa.WNL,0) = 0";
93 dataMap = commonSqlService.queryForMap(sql);
94 operationDailyVO.setWnDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无") );
95
96 // 6 污泥浓度公司
97 String dataViewName9bff = ReportViewUtil.buildView(ReportConstant.view9bff,"AYHGMLSS,BYHGMLSS,CYHGMLSS,DYHGMLSS,EYHGMLSS,FYHGMLSS", departIds, dateTIme,dateTIme);
98 sql = "select ifnull(GROUP_CONCAT(d.depart_name),'无') depart_name from (";
99 sql += "select aaa.depart_id ,";
100 sql +=" CASE WHEN (ifnull(aaa.AYHGMLSS,0) - ifnull(bbb.mlss,99999999.99)) > 0 THEN 1 ";
101 sql += " WHEN (ifnull(aaa.BYHGMLSS,0) - ifnull(bbb.mlss,99999999.99) ) >0 THEN 1 ";
102 sql += " WHEN (ifnull(aaa.CYHGMLSS,0) - ifnull(bbb.mlss,99999999.99) ) >0 THEN 1 ";
103 sql +=" WHEN (ifnull(aaa.DYHGMLSS,0) - ifnull(bbb.mlss,99999999.99))>0 THEN 1 ";
104 sql += " WHEN (ifnull(aaa.EYHGMLSS,0) - ifnull(bbb.mlss,99999999.99) ) >0 THEN 1 ";
105 sql += " WHEN (ifnull(aaa.FYHGMLSS,0) - ifnull(bbb.mlss,99999999.99))>0 THEN 1 " +
106 " ELSE 0 END AS result from " +dataViewName9bff+ " aaa";
107 sql += " left join sys_factory_info bbb on bbb.depart_id = aaa.depart_id ) ccc ";
108 sql += " left join sys_depart d on ccc.depart_id = d.id where ccc.result = 1";
109 dataMap = commonSqlService.queryForMap(sql);
110 operationDailyVO.setMlssDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无") );
111
112 // 7 进水超标公司
113 // JSZL,JSCOD,JSAD,JSZD,JSPH
114 dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,ReportConstant.field_2119_JS, departIds, dateTIme,dateTIme);
115 sql = " select ifnull(GROUP_CONCAT(d.depart_name),'无') depart_name from ( select aaa.depart_id,";
116 sql += " CASE WHEN (ifnull(aaa.JSCOD,0) - ifnull(bbb.JSCOD,0)) > 0 THEN 1 " +
117 " WHEN (ifnull(aaa.JSZL,0) - ifnull(bbb.JSTP,0) ) >0 THEN 1 ";
118 sql += " WHEN (ifnull(aaa.JSAD,0) - ifnull(bbb.JSNH3N,0))>0 THEN 1 " +
119 " WHEN (ifnull(aaa.JSZD,0) - ifnull(bbb.JSTN,0) ) >0 THEN 1 " +
120 " ELSE 0 END AS result from "+dataViewName2119 +" aaa ";
121 sql += " left join ( select depart_id , MAX(CASE WHEN index_code = 'JSBOD' THEN upper ELSE 0 END) AS 'JSBOD' , MAX(CASE WHEN index_code = 'JSPH' THEN upper ELSE 0 END) AS 'JSPH' ,";
122 sql += " MAX(CASE WHEN index_code = 'JSNH3N' THEN upper ELSE 0 END) AS 'JSNH3N' , MAX(CASE WHEN index_code = 'JSTP' THEN upper ELSE 0 END) AS 'JSTP' , ";
123 sql += " MAX(CASE WHEN index_code = 'JSCOD' THEN upper ELSE 0 END) AS 'JSCOD', MAX(CASE WHEN index_code = 'JSTN' THEN upper ELSE 0 END) AS 'JSTN',";
124 sql += " MAX(CASE WHEN index_code = 'JSSS' THEN upper ELSE 0 END) AS 'JSSS' ";
125 sql += " from water_quality_in_level group by depart_id";
126 sql += ") bbb on bbb.depart_id = aaa.depart_id ";
127 sql += " ) ccc left join sys_depart d on ccc.depart_id = d.id where ccc.result = 1";
128 dataMap = commonSqlService.queryForMap(sql);
129 operationDailyVO.setJsDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无") );
130 // 8 出水超标部门
131 dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,ReportConstant.field_2119_CS, departIds, dateTIme,dateTIme);
132 sql = " select ifnull(GROUP_CONCAT(d.depart_name),'无') depart_name from ( select aaa.depart_id,";
133 sql += " CASE WHEN (ifnull(aaa.CSCOD,0) - ifnull(bbb.CSCOD,0)) > 0 THEN 1 " +
134 " WHEN (ifnull(aaa.CSZL,0) - ifnull(bbb.CSTP,0) ) >0 THEN 1 ";
135 sql += " WHEN (ifnull(aaa.CSAD,0) - ifnull(bbb.CSNH3N,0))>0 THEN 1 " +
136 "WHEN (ifnull(aaa.CSTN,0) - ifnull(bbb.CSTN,0) ) >0 THEN 1 " +
137 " ELSE 0 END AS result from "+dataViewName2119 +" aaa";
138 sql += " left join (select t.depart_id , MAX(CASE WHEN alarm_param_code = 'CSBOD' THEN alarm_param_upper_limit ELSE 0 END) AS 'CSBOD' , ";
139 sql += " MAX(CASE WHEN alarm_param_code = 'CSPH' THEN alarm_param_upper_limit ELSE 0 END) AS 'CSPH' , MAX(CASE WHEN alarm_param_code = 'CSNH3N' THEN alarm_param_upper_limit ELSE 0 END) AS 'CSNH3N' , ";
140 sql += " MAX(CASE WHEN alarm_param_code = 'CSTP' THEN alarm_param_upper_limit ELSE 0 END) AS 'CSTP' , MAX(CASE WHEN alarm_param_code = 'CSCOD' THEN alarm_param_upper_limit ELSE 0 END) AS 'CSCOD', ";
141 sql += " MAX(CASE WHEN alarm_param_code = 'CSTN' THEN alarm_param_upper_limit ELSE 0 END) AS 'CSTN', MAX(CASE WHEN alarm_param_code = 'CSSS' THEN alarm_param_upper_limit ELSE 0 END) AS 'CSSS' ";
142 sql += " from alarm_param_standard_config sc ,sys_factory_info t where sc.alarm_level_standard_id = t.out_level group by t.depart_id ";
143 sql += " ) bbb on bbb.depart_id = aaa.depart_id ";
144 sql += " ) ccc left join sys_depart d on ccc.depart_id = d.id where ccc.result = 1";
145 dataMap = commonSqlService.queryForMap(sql);
146 operationDailyVO.setCsDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无") );
147 // 9 电耗超标公司
148 dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,"CSL", departIds, dateTIme,dateTIme);
149 dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24,"DLHJ", departIds, dateTIme,dateTIme);
150 sql ="select GROUP_CONCAT(d.depart_name,',') depart_name from "+dataViewName3a24+ " aaa left join "+dataViewName2119+ " bbb on aaa.depart_id = bbb.depart_id and aaa.time = bbb.time ";
151 sql += " left join report_target_config rtc on rtc.depart_id = aaa.depart_id and rtc.target_year = "+DateUtils.getDateYear(dateTIme);
152 sql += " left join sys_depart d on d.id = aaa.depart_id where (aaa.DLHJ/bbb.CSL ) > ifnull(rtc.target_power,999999999.99)";
153 dataMap = commonSqlService.queryForMap(sql);
154 operationDailyVO.setDhDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无") );
155 //10 药剂单耗公司
156 dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24,ReportConstant.fieldYj, departIds, dateTIme,dateTIme);
157
158 sql = " select GROUP_CONCAT(d.depart_name) depart_name from (";
159 sql += " select aa.depart_id, ";
160 sql += " CASE WHEN (aa.PAMZ /bb.CSL - ifnull(rtc.target_sclpamz / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1" +
161 " WHEN ( aa.PAMF/bb.CSL - ifnull(rtc.target_sclpamf / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1 ";
162 sql += " WHEN ( aa.PAMRJ/bb.CSL - ifnull(rtc.target_pamrj / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1 " +
163 " WHEN ( aa.SCLPAMZ/bb.CSL - ifnull(rtc.target_pamz / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1 ";
164 sql += " WHEN ( aa.SCLPAMF/bb.CSL - ifnull(rtc.target_pamf / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1 " +
165 " WHEN ( aa.NACLO/bb.CSL - ifnull(rtc.target_naclo / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1 ";
166 sql += " WHEN ( aa.PACGT/bb.CSL - ifnull(rtc.target_pacgt / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1 " +
167 " WHEN ( aa.PACYT/bb.CSL - ifnull(rtc.target_pacyt / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1 ";
168 sql += " WHEN ( aa.PFS/bb.CSL - ifnull(rtc.target_pfs / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1 " +
169 " WHEN ( aa.FHTY/bb.CSL - ifnull(rtc.target_fhty / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1 ";
170 sql += " WHEN ( aa.RYXNJ/bb.CSL - ifnull(rtc.target_ryxnj / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1" +
171 " WHEN ( aa.YWL/bb.CSL - ifnull(rtc.target_ywl / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1 ";
172 sql += " WHEN ( aa.GXCLJ/bb.CSL - ifnull(rtc.target_gxclj / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1" +
173 " WHEN ( aa.CH3COONA/bb.CSL - ifnull(rtc.target_ch3coona / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1 ";
174 sql += " WHEN ( aa.HXT/bb.CSL - ifnull(rtc.target_hxt / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1" +
175 " WHEN ( aa.FECL3/bb.CSL - ifnull(rtc.target_fecl3 / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1 ";
176 sql += " WHEN ( aa.SH/bb.CSL - ifnull(rtc.target_sh / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1" +
177 " WHEN ( aa.CH3COOH/bb.CSL - ifnull(rtc.target_ch3cooh / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1 ";
178 sql += " WHEN ( aa.FESO4G/bb.CSL - ifnull(rtc.target_feso4g / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1" +
179 " WHEN ( aa.FESO4Y/bb.CSL - ifnull(rtc.target_feso4y / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1 ";
180 sql += " WHEN ( aa.H2O2/bb.CSL - ifnull(rtc.target_h2o2 / (rtc.target_water *10000),9999999999.99)) > 0 THEN 1 " +
181 " ELSE 0 END AS result ";
182 sql += " from "+dataViewName3a24+" aa left join "+dataViewName2119+" bb on aa.depart_id = bb.depart_id ";
183 sql += " left join report_target_config rtc on rtc.depart_id = aa.depart_id and rtc.target_year = '"+ DateUtils.getDateYear(dateTIme)+"'";
184 sql += " ) ccc left join sys_depart d on d.id = ccc.depart_id where ccc.result =1 ";
185 dataMap = commonSqlService.queryForMap(sql);
186 operationDailyVO.setYhDepartName( ConvertUtils.getString(dataMap.get("depart_name"),"无") );
187
188 return operationDailyVO;
189 }
190
191 }
1 package com.skua.modules.report.vo;
2
3 import io.swagger.annotations.ApiModelProperty;
4 import lombok.Data;
5
6 /**
7 * 运营日报 日报
8 * @author kangwei
9 */
10 @Data
11 public class OperationDailyVO {
12
13 @ApiModelProperty(value = "处理水量合计")
14 private String cslhj;
15
16 @ApiModelProperty(value = "日均水量")
17 private String clsavg;
18
19 @ApiModelProperty(value = "昨日增加出水量")
20 private String increaseCLS;
21
22 @ApiModelProperty(value = "吨水电耗")
23 private String dsdh;
24
25 @ApiModelProperty(value = "昨日增加吨水电耗")
26 private String increaseDsdh;
27
28 @ApiModelProperty(value = "污泥量")
29 private String wnl;
30
31 @ApiModelProperty(value = "污泥脱水公司")
32 private String wnDepartName;
33
34 @ApiModelProperty(value = "污泥浓度公司")
35 private String mlssDepartName;
36
37 @ApiModelProperty(value = "进水超标公司")
38 private String jsDepartName;
39
40 @ApiModelProperty(value = "出水超标公司")
41 private String csDepartName;
42
43 @ApiModelProperty(value = "电耗超标公司")
44 private String dhDepartName;
45
46 @ApiModelProperty(value = "药耗超标公司")
47 private String yhDepartName;
48 }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!