Commit e0d7d8e6 authored by xixinzhao's avatar xixinzhao

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

parents 35fa7aee bbd308de
...@@ -125,4 +125,7 @@ public class EquipmentIndex extends BaseEntity { ...@@ -125,4 +125,7 @@ public class EquipmentIndex extends BaseEntity {
@TableField(value = "unit") @TableField(value = "unit")
private String unit; private String unit;
@TableField(value = "alarm_rule")
private String alarmRule;
} }
...@@ -145,9 +145,6 @@ public class EquipmentSpecificIndex extends BaseEntity { ...@@ -145,9 +145,6 @@ public class EquipmentSpecificIndex extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private String buildId; private String buildId;
@ApiModelProperty(value = "是否遥测")
@TableField(exist = false)
private Integer isTrend;
@ApiModelProperty(value = "绑定视屏数量") @ApiModelProperty(value = "绑定视屏数量")
@TableField(exist = false) @TableField(exist = false)
private int num; private int num;
...@@ -208,4 +205,12 @@ public class EquipmentSpecificIndex extends BaseEntity { ...@@ -208,4 +205,12 @@ public class EquipmentSpecificIndex extends BaseEntity {
@ApiModelProperty(value = "网关标识") @ApiModelProperty(value = "网关标识")
@TableField(value = "gateway_id") @TableField(value = "gateway_id")
private String gatewayId; private String gatewayId;
@ApiModelProperty(value = "告警规则")
@TableField(value = "alarm_rule")
private String alarmRule;
@ApiModelProperty(value = "是否遥测")
@TableField(value = "is_trend")
private Boolean isTrend;
} }
...@@ -90,4 +90,7 @@ public class EquipmentIndexVO { ...@@ -90,4 +90,7 @@ public class EquipmentIndexVO {
@ApiModelProperty(value = "装备指标名称") @ApiModelProperty(value = "装备指标名称")
private String equipmentIndexName; private String equipmentIndexName;
@ApiModelProperty(value = "告警规则")
private String alarmRule;
} }
...@@ -786,4 +786,29 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -786,4 +786,29 @@ public class SupervisionConfigureController extends AbstractBaseController {
// return format; // return format;
} }
@PersonIdentify
@RequestMapping(value = "/pressurePump/page", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "稳压泵信号详情分页列表", produces = "application/json;charset=UTF-8", notes = "稳压泵信号详情分页列表")
public ResponseModel getPressurePumpPage(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
@RequestParam(value = "id", required = false) String id,
@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime,
@RequestParam(value = "pageNum") String pageNum,
@RequestParam(value = "pageSize") String pageSize) {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
}
Map<String, Object> list = supervisionVideoService.getPressurePumpPage(bizOrgCode, id, startTime, endTime, pageNum, pageSize);
return CommonResponseUtil.success(list);
}
} }
...@@ -694,6 +694,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -694,6 +694,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> selectAllPressurePumpInfo(@Param("bizOrgCode") String bizOrgCode, @Param("id") String id); List<Map<String, Object>> selectAllPressurePumpInfo(@Param("bizOrgCode") String bizOrgCode, @Param("id") String id);
List<Map<String, Object>> selectAllPressurePumpInfoByBizOrgCode(@Param("bizOrgCode") String bizOrgCode, @Param("id") String id);
List<Map<String, Object>> selectAllPressureName(@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> selectAllPressureName(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> selectAllDays(); List<Map<String, Object>> selectAllDays();
......
...@@ -26,5 +26,7 @@ public interface ISupervisionVideoService extends IService<SupervisionVideo> { ...@@ -26,5 +26,7 @@ public interface ISupervisionVideoService extends IService<SupervisionVideo> {
List<Map<String, Object>> selectPressureDetails(String bizOrgCode, String id, String startTime, String endTime); List<Map<String, Object>> selectPressureDetails(String bizOrgCode, String id, String startTime, String endTime);
Map<String, Object> getPressurePumpPage(String bizOrgCode, String id, String startTime, String endTime, String pageNum, String pageSize);
List<Map<String, Object>> selectAllPressureName(String bizOrgCode); List<Map<String, Object>> selectAllPressureName(String bizOrgCode);
} }
...@@ -1585,6 +1585,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1585,6 +1585,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
equipmentSpecificIndex.setUnit(index.getUnit()); equipmentSpecificIndex.setUnit(index.getUnit());
equipmentSpecificIndex.setValueEnum(index.getValueEnum()); equipmentSpecificIndex.setValueEnum(index.getValueEnum());
equipmentSpecificIndex.setTypeCode(index.getTypeCode()); equipmentSpecificIndex.setTypeCode(index.getTypeCode());
equipmentSpecificIndex.setIsTrend(index.getIsTrend());
equipmentSpecificIndex.setAlamReason(index.getAlarmRule());
equipmentSpecificIndices.add(equipmentSpecificIndex); equipmentSpecificIndices.add(equipmentSpecificIndex);
}); });
} }
...@@ -1921,7 +1923,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1921,7 +1923,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
iotIndexInfoVo.setType(equipmentSpecificIndex.getTypeName() != null ? equipmentSpecificIndex.getTypeName() : equipmentSpecificIndex.getIndexName()); iotIndexInfoVo.setType(equipmentSpecificIndex.getTypeName() != null ? equipmentSpecificIndex.getTypeName() : equipmentSpecificIndex.getIndexName());
iotIndexInfoVo.setNumber(deviceName); iotIndexInfoVo.setNumber(deviceName);
if (equipmentSpecificIndex.getIsTrend() == 1) { if (equipmentSpecificIndex.getIsTrend()) {
BigDecimal val = new BigDecimal(String.valueOf(entry.getValue())); BigDecimal val = new BigDecimal(String.valueOf(entry.getValue()));
iotIndexInfoVo.setContent(equipmentSpecificIndex.getIndexName() + (val.setScale(2, BigDecimal.ROUND_HALF_UP)) + equipmentSpecificIndex.getIndexUnitName()); iotIndexInfoVo.setContent(equipmentSpecificIndex.getIndexName() + (val.setScale(2, BigDecimal.ROUND_HALF_UP)) + equipmentSpecificIndex.getIndexUnitName());
} else { } else {
......
...@@ -444,8 +444,13 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -444,8 +444,13 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
List<EquipmentSpecificIndex> equipmentSpecificIndexList = new ArrayList<>(); List<EquipmentSpecificIndex> equipmentSpecificIndexList = new ArrayList<>();
List<EquipmentSpecificAlarm> equipmentSpecificAlarms = new ArrayList<>(); List<EquipmentSpecificAlarm> equipmentSpecificAlarms = new ArrayList<>();
List<IndexStateVo> indexStateList = new ArrayList<>(); List<IndexStateVo> indexStateList = new ArrayList<>();
JSONObject messageObj = JSONObject.parseObject(message);
JSONObject data = messageObj.getJSONObject("data");
if (!ObjectUtils.isEmpty(data)) {
message = JSON.toJSONString(data);
}
StationMessage stationMessage = JSON.parseObject(String.valueOf(message), StationMessage.class); StationMessage stationMessage = JSON.parseObject(message, StationMessage.class);
log.info("接收到换流站Kafka消息: {}", stationMessage); log.info("接收到换流站Kafka消息: {}", stationMessage);
String indexAddress = null, value = null, timeStamp = null, quality = null, dataType = null; String indexAddress = null, value = null, timeStamp = null, quality = null, dataType = null;
if (stationMessage != null) { if (stationMessage != null) {
...@@ -514,6 +519,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -514,6 +519,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
//es存储数据 //es存储数据
eSeqService.saveESEquiplistSpecificBySystemESVO(equipmentSpeIndex, String.valueOf(equipmentSpecificVo.getSystemId()), equipmentSpecificVo.getSystemName()); eSeqService.saveESEquiplistSpecificBySystemESVO(equipmentSpeIndex, String.valueOf(equipmentSpecificVo.getSystemId()), equipmentSpecificVo.getSystemName());
//更新装备性能指标 //更新装备性能指标
log.info("接收到遥信遥测消息更新sepcificIndex表消息对象是: {}", JSON.toJSONString(equipmentSpeIndex));
equipmentSpecificIndexService.updateById(equipmentSpeIndex); equipmentSpecificIndexService.updateById(equipmentSpeIndex);
// 更新设备表指标状态 // 更新设备表指标状态
...@@ -561,7 +567,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -561,7 +567,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
JSONObject jsonObjectXf = new JSONObject(); JSONObject jsonObjectXf = new JSONObject();
jsonObjectXf.put("data_class", "realdata"); jsonObjectXf.put("data_class", "realdata");
if (equipmentSpeIndex.getIsTrend() == 1) { if (equipmentSpeIndex.getIsTrend()) {
jsonObjectXf.put("data_type", "analog"); jsonObjectXf.put("data_type", "analog");
} else { } else {
jsonObjectXf.put("data_type", "state"); jsonObjectXf.put("data_type", "state");
...@@ -595,7 +601,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -595,7 +601,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
jsonObjectXf.put("data", jsonObjects); jsonObjectXf.put("data", jsonObjects);
// 遥测 // 遥测
if (!isOpenTelemetering && equipmentSpeIndex.getIsTrend() == 1) { if (!isOpenTelemetering && equipmentSpeIndex.getIsTrend()) {
} else { } else {
try { try {
...@@ -840,7 +846,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -840,7 +846,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
JSONObject jsonObjectXf = new JSONObject(); JSONObject jsonObjectXf = new JSONObject();
jsonObjectXf.put("data_class", "realdata"); jsonObjectXf.put("data_class", "realdata");
if (equipmentSpeIndex.getIsTrend() == 1) { if (equipmentSpeIndex.getIsTrend()) {
jsonObjectXf.put("data_type", "analog"); jsonObjectXf.put("data_type", "analog");
} else { } else {
jsonObjectXf.put("data_type", "state"); jsonObjectXf.put("data_type", "state");
...@@ -872,7 +878,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -872,7 +878,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
jsonObjectXf.put("data", jsonObjects); jsonObjectXf.put("data", jsonObjects);
// 遥测 // 遥测
if (!isOpenTelemetering && equipmentSpeIndex.getIsTrend() == 1) { if (!isOpenTelemetering && equipmentSpeIndex.getIsTrend()) {
} else { } else {
try { try {
...@@ -1125,7 +1131,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1125,7 +1131,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
JSONObject jsonObjectXf = new JSONObject(); JSONObject jsonObjectXf = new JSONObject();
jsonObjectXf.put("data_class", "realdata"); jsonObjectXf.put("data_class", "realdata");
if (equipmentSpeIndex.getIsTrend() == 1) { if (equipmentSpeIndex.getIsTrend()) {
jsonObjectXf.put("data_type", "analog"); jsonObjectXf.put("data_type", "analog");
} else { } else {
jsonObjectXf.put("data_type", "state"); jsonObjectXf.put("data_type", "state");
...@@ -1159,7 +1165,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -1159,7 +1165,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
jsonObjectXf.put("data", jsonObjects); jsonObjectXf.put("data", jsonObjects);
// 遥测 // 遥测
if (!isOpenTelemetering && equipmentSpeIndex.getIsTrend() == 1) { if (!isOpenTelemetering && equipmentSpeIndex.getIsTrend()) {
} else { } else {
try { try {
...@@ -2007,43 +2013,89 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -2007,43 +2013,89 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
if (verifyNB(equipmentSpcIndex.getNameKey())) { if (verifyNB(equipmentSpcIndex.getNameKey())) {
return getNbEquipAlarmList(indexAlarms, equipmentSpcIndex, equipmentSpecificAlarm, messageBody); return getNbEquipAlarmList(indexAlarms, equipmentSpcIndex, equipmentSpecificAlarm, messageBody);
} }
// 报警表新增信息
if (ObjectUtils.isEmpty(indexAlarms) && (TrueOrFalseEnum.real.value.equals(equipmentSpcIndex.getValue()))) { Boolean flag = judgeIsAlarm(equipmentSpcIndex.getAlarmRule(), equipmentSpcIndex.getValue());
equipmentSpecificAlarms = addEquipmentSpecificAlarm(equipmentSpecificAlarms, equipmentSpcIndex, equipmentSpecificAlarm, messageBody); if (StringUtil.isNotEmpty(equipmentSpcIndex.getAlarmRule())) {
if (ObjectUtils.isEmpty(indexAlarms) && flag) {
equipmentSpecificAlarms = addEquipmentSpecificAlarm(equipmentSpecificAlarms, equipmentSpcIndex, equipmentSpecificAlarm, messageBody);
} else {
for (EquipmentSpecificAlarm action : indexAlarms) {
if (flag) {
// 报警,修改发生频率
action.setFrequency((action.getFrequency() + 1));
} else {
// 报警恢复,修改数据为恢复状态
action.setRecoveryDate(new Date());
action.setEquipmentSpecificIndexValue(equipmentSpcIndex.getValue());
action.setStatus(AlarmStatusEnum.HF.getCode());
}
action.setUpdateDate(new Date());
// 更新所在系统,设备可能编辑过,更新所在系统、装备名称、装备定义code
action.setTraceId(equipmentSpcIndex.getTraceId());
action.setSystemIds(equipmentSpcIndex.getSystemId());
action.setSystemCodes(this.getSystemCodeBySpeId(equipmentSpcIndex.getSystemId()));
action.setEquipmentSpecificName(equipmentSpcIndex.getEquipmentSpecificName());
action.setEquipmentCode(equipmentSpcIndex.getEquipmentCode());
// 冗余字段,alarm_log表更新时使用
action.setEquipmentSpecificCode(equipmentSpcIndex.getEquipmentSpecificCode());
action.setBuildId(equipmentSpcIndex.getBuildId());
action.setBizOrgName(equipmentSpcIndex.getBizOrgName());
action.setBizOrgCode(equipmentSpcIndex.getBizOrgCode());
action.setMessageBody(!ObjectUtils.isEmpty(messageBody) ? messageBody.get("messageBody") : "");
equipmentSpecificAlarms.add(action);
}
}
} else { } else {
// 报警表更新信息 // 报警表新增信息
for (EquipmentSpecificAlarm action : indexAlarms) { if (ObjectUtils.isEmpty(indexAlarms) && (TrueOrFalseEnum.real.value.equals(equipmentSpcIndex.getValue()))) {
if (TrueOrFalseEnum.real.value.equals(equipmentSpcIndex.getValue())) { equipmentSpecificAlarms = addEquipmentSpecificAlarm(equipmentSpecificAlarms, equipmentSpcIndex, equipmentSpecificAlarm, messageBody);
// 报警,修改发生频率 } else {
action.setFrequency((action.getFrequency() + 1)); // 报警表更新信息
} else { for (EquipmentSpecificAlarm action : indexAlarms) {
// 报警恢复,修改数据为恢复状态 if (TrueOrFalseEnum.real.value.equals(equipmentSpcIndex.getValue())) {
action.setRecoveryDate(new Date()); // 报警,修改发生频率
action.setEquipmentSpecificIndexValue(TrueOrFalseEnum.fake.value); action.setFrequency((action.getFrequency() + 1));
action.setStatus(AlarmStatusEnum.HF.getCode()); } else {
// 报警恢复,修改数据为恢复状态
action.setRecoveryDate(new Date());
action.setEquipmentSpecificIndexValue(equipmentSpcIndex.getValue());
action.setStatus(AlarmStatusEnum.HF.getCode());
}
action.setUpdateDate(new Date());
// 更新所在系统,设备可能编辑过,更新所在系统、装备名称、装备定义code
action.setTraceId(equipmentSpcIndex.getTraceId());
action.setSystemIds(equipmentSpcIndex.getSystemId());
action.setSystemCodes(this.getSystemCodeBySpeId(equipmentSpcIndex.getSystemId()));
action.setEquipmentSpecificName(equipmentSpcIndex.getEquipmentSpecificName());
action.setEquipmentCode(equipmentSpcIndex.getEquipmentCode());
// 冗余字段,alarm_log表更新时使用
action.setEquipmentSpecificCode(equipmentSpcIndex.getEquipmentSpecificCode());
action.setBuildId(equipmentSpcIndex.getBuildId());
action.setBizOrgName(equipmentSpcIndex.getBizOrgName());
action.setBizOrgCode(equipmentSpcIndex.getBizOrgCode());
action.setMessageBody(!ObjectUtils.isEmpty(messageBody) ? messageBody.get("messageBody") : "");
equipmentSpecificAlarms.add(action);
} }
action.setEquipmentSpecificName(equipmentSpcIndex.getEquipmentSpecificName());
action.setUpdateDate(new Date());
// 更新所在系统,设备可能编辑过,更新所在系统、装备名称、装备定义code
action.setTraceId(equipmentSpcIndex.getTraceId());
action.setSystemIds(equipmentSpcIndex.getSystemId());
action.setSystemCodes(this.getSystemCodeBySpeId(equipmentSpcIndex.getSystemId()));
action.setEquipmentSpecificName(equipmentSpcIndex.getEquipmentSpecificName());
action.setEquipmentCode(equipmentSpcIndex.getEquipmentCode());
// 冗余字段,alarm_log表更新时使用
action.setLocation(equipmentSpcIndex.getLocation());
action.setEquipmentSpecificCode(equipmentSpcIndex.getEquipmentSpecificCode());
action.setBuildId(equipmentSpcIndex.getBuildId());
action.setBizOrgName(equipmentSpcIndex.getBizOrgName());
action.setBizOrgCode(equipmentSpcIndex.getBizOrgCode());
action.setMessageBody(!ObjectUtils.isEmpty(messageBody) ? messageBody.get("messageBody") : "");
equipmentSpecificAlarms.add(action);
} }
} }
return equipmentSpecificAlarms; return equipmentSpecificAlarms;
} }
/** /**
* 根据alarm_rule规则字段判断是否是告警
* @return
*/
private Boolean judgeIsAlarm(String rule, String value) {
Boolean bool = Boolean.TRUE;
if (StringUtil.isNotEmpty(rule)) {
if (!rule.equalsIgnoreCase(value)) {
bool = Boolean.FALSE;
}
}
return bool;
}
/**
* 发送数据至换流站 * 发送数据至换流站
* *
* @param * @param
......
...@@ -2,6 +2,9 @@ package com.yeejoin.equipmanage.service.impl; ...@@ -2,6 +2,9 @@ package com.yeejoin.equipmanage.service.impl;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...@@ -11,6 +14,8 @@ import com.yeejoin.equipmanage.common.enums.PressurePumpRelateEnum; ...@@ -11,6 +14,8 @@ import com.yeejoin.equipmanage.common.enums.PressurePumpRelateEnum;
import com.yeejoin.equipmanage.common.utils.DateUtils; import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.common.vo.IotDataVO; import com.yeejoin.equipmanage.common.vo.IotDataVO;
import com.yeejoin.equipmanage.common.vo.PressurePumpCountVo; import com.yeejoin.equipmanage.common.vo.PressurePumpCountVo;
import com.yeejoin.equipmanage.common.vo.StationMessage;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper; import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.mapper.SupervisionVideoMapper; import com.yeejoin.equipmanage.mapper.SupervisionVideoMapper;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce; import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
...@@ -25,6 +30,7 @@ import org.springframework.stereotype.Service; ...@@ -25,6 +30,7 @@ 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.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.ParseException; import java.text.ParseException;
...@@ -33,6 +39,8 @@ import java.util.*; ...@@ -33,6 +39,8 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.typroject.tyboot.core.foundation.context.RequestContext.*;
@Slf4j @Slf4j
@Service @Service
...@@ -53,6 +61,9 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap ...@@ -53,6 +61,9 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
@Autowired @Autowired
private FireFightingSystemMapper fireFightingSystemMapper; private FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
private IotFeign iotFeign;
@Value("${equipment.pressurepump.start}") @Value("${equipment.pressurepump.start}")
private String pressurePumpStart; private String pressurePumpStart;
...@@ -302,6 +313,62 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap ...@@ -302,6 +313,62 @@ public class SupervisionVideoServiceImpl extends ServiceImpl<SupervisionVideoMap
} }
} }
@Override
public Map<String, Object> getPressurePumpPage(String bizOrgCode, String id, String startTime, String endTime, String pageNum, String pageSize) {
List<Map<String, Object>> pressurePumpInfo = fireFightingSystemMapper.selectAllPressurePumpInfoByBizOrgCode(bizOrgCode, id);
List<Map<String, String>> resList = new ArrayList<>();
List<Map<String, String>> finalResList = resList;
pressurePumpInfo.stream().forEach(item -> {
String prefix = null;
String suffix = null;
String iotCode = item.get("iot_code").toString();
if (iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
throw new BadRequest("装备物联编码错误,请确认!");
}
ResponseModel entity = null;
try {
entity = iotFeign.selectPage(getAppKey(), getProduct(), getToken(), startTime, endTime, prefix, suffix, pressurePumpStart, 0, 1000);
} catch (Exception e) {
throw new RuntimeException("调用AMOS-API-IOT服务失败,请检查服务是否正常!");
}
if (200 == entity.getStatus() && !ObjectUtils.isEmpty(entity.getResult())) {
String json = JSON.toJSONString(entity.getResult());
JSONObject messageObj = JSONObject.parseObject(json);
JSONArray array = messageObj.getJSONArray("records");
List<Map<String, String>> listObject = (List<Map<String, String>>) JSONArray.parse(JSON.toJSONString(array));
listObject.forEach(x -> {
Map<String, String> map = new HashMap<>();
map.put("id", UUID.randomUUID().toString());
map.put("name", String.valueOf(item.get("name")));
map.put("time", String.valueOf(x.get("time")).substring(0, 19).replace("T", " "));
map.put("value", String.valueOf(x.get(pressurePumpStart)));
finalResList.add(map);
});
}
});
Map<String, Object> resMap = new HashMap<>();
resMap.put("current", Integer.valueOf(pageNum));
resMap.put("pageSize", Integer.valueOf(pageSize));
resMap.put("total", finalResList.size());
if (ObjectUtils.isEmpty(finalResList)) {
resMap.put("pages", 0);
resMap.put("records", new ArrayList<>());
return resMap;
} else {
resList = finalResList.stream().sorted((t1, t2) -> t2.get("time").compareTo(t1.get("time"))).collect(Collectors.toList());
}
int startIndex = (Integer.valueOf(pageNum) - 1) * Integer.valueOf(pageSize);
int endIndex = Math.min(startIndex + Integer.valueOf(pageSize), resList.size());
int pages = (finalResList.size() + Integer.valueOf(pageSize) - 1) / Integer.valueOf(pageSize);
List<Map<String, String>> list = resList.subList(startIndex, endIndex);
resMap.put("pages", pages);
resMap.put("records", list);
return resMap;
}
@Override @Override
public List<Map<String, Object>> selectAllPressureName(String bizOrgCode) { public List<Map<String, Object>> selectAllPressureName(String bizOrgCode) {
......
...@@ -1174,4 +1174,20 @@ ...@@ -1174,4 +1174,20 @@
UPDATE `wl_car` wc SET wc.use_type = '自购'; UPDATE `wl_car` wc SET wc.use_type = '自购';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="keyong" id="1694055999">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_index" columnName="alarm_rule"/>
</not>
</preConditions>
<comment>新增字段 type_code</comment>
<sql>
alter table `wl_equipment_index` add column `alarm_rule` varchar(50) DEFAULT NULL COMMENT '告警规则';
alter table `wl_equipment_specific_index` add column `is_trend` bit(1) DEFAULT b'0' COMMENT '是否支持趋势查看(冗余自wl_equipment_index)';
alter table `wl_equipment_specific_index` add column `alarm_rule` varchar(50) DEFAULT NULL COMMENT '告警规则(冗余自wl_equipment_index)';
UPDATE wl_equipment_specific_index esi SET esi.is_trend = ( SELECT is_trend FROM wl_equipment_index wei WHERE esi.equipment_index_id = wei.id ),
esi.alarm_rule = ( SELECT alarm_rule FROM wl_equipment_index wei WHERE esi.equipment_index_id = wei.id );
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -158,7 +158,8 @@ ...@@ -158,7 +158,8 @@
sort_num, sort_num,
type, type,
is_trend, is_trend,
value_enum value_enum,
alarm_rule AS alarmRule
from from
wl_equipment_index wl_equipment_index
where id = #{id} where id = #{id}
......
...@@ -67,7 +67,8 @@ ...@@ -67,7 +67,8 @@
TRIM(CONCAT_WS(' ',wes.position,sd.description)) AS location, TRIM(CONCAT_WS(' ',wes.position,sd.description)) AS location,
sd.warehouse_structure_id AS buildId, sd.warehouse_structure_id AS buildId,
wes.biz_org_name AS bizOrgName, wes.biz_org_name AS bizOrgName,
wes.biz_org_code AS bizOrgCode wes.biz_org_code AS bizOrgCode,
wesi.alarm_rule AS alarmRule
FROM FROM
wl_equipment_specific_index AS wesi wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes LEFT JOIN wl_equipment_specific AS wes
......
...@@ -5887,6 +5887,29 @@ ...@@ -5887,6 +5887,29 @@
es.id es.id
</select> </select>
<select id="selectAllPressurePumpInfoByBizOrgCode" resultType="java.util.Map">
SELECT
es.id,
es.`name`,
concat_ws( '-', ws.full_name, ed.area ) area,
es.iot_code
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = es.warehouse_structure_id
WHERE
ed.`code` LIKE '92010800%'
AND es.iot_code IS NOT NULL
<if test="bizOrgCode != null and bizOrgCode != ''" >
AND es.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
<if test="id != null and id != ''" >
AND es.id = #{id}
</if>
GROUP BY
es.id
</select>
<select id="selectAllPressureName" resultType="java.util.Map"> <select id="selectAllPressureName" resultType="java.util.Map">
SELECT SELECT
es.`name`, es.`name`,
......
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