Commit 0137ca0b authored by KeYong's avatar KeYong

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

parents 087faae0 48885585
package com.yeejoin.equipmanage.common.enums;
/**
* 一天内不同时段个数
*/
public enum DayHourEnum {
hour("小时", 24),
hafHour("半小时个数", 48),
twoHour("两小时个数", 12),
fourHour("四小时个数", 6);
private String name;
private int number;
DayHourEnum(String name, int number ){
this.name = name;
this.number = number;
}
public String getName() {
return name;
}
public int getNumber() {
return number;
}
}
...@@ -114,8 +114,8 @@ public class BigScreenController extends AbstractBaseController { ...@@ -114,8 +114,8 @@ public class BigScreenController extends AbstractBaseController {
ResponseModel entity1 = null; ResponseModel entity1 = null;
ResponseModel entity2 = null; ResponseModel entity2 = null;
try { try {
entity1 = iotFeign.selectListNew(getAppKey(), getProduct(), getToken(),prefix,suffix, startDateStr, nowStrLong, "true", pressurePumpStart); entity1 = iotFeign.selectListNew(prefix,suffix, startDateStr, nowStrLong, "true", pressurePumpStart);
entity2 = iotFeign.selectListNew(getAppKey(), getProduct(), getToken(),prefix,suffix, startDateStr, nowStrLong, "false", pressurePumpStart); entity2 = iotFeign.selectListNew(prefix,suffix, startDateStr, nowStrLong, "false", pressurePumpStart);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -332,8 +332,8 @@ public class ConfigureController extends AbstractBaseController { ...@@ -332,8 +332,8 @@ public class ConfigureController extends AbstractBaseController {
ResponseModel entity1 = null; ResponseModel entity1 = null;
ResponseModel entity2 = null; ResponseModel entity2 = null;
try { try {
entity1 = iotFeign.selectListNew(getAppKey(), getProduct(), getToken(),prefix,suffix, startDateStr, nowStrLong, "true", pressurePumpStart); entity1 = iotFeign.selectListNew(prefix,suffix, startDateStr, nowStrLong, "true", pressurePumpStart);
entity2 = iotFeign.selectListNew(getAppKey(), getProduct(), getToken(),prefix,suffix, startDateStr, nowStrLong, "false", pressurePumpStart); entity2 = iotFeign.selectListNew(prefix,suffix, startDateStr, nowStrLong, "false", pressurePumpStart);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -393,8 +393,8 @@ public class ConfigureController extends AbstractBaseController { ...@@ -393,8 +393,8 @@ public class ConfigureController extends AbstractBaseController {
ResponseModel entity1 = null; ResponseModel entity1 = null;
ResponseModel entity2 = null; ResponseModel entity2 = null;
try { try {
entity1 = iotFeign.selectListNew(getAppKey(), getProduct(), getToken(),prefix,suffix, startDateStr, nowStrLong, "true", pressurePumpStart); entity1 = iotFeign.selectListNew(prefix,suffix, startDateStr, nowStrLong, "true", pressurePumpStart);
entity2 = iotFeign.selectListNew(getAppKey(), getProduct(), getToken(),prefix,suffix, startDateStr, nowStrLong, "false", pressurePumpStart); entity2 = iotFeign.selectListNew(prefix,suffix, startDateStr, nowStrLong, "false", pressurePumpStart);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -386,48 +386,55 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -386,48 +386,55 @@ public class SupervisionConfigureController extends AbstractBaseController {
Long stop_time = 0L; Long stop_time = 0L;
Date startDate = null; Date startDate = null;
Date stopDate = null; Date stopDate = null;
if (ObjectUtils.isEmpty(item.get("start")) && ObjectUtils.isEmpty(item.get("stop"))) { if (!ObjectUtils.isEmpty(item.get("start"))) {
item.put("equipment_index_name", "无信号"); startTime = item.get("start").toString().substring(0, 19).replace("T", " ");
item.put("update_time", false); startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTime), +8);
startTimeList.add(startDate.getTime());
start_time = startDate.getTime();
item.put("startTime", startDate);
} else { } else {
if (!ObjectUtils.isEmpty(item.get("start"))) { item.put("startTime", 0);
startTime = item.get("start").toString().substring(0, 19).replace("T", " "); }
startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTime), +8); if (!ObjectUtils.isEmpty(item.get("stop"))) {
startTimeList.add(startDate.getTime()); stopTime = item.get("stop").toString().substring(0, 19).replace("T", " ");
start_time = startDate.getTime(); stopDate = DateUtils.dateAddHours(DateUtils.longStr2Date(stopTime), +8);
item.put("startTime", startDate); stopTimeList.add(stopDate.getTime());
} else { stop_time = stopDate.getTime();
item.put("startTime", 0); item.put("stopTime", stopDate);
} } else {
if (!ObjectUtils.isEmpty(item.get("stop"))) { item.put("stopTime", 0);
stopTime = item.get("stop").toString().substring(0, 19).replace("T", " "); }
stopDate = DateUtils.dateAddHours(DateUtils.longStr2Date(stopTime), +8); Map<String, Object> stateMap = fireFightingSystemMapper.queryPressureNowSignalBySpecificId((Long) item.get("id"));
stopTimeList.add(stopDate.getTime()); Long update_date = 0L;
stop_time = stopDate.getTime(); if (!ObjectUtils.isEmpty(stateMap)) {
item.put("stopTime", stopDate); try {
} else { String time1 = stateMap.get("update_date").toString().replace("T", " ");
item.put("stopTime", 0); update_date = sdf.parse(time1).getTime();
} catch (ParseException e) {
throw new RuntimeException(e);
} }
if (start_time - stop_time > 0) { }
long res = nowDateTime - start_time; if (start_time - stop_time > 0) {
long diffMinute = res / 1000 / 60; long res = nowDateTime - start_time;
if (diffMinute > 5) { long diffMinute = res / 1000 / 60;
time = false; if (diffMinute > 5) {
} time = false;
item.put("upTime", diffMinute);
item.put("equipment_index_name", "启动");
item.put("update_time", startDate);
} else {
item.put("upTime", 0);
item.put("equipment_index_name", "停止");
item.put("update_time", stopDate);
} }
item.put("upTime", diffMinute);
item.put("equipment_index_name", update_date - start_time > 0 ? stateMap.get("equipment_index_name") : "启动");
item.put("update_time", update_date - start_time > 0 ? stateMap.get("update_date") : startDate);
} else if (start_time - stop_time < 0) {
item.put("equipment_index_name", update_date - stop_time > 0 ? stateMap.get("equipment_index_name") : "停止");
item.put("update_time", update_date - stop_time > 0 ? stateMap.get("update_date") : stopDate);
} else {
item.put("equipment_index_name", ObjectUtils.isEmpty(stateMap) ? "无信号" : stateMap.get("equipment_index_name"));
item.put("update_time", ObjectUtils.isEmpty(stateMap) ? false : stateMap.get("update_date"));
} }
item.put("stateDesc", Integer.parseInt(String.valueOf(item.get("isAlarm"))) == 0 && time ? "正常" : "异常"); item.put("stateDesc", Integer.parseInt(String.valueOf(item.get("isAlarm"))) == 0 && time ? "正常" : "异常");
if("正常".equals(item.get("stateDesc").toString())){ if ("正常".equals(item.get("stateDesc").toString())) {
item.put("sort",0); item.put("sort", 0);
} else { } else {
item.put("sort",1); item.put("sort", 1);
} }
} }
// List<Long> startCollect = startTimeList.stream().sorted(Comparator.reverseOrder()).limit(1).collect(Collectors.toList()); // List<Long> startCollect = startTimeList.stream().sorted(Comparator.reverseOrder()).limit(1).collect(Collectors.toList());
......
...@@ -64,9 +64,6 @@ public interface IotFeign { ...@@ -64,9 +64,6 @@ public interface IotFeign {
@RequestMapping(value = "v1/livedata/common/list", method = RequestMethod.GET, consumes = "application/json") @RequestMapping(value = "v1/livedata/common/list", method = RequestMethod.GET, consumes = "application/json")
ResponseModel selectListNew( ResponseModel selectListNew(
@RequestHeader("appKey") String appKey,
@RequestHeader("product") String product,
@RequestHeader("token") String token,
@RequestParam(value = "measurement") String measurement, @RequestParam(value = "measurement") String measurement,
@RequestParam( required = false, value = "deviceName") String deviceName, @RequestParam( required = false, value = "deviceName") String deviceName,
@RequestParam(value = "timeStart") String beginDate, @RequestParam(value = "timeStart") String beginDate,
......
...@@ -427,6 +427,13 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -427,6 +427,13 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Map<String, String> queryPressureNowStateBySpecificId(@Param("id") Long id); Map<String, String> queryPressureNowStateBySpecificId(@Param("id") Long id);
/** /**
* 根据装备ID查最新一条有信号的指标信息
* @param id
* @return
*/
Map<String, Object> queryPressureNowSignalBySpecificId(@Param("id") Long id);
/**
* 稳压泵信息-3小消防给水信息 * 稳压泵信息-3小消防给水信息
* @param bizOrgCode * @param bizOrgCode
* @param systemCode * @param systemCode
......
...@@ -237,7 +237,7 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -237,7 +237,7 @@ public class EmergencyServiceImpl implements IEmergencyService {
prefix = iotCode.toString().substring(0, 8); prefix = iotCode.toString().substring(0, 8);
suffix = iotCode.toString().substring(8); suffix = iotCode.toString().substring(8);
try { try {
ResponseModel responseModel = iotFeign.selectListNew(appKey, product, token, prefix, suffix, startTime, endTime, null, pressurePumpStart); ResponseModel responseModel = iotFeign.selectListNew( prefix, suffix, startTime, endTime, null, pressurePumpStart);
if (200 == responseModel.getStatus()) { if (200 == responseModel.getStatus()) {
String json = JSON.toJSONString(responseModel.getResult()); String json = JSON.toJSONString(responseModel.getResult());
List<Map<String, String>> dataList = (List<Map<String, String>>) JSONArray.parse(json); List<Map<String, String>> dataList = (List<Map<String, String>>) JSONArray.parse(json);
...@@ -402,7 +402,7 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -402,7 +402,7 @@ public class EmergencyServiceImpl implements IEmergencyService {
durationTime = intervalTime2; durationTime = intervalTime2;
intervalTime1 = falseDataList.get(0).get("createdTime"); intervalTime1 = falseDataList.get(0).get("createdTime");
String stop5BeforeTime = DateUtils.convertDateToString(DateUtils.dateAddMinutes(DateUtils.convertStrToDate(intervalTime1, "yyyy-MM-dd HH:mm:ss"), -5), "yyyy-MM-dd HH:mm:ss"); String stop5BeforeTime = DateUtils.convertDateToString(DateUtils.dateAddMinutes(DateUtils.convertStrToDate(intervalTime1, "yyyy-MM-dd HH:mm:ss"), -5), "yyyy-MM-dd HH:mm:ss");
ResponseModel pipeResponseModel = iotFeign.selectListNew(appKey, product, token, prefix, null, stop5BeforeTime, intervalTime2, null, "FHS_PipePressureDetector_PipePressure"); ResponseModel pipeResponseModel = iotFeign.selectListNew( prefix, null, stop5BeforeTime, intervalTime2, null, "FHS_PipePressureDetector_PipePressure");
if (200 == pipeResponseModel.getStatus()) { if (200 == pipeResponseModel.getStatus()) {
String pipeJson = JSON.toJSONString(pipeResponseModel.getResult()); String pipeJson = JSON.toJSONString(pipeResponseModel.getResult());
List<Map<String, String>> pipeDataList = (List<Map<String, String>>) JSONArray.parse(pipeJson); List<Map<String, String>> pipeDataList = (List<Map<String, String>>) JSONArray.parse(pipeJson);
......
...@@ -35,6 +35,7 @@ import org.springframework.data.domain.PageImpl; ...@@ -35,6 +35,7 @@ import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -788,8 +789,18 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec ...@@ -788,8 +789,18 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
if(equipmentSpecificMapper.getEquipmentSpecificIotCodeWYB().get(0) != null) { if(equipmentSpecificMapper.getEquipmentSpecificIotCodeWYB().get(0) != null) {
vo = equipmentSpecificMapper.getEquipmentSpecificIotCodeWYB().get(0); vo = equipmentSpecificMapper.getEquipmentSpecificIotCodeWYB().get(0);
} }
int startNum = Integer.parseInt(stringObjectMap.get("startNum").toString()); // 启停总数
ResponseModel start = iotFeign.selectListNew(remoteSecurityService.getServerToken().getAppKey(), remoteSecurityService.getServerToken().getProduct(), remoteSecurityService.getServerToken().getToke(), vo.getIotCode().substring(0,8),null, startTime, endTime,"true", pressurePumpStart); int allNum = 0;
// 启动次数
int startNum = 0;
ResponseModel all = iotFeign.selectListNew(vo.getIotCode().substring(0,8),null, startTime, endTime,null, pressurePumpStart);
if (200 == all.getStatus() && !ObjectUtils.isEmpty(all.getResult())) {
String json1 = JSON.toJSONString(all.getResult());
List<Map<String, String>> listObject1 = (List<Map<String, String>>) JSONArray.parse(json1);
allNum = listObject1.size();
}
ResponseModel start = iotFeign.selectListNew(vo.getIotCode().substring(0,8),null, startTime, endTime,"true", pressurePumpStart);
if (200 == start.getStatus() && !ObjectUtils.isEmpty(start.getResult())) { if (200 == start.getStatus() && !ObjectUtils.isEmpty(start.getResult())) {
String json1 = JSON.toJSONString(start.getResult()); String json1 = JSON.toJSONString(start.getResult());
List<Map<String, String>> listObject1 = (List<Map<String, String>>) JSONArray.parse(json1); List<Map<String, String>> listObject1 = (List<Map<String, String>>) JSONArray.parse(json1);
...@@ -797,7 +808,6 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec ...@@ -797,7 +808,6 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
} }
Map<String, Object> retMap = new HashMap<>(); Map<String, Object> retMap = new HashMap<>();
int allNum = Integer.parseInt(stringObjectMap.get("allNum").toString());
// 计算平均每小时打压频率 // 计算平均每小时打压频率
try { try {
...@@ -808,7 +818,13 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec ...@@ -808,7 +818,13 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
int twoHour = DateUtils.dateBetweenNew2(DateUtils.dateParse(startTime, null),DateUtils.dateParse(endTime, null)); int twoHour = DateUtils.dateBetweenNew2(DateUtils.dateParse(startTime, null),DateUtils.dateParse(endTime, null));
int fourHour = DateUtils.dateBetweenNew3(DateUtils.dateParse(startTime, null),DateUtils.dateParse(endTime, null)); int fourHour = DateUtils.dateBetweenNew3(DateUtils.dateParse(startTime, null),DateUtils.dateParse(endTime, null));
// 开始时间与结束时间为同一天时 给默认值
if (hour == 0){
hour = DayHourEnum.hour.getNumber();
hafHour = DayHourEnum.hafHour.getNumber();
twoHour = DayHourEnum.twoHour.getNumber();
fourHour = DayHourEnum.fourHour.getNumber();
}
if(allNum/hour > 15) { if(allNum/hour > 15) {
retMap.put("status","异常"); retMap.put("status","异常");
} else { } else {
......
...@@ -2831,6 +2831,21 @@ ...@@ -2831,6 +2831,21 @@
LIMIT 1 LIMIT 1
</select> </select>
<select id="queryPressureNowSignalBySpecificId" resultType="java.util.Map">
SELECT
DATE_FORMAT(i.update_date, '%Y-%m-%d %H:%i:%S') update_date,
i.equipment_index_name,
value
FROM
wl_equipment_specific_index i
WHERE
i.equipment_specific_id = #{id,jdbcType=VARCHAR}
AND value <![CDATA[<>]]> '' AND value IS NOT NULL
ORDER BY
i.update_date DESC
LIMIT 1
</select>
<select id="getPressurePumpInfo3Small" resultType="java.util.Map"> <select id="getPressurePumpInfo3Small" resultType="java.util.Map">
SELECT SELECT
ed.`name`, ed.`name`,
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<rule.version>1.7.9-SNAPSHOT</rule.version> <rule.version>1.7.9-SNAPSHOT</rule.version>
<itext.version>7.1.1</itext.version> <itext.version>7.1.1</itext.version>
<elasticsearch.version>7.15.2</elasticsearch.version> <elasticsearch.version>7.15.2</elasticsearch.version>
<sonar.qualitygate.wait>true</sonar.qualitygate.wait>
</properties> </properties>
<dependencies> <dependencies>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment