Commit 29e1b559 authored by KeYong's avatar KeYong

更新预案

parent 61a9ac07
package com.yeejoin.amos.fas.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author keyong
* @title: JudgeSignEnum
* <pre>
* @description: TODO
* </pre>
* @date 2023/3/8 20:54
*/
@Getter
@AllArgsConstructor
public enum JudgeSignEnum {
AND("and","与"),
OR("or","或");
private String sign;
private String describe;
}
package com.yeejoin.amos.fas.dao.entity; package com.yeejoin.amos.fas.dao.entity;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*; import javax.persistence.*;
...@@ -13,6 +14,7 @@ import java.util.Date; ...@@ -13,6 +14,7 @@ import java.util.Date;
@Entity @Entity
@Table(name="f_equipment") @Table(name="f_equipment")
@NamedQuery(name="Equipment.findAll", query="SELECT e FROM Equipment e") @NamedQuery(name="Equipment.findAll", query="SELECT e FROM Equipment e")
@Data
public class Equipment extends BasicEntity { public class Equipment extends BasicEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
package com.yeejoin.amos.fas.dao.entity; package com.yeejoin.amos.fas.dao.entity;
import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
...@@ -18,6 +20,7 @@ import java.util.Date; ...@@ -18,6 +20,7 @@ import java.util.Date;
@Entity @Entity
@Table(name = "c_plan_message") @Table(name = "c_plan_message")
@NamedQuery(name = "PlanMessage.findAll", query = "SELECT e FROM PlanMessage e") @NamedQuery(name = "PlanMessage.findAll", query = "SELECT e FROM PlanMessage e")
@Data
public class PlanMessage extends BasicEntity { public class PlanMessage extends BasicEntity {
@Column(name = "batch_no") @Column(name = "batch_no")
......
...@@ -37,14 +37,8 @@ public class EquipmentFireEquipmentController { ...@@ -37,14 +37,8 @@ public class EquipmentFireEquipmentController {
@ApiOperation(value = "判断节点是否自动执行", notes = "判断节点是否自动执行") @ApiOperation(value = "判断节点是否自动执行", notes = "判断节点是否自动执行")
@GetMapping("/automaticExecutePoint") @GetMapping("/automaticExecutePoint")
public Object automaticExecutePoint(@RequestParam(required = false) String equipmentId, public Object automaticExecutePoint(@RequestParam(required = false) Integer index) {
@RequestParam(required = false) String equipCode, return equipmentFireEquipmentService.automaticExecutePoint(index);
@RequestParam(required = false) String equipSpeCode,
@RequestParam(required = false) String type,
@RequestParam(required = false) String indexKeys,
@RequestParam(required = false) String value,
@RequestParam(required = false) String index) {
return equipmentFireEquipmentService.automaticExecutePoint(equipmentId, equipCode, equipSpeCode, type, indexKeys, value, index);
} }
} }
\ No newline at end of file
package com.yeejoin.amos.fas.business.dao.mapper; package com.yeejoin.amos.fas.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.fas.business.vo.ConditionVO;
import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo; import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo;
import com.yeejoin.amos.fas.dao.entity.PlanMessage;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -22,4 +24,6 @@ public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecif ...@@ -22,4 +24,6 @@ public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecif
List<EquipmentSpecificIndexVo> getInitAlarm(@Param("value") String value, @Param("list") String[] nameKeys); List<EquipmentSpecificIndexVo> getInitAlarm(@Param("value") String value, @Param("list") String[] nameKeys);
Map<String, Object> countEquipIndexAndValueOfNum(@Param("list") List<Long> equipSpecificIdList, @Param("equipCodes") String[] equipCodes, @Param("equipSpeCodes") String[] equipSpeCodes, @Param("indexKeys") String[] indexKeys, @Param("value") String value); Map<String, Object> countEquipIndexAndValueOfNum(@Param("list") List<Long> equipSpecificIdList, @Param("equipCodes") String[] equipCodes, @Param("equipSpeCodes") String[] equipSpeCodes, @Param("indexKeys") String[] indexKeys, @Param("value") String value);
List<PlanMessage> getEquipIndexAndValue(@Param("list") List<ConditionVO> list, @Param("fireEquipments") List<Long> fireEquipments, @Param("outAndOr") String outAndOr);
} }
...@@ -91,4 +91,6 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecificVo> ...@@ -91,4 +91,6 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecificVo>
String getEquipId(@Param("id") String id); String getEquipId(@Param("id") String id);
String getBatchNoByEquipId(@Param("equipId") String equipId); String getBatchNoByEquipId(@Param("equipId") String equipId);
List<String> getFireEquipIdsByNamePrefix(@Param("namePrefix") String namePrefix);
} }
...@@ -42,5 +42,7 @@ public interface PlanOperationRecordMapper { ...@@ -42,5 +42,7 @@ public interface PlanOperationRecordMapper {
*/ */
String getLastBatchNo(); String getLastBatchNo();
Map<String, Object> getLatestFireEquipId();
PlanRule getPlanRuleByBatchNo(String batchNo); PlanRule getPlanRuleByBatchNo(String batchNo);
} }
...@@ -38,4 +38,7 @@ public interface IEquipmentFireEquipmentDao extends BaseDao<EquipmentFireEquipme ...@@ -38,4 +38,7 @@ public interface IEquipmentFireEquipmentDao extends BaseDao<EquipmentFireEquipme
@Query(value = "SELECT ffe.* FROM f_equipment_fire_equipment ffe LEFT JOIN wl_equipment_specific es ON ffe.fire_equipment_id = es.id WHERE ffe.equipment_id = ?1 AND es.`code` IN ?2", nativeQuery = true) @Query(value = "SELECT ffe.* FROM f_equipment_fire_equipment ffe LEFT JOIN wl_equipment_specific es ON ffe.fire_equipment_id = es.id WHERE ffe.equipment_id = ?1 AND es.`code` IN ?2", nativeQuery = true)
List<EquipmentFireEquipment> findByEquipIdAndEquipSpeCodeIn(Long equipmentId, String[] equipSpeCodes); List<EquipmentFireEquipment> findByEquipIdAndEquipSpeCodeIn(Long equipmentId, String[] equipSpeCodes);
@Query(value = "SELECT fire_equipment_id FROM `f_equipment_fire_equipment` WHERE equipment_id IN ?1", nativeQuery = true)
List<Long> findFireEquipmentIdsByEquipmentId(String[] equipmentIds);
} }
...@@ -2,12 +2,22 @@ package com.yeejoin.amos.fas.business.service.impl; ...@@ -2,12 +2,22 @@ package com.yeejoin.amos.fas.business.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PlanMessageMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper;
import com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IEquipmentFireEquipmentDao; import com.yeejoin.amos.fas.business.dao.repository.IEquipmentFireEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IPlanMessageDao;
import com.yeejoin.amos.fas.business.entity.mybatis.FireEquipmentEntity;
import com.yeejoin.amos.fas.business.service.intfc.EquipmentSpecificIndexService; import com.yeejoin.amos.fas.business.service.intfc.EquipmentSpecificIndexService;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentFireEquipmentService; import com.yeejoin.amos.fas.business.service.intfc.IEquipmentFireEquipmentService;
import com.yeejoin.amos.fas.business.vo.ConditionVO;
import com.yeejoin.amos.fas.business.vo.PlanStepJsonVO; import com.yeejoin.amos.fas.business.vo.PlanStepJsonVO;
import com.yeejoin.amos.fas.common.enums.SqlKeyWordEnum; import com.yeejoin.amos.fas.common.enums.SqlKeyWordEnum;
import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment; import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment;
import com.yeejoin.amos.fas.dao.entity.PlanDetail;
import com.yeejoin.amos.fas.dao.entity.PlanMessage;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -17,11 +27,14 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -17,11 +27,14 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -40,6 +53,7 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen ...@@ -40,6 +53,7 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
private static final String TYPE = "or"; private static final String TYPE = "or";
private static final String VALUE = "true"; private static final String VALUE = "true";
private static final int stepIndex = 9;
@Autowired @Autowired
private IEquipmentFireEquipmentService equipmentFireEquipmentService; private IEquipmentFireEquipmentService equipmentFireEquipmentService;
...@@ -50,6 +64,21 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen ...@@ -50,6 +64,21 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
@Autowired @Autowired
private IEquipmentFireEquipmentDao equipmentFireEquipmentDao; private IEquipmentFireEquipmentDao equipmentFireEquipmentDao;
@Autowired
PlanOperationRecordMapper planOperationRecordMapper;
@Autowired
PlanMessageMapper planMessageMapper;
@Autowired
IEquipmentDao iEquipmentDao;
@Autowired
IPlanMessageDao planMessageDao;
@Autowired
private EquipmentSpecificMapper equipmentSpecificMapper;
@Value("classpath:/json/plan-step.json") @Value("classpath:/json/plan-step.json")
private Resource planStepResource; private Resource planStepResource;
...@@ -59,6 +88,11 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen ...@@ -59,6 +88,11 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
} }
@Override @Override
public List<Long> findFireEquipmentIdsByEquipmentId(String[] equipmentIds) {
return Optional.ofNullable(equipmentFireEquipmentDao.findFireEquipmentIdsByEquipmentId(equipmentIds)).orElse(new ArrayList<>());
}
@Override
public List<EquipmentFireEquipment> findByEquipIdAndEquipCodeIn(Long equipmentId, String[] equipCodes) { public List<EquipmentFireEquipment> findByEquipIdAndEquipCodeIn(Long equipmentId, String[] equipCodes) {
return equipmentFireEquipmentDao.findByEquipIdAndEquipCodeIn(equipmentId, equipCodes); return equipmentFireEquipmentDao.findByEquipIdAndEquipCodeIn(equipmentId, equipCodes);
} }
...@@ -131,10 +165,7 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen ...@@ -131,10 +165,7 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
} }
@Override @Override
public Object automaticExecutePoint(String equipmentId, String equipCode, String equipSpeCode, String type, String indexKeys, String value, String index) { public Object automaticExecutePoint(Integer index) {
String json; String json;
try { try {
json = IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8)); json = IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
...@@ -143,65 +174,45 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen ...@@ -143,65 +174,45 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
} }
List<PlanStepJsonVO> result = JSONObject.parseArray(json, PlanStepJsonVO.class); List<PlanStepJsonVO> result = JSONObject.parseArray(json, PlanStepJsonVO.class);
if (!CollectionUtils.isEmpty(result)) { if (!CollectionUtils.isEmpty(result)) {
// 获取电力设备id及batchNo
} Map<String, Object> map = planOperationRecordMapper.getLatestFireEquipId();
String fireEquipId = String.valueOf(map.get("fireEquipId"));
List<Long> fireEquipments = new ArrayList<>();
// 若是停运本极对端换流器,则需查出本极对应的电力设备列表,暂用电力设备名称过滤出本极电力设备,注意此处的电力设备按照标准有两极(极I,极II)
Map<String, Object> map = null; if (stepIndex == index) {
if(StringUtils.isBlank(equipCode)){ Optional<Equipment> equipment = iEquipmentDao.findById(Long.valueOf(fireEquipId));
return false; if (equipment.get() != null) {
} String fireEquipNamePrefix = equipment.get().getName().substring(0, 2);
if (StringUtils.isBlank(type)) { List<String> fireEquipIdList = equipmentSpecificMapper.getFireEquipIdsByNamePrefix(fireEquipNamePrefix);
type = TYPE; String[] strings = fireEquipIdList.toArray(new String[fireEquipIdList.size()]);
} // 获取消防设备id列表
if (StringUtils.isBlank(value)) { fireEquipments = equipmentFireEquipmentService.findFireEquipmentIdsByEquipmentId(strings);
value = VALUE;
}
if (StringUtils.isNotBlank(equipmentId)) {
// 1. 查询重点设备绑定的消防设备
List<EquipmentFireEquipment> list = null;
if (StringUtils.isBlank(equipSpeCode)) {
if (StringUtils.isBlank(equipCode)) {
list = equipmentFireEquipmentService.findByEquipmentId(Long.parseLong(equipmentId));
} else {
list = equipmentFireEquipmentService.findByEquipIdAndEquipCodeIn(Long.parseLong(equipmentId), equipCode.split(","));
} }
} else { } else {
list = equipmentFireEquipmentService.findByEquipIdAndEquipSpeCodeIn(Long.parseLong(equipmentId), equipSpeCode.split(",")); String[] fireEquipIds = new String[]{fireEquipId};
// 获取消防设备id列表
fireEquipments = equipmentFireEquipmentService.findFireEquipmentIdsByEquipmentId(fireEquipIds);
} }
PlanStepJsonVO vo = result.stream().filter(x -> x.getIndex() == index).collect(Collectors.toList()).get(0);
List<ConditionVO> list = vo.getCondition();
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
List<Long> equipSpecificIdList = list.stream().map(EquipmentFireEquipment::getFireEquipmentId).collect(Collectors.toList()); List<PlanMessage> planMessages = equipmentSpecificIndexService.getEquipIndexAndValue(list, fireEquipments, vo.getOutAndOr());
// 2 获取消防设备满足条件的集合 int resultSize = planMessages.size();
if (StringUtils.isNotBlank(indexKeys)) { if (0 < resultSize) {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(equipSpecificIdList, null, null, indexKeys.split(","), value); List<PlanMessage> messages = planMessages.stream().map(x -> {
} else { PlanMessage planMessage = new PlanMessage();
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(equipSpecificIdList, null, null, null, value); Bean.copyExistPropertis(x, planMessage);
planMessage.setBatchNo(String.valueOf(map.get("batchNo")));
planMessage.setStepCode(vo.getStepCode());
planMessage.setStepIndex(vo.getIndex());
return planMessage;
}).collect(Collectors.toList());
planMessageDao.saveAll(messages);
} }
} return 0 < resultSize;
} else { } else {
// 不存在重点设备,直接查消防设备 return false;
if (StringUtils.isNotBlank(equipSpeCode)) {
if (StringUtils.isNotBlank(indexKeys)) {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(null, null, equipSpeCode.split(","), indexKeys.split(","), value);
} else {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(null, null, equipSpeCode.split(","), null, value);
}
} else if (StringUtils.isNotBlank(equipCode)) {
if (StringUtils.isNotBlank(indexKeys)) {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(null, equipCode.split(","), null, indexKeys.split(","), value);
} else {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(null, equipCode.split(","), null, null, value);
}
}
}
if (!CollectionUtils.isEmpty(map)) {
Integer total = Integer.parseInt(map.get("total").toString());
Integer count = Integer.parseInt(map.get("count").toString());
if (SqlKeyWordEnum.AND.getKey().equalsIgnoreCase(type)) {
return total.equals(count);
} else if (SqlKeyWordEnum.OR.getKey().equalsIgnoreCase(type)) {
return count != 0;
} }
} }
return false; return false;
......
...@@ -3,8 +3,10 @@ package com.yeejoin.amos.fas.business.service.impl; ...@@ -3,8 +3,10 @@ package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificIndexMapper; import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificIndexMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PollPointMapper; import com.yeejoin.amos.fas.business.dao.mapper.PollPointMapper;
import com.yeejoin.amos.fas.business.service.intfc.EquipmentSpecificIndexService; import com.yeejoin.amos.fas.business.service.intfc.EquipmentSpecificIndexService;
import com.yeejoin.amos.fas.business.vo.ConditionVO;
import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo; import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo;
import com.yeejoin.amos.fas.business.vo.PollPointVo; import com.yeejoin.amos.fas.business.vo.PollPointVo;
import com.yeejoin.amos.fas.dao.entity.PlanMessage;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -57,4 +59,9 @@ public class EquipmentSpecificIndexServiceImpl implements EquipmentSpecificIndex ...@@ -57,4 +59,9 @@ public class EquipmentSpecificIndexServiceImpl implements EquipmentSpecificIndex
public Map<String, Object> countEquipIndexAndValueOfNum(List<Long> equipSpecificIdList, String[] equipCodes, String[] equipSpeCodes, String[] indexKeys, String value) { public Map<String, Object> countEquipIndexAndValueOfNum(List<Long> equipSpecificIdList, String[] equipCodes, String[] equipSpeCodes, String[] indexKeys, String value) {
return equipmentSpecificIndexMapper.countEquipIndexAndValueOfNum(equipSpecificIdList, equipCodes, equipSpeCodes, indexKeys, value); return equipmentSpecificIndexMapper.countEquipIndexAndValueOfNum(equipSpecificIdList, equipCodes, equipSpeCodes, indexKeys, value);
} }
@Override
public List<PlanMessage> getEquipIndexAndValue(List<ConditionVO> list, List<Long> fireEquipments, String outAndOr) {
return equipmentSpecificIndexMapper.getEquipIndexAndValue(list, fireEquipments, outAndOr);
}
} }
\ No newline at end of file
package com.yeejoin.amos.fas.business.service.intfc; package com.yeejoin.amos.fas.business.service.intfc;
import com.yeejoin.amos.fas.business.vo.ConditionVO;
import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo; import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo;
import com.yeejoin.amos.fas.dao.entity.PlanMessage;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -21,4 +23,6 @@ public interface EquipmentSpecificIndexService { ...@@ -21,4 +23,6 @@ public interface EquipmentSpecificIndexService {
List<EquipmentSpecificIndexVo> getInitAlarm(String value, String nameKeys, String status); List<EquipmentSpecificIndexVo> getInitAlarm(String value, String nameKeys, String status);
Map<String, Object> countEquipIndexAndValueOfNum(List<Long> equipSpecificIdList, String[] equipCodes, String[] equipSpeCodes, String[] indexKeys, String value); Map<String, Object> countEquipIndexAndValueOfNum(List<Long> equipSpecificIdList, String[] equipCodes, String[] equipSpeCodes, String[] indexKeys, String value);
List<PlanMessage> getEquipIndexAndValue(List<ConditionVO> list, List<Long> fireEquipments, String outAndOr);
} }
\ No newline at end of file
...@@ -22,5 +22,7 @@ public interface IEquipmentFireEquipmentService { ...@@ -22,5 +22,7 @@ public interface IEquipmentFireEquipmentService {
Object automaticExecute(String equipmentId, String equipCode, String equipSpeCode, String type, String indexKeys, String value); Object automaticExecute(String equipmentId, String equipCode, String equipSpeCode, String type, String indexKeys, String value);
Object automaticExecutePoint(String equipmentId, String equipCode, String equipSpeCode, String type, String indexKeys, String value, String index); Object automaticExecutePoint(Integer index);
List<Long> findFireEquipmentIdsByEquipmentId(String[] equipmentIds);
} }
package com.yeejoin.amos.fas.business.vo;
import lombok.Data;
/**
* @author keyong
* @title: ConditionVO
* <pre>
* @description: TODO
* </pre>
* @date 2023/3/8 16:12
*/
@Data
public class ConditionVO {
private String equipName;
private String equipCode;
private String equipSpeName;
private String equipSpeCode;
private String equipSpeIndexKey;
private String standardValue;
private String inAndOr;
}
...@@ -26,12 +26,12 @@ public class PlanStepJsonVO { ...@@ -26,12 +26,12 @@ public class PlanStepJsonVO {
/** /**
* 进度索引 * 进度索引
*/ */
private int index; private Integer index;
/** /**
* 节点物联动作判断条件 * 节点物联动作判断条件
*/ */
private List condition; private List<ConditionVO> condition;
/** /**
* 节点物联设备指标之间关系 * 节点物联设备指标之间关系
......
...@@ -132,4 +132,8 @@ ...@@ -132,4 +132,8 @@
<select id="getLastBatchNo" resultType="java.lang.String"> <select id="getLastBatchNo" resultType="java.lang.String">
select batch_no as batchNo from c_plan_operation_record where is_delete = 0 order by create_date desc limit 1 select batch_no as batchNo from c_plan_operation_record where is_delete = 0 order by create_date desc limit 1
</select> </select>
<select id="getLatestFireEquipId" resultType="map">
select fire_equipment_id AS fireEquipId, batch_no AS batchNo from c_plan_operation_record where is_delete = 0 order by create_date desc limit 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -292,4 +292,22 @@ ...@@ -292,4 +292,22 @@
ORDER BY create_date DESC ORDER BY create_date DESC
LIMIT 1 LIMIT 1
</select> </select>
<select id="getFireEquipIdsByNamePrefix" resultType="java.lang.String">
SELECT
f.id
FROM
f_equipment f
<where>
-- 由于模糊查询时若取前两个字极I会把极II的也会查出来,所以在此处进行处理
<choose>
<when test="namePrefix != null and namePrefix != '' and namePrefix == '极II'">
f.name like CONCAT(#{namePrefix}, '%')
</when>
<otherwise>
f.name not like CONCAT('极II', '%')
</otherwise>
</choose>
</where>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -130,4 +130,42 @@ ...@@ -130,4 +130,42 @@
</if> </if>
</where> </where>
</select> </select>
<select id="getEquipIndexAndValue" resultType="com.yeejoin.amos.fas.dao.entity.PlanMessage">
SELECT
es.name AS equipName,
esi.equipment_index_key AS indexKey,
esi.equipment_index_name AS indexName,
esi.`value` AS indexValue,
(CASE esi.`value` WHEN 'true' THEN '是' WHEN 'false' THEN '否' END) AS indexValueDesc,
esi.update_date AS indexCreateTime
FROM
`wl_equipment_specific_index` esi
LEFT JOIN wl_equipment_specific es ON esi.equipment_specific_id = es.id
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
<where>
<choose>
<when test = "outAndOr != null and outAndOr != '' and outAndOr == 'and'">
<if test="list != null and list.size() > 0">
<foreach collection="list" item="item" index="index" open="(" close=")" separator="and">
esi.equipment_index_key = #{item.equipSpeIndexKey} and esi.`value` = #{item.standardValue}
</foreach>
</if>
</when>
<otherwise>
<if test="list != null and list.size() > 0">
<foreach collection="list" item="item" index="index" open="(" close=")" separator="or">
esi.equipment_index_key = #{item.equipSpeIndexKey} and esi.`value` = #{item.standardValue}
</foreach>
</if>
</otherwise>
</choose>
<if test="fireEquipments != null and fireEquipments.size() > 0">
AND esi.equipment_specific_id IN
<foreach collection="fireEquipments" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -39,12 +39,12 @@ ...@@ -39,12 +39,12 @@
"index": 3, "index": 3,
"condition": [ "condition": [
{ {
"equipName": "ONL-直流电源", "equipName": "开关",
"equipCode": "92100300MNL44", "equipCode": "590000003EB44",
"equipSpeName": "ONL-直流电源", "equipSpeName": "",
"equipSpeCode": "SBMC0001", "equipSpeCode": "",
"equipSpeIndexKey": "ONL_DCPower_Fault", "equipSpeIndexKey": "Running_Alarm",
"standardValue": "true", "standardValue": "false",
"inAndOr": "and" "inAndOr": "and"
} }
], ],
...@@ -61,11 +61,11 @@ ...@@ -61,11 +61,11 @@
"index": 4, "index": 4,
"condition": [ "condition": [
{ {
"equipName": "ONL-直流电源", "equipName": "排油阀",
"equipCode": "92100300MNL44", "equipCode": "92100400VWE44",
"equipSpeName": "ONL-直流电源", "equipSpeName": "",
"equipSpeCode": "SBMC0001", "equipSpeCode": "",
"equipSpeIndexKey": "ONL_DCPower_Fault", "equipSpeIndexKey": "ONL_DrainOilValve_Open",
"standardValue": "true", "standardValue": "true",
"inAndOr": "and" "inAndOr": "and"
} }
...@@ -83,11 +83,11 @@ ...@@ -83,11 +83,11 @@
"index": 5, "index": 5,
"condition": [ "condition": [
{ {
"equipName": "ONL-直流电源", "equipName": "主机",
"equipCode": "92100300MNL44", "equipCode": "92030100TGX44",
"equipSpeName": "ONL-直流电源", "equipSpeName": "",
"equipSpeCode": "SBMC0001", "equipSpeCode": "",
"equipSpeIndexKey": "ONL_DCPower_Fault", "equipSpeIndexKey": "CAFS_CompAirFoamHost_Outfire",
"standardValue": "true", "standardValue": "true",
"inAndOr": "and" "inAndOr": "and"
} }
...@@ -105,11 +105,11 @@ ...@@ -105,11 +105,11 @@
"index": 6, "index": 6,
"condition": [ "condition": [
{ {
"equipName": "ONL-直流电源", "equipName": "CAFS消防炮",
"equipCode": "92100300MNL44", "equipCode": "92032200BUX44",
"equipSpeName": "ONL-直流电源", "equipSpeName": "",
"equipSpeCode": "SBMC0001", "equipSpeCode": "",
"equipSpeIndexKey": "ONL_DCPower_Fault", "equipSpeIndexKey": "CAFS_GunValve_Open",
"standardValue": "true", "standardValue": "true",
"inAndOr": "and" "inAndOr": "and"
} }
...@@ -127,13 +127,13 @@ ...@@ -127,13 +127,13 @@
"index": 7, "index": 7,
"condition": [ "condition": [
{ {
"equipName": "ONL-直流电源", "equipName": "消防泵",
"equipCode": "92100300MNL44", "equipCode": "920106007GV44",
"equipSpeName": "ONL-直流电源", "equipSpeName": "",
"equipSpeCode": "SBMC0001", "equipSpeCode": "",
"equipSpeIndexKey": "ONL_DCPower_Fault", "equipSpeIndexKey": "FHS_FirePump_Start",
"standardValue": "true", "standardValue": "true",
"inAndOr": "and" "inAndOr": "or"
} }
], ],
"outAndOr": "and", "outAndOr": "and",
...@@ -159,12 +159,12 @@ ...@@ -159,12 +159,12 @@
"index": 9, "index": 9,
"condition": [ "condition": [
{ {
"equipName": "ONL-直流电源", "equipName": "开关",
"equipCode": "92100300MNL44", "equipCode": "590000003EB44",
"equipSpeName": "ONL-直流电源", "equipSpeName": "",
"equipSpeCode": "SBMC0001", "equipSpeCode": "",
"equipSpeIndexKey": "ONL_DCPower_Fault", "equipSpeIndexKey": "Running_Alarm",
"standardValue": "true", "standardValue": "false",
"inAndOr": "and" "inAndOr": "and"
} }
], ],
...@@ -181,12 +181,12 @@ ...@@ -181,12 +181,12 @@
"index": 10, "index": 10,
"condition": [ "condition": [
{ {
"equipName": "ONL-直流电源", "equipName": "阀冷系统主机",
"equipCode": "92100300MNL44", "equipCode": "59000000H9G44",
"equipSpeName": "ONL-直流电源", "equipSpeName": "",
"equipSpeCode": "SBMC0001", "equipSpeCode": "",
"equipSpeIndexKey": "ONL_DCPower_Fault", "equipSpeIndexKey": "normal_running_state",
"standardValue": "true", "standardValue": "false",
"inAndOr": "and" "inAndOr": "and"
} }
], ],
...@@ -203,12 +203,12 @@ ...@@ -203,12 +203,12 @@
"index": 11, "index": 11,
"condition": [ "condition": [
{ {
"equipName": "ONL-直流电源", "equipName": "AIRCS-风机",
"equipCode": "92100300MNL44", "equipCode": "92230600UH244",
"equipSpeName": "ONL-直流电源", "equipSpeName": "",
"equipSpeCode": "SBMC0001", "equipSpeCode": "",
"equipSpeIndexKey": "ONL_DCPower_Fault", "equipSpeIndexKey": "AIRCS_Fan_Start",
"standardValue": "true", "standardValue": "false",
"inAndOr": "and" "inAndOr": "and"
} }
], ],
...@@ -235,11 +235,11 @@ ...@@ -235,11 +235,11 @@
"index": 13, "index": 13,
"condition": [ "condition": [
{ {
"equipName": "ONL-直流电源", "equipName": "地刀",
"equipCode": "92100300MNL44", "equipCode": "59000000SAT44",
"equipSpeName": "ONL-直流电源", "equipSpeName": "",
"equipSpeCode": "SBMC0001", "equipSpeCode": "",
"equipSpeIndexKey": "ONL_DCPower_Fault", "equipSpeIndexKey": "Running_Alarm",
"standardValue": "true", "standardValue": "true",
"inAndOr": "and" "inAndOr": "and"
} }
......
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