Commit dae9c3a5 authored by xukaiqiang's avatar xukaiqiang

bug

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