Commit d78bf1ff authored by xukaiqiang's avatar xukaiqiang

bug

parent 7c5de387
...@@ -148,9 +148,7 @@ public class RiskModelController extends BaseController { ...@@ -148,9 +148,7 @@ public class RiskModelController extends BaseController {
public CommonResponse deleteFmea(@ApiParam(value = "Fmea模型id", required = true) @RequestBody RiskFmeaParam param) { public CommonResponse deleteFmea(@ApiParam(value = "Fmea模型id", required = true) @RequestBody RiskFmeaParam param) {
try { try {
Long[] fmeaIds = param.getFmeaIds(); Long[] fmeaIds = param.getFmeaIds();
Long riskSourceId = param.getRiskSourceId();
fmeaService.deleteFmea(fmeaIds); fmeaService.deleteFmea(fmeaIds);
fmeaService.updateRpniInfo(riskSourceId);
if (fmeaIds.length > 0) { if (fmeaIds.length > 0) {
RsDataQueue rsDataQueue = RsDataQueue.getInstance(); RsDataQueue rsDataQueue = RsDataQueue.getInstance();
for (Long fmeaId : fmeaIds) { for (Long fmeaId : fmeaIds) {
......
...@@ -35,4 +35,6 @@ public interface FmeaMapper extends BaseMapper { ...@@ -35,4 +35,6 @@ public interface FmeaMapper extends BaseMapper {
Fmea getById(Long id); Fmea getById(Long id);
List<Fmea> listByRiskSourceId(Long riskSourceId); List<Fmea> listByRiskSourceId(Long riskSourceId);
void updateRpn(Fmea fmea);
} }
...@@ -49,7 +49,7 @@ public interface RiskSourceMapper extends BaseMapper { ...@@ -49,7 +49,7 @@ public interface RiskSourceMapper extends BaseMapper {
//厂区rpn,重点设备个数,风险点个数,巡检点个数 //厂区rpn,重点设备个数,风险点个数,巡检点个数
Map<String,List> statistics3dCount(); Map<String, List> statistics3dCount();
//消防设备按分类统计个数 //消防设备按分类统计个数
List<Map> statisticsEquipClassify(); List<Map> statisticsEquipClassify();
...@@ -93,4 +93,6 @@ public interface RiskSourceMapper extends BaseMapper { ...@@ -93,4 +93,6 @@ public interface RiskSourceMapper extends BaseMapper {
List<Map> queryContingencyWater(); List<Map> queryContingencyWater();
List<Map> queryFmeaByPointId(@Param("pointId") Long pointId); List<Map> queryFmeaByPointId(@Param("pointId") Long pointId);
void updateRpn(RiskSource riskSource);
} }
...@@ -66,8 +66,8 @@ public class FmeaServiceImpl implements IFmeaService { ...@@ -66,8 +66,8 @@ public class FmeaServiceImpl implements IFmeaService {
fmeas.forEach(fmea -> { fmeas.forEach(fmea -> {
String userId = paramMap.get("user_id") == null ? "0" : paramMap.get("user_id").toString(); String userId = paramMap.get("user_id") == null ? "0" : paramMap.get("user_id").toString();
fmea.setCreateBy(Integer.parseInt(userId)); fmea.setCreateBy(Integer.parseInt(userId));
RiskSource riskSource = iRiskSourceDao.findById(fmea.getRiskSourceId()); // RiskSource riskSource = iRiskSourceDao.findById(fmea.getRiskSourceId());
fmea.setRiskSource(riskSource); // fmea.setRiskSource(riskSource);
iFmeaDao.save(fmea); iFmeaDao.save(fmea);
//updateRpniInfo(fmea.getRiskSourceId()); //updateRpniInfo(fmea.getRiskSourceId());
}); });
......
...@@ -1399,7 +1399,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1399,7 +1399,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
BigDecimal sidValue = new BigDecimal(fmea.getSidValue()); BigDecimal sidValue = new BigDecimal(fmea.getSidValue());
BigDecimal didValue = new BigDecimal(fmea.getDidValue()); BigDecimal didValue = new BigDecimal(fmea.getDidValue());
BigDecimal rpni = oidValue.multiply(sidValue).multiply(didValue); BigDecimal rpni = oidValue.multiply(sidValue).multiply(didValue);
BigDecimal rpn = null; BigDecimal rpn;
if (fmea.getNewEvaluationOid() == null) { if (fmea.getNewEvaluationOid() == null) {
fmea.setNewEvaluationOid(fmea.getEvaluationOid()); fmea.setNewEvaluationOid(fmea.getEvaluationOid());
rpn = rpni; rpn = rpni;
...@@ -1410,7 +1410,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1410,7 +1410,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} }
fmea.setRpni(rpni); fmea.setRpni(rpni);
fmea.setRpn(rpn); fmea.setRpn(rpn);
iFmeaDao.save(fmea); fmeaMapper.updateRpn(fmea);
saveRpnLog(fmea.getRiskSourceId(), fmeaId, rpn, rpni); saveRpnLog(fmea.getRiskSourceId(), fmeaId, rpn, rpni);
this.notifyRiskSource(fmea.getRiskSourceId()); this.notifyRiskSource(fmea.getRiskSourceId());
} }
...@@ -1438,7 +1438,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1438,7 +1438,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
BigDecimal rpn = newOidValue.multiply(sidValue).multiply(didValue); BigDecimal rpn = newOidValue.multiply(sidValue).multiply(didValue);
fmea.setRpn(rpn); fmea.setRpn(rpn);
fmea.setNewEvaluationOid(oEvaluationModel.getId()); fmea.setNewEvaluationOid(oEvaluationModel.getId());
iFmeaDao.save(fmea); fmeaMapper.updateRpn(fmea);
saveRpnLog(fmea.getRiskSourceId(), fmeaId, rpn, fmea.getRpni()); saveRpnLog(fmea.getRiskSourceId(), fmeaId, rpn, fmea.getRpni());
this.notifyRiskSource(fmea.getRiskSourceId()); this.notifyRiskSource(fmea.getRiskSourceId());
} }
...@@ -1550,7 +1550,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1550,7 +1550,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setRpn(rpn); riskSource.setRpn(rpn);
riskSource.setRpni(rpni); riskSource.setRpni(rpni);
riskSource.setRiskLevelId(newLevel.getId()); riskSource.setRiskLevelId(newLevel.getId());
iRiskSourceDao.save(riskSource); riskSourceMapper.updateRpn(riskSource);
} }
} }
......
...@@ -43,6 +43,10 @@ ...@@ -43,6 +43,10 @@
fm.department_leader as departmentLeader, fm.department_leader as departmentLeader,
fm.group_leader as groupLeader, fm.group_leader as groupLeader,
fm.person_leader as personLeader, fm.person_leader as personLeader,
(select name from s_user where id = fm.company_leader) as companyLeaderName,
(select name from s_user where id = fm.department_leader) as departmentLeaderName,
(select name from s_user where id = fm.group_leader) as groupLeaderName,
(select name from s_user where id = fm.person_leader) as personLeaderName,
rf.`name` AS riskFactorName, rf.`name` AS riskFactorName,
fat.`name` AS accidentTypeName, fat.`name` AS accidentTypeName,
fat.id AS accidentTypeId, fat.id AS accidentTypeId,
...@@ -123,5 +127,19 @@ ...@@ -123,5 +127,19 @@
a.risk_source_id = #{riskSourceId} a.risk_source_id = #{riskSourceId}
</select> </select>
<update id="updateRpn">
update f_fmea
<set>
<if test="rpn != null">
rpn = #{rpn},
</if>
<if test="rpni != null">
rpni = #{rpni},
</if>
<if test="newEvaluationOid != null">
new_evaluation_oid = #{newEvaluationOid},
</if>
</set>
where id = #{id}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -656,4 +656,20 @@ ...@@ -656,4 +656,20 @@
parent_id = #{riskSourceId} parent_id = #{riskSourceId}
</select> </select>
<update id="updateRpn">
update f_risk_source
<set>
<if test="rpn != null">
rpn = #{rpn},
</if>
<if test="rpni != null">
rpni = #{rpni},
</if>
<if test="riskLevelId != null">
risk_level_id = #{riskLevelId},
</if>
</set>
where id = #{id}
</update>
</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