Commit f98fa9f3 authored by xukaiqiang's avatar xukaiqiang

bug

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