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
d32833c2
Commit
d32833c2
authored
Aug 24, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
报表地区指标分布报表3代码提交
parent
f3525e0a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
272 additions
and
5 deletions
+272
-5
BeforeCompareUnitCalActor.java
...tors/akka/actor/indicators/BeforeCompareUnitCalActor.java
+5
-0
IndicatorsReportThree.java
...indicators/model/entity/report/IndicatorsReportThree.java
+1
-0
IndicatorsReportService.java
...le/indicators/service/report/IndicatorsReportService.java
+261
-3
ReportThreeMapper.xml
src/main/resources/mybatis/mapping/ReportThreeMapper.xml
+5
-2
No files found.
src/main/java/com/keymobile/indicators/akka/actor/indicators/BeforeCompareUnitCalActor.java
View file @
d32833c2
...
@@ -96,6 +96,11 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
...
@@ -96,6 +96,11 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
indicatorsReportService
.
dealDriveIndReportTwoData
(
indicatorsReportService
.
dealDriveIndReportTwoData
(
unitDef
.
getCompareId
(),
Arrays
.
asList
(
unitDef
.
getIndIds
().
split
(
","
)),
unitDef
.
getCompareId
(),
Arrays
.
asList
(
unitDef
.
getIndIds
().
split
(
","
)),
Arrays
.
asList
(
unitDef
.
getCompareObjs
().
split
(
","
)),
unitDef
.
getDate
());
Arrays
.
asList
(
unitDef
.
getCompareObjs
().
split
(
","
)),
unitDef
.
getDate
());
//整合考核指标报表数据3
indicatorsReportService
.
dealDriveIndReportThreeData
(
unitDef
.
getCompareId
(),
Arrays
.
asList
(
unitDef
.
getIndIds
().
split
(
","
)),
unitDef
.
getDate
());
}
}
}
}
...
...
src/main/java/com/keymobile/indicators/model/entity/report/IndicatorsReportThree.java
View file @
d32833c2
...
@@ -29,4 +29,5 @@ public class IndicatorsReportThree {
...
@@ -29,4 +29,5 @@ public class IndicatorsReportThree {
private
Integer
indImproveHeadThreeCount
;
//指标提升排名前三的指标个数
private
Integer
indImproveHeadThreeCount
;
//指标提升排名前三的指标个数
private
Integer
indImproveAfterThreeCount
;
//指标提升排名末三的指标个数
private
Integer
indImproveAfterThreeCount
;
//指标提升排名末三的指标个数
private
String
indImproveRate
;
//指标提升率
private
String
indImproveRate
;
//指标提升率
private
Integer
effectiveIndCount
;
//有效的指标个数
}
}
src/main/java/com/keymobile/indicators/service/report/IndicatorsReportService.java
View file @
d32833c2
package
com
.
keymobile
.
indicators
.
service
.
report
;
package
com
.
keymobile
.
indicators
.
service
.
report
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
...
@@ -121,13 +122,266 @@ public class IndicatorsReportService {
...
@@ -121,13 +122,266 @@ public class IndicatorsReportService {
}
}
}
}
@Async
public
void
dealDriveIndReportThreeData
(
String
compareId
,
List
<
String
>
indIds
,
Integer
date
)
{
public
void
dealDriveIndReportThreeData
(
String
compareId
,
List
<
String
>
indIds
,
Integer
date
)
{
List
<
IndicatorsReportThree
>
dataList
=
new
ArrayList
<>();
List
<
IndicatorsReportThree
>
dataList
=
new
ArrayList
<>();
String
type
=
this
.
getCompareType
(
date
);
for
(
String
indId
:
indIds
)
{
Map
<
String
,
String
>
improveValue
=
new
HashMap
<>();
//定义存储地区指标增幅,用于排名使用
String
indRule
=
null
;
String
growCalType
=
null
;
//根据indId获取指标信息
DriveIndDef
driveIndDef
=
driveIndDefMapper
.
selectByPrimaryKey
(
indId
);
if
(
driveIndDef
!=
null
)
{
//获取指标正反属性
indRule
=
driveIndDef
.
getIndRule
();
//获取指标增幅类型
growCalType
=
driveIndDef
.
getGrowCalType
();
}
//根据指标编号,对标单元id和日期获取指标考核结果
List
<
DriveIndCalResultDef
>
calResults
=
driveIndCalResultDefMapper
.
findByIndIdAndDateAndCompareIdAndSort
(
indId
,
date
,
compareId
);
if
(!
calResults
.
isEmpty
())
{
for
(
DriveIndCalResultDef
calResult
:
calResults
)
{
//判断是否存在
IndicatorsReportThree
indReportData
=
reportThreeMapper
.
getByParam
(
calResult
.
getCompareObj
(),
date
,
type
);
if
(
indReportData
==
null
)
{
indReportData
=
new
IndicatorsReportThree
();
}
indReportData
.
setCompareObj
(
calResult
.
getCompareObj
());
indReportData
.
setCompareObjDesc
(
calResult
.
getCompareObjDesc
());
indReportData
.
setCompareDate
(
date
);
indReportData
.
setCompareType
(
type
);
if
(
StringUtils
.
isNotBlank
(
indRule
)
&&
StringUtils
.
isNotBlank
(
growCalType
))
{
//填充优劣平均数指标个数
indReportData
=
this
.
fillAverageCount
(
indReportData
,
calResult
,
indRule
);
//填充排名前三末三指标个数
indReportData
=
this
.
fillRankHeadAndAfterCount
(
indReportData
,
calResults
,
indRule
);
//判断是否存在同期数据
DriveIndCalResultDef
sameCalResult
=
driveIndCalResultDefMapper
.
findByCompareIdAndCompareObjAndIndIdAndDate
(
compareId
,
calResult
.
getCompareObj
(),
indId
,
(
date
-
100
));
//有同期值
if
(
sameCalResult
!=
null
)
{
//有效指标加1
if
(
indReportData
.
getEffectiveIndCount
()==
null
)
{
indReportData
.
setEffectiveIndCount
(
1
);
}
else
{
indReportData
.
setEffectiveIndCount
(
indReportData
.
getEffectiveIndCount
()+
1
);
}
//算增幅
if
(!
"NaN"
.
equals
(
sameCalResult
.
getValue
())
&&
!
"Infinite"
.
equals
(
sameCalResult
.
getValue
())
&&
StringUtils
.
isNotBlank
(
sameCalResult
.
getValue
())
&&
!
"NaN"
.
equals
(
calResult
.
getValue
())
&&
!
"Infinite"
.
equals
(
calResult
.
getValue
())
&&
StringUtils
.
isNotBlank
(
calResult
.
getValue
()))
{
String
calGowthValue
=
CalculateUtils
.
calGowth
(
calResult
.
getValue
(),
sameCalResult
.
getValue
(),
growCalType
);
if
(
StringUtils
.
isNotBlank
(
calGowthValue
))
{
if
(
Double
.
parseDouble
(
calGowthValue
)>
0
)
{
//同比提升
//填充指标提升个数
if
(
indReportData
.
getIndImproveCount
()==
null
)
{
indReportData
.
setIndImproveCount
(
1
);
}
else
{
indReportData
.
setIndImproveCount
(
indReportData
.
getIndImproveCount
()+
1
);
}
}
improveValue
.
put
(
calResult
.
getCompareObj
(),
calGowthValue
);
}
}
}
}
//算指标提升率
if
(
indReportData
.
getEffectiveIndCount
()!=
null
&&
indReportData
.
getIndImproveCount
()!=
null
)
{
String
improveRate
=
String
.
format
(
"%.4f"
,
new
BigDecimal
(
indReportData
.
getIndImproveCount
()/
indReportData
.
getEffectiveIndCount
()*
100.0
));
indReportData
.
setIndImproveRate
(
improveRate
);
}
//加入list中
dataList
.
add
(
indReportData
);
}
}
//算提升前三末三指标个数
if
(!
improveValue
.
isEmpty
())
{
Map
<
String
,
Integer
>
resultRank
=
new
HashMap
<>();
if
(
"1"
.
equals
(
growCalType
))
{
//差比,无论正反向,都有大到小排序
resultRank
=
CalculateUtils
.
rankValue
(
improveValue
,
"0"
);
}
else
{
//差值
resultRank
=
CalculateUtils
.
rankValue
(
improveValue
,
indRule
);
}
//提升前三
dataList
=
this
.
fillImproveHeadAndAfterCount
(
resultRank
,
dataList
,
0
);
//提升末三
dataList
=
this
.
fillImproveHeadAndAfterCount
(
resultRank
,
dataList
,
1
);
}
}
this
.
batchSaveOrUpdateReportThree
(
dataList
);
this
.
batchSaveOrUpdateReportThree
(
dataList
);
}
}
//type:0 从小到大 1从大到小
private
List
<
IndicatorsReportThree
>
fillImproveHeadAndAfterCount
(
Map
<
String
,
Integer
>
resultRank
,
List
<
IndicatorsReportThree
>
dataList
,
Integer
type
){
resultRank
=
CalculateUtils
.
sortMapByValue
(
resultRank
,
type
);
//按照value从小到大排序
int
limitNum
=
0
;
for
(
IndicatorsReportThree
indReportData
:
dataList
)
{
for
(
Map
.
Entry
<
String
,
Integer
>
map
:
resultRank
.
entrySet
())
{
if
(
map
.
getValue
()==
1
||
map
.
getValue
()==
2
||
map
.
getValue
()==
3
)
{
if
(
indReportData
.
getCompareObj
().
equals
(
map
.
getKey
()))
{
if
(
map
.
getValue
()==
1
)
{
if
(
type
==
0
)
{
//填充提升前三指标个数
if
(
indReportData
.
getIndImproveHeadThreeCount
()==
null
)
{
indReportData
.
setIndImproveHeadThreeCount
(
1
);
}
else
{
indReportData
.
setIndImproveHeadThreeCount
(
indReportData
.
getIndImproveHeadThreeCount
()+
1
);
}
limitNum
++;
break
;
}
else
{
//填充提升末三指标个数
if
(
indReportData
.
getIndImproveAfterThreeCount
()==
null
)
{
indReportData
.
setIndImproveAfterThreeCount
(
1
);
}
else
{
indReportData
.
setIndImproveAfterThreeCount
(
indReportData
.
getIndImproveAfterThreeCount
()+
1
);
}
limitNum
++;
break
;
}
}
else
{
if
(
limitNum
<
3
)
{
if
(
type
==
0
)
{
//填充提升前三指标个数
if
(
indReportData
.
getIndImproveHeadThreeCount
()==
null
)
{
indReportData
.
setIndImproveHeadThreeCount
(
1
);
}
else
{
indReportData
.
setIndImproveHeadThreeCount
(
indReportData
.
getIndImproveHeadThreeCount
()+
1
);
}
limitNum
++;
break
;
}
else
{
//填充提升末三指标个数
if
(
indReportData
.
getIndImproveAfterThreeCount
()==
null
)
{
indReportData
.
setIndImproveAfterThreeCount
(
1
);
}
else
{
indReportData
.
setIndImproveAfterThreeCount
(
indReportData
.
getIndImproveAfterThreeCount
()+
1
);
}
limitNum
++;
break
;
}
}
}
}
}
}
}
return
dataList
;
}
//填充排名前三末三指标个数
private
IndicatorsReportThree
fillRankHeadAndAfterCount
(
IndicatorsReportThree
indReportData
,
List
<
DriveIndCalResultDef
>
calResults
,
String
indRule
)
{
Map
<
String
,
String
>
valueMap
=
new
HashMap
<>();
//前三
for
(
DriveIndCalResultDef
calResult
:
calResults
)
{
valueMap
.
put
(
calResult
.
getCompareObj
(),
calResult
.
getValue
());
if
(
calResult
.
getRank
()==
1
||
calResult
.
getRank
()==
2
||
calResult
.
getRank
()==
3
)
{
if
(
calResult
.
getCompareObj
().
equals
(
indReportData
.
getCompareObj
()))
{
if
(
indReportData
.
getRankHeadThreeIndCount
()==
null
)
{
indReportData
.
setRankHeadThreeIndCount
(
1
);
}
else
{
indReportData
.
setRankHeadThreeIndCount
(
indReportData
.
getRankHeadThreeIndCount
()+
1
);
}
}
}
}
//末三
Map
<
String
,
Integer
>
rankValue
=
new
HashMap
<>();
if
(
"0"
.
equals
(
indRule
))
{
//正向
rankValue
=
CalculateUtils
.
rankValue
(
valueMap
,
"1"
);
}
else
{
//反向
rankValue
=
CalculateUtils
.
rankValue
(
valueMap
,
"0"
);
}
if
(!
rankValue
.
isEmpty
())
{
for
(
Map
.
Entry
<
String
,
Integer
>
map
:
rankValue
.
entrySet
())
{
if
(
map
.
getValue
()==
1
||
map
.
getValue
()==
2
||
map
.
getValue
()==
3
)
{
if
(
map
.
getKey
().
equals
(
indReportData
.
getCompareObj
()))
{
if
(
indReportData
.
getRankAfterThreeIndCount
()==
null
)
{
indReportData
.
setRankAfterThreeIndCount
(
1
);
}
else
{
indReportData
.
setRankAfterThreeIndCount
(
indReportData
.
getRankAfterThreeIndCount
()+
1
);
}
}
}
}
}
return
indReportData
;
}
//填充优劣平均数个数
private
IndicatorsReportThree
fillAverageCount
(
IndicatorsReportThree
indReportData
,
DriveIndCalResultDef
calResult
,
String
indRule
)
{
String
average
=
null
;
//优于平均水平的指标个数
if
(
StringUtils
.
isNotBlank
(
calResult
.
getActualAverage
()))
{
average
=
calResult
.
getActualAverage
();
}
else
{
average
=
calResult
.
getAverage
();
}
if
(
StringUtils
.
isNotBlank
(
average
)
&&
StringUtils
.
isNotBlank
(
calResult
.
getValue
()))
{
//指标值大于平均数
if
(
Double
.
parseDouble
(
calResult
.
getValue
())
>
Double
.
parseDouble
(
average
))
{
if
(
"1"
.
equals
(
indRule
))
{
//反向
if
(
indReportData
.
getBadAverageIndCount
()==
null
)
{
indReportData
.
setBadAverageIndCount
(
1
);
}
else
{
indReportData
.
setBadAverageIndCount
(
indReportData
.
getBadAverageIndCount
()+
1
);
}
}
else
{
//正向
if
(
indReportData
.
getBatterAverageIndCount
()==
null
)
{
indReportData
.
setBatterAverageIndCount
(
1
);
}
else
{
indReportData
.
setBatterAverageIndCount
(
indReportData
.
getBatterAverageIndCount
()+
1
);
}
}
}
if
(
Double
.
parseDouble
(
calResult
.
getValue
())
<
Double
.
parseDouble
(
average
)){
//指标值小于平均数
if
(
"1"
.
equals
(
indRule
))
{
//反向
if
(
indReportData
.
getBatterAverageIndCount
()==
null
)
{
indReportData
.
setBatterAverageIndCount
(
1
);
}
else
{
indReportData
.
setBatterAverageIndCount
(
indReportData
.
getBatterAverageIndCount
()+
1
);
}
}
else
{
//正向
if
(
indReportData
.
getBadAverageIndCount
()==
null
)
{
indReportData
.
setBadAverageIndCount
(
1
);
}
else
{
indReportData
.
setBadAverageIndCount
(
indReportData
.
getBadAverageIndCount
()+
1
);
}
}
}
}
return
indReportData
;
}
@Async
@Async
public
void
dealDriveIndReportTwoData
(
String
compareUnitId
,
List
<
String
>
indIds
,
public
void
dealDriveIndReportTwoData
(
String
compareUnitId
,
List
<
String
>
indIds
,
List
<
String
>
compareObjs
,
Integer
date
)
{
List
<
String
>
compareObjs
,
Integer
date
)
{
...
@@ -533,7 +787,11 @@ public class IndicatorsReportService {
...
@@ -533,7 +787,11 @@ public class IndicatorsReportService {
}
}
}
}
}
}
resultRank
=
CalculateUtils
.
rankValue
(
rankMap
,
indRule
);
if
(
"1"
.
equals
(
driveIndDef
.
getGrowCalType
()))
{
//差比,无论正反向,都有大到小排序
resultRank
=
CalculateUtils
.
rankValue
(
rankMap
,
"0"
);
}
else
{
//差值
resultRank
=
CalculateUtils
.
rankValue
(
rankMap
,
indRule
);
}
resultRank
=
CalculateUtils
.
sortMapByValue
(
resultRank
,
0
);
//按照value从小到大排序
resultRank
=
CalculateUtils
.
sortMapByValue
(
resultRank
,
0
);
//按照value从小到大排序
}
}
}
}
...
...
src/main/resources/mybatis/mapping/ReportThreeMapper.xml
View file @
d32833c2
...
@@ -15,14 +15,14 @@
...
@@ -15,14 +15,14 @@
compare_obj, compare_obj_desc, compare_date, compare_type, batter_average_ind_count,
compare_obj, compare_obj_desc, compare_date, compare_type, batter_average_ind_count,
bad_average_ind_count, rank_head_three_ind_count, rank_after_three_ind_count,
bad_average_ind_count, rank_head_three_ind_count, rank_after_three_ind_count,
ind_improve_count, ind_improve_head_three_count, ind_improve_after_three_count,
ind_improve_count, ind_improve_head_three_count, ind_improve_after_three_count,
ind_improve_rate)
ind_improve_rate
,effective_ind_count
)
values
values
<foreach
collection=
"datas"
item=
"val"
separator=
","
>
<foreach
collection=
"datas"
item=
"val"
separator=
","
>
(
(
#{val.compareObj}, #{val.compareObjDesc}, #{val.compareDate}, #{val.compareType},
#{val.compareObj}, #{val.compareObjDesc}, #{val.compareDate}, #{val.compareType},
#{val.batterAverageIndCount}, #{val.badAverageIndCount}, #{val.rankHeadThreeIndCount},
#{val.batterAverageIndCount}, #{val.badAverageIndCount}, #{val.rankHeadThreeIndCount},
#{val.rankAfterThreeIndCount}, #{val.indImproveCount}, #{val.indImproveHeadThreeCount},
#{val.rankAfterThreeIndCount}, #{val.indImproveCount}, #{val.indImproveHeadThreeCount},
#{val.indImproveAfterThreeCount}, #{val.indImproveRate}
#{val.indImproveAfterThreeCount}, #{val.indImproveRate}
, #{val.effectiveIndCount}
)
)
</foreach>
</foreach>
</insert>
</insert>
...
@@ -67,6 +67,9 @@
...
@@ -67,6 +67,9 @@
<if
test=
"val.indImproveRate != null"
>
<if
test=
"val.indImproveRate != null"
>
ind_improve_rate = #{val.indImproveRate},
ind_improve_rate = #{val.indImproveRate},
</if>
</if>
<if
test=
"val.effectiveIndCount != null"
>
effective_ind_count = #{val.effectiveIndCount},
</if>
</set>
</set>
where id = ${val.id}
where id = ${val.id}
</foreach>
</foreach>
...
...
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