Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
indicators
Overview
Overview
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
zhangkb
indicators
Commits
81822599
Commit
81822599
authored
Aug 19, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改对标单元计算取数逻辑
parent
ffdaa94e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
97 deletions
+97
-97
DriveIndIdObjCalActor.java
...dicators/akka/actor/indicators/DriveIndIdObjCalActor.java
+88
-93
GetBaseIndValueActor.java
...ndicators/akka/actor/indicators/GetBaseIndValueActor.java
+9
-4
No files found.
src/main/java/com/keymobile/indicators/akka/actor/indicators/DriveIndIdObjCalActor.java
View file @
81822599
...
@@ -153,76 +153,72 @@ public class DriveIndIdObjCalActor extends AbstractActor{
...
@@ -153,76 +153,72 @@ public class DriveIndIdObjCalActor extends AbstractActor{
logger
.
info
(
baseIndValueMsg
.
getConfirmMessage
());
logger
.
info
(
baseIndValueMsg
.
getConfirmMessage
());
}
}
String
indValue
=
baseIndValueMsg
.
getValue
();
String
indValue
=
baseIndValueMsg
.
getValue
();
//如果指标值返回空值
,那么就不进行下面的计算了,直接返回给父actor
//如果指标值返回空值
if
(
StringUtils
.
isBlank
(
indValue
))
{
if
(
StringUtils
.
isBlank
(
indValue
))
{
CalIndAverageAndRankMsg
driveIndAverageAndRankMsg
=
indValue
=
"0.0"
;
new
CalIndAverageAndRankMsg
(-
1
,
}
compareId
,
driveIndId
,
compareObj
,
date
,
"NaN"
,
try
{
unit
,
indType
,
scoreCardId
,
averageDriveIndFormula
,
compCalLogId
);
driveIndFormula
=
driveIndFormula
.
replace
(
"["
+
baseIndValueMsg
.
getIndId
()+
"]"
,
driveIndIdCalActor
.
tell
(
driveIndAverageAndRankMsg
,
ActorRef
.
noSender
());
indValue
);
}
else
{
//替换公式中的基础指标id为确定指标值
try
{
//env.put(baseIndValueMsg.getIndId(), Double.valueOf(indValue));
driveIndFormula
=
driveIndFormula
.
replace
(
"["
+
baseIndValueMsg
.
getIndId
()+
"]"
,
}
catch
(
Exception
e
)
{
indValue
);
e
.
printStackTrace
();
//替换公式中的基础指标id为确定指标值
logger
.
error
(
"driveIndId:"
+
driveIndId
+
";"
+
//env.put(baseIndValueMsg.getIndId(), Double.valueOf(indValue));
"formula:"
+
driveIndFormula
+
";"
+
}
catch
(
Exception
e
)
{
"errorValue:"
+
indValue
+
";"
+
"paramEnv:"
+
env
);
e
.
printStackTrace
();
//日志记录
logger
.
error
(
"driveIndId:"
+
driveIndId
+
";"
+
String
logInfo
=
compCalLog
.
getLogInfo
();
"formula:"
+
driveIndFormula
+
";"
+
if
(
StringUtils
.
isNotBlank
(
logInfo
))
{
"errorValue:"
+
indValue
+
";"
+
"paramEnv:"
+
env
);
logInfo
+=
"替换公式值出错:driveIndId:"
+
driveIndId
+
";"
+
//日志记录
"formula:"
+
driveIndFormula
+
";"
+
String
logInfo
=
compCalLog
.
getLogInfo
();
"errorValue:"
+
indValue
+
";"
+
"paramEnv:"
+
env
+
"</n>"
;
if
(
StringUtils
.
isNotBlank
(
logInfo
))
{
compCalLog
.
setLogInfo
(
logInfo
);
logInfo
+=
"替换公式值出错:driveIndId:"
+
driveIndId
+
";"
+
}
else
{
"formula:"
+
driveIndFormula
+
";"
+
compCalLog
.
setLogInfo
(
"替换公式值出错:driveIndId:"
+
driveIndId
+
";"
+
"errorValue:"
+
indValue
+
";"
+
"paramEnv:"
+
env
+
"</n>"
;
"formula:"
+
driveIndFormula
+
";"
+
compCalLog
.
setLogInfo
(
logInfo
);
"errorValue:"
+
indValue
+
";"
+
"paramEnv:"
+
env
+
"</n>"
);
}
else
{
}
compCalLog
.
setLogInfo
(
"替换公式值出错:driveIndId:"
+
driveIndId
+
";"
+
//保存日志
"formula:"
+
driveIndFormula
+
";"
+
if
(
compCalLog
!=
null
)
{
"errorValue:"
+
indValue
+
";"
+
"paramEnv:"
+
env
+
"</n>"
);
compareUnitCalLogService
.
saveOrUndate
(
compCalLog
);
}
//保存日志
if
(
compCalLog
!=
null
)
{
compareUnitCalLogService
.
saveOrUndate
(
compCalLog
);
}
}
}
confirmList
.
add
(
baseIndValueMsg
.
getIsFinish
());
}
if
(++
numberOfConfirm
>=
indIdSize
)
{
//子actor全部返回
confirmList
.
add
(
baseIndValueMsg
.
getIsFinish
());
if
(!
confirmList
.
contains
(
0
))
{
//取所有基础指标值没错
if
(++
numberOfConfirm
>=
indIdSize
)
{
//子actor全部返回
//进行考核指标值计算
if
(!
confirmList
.
contains
(
0
))
{
//取所有基础指标值没错
try
{
//进行考核指标值计算
String
driveIndValue
=
AviatorEvaluator
.
execute
(
driveIndFormula
).
toString
();
try
{
//保留四位小数
String
driveIndValue
=
AviatorEvaluator
.
execute
(
driveIndFormula
).
toString
();
if
(!
driveIndValue
.
equals
(
"NaN"
)
&&
!
driveIndValue
.
equals
(
"Infinite"
))
{
//保留四位小数
driveIndValue
=
String
.
format
(
"%.4f"
,
if
(!
driveIndValue
.
equals
(
"NaN"
)
&&
!
driveIndValue
.
equals
(
"Infinite"
))
{
new
BigDecimal
(
Double
.
valueOf
(
driveIndValue
)));
driveIndValue
=
String
.
format
(
"%.4f"
,
}
new
BigDecimal
(
Double
.
valueOf
(
driveIndValue
)));
//判断结果表中是否已存在该结果数据,存在则覆盖
}
DriveIndCalResultDef
driveIndCalResult
=
driveIndCalResultService
.
//判断结果表中是否已存在该结果数据,存在则覆盖
findCalResultDataIsExist
(
compareId
,
compareObj
,
driveIndId
,
date
);
DriveIndCalResultDef
driveIndCalResult
=
driveIndCalResultService
.
if
(
driveIndCalResult
==
null
)
{
findCalResultDataIsExist
(
compareId
,
compareObj
,
driveIndId
,
date
);
driveIndCalResult
=
new
DriveIndCalResultDef
(
compareId
,
if
(
driveIndCalResult
==
null
)
{
driveIndId
,
compareObj
,
date
,
driveIndValue
,
unit
,
driveIndCalResult
=
new
DriveIndCalResultDef
(
compareId
,
"1"
,
"1"
,
"admin"
,
code
,
baseIndValueMsg
.
getCompareObjDesc
());
driveIndId
,
compareObj
,
date
,
driveIndValue
,
unit
,
}
else
{
"1"
,
"1"
,
"admin"
,
code
,
baseIndValueMsg
.
getCompareObjDesc
());
driveIndCalResult
.
setCode
(
code
);
}
else
{
driveIndCalResult
.
setUnit
(
unit
);
driveIndCalResult
.
setCode
(
code
);
driveIndCalResult
.
setValue
(
driveIndValue
);
driveIndCalResult
.
setUnit
(
unit
);
driveIndCalResult
.
setLastUpdateTime
(
DateUtils
.
formatDate
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
));
driveIndCalResult
.
setValue
(
driveIndValue
);
}
driveIndCalResult
.
setLastUpdateTime
(
DateUtils
.
formatDate
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
));
//保存进考核指标结果表中
}
driveIndCalResultService
.
saveOrUpdate
(
driveIndCalResult
);
//保存进考核指标结果表中
driveIndCalResultService
.
saveOrUpdate
(
driveIndCalResult
);
//返回指标值回去算平均值和排名
CalIndAverageAndRankMsg
driveIndAverageAndRankMsg
=
//返回指标值回去算平均值和排名
new
CalIndAverageAndRankMsg
(
driveIndCalResult
.
getId
(),
CalIndAverageAndRankMsg
driveIndAverageAndRankMsg
=
compareId
,
driveIndId
,
compareObj
,
date
,
driveIndValue
,
new
CalIndAverageAndRankMsg
(
driveIndCalResult
.
getId
(),
unit
,
indType
,
scoreCardId
,
averageDriveIndFormula
,
compCalLogId
);
compareId
,
driveIndId
,
compareObj
,
date
,
driveIndValue
,
driveIndIdCalActor
.
tell
(
driveIndAverageAndRankMsg
,
ActorRef
.
noSender
());
unit
,
indType
,
scoreCardId
,
averageDriveIndFormula
,
compCalLogId
);
}
catch
(
Exception
e
)
{
driveIndIdCalActor
.
tell
(
driveIndAverageAndRankMsg
,
ActorRef
.
noSender
());
//判断结果表中是否已存在该结果数据,存在则覆盖
}
catch
(
Exception
e
)
{
//判断结果表中是否已存在该结果数据,存在则覆盖
// DriveIndCalResultDef driveIndCalResult = driveIndCalResultService.
// DriveIndCalResultDef driveIndCalResult = driveIndCalResultService.
// findCalResultDataIsExist(compareId, compareObj, driveIndId, date);
// findCalResultDataIsExist(compareId, compareObj, driveIndId, date);
// if(driveIndCalResult==null) {
// if(driveIndCalResult==null) {
...
@@ -236,38 +232,37 @@ public class DriveIndIdObjCalActor extends AbstractActor{
...
@@ -236,38 +232,37 @@ public class DriveIndIdObjCalActor extends AbstractActor{
// driveIndCalResult.setLastUpdateTime(DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"));
// driveIndCalResult.setLastUpdateTime(DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"));
// }
// }
// driveIndCalResultService.saveOrUpdate(driveIndCalResult);
// driveIndCalResultService.saveOrUpdate(driveIndCalResult);
logger
.
error
(
"driveIndId:"
+
driveIndId
+
";"
+
logger
.
error
(
"driveIndId:"
+
driveIndId
+
";"
+
"paramEnv:"
+
env
+
";formula:"
+
driveIndFormula
);
"paramEnv:"
+
env
+
";formula:"
+
driveIndFormula
);
//日志记录
//日志记录
String
logInfo
=
compCalLog
.
getLogInfo
();
String
logInfo
=
compCalLog
.
getLogInfo
();
if
(
StringUtils
.
isNotBlank
(
logInfo
))
{
if
(
StringUtils
.
isNotBlank
(
logInfo
))
{
logInfo
+=
"计算考核指标出错:driveIndId:"
+
driveIndId
+
";"
+
logInfo
+=
"计算考核指标出错:driveIndId:"
+
driveIndId
+
";"
+
"paramEnv:"
+
env
+
";formula:"
+
driveIndFormula
+
"</n>"
;
"paramEnv:"
+
env
+
";formula:"
+
driveIndFormula
+
"</n>"
;
compCalLog
.
setLogInfo
(
logInfo
);
compCalLog
.
setLogInfo
(
logInfo
);
}
else
{
}
else
{
compCalLog
.
setLogInfo
(
"计算考核指标出错:driveIndId:"
+
driveIndId
+
";"
+
compCalLog
.
setLogInfo
(
"计算考核指标出错:driveIndId:"
+
driveIndId
+
";"
+
"paramEnv:"
+
env
+
";formula:"
+
driveIndFormula
+
"</n>"
);
"paramEnv:"
+
env
+
";formula:"
+
driveIndFormula
+
"</n>"
);
}
//保存日志
if
(
compCalLog
!=
null
)
{
compareUnitCalLogService
.
saveOrUndate
(
compCalLog
);
}
//表示计算错误,不生成考核结果
CalIndAverageAndRankMsg
driveIndAverageAndRankMsg
=
new
CalIndAverageAndRankMsg
(-
1
,
compareId
,
driveIndId
,
compareObj
,
date
,
"NaN"
,
unit
,
indType
,
scoreCardId
,
averageDriveIndFormula
,
compCalLogId
);
driveIndIdCalActor
.
tell
(
driveIndAverageAndRankMsg
,
ActorRef
.
noSender
());
}
}
}
else
{
//保存日志
//返回考核指标因为考核指标公式中的数据项不存在而导致的计算错误标识
if
(
compCalLog
!=
null
)
{
compareUnitCalLogService
.
saveOrUndate
(
compCalLog
);
}
//表示计算错误,不生成考核结果
CalIndAverageAndRankMsg
driveIndAverageAndRankMsg
=
CalIndAverageAndRankMsg
driveIndAverageAndRankMsg
=
new
CalIndAverageAndRankMsg
(-
1
,
new
CalIndAverageAndRankMsg
(-
1
,
compareId
,
driveIndId
,
compareObj
,
date
,
"NaN"
,
compareId
,
driveIndId
,
compareObj
,
date
,
"NaN"
,
unit
,
indType
,
scoreCardId
,
averageDriveIndFormula
,
compCalLogId
);
unit
,
indType
,
scoreCardId
,
averageDriveIndFormula
,
compCalLogId
);
driveIndIdCalActor
.
tell
(
driveIndAverageAndRankMsg
,
ActorRef
.
noSender
());
driveIndIdCalActor
.
tell
(
driveIndAverageAndRankMsg
,
ActorRef
.
noSender
());
}
}
}
else
{
//返回考核指标因为考核指标公式中的数据项不存在而导致的计算错误标识
CalIndAverageAndRankMsg
driveIndAverageAndRankMsg
=
new
CalIndAverageAndRankMsg
(-
1
,
compareId
,
driveIndId
,
compareObj
,
date
,
"NaN"
,
unit
,
indType
,
scoreCardId
,
averageDriveIndFormula
,
compCalLogId
);
driveIndIdCalActor
.
tell
(
driveIndAverageAndRankMsg
,
ActorRef
.
noSender
());
}
}
}
}
})
})
...
...
src/main/java/com/keymobile/indicators/akka/actor/indicators/GetBaseIndValueActor.java
View file @
81822599
...
@@ -21,10 +21,15 @@ public class GetBaseIndValueActor extends AbstractActor{
...
@@ -21,10 +21,15 @@ public class GetBaseIndValueActor extends AbstractActor{
Map
<
String
,
Object
>
indValueMap
=
indicatorsValueService
.
getIndicatorsValue
(
Map
<
String
,
Object
>
indValueMap
=
indicatorsValueService
.
getIndicatorsValue
(
getBaseIndValueMsg
.
getIndId
(),
getBaseIndValueMsg
.
getDimValue
());
getBaseIndValueMsg
.
getIndId
(),
getBaseIndValueMsg
.
getDimValue
());
if
(
indValueMap
!=
null
)
{
if
(
indValueMap
!=
null
)
{
//返回指标值结果
if
(
indValueMap
.
get
(
"value"
)==
null
)
{
//如果指标值为空,返回失败结果
getSender
().
tell
(
new
BaseIndValueMsg
(
getBaseIndValueMsg
.
getIndId
()
//返回指标值结果
,
indValueMap
.
get
(
"value"
)==
null
?
null
:
indValueMap
.
get
(
"value"
).
toString
(),
getSender
().
tell
(
new
BaseIndValueMsg
(
getBaseIndValueMsg
.
getIndId
()
indValueMap
.
get
(
"compareObjDesc"
).
toString
(),
1
,
""
),
getSelf
());
,
null
,
indValueMap
.
get
(
"compareObjDesc"
).
toString
(),
0
,
""
),
getSelf
());
}
else
{
getSender
().
tell
(
new
BaseIndValueMsg
(
getBaseIndValueMsg
.
getIndId
()
,
indValueMap
.
get
(
"value"
).
toString
(),
indValueMap
.
get
(
"compareObjDesc"
).
toString
(),
1
,
""
),
getSelf
());
}
}
else
{
}
else
{
//返回指标值结果
//返回指标值结果
getSender
().
tell
(
new
BaseIndValueMsg
(
getBaseIndValueMsg
.
getIndId
(),
null
,
null
,
getSender
().
tell
(
new
BaseIndValueMsg
(
getBaseIndValueMsg
.
getIndId
(),
null
,
null
,
...
...
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