06f69860 张雷

Merge remote-tracking branch 'origin/master' into master

2 个父辈 00d3760a e6ec9091
...@@ -159,8 +159,16 @@ public class AjhRectificationInfoController { ...@@ -159,8 +159,16 @@ public class AjhRectificationInfoController {
159 public Result<List<Map<String,Object>>> getDefectHandleCount(AjhRectificationInfo ajhRectificationInfo, HttpServletRequest req){ 159 public Result<List<Map<String,Object>>> getDefectHandleCount(AjhRectificationInfo ajhRectificationInfo, HttpServletRequest req){
160 Result<List<Map<String,Object>>> result = new Result<>(); 160 Result<List<Map<String,Object>>> result = new Result<>();
161 QueryWrapper<AjhRectificationInfo> queryWrapper = QueryGenerator.initQueryWrapper(ajhRectificationInfo, req.getParameterMap()); 161 QueryWrapper<AjhRectificationInfo> queryWrapper = QueryGenerator.initQueryWrapper(ajhRectificationInfo, req.getParameterMap());
162
162 queryWrapper.select("count(id) count,handle_result handleResult"); 163 queryWrapper.select("count(id) count,handle_result handleResult");
163 queryWrapper.groupBy("handle_result"); 164 queryWrapper.groupBy("handle_result");
165 /* if(StringUtils.isEmpty(ajhRectificationInfo.getDepartId())){
166 ajhRectificationInfo.setDepartId(BaseContextHandler.getDeparts());
167 }*/
168 if (!"1".equals(BaseContextHandler.get("userType"))) {
169 queryWrapper.in("depart_id",BaseContextHandler.getDeparts());
170 }
171
164 List<Map<String,Object>> list = ajhRectificationInfoService.listMaps(queryWrapper); 172 List<Map<String,Object>> list = ajhRectificationInfoService.listMaps(queryWrapper);
165 result.setSuccess(true); 173 result.setSuccess(true);
166 result.setResult(list); 174 result.setResult(list);
......
...@@ -18,4 +18,23 @@ public interface IAlarmLimitCustomService { ...@@ -18,4 +18,23 @@ public interface IAlarmLimitCustomService {
18 18
19 Map<String, Map<String,Double>> getAlarmLimitData(String departIds); 19 Map<String, Map<String,Double>> getAlarmLimitData(String departIds);
20 20
21 public Map<String, Map<String, Map<String, Double>>> riverAlarmMap(String alarmParamCodes);
22
23 /**
24 * 指标值报警预警
25 * @param value 指标值
26 * @param stringIntegerMap key->factoryId+_+code val->报警上下限值
27 * @return
28 */
29 public String alarmValue(Double value, Map<String, Double> stringIntegerMap);
30
31 /***
32 * 指标值超上下限
33 * @param value
34 * @param stringIntegerMap key->factoryId+_+code val->报警上下限值
35 * @return
36 */
37 public String alarmValueLimit(Double value, Map<String, Double> stringIntegerMap);
38 public Double riverAlarm(Map<String, Map<String, Map<String, Double>>> riverAlarmMap, String paramId,Double paramValue);
39
21 } 40 }
......
1 package com.skua.modules.algorithm.handle.impl; 1 package com.skua.modules.algorithm.handle.impl;
2 2
3 import cn.hutool.core.util.ObjectUtil;
4 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5 import com.skua.core.util.ConvertUtils;
6 import com.skua.modules.alarmtmp.entity.AlarmLevelStandardConfig;
7 import com.skua.modules.alarmtmp.entity.AlarmParamStandardConfig;
8 import com.skua.modules.alarmtmp.service.AlarmLevelStandardConfigService;
9 import com.skua.modules.alarmtmp.service.AlarmParamStandardConfigService;
3 import com.skua.modules.algorithm.handle.IAlarmLimitCustomService; 10 import com.skua.modules.algorithm.handle.IAlarmLimitCustomService;
11 import org.springframework.beans.factory.annotation.Autowired;
4 import org.springframework.stereotype.Component; 12 import org.springframework.stereotype.Component;
5 13
6 import java.util.HashMap; 14 import java.util.HashMap;
15 import java.util.List;
7 import java.util.Map; 16 import java.util.Map;
8 17
9 /** 18 /**
...@@ -14,10 +23,103 @@ import java.util.Map; ...@@ -14,10 +23,103 @@ import java.util.Map;
14 */ 23 */
15 @Component("alarmLimitCustomServiceImpl") 24 @Component("alarmLimitCustomServiceImpl")
16 public class IAlarmLimitCustomServiceImpl implements IAlarmLimitCustomService { 25 public class IAlarmLimitCustomServiceImpl implements IAlarmLimitCustomService {
26 @Autowired
27 private AlarmLevelStandardConfigService alarmLevelStandardConfigService;
28 @Autowired
29 private AlarmParamStandardConfigService alarmParamStandardConfigService;
17 30
31 /**
32 * 指标值报警预警
33 *
34 * @param value 指标值
35 * @param stringIntegerMap key->alarmUpperLimit val->报警上限值
36 * key->alarmLowerLimit val->报警下限值
37 * @author Gao Ran,
38 * @Description:
39 */
40 @Override
41 public String alarmValue(Double value, Map<String, Double> stringIntegerMap) {
42 if ((stringIntegerMap != null && stringIntegerMap.get("alarmUpperLimit") != null && value > stringIntegerMap.get("alarmUpperLimit")) ||
43 (stringIntegerMap != null && stringIntegerMap.get("alarmLowerLimit") != null && value < stringIntegerMap.get("alarmLowerLimit"))) {
44 //报警
45 return ("2");
46 } else if ((stringIntegerMap != null && stringIntegerMap.get("warnUpperLimit") != null && value > stringIntegerMap.get("warnUpperLimit")) ||
47 (stringIntegerMap != null && stringIntegerMap.get("warnLowerLimit") != null && value < stringIntegerMap.get("warnLowerLimit"))) {
48 //预警
49 return ("1");
50 } else {
51 //正常
52 return ("0");
53 }
54 }
55
56 public String alarmValueLimit(Double value, Map<String, Double> stringIntegerMap) {
57 if ((stringIntegerMap != null && stringIntegerMap.get("alarmUpperLimit") != null && value > stringIntegerMap.get("alarmUpperLimit"))) {
58 //超上限
59 return ("2");
60 } else if ((stringIntegerMap != null && stringIntegerMap.get("alarmLowerLimit") != null && value < stringIntegerMap.get("alarmLowerLimit"))) {
61 //低于下限
62 return ("1");
63 } else {
64 //正常
65 return ("0");
66 }
67 }
68 @Override
69 public Double riverAlarm(Map<String, Map<String, Map<String, Double>>> riverAlarmMap, String paramId, Double paramValue) {
70 //河道地表水标准
71 //三类水标准
72 Map<String, Map<String, Double>> threeMap = riverAlarmMap.get("DBSSL");
73 //四类水标准
74 Map<String, Map<String, Double>> fourMap = riverAlarmMap.get("DBSSIL");
75 //五类水标准
76 Map<String, Map<String, Double>> fiveMap = riverAlarmMap.get("DBSWL");
77 Map<String, Object> paramMap = new HashMap<>();
78 if ((threeMap != null && threeMap.get(paramId) != null && paramValue <= threeMap.get(paramId).get("alarmUpperLimit"))
79 && (paramValue > threeMap.get(paramId).get("alarmLowerLimit"))) {
80 paramMap.put("paramLevel", 3);
81 } else if ((fourMap != null && fourMap.get(paramId) != null && paramValue <= fourMap.get(paramId).get("alarmUpperLimit"))
82 && (paramValue > fourMap.get(paramId).get("alarmLowerLimit"))) {
83 paramMap.put("paramLevel", 4);
84 } else if ((fiveMap != null && fiveMap.get(paramId) != null && paramValue <= fiveMap.get(paramId).get("alarmUpperLimit"))
85 && (paramValue > fiveMap.get(paramId).get("alarmLowerLimit"))) {
86 paramMap.put("paramLevel", 5);
87 } else if ((fiveMap != null && fiveMap.get(paramId) != null && paramValue > fiveMap.get(paramId).get("alarmUpperLimit"))) {
88 paramMap.put("paramLevel", 6);
89 } else {
90 paramMap.put("paramLevel", 3);
91 }
92 return ConvertUtils.getDouble(paramMap.get("paramLevel"), 0);
93 }
18 @Override 94 @Override
19 public Map<String, Map<String, Double>> getAlarmLimitData(String departIds) { 95 public Map<String, Map<String, Double>> getAlarmLimitData(String departIds) {
20 return new HashMap<>(); 96 return new HashMap<>();
21 } 97 }
98 public Map<String, Map<String, Map<String, Double>>> riverAlarmMap(String alarmParamCodes) {
99 Map<String, Map<String, Map<String, Double>>> alarmParamMap = new HashMap<>();
100 for (String alarmParamCode : alarmParamCodes.split(",")) {
101 AlarmLevelStandardConfig levelCode = alarmLevelStandardConfigService.getOne(new QueryWrapper<AlarmLevelStandardConfig>().eq("alarm_standard_level_code", alarmParamCode), false);
102 if (ObjectUtil.isEmpty(levelCode)) {
103 return new HashMap<>();
104 }
105 List<AlarmParamStandardConfig> standardConfig = alarmParamStandardConfigService.list(new QueryWrapper<AlarmParamStandardConfig>().
106 eq("alarm_level_standard_id", levelCode.getId()));
107 //保存厂站指标报警
108 Map<String, Map<String, Double>> factoryParamLimitMap = new HashMap<>();
109 Map<String, Double> paramLimitMap;
110 for (AlarmParamStandardConfig alarmParamStandardDepartVO : standardConfig) {
111 paramLimitMap = new HashMap<>();
112 paramLimitMap.put("alarmUpperLimit", Double.parseDouble(alarmParamStandardDepartVO.getAlarmParamUpperLimit()));
113 paramLimitMap.put("alarmLowerLimit", Double.parseDouble(alarmParamStandardDepartVO.getAlarmParamLowerLimit()));
114
115 factoryParamLimitMap.put(alarmParamStandardDepartVO.getAlarmParamCode(), paramLimitMap);
116 }
117
118 alarmParamMap.put(alarmParamCode, factoryParamLimitMap);
119
120 }
121 return alarmParamMap;
122
123 }
22 124
23 } 125 }
......
...@@ -97,4 +97,9 @@ public class QuestionDB { ...@@ -97,4 +97,9 @@ public class QuestionDB {
97 @TableField(exist=false) 97 @TableField(exist=false)
98 @ApiModelProperty(value = "判断题数目") 98 @ApiModelProperty(value = "判断题数目")
99 private Integer judgeNum; 99 private Integer judgeNum;
100
101
102 @TableField(exist=false)
103 @ApiModelProperty(value = "所属厂站")
104 private String departName;
100 } 105 }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
4 <resultMap type="com.skua.modules.edu.entity.QuestionDB" id="EduQuestionDbResult"> 4 <resultMap type="com.skua.modules.edu.entity.QuestionDB" id="EduQuestionDbResult">
5 <result property="id" column="id" /> 5 <result property="id" column="id" />
6 <result property="departId" column="depart_id" /> 6 <result property="departId" column="depart_id" />
7 <result property="departName" column="depart_name" />
7 <result property="userId" column="user_id" /> 8 <result property="userId" column="user_id" />
8 <result property="parentId" column="parent_id" /> 9 <result property="parentId" column="parent_id" />
9 <result property="dbName" column="db_name" /> 10 <result property="dbName" column="db_name" />
...@@ -25,7 +26,7 @@ ...@@ -25,7 +26,7 @@
25 </sql> 26 </sql>
26 27
27 <select id="selectQuestionDbList" parameterType="com.skua.modules.edu.entity.QuestionDB" resultMap="EduQuestionDbResult"> 28 <select id="selectQuestionDbList" parameterType="com.skua.modules.edu.entity.QuestionDB" resultMap="EduQuestionDbResult">
28 select t.* , ifnull(aaa.single_num,0) single_num , ifnull(aaa.multiple_num,0) multiple_num , ifnull(aaa.judge_num,0) judge_num from edu_question_db t 29 select d.depart_name,t.* , ifnull(aaa.single_num,0) single_num , ifnull(aaa.multiple_num,0) multiple_num , ifnull(aaa.judge_num,0) judge_num from edu_question_db t
29 left join ( 30 left join (
30 SELECT question_db_id , question_type, 31 SELECT question_db_id , question_type,
31 SUM(IF(`question_type`='1',1,0))as 'single_num', 32 SUM(IF(`question_type`='1',1,0))as 'single_num',
...@@ -34,6 +35,7 @@ ...@@ -34,6 +35,7 @@
34 FROM edu_question 35 FROM edu_question
35 group by question_db_id , question_type 36 group by question_db_id , question_type
36 )aaa on aaa.question_db_id = t.id 37 )aaa on aaa.question_db_id = t.id
38 left join sys_depart d on t.depart_id = d.id
37 <where> 39 <where>
38 <if test="departId != null and departId != ''"> and t.depart_id = #{departId}</if> 40 <if test="departId != null and departId != ''"> and t.depart_id = #{departId}</if>
39 <if test="userId != null and userId != ''"> and t.user_id = #{userId}</if> 41 <if test="userId != null and userId != ''"> and t.user_id = #{userId}</if>
......
...@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
8 import com.google.common.collect.Lists; 8 import com.google.common.collect.Lists;
9 import com.google.common.collect.MapDifference; 9 import com.google.common.collect.MapDifference;
10 import com.google.common.collect.Maps; 10 import com.google.common.collect.Maps;
11 import com.skua.core.util.DoubleOperaUtils;
11 import com.skua.modules.alarmtmp.entity.SysFactoryDevice; 12 import com.skua.modules.alarmtmp.entity.SysFactoryDevice;
12 import com.skua.modules.alarmtmp.service.ISysFactoryDeviceService; 13 import com.skua.modules.alarmtmp.service.ISysFactoryDeviceService;
13 import com.skua.core.api.vo.Result; 14 import com.skua.core.api.vo.Result;
...@@ -17,6 +18,7 @@ import com.skua.core.context.SpringContextUtils; ...@@ -17,6 +18,7 @@ import com.skua.core.context.SpringContextUtils;
17 import com.skua.core.service.IFactoryInfoService; 18 import com.skua.core.service.IFactoryInfoService;
18 import com.skua.core.util.ConvertUtils; 19 import com.skua.core.util.ConvertUtils;
19 import com.skua.core.util.DateUtils; 20 import com.skua.core.util.DateUtils;
21 import com.skua.modules.algorithm.handle.IAlarmLimitCustomService;
20 import com.skua.modules.algorithm.service.ISysAlgorithmLibraryService; 22 import com.skua.modules.algorithm.service.ISysAlgorithmLibraryService;
21 import com.skua.modules.algorithm.service.ISysAlgorithmStatisticsLibraryService; 23 import com.skua.modules.algorithm.service.ISysAlgorithmStatisticsLibraryService;
22 import com.skua.modules.algorithm.vo.SysAlgorithmStatisticsLibraryVO; 24 import com.skua.modules.algorithm.vo.SysAlgorithmStatisticsLibraryVO;
...@@ -34,6 +36,7 @@ import com.skua.modules.system.vo.SysFactoryInfo.SysFactoryInfoVO; ...@@ -34,6 +36,7 @@ import com.skua.modules.system.vo.SysFactoryInfo.SysFactoryInfoVO;
34 import com.skua.modules.threedimensional.service.IDataCountDayService; 36 import com.skua.modules.threedimensional.service.IDataCountDayService;
35 import com.skua.modules.threedimensional.service.IScreenDataService; 37 import com.skua.modules.threedimensional.service.IScreenDataService;
36 import com.skua.modules.threedimensional.vo.DataParams; 38 import com.skua.modules.threedimensional.vo.DataParams;
39 import com.skua.modules.threedimensional.vo.RealTimeDataVO;
37 import com.skua.modules.threedimensional.vo.StatisticsParams; 40 import com.skua.modules.threedimensional.vo.StatisticsParams;
38 import io.swagger.annotations.Api; 41 import io.swagger.annotations.Api;
39 import io.swagger.annotations.ApiOperation; 42 import io.swagger.annotations.ApiOperation;
...@@ -78,6 +81,10 @@ public class ScreenDataController { ...@@ -78,6 +81,10 @@ public class ScreenDataController {
78 private IDataCountDayService dataCountDayService; 81 private IDataCountDayService dataCountDayService;
79 @Autowired 82 @Autowired
80 private ISysFactoryDeviceService sysFactoryDeviceService; 83 private ISysFactoryDeviceService sysFactoryDeviceService;
84 @Autowired
85 private IAlarmLimitCustomService alarmLimitCustomService;
86 @Autowired
87 private IFactoryInfoService factoryInfoService;
81 88
82 /** 89 /**
83 * 获取累计流量 90 * 获取累计流量
...@@ -498,8 +505,6 @@ public class ScreenDataController { ...@@ -498,8 +505,6 @@ public class ScreenDataController {
498 result.setResult(resultMap); 505 result.setResult(resultMap);
499 return result; 506 return result;
500 } 507 }
501
502
503 /** 508 /**
504 * 今日水量情况 509 * 今日水量情况
505 * 510 *
...@@ -1196,10 +1201,6 @@ public class ScreenDataController { ...@@ -1196,10 +1201,6 @@ public class ScreenDataController {
1196 return true; 1201 return true;
1197 } 1202 }
1198 1203
1199 public static void main(String[] args) {
1200 System.out.println(getBetweenDate("2020-02-02", "2020-03-03"));
1201 }
1202
1203 public static List<String> getBetweenDate(String start, String end) { 1204 public static List<String> getBetweenDate(String start, String end) {
1204 List<String> list = new ArrayList<>(); 1205 List<String> list = new ArrayList<>();
1205 // LocalDate默认的时间格式为2020-02-02 1206 // LocalDate默认的时间格式为2020-02-02
...@@ -1219,6 +1220,14 @@ public class ScreenDataController { ...@@ -1219,6 +1220,14 @@ public class ScreenDataController {
1219 public Result<Map<String, Object>> getRealTimeSz(@RequestBody DataParams dataParams) { 1220 public Result<Map<String, Object>> getRealTimeSz(@RequestBody DataParams dataParams) {
1220 Result<Map<String, Object>> result = new Result<>(); 1221 Result<Map<String, Object>> result = new Result<>();
1221 Map<String, Object> map = new HashMap<>(); 1222 Map<String, Object> map = new HashMap<>();
1223
1224
1225
1226
1227
1228
1229
1230
1222 result.setResult(map); 1231 result.setResult(map);
1223 return result; 1232 return result;
1224 } 1233 }
...@@ -1245,4 +1254,430 @@ public class ScreenDataController { ...@@ -1245,4 +1254,430 @@ public class ScreenDataController {
1245 return result; 1254 return result;
1246 } 1255 }
1247 1256
1257
1258 /**
1259 * app工艺段实时数据分组查询
1260 *
1261 * @param departId
1262 * @param req
1263 * @return
1264 */
1265 @AutoLog(value = "工艺段实时数据分组查询")
1266 @ApiOperation(value = "工艺段实时数据分组查询", notes = "工艺段实时数据分组查询")
1267 @GetMapping(value = "/getRealData")
1268 public Result getRealTimeData(String statics, String departId, HttpServletRequest req, String startTime, String endTime, String departType, String structCode, String isApp, String tag, String pgId) {
1269 Result result = new Result();
1270 // if (!org.springframework.util.StringUtils.hasText(departId)) {
1271 // //如果厂站为空
1272 // departId = BaseContextHandler.getDeparts();
1273 // }
1274 String order = req.getParameter("order");
1275 String groupName = req.getParameter("groupName");
1276 String pattern = "yyyy-MM-dd HH:mm:ss";
1277 String timePeriod = "mm";
1278 if (org.apache.commons.lang3.StringUtils.isNotBlank(statics)) {
1279 if (statics.equals("mm")) {
1280 pattern = "yyyy-MM-dd HH:mm:ss";
1281 timePeriod = "mm";
1282 } else if (statics.equals("day")) {
1283 pattern = "yyyy-MM-dd HH:mm:ss";
1284 timePeriod = "mm";
1285 } else if (statics.equals("month")) {
1286 pattern = "yyyy-MM-dd";
1287 timePeriod = "d";
1288 } else if (statics.equals("year")) {
1289 pattern = "yyyy-MM";
1290 timePeriod = "m";
1291 }
1292 }
1293 List<Map<String, Object>> dictGroupData = getDictGroup(departType, departId, tag, pgId, structCode, groupName);
1294 //点表id
1295 String fields = dictGroupData.stream().map(data -> ConvertUtils.getString(data.get("id"))).collect(Collectors.joining(","));
1296 //指标标准化编码
1297 String codeId = dictGroupData.stream().map(data -> ConvertUtils.getString(data.get("metric_uid_tag"))).distinct().collect(Collectors.joining(","));
1298 Map<String, String> id2Name = dictGroupData.stream().collect(Collectors.toMap(data -> ConvertUtils.getString(data.get("id")), data -> ConvertUtils.getString(data.get("metric_name")), (o1, o2) -> o1));
1299
1300 //查询指标的实时pg值
1301 List<Map<String, Object>> maps = new ArrayList<>();
1302 List<Map<String, Object>> pgList = new ArrayList<>();
1303 try {
1304 if (org.apache.commons.lang3.StringUtils.isEmpty(startTime) && org.apache.commons.lang3.StringUtils.isEmpty(endTime)) {
1305 JdbcTemplate pgdb = (JdbcTemplate) SpringContextUtils.getBean("pg-db");
1306 String fieldsCollect = Arrays.stream(fields.split(",")).map(data -> "'" + data + "'").collect(Collectors.joining(","));
1307 String yyyyMMdd = DateUtils.format(new Date(), "yyyyMMdd");
1308 String sql = "select * from realtimedata where nm in (" + fieldsCollect + ")";
1309 // String sql = "SELECT t2.* FROM" +
1310 // "( SELECT nm, MAX ( ts ) ts FROM xsinsert" + yyyyMMdd + " where nm in (" + fieldsCollect + ") GROUP BY nm ,ts ) t1, " +
1311 // "xsinsert" + yyyyMMdd + " t2 WHERE t1.nm = t2.nm AND t1.ts = t2.ts and t2.nm in (" + fieldsCollect + ")";
1312 pgList = pgdb.queryForList(sql);
1313 maps = new ArrayList<>();
1314 for (Map<String, Object> pgMap : pgList) {
1315 Map<String, Object> pgTimeValMap = Maps.newHashMap();
1316 String nm = ConvertUtils.getString(pgMap.get("nm"));
1317 pgTimeValMap.put(nm, ConvertUtils.getString(pgMap.get("v")));
1318 pgTimeValMap.put("time", ConvertUtils.getString(pgMap.get("ts")));
1319 maps.add(pgTimeValMap);
1320
1321 }
1322 }
1323 } catch (Exception e) {
1324 e.printStackTrace();
1325 }
1326
1327 //如果起止时间不为空,查询小时表趋势的数据
1328 if (org.apache.commons.lang3.StringUtils.isNotBlank(startTime) && org.apache.commons.lang3.StringUtils.isNotBlank(endTime)) {
1329 maps = factoryInfoService.queryFactoryInfos(departId, fields, startTime, endTime, "1");
1330 if (org.apache.commons.lang3.StringUtils.isNotBlank(statics)) {
1331 maps = factoryInfoService.handleResult(maps, timePeriod, fields);
1332 for (Map<String, Object> map : maps) {
1333 //除time字段外,求平均值
1334 for (String field : fields.split(",")) {
1335 Object value = map.get(field);
1336 Object valueSumCount = map.get(field + "_tag");
1337 if (field.contains("LJ")) {
1338 //求和则使用原来求和的值
1339 map.put(field, DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(value, 0.00), 2));
1340 } else {
1341 //用平均值改写原来合计值
1342 map.put(field, DoubleOperaUtils.bigDecimalRound(ConvertUtils.getDouble(value, 0.00) / ConvertUtils.getDouble(valueSumCount, 1.00), 2));
1343 }
1344 }
1345 }
1346 }
1347 }
1348 //如果起止时间不为空,特殊处理测压点的趋势的数据
1349 // if (org.apache.commons.lang3.StringUtils.isNotBlank(startTime) && org.apache.commons.lang3.StringUtils.isNotBlank(endTime) && "6".equals(departType)) {
1350 // try {
1351 // JdbcTemplate pgdb = (JdbcTemplate) SpringContextUtils.getBean("pg-db");
1352 // String fieldsCollect = Arrays.stream(fields.split(",")).map(data -> "'" + data + "'").distinct().collect(Collectors.joining(","));
1353 // String sql = "select ts as time,nm as monitorId,v as monitorValue from yl_day where nm in (" + fieldsCollect + ") and ts>='" + DateUtils.getMillis(DateUtils.parse(startTime, "yyyy-MM-dd HH:mm:ss")) / 1000 + "' and ts<='" + DateUtils.getMillis(DateUtils.parse(endTime, "yyyy-MM-dd HH:mm:ss")) / 1000 + "'";
1354 // maps = pgdb.queryForList(sql);
1355 // maps = dataRowToCellByTime(new ArrayList<Map<String, Object>>(), maps);
1356 // } catch (Exception e) {
1357 // e.printStackTrace();
1358 // }
1359 //
1360 //
1361 // }
1362 //校验数据判断组装
1363 List<RealTimeDataVO> res;
1364 //实时数据按厂站格式分组组装数据
1365 if (org.apache.commons.lang3.StringUtils.isNotBlank(departType) && org.apache.commons.lang3.StringUtils.isEmpty(startTime) && org.apache.commons.lang3.StringUtils.isEmpty(endTime)) {
1366 res = alarmPgVal(departId, maps, dictGroupData, pattern);
1367 List<Map<String, Object>> resList;
1368 resList = staticsForDepart(departType, res, departId);
1369 result.setResult(resList);
1370 }
1371 //如果是趋势图以时间分组格式组装
1372 else if (org.apache.commons.lang3.StringUtils.isNotBlank(startTime) && org.apache.commons.lang3.StringUtils.isNotBlank(endTime)) {
1373 res = alarmPgVal(departId, maps, dictGroupData, pattern);
1374
1375 Map<String, List<RealTimeDataVO>> collect = res.stream().sorted(Comparator.comparing(RealTimeDataVO::getTime).reversed()).collect(Collectors.groupingBy(data -> data.getTime()));
1376 List<String> timeList;
1377 if (org.apache.commons.lang3.StringUtils.isNotBlank(statics)) {
1378 timeList = DateUtils.sliceUpDateRange(startTime, endTime, statics);
1379 } else {
1380 timeList = DateUtils.sliceUpDateRange(startTime, endTime, "day");
1381 }
1382 //补充默认字段
1383 if ("6".equals(departType)) {
1384 } else {
1385 for (String time : timeList) {
1386 if (CollectionUtil.isEmpty(collect.get(time))) {
1387 collect.put(time, new ArrayList<>());
1388 }
1389 }
1390 }
1391 //排序
1392 TreeMap<String, Object> treeMap = new TreeMap<>();
1393 treeMap.putAll(collect);
1394 result.setResult(treeMap);
1395 //数据格式组装
1396
1397 List<String> codeList = Arrays.asList(codeId.split(","));
1398 collect = res.stream().sorted(Comparator.comparing(RealTimeDataVO::getTime)).collect(Collectors.groupingBy(data -> data.getDictId()));
1399 List<Object> list = new ArrayList<>();
1400 Map<String, Object> finalRes = new HashMap<String, Object>() {{
1401 put("code", codeList);
1402 put("time", timeList);
1403 put("data", list);
1404 }};
1405 //为空数据的时间段塞值
1406 //为空数据的时间段塞值
1407 if (!org.apache.commons.lang3.StringUtils.isEmpty(codeId)) {
1408 for (String key : codeList) {
1409 Map<String, Object> map = Maps.newHashMap();
1410 Map<String, RealTimeDataVO> time2ValMap = Maps.newHashMap();
1411 map.put("code", key);
1412 List<RealTimeDataVO> realTimeDataVOS = collect.getOrDefault(key, new ArrayList<>());
1413 for (RealTimeDataVO realTimeDataVO : realTimeDataVOS) {
1414 time2ValMap.put(realTimeDataVO.getTime(), realTimeDataVO);
1415 }
1416 //如果是测压点,十分钟采集的一条数据无序,对应不上切割的时间,不填充数据了
1417
1418 for (String time : timeList) {
1419 //String format = localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
1420 RealTimeDataVO realTimeDataVO = time2ValMap.get(time);
1421 if (ObjectUtil.isEmpty(realTimeDataVO)) {
1422 realTimeDataVO = new RealTimeDataVO();
1423 realTimeDataVO.setTime(time);
1424 realTimeDataVO.setDictId(key);
1425 realTimeDataVO.setPgId(key);
1426 realTimeDataVO.setMetricRealName(id2Name.get(key));
1427 realTimeDataVO.setPgVal("");
1428 realTimeDataVO.setAlarmStatus("0");
1429 realTimeDataVOS.add(realTimeDataVO);
1430 }
1431 }
1432 if (org.apache.commons.lang3.StringUtils.isEmpty(order) || order.equals("asc")) {
1433 realTimeDataVOS = realTimeDataVOS.stream().sorted(Comparator.comparing(RealTimeDataVO::getTime)).collect(Collectors.toList());
1434 } else {
1435 realTimeDataVOS = realTimeDataVOS.stream().sorted(Comparator.comparing(RealTimeDataVO::getTime).reversed()).collect(Collectors.toList());
1436 }
1437 map.put("data", realTimeDataVOS);
1438 list.add(map);
1439 }
1440 }
1441 result.setResult(finalRes);
1442 }
1443
1444 //实时数据格式
1445 else {
1446 res = alarmPgVal(departId, maps, dictGroupData, pattern);
1447 result.setResult(res);
1448 }
1449 return result;
1450
1451 }
1452
1453 /**
1454 * <pre>
1455 * <请输入描述信息> //工艺段分组,查询工艺段下的指标
1456 * </pre>
1457 *
1458 * @param departId
1459 * @param tag
1460 * @author Gao Ran,
1461 * @Description: TODO(这里描述这个方法的需求变更情况)
1462 */
1463 public List<Map<String, Object>> getDictGroup(String departType, String departId, String tag, String
1464 pgId, String structCode, String groupName) {
1465 //工艺段分组,查询工艺段下的指标
1466 QueryWrapper dictGroupQueryWrapper = new QueryWrapper();
1467 if (!org.apache.commons.lang3.StringUtils.isEmpty(departId)) {
1468 dictGroupQueryWrapper.in("sd.id", Arrays.asList(departId.split(",")));
1469 }
1470 if (!org.apache.commons.lang3.StringUtils.isEmpty(departType)) {
1471 dictGroupQueryWrapper.in("sd.depart_type", Arrays.asList(departType.split(",")));
1472 }
1473 if (!org.apache.commons.lang3.StringUtils.isEmpty(pgId)) {
1474 dictGroupQueryWrapper.in("smmi.id", Arrays.asList(pgId.split(",")));
1475 }
1476 if (!org.apache.commons.lang3.StringUtils.isEmpty(tag)) {
1477 dictGroupQueryWrapper.in("smmi.metric_uid_tag", Arrays.asList(tag.split(",")));
1478 }
1479
1480 if (!org.apache.commons.lang3.StringUtils.isEmpty(structCode)) {
1481 dictGroupQueryWrapper.in("smmi.struct_code", Arrays.asList(structCode.split(",")));
1482 }
1483
1484 if (!org.apache.commons.lang3.StringUtils.isEmpty(groupName)) {
1485 dictGroupQueryWrapper.in("g.group_name", Arrays.asList(groupName.split(",")));
1486 }
1487 List<Map<String, Object>> dictGroupData = screenDataService.getDictGroupData(dictGroupQueryWrapper);
1488 return dictGroupData;
1489 }
1490 private List<RealTimeDataVO> alarmPgVal(String departId, List<Map<String, Object>> maps, List<Map<String, Object>> dictGroupData, String pattern) {
1491 List<RealTimeDataVO> res = new ArrayList<>();
1492 //点id与点信息映射
1493 Map<String, Map<String, Object>> pgId2Map = Maps.newHashMap();
1494 for (Map<String, Object> dictGroupDatum : dictGroupData) {
1495 pgId2Map.put(ConvertUtils.getString(dictGroupDatum.get("id")), dictGroupDatum);
1496 }
1497 // Map<String, Map<String, Double>> alarmLimitData = alarmLimitCustomService.riverAlarmAllMap("DBSSW,DBSSL");
1498 Map<String, Map<String, Map<String, Double>>> riverAlarmMap = alarmLimitCustomService.riverAlarmMap("DBSSIL,DBSSL,DBSWL");
1499 Map<String, Map<String, Double>> alarmLimitData = alarmLimitCustomService.getAlarmLimitData(departId);
1500
1501
1502 for (Map<String, Object> realTimeData : maps) {
1503 //查询所属厂站的报警阈值
1504 //获取时间
1505 //String time = DateUtils.formatTime(Long.parseLong(realTimeData.get("time") + "000"));
1506 NumberFormat numberFormat = NumberFormat.getInstance();
1507 numberFormat.setMaximumFractionDigits(2);
1508 String time = DateUtils.format(DateUtils.getDate(Long.parseLong(realTimeData.get("time") + "000")), pattern);
1509 for (String pgId : realTimeData.keySet()) {
1510 if ("time".equals(pgId) || pgId.contains("tag")) {
1511 continue;
1512 }
1513 RealTimeDataVO realTimeDataVO = new RealTimeDataVO();
1514 String pgVal = ConvertUtils.getString(realTimeData.get(pgId));
1515 BigDecimal b1 = new BigDecimal((org.apache.commons.lang3.StringUtils.isEmpty(pgVal) ? "0" : pgVal)).setScale(2, BigDecimal.ROUND_HALF_UP);
1516 double v = b1.doubleValue();
1517 Map<String, Object> pgId2MapOrDefault = pgId2Map.getOrDefault(pgId, new HashMap<>());
1518 String depart = ConvertUtils.getString(pgId2MapOrDefault.get("depart_id"));
1519 String metric_type = ConvertUtils.getString(pgId2MapOrDefault.get("metric_type"));
1520 String uidTag = ConvertUtils.getString(pgId2MapOrDefault.get("metric_uid_tag"));
1521 String sort_num = ConvertUtils.getString(pgId2MapOrDefault.get("sort_num"));
1522 String metricd_name = ConvertUtils.getString(pgId2MapOrDefault.get("metricd_name"));
1523 String depart_name = ConvertUtils.getString(pgId2MapOrDefault.get("depart_name"));
1524 String parent_depart_name = ConvertUtils.getString(pgId2MapOrDefault.get("parent_depart_name"));
1525 String metric_name = ConvertUtils.getString(pgId2MapOrDefault.get("metric_name"));
1526 String metric_unit = ConvertUtils.getString(pgId2MapOrDefault.get("metric_unit"));
1527 String groupName = ConvertUtils.getString(pgId2MapOrDefault.get("groupName"));
1528 String groupType = ConvertUtils.getString(pgId2MapOrDefault.get("groupType"));
1529 Map<String, Double> limitMap = alarmLimitData.get(depart + "_" + uidTag);
1530 // Map<String, Double> limitMap = alarmLimitData.get(uidTag);
1531 //查询报警上下限比较状态
1532 String alarmValue = "0";
1533 Double riverAlarm = 0d;
1534 if (ObjectUtil.isNotEmpty(limitMap)) {
1535 alarmValue = alarmLimitCustomService.alarmValue(v, limitMap);
1536
1537 if ("SZBOD,SZCOD,SZDDL,SZDO,SZGMSY,SZNH3N,SZPH,SZTN,SZTP".contains(uidTag)) {
1538 riverAlarm = alarmLimitCustomService.riverAlarm(riverAlarmMap, uidTag, v);
1539 } else {
1540 riverAlarm = ConvertUtils.getDouble(alarmLimitCustomService.alarmValueLimit(v, limitMap), 0);
1541 }
1542 String alarmUpperLimit = ConvertUtils.getString(limitMap.get("alarmUpperLimit"), "");
1543 String alarmLowerLimit = ConvertUtils.getString(limitMap.get("alarmLowerLimit"), "");
1544 String warnUpperLimit = ConvertUtils.getString(limitMap.get("warnUpperLimit"), "");
1545 String warnLowerLimit = ConvertUtils.getString(limitMap.get("warnLowerLimit"), "");
1546 realTimeDataVO.setAlarmLimit(alarmLowerLimit + "-" + alarmUpperLimit);
1547 realTimeDataVO.setWarnLimit(warnLowerLimit + "-" + warnUpperLimit);
1548 realTimeDataVO.setRiverAlarm(ConvertUtils.getString(riverAlarm));
1549 }
1550 realTimeDataVO.setDepartId(depart);
1551 realTimeDataVO.setDepartName(depart_name);
1552 realTimeDataVO.setParentDepartName(parent_depart_name);
1553 realTimeDataVO.setTime(time);
1554 realTimeDataVO.setMetricdName(metricd_name);
1555 realTimeDataVO.setMetricRealName(metric_name);
1556 realTimeDataVO.setMetricUnit(metric_unit);
1557 realTimeDataVO.setGroupType(groupType);
1558 realTimeDataVO.setGroupName(groupName);
1559 realTimeDataVO.setAlarmStatus(alarmValue);
1560 realTimeDataVO.setDictId(uidTag);
1561 realTimeDataVO.setPgId(pgId);
1562 realTimeDataVO.setSortNum(sort_num);
1563 realTimeDataVO.setPgVal(ConvertUtils.getString(b1));
1564 //判端指标进出水分类
1565 if (!org.springframework.util.StringUtils.isEmpty(uidTag)) {
1566 if (uidTag.contains("JS")) {
1567 realTimeDataVO.setWaterType("JS");
1568 } else if (uidTag.contains("CS")) {
1569 realTimeDataVO.setWaterType("CS");
1570 }
1571 }
1572 // if ("1".equals(metric_type)||uidTag.contains("YXZT")){
1573 // if (0d==v){
1574 // realTimeDataVO.setPgVal("开启") ;
1575 // }else {
1576 // realTimeDataVO.setPgVal("关闭") ;
1577 // }
1578 // }
1579
1580 if ("YWJZT".equals(uidTag)) {
1581 if (0 == v) {
1582 realTimeDataVO.setPgVal("正常");
1583 } else if (1 == v) {
1584 realTimeDataVO.setPgVal("预警");
1585 } else if (2 == v) {
1586 realTimeDataVO.setPgVal("告警");
1587 } else if (3 == v) {
1588 realTimeDataVO.setPgVal("溢流");
1589 }
1590 }
1591 res.add(realTimeDataVO);
1592 }
1593 }
1594
1595 //排序
1596 res = res.stream().map(data -> {
1597 if (org.apache.commons.lang3.StringUtils.isEmpty(data.getSortNum())) {
1598 data.setSortNum("0");
1599 }
1600 return data;
1601 }).sorted(Comparator.comparing(RealTimeDataVO::getMetricRealName)).
1602 sorted(Comparator.comparingInt(o -> ConvertUtils.getInt(o.getSortNum())))
1603 .collect(Collectors.toList()
1604 );
1605 return res;
1606 }
1607
1608 /**
1609 * <pre>
1610 * <请输入描述信息> 按厂站分组统计指标数据
1611 * </pre>
1612 *
1613 * @param departType
1614 * @param res
1615 * @param departId
1616 * @author Gao Ran,
1617 * @Description: TODO(这里描述这个方法的需求变更情况)
1618 */
1619 private List<Map<String, Object>> staticsForDepart(String departType, List<RealTimeDataVO> res, String departId) {
1620 List<Map<String, Object>> resList = Lists.newArrayList();
1621 QueryWrapper<Object> queryWrapper = new QueryWrapper<>();
1622
1623 if (org.apache.commons.lang3.StringUtils.isNotBlank(departType)) {
1624 queryWrapper.in(org.apache.commons.lang3.StringUtils.isNotBlank(departType), "depart_type", Arrays.asList(departType.split(",")));
1625 }
1626 if (org.apache.commons.lang3.StringUtils.isNotBlank(departId)) {
1627 queryWrapper.in(org.apache.commons.lang3.StringUtils.isNotBlank(departId), "sd.id", Arrays.asList(departId.split(",")));
1628 }
1629 queryWrapper.orderByAsc("sd.depart_order");
1630 //分类统计厂站类型
1631 List<Map<String, Object>> factoryDesign = screenDataService.factoryDesign(queryWrapper);
1632 Map<String, List<RealTimeDataVO>> dataListGroup = res.stream().collect(Collectors.groupingBy(realTimeDataVO -> realTimeDataVO.getDepartId()));
1633 //計算累计流量的差值
1634 for (Map<String, Object> depart : factoryDesign) {
1635 Map<String, Object> resMap = new HashMap<>();
1636 String sysDepartId = ConvertUtils.getString(depart.get("depart_id"));
1637 String factoryType = ConvertUtils.getString(depart.get("depart_type"));
1638 String departName = ConvertUtils.getString(depart.get("depart_name"));
1639 String parent_depart_name = ConvertUtils.getString(depart.get("parent_depart_name"));
1640 String proLongitude = ConvertUtils.getString(depart.get("pro_longitude"));
1641 String proLatitude = ConvertUtils.getString(depart.get("pro_latitude"));
1642 //获取厂站所有的实时数据list
1643 List<RealTimeDataVO> timeDataVOS = dataListGroup.getOrDefault(sysDepartId, new ArrayList<>());
1644 String time = DateUtils.getDate("yyyy-MM-dd HH:mm:ss");
1645 if (CollectionUtil.isNotEmpty(timeDataVOS)) {
1646 time = timeDataVOS.get(0).getTime();
1647 }
1648 //如果alarmCollect的size大于0则有报警
1649 List<RealTimeDataVO> alarmCollect = timeDataVOS.stream().filter(data -> "2".equals(data.getAlarmStatus())).collect(Collectors.toList());
1650 List<RealTimeDataVO> warnCollect = timeDataVOS.stream().filter(data -> "1".equals(data.getAlarmStatus())).collect(Collectors.toList());
1651
1652 String alarmStatus = "0";
1653 if (!CollectionUtil.isEmpty(alarmCollect)) {
1654 alarmStatus = "2";
1655 } else if (!CollectionUtil.isEmpty(warnCollect)) {
1656 alarmStatus = "1";
1657 }
1658 Double riverAlarm = timeDataVOS.stream().mapToDouble(data -> ConvertUtils.getDouble(data.getRiverAlarm(), 0)).summaryStatistics().getMax();
1659 //排序
1660 timeDataVOS = timeDataVOS.stream().map(data -> {
1661 if (org.apache.commons.lang3.StringUtils.isEmpty(data.getSortNum())) {
1662 data.setSortNum("0");
1663 }
1664 return data;
1665 }).sorted(Comparator.comparing(RealTimeDataVO::getMetricRealName)).
1666 sorted(Comparator.comparingInt(o -> ConvertUtils.getInt(o.getSortNum())))
1667 .collect(Collectors.toList()
1668 );
1669 resMap.put("departId", sysDepartId);
1670 resMap.put("departName", departName);
1671 resMap.put("parentDepartName", parent_depart_name);
1672 resMap.put("departType", factoryType);
1673 resMap.put("marsLatitude", proLatitude);
1674 resMap.put("marsLongitude", proLongitude);
1675 resMap.put("dataVOS", timeDataVOS);
1676 resMap.put("time", time);
1677 resMap.put("riverAlarm", riverAlarm);
1678 resMap.put("alarmStatus", alarmStatus);
1679 resList.add(resMap);
1680 }
1681 return resList;
1682 }
1248 } 1683 }
......
...@@ -29,4 +29,16 @@ public interface ScreenMapper { ...@@ -29,4 +29,16 @@ public interface ScreenMapper {
29 @Param("dataViewName3a24") String dataViewName3a24, @Param("dataViewName2119") String dataViewName2119, 29 @Param("dataViewName3a24") String dataViewName3a24, @Param("dataViewName2119") String dataViewName2119,
30 @Param("startMonth") String startMonth, @Param("endMonth") String endMonth, 30 @Param("startMonth") String startMonth, @Param("endMonth") String endMonth,
31 @Param("dataViewName4411") String dataViewName4411); 31 @Param("dataViewName4411") String dataViewName4411);
32
33 @Select(" select sd.depart_name,( SELECT depart_name from sys_depart WHERE id = sd.parent_id )parent_depart_name,sd.depart_type,smd.metricd_name, smmi.id,smmi.metric_name,smmi.metric_type,smmi.metric_uid_tag ,g.group_name groupName,g.group_type groupType , COALESCE(smmi.metric_unit,smd.metric_unit) metric_unit,smmi.depart_id ,COALESCE(g.sort_num,smmi.sort_num) sort_num from sys_monitor_metric_info smmi left join sys_metric_dict smd on smd.id =smmi.metric_uid_tag " +
34 "inner join sys_depart sd on smmi.depart_id =sd.id left join sys_metric_dict_group g on g.dict_id =smmi.metric_uid_tag " +
35 " ${ew.customSqlSegment}")
36 List<Map<String, Object>> getDictGroupData(@Param(Constants.WRAPPER) QueryWrapper dictGroupQueryWrapper);
37
38 /**
39 * 水厂档案相关查询
40 * @param queryWrapper
41 */
42 @Select("select sd.id depart_id,sd.parent_id,sd.depart_name,( SELECT depart_name from sys_depart WHERE id = sd.parent_id )parent_depart_name,sd.depart_type,sf.* from sys_depart sd left join sys_factory_info sf on sd.id =sf.depart_id ${ew.customSqlSegment}")
43 List<Map<String, Object>> factoryDesign(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);
32 } 44 }
......
...@@ -3,6 +3,7 @@ package com.skua.modules.threedimensional.service; ...@@ -3,6 +3,7 @@ package com.skua.modules.threedimensional.service;
3 import java.util.List; 3 import java.util.List;
4 import java.util.Map; 4 import java.util.Map;
5 5
6 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
6 import com.skua.modules.threedimensional.vo.StatisticsParams; 7 import com.skua.modules.threedimensional.vo.StatisticsParams;
7 import org.apache.ibatis.annotations.Param; 8 import org.apache.ibatis.annotations.Param;
8 import org.springframework.jdbc.core.JdbcTemplate; 9 import org.springframework.jdbc.core.JdbcTemplate;
...@@ -24,4 +25,13 @@ public interface IScreenDataService{ ...@@ -24,4 +25,13 @@ public interface IScreenDataService{
24 List<Map<String, Object>> getYhdlqs(StatisticsParams statisticsParams); 25 List<Map<String, Object>> getYhdlqs(StatisticsParams statisticsParams);
25 26
26 List<Map<String, Object>> getYhylqs(StatisticsParams statisticsParams); 27 List<Map<String, Object>> getYhylqs(StatisticsParams statisticsParams);
28
29 List<Map<String, Object>> getDictGroupData(QueryWrapper dictGroupQueryWrapper);
30
31 /**
32 * 水厂档案相关查询
33 * @param queryWrapper
34 * @return
35 */
36 List<Map<String, Object>> factoryDesign(QueryWrapper<Object> queryWrapper);
27 } 37 }
......
1 package com.skua.modules.threedimensional.service.impl; 1 package com.skua.modules.threedimensional.service.impl;
2 2
3 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3 import com.skua.common.constant.ReportConstant; 4 import com.skua.common.constant.ReportConstant;
4 import com.skua.common.report.ReportViewUtil; 5 import com.skua.common.report.ReportViewUtil;
5 import com.skua.core.service.IFactoryInfoService; 6 import com.skua.core.service.IFactoryInfoService;
...@@ -338,6 +339,22 @@ public class ScreenDataServiceImpl implements IScreenDataService { ...@@ -338,6 +339,22 @@ public class ScreenDataServiceImpl implements IScreenDataService {
338 return months; 339 return months;
339 } 340 }
340 341
342
343
344 public List<Map<String, Object>> getDictGroupData(QueryWrapper dictGroupQueryWrapper){
345 return screenMapper.getDictGroupData(dictGroupQueryWrapper);
346 }
347
348 /***
349 * 水厂档案相关查询
350 * @param queryWrapper
351 * @return
352 */
353 @Override
354 public List<Map<String, Object>> factoryDesign(QueryWrapper<Object> queryWrapper) {
355 return screenMapper.factoryDesign(queryWrapper);
356 }
357
341 public static void main(String[] args) { 358 public static void main(String[] args) {
342 String startTime = "2024-01-01";// 359 String startTime = "2024-01-01";//
343 String endTime = "2024-12-31"; 360 String endTime = "2024-12-31";
......
...@@ -15,4 +15,7 @@ public class DataParams { ...@@ -15,4 +15,7 @@ public class DataParams {
15 15
16 private String startDate; 16 private String startDate;
17 17
18 private String departType;
19
20 private String tag;
18 } 21 }
......
1 package com.skua.modules.threedimensional.vo; 1 package com.skua.modules.threedimensional.vo;
2 2
3 import com.skua.core.util.ConvertUtils;
3 import com.skua.modules.threedimensional.entity.RealTimeData; 4 import com.skua.modules.threedimensional.entity.RealTimeData;
4 import lombok.Data; 5 import lombok.Data;
5 6
...@@ -16,4 +17,18 @@ public class RealTimeDataVO extends RealTimeData { ...@@ -16,4 +17,18 @@ public class RealTimeDataVO extends RealTimeData {
16 17
17 private String departName; 18 private String departName;
18 19
20 private String metricRealName;
21
22
23 private String waterType;
24 private String groupType;
25 private String groupName;
26 private String alarmValue;
27 private String alarmStatus;
28 private String parentDepartName;
29 private String alarmLimit;
30 private String warnLimit;
31 private String riverAlarm;
32
33
19 } 34 }
......
...@@ -15,26 +15,28 @@ public class PowerCutDownVO { ...@@ -15,26 +15,28 @@ public class PowerCutDownVO {
15 @ApiModelProperty(value = "部门编号") 15 @ApiModelProperty(value = "部门编号")
16 public String departId ; 16 public String departId ;
17 17
18 @ApiModelProperty(value = "部门名称")
19 public String departName;
18 20
19 @ApiModelProperty(value = "名称") 21 @ApiModelProperty(value = "处理水量")
20 public String clsl ; 22 public String clsl ;
21 23
22 @ApiModelProperty(value = "名称") 24 @ApiModelProperty(value = "COD")
23 public String codValue; 25 public String codValue;
24 26
25 @ApiModelProperty(value = "名称") 27 @ApiModelProperty(value = "耗电量")
26 public String hdl; 28 public String hdl;
27 29
28 @ApiModelProperty(value = "名称") 30 @ApiModelProperty(value = "氨氮")
29 public String nh3nValue; 31 public String nh3nValue;
30 32
31 @ApiModelProperty(value = "名称") 33 @ApiModelProperty(value = "数量")
32 public String num; 34 public String num;
33 35
34 @ApiModelProperty(value = "名称") 36 @ApiModelProperty(value = "总氮")
35 public String tnValue; 37 public String tnValue;
36 38
37 @ApiModelProperty(value = "名称") 39 @ApiModelProperty(value = "总磷")
38 public String tpValue; 40 public String tpValue;
39 41
40 } 42 }
......
...@@ -106,7 +106,7 @@ public class OperationReportServiceImpl implements IOperationReportService { ...@@ -106,7 +106,7 @@ public class OperationReportServiceImpl implements IOperationReportService {
106 /***************** 实际水量同比下降水务公司原因分析一览表************************/ 106 /***************** 实际水量同比下降水务公司原因分析一览表************************/
107 dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysjsl,tqysjsl,ysjsldyqntqyy", departId, seasonTimeVO.getStartTime(), seasonTimeVO.getEndTime()); 107 dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysjsl,tqysjsl,ysjsldyqntqyy", departId, seasonTimeVO.getStartTime(), seasonTimeVO.getEndTime());
108 sql = " select aaa.depart_id , d.depart_name departName, round(100*(sum(ifnull(aaa.ysjsl,0)) - sum(ifnull(aaa.tqysjsl,0)) )/ sum(ifnull(aaa.tqysjsl,0)),2) 'ratio', "; 108 sql = " select aaa.depart_id , d.depart_name departName, round(100*(sum(ifnull(aaa.ysjsl,0)) - sum(ifnull(aaa.tqysjsl,0)) )/ sum(ifnull(aaa.tqysjsl,0)),2) 'ratio', ";
109 sql += " round( sum(ifnull(aaa.ysjsl,0)),2 ) 'ysjsl' ,round( sum(ifnull(aaa.tqysjsl,0)),2 ) 'tqysjsl' ,GROUP_CONCAT(aaa.ysjsldyqntqyy) 'causeAnalysis' from "+ dataViewName4411+" aaa"; 109 sql += " round( sum(ifnull(aaa.ysjsl,0)),2 ) 'ysjsl' ,round( sum(ifnull(aaa.tqysjsl,0)),2 ) 'tqysjsl' ,GROUP_CONCAT(aaa.ysjsldyqntqyy SEPARATOR '') 'causeAnalysis' from "+ dataViewName4411+" aaa";
110 sql += " left join sys_depart d on d.id = aaa.depart_id"; 110 sql += " left join sys_depart d on d.id = aaa.depart_id";
111 sql += " group by aaa.depart_id HAVING sum(ifnull(aaa.ysjsl,0)) < sum(ifnull(aaa.tqysjsl,0)) "; 111 sql += " group by aaa.depart_id HAVING sum(ifnull(aaa.ysjsl,0)) < sum(ifnull(aaa.tqysjsl,0)) ";
112 List<FReportWaterMonthDataVO> waterMonthDataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<FReportWaterMonthDataVO>(FReportWaterMonthDataVO.class)); 112 List<FReportWaterMonthDataVO> waterMonthDataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<FReportWaterMonthDataVO>(FReportWaterMonthDataVO.class));
...@@ -115,7 +115,7 @@ public class OperationReportServiceImpl implements IOperationReportService { ...@@ -115,7 +115,7 @@ public class OperationReportServiceImpl implements IOperationReportService {
115 //水电耗高于控制目标--水务公司列表 115 //水电耗高于控制目标--水务公司列表
116 dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ydh,dhcmbzyy", departId, seasonTimeVO.getStartTime(), seasonTimeVO.getEndTime()); 116 dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ydh,dhcmbzyy", departId, seasonTimeVO.getStartTime(), seasonTimeVO.getEndTime());
117 sql = "select * from ( "; 117 sql = "select * from ( ";
118 sql += " select d.depart_name 'departName', aaa.depart_id , round(avg(aaa.ydh),2) realConsume , IFNULL(tc.target_power,2) 'targetConsume' ,GROUP_CONCAT(aaa.dhcmbzyy) 'causeAnalysis' from "+ dataViewName4411+" aaa";; 118 sql += " select d.depart_name 'departName', aaa.depart_id , round(avg(aaa.ydh),2) realConsume , IFNULL(tc.target_power,2) 'targetConsume' ,GROUP_CONCAT(aaa.dhcmbzyy SEPARATOR '') 'causeAnalysis' from "+ dataViewName4411+" aaa";;
119 sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year='2024')"; 119 sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year='2024')";
120 sql += " left join sys_depart d on d.id = aaa.depart_id "; 120 sql += " left join sys_depart d on d.id = aaa.depart_id ";
121 sql += " group by aaa.depart_id )bbb where bbb.realConsume > bbb.targetConsume "; 121 sql += " group by aaa.depart_id )bbb where bbb.realConsume > bbb.targetConsume ";
...@@ -126,7 +126,7 @@ public class OperationReportServiceImpl implements IOperationReportService { ...@@ -126,7 +126,7 @@ public class OperationReportServiceImpl implements IOperationReportService {
126 //药剂成本高于控制目标--水务公司列表 126 //药剂成本高于控制目标--水务公司列表
127 dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"yyh,yhcyqyy", departId, seasonTimeVO.getStartTime(), seasonTimeVO.getEndTime()); 127 dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"yyh,yhcyqyy", departId, seasonTimeVO.getStartTime(), seasonTimeVO.getEndTime());
128 sql = "select * from ( "; 128 sql = "select * from ( ";
129 sql += " select d.depart_name 'departName', aaa.depart_id , round(avg(aaa.yyh),2) realConsume , IFNULL(tc.target_drug,2) 'targetConsume' ,GROUP_CONCAT(aaa.yhcyqyy) 'causeAnalysis' from "+ dataViewName4411+" aaa";; 129 sql += " select d.depart_name 'departName', aaa.depart_id , round(avg(aaa.yyh),2) realConsume , IFNULL(tc.target_drug,2) 'targetConsume' ,GROUP_CONCAT(aaa.yhcyqyy SEPARATOR '') 'causeAnalysis' from "+ dataViewName4411+" aaa";;
130 sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year='2024')"; 130 sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year='2024')";
131 sql += " left join sys_depart d on d.id = aaa.depart_id "; 131 sql += " left join sys_depart d on d.id = aaa.depart_id ";
132 sql += " group by aaa.depart_id )bbb where bbb.realConsume > bbb.targetConsume "; 132 sql += " group by aaa.depart_id )bbb where bbb.realConsume > bbb.targetConsume ";
......
...@@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletResponse;
9 9
10 import cn.hutool.json.JSONObject; 10 import cn.hutool.json.JSONObject;
11 import com.skua.core.context.BaseContextHandler; 11 import com.skua.core.context.BaseContextHandler;
12 import com.skua.core.query.QueryGenerator;
12 import org.apache.commons.lang.StringUtils; 13 import org.apache.commons.lang.StringUtils;
13 import org.apache.poi.hssf.usermodel.HSSFWorkbook; 14 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
14 import org.apache.poi.ss.usermodel.Sheet; 15 import org.apache.poi.ss.usermodel.Sheet;
...@@ -110,6 +111,28 @@ public class EquipmentController { ...@@ -110,6 +111,28 @@ public class EquipmentController {
110 @Autowired 111 @Autowired
111 private Key2ValueService key2ValueService; 112 private Key2ValueService key2ValueService;
112 113
114 @AutoLog(value = "设备台账-所有设备")
115 @ApiOperation(value = "设备台账-所有设备", notes = "设备台账-所有设备")
116 @GetMapping(value = "/allList")
117 public Result<List<EquipmentInfo>> allList(EquipmentInfo equipmentInfo, @RequestParam(name="model", defaultValue="0") Integer model,HttpServletRequest req ) throws Exception {
118
119 Result<List<EquipmentInfo>> result = new Result<List<EquipmentInfo>>();
120 QueryWrapper<EquipmentInfo> queryWrapper = QueryGenerator.initQueryWrapper(equipmentInfo, req.getParameterMap());
121 // queryWrapper.eq("depart_id", BaseContextHandler.getRealDepartId());
122 if(equipmentInfo.getDepartId()==null){
123 equipmentInfo.setDepartId(BaseContextHandler.getDeparts());
124 }
125 /* if(model==1){
126 queryWrapper.isNotNull("is_model");
127 queryWrapper.last(" and is_model != ''");
128 }*/
129 queryWrapper.orderByDesc("create_time");
130 List<EquipmentInfo> dataList = equipmentInfoService.list(queryWrapper);
131 result.setSuccess(true);
132 result.setResult(dataList);
133 return result;
134 }
135
113 @CustomExceptionAnno(description = "设备台账-设备排序") 136 @CustomExceptionAnno(description = "设备台账-设备排序")
114 @AutoLog(value = "设备台账-设备排序") 137 @AutoLog(value = "设备台账-设备排序")
115 @ApiOperation(value = "设备台账-设备排序", notes = "设备台账-设备排序") 138 @ApiOperation(value = "设备台账-设备排序", notes = "设备台账-设备排序")
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!