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
084d81a1
Commit
084d81a1
authored
Aug 31, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加对标运算试运算功能代码
parent
b4dcd4d2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
735 additions
and
134 deletions
+735
-134
BeforeCompareUnitCalActor.java
...tors/akka/actor/indicators/BeforeCompareUnitCalActor.java
+64
-45
CompareUnitCalActor.java
...indicators/akka/actor/indicators/CompareUnitCalActor.java
+5
-1
DriveIndIdCalActor.java
.../indicators/akka/actor/indicators/DriveIndIdCalActor.java
+104
-40
DriveIndIdObjCalActor.java
...dicators/akka/actor/indicators/DriveIndIdObjCalActor.java
+50
-20
StartCompareUnitCalActor.java
...ators/akka/actor/indicators/StartCompareUnitCalActor.java
+65
-17
CompareUnitCalMsg.java
...indicators/akka/message/indicators/CompareUnitCalMsg.java
+12
-1
DriveIndIdCalMsg.java
.../indicators/akka/message/indicators/DriveIndIdCalMsg.java
+11
-1
DriveIndIdObjCalMsg.java
...dicators/akka/message/indicators/DriveIndIdObjCalMsg.java
+12
-1
StartCompareUnitCalMsg.java
...ators/akka/message/indicators/StartCompareUnitCalMsg.java
+12
-1
DriveIndCalResultCtrl.java
...obile/indicators/api/hytobacco/DriveIndCalResultCtrl.java
+22
-5
TestDriveIndCalResultDef.java
...cators/model/entity/testrun/TestDriveIndCalResultDef.java
+60
-0
TestObjScoreCalResult.java
...ndicators/model/entity/testrun/TestObjScoreCalResult.java
+30
-0
TestDriveIndCalResultDefMapper.java
.../model/mapper/testrun/TestDriveIndCalResultDefMapper.java
+28
-0
TestObjScoreCalResultMapper.java
...ors/model/mapper/testrun/TestObjScoreCalResultMapper.java
+20
-0
DriveIndCalResultService.java
...ndicators/service/hytobacco/DriveIndCalResultService.java
+2
-2
TestDriveIndCalResultService.java
...icators/service/testrun/TestDriveIndCalResultService.java
+64
-0
TestScoreRuleService.java
...bile/indicators/service/testrun/TestScoreRuleService.java
+0
-0
TestDriveIndCalResultDefMapper.xml
...ources/mybatis/mapping/TestDriveIndCalResultDefMapper.xml
+109
-0
TestObjScoreCalResultMapper.xml
...resources/mybatis/mapping/TestObjScoreCalResultMapper.xml
+65
-0
No files found.
src/main/java/com/keymobile/indicators/akka/actor/indicators/BeforeCompareUnitCalActor.java
View file @
084d81a1
...
@@ -39,6 +39,8 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
...
@@ -39,6 +39,8 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
private
String
code
=
null
;
private
String
code
=
null
;
private
String
isTest
=
null
;
//试运行,0:试运行 1:正式运行
@Override
@Override
public
Receive
createReceive
()
{
public
Receive
createReceive
()
{
return
receiveBuilder
()
return
receiveBuilder
()
...
@@ -47,10 +49,17 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
...
@@ -47,10 +49,17 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
sameCompareUnitDef
.
addAll
(
compareUnitDefs
);
sameCompareUnitDef
.
addAll
(
compareUnitDefs
);
sameDate
=
compareUnitDefs
.
get
(
0
).
getDate
();
sameDate
=
compareUnitDefs
.
get
(
0
).
getDate
();
code
=
beforeCompareUnitCalMsg
.
getCode
();
code
=
beforeCompareUnitCalMsg
.
getCode
();
logger
.
info
(
"进行date:"
+
sameDate
+
" 的对标单元计算....."
);
isTest
=
beforeCompareUnitCalMsg
.
getIsTest
();
if
(
"0"
.
equals
(
isTest
))
{
logger
.
info
(
"进行date:"
+
sameDate
+
" 的对标单元试运行计算....."
);
}
else
{
logger
.
info
(
"进行date:"
+
sameDate
+
" 的对标单元计算....."
);
}
//计算同期对标单元
//计算同期对标单元
StartCompareUnitCalMsg
startCompareUnitCalMsg
=
new
StartCompareUnitCalMsg
(
StartCompareUnitCalMsg
startCompareUnitCalMsg
=
new
StartCompareUnitCalMsg
(
compareUnitDefs
,
beforeCompareUnitCalMsg
.
getCode
());
compareUnitDefs
,
beforeCompareUnitCalMsg
.
getCode
(),
beforeCompareUnitCalMsg
.
getIsTest
());
ActorRef
startCompareUnitCalActor
=
this
.
getContext
().
actorOf
(
Props
.
create
(
ActorRef
startCompareUnitCalActor
=
this
.
getContext
().
actorOf
(
Props
.
create
(
StartCompareUnitCalActor
.
class
,()->
new
StartCompareUnitCalActor
(
getSelf
())));
StartCompareUnitCalActor
.
class
,()->
new
StartCompareUnitCalActor
(
getSelf
())));
startCompareUnitCalActor
.
tell
(
startCompareUnitCalMsg
,
getSelf
());
startCompareUnitCalActor
.
tell
(
startCompareUnitCalMsg
,
getSelf
());
...
@@ -66,61 +75,71 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
...
@@ -66,61 +75,71 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
}
}
if
(!
currentCompareUnitDef
.
isEmpty
())
{
if
(!
currentCompareUnitDef
.
isEmpty
())
{
currentDate
=
currentCompareUnitDef
.
get
(
0
).
getDate
();
currentDate
=
currentCompareUnitDef
.
get
(
0
).
getDate
();
logger
.
info
(
"进行date:"
+
currentDate
+
" 的对标单元计算....."
);
if
(
"0"
.
equals
(
isTest
))
{
logger
.
info
(
"进行date:"
+
currentDate
+
" 的对标单元试运行计算....."
);
}
else
{
logger
.
info
(
"进行date:"
+
currentDate
+
" 的对标单元计算....."
);
}
//计算同期对标单元
//计算同期对标单元
StartCompareUnitCalMsg
startCompareUnitCalMsg
=
new
StartCompareUnitCalMsg
(
StartCompareUnitCalMsg
startCompareUnitCalMsg
=
new
StartCompareUnitCalMsg
(
currentCompareUnitDef
,
code
);
currentCompareUnitDef
,
code
,
isTest
);
ActorRef
startCompareUnitCalActor
=
this
.
getContext
().
actorOf
(
Props
.
create
(
ActorRef
startCompareUnitCalActor
=
this
.
getContext
().
actorOf
(
Props
.
create
(
StartCompareUnitCalActor
.
class
,()->
new
StartCompareUnitCalActor
(
getSelf
())));
StartCompareUnitCalActor
.
class
,()->
new
StartCompareUnitCalActor
(
getSelf
())));
startCompareUnitCalActor
.
tell
(
startCompareUnitCalMsg
,
getSelf
());
startCompareUnitCalActor
.
tell
(
startCompareUnitCalMsg
,
getSelf
());
}
}
}
}
if
(
numberOfConfirm
>
1
)
{
if
(
numberOfConfirm
>
1
)
{
Map
<
String
,
String
>
compareObjMap
=
new
HashMap
<>();
if
(
"1"
.
equals
(
isTest
))
{
//正式对标单元运算才进行报表数据生成
logger
.
info
(
"进行date:"
+
currentDate
+
" 指标本期同期报表数据和考核指标报表数据2数据整合"
);
Map
<
String
,
String
>
compareObjMap
=
new
HashMap
<>();
logger
.
info
(
"进行date:"
+
currentDate
+
" 指标本期同期报表数据和考核指标报表数据2数据整合"
);
//整合考核指标报表数据2
for
(
CompareUnitDef
unitDef
:
currentCompareUnitDef
)
{
//整合考核指标报表数据2
if
(
StringUtils
.
isNotBlank
(
unitDef
.
getIndIds
())
&&
for
(
CompareUnitDef
unitDef
:
currentCompareUnitDef
)
{
StringUtils
.
isNotBlank
(
unitDef
.
getCompareObjs
()))
{
if
(
StringUtils
.
isNotBlank
(
unitDef
.
getIndIds
())
&&
//用map整合对标机构
StringUtils
.
isNotBlank
(
unitDef
.
getCompareObjs
()))
{
List
<
String
>
compareObjsList
=
Arrays
//用map整合对标机构
.
asList
(
unitDef
.
getCompareObjs
().
split
(
","
));
List
<
String
>
compareObjsList
=
Arrays
for
(
String
compareObj
:
compareObjsList
)
{
.
asList
(
unitDef
.
getCompareObjs
().
split
(
","
));
compareObjMap
.
put
(
compareObj
,
compareObj
);
for
(
String
compareObj
:
compareObjsList
)
{
compareObjMap
.
put
(
compareObj
,
compareObj
);
}
//整合指标本期同期报表数据
indicatorsReportService
.
dealReportOne
(
unitDef
.
getCompareId
(),
Arrays
.
asList
(
unitDef
.
getIndIds
().
split
(
","
)),
Arrays
.
asList
(
unitDef
.
getCompareObjs
().
split
(
","
)),
unitDef
.
getDate
(),
code
);
//整合考核指标报表数据2
indicatorsReportService
.
dealDriveIndReportTwoData
(
unitDef
.
getCompareId
(),
Arrays
.
asList
(
unitDef
.
getIndIds
().
split
(
","
)),
Arrays
.
asList
(
unitDef
.
getCompareObjs
().
split
(
","
)),
unitDef
.
getDate
(),
code
);
}
}
//整合指标本期同期报表数据
}
indicatorsReportService
.
dealReportOne
(
unitDef
.
getCompareId
(),
Arrays
.
asList
(
unitDef
.
getIndIds
().
split
(
","
)),
//整合基础项本期同期报表数据
Arrays
.
asList
(
unitDef
.
getCompareObjs
().
split
(
","
)),
logger
.
info
(
"进行date:"
+
currentDate
+
" 基础项本期同期报表数据整合"
);
unitDef
.
getDate
(),
code
);
if
(!
compareObjMap
.
isEmpty
())
{
List
<
String
>
compareObjs
=
new
ArrayList
<
String
>(
compareObjMap
.
keySet
());
//整合考核指标报表数据2
indicatorsReportService
.
dealBaseIndReportOneData
(
currentDate
,
compareObjs
,
code
);
indicatorsReportService
.
dealDriveIndReportTwoData
(
}
unitDef
.
getCompareId
(),
Arrays
.
asList
(
unitDef
.
getIndIds
().
split
(
","
)),
Arrays
.
asList
(
unitDef
.
getCompareObjs
().
split
(
","
)),
unitDef
.
getDate
(),
code
);
//整合考核指标报表数据3
logger
.
info
(
"进行date:"
+
currentDate
+
" 指标报表3数据整合"
);
//删除历史数据
indicatorsReportService
.
deleteReportThreeDataByParam
(
currentDate
,
new
ArrayList
<
String
>(
compareObjMap
.
keySet
()),
code
);
for
(
CompareUnitDef
unitDef
:
currentCompareUnitDef
)
{
indicatorsReportService
.
dealDriveIndReportThreeData
(
unitDef
.
getCompareId
(),
Arrays
.
asList
(
unitDef
.
getIndIds
().
split
(
","
)),
unitDef
.
getDate
(),
code
);
}
}
}
}
if
(
"0"
.
equals
(
isTest
))
{
//整合基础项本期同期报表数据
logger
.
info
(
"本期同期对标单元试运行计算完成"
);
logger
.
info
(
"进行date:"
+
currentDate
+
" 基础项本期同期报表数据整合"
);
}
else
{
if
(!
compareObjMap
.
isEmpty
())
{
logger
.
info
(
"本期同期对标单元计算完成"
);
List
<
String
>
compareObjs
=
new
ArrayList
<
String
>(
compareObjMap
.
keySet
());
indicatorsReportService
.
dealBaseIndReportOneData
(
currentDate
,
compareObjs
,
code
);
}
//整合考核指标报表数据3
logger
.
info
(
"进行date:"
+
currentDate
+
" 指标报表3数据整合"
);
//删除历史数据
indicatorsReportService
.
deleteReportThreeDataByParam
(
currentDate
,
new
ArrayList
<
String
>(
compareObjMap
.
keySet
()),
code
);
for
(
CompareUnitDef
unitDef
:
currentCompareUnitDef
)
{
indicatorsReportService
.
dealDriveIndReportThreeData
(
unitDef
.
getCompareId
(),
Arrays
.
asList
(
unitDef
.
getIndIds
().
split
(
","
)),
unitDef
.
getDate
(),
code
);
}
}
logger
.
info
(
"本期同期对标单元计算完成"
);
}
}
}
}
})
})
...
...
src/main/java/com/keymobile/indicators/akka/actor/indicators/CompareUnitCalActor.java
View file @
084d81a1
...
@@ -50,6 +50,8 @@ public class CompareUnitCalActor extends AbstractActor{
...
@@ -50,6 +50,8 @@ public class CompareUnitCalActor extends AbstractActor{
private
String
code
;
//机构编码
private
String
code
;
//机构编码
private
String
isTest
;
private
final
ActorRef
startCompareUnitCalActor
;
//定义父actor
private
final
ActorRef
startCompareUnitCalActor
;
//定义父actor
static
public
Props
props
(
ActorRef
startCompareUnitCalActor
)
{
static
public
Props
props
(
ActorRef
startCompareUnitCalActor
)
{
...
@@ -71,6 +73,7 @@ public class CompareUnitCalActor extends AbstractActor{
...
@@ -71,6 +73,7 @@ public class CompareUnitCalActor extends AbstractActor{
averageObj
=
compareUnitDef
.
getAverageObj
();
averageObj
=
compareUnitDef
.
getAverageObj
();
objScoreRuleId
=
compareUnitDef
.
getObjScoreRuleId
();
objScoreRuleId
=
compareUnitDef
.
getObjScoreRuleId
();
code
=
compareUnitCalMsg
.
getCode
();
code
=
compareUnitCalMsg
.
getCode
();
isTest
=
compareUnitCalMsg
.
getIsTest
();
//新增运行日志记录
//新增运行日志记录
CompareUnitCalLog
compCalLog
=
new
CompareUnitCalLog
(
compareId
,
date
,
CompareUnitCalLog
compCalLog
=
new
CompareUnitCalLog
(
compareId
,
date
,
...
@@ -92,7 +95,8 @@ public class CompareUnitCalActor extends AbstractActor{
...
@@ -92,7 +95,8 @@ public class CompareUnitCalActor extends AbstractActor{
for
(
String
indId
:
indIdsList
)
{
for
(
String
indId
:
indIdsList
)
{
DriveIndIdCalMsg
driveIndIdCalMsg
=
new
DriveIndIdCalMsg
(
DriveIndIdCalMsg
driveIndIdCalMsg
=
new
DriveIndIdCalMsg
(
compareUnitDef
.
getCompareId
(),
indId
,
compareObjsList
,
compareUnitDef
.
getDate
(),
compareUnitDef
.
getCompareId
(),
indId
,
compareObjsList
,
compareUnitDef
.
getDate
(),
firstExe
,
averageObj
,
compCalLogId
,
compareUnitCalMsg
.
getCode
());
firstExe
,
averageObj
,
compCalLogId
,
compareUnitCalMsg
.
getCode
(),
compareUnitCalMsg
.
getIsTest
());
//start akka
//start akka
ActorRef
driveIndIdCalActor
=
this
.
getContext
()
ActorRef
driveIndIdCalActor
=
this
.
getContext
()
.
actorOf
(
Props
.
create
(
DriveIndIdCalActor
.
class
,
.
actorOf
(
Props
.
create
(
DriveIndIdCalActor
.
class
,
...
...
src/main/java/com/keymobile/indicators/akka/actor/indicators/DriveIndIdCalActor.java
View file @
084d81a1
This diff is collapsed.
Click to expand it.
src/main/java/com/keymobile/indicators/akka/actor/indicators/DriveIndIdObjCalActor.java
View file @
084d81a1
...
@@ -22,9 +22,11 @@ import com.keymobile.indicators.akka.message.indicators.GetBaseIndValueMsg;
...
@@ -22,9 +22,11 @@ import com.keymobile.indicators.akka.message.indicators.GetBaseIndValueMsg;
import
com.keymobile.indicators.model.entity.indicators.CompareUnitCalLog
;
import
com.keymobile.indicators.model.entity.indicators.CompareUnitCalLog
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndDef
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndDef
;
import
com.keymobile.indicators.model.entity.testrun.TestDriveIndCalResultDef
;
import
com.keymobile.indicators.service.hytobacco.CompareUnitCalLogService
;
import
com.keymobile.indicators.service.hytobacco.CompareUnitCalLogService
;
import
com.keymobile.indicators.service.hytobacco.DriveIndCalResultService
;
import
com.keymobile.indicators.service.hytobacco.DriveIndCalResultService
;
import
com.keymobile.indicators.service.hytobacco.DriveIndDefService
;
import
com.keymobile.indicators.service.hytobacco.DriveIndDefService
;
import
com.keymobile.indicators.service.testrun.TestDriveIndCalResultService
;
import
com.keymobile.indicators.utils.DateUtils
;
import
com.keymobile.indicators.utils.DateUtils
;
import
com.keymobile.indicators.utils.SpringUtil
;
import
com.keymobile.indicators.utils.SpringUtil
;
...
@@ -39,6 +41,8 @@ public class DriveIndIdObjCalActor extends AbstractActor{
...
@@ -39,6 +41,8 @@ public class DriveIndIdObjCalActor extends AbstractActor{
private
DriveIndCalResultService
driveIndCalResultService
=
SpringUtil
.
getBean
(
DriveIndCalResultService
.
class
);
private
DriveIndCalResultService
driveIndCalResultService
=
SpringUtil
.
getBean
(
DriveIndCalResultService
.
class
);
private
TestDriveIndCalResultService
testDriveIndCalResultService
=
SpringUtil
.
getBean
(
TestDriveIndCalResultService
.
class
);
private
CompareUnitCalLogService
compareUnitCalLogService
=
SpringUtil
.
getBean
(
CompareUnitCalLogService
.
class
);
private
CompareUnitCalLogService
compareUnitCalLogService
=
SpringUtil
.
getBean
(
CompareUnitCalLogService
.
class
);
private
String
compareId
;
private
String
compareId
;
...
@@ -65,6 +69,8 @@ public class DriveIndIdObjCalActor extends AbstractActor{
...
@@ -65,6 +69,8 @@ public class DriveIndIdObjCalActor extends AbstractActor{
private
String
code
;
//编码标识
private
String
code
;
//编码标识
private
String
isTest
;
//试运行
private
Map
<
String
,
Object
>
env
=
Maps
.
newHashMap
();
private
Map
<
String
,
Object
>
env
=
Maps
.
newHashMap
();
//定义线程安全的收集反馈确认消息list
//定义线程安全的收集反馈确认消息list
...
@@ -93,6 +99,7 @@ public class DriveIndIdObjCalActor extends AbstractActor{
...
@@ -93,6 +99,7 @@ public class DriveIndIdObjCalActor extends AbstractActor{
//日志记录id
//日志记录id
compCalLogId
=
driveIndIdObjCalMsg
.
getCompCalLogId
();
compCalLogId
=
driveIndIdObjCalMsg
.
getCompCalLogId
();
code
=
driveIndIdObjCalMsg
.
getCode
();
code
=
driveIndIdObjCalMsg
.
getCode
();
isTest
=
driveIndIdObjCalMsg
.
getIsTest
();
List
<
String
>
indIdList
=
new
ArrayList
<>();
//定义存储从考核指标公式解析出来的基础指标id
List
<
String
>
indIdList
=
new
ArrayList
<>();
//定义存储从考核指标公式解析出来的基础指标id
...
@@ -196,28 +203,51 @@ public class DriveIndIdObjCalActor extends AbstractActor{
...
@@ -196,28 +203,51 @@ public class DriveIndIdObjCalActor extends AbstractActor{
driveIndValue
=
String
.
format
(
"%.4f"
,
driveIndValue
=
String
.
format
(
"%.4f"
,
new
BigDecimal
(
Double
.
valueOf
(
driveIndValue
)));
new
BigDecimal
(
Double
.
valueOf
(
driveIndValue
)));
}
}
//判断结果表中是否已存在该结果数据,存在则覆盖
if
(
"0"
.
equals
(
isTest
))
{
//试运行
DriveIndCalResultDef
driveIndCalResult
=
driveIndCalResultService
.
//判断结果表中是否已存在该结果数据,存在则覆盖
findCalResultDataIsExist
(
compareId
,
compareObj
,
driveIndId
,
date
,
code
);
TestDriveIndCalResultDef
driveIndCalResult
=
testDriveIndCalResultService
.
if
(
driveIndCalResult
==
null
)
{
findCalResultDataIsExist
(
compareId
,
compareObj
,
driveIndId
,
date
,
code
);
driveIndCalResult
=
new
DriveIndCalResultDef
(
compareId
,
if
(
driveIndCalResult
==
null
)
{
driveIndId
,
compareObj
,
date
,
driveIndValue
,
unit
,
driveIndCalResult
=
new
TestDriveIndCalResultDef
(
compareId
,
"1"
,
"1"
,
"admin"
,
code
,
baseIndValueMsg
.
getCompareObjDesc
());
driveIndId
,
compareObj
,
date
,
driveIndValue
,
unit
,
"1"
,
"1"
,
"admin"
,
code
,
baseIndValueMsg
.
getCompareObjDesc
());
}
else
{
driveIndCalResult
.
setCode
(
code
);
driveIndCalResult
.
setUnit
(
unit
);
driveIndCalResult
.
setValue
(
driveIndValue
);
driveIndCalResult
.
setLastUpdateTime
(
DateUtils
.
formatDate
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
));
}
//保存进考核指标结果表中
testDriveIndCalResultService
.
saveOrUpdate
(
driveIndCalResult
);
//返回指标值回去算平均值和排名
CalIndAverageAndRankMsg
driveIndAverageAndRankMsg
=
new
CalIndAverageAndRankMsg
(
driveIndCalResult
.
getId
(),
compareId
,
driveIndId
,
compareObj
,
date
,
driveIndValue
,
unit
,
indType
,
scoreCardId
,
averageDriveIndFormula
,
compCalLogId
);
driveIndIdCalActor
.
tell
(
driveIndAverageAndRankMsg
,
ActorRef
.
noSender
());
}
else
{
}
else
{
driveIndCalResult
.
setCode
(
code
);
//判断结果表中是否已存在该结果数据,存在则覆盖
driveIndCalResult
.
setUnit
(
unit
);
DriveIndCalResultDef
driveIndCalResult
=
driveIndCalResultService
.
driveIndCalResult
.
setValue
(
driveIndValue
);
findCalResultDataIsExist
(
compareId
,
compareObj
,
driveIndId
,
date
,
code
);
driveIndCalResult
.
setLastUpdateTime
(
DateUtils
.
formatDate
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
));
if
(
driveIndCalResult
==
null
)
{
driveIndCalResult
=
new
DriveIndCalResultDef
(
compareId
,
driveIndId
,
compareObj
,
date
,
driveIndValue
,
unit
,
"1"
,
"1"
,
"admin"
,
code
,
baseIndValueMsg
.
getCompareObjDesc
());
}
else
{
driveIndCalResult
.
setCode
(
code
);
driveIndCalResult
.
setUnit
(
unit
);
driveIndCalResult
.
setValue
(
driveIndValue
);
driveIndCalResult
.
setLastUpdateTime
(
DateUtils
.
formatDate
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
));
}
//保存进考核指标结果表中
driveIndCalResultService
.
saveOrUpdate
(
driveIndCalResult
);
//返回指标值回去算平均值和排名
CalIndAverageAndRankMsg
driveIndAverageAndRankMsg
=
new
CalIndAverageAndRankMsg
(
driveIndCalResult
.
getId
(),
compareId
,
driveIndId
,
compareObj
,
date
,
driveIndValue
,
unit
,
indType
,
scoreCardId
,
averageDriveIndFormula
,
compCalLogId
);
driveIndIdCalActor
.
tell
(
driveIndAverageAndRankMsg
,
ActorRef
.
noSender
());
}
}
//保存进考核指标结果表中
driveIndCalResultService
.
saveOrUpdate
(
driveIndCalResult
);
//返回指标值回去算平均值和排名
CalIndAverageAndRankMsg
driveIndAverageAndRankMsg
=
new
CalIndAverageAndRankMsg
(
driveIndCalResult
.
getId
(),
compareId
,
driveIndId
,
compareObj
,
date
,
driveIndValue
,
unit
,
indType
,
scoreCardId
,
averageDriveIndFormula
,
compCalLogId
);
driveIndIdCalActor
.
tell
(
driveIndAverageAndRankMsg
,
ActorRef
.
noSender
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
//判断结果表中是否已存在该结果数据,存在则覆盖
//判断结果表中是否已存在该结果数据,存在则覆盖
// DriveIndCalResultDef driveIndCalResult = driveIndCalResultService.
// DriveIndCalResultDef driveIndCalResult = driveIndCalResultService.
...
...
src/main/java/com/keymobile/indicators/akka/actor/indicators/StartCompareUnitCalActor.java
View file @
084d81a1
...
@@ -15,6 +15,7 @@ import com.keymobile.indicators.akka.message.indicators.StartCompareUnitCalMsg;
...
@@ -15,6 +15,7 @@ import com.keymobile.indicators.akka.message.indicators.StartCompareUnitCalMsg;
import
com.keymobile.indicators.model.entity.indicators.CompareUnitDef
;
import
com.keymobile.indicators.model.entity.indicators.CompareUnitDef
;
import
com.keymobile.indicators.model.entity.objscorerule.ScoreRule
;
import
com.keymobile.indicators.model.entity.objscorerule.ScoreRule
;
import
com.keymobile.indicators.service.hytobacco.ScoreRuleService
;
import
com.keymobile.indicators.service.hytobacco.ScoreRuleService
;
import
com.keymobile.indicators.service.testrun.TestScoreRuleService
;
import
com.keymobile.indicators.utils.SpringUtil
;
import
com.keymobile.indicators.utils.SpringUtil
;
import
akka.actor.AbstractActor
;
import
akka.actor.AbstractActor
;
...
@@ -26,6 +27,8 @@ public class StartCompareUnitCalActor extends AbstractActor{
...
@@ -26,6 +27,8 @@ public class StartCompareUnitCalActor extends AbstractActor{
private
ScoreRuleService
scoreRuleServer
=
SpringUtil
.
getBean
(
ScoreRuleService
.
class
);
private
ScoreRuleService
scoreRuleServer
=
SpringUtil
.
getBean
(
ScoreRuleService
.
class
);
private
TestScoreRuleService
testScoreRuleServer
=
SpringUtil
.
getBean
(
TestScoreRuleService
.
class
);
private
List
<
CompareUnitDef
>
firstExeList
=
new
ArrayList
<>();
//先执行对标单元list
private
List
<
CompareUnitDef
>
firstExeList
=
new
ArrayList
<>();
//先执行对标单元list
private
List
<
CompareUnitDef
>
afterExeList
=
new
ArrayList
<>();
//后执行对标单元list
private
List
<
CompareUnitDef
>
afterExeList
=
new
ArrayList
<>();
//后执行对标单元list
...
@@ -42,6 +45,8 @@ public class StartCompareUnitCalActor extends AbstractActor{
...
@@ -42,6 +45,8 @@ public class StartCompareUnitCalActor extends AbstractActor{
private
String
code
=
null
;
//机构编码
private
String
code
=
null
;
//机构编码
private
String
isTest
=
null
;
//试运行,0:试运行 1:正式运行
private
final
ActorRef
beforeCompareUnitActor
;
//定义父actor
private
final
ActorRef
beforeCompareUnitActor
;
//定义父actor
static
public
Props
props
(
ActorRef
beforeCompareUnitActor
)
{
static
public
Props
props
(
ActorRef
beforeCompareUnitActor
)
{
...
@@ -57,6 +62,7 @@ public class StartCompareUnitCalActor extends AbstractActor{
...
@@ -57,6 +62,7 @@ public class StartCompareUnitCalActor extends AbstractActor{
return
receiveBuilder
()
return
receiveBuilder
()
.
match
(
StartCompareUnitCalMsg
.
class
,
startCompareUnitCalMsg
->
{
.
match
(
StartCompareUnitCalMsg
.
class
,
startCompareUnitCalMsg
->
{
code
=
startCompareUnitCalMsg
.
getCode
();
code
=
startCompareUnitCalMsg
.
getCode
();
isTest
=
startCompareUnitCalMsg
.
getIsTest
();
List
<
CompareUnitDef
>
compareUnitDefs
=
startCompareUnitCalMsg
.
getCompareInitDefs
();
List
<
CompareUnitDef
>
compareUnitDefs
=
startCompareUnitCalMsg
.
getCompareInitDefs
();
//将对标单元进行分类,需要先执行的先开始进行对标计算
//将对标单元进行分类,需要先执行的先开始进行对标计算
for
(
CompareUnitDef
unitDef
:
compareUnitDefs
)
{
for
(
CompareUnitDef
unitDef
:
compareUnitDefs
)
{
...
@@ -80,7 +86,8 @@ public class StartCompareUnitCalActor extends AbstractActor{
...
@@ -80,7 +86,8 @@ public class StartCompareUnitCalActor extends AbstractActor{
if
(!
firstExeList
.
isEmpty
())
{
if
(!
firstExeList
.
isEmpty
())
{
for
(
CompareUnitDef
unitDef
:
firstExeList
)
{
for
(
CompareUnitDef
unitDef
:
firstExeList
)
{
CompareUnitCalMsg
compareUnitCalMsg
=
new
CompareUnitCalMsg
(
unitDef
,
CompareUnitCalMsg
compareUnitCalMsg
=
new
CompareUnitCalMsg
(
unitDef
,
startCompareUnitCalMsg
.
getCode
());
startCompareUnitCalMsg
.
getCode
(),
startCompareUnitCalMsg
.
getIsTest
());
ActorRef
compareUnitCalActor
=
this
.
getContext
()
ActorRef
compareUnitCalActor
=
this
.
getContext
()
.
actorOf
(
Props
.
create
(
CompareUnitCalActor
.
class
,
.
actorOf
(
Props
.
create
(
CompareUnitCalActor
.
class
,
()->
new
CompareUnitCalActor
(
getSelf
())));
()->
new
CompareUnitCalActor
(
getSelf
())));
...
@@ -90,7 +97,8 @@ public class StartCompareUnitCalActor extends AbstractActor{
...
@@ -90,7 +97,8 @@ public class StartCompareUnitCalActor extends AbstractActor{
if
(!
afterExeList
.
isEmpty
())
{
if
(!
afterExeList
.
isEmpty
())
{
for
(
CompareUnitDef
unitDef
:
afterExeList
)
{
for
(
CompareUnitDef
unitDef
:
afterExeList
)
{
CompareUnitCalMsg
compareUnitCalMsg
=
new
CompareUnitCalMsg
(
unitDef
,
CompareUnitCalMsg
compareUnitCalMsg
=
new
CompareUnitCalMsg
(
unitDef
,
startCompareUnitCalMsg
.
getCode
());
startCompareUnitCalMsg
.
getCode
(),
startCompareUnitCalMsg
.
getIsTest
());
ActorRef
compareUnitCalActor
=
this
.
getContext
()
ActorRef
compareUnitCalActor
=
this
.
getContext
()
.
actorOf
(
Props
.
create
(
CompareUnitCalActor
.
class
,
.
actorOf
(
Props
.
create
(
CompareUnitCalActor
.
class
,
()->
new
CompareUnitCalActor
(
getSelf
())));
()->
new
CompareUnitCalActor
(
getSelf
())));
...
@@ -100,7 +108,11 @@ public class StartCompareUnitCalActor extends AbstractActor{
...
@@ -100,7 +108,11 @@ public class StartCompareUnitCalActor extends AbstractActor{
//发送确认消息给父actor
//发送确认消息给父actor
CurrentCompUnitExeMsg
currentCompUnitExeMsg
=
new
CurrentCompUnitExeMsg
(
1
,
""
);
CurrentCompUnitExeMsg
currentCompUnitExeMsg
=
new
CurrentCompUnitExeMsg
(
1
,
""
);
beforeCompareUnitActor
.
tell
(
currentCompUnitExeMsg
,
ActorRef
.
noSender
());
beforeCompareUnitActor
.
tell
(
currentCompUnitExeMsg
,
ActorRef
.
noSender
());
logger
.
info
(
"对标单元计算完成"
);
if
(
"0"
.
equals
(
isTest
))
{
logger
.
info
(
"对标单元试运行计算完成"
);
}
else
{
logger
.
info
(
"对标单元计算完成"
);
}
}
}
}
}
})
})
...
@@ -110,45 +122,81 @@ public class StartCompareUnitCalActor extends AbstractActor{
...
@@ -110,45 +122,81 @@ public class StartCompareUnitCalActor extends AbstractActor{
if
(!
afterExeList
.
isEmpty
())
{
if
(!
afterExeList
.
isEmpty
())
{
for
(
CompareUnitDef
unitDef
:
afterExeList
)
{
for
(
CompareUnitDef
unitDef
:
afterExeList
)
{
CompareUnitCalMsg
compareUnitCalMsg
=
new
CompareUnitCalMsg
(
unitDef
,
CompareUnitCalMsg
compareUnitCalMsg
=
new
CompareUnitCalMsg
(
unitDef
,
code
);
code
,
isTest
);
ActorRef
compareUnitCalActor
=
this
.
getContext
()
ActorRef
compareUnitCalActor
=
this
.
getContext
()
.
actorOf
(
Props
.
create
(
CompareUnitCalActor
.
class
,
.
actorOf
(
Props
.
create
(
CompareUnitCalActor
.
class
,
()->
new
CompareUnitCalActor
(
getSelf
())));
()->
new
CompareUnitCalActor
(
getSelf
())));
compareUnitCalActor
.
tell
(
compareUnitCalMsg
,
getSelf
());
compareUnitCalActor
.
tell
(
compareUnitCalMsg
,
getSelf
());
}
}
logger
.
info
(
"进行后执行对标单元计算...."
);
if
(
"0"
.
equals
(
isTest
))
{
logger
.
info
(
"进行后执行对标单元试运行计算...."
);
}
else
{
logger
.
info
(
"进行后执行对标单元计算...."
);
}
}
else
{
}
else
{
if
(!
calTypeExeList
.
isEmpty
())
{
if
(!
calTypeExeList
.
isEmpty
())
{
logger
.
info
(
"计算对标单元单位评分......"
);
if
(
"0"
.
equals
(
isTest
))
{
logger
.
info
(
"计算试运行对标单元单位评分......"
);
}
else
{
logger
.
info
(
"计算对标单元单位评分......"
);
}
for
(
CompareUnitDef
unitDef
:
calTypeExeList
)
{
for
(
CompareUnitDef
unitDef
:
calTypeExeList
)
{
scoreRuleServer
.
calObjScore
(
unitDef
.
getCompareId
(),
//试运行
Arrays
.
asList
(
unitDef
.
getIndIds
().
split
(
","
)),
if
(
"0"
.
equals
(
isTest
))
{
Arrays
.
asList
(
unitDef
.
getCompareObjs
().
split
(
","
)),
testScoreRuleServer
.
testCalObjScore
(
unitDef
.
getCompareId
(),
unitDef
.
getDate
(),
unitDef
.
getObjScoreRuleId
(),
code
);
Arrays
.
asList
(
unitDef
.
getIndIds
().
split
(
","
)),
Arrays
.
asList
(
unitDef
.
getCompareObjs
().
split
(
","
)),
unitDef
.
getDate
(),
unitDef
.
getObjScoreRuleId
(),
code
);
}
else
{
scoreRuleServer
.
calObjScore
(
unitDef
.
getCompareId
(),
Arrays
.
asList
(
unitDef
.
getIndIds
().
split
(
","
)),
Arrays
.
asList
(
unitDef
.
getCompareObjs
().
split
(
","
)),
unitDef
.
getDate
(),
unitDef
.
getObjScoreRuleId
(),
code
);
}
}
}
}
}
//发送确认消息给父actor
//发送确认消息给父actor
CurrentCompUnitExeMsg
currentCompUnitExeMsg
=
new
CurrentCompUnitExeMsg
(
1
,
""
);
CurrentCompUnitExeMsg
currentCompUnitExeMsg
=
new
CurrentCompUnitExeMsg
(
1
,
""
);
beforeCompareUnitActor
.
tell
(
currentCompUnitExeMsg
,
ActorRef
.
noSender
());
beforeCompareUnitActor
.
tell
(
currentCompUnitExeMsg
,
ActorRef
.
noSender
());
logger
.
info
(
"对标单元计算完成"
);
if
(
"0"
.
equals
(
isTest
))
{
logger
.
info
(
"对标单元试运行计算完成"
);
}
else
{
logger
.
info
(
"对标单元计算完成"
);
}
}
}
}
}
})
})
.
match
(
AfterExeConfirmMsg
.
class
,
afterExeConfirmMsg
->
{
.
match
(
AfterExeConfirmMsg
.
class
,
afterExeConfirmMsg
->
{
if
(++
numberOfAfterConfirm
>=
afterExeUnitSize
)
{
//全部后执行的子actor全部返回
if
(++
numberOfAfterConfirm
>=
afterExeUnitSize
)
{
//全部后执行的子actor全部返回
if
(!
calTypeExeList
.
isEmpty
())
{
if
(!
calTypeExeList
.
isEmpty
())
{
logger
.
info
(
"计算对标单元单位评分......"
);
if
(
"0"
.
equals
(
isTest
))
{
logger
.
info
(
"计算试运行对标单元单位评分......"
);
}
else
{
logger
.
info
(
"计算对标单元单位评分......"
);
}
for
(
CompareUnitDef
unitDef
:
calTypeExeList
)
{
for
(
CompareUnitDef
unitDef
:
calTypeExeList
)
{
scoreRuleServer
.
calObjScore
(
unitDef
.
getCompareId
(),
//试运行
Arrays
.
asList
(
unitDef
.
getIndIds
().
split
(
","
)),
if
(
"0"
.
equals
(
isTest
))
{
Arrays
.
asList
(
unitDef
.
getCompareObjs
().
split
(
","
)),
testScoreRuleServer
.
testCalObjScore
(
unitDef
.
getCompareId
(),
unitDef
.
getDate
(),
unitDef
.
getObjScoreRuleId
(),
code
);
Arrays
.
asList
(
unitDef
.
getIndIds
().
split
(
","
)),
Arrays
.
asList
(
unitDef
.
getCompareObjs
().
split
(
","
)),
unitDef
.
getDate
(),
unitDef
.
getObjScoreRuleId
(),
code
);
}
else
{
scoreRuleServer
.
calObjScore
(
unitDef
.
getCompareId
(),
Arrays
.
asList
(
unitDef
.
getIndIds
().
split
(
","
)),
Arrays
.
asList
(
unitDef
.
getCompareObjs
().
split
(
","
)),
unitDef
.
getDate
(),
unitDef
.
getObjScoreRuleId
(),
code
);
}
}
}
}
}
//发送确认消息给父actor
//发送确认消息给父actor
CurrentCompUnitExeMsg
currentCompUnitExeMsg
=
new
CurrentCompUnitExeMsg
(
1
,
""
);
CurrentCompUnitExeMsg
currentCompUnitExeMsg
=
new
CurrentCompUnitExeMsg
(
1
,
""
);
beforeCompareUnitActor
.
tell
(
currentCompUnitExeMsg
,
ActorRef
.
noSender
());
beforeCompareUnitActor
.
tell
(
currentCompUnitExeMsg
,
ActorRef
.
noSender
());
logger
.
info
(
"对标单元计算完成"
);
if
(
"0"
.
equals
(
isTest
))
{
logger
.
info
(
"对标单元试运行计算完成"
);
}
else
{
logger
.
info
(
"对标单元计算完成"
);
}
}
}
})
})
.
build
();
.
build
();
...
...
src/main/java/com/keymobile/indicators/akka/message/indicators/CompareUnitCalMsg.java
View file @
084d81a1
...
@@ -14,9 +14,12 @@ public class CompareUnitCalMsg implements Serializable{
...
@@ -14,9 +14,12 @@ public class CompareUnitCalMsg implements Serializable{
private
String
code
;
private
String
code
;
public
CompareUnitCalMsg
(
CompareUnitDef
compareUnitDef
,
String
code
)
{
private
String
isTest
;
public
CompareUnitCalMsg
(
CompareUnitDef
compareUnitDef
,
String
code
,
String
isTest
)
{
this
.
compareUnitDef
=
compareUnitDef
;
this
.
compareUnitDef
=
compareUnitDef
;
this
.
code
=
code
;
this
.
code
=
code
;
this
.
isTest
=
isTest
;
}
}
public
CompareUnitDef
getCompareUnitDef
()
{
public
CompareUnitDef
getCompareUnitDef
()
{
...
@@ -34,4 +37,12 @@ public class CompareUnitCalMsg implements Serializable{
...
@@ -34,4 +37,12 @@ public class CompareUnitCalMsg implements Serializable{
public
void
setCode
(
String
code
)
{
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
this
.
code
=
code
;
}
}
public
String
getIsTest
()
{
return
isTest
;
}
public
void
setIsTest
(
String
isTest
)
{
this
.
isTest
=
isTest
;
}
}
}
src/main/java/com/keymobile/indicators/akka/message/indicators/DriveIndIdCalMsg.java
View file @
084d81a1
...
@@ -18,9 +18,10 @@ public class DriveIndIdCalMsg implements Serializable{
...
@@ -18,9 +18,10 @@ public class DriveIndIdCalMsg implements Serializable{
private
String
averageObj
;
//平均分参考对象
private
String
averageObj
;
//平均分参考对象
private
Integer
compCalLogId
;
//运行日志记录id
private
Integer
compCalLogId
;
//运行日志记录id
private
String
code
;
//机构编码
private
String
code
;
//机构编码
private
String
isTest
;
//试运行 0:试运行 1:正式运行
public
DriveIndIdCalMsg
(
String
compareId
,
String
indId
,
List
<
String
>
compareObj
,
Integer
date
,
public
DriveIndIdCalMsg
(
String
compareId
,
String
indId
,
List
<
String
>
compareObj
,
Integer
date
,
String
firstExe
,
String
averageObj
,
Integer
compCalLogId
,
String
code
)
{
String
firstExe
,
String
averageObj
,
Integer
compCalLogId
,
String
code
,
String
isTest
)
{
this
.
compareId
=
compareId
;
this
.
compareId
=
compareId
;
this
.
indId
=
indId
;
this
.
indId
=
indId
;
this
.
compareObj
.
addAll
(
compareObj
);
this
.
compareObj
.
addAll
(
compareObj
);
...
@@ -29,6 +30,7 @@ public class DriveIndIdCalMsg implements Serializable{
...
@@ -29,6 +30,7 @@ public class DriveIndIdCalMsg implements Serializable{
this
.
averageObj
=
averageObj
;
this
.
averageObj
=
averageObj
;
this
.
compCalLogId
=
compCalLogId
;
this
.
compCalLogId
=
compCalLogId
;
this
.
code
=
code
;
this
.
code
=
code
;
this
.
isTest
=
isTest
;
}
}
public
String
getCompareId
()
{
public
String
getCompareId
()
{
...
@@ -84,4 +86,12 @@ public class DriveIndIdCalMsg implements Serializable{
...
@@ -84,4 +86,12 @@ public class DriveIndIdCalMsg implements Serializable{
public
void
setCode
(
String
code
)
{
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
this
.
code
=
code
;
}
}
public
String
getIsTest
()
{
return
isTest
;
}
public
void
setIsTest
(
String
isTest
)
{
this
.
isTest
=
isTest
;
}
}
}
src/main/java/com/keymobile/indicators/akka/message/indicators/DriveIndIdObjCalMsg.java
View file @
084d81a1
...
@@ -19,9 +19,11 @@ public class DriveIndIdObjCalMsg implements Serializable{
...
@@ -19,9 +19,11 @@ public class DriveIndIdObjCalMsg implements Serializable{
private
List
<
DimValue
>
dimValues
=
new
ArrayList
<>();
//维度值list
private
List
<
DimValue
>
dimValues
=
new
ArrayList
<>();
//维度值list
private
Integer
compCalLogId
;
//运行日志记录id
private
Integer
compCalLogId
;
//运行日志记录id
private
String
code
;
//机构编码
private
String
code
;
//机构编码
private
String
isTest
;
//试运行
public
DriveIndIdObjCalMsg
(
String
compareId
,
String
indId
,
String
compareObj
,
public
DriveIndIdObjCalMsg
(
String
compareId
,
String
indId
,
String
compareObj
,
Integer
date
,
List
<
DimValue
>
dimValues
,
Integer
compCalLogId
,
String
code
)
{
Integer
date
,
List
<
DimValue
>
dimValues
,
Integer
compCalLogId
,
String
code
,
String
isTest
)
{
this
.
compareId
=
compareId
;
this
.
compareId
=
compareId
;
this
.
indId
=
indId
;
this
.
indId
=
indId
;
this
.
compareObj
=
compareObj
;
this
.
compareObj
=
compareObj
;
...
@@ -29,6 +31,7 @@ public class DriveIndIdObjCalMsg implements Serializable{
...
@@ -29,6 +31,7 @@ public class DriveIndIdObjCalMsg implements Serializable{
this
.
dimValues
.
addAll
(
dimValues
);
this
.
dimValues
.
addAll
(
dimValues
);
this
.
compCalLogId
=
compCalLogId
;
this
.
compCalLogId
=
compCalLogId
;
this
.
code
=
code
;
this
.
code
=
code
;
this
.
isTest
=
isTest
;
}
}
public
String
getCompareId
()
{
public
String
getCompareId
()
{
...
@@ -77,4 +80,12 @@ public class DriveIndIdObjCalMsg implements Serializable{
...
@@ -77,4 +80,12 @@ public class DriveIndIdObjCalMsg implements Serializable{
public
void
setCode
(
String
code
)
{
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
this
.
code
=
code
;
}
}
public
String
getIsTest
()
{
return
isTest
;
}
public
void
setIsTest
(
String
isTest
)
{
this
.
isTest
=
isTest
;
}
}
}
src/main/java/com/keymobile/indicators/akka/message/indicators/StartCompareUnitCalMsg.java
View file @
084d81a1
...
@@ -16,9 +16,12 @@ public class StartCompareUnitCalMsg implements Serializable{
...
@@ -16,9 +16,12 @@ public class StartCompareUnitCalMsg implements Serializable{
private
String
code
;
private
String
code
;
public
StartCompareUnitCalMsg
(
List
<
CompareUnitDef
>
compareInitDefs
,
String
code
)
{
private
String
isTest
;
public
StartCompareUnitCalMsg
(
List
<
CompareUnitDef
>
compareInitDefs
,
String
code
,
String
isTest
)
{
this
.
compareInitDefs
.
addAll
(
compareInitDefs
);
this
.
compareInitDefs
.
addAll
(
compareInitDefs
);
this
.
code
=
code
;
this
.
code
=
code
;
this
.
setIsTest
(
isTest
);
}
}
public
List
<
CompareUnitDef
>
getCompareInitDefs
()
{
public
List
<
CompareUnitDef
>
getCompareInitDefs
()
{
...
@@ -36,4 +39,12 @@ public class StartCompareUnitCalMsg implements Serializable{
...
@@ -36,4 +39,12 @@ public class StartCompareUnitCalMsg implements Serializable{
public
void
setCode
(
String
code
)
{
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
this
.
code
=
code
;
}
}
public
String
getIsTest
()
{
return
isTest
;
}
public
void
setIsTest
(
String
isTest
)
{
this
.
isTest
=
isTest
;
}
}
}
src/main/java/com/keymobile/indicators/api/hytobacco/DriveIndCalResultCtrl.java
View file @
084d81a1
...
@@ -3,6 +3,7 @@ package com.keymobile.indicators.api.hytobacco;
...
@@ -3,6 +3,7 @@ package com.keymobile.indicators.api.hytobacco;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
@@ -35,17 +36,33 @@ public class DriveIndCalResultCtrl {
...
@@ -35,17 +36,33 @@ public class DriveIndCalResultCtrl {
driveIndCalResultService
.
batchSaveOrUpdate
(
calResults
);
driveIndCalResultService
.
batchSaveOrUpdate
(
calResults
);
}
}
@ApiOperation
(
value
=
"对标单元综合计算"
,
notes
=
"对标单元综合计算"
)
@ApiOperation
(
value
=
"对标单元综合计算
(isTest: 0试运行 1正式运行)
"
,
notes
=
"对标单元综合计算"
)
@PostMapping
(
value
=
"/compareUnitListCal"
)
@PostMapping
(
value
=
"/compareUnitListCal"
)
public
void
compareUnitListCal
(
@RequestBody
List
<
CompareUnitDef
>
compareUnitList
,
public
void
compareUnitListCal
(
@RequestBody
List
<
CompareUnitDef
>
compareUnitList
,
@RequestParam
(
value
=
"code"
,
required
=
false
)
String
code
)
{
@RequestParam
(
value
=
"code"
,
required
=
false
)
String
code
,
@RequestParam
(
value
=
"isTest"
,
required
=
false
)
String
isTest
)
throws
Exception
{
if
(
StringUtils
.
isBlank
(
code
))
{
throw
new
Exception
(
"user org number is null"
);
}
if
(
StringUtils
.
isBlank
(
isTest
))
{
//空值默认为正式运算
isTest
=
"1"
;
}
else
{
if
(!
"0"
.
equals
(
isTest
)
&&
!
"1"
.
equals
(
isTest
))
{
throw
new
Exception
(
"the param isTest's value must be '0' or '1'"
);
}
}
StringBuilder
compUnitDefString
=
new
StringBuilder
(
""
);
StringBuilder
compUnitDefString
=
new
StringBuilder
(
""
);
for
(
CompareUnitDef
compUnitDef
:
compareUnitList
)
{
for
(
CompareUnitDef
compUnitDef
:
compareUnitList
)
{
compUnitDefString
.
append
(
compUnitDef
.
getCompareId
()).
append
(
";"
);
compUnitDefString
.
append
(
compUnitDef
.
getCompareId
()).
append
(
";"
);
}
}
LogManager
.
logInfo
(
Constants
.
LOG_INDICATOR_UNIT_CAL_API
,
"执行对标单元id:{},日期:{} 的计算"
,
if
(
"0"
.
equals
(
isTest
))
{
compUnitDefString
.
toString
(),
compareUnitList
.
get
(
0
).
getDate
());
LogManager
.
logInfo
(
Constants
.
LOG_INDICATOR_UNIT_CAL_API
,
"执行对标单元id:{},日期:{} 的试运行计算"
,
driveIndCalResultService
.
compareUnitListCal
(
compareUnitList
,
code
);
compUnitDefString
.
toString
(),
compareUnitList
.
get
(
0
).
getDate
());
}
else
{
LogManager
.
logInfo
(
Constants
.
LOG_INDICATOR_UNIT_CAL_API
,
"执行对标单元id:{},日期:{} 的计算"
,
compUnitDefString
.
toString
(),
compareUnitList
.
get
(
0
).
getDate
());
}
driveIndCalResultService
.
compareUnitListCal
(
compareUnitList
,
code
,
isTest
);
}
}
@ApiOperation
(
value
=
"根据对标单元id分页获取日志详情"
,
notes
=
"根据对标单元id分页获取日志详情"
)
@ApiOperation
(
value
=
"根据对标单元id分页获取日志详情"
,
notes
=
"根据对标单元id分页获取日志详情"
)
...
...
src/main/java/com/keymobile/indicators/model/entity/testrun/TestDriveIndCalResultDef.java
0 → 100644
View file @
084d81a1
package
com
.
keymobile
.
indicators
.
model
.
entity
.
testrun
;
import
java.util.Date
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
com.keymobile.indicators.utils.DateUtils
;
import
lombok.Data
;
/**
* author:zhangkb time:2020-8-31 desc:试运行考核指标结果表
*/
@Data
@Table
(
name
=
"test_drive_ind_cal_result_def"
)
public
class
TestDriveIndCalResultDef
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
private
String
compareId
;
private
String
indId
;
private
String
compareObj
;
private
String
compareObjDesc
;
private
Integer
date
;
private
String
value
;
private
String
unit
;
private
String
type
;
//0:季度 1:年度
private
String
isRight
;
//表示考核指标的值是否计算正常得到的 0:计算有误 1:计算正常
private
String
lastUpdateTime
=
DateUtils
.
formatDate
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
);
private
String
lastUpdater
;
private
String
average
;
//组内平均数
private
Integer
rank
;
//同组排名
private
String
score
;
//指标评分分数
private
String
improveScore
;
//改善提升得分
private
String
actualAverage
;
//实际平均数:用于省对市的操作,如果有全省的基础项数据,直接拿全省的基础项数据算考核指标做为其实际平均值
private
String
code
;
//编码标识
public
TestDriveIndCalResultDef
()
{
super
();
}
public
TestDriveIndCalResultDef
(
String
compareId
,
String
indId
,
String
compareObj
,
int
date
,
String
value
,
String
unit
,
String
type
,
String
isRight
,
String
lastUpdater
,
String
code
,
String
compareObjDesc
)
{
this
.
compareId
=
compareId
;
this
.
indId
=
indId
;
this
.
compareObj
=
compareObj
;
this
.
date
=
date
;
this
.
value
=
value
;
this
.
unit
=
unit
;
this
.
type
=
type
;
this
.
isRight
=
isRight
;
this
.
lastUpdater
=
lastUpdater
;
this
.
code
=
code
;
this
.
compareObjDesc
=
compareObjDesc
;
}
}
src/main/java/com/keymobile/indicators/model/entity/testrun/TestObjScoreCalResult.java
0 → 100644
View file @
084d81a1
package
com
.
keymobile
.
indicators
.
model
.
entity
.
testrun
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
lombok.Data
;
/**
*author:zhangkb time:2020-8-31 desc:试运行单位评分结果存放实体
*/
@Data
@Table
(
name
=
"test_obj_score_cal_result"
)
public
class
TestObjScoreCalResult
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
private
String
compareId
;
//对标单元id
private
String
compareObj
;
//对标对象
private
String
compareObjDesc
;
//对标对象描述
private
String
indIds
;
//对标考核指标id
private
Integer
date
;
//对标日期
private
String
scoreValue
;
//考核对象得分
private
String
improveValue
;
//考核对象改善得分
private
String
scoreSumValue
;
//指标总积分
private
Integer
indCount
;
//指标个数
private
String
code
;
//机构编码
}
src/main/java/com/keymobile/indicators/model/mapper/testrun/TestDriveIndCalResultDefMapper.java
0 → 100644
View file @
084d81a1
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
testrun
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
com.keymobile.indicators.model.entity.testrun.TestDriveIndCalResultDef
;
import
tk.mybatis.mapper.common.BaseMapper
;
@Mapper
public
interface
TestDriveIndCalResultDefMapper
extends
BaseMapper
<
TestDriveIndCalResultDef
>{
public
List
<
TestDriveIndCalResultDef
>
findByCompareObjAndDate
(
@Param
(
"compareObj"
)
String
compareObj
,
@Param
(
"date"
)
int
date
,
@Param
(
"code"
)
String
code
);
public
TestDriveIndCalResultDef
findByIndIdAndDateAndCompareObj
(
@Param
(
"indId"
)
String
indId
,
@Param
(
"date"
)
int
date
,
@Param
(
"compareObj"
)
String
compareObj
,
@Param
(
"code"
)
String
code
);
public
TestDriveIndCalResultDef
findByCompareIdAndCompareObjAndIndIdAndDate
(
@Param
(
"compareId"
)
String
compareId
,
@Param
(
"compareObj"
)
String
compareObj
,
@Param
(
"indId"
)
String
indId
,
@Param
(
"date"
)
Integer
date
,
@Param
(
"code"
)
String
code
);
//批量保存
public
void
batchSave
(
@Param
(
"datas"
)
List
<
TestDriveIndCalResultDef
>
datas
);
//批量修改
public
void
batchUpdate
(
@Param
(
"datas"
)
List
<
TestDriveIndCalResultDef
>
datas
);
}
src/main/java/com/keymobile/indicators/model/mapper/testrun/TestObjScoreCalResultMapper.java
0 → 100644
View file @
084d81a1
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
testrun
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
com.keymobile.indicators.model.entity.testrun.TestObjScoreCalResult
;
import
tk.mybatis.mapper.common.BaseMapper
;
@Mapper
public
interface
TestObjScoreCalResultMapper
extends
BaseMapper
<
TestObjScoreCalResult
>{
public
TestObjScoreCalResult
getTestObjScoreCalResultByParam
(
@Param
(
"compareId"
)
String
compareId
,
@Param
(
"compareObj"
)
String
compareObj
,
@Param
(
"date"
)
Integer
date
,
@Param
(
"code"
)
String
code
);
public
void
batchSave
(
@Param
(
"datas"
)
List
<
TestObjScoreCalResult
>
datas
);
public
void
batchUpdate
(
@Param
(
"datas"
)
List
<
TestObjScoreCalResult
>
datas
);
}
src/main/java/com/keymobile/indicators/service/hytobacco/DriveIndCalResultService.java
View file @
084d81a1
...
@@ -73,7 +73,7 @@ public class DriveIndCalResultService {
...
@@ -73,7 +73,7 @@ public class DriveIndCalResultService {
return
driveIndCalResultDefMapper
.
findByCompareIdAndDate
(
compareId
,
date
);
return
driveIndCalResultDefMapper
.
findByCompareIdAndDate
(
compareId
,
date
);
}
}
public
void
compareUnitListCal
(
List
<
CompareUnitDef
>
compareUnitList
,
String
code
)
{
public
void
compareUnitListCal
(
List
<
CompareUnitDef
>
compareUnitList
,
String
code
,
String
isTest
)
{
if
(!
compareUnitList
.
isEmpty
())
{
if
(!
compareUnitList
.
isEmpty
())
{
List
<
CompareUnitDef
>
sameCompareUnitList
=
new
ArrayList
<>();
List
<
CompareUnitDef
>
sameCompareUnitList
=
new
ArrayList
<>();
//将对标单元的日期改成同期
//将对标单元的日期改成同期
...
@@ -85,7 +85,7 @@ public class DriveIndCalResultService {
...
@@ -85,7 +85,7 @@ public class DriveIndCalResultService {
//启动回流actor
//启动回流actor
final
ActorSystem
system
=
ActorSystem
.
create
(
"CompareUnitCalAkka"
);
//创建akka
final
ActorSystem
system
=
ActorSystem
.
create
(
"CompareUnitCalAkka"
);
//创建akka
StartCompareUnitCalMsg
startCompareUnitCalMsg
=
new
StartCompareUnitCalMsg
(
StartCompareUnitCalMsg
startCompareUnitCalMsg
=
new
StartCompareUnitCalMsg
(
sameCompareUnitList
,
code
);
sameCompareUnitList
,
code
,
isTest
);
ActorRef
beforeCompareUnitCalActor
=
system
.
actorOf
(
Props
.
create
(
ActorRef
beforeCompareUnitCalActor
=
system
.
actorOf
(
Props
.
create
(
BeforeCompareUnitCalActor
.
class
,()->
new
BeforeCompareUnitCalActor
()));
BeforeCompareUnitCalActor
.
class
,()->
new
BeforeCompareUnitCalActor
()));
beforeCompareUnitCalActor
.
tell
(
startCompareUnitCalMsg
,
ActorRef
.
noSender
());
beforeCompareUnitCalActor
.
tell
(
startCompareUnitCalMsg
,
ActorRef
.
noSender
());
...
...
src/main/java/com/keymobile/indicators/service/testrun/TestDriveIndCalResultService.java
0 → 100644
View file @
084d81a1
package
com
.
keymobile
.
indicators
.
service
.
testrun
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.keymobile.indicators.model.entity.testrun.TestDriveIndCalResultDef
;
import
com.keymobile.indicators.model.mapper.testrun.TestDriveIndCalResultDefMapper
;
@Service
public
class
TestDriveIndCalResultService
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
TestDriveIndCalResultService
.
class
);
@Autowired
private
TestDriveIndCalResultDefMapper
testDriveIndCalResultDefMapper
;
public
TestDriveIndCalResultDef
findById
(
Integer
id
)
{
return
testDriveIndCalResultDefMapper
.
selectByPrimaryKey
(
id
);
}
public
TestDriveIndCalResultDef
findCompareObjInfo
(
String
driveIndId
,
int
date
,
String
compareObj
,
String
code
)
{
return
testDriveIndCalResultDefMapper
.
findByIndIdAndDateAndCompareObj
(
driveIndId
,
date
,
compareObj
,
code
);
}
public
TestDriveIndCalResultDef
findCalResultDataIsExist
(
String
compareId
,
String
compareObj
,
String
indId
,
int
date
,
String
code
)
{
return
testDriveIndCalResultDefMapper
.
findByCompareIdAndCompareObjAndIndIdAndDate
(
compareId
,
compareObj
,
indId
,
date
,
code
);
}
public
int
saveOrUpdate
(
TestDriveIndCalResultDef
driveIndCalResult
)
{
if
(
driveIndCalResult
.
getId
()==
null
)
{
testDriveIndCalResultDefMapper
.
insert
(
driveIndCalResult
);
}
else
{
testDriveIndCalResultDefMapper
.
updateByPrimaryKey
(
driveIndCalResult
);
}
return
driveIndCalResult
.
getId
();
}
//批量新增或者修改
public
void
batchSaveOrUpdate
(
List
<
TestDriveIndCalResultDef
>
driveIndCalResults
)
{
List
<
TestDriveIndCalResultDef
>
addList
=
new
ArrayList
<>();
List
<
TestDriveIndCalResultDef
>
updateList
=
new
ArrayList
<>();
for
(
TestDriveIndCalResultDef
driveIndCalResult
:
driveIndCalResults
)
{
if
(
driveIndCalResult
.
getId
()==
null
)
{
addList
.
add
(
driveIndCalResult
);
//新增list
}
else
{
updateList
.
add
(
driveIndCalResult
);
//修改list
}
}
if
(!
addList
.
isEmpty
())
{
//批量新增
testDriveIndCalResultDefMapper
.
batchSave
(
addList
);
}
if
(!
updateList
.
isEmpty
())
{
//批量修改
testDriveIndCalResultDefMapper
.
batchUpdate
(
updateList
);
}
}
}
src/main/java/com/keymobile/indicators/service/testrun/TestScoreRuleService.java
0 → 100644
View file @
084d81a1
This diff is collapsed.
Click to expand it.
src/main/resources/mybatis/mapping/TestDriveIndCalResultDefMapper.xml
0 → 100644
View file @
084d81a1
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.keymobile.indicators.model.mapper.testrun.TestDriveIndCalResultDefMapper"
>
<select
id=
"findByCompareObjAndDate"
resultType=
"com.keymobile.indicators.model.entity.testrun.TestDriveIndCalResultDef"
>
select *
from test_drive_ind_cal_result_def
where
compare_obj = #{compareObj} and
date = #{date} and
code = #{code}
</select>
<select
id=
"findByIndIdAndDateAndCompareObj"
resultType=
"com.keymobile.indicators.model.entity.testrun.TestDriveIndCalResultDef"
>
select *
from test_drive_ind_cal_result_def
where
ind_id = #{indId} and
compare_obj = #{compareObj} and
date = #{date} and
code = #{code}
</select>
<select
id=
"findByCompareIdAndCompareObjAndIndIdAndDate"
resultType=
"com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef"
>
select *
from test_drive_ind_cal_result_def
where
compare_id = #{compareId} and
compare_obj = #{compareObj} and
ind_id = #{indId} and
date = #{date} and
code = #{code}
</select>
<insert
id=
"batchSave"
parameterType=
"java.util.List"
>
insert into test_drive_ind_cal_result_def(
compare_id, ind_id, compare_obj, compare_obj_desc, date, value, unit, type,
is_right, last_update_time, last_updater, average, rank, score, improve_score,
actual_average, code)
values
<foreach
collection=
"datas"
item=
"val"
separator=
","
>
(
#{val.compareId}, #{val.indId}, #{val.compareObj}, #{val.compareObjDesc}, #{val.date},
#{val.value},#{val.unit},#{val.type},#{val.isRight},#{val.lastUpdateTime},#{val.lastUpdater},
#{val.average},#{val.rank},#{val.score},#{val.improveScore},#{val.actualAverage},#{val.code}
)
</foreach>
</insert>
<update
id=
"batchUpdate"
parameterType=
"java.util.List"
>
<foreach
collection=
"datas"
item=
"val"
index=
"index"
separator=
";"
>
update test_drive_ind_cal_result_def
<set>
<if
test=
"val.compareId != null"
>
compare_id = #{val.compareId},
</if>
<if
test=
"val.indId != null"
>
ind_id = #{val.indId},
</if>
<if
test=
"val.compareObj != null"
>
compare_obj = #{val.compareObj},
</if>
<if
test=
"val.compareObjDesc != null"
>
compare_obj_desc = #{val.compareObjDesc},
</if>
<if
test=
"val.date != null"
>
date = #{val.date},
</if>
<if
test=
"val.value != null"
>
value = #{val.value},
</if>
<if
test=
"val.unit != null"
>
unit = #{val.unit},
</if>
<if
test=
"val.type != null"
>
type = #{val.type},
</if>
<if
test=
"val.isRight != null"
>
is_right = #{val.isRight},
</if>
<if
test=
"val.lastUpdateTime != null"
>
last_update_time = #{val.lastUpdateTime},
</if>
<if
test=
"val.lastUpdater != null"
>
last_updater = #{val.lastUpdater},
</if>
<if
test=
"val.average != null"
>
average = #{val.average},
</if>
<if
test=
"val.rank != null"
>
rank = #{val.rank},
</if>
<if
test=
"val.score != null"
>
score = #{val.score},
</if>
<if
test=
"val.improveScore != null"
>
improve_score = #{val.improveScore},
</if>
<if
test=
"val.actualAverage != null"
>
actual_average = #{val.actualAverage},
</if>
<if
test=
"val.code != null"
>
code = #{val.code},
</if>
</set>
where id = ${val.id}
</foreach>
</update>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/TestObjScoreCalResultMapper.xml
0 → 100644
View file @
084d81a1
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.keymobile.indicators.model.mapper.testrun.TestObjScoreCalResultMapper"
>
<select
id=
"getTestObjScoreCalResultByParam"
resultType=
"com.keymobile.indicators.model.entity.testrun.TestObjScoreCalResult"
>
select *
from test_obj_score_cal_result
where
compare_id=#{compareId} and
compare_obj=#{compareObj} and
date=#{date} and
code=#{code}
</select>
<insert
id=
"batchSave"
parameterType=
"java.util.List"
>
insert into test_obj_score_cal_result(
compare_id, compare_obj, compare_obj_desc, ind_ids, date, score_value, improve_value,
score_sum_value, ind_count, code)
values
<foreach
collection=
"datas"
item=
"val"
separator=
","
>
(
#{val.compareId}, #{val.compareObj}, #{val.compareObjDesc}, #{val.indIds}, #{val.date},
#{val.scoreValue},#{val.improveValue},#{val.scoreSumValue},#{val.indCount},#{val.code})
</foreach>
</insert>
<update
id=
"batchUpdate"
parameterType=
"java.util.List"
>
<foreach
collection=
"datas"
item=
"val"
separator=
";"
>
update test_obj_score_cal_result
<set>
<if
test=
"val.compareId != null"
>
compare_id = #{val.compareId},
</if>
<if
test=
"val.compareObj != null"
>
compare_obj = #{val.compareObj},
</if>
<if
test=
"val.compareObjDesc != null"
>
compare_obj_desc = #{val.compareObjDesc},
</if>
<if
test=
"val.indIds != null"
>
ind_ids = #{val.indIds},
</if>
<if
test=
"val.date != null"
>
date = #{val.date},
</if>
<if
test=
"val.scoreValue != null"
>
score_value = #{val.scoreValue},
</if>
<if
test=
"val.improveValue != null"
>
improve_value = #{val.improveValue},
</if>
<if
test=
"val.scoreSumValue != null"
>
score_sum_value = #{val.scoreSumValue},
</if>
<if
test=
"val.indCount != null"
>
ind_count = #{val.indCount},
</if>
<if
test=
"val.code != null"
>
code = #{val.code},
</if>
</set>
where id = ${val.id}
</foreach>
</update>
</mapper>
\ 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