Commit dae9c3a5 authored by xukaiqiang's avatar xukaiqiang

bug

parent d78bf1ff
......@@ -149,11 +149,9 @@ public class RiskModelController extends BaseController {
try {
Long[] fmeaIds = param.getFmeaIds();
fmeaService.deleteFmea(fmeaIds);
if (fmeaIds.length > 0) {
if (fmeaIds.length > 0 && param.getRiskSourceId() != null) {
RsDataQueue rsDataQueue = RsDataQueue.getInstance();
for (Long fmeaId : fmeaIds) {
rsDataQueue.addUpdateMessage(fmeaId);
}
rsDataQueue.addDeleteMessage(param.getRiskSourceId());
}
return CommonResponseUtil.success();
} catch (Exception e) {
......
......@@ -407,6 +407,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
if (!CollectionUtils.isEmpty(returnList)) {
fmeaEquipmentPointMapper.saveBatch(returnList);
RsDataQueue rsDataQueue = RsDataQueue.getInstance();
rsDataQueue.addAbnormalMessage(fmeaId);
}
return returnList;
}
......@@ -427,6 +429,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
if (!CollectionUtils.isEmpty(returnList)) {
fmeaPointInputitemMapper.saveBatch(returnList);
RsDataQueue rsDataQueue = RsDataQueue.getInstance();
rsDataQueue.addAbnormalMessage(fmeaId);
}
return returnList;
}
......@@ -1386,7 +1390,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
/**
* 修改、添加、删除f_fmea导致rpn、rpni改变
* 修改、添加导致rpn、rpni改变
*/
@Override
public void notifyFmeaFromUpdate(Long fmeaId) {
......@@ -1509,12 +1513,20 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
/**
* fmea的更新导致rpn、rpni的值改变
*/
private void notifyRiskSource(Long riskSourceId) {
@Override
public void notifyRiskSource(Long riskSourceId) {
RiskSource riskSource = iRiskSourceDao.findById(riskSourceId);
if (riskSource == null) {
return;
}
List<Fmea> fmeas = fmeaMapper.listByRiskSourceId(riskSourceId);
if (CollectionUtils.isEmpty(fmeas)) {
BigDecimal resetValue = new BigDecimal("0");
riskSource.setRpn(resetValue);
riskSource.setRpni(resetValue);
riskSource.setRiskLevelId(0L);
riskSourceMapper.updateRpn(riskSource);
}
BigDecimal maxSidValue = new BigDecimal("0");
BigDecimal maxDidValue = new BigDecimal("0");
BigDecimal totalOidValue = new BigDecimal("0");
......@@ -1537,7 +1549,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
count++;
}
}
if(count==0){
if (count == 0) {
return;
}
BigDecimal averageOidValue = totalOidValue.divide(BigDecimal.valueOf(count));
......
......@@ -110,4 +110,6 @@ public interface IRiskSourceService {
void notifyFmeaFromAbnormal(Long fmeaId);
void notifyFmeaFromUpdate(Long fmeaId);
void notifyRiskSource(Long riskSourceId);
}
......@@ -2,21 +2,21 @@ package com.yeejoin.amos.fas.client.invoke;
public class FmeaMessage {
private Long fmeaId;
private Long handId;
private String norifyFrom;
public FmeaMessage(Long fmeaId, String norifyFrom) {
this.fmeaId = fmeaId;
public FmeaMessage(Long handId, String norifyFrom) {
this.handId = handId;
this.norifyFrom = norifyFrom;
}
public Long getFmeaId() {
return fmeaId;
public Long getHandId() {
return handId;
}
public void setFmeaId(Long fmeaId) {
this.fmeaId = fmeaId;
public void setHandId(Long handId) {
this.handId = handId;
}
public String getNorifyFrom() {
......
......@@ -56,6 +56,10 @@ public class RsDataQueue {
blockingQueue.add(new FmeaMessage(fmeaId, "abnormal"));
}
public void addDeleteMessage(Long riskSourceId) {
blockingQueue.add(new FmeaMessage(riskSourceId, "delete"));
}
Runnable task_runnable = new Runnable() {
public void run() {
while (true) {
......@@ -63,11 +67,13 @@ public class RsDataQueue {
FmeaMessage fmeaMessage = blockingQueue.take();
if (riskSourceService != null) {
String from = fmeaMessage.getNorifyFrom();
Long fmeaId = fmeaMessage.getFmeaId();
Long handId = fmeaMessage.getHandId();
if (from.equals("abnormal")) {
riskSourceService.notifyFmeaFromAbnormal(fmeaId);
riskSourceService.notifyFmeaFromAbnormal(handId);
} else if (from.equals("update")) {
riskSourceService.notifyFmeaFromUpdate(fmeaId);
riskSourceService.notifyFmeaFromUpdate(handId);
} else if (from.equals("delete")) {
riskSourceService.notifyRiskSource(handId);
}
}
} catch (Exception e) {
......
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