Commit f98fa9f3 authored by xukaiqiang's avatar xukaiqiang

bug

parent 845352cf
...@@ -51,6 +51,7 @@ public class RemoteRuleServer { ...@@ -51,6 +51,7 @@ public class RemoteRuleServer {
public Object fireRule(RiskSourceRuleRo riskSourceRuleRo, String packageId) throws Exception { public Object fireRule(RiskSourceRuleRo riskSourceRuleRo, String packageId) throws Exception {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
String data = JSONUtil.toJson(riskSourceRuleRo); String data = JSONUtil.toJson(riskSourceRuleRo);
log.info(data);
map.put("resFact", data); map.put("resFact", data);
map.put("packageId", packageId); map.put("packageId", packageId);
map.put("className", riskSourceRuleRo.getClass().getName()); map.put("className", riskSourceRuleRo.getClass().getName());
...@@ -83,8 +84,10 @@ public class RemoteRuleServer { ...@@ -83,8 +84,10 @@ public class RemoteRuleServer {
* @return * @return
*/ */
public Object fireRuleFlow(BasicsRo resFact, String packageId, String processId) throws Exception { public Object fireRuleFlow(BasicsRo resFact, String packageId, String processId) throws Exception {
String data = JSONUtil.toJson(resFact);
log.info("调用规则请求====================>" + data);
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
map.put("resFact", JSONUtil.toJson(resFact)); map.put("resFact", data);
map.put("packageId", packageId); map.put("packageId", packageId);
map.put("processId", processId); map.put("processId", processId);
map.put("className", resFact.getClass().getName()); map.put("className", resFact.getClass().getName());
...@@ -96,7 +99,6 @@ public class RemoteRuleServer { ...@@ -96,7 +99,6 @@ public class RemoteRuleServer {
headers.setContentType(type); headers.setContentType(type);
headers.add("Accept", MediaType.APPLICATION_JSON.toString()); headers.add("Accept", MediaType.APPLICATION_JSON.toString());
HttpEntity<Map<String, String>> formEntity = new HttpEntity<Map<String, String>>(map, headers); HttpEntity<Map<String, String>> formEntity = new HttpEntity<Map<String, String>>(map, headers);
ResponseEntity responseEntity = restTemplate.exchange(url + "urule/rule/fireRuleFlow", ResponseEntity responseEntity = restTemplate.exchange(url + "urule/rule/fireRuleFlow",
HttpMethod.POST, formEntity, String.class); HttpMethod.POST, formEntity, String.class);
......
...@@ -1487,6 +1487,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1487,6 +1487,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if (fmea == null) { if (fmea == null) {
return; return;
} }
if (fmea.getEvaluationOid() != null && fmea.getEvaluationSid() != null && fmea.getEvaluationDid() != null) {
List<FmeaEquipmentPoint> equipmentPoints = fmeaEquipmentPointMapper.listFmeaByFmeaId(fmeaId); List<FmeaEquipmentPoint> equipmentPoints = fmeaEquipmentPointMapper.listFmeaByFmeaId(fmeaId);
List<FmeaPointInputitem> pointInputitems = fmeaPointInputitemMapper.listFmeaByFmeaId(fmeaId); List<FmeaPointInputitem> pointInputitems = fmeaPointInputitemMapper.listFmeaByFmeaId(fmeaId);
Double maxRate = getMaxRate(equipmentPoints, pointInputitems); Double maxRate = getMaxRate(equipmentPoints, pointInputitems);
...@@ -1513,6 +1514,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1513,6 +1514,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} }
} }
} }
}
private void saveRpnLog(Long riskSourceId, Long fmeaId, BigDecimal rpn, BigDecimal rpni) { private void saveRpnLog(Long riskSourceId, Long fmeaId, BigDecimal rpn, BigDecimal rpni) {
RpnChangeLog rpnChangeLog = new RpnChangeLog(); RpnChangeLog rpnChangeLog = new RpnChangeLog();
...@@ -1584,7 +1586,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1584,7 +1586,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if (riskSource == null) { if (riskSource == null) {
return; return;
} }
RiskLevel oldRiskLevel = iRiskLevelDao.findById(riskSource.getRiskLevelId());
List<Fmea> fmeas = fmeaMapper.listByRiskSourceId(riskSourceId); List<Fmea> fmeas = fmeaMapper.listByRiskSourceId(riskSourceId);
if (CollectionUtils.isEmpty(fmeas)) { if (CollectionUtils.isEmpty(fmeas)) {
BigDecimal resetValue = new BigDecimal("0"); BigDecimal resetValue = new BigDecimal("0");
...@@ -1624,6 +1625,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1624,6 +1625,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
BigDecimal rpni = maxDidValue.multiply(maxSidValue).multiply(averageOidValue); BigDecimal rpni = maxDidValue.multiply(maxSidValue).multiply(averageOidValue);
List<RiskLevel> levels = riskLevelDao.findAll(); List<RiskLevel> levels = riskLevelDao.findAll();
RiskLevel newRiskLevel = getBetweenLevel(rpn, levels); RiskLevel newRiskLevel = getBetweenLevel(rpn, levels);
RiskLevel oldRiskLevel = getBetweenLevel(rpni, levels);
if (newRiskLevel != null) { if (newRiskLevel != null) {
riskSource.setRpn(rpn); riskSource.setRpn(rpn);
riskSource.setRpni(rpni); riskSource.setRpni(rpni);
...@@ -1650,11 +1652,11 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1650,11 +1652,11 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
int level = oldLevel - newLevel; int level = oldLevel - newLevel;
String changeType; String changeType;
if (level > 0) { if (level > 0) {
changeType = "down"; changeType = "up";
} else if (level == 0) { } else if (level == 0) {
changeType = "no"; changeType = "no";
} else { } else {
changeType = "up"; changeType = "down";
} }
RiskSourceRuleRo riskSourceRuleRo = new RiskSourceRuleRo(); RiskSourceRuleRo riskSourceRuleRo = new RiskSourceRuleRo();
riskSourceRuleRo.setId(id); riskSourceRuleRo.setId(id);
...@@ -1663,7 +1665,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1663,7 +1665,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSourceRuleRo.setLevelChangeType(changeType); riskSourceRuleRo.setLevelChangeType(changeType);
riskSourceRuleRo.setNotifyType(notifyType); riskSourceRuleRo.setNotifyType(notifyType);
BigDecimal rg = rpnr.subtract(rpni); BigDecimal rg = rpnr.subtract(rpni);
Integer frequency = 0; int frequency = 0;
if ("up".equals(changeType) && rg.intValue() > 0) { if ("up".equals(changeType) && rg.intValue() > 0) {
frequency = 3; frequency = 3;
} else if ("no".equals(changeType) && rg.intValue() > 0) { } else if ("no".equals(changeType) && rg.intValue() > 0) {
......
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