Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
station
YeeAmosFireAutoSysRoot
Commits
93121db8
Commit
93121db8
authored
May 11, 2020
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.修改rpn计算
parent
5a275471
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
8 deletions
+38
-8
RpnChangeLog.java
...in/java/com/yeejoin/amos/fas/dao/entity/RpnChangeLog.java
+14
-0
RiskSourceServiceImpl.java
...amos/fas/business/service/impl/RiskSourceServiceImpl.java
+8
-7
fas-1.0.2.xml
...utoSysStart/src/main/resources/db/changelog/fas-1.0.2.xml
+16
-1
No files found.
YeeAmosFireAutoSysCommon/src/main/java/com/yeejoin/amos/fas/dao/entity/RpnChangeLog.java
View file @
93121db8
...
...
@@ -35,6 +35,12 @@ public class RpnChangeLog extends BasicEntity {
@Column
(
name
=
"trigger_by"
)
private
Long
triggerBy
;
/**
* 变化类型(巡检、评价、告警)
*/
@Column
(
name
=
"trigger_type"
)
private
String
triggerType
;
private
int
type
;
private
RiskSource
riskSource
;
...
...
@@ -66,6 +72,14 @@ public class RpnChangeLog extends BasicEntity {
this
.
rpn
=
rpn
;
}
public
String
getTriggerType
()
{
return
triggerType
;
}
public
void
setTriggerType
(
String
triggerType
)
{
this
.
triggerType
=
triggerType
;
}
public
BigDecimal
getRpni
()
{
return
this
.
rpni
;
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
View file @
93121db8
...
...
@@ -1026,7 +1026,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
BigDecimal
sidValue
=
new
BigDecimal
(
fmea
.
getSidValue
());
BigDecimal
didValue
=
new
BigDecimal
(
fmea
.
getDidValue
());
//1.1计算rpni
BigDecimal
rpni
=
oidValue
.
multiply
(
sidValue
).
multiply
(
didValue
);
BigDecimal
rpni
=
oidValue
.
multiply
(
sidValue
).
multiply
(
didValue
)
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
)
;
BigDecimal
rpn
;
//1.2计算rpn:为空则rpni = rpn;不为空则重新计算s*d*newo
if
(
fmea
.
getNewEvaluationOid
()
==
null
)
{
...
...
@@ -1034,7 +1034,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
rpn
=
rpni
;
}
else
{
BigDecimal
newOidValue
=
new
BigDecimal
(
fmea
.
getNewOidValue
());
rpn
=
newOidValue
.
multiply
(
sidValue
).
multiply
(
didValue
);
rpn
=
newOidValue
.
multiply
(
sidValue
).
multiply
(
didValue
)
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
;
}
List
<
RiskLevel
>
levels
=
riskLevelDao
.
findAll
();
RiskLevel
newLevel
=
RpnUtils
.
getBetweenLevel
(
rpn
,
levels
);
...
...
@@ -1109,7 +1109,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
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
);
BigDecimal
rpn
=
newOidValue
.
multiply
(
sidValue
).
multiply
(
didValue
)
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
)
;
List
<
RiskLevel
>
levels
=
riskLevelDao
.
findAll
();
RiskLevel
newLevel
=
RpnUtils
.
getBetweenLevel
(
rpn
,
levels
);
fmea
.
setRpn
(
rpn
);
...
...
@@ -1129,7 +1129,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
,
String
notifyType
)
{
RpnChangeLog
rpnChangeLog
=
new
RpnChangeLog
();
rpnChangeLog
.
setRiskSourceId
(
riskSourceId
);
rpnChangeLog
.
setRpn
(
rpn
);
...
...
@@ -1137,6 +1137,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
rpnChangeLog
.
setType
(
RpnUtils
.
getChangeType
(
rpn
,
rpni
));
rpnChangeLog
.
setTriggerBy
(
fmeaId
);
rpnChangeLog
.
setFmeaId
(
fmeaId
);
rpnChangeLog
.
setTriggerType
(
notifyType
);
iRpnChangeLogDao
.
save
(
rpnChangeLog
);
}
...
...
@@ -1160,7 +1161,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
return
;
}
List
<
Fmea
>
fmeas
=
fmeaMapper
.
listByRiskSourceId
(
riskSourceId
);
if
(
CollectionUtils
.
isEmpty
(
fmeas
))
{
//fema删除
if
(
CollectionUtils
.
isEmpty
(
fmeas
))
{
//fema
全部
删除
BigDecimal
resetValue
=
new
BigDecimal
(
"0"
);
riskSource
.
setRpn
(
null
);
riskSource
.
setRpni
(
null
);
...
...
@@ -1168,7 +1169,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
//1.更新fmea对应风险点rpn、rpni、level
riskSourceMapper
.
updateRpn
(
riskSource
);
//2.记录风险点rpn变化流水
this
.
saveRpnLog
(
riskSource
.
getId
(),
fmeaId
,
resetValue
,
resetValue
);
this
.
saveRpnLog
(
riskSource
.
getId
(),
fmeaId
,
resetValue
,
resetValue
,
notifyType
);
//3.更新父节点rpn、rpni、风险等级
this
.
updateParentRpn
(
riskSource
.
getParentId
());
}
else
{
//fmea评价、巡检、告警
...
...
@@ -1188,7 +1189,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
//1.更新fmea对应风险点rpn、rpni、level
riskSourceMapper
.
updateRpn
(
riskSource
);
//2.记录风险点rpn变化流水
this
.
saveRpnLog
(
riskSource
.
getId
(),
fmeaId
,
rpn
,
rpni
);
this
.
saveRpnLog
(
riskSource
.
getId
(),
fmeaId
,
rpn
,
rpni
,
notifyType
);
//3.更新父节点rpn、rpni、风险等级
this
.
updateParentRpn
(
riskSource
.
getParentId
());
//4.极光推送给手机客户端
...
...
YeeAmosFireAutoSysStart/src/main/resources/db/changelog/fas-1.0.2.xml
View file @
93121db8
...
...
@@ -370,7 +370,9 @@
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1588990926789-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<columnExists
tableName=
"f_risk_level "
columnName=
"manage_level"
/>
<not>
<columnExists
tableName=
"f_risk_level "
columnName=
"manage_level"
/>
</not>
</preConditions>
<comment>
f_risk_level add column manage_level 管控级别
</comment>
<sql>
...
...
@@ -378,5 +380,17 @@
add COLUMN `manage_level` tinyint(4) DEFAULT NULL COMMENT '管控级别';
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1589165258908-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_rpn_change_log "
columnName=
"trigger_type"
/>
</not>
</preConditions>
<comment>
f_rpn_change_log add column trigger_type 触发类型
</comment>
<sql>
ALTER TABLE `f_rpn_change_log`
add COLUMN `trigger_type` varchar(20) DEFAULT NULL COMMENT '触发类型:巡检、告警、评价、删除' after `trigger_by`;
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment