Commit 20833a51 authored by lisong's avatar lisong

修改双月报、稳压泵平均打压频次bug

parent 8645f62d
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();
} }
......
...@@ -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,
......
...@@ -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 {
......
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