Commit ef154a1d authored by 万伟's avatar 万伟

规则服务修改

parent 54426991
...@@ -21,6 +21,15 @@ public class JpushMsgContentBo { ...@@ -21,6 +21,15 @@ public class JpushMsgContentBo {
* 巡检状态 * 巡检状态
*/ */
private String checkStatus; private String checkStatus;
public String getCheckStatus() {
return checkStatus;
}
public void setCheckStatus(String checkStatus) {
this.checkStatus = checkStatus;
}
/** /**
* 执行日期 * 执行日期
*/ */
......
...@@ -19,6 +19,15 @@ public class MsgParamBo { ...@@ -19,6 +19,15 @@ public class MsgParamBo {
private BigDecimal rpn; private BigDecimal rpn;
private String level; private String level;
private String relationName; private String relationName;
private String checkStatus;
public String getCheckStatus() {
return checkStatus;
}
public void setCheckStatus(String checkStatus) {
this.checkStatus = checkStatus;
}
public String getToke() { public String getToke() {
return toke; return toke;
......
...@@ -564,7 +564,7 @@ public class RiskSourceController extends BaseController { ...@@ -564,7 +564,7 @@ public class RiskSourceController extends BaseController {
} }
//@Authorization(ingore = true) // @Authorization(ingore = true)
@ApiOperation(httpMethod = "PUT", value = "上传巡检数据", notes = "上传巡检数据") @ApiOperation(httpMethod = "PUT", value = "上传巡检数据", notes = "上传巡检数据")
@RequestMapping(value = "/data/patroldata", produces = "application/json;charset=UTF-8", method = RequestMethod.PUT) @RequestMapping(value = "/data/patroldata", produces = "application/json;charset=UTF-8", method = RequestMethod.PUT)
public CommonResponse postPatrolData(@RequestBody ProtalDataRo protalData) throws Exception { public CommonResponse postPatrolData(@RequestBody ProtalDataRo protalData) throws Exception {
......
...@@ -76,4 +76,6 @@ public interface FireEquipMapper extends BaseMapper { ...@@ -76,4 +76,6 @@ public interface FireEquipMapper extends BaseMapper {
Long queryEquimentRelationCount( Long queryEquimentRelationCount(
@Param("equipmentId") String equipmentId, @Param("equipmentId") String equipmentId,
@Param("fname") String fname); @Param("fname") String fname);
FireEquipmentEntity findById(@Param("id") Long id);
} }
...@@ -555,17 +555,30 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -555,17 +555,30 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if(!CollectionUtils.isEmpty(userIds)){ if(!CollectionUtils.isEmpty(userIds)){
users = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds)); users = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
} }
Map<String, String> userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName)); // Map<String, String> userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName));
Map<String, String> userMap = new HashMap<>();
if(users!=null){
userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName));
}
List<DepartmentModel> depts = new ArrayList<>(); List<DepartmentModel> depts = new ArrayList<>();
if(!CollectionUtils.isEmpty(deptIds)){ if(!CollectionUtils.isEmpty(deptIds)){
depts = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIds)); depts = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIds));
} }
Map<Long, String > deptMap = depts.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr,DepartmentModel::getDepartmentName)); // Map<Long, String > deptMap = depts.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr,DepartmentModel::getDepartmentName));
content.forEach(e -> { Map<Long, String> deptMap = new HashMap<>();
e.put("userName",userMap.get(e.get("userId"))); if(depts!=null){
e.put("deptName",deptMap.get(e.get("deptId"))); deptMap = depts.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr,DepartmentModel::getDepartmentName));
e.put("tel",userMap.get(String.valueOf(e.get("deptId")+"tel"))); }
}); // content.forEach(e -> {
// e.put("userName",userMap.get(e.get("userId")));
// e.put("deptName",deptMap.get(e.get("deptId")));
// e.put("tel",userMap.get(String.valueOf(e.get("deptId")+"tel")));
// });
for(int i=0;i<content.size();i++){
content.get(i).put("userName",userMap.get(content.get(i).get("userId")));
content.get(i).put("deptName",deptMap.get(content.get(i).get("deptId")));
content.get(i).put("tel",userMap.get(String.valueOf(content.get(i).get("deptId")+"tel")));
}
} }
return new PageImpl<>(content, pageable, total); return new PageImpl<>(content, pageable, total);
} }
...@@ -589,11 +602,11 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -589,11 +602,11 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Override @Override
@Async @Async
public void processProtalData(String toke, String product, String appKey, ProtalDataRo protalData) { public void processProtalData(String toke, String product, String appKey, ProtalDataRo protalData) {
if (!CollectionUtils.isEmpty(protalData.getItems())) { if (!CollectionUtils.isEmpty(protalData.getPointInputitems())) {
Long pointId = protalData.getId(); Long pointId = protalData.getId();
List<Long> inputIds = Lists.newArrayList(); List<Long> inputIds = Lists.newArrayList();
Map<Long, CheckInputItemRo> map = Maps.newHashMap(); Map<Long, CheckInputItemRo> map = Maps.newHashMap();
for (CheckInputItemRo checkInputItemRo : protalData.getItems()) { for (CheckInputItemRo checkInputItemRo : protalData.getPointInputitems()) {
inputIds.add(checkInputItemRo.getPointInputitemId()); inputIds.add(checkInputItemRo.getPointInputitemId());
map.put(checkInputItemRo.getPointInputitemId(), checkInputItemRo); map.put(checkInputItemRo.getPointInputitemId(), checkInputItemRo);
} }
...@@ -936,12 +949,15 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -936,12 +949,15 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} else if (param.getState().equals("false")) { } else if (param.getState().equals("false")) {
state = 0; state = 0;
} }
if (state != null) { if (state != null) {
if (ids.size() > 0) { if (ids.size() > 0) {
fmeaEquipmentPointMapper.updateStateByIds(state, ids); fmeaEquipmentPointMapper.updateStateByIds(state, ids);
} }
final Integer st=state;
String monitor=fireEquipMapper.findById(fireEquipPointMapper.getByCode(param.getPointCode()).getFireEquipmentId()).getName();
RsDataQueue rsDataQueue = RsDataQueue.getInstance(); RsDataQueue rsDataQueue = RsDataQueue.getInstance();
fmeaIds.forEach(fmeaId -> rsDataQueue.addEquipmentMessage(fmeaId,param.getMonitor())); fmeaIds.forEach(fmeaId -> rsDataQueue.addEquipmentMessage(fmeaId,monitor,st));
} }
} }
...@@ -1144,6 +1160,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1144,6 +1160,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
jpushMsgContentBo.setLevel(msgParam.getLevel()); jpushMsgContentBo.setLevel(msgParam.getLevel());
jpushMsgContentBo.setRelationName(msgParam.getRelationName()); jpushMsgContentBo.setRelationName(msgParam.getRelationName());
jpushMsgContentBo.setRpn(msgParam.getRpn()); jpushMsgContentBo.setRpn(msgParam.getRpn());
jpushMsgContentBo.setCheckStatus(msgParam.getCheckStatus());
msgBo.setTarget(this.getJpushTarget(msgParam)); msgBo.setTarget(this.getJpushTarget(msgParam));
msgBo.setMsg(jpushMsgContentBo); msgBo.setMsg(jpushMsgContentBo);
} }
...@@ -1190,7 +1207,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1190,7 +1207,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Override @Override
public void notifyFmeaFromAbnormal( public void notifyFmeaFromAbnormal(
String toke, String product, String appKey, String toke, String product, String appKey,
Long fmeaId, String notifyType,String userName, String relationName) { Long fmeaId, String notifyType,String userName, String relationName, String checkStatus) {
Fmea fmea = fmeaMapper.getById(fmeaId); Fmea fmea = fmeaMapper.getById(fmeaId);
if (fmea == null) { if (fmea == null) {
return; return;
...@@ -1226,7 +1243,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1226,7 +1243,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
msgParamBo.setLevel(newLevel.getName()); msgParamBo.setLevel(newLevel.getName());
msgParamBo.setUserName(userName); msgParamBo.setUserName(userName);
msgParamBo.setNotifyType(notifyType); msgParamBo.setNotifyType(notifyType);
msgParamBo.setCheckStatus(checkStatus);
msgParamBo.setRelationName(relationName); msgParamBo.setRelationName(relationName);
msgParamBo.setRpn(rpn);
jpushMsgBo = this.getJushMessageInfo(msgParamBo); jpushMsgBo = this.getJushMessageInfo(msgParamBo);
} }
//1.3.更新fmea的rpn、风险等级及newOid //1.3.更新fmea的rpn、风险等级及newOid
...@@ -1294,6 +1313,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1294,6 +1313,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if (rpnValueBo.isEmpty()) { if (rpnValueBo.isEmpty()) {
return; return;
} }
Fmea caluFmea=fmeaMapper.getById(fmeaId);
Integer rpnDiffer=caluFmea.getRpn().intValue()-caluFmea.getRpni().intValue();
String checkStatus=jpushMsgBo.getMsg().getCheckStatus();
BigDecimal rpn = rpnValueBo.getRpn(); BigDecimal rpn = rpnValueBo.getRpn();
BigDecimal rpni = rpnValueBo.getRpni(); BigDecimal rpni = rpnValueBo.getRpni();
List<RiskLevel> levels = riskLevelDao.findAll(); List<RiskLevel> levels = riskLevelDao.findAll();
...@@ -1313,9 +1335,11 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1313,9 +1335,11 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
//3.更新父节点rpn、rpni、风险等级 //3.更新父节点rpn、rpni、风险等级
this.updateParentRpn(riskSource.getParentId()); this.updateParentRpn(riskSource.getParentId());
//4.极光推送给手机客户端 //4.极光推送给手机客户端
if(notifyType=="recovery"||notifyType=="fmeaUpdate"||(notifyType=="alarm"&&rpnDiffer>0)||(notifyType=="patrol"&&rpnDiffer>0&&checkStatus.equals("不合格")))
jpushRiskSourceMessage(jpushMsgBo); jpushRiskSourceMessage(jpushMsgBo);
//5.规则告警(消息)TODO //5.规则告警(消息)TODO
notifyRule(riskSourceId, rpn, rpni, notifyType,changeType, jpushMsgBo.getMsg()); if(notifyType=="recovery"||notifyType=="fmeaUpdate"||(notifyType=="alarm"&&rpnDiffer>0)||(notifyType=="patrol"&&rpnDiffer>0&&checkStatus.equals("不合格")))
notifyRule(riskSourceId, rpn, rpni, notifyType,changeType, jpushMsgBo.getMsg());
//6.通知全景监控屏幕数据刷新 //6.通知全景监控屏幕数据刷新
iDataRefreshService.refreshViewData(DataRefreshTypeEum.rpn.getCode()); iDataRefreshService.refreshViewData(DataRefreshTypeEum.rpn.getCode());
} }
......
...@@ -109,7 +109,7 @@ public interface IRiskSourceService { ...@@ -109,7 +109,7 @@ public interface IRiskSourceService {
Integer getChildTypeByPid(Long riskSourceId); Integer getChildTypeByPid(Long riskSourceId);
void notifyFmeaFromAbnormal(String toke,String product,String appKey,Long fmeaId, String notifyType,String userName, String relationName); void notifyFmeaFromAbnormal(String toke,String product,String appKey,Long fmeaId, String notifyType,String userName, String relationName,String checkStatus);
void notifyFmeaFromUpdate(String toke,String product,String appKey,Long fmeaId, String nofityType,String userName); void notifyFmeaFromUpdate(String toke,String product,String appKey,Long fmeaId, String nofityType,String userName);
......
...@@ -49,6 +49,16 @@ public class ProtalDataRo extends BasicsRo { ...@@ -49,6 +49,16 @@ public class ProtalDataRo extends BasicsRo {
private List<CheckInputItemRo> items; private List<CheckInputItemRo> items;
private List<CheckInputItemRo> pointInputitems;
public List<CheckInputItemRo> getPointInputitems() {
return pointInputitems;
}
public void setPointInputitems(List<CheckInputItemRo> pointInputitems) {
this.pointInputitems = pointInputitems;
}
public List<CheckInputItemRo> getItems() { public List<CheckInputItemRo> getItems() {
return items; return items;
} }
......
...@@ -78,6 +78,15 @@ public class RsDataQueue { ...@@ -78,6 +78,15 @@ public class RsDataQueue {
blockingQueue.add(new FmeaMessage(fmeaId, TriggerRpnChangeTypeEum.alarm.getCode(),"",equipmentName,"")); blockingQueue.add(new FmeaMessage(fmeaId, TriggerRpnChangeTypeEum.alarm.getCode(),"",equipmentName,""));
} }
public void addEquipmentMessage(Long fmeaId,String equipmentName,Integer state) {
if(state==0){
blockingQueue.add(new FmeaMessage(fmeaId, TriggerRpnChangeTypeEum.alarmRecovery.getCode(),"",equipmentName,""));
}else{
blockingQueue.add(new FmeaMessage(fmeaId, TriggerRpnChangeTypeEum.alarm.getCode(),"",equipmentName,""));
}
}
public void addDeleteMessage(Long riskSourceId) { public void addDeleteMessage(Long riskSourceId) {
blockingQueue.add(new FmeaMessage(riskSourceId, TriggerRpnChangeTypeEum.fmeaDelete.getCode())); blockingQueue.add(new FmeaMessage(riskSourceId, TriggerRpnChangeTypeEum.fmeaDelete.getCode()));
} }
...@@ -105,12 +114,19 @@ public class RsDataQueue { ...@@ -105,12 +114,19 @@ public class RsDataQueue {
Long handId = fmeaMessage.getHandId(); Long handId = fmeaMessage.getHandId();
String userName = fmeaMessage.getUserName(); String userName = fmeaMessage.getUserName();
String relationName = fmeaMessage.getRelationName(); String relationName = fmeaMessage.getRelationName();
String checkStatus =null;
if(fmeaMessage.getCheckStatus()!=null){
checkStatus =(fmeaMessage.getCheckStatus().equals("1"))?"合格":"不合格";
}
if (from.equals(TriggerRpnChangeTypeEum.patrol.getCode())) { if (from.equals(TriggerRpnChangeTypeEum.patrol.getCode())) {
//巡检不合格通知 //巡检不合格通知
riskSourceService.notifyFmeaFromAbnormal(toke.getToke(), toke.getProduct(), toke.getAppKey(), handId, from, userName,relationName); riskSourceService.notifyFmeaFromAbnormal(toke.getToke(), toke.getProduct(), toke.getAppKey(), handId, from, userName,relationName,checkStatus);
} else if (from.equals(TriggerRpnChangeTypeEum.alarm.getCode())) { } else if (from.equals(TriggerRpnChangeTypeEum.alarm.getCode())) {
//设备告警 //设备告警
riskSourceService.notifyFmeaFromAbnormal(toke.getToke(), toke.getProduct(), toke.getAppKey(), handId, from, userName,relationName); riskSourceService.notifyFmeaFromAbnormal(toke.getToke(), toke.getProduct(), toke.getAppKey(), handId, from, userName,relationName,checkStatus);
} else if (from.equals(TriggerRpnChangeTypeEum.alarmRecovery.getCode())) {
//设备告警恢复
riskSourceService.notifyFmeaFromAbnormal(toke.getToke(), toke.getProduct(), toke.getAppKey(), handId, from, userName,relationName,checkStatus);
} else if (from.equals(TriggerRpnChangeTypeEum.fmeaUpdate.getCode())) { } else if (from.equals(TriggerRpnChangeTypeEum.fmeaUpdate.getCode())) {
//危险因素评价修改通知 //危险因素评价修改通知
riskSourceService.notifyFmeaFromUpdate(toke.getToke(), toke.getProduct(), toke.getAppKey(), handId, from, userName); riskSourceService.notifyFmeaFromUpdate(toke.getToke(), toke.getProduct(), toke.getAppKey(), handId, from, userName);
......
...@@ -499,4 +499,8 @@ ...@@ -499,4 +499,8 @@
AND fe.`name` like '%${fname}%' AND fe.`name` like '%${fname}%'
</if> </if>
</select> </select>
<select id="findById" resultType="com.yeejoin.amos.fas.business.entity.mybatis.FireEquipmentEntity">
select name from f_fire_equipment where id= #{id}
</select>
</mapper> </mapper>
\ No newline at end of file
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