Commit efe531a8 authored by xukaiqiang's avatar xukaiqiang

合格和不告警

parent 25ff0bb2
...@@ -4,6 +4,7 @@ import javax.persistence.Column; ...@@ -4,6 +4,7 @@ import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient;
/** /**
...@@ -24,6 +25,8 @@ public class FmeaPointInputitem extends BasicEntity { ...@@ -24,6 +25,8 @@ public class FmeaPointInputitem extends BasicEntity {
@Column(name = "state") @Column(name = "state")
private Integer state; private Integer state;
private Long inputItemId;
public Long getPointInputitemId() { public Long getPointInputitemId() {
return PointInputitemId; return PointInputitemId;
} }
...@@ -47,4 +50,13 @@ public class FmeaPointInputitem extends BasicEntity { ...@@ -47,4 +50,13 @@ public class FmeaPointInputitem extends BasicEntity {
public void setState(Integer state) { public void setState(Integer state) {
this.state = state; this.state = state;
} }
public void setInputItemId(Long inputItemId) {
this.inputItemId = inputItemId;
}
@Transient
public Long getInputItemId() {
return inputItemId;
}
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.service.impl; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.yeejoin.amos.fas.business.constants.FasConstant; import com.yeejoin.amos.fas.business.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.FireEquipMapper; import com.yeejoin.amos.fas.business.dao.mapper.FireEquipMapper;
...@@ -835,18 +836,21 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -835,18 +836,21 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if (!CollectionUtils.isEmpty(protalData.getItems())) { if (!CollectionUtils.isEmpty(protalData.getItems())) {
Long pointId = protalData.getId(); Long pointId = protalData.getId();
List<Long> inputIds = Lists.newArrayList(); List<Long> inputIds = Lists.newArrayList();
Map<Long, CheckInputItemRo> map = Maps.newHashMap();
for (CheckInputItemRo checkInputItemRo : protalData.getItems()) { for (CheckInputItemRo checkInputItemRo : protalData.getItems()) {
inputIds.add(checkInputItemRo.getPointInputitemId()); inputIds.add(checkInputItemRo.getPointInputitemId());
map.put(checkInputItemRo.getPointInputitemId(), checkInputItemRo);
} }
List<FmeaPointInputitem> fmeaPointInputitems = fmeaPointInputitemMapper.listByPointIdAndInputItemIds(pointId, inputIds); List<FmeaPointInputitem> fmeaPointInputitems = fmeaPointInputitemMapper.listByPointIdAndInputItemIds(pointId, inputIds);
Set<Long> fmeaIds = Sets.newHashSet(); Set<Long> fmeaIds = Sets.newHashSet();
List<Long> failIds = Lists.newArrayList(); List<Long> failIds = Lists.newArrayList();
List<Long> successIds = Lists.newArrayList(); List<Long> successIds = Lists.newArrayList();
fmeaPointInputitems.forEach(fmeaPointInputitem -> { fmeaPointInputitems.forEach(fmeaPointInputitem -> {
if (fmeaPointInputitem.getState().equals(2)) { CheckInputItemRo checkInputItemRo = map.get(fmeaPointInputitem.getInputItemId());
if (checkInputItemRo.getStatus().equals(2)) {
failIds.add(fmeaPointInputitem.getId()); failIds.add(fmeaPointInputitem.getId());
fmeaIds.add(fmeaPointInputitem.getFmeaId()); fmeaIds.add(fmeaPointInputitem.getFmeaId());
} else { } else if (checkInputItemRo.getStatus().equals(1)) {
successIds.add(fmeaPointInputitem.getId()); successIds.add(fmeaPointInputitem.getId());
fmeaIds.add(fmeaPointInputitem.getFmeaId()); fmeaIds.add(fmeaPointInputitem.getFmeaId());
} }
...@@ -1221,21 +1225,20 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1221,21 +1225,20 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if (dict != null && dict.getDictCode().equals("alarm_type_trouble")) { if (dict != null && dict.getDictCode().equals("alarm_type_trouble")) {
List<FmeaEquipmentPoint> fmeaEquipmentPoints = fmeaEquipmentPointMapper.listByEquipmentPointId(fireEquipmentPoint.getId()); List<FmeaEquipmentPoint> fmeaEquipmentPoints = fmeaEquipmentPointMapper.listByEquipmentPointId(fireEquipmentPoint.getId());
Set<Long> fmeaIds = Sets.newHashSet(); Set<Long> fmeaIds = Sets.newHashSet();
List<Long> failIds = Lists.newArrayList(); List<Long> ids = Lists.newArrayList();
List<Long> successIds = Lists.newArrayList();
fmeaEquipmentPoints.forEach(fmeaEquipmentPoint -> { fmeaEquipmentPoints.forEach(fmeaEquipmentPoint -> {
if (fmeaEquipmentPoint.getState().equals(2)) { ids.add(fmeaEquipmentPoint.getId());
failIds.add(fmeaEquipmentPoint.getId()); fmeaIds.add(fmeaEquipmentPoint.getFmeaId());
fmeaIds.add(fmeaEquipmentPoint.getFmeaId());
} else {
successIds.add(fmeaEquipmentPoint.getId());
fmeaIds.add(fmeaEquipmentPoint.getFmeaId());
}
}); });
fmeaEquipmentPointMapper.updateStateByIds(1, failIds); if (param.getState().equals("true")) {
fmeaEquipmentPointMapper.updateStateByIds(0, successIds); fmeaEquipmentPointMapper.updateStateByIds(1, ids);
RsDataQueue rsDataQueue = RsDataQueue.getInstance(); RsDataQueue rsDataQueue = RsDataQueue.getInstance();
fmeaIds.forEach(fmeaId -> rsDataQueue.addAbnormalMessage(fmeaId)); fmeaIds.forEach(fmeaId -> rsDataQueue.addAbnormalMessage(fmeaId));
} else if (param.getState().equals("false")) {
fmeaEquipmentPointMapper.updateStateByIds(0, ids);
RsDataQueue rsDataQueue = RsDataQueue.getInstance();
fmeaIds.forEach(fmeaId -> rsDataQueue.addAbnormalMessage(fmeaId));
}
} }
String batchNo = UUID.randomUUID().toString(); String batchNo = UUID.randomUUID().toString();
FireEquimentDataRo ruleData = new FireEquimentDataRo(); FireEquimentDataRo ruleData = new FireEquimentDataRo();
......
...@@ -98,27 +98,22 @@ ...@@ -98,27 +98,22 @@
<select id="listByPointIdAndInputItemIds" resultType="com.yeejoin.amos.fas.dao.entity.FmeaPointInputitem"> <select id="listByPointIdAndInputItemIds" resultType="com.yeejoin.amos.fas.dao.entity.FmeaPointInputitem">
select select
id, a.id,
fmea_id as fmeaId, a.fmea_id as fmeaId,
point_inputitem_id as pointInputitemId, a.point_inputitem_id as pointInputitemId,
state a.state,
b.input_item_id as inputItemId
from from
f_fmea_point_inputitem f_fmea_point_inputitem as a
left join
p_point_inputitem as b on a.point_inputitem_id = b.id
where where
point_inputitem_id in b.point_id = #{pointId}
( and
select b.input_item_id in
id <foreach collection="inputIds" item="item" index="index" separator="," open="(" close=")">
from #{item}
p_point_inputitem </foreach>
where
point_id = #{pointId}
and
input_item_id in
<foreach collection="inputIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
)
</select> </select>
<select id="listFmeaByFmeaId" resultType="com.yeejoin.amos.fas.dao.entity.FmeaPointInputitem"> <select id="listFmeaByFmeaId" resultType="com.yeejoin.amos.fas.dao.entity.FmeaPointInputitem">
......
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