Commit ed97b067 authored by zhangsen's avatar zhangsen

bug

需求提交
parent 8506ac7c
...@@ -382,7 +382,7 @@ public class WaterResourceDto extends BaseDto { ...@@ -382,7 +382,7 @@ public class WaterResourceDto extends BaseDto {
@ExcelIgnore @ExcelIgnore
@ApiModelProperty("水池液位显示装置id") @ApiModelProperty("水池液位显示装置id")
private String levelDeviceId; private List<String> levelDeviceId;
@ApiModelProperty("水池液位显示装置名称") @ApiModelProperty("水池液位显示装置名称")
@ExcelProperty(value = "水池液位显示装置", index = 45) @ExcelProperty(value = "水池液位显示装置", index = 45)
......
...@@ -143,7 +143,8 @@ public class WaterResourceController extends BaseController { ...@@ -143,7 +143,8 @@ public class WaterResourceController extends BaseController {
model.setIsIot(true); model.setIsIot(true);
waterResourceServiceImpl.createWithModel(model); waterResourceServiceImpl.createWithModel(model);
WaterResourcePoolDto waterResourcePoolDto = new WaterResourcePoolDto(); WaterResourcePoolDto waterResourcePoolDto = new WaterResourcePoolDto();
BeanUtils.copyProperties(model, waterResourcePoolDto); BeanUtils.copyProperties(model, waterResourcePoolDto, "levelDeviceId");
waterResourcePoolDto.setLevelDeviceId(String.join(",", model.getLevelDeviceId()));
waterResourcePoolDto.setSequenceNbr(null); waterResourcePoolDto.setSequenceNbr(null);
waterResourcePoolDto.setResourceId(model.getSequenceNbr()); waterResourcePoolDto.setResourceId(model.getSequenceNbr());
waterResourcePoolService.createWithModel(waterResourcePoolDto); waterResourcePoolService.createWithModel(waterResourcePoolDto);
...@@ -411,7 +412,8 @@ public class WaterResourceController extends BaseController { ...@@ -411,7 +412,8 @@ public class WaterResourceController extends BaseController {
WaterResourcePool waterResourcePool = WaterResourcePool waterResourcePool =
waterResourcePoolService.getOne(new QueryWrapper<WaterResourcePool>().eq("resource_id", waterResourcePoolService.getOne(new QueryWrapper<WaterResourcePool>().eq("resource_id",
sequenceNbr)); sequenceNbr));
BeanUtils.copyProperties(waterResourcePool, waterResourceDto); BeanUtils.copyProperties(waterResourcePool, waterResourceDto, "levelDeviceId");
waterResourceDto.setLevelDeviceId(Arrays.asList(waterResourcePool.getLevelDeviceId().split(",")));
break; break;
default: default:
break; break;
......
...@@ -604,4 +604,9 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -604,4 +604,9 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> queryStartAndStopBySpecificId(@Param("ids")List<Long> ids); List<Map<String, Object>> queryStartAndStopBySpecificId(@Param("ids")List<Long> ids);
List<Map<String, Object>> queryStateBySpecificId(@Param("id")long id); List<Map<String, Object>> queryStateBySpecificId(@Param("id")long id);
Map<String, Object> getFoamTankLevel(@Param("equipSpeId") Long equipSpeId);
Map<String, Object> getPipeNetwork(@Param("equipSpeId") Long equipSpeId);
} }
...@@ -39,6 +39,8 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil; ...@@ -39,6 +39,8 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.lang.reflect.Array; import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
...@@ -89,6 +91,22 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -89,6 +91,22 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Autowired @Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper; EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
/**
* 泡沫罐KEY
*/
private final static String CAFS_FoamTank_FoamTankLevel = "CAFS_FoamTank_FoamTankLevel";
/**
* 泡沫罐KEY
*/
private final static String FHS_PipePressureDetector_PipePressure = "FHS_PipePressureDetector_PipePressure";
/**
* 水池信息
*/
private final static String FHS_FirePoolDevice_WaterLevel = "FHS_FirePoolDevice_WaterLevel";
static EquipmentSpecificMapper equipmentSpecificMapper; static EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired @Autowired
public void setEquipmentSpecificMapper(EquipmentSpecificMapper equipmentSpecificMapper){ public void setEquipmentSpecificMapper(EquipmentSpecificMapper equipmentSpecificMapper){
...@@ -327,6 +345,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -327,6 +345,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
if (equipmentSpecificIndex.getIsAlarm() != null && 1 == equipmentSpecificIndex.getIsAlarm()) { if (equipmentSpecificIndex.getIsAlarm() != null && 1 == equipmentSpecificIndex.getIsAlarm()) {
equipmentSpecificAlarms.addAll(createIndexAlarmRecord(equipmentSpecificIndex)); equipmentSpecificAlarms.addAll(createIndexAlarmRecord(equipmentSpecificIndex));
} }
if (iotDataVO.getKey().toLowerCase().equals(CAFS_FoamTank_FoamTankLevel.toLowerCase()) ||
FHS_PipePressureDetector_PipePressure.toLowerCase().equals(iotDataVO.getKey().toLowerCase())
) {
doFoamTankLevel(iotDataVO, equipmentSpecificIndex);
}
} }
} }
}); });
...@@ -379,6 +403,77 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -379,6 +403,77 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}); });
} }
/**
* 泡沫罐 或 者管网压力 消息发送
* @param iotDataVO iotDataVO
* @param equipmentSpecificIndex equipmentSpecificIndex
*/
private void doFoamTankLevel(IotDataVO iotDataVO, EquipmentSpecificIndex equipmentSpecificIndex) {
MessageModel model = new MessageModel();
Map<String, Object> map = new HashMap<>();
if (iotDataVO.getKey().toLowerCase().equals(CAFS_FoamTank_FoamTankLevel.toLowerCase())) {
map = fireFightingSystemMapper.getFoamTankLevel(equipmentSpecificIndex.getEquipmentSpecificId());
} else {
map = fireFightingSystemMapper.getPipeNetwork(equipmentSpecificIndex.getEquipmentSpecificId());
}
BigDecimal minValue = getBigDecimal(map.get("minValues"));
BigDecimal maxValue = getBigDecimal(map.get("maxValues"));
BigDecimal nowValue = getBigDecimal(iotDataVO.getValue());
if (nowValue.compareTo(minValue) < 0 || nowValue.compareTo(maxValue) > 0) {
String body = "";
if (nowValue.compareTo(minValue) < 0) {
body = "当前数值 " + nowValue + " 低于最低报警阈值 " + minValue;
} else if (nowValue.compareTo(maxValue) > 0) {
body = "当前数值 " + nowValue + " 超过最高报警阈值 " + maxValue;
}
String bodyMain = String.format("名称:模拟量提醒,时间:%s,内容:%s,- 当前数值%s,%s ,请及时查看处理。",
new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(new Date()),
equipmentSpecificIndex.getEquipmentSpecificName() + "-" + equipmentSpecificIndex.getLocation(),
nowValue,
nowValue.compareTo(minValue) < 0 ? "低于最低报警阈值" + minValue : "超过最高报警阈值" + maxValue
);
model.setTitle(equipmentSpecificIndex.getEquipmentSpecificName());
model.setBody(bodyMain);
model.setMsgType("FoamTankOrPipeNetwork");
model.setSendTime(new Date());
model.setIsSendWeb(true);
model.setCategory(1);
model.setRelationId(equipmentSpecificIndex.getEquipmentSpecificId().toString());
model.setIsSendApp(false);
model.setTerminal("WEB");
Map<String, String> ext = new HashMap<>();
ext.put("content", body);
ext.put("type", "模拟量超阈值提醒");
ext.put("name", equipmentSpecificIndex.getEquipmentSpecificName());
ext.put("time", new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(new Date()));
model.setExtras(ext);
Token token = remoteSecurityService.getServerToken();
systemctlFeign.create(token.getAppKey(), token.getProduct(), token.getToke(), model);
log.info(String.format("调用平台消息服务成功:%s", JSON.toJSONString(model)));
}
}
private BigDecimal getBigDecimal( Object value ) {
BigDecimal val = null;
if( value != null ) {
if( value instanceof BigDecimal ) {
val = (BigDecimal) value;
} else if( value instanceof String ) {
val = new BigDecimal( (String) value );
} else if( value instanceof BigInteger) {
val = new BigDecimal( (BigInteger) value );
} else if( value instanceof Number ) {
val = new BigDecimal( ((Number)value).doubleValue() );
} else {
throw new ClassCastException("Not possible to coerce ["+value+"] from class "+value.getClass()+" into a BigDecimal.");
}
}
return val;
}
public void carRealTimeDate(List<IotDataVO> iotDatalist, List<CarProperty> carProperties) { public void carRealTimeDate(List<IotDataVO> iotDatalist, List<CarProperty> carProperties) {
List<CarProperty> carIndexsList = new ArrayList<>(); List<CarProperty> carIndexsList = new ArrayList<>();
iotDatalist.forEach(iotDataVO -> { iotDatalist.forEach(iotDataVO -> {
......
...@@ -1340,7 +1340,7 @@ public class ExcelServiceImpl { ...@@ -1340,7 +1340,7 @@ public class ExcelServiceImpl {
if (item.getLevelDeviceName() != null) { if (item.getLevelDeviceName() != null) {
String[] type = item.getLevelDeviceName().split("@"); String[] type = item.getLevelDeviceName().split("@");
item.setLevelDeviceName(type[0]); item.setLevelDeviceName(type[0]);
item.setLevelDeviceId(type[1]); item.setLevelDeviceId(Arrays.asList(type[1]));
} }
// BUG 2935 优化项 分类从93060000 取得字典数据 by kongfm 2021-09-17 // BUG 2935 优化项 分类从93060000 取得字典数据 by kongfm 2021-09-17
if (item.getEquipCategoryName() != null) { if (item.getEquipCategoryName() != null) {
......
...@@ -4947,4 +4947,44 @@ ...@@ -4947,4 +4947,44 @@
ORDER BY ORDER BY
i.update_date DESC i.update_date DESC
</select> </select>
<select id="getFoamTankLevel" resultType="java.util.Map">
SELECT
IF
(
max( CASE WHEN fi.field_name = 'minLevel' THEN fi.field_value END ) = ''
OR max( CASE WHEN fi.field_name = 'minLevel' THEN fi.field_value END ) IS NULL,
0,
max( CASE WHEN fi.field_name = 'minLevel' THEN fi.field_value END )) AS minValues,
IF
(
max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) = ''
OR max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) IS NULL,
0,
max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END )) AS maxValues
FROM
wl_form_instance fi
WHERE
fi.instance_id = #{equipSpeId}
</select>
<select id="getPipeNetwork" resultType="java.util.Map">
SELECT
IF
(
max( CASE WHEN fi.field_name = 'minPressure' THEN fi.field_value END ) = ''
OR max( CASE WHEN fi.field_name = 'minPressure' THEN fi.field_value END ) IS NULL,
0,
max( CASE WHEN fi.field_name = 'minPressure' THEN fi.field_value END )) AS minValues,
IF
(
max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END ) = ''
OR max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END ) IS NULL,
0,
max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END )) AS maxValues
FROM
wl_form_instance fi
WHERE
fi.instance_id = #{equipSpeId}
</select>
</mapper> </mapper>
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