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
4f5e6722
Commit
4f5e6722
authored
Sep 27, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
单位评分表添加单位分数排名字段和相应代码排序逻辑。
parent
f5fa7d32
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
18 deletions
+57
-18
ObjScoreCalResult.java
...dicators/model/entity/objscorerule/ObjScoreCalResult.java
+1
-0
ScoreRuleService.java
...mobile/indicators/service/hytobacco/ScoreRuleService.java
+26
-1
CalculateUtils.java
...n/java/com/keymobile/indicators/utils/CalculateUtils.java
+24
-15
ObjScoreCalResultMapper.xml
...ain/resources/mybatis/mapping/ObjScoreCalResultMapper.xml
+6
-2
No files found.
src/main/java/com/keymobile/indicators/model/entity/objscorerule/ObjScoreCalResult.java
View file @
4f5e6722
...
@@ -24,6 +24,7 @@ public class ObjScoreCalResult {
...
@@ -24,6 +24,7 @@ public class ObjScoreCalResult {
private
Integer
date
;
//对标日期
private
Integer
date
;
//对标日期
private
String
scoreValue
;
//考核对象得分
private
String
scoreValue
;
//考核对象得分
private
String
improveValue
;
//考核对象改善得分
private
String
improveValue
;
//考核对象改善得分
private
Integer
scoreRank
;
//得分排名
private
String
scoreSumValue
;
//指标总积分
private
String
scoreSumValue
;
//指标总积分
private
Integer
indCount
;
//指标个数
private
Integer
indCount
;
//指标个数
private
String
code
;
//机构编码
private
String
code
;
//机构编码
...
...
src/main/java/com/keymobile/indicators/service/hytobacco/ScoreRuleService.java
View file @
4f5e6722
...
@@ -429,8 +429,33 @@ public class ScoreRuleService {
...
@@ -429,8 +429,33 @@ public class ScoreRuleService {
datas
.
add
(
objScoreCalResult
);
datas
.
add
(
objScoreCalResult
);
}
}
//进行综合评价和改善提升总分排名
List
<
ObjScoreCalResult
>
dbDatas
=
new
ArrayList
<>();
if
(!
datas
.
isEmpty
())
{
Map
<
String
,
String
>
scoreRankMap
=
new
HashMap
<>();
for
(
ObjScoreCalResult
scoreResult
:
datas
)
{
//计算综合评价和改善提升总分
Double
scoreSum
=
Double
.
parseDouble
(
scoreResult
.
getScoreValue
())+
Double
.
parseDouble
(
scoreResult
.
getImproveValue
());
scoreRankMap
.
put
(
scoreResult
.
getCompareObj
(),
String
.
valueOf
(
scoreSum
));
}
//排名(正向排序)
Map
<
String
,
Integer
>
rankValueMap
=
CalculateUtils
.
rankValue
(
scoreRankMap
,
"0"
);
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
rankValueMap
.
entrySet
())
{
for
(
ObjScoreCalResult
scoreResult
:
datas
)
{
if
(
scoreResult
.
getCompareObj
().
equals
(
entry
.
getKey
()))
{
scoreResult
.
setScoreRank
(
entry
.
getValue
());
dbDatas
.
add
(
scoreResult
);
}
}
}
datas
=
null
;
}
//批量新增或修改
//批量新增或修改
this
.
batchSaveOrUpdateObjScoreCalResult
(
datas
);
if
(!
dbDatas
.
isEmpty
())
{
this
.
batchSaveOrUpdateObjScoreCalResult
(
dbDatas
);
dbDatas
=
null
;
}
}
}
}
else
{
}
else
{
logger
.
info
(
"单位评分卡id:"
+
scoreRuleId
+
" 不存在"
);
logger
.
info
(
"单位评分卡id:"
+
scoreRuleId
+
" 不存在"
);
...
...
src/main/java/com/keymobile/indicators/utils/CalculateUtils.java
View file @
4f5e6722
...
@@ -366,20 +366,29 @@ public class CalculateUtils {
...
@@ -366,20 +366,29 @@ public class CalculateUtils {
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
Map
<
String
,
Integer
>
objSort
=
new
HashMap
<>();
// Map<String,Integer> objSort = new HashMap<>();
objSort
.
put
(
"4301"
,
1
);
objSort
.
put
(
"4302"
,
2
);
objSort
.
put
(
"4303"
,
3
);
// objSort.put("4301",1);objSort.put("4302",2);objSort.put("4303",3);
objSort
.
put
(
"4304"
,
4
);
objSort
.
put
(
"4305"
,
5
);
objSort
.
put
(
"4306"
,
6
);
// objSort.put("4304",4);objSort.put("4305",5);objSort.put("4306",6);
objSort
.
put
(
"4307"
,
7
);
objSort
.
put
(
"4308"
,
8
);
objSort
.
put
(
"4309"
,
9
);
// objSort.put("4307",7);objSort.put("4308",8);objSort.put("4309",9);
objSort
.
put
(
"4310"
,
10
);
objSort
.
put
(
"4311"
,
11
);
objSort
.
put
(
"4312"
,
12
);
// objSort.put("4310",10);objSort.put("4311",11);objSort.put("4312",12);
objSort
.
put
(
"4313"
,
13
);
objSort
.
put
(
"4331"
,
14
);
// objSort.put("4313",13);objSort.put("4331",14);
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
// Map<String,Integer> map = new HashMap<>();
map
.
put
(
"430402"
,
4
);
// map.put("430402", 4);
map
.
put
(
"430405"
,
2
);
// map.put("430405", 2);
map
.
put
(
"430404"
,
5
);
// map.put("430404", 5);
map
.
put
(
"430407"
,
3
);
// map.put("430407", 3);
map
.
put
(
"430409"
,
1
);
// map.put("430409", 1);
map
=
CalculateUtils
.
sortMapByValue
(
map
,
1
);
//按照value从大到小排序
// map = CalculateUtils.sortMapByValue(map,1);//按照value从大到小排序
Map
<
String
,
Object
>
resultRankMap
=
CalculateUtils
.
rankByObjSort
(
map
,
objSort
);
// Map<String,Object> resultRankMap = CalculateUtils.rankByObjSort(map, objSort);
System
.
out
.
println
(
resultRankMap
);
// System.out.println(resultRankMap);
Map
<
String
,
String
>
rankMap
=
new
HashMap
<>();
rankMap
.
put
(
"1001"
,
"0.0"
);
rankMap
.
put
(
"1002"
,
"0.0"
);
rankMap
.
put
(
"1003"
,
"0.0"
);
rankMap
.
put
(
"1004"
,
"0.0"
);
rankMap
.
put
(
"1005"
,
"0.0"
);
Map
<
String
,
Integer
>
rankValueMap
=
CalculateUtils
.
rankValue
(
rankMap
,
"0"
);
System
.
out
.
println
(
rankValueMap
);
}
}
}
}
src/main/resources/mybatis/mapping/ObjScoreCalResultMapper.xml
View file @
4f5e6722
...
@@ -14,12 +14,13 @@
...
@@ -14,12 +14,13 @@
<insert
id=
"batchSave"
parameterType=
"java.util.List"
>
<insert
id=
"batchSave"
parameterType=
"java.util.List"
>
insert into obj_score_cal_result(
insert into obj_score_cal_result(
compare_id, compare_obj, compare_obj_desc, ind_ids, date, score_value, improve_value,
compare_id, compare_obj, compare_obj_desc, ind_ids, date, score_value, improve_value,
score_sum_value, ind_count, code)
score_
rank, score_
sum_value, ind_count, code)
values
values
<foreach
collection=
"datas"
item=
"val"
separator=
","
>
<foreach
collection=
"datas"
item=
"val"
separator=
","
>
(
(
#{val.compareId}, #{val.compareObj}, #{val.compareObjDesc}, #{val.indIds}, #{val.date},
#{val.compareId}, #{val.compareObj}, #{val.compareObjDesc}, #{val.indIds}, #{val.date},
#{val.scoreValue},#{val.improveValue},#{val.scoreSumValue},#{val.indCount},#{val.code})
#{val.scoreValue},#{val.improveValue},#{val.scoreRank},#{val.scoreSumValue},#{val.indCount},
#{val.code})
</foreach>
</foreach>
</insert>
</insert>
...
@@ -48,6 +49,9 @@
...
@@ -48,6 +49,9 @@
<if
test=
"val.improveValue != null"
>
<if
test=
"val.improveValue != null"
>
improve_value = #{val.improveValue},
improve_value = #{val.improveValue},
</if>
</if>
<if
test=
"val.scoreRank != null"
>
score_rank = #{val.scoreRank},
</if>
<if
test=
"val.scoreSumValue != null"
>
<if
test=
"val.scoreSumValue != null"
>
score_sum_value = #{val.scoreSumValue},
score_sum_value = #{val.scoreSumValue},
</if>
</if>
...
...
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