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
c2085ae8
Commit
c2085ae8
authored
Mar 10, 2023
by
dengwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权重配置,多层权重计算逻辑优化
parent
2bc0b35b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
3 deletions
+29
-3
WeightDataEnterCtrl.java
...ymobile/indicators/api/hytobacco/WeightDataEnterCtrl.java
+8
-0
ObjScoreIndWeightDetail.java
...dicators/model/entity/weight/ObjScoreIndWeightDetail.java
+4
-0
ScoreRuleService.java
...mobile/indicators/service/hytobacco/ScoreRuleService.java
+15
-3
WeightIndValueServiceImpl.java
...rvice/weightDataEnter/impl/WeightIndValueServiceImpl.java
+2
-0
No files found.
src/main/java/com/keymobile/indicators/api/hytobacco/WeightDataEnterCtrl.java
View file @
c2085ae8
...
@@ -432,9 +432,17 @@ public class WeightDataEnterCtrl {
...
@@ -432,9 +432,17 @@ public class WeightDataEnterCtrl {
value
.
setIndId
(
ind
.
getIndId
());
value
.
setIndId
(
ind
.
getIndId
());
value
.
setIndUnit
(
ind
.
getIndUnit
());
value
.
setIndUnit
(
ind
.
getIndUnit
());
// 设置综合评价权重
// 设置综合评价权重
if
(
StringUtils
.
isNotBlank
(
synthesizeWeight
))
{
value
.
setSynthesizeWeight
(
new
BigDecimal
(
synthesizeWeight
));
value
.
setSynthesizeWeight
(
new
BigDecimal
(
synthesizeWeight
));
}
else
{
value
.
setSynthesizeWeight
(
BigDecimal
.
ZERO
);
}
// 设置改善提升权重
// 设置改善提升权重
if
(
StringUtils
.
isNotBlank
(
improveWeight
))
{
value
.
setImproveWeight
(
new
BigDecimal
(
improveWeight
));
value
.
setImproveWeight
(
new
BigDecimal
(
improveWeight
));
}
else
{
value
.
setImproveWeight
(
BigDecimal
.
ZERO
);
}
// 设置维度权重
// 设置维度权重
value
.
setDimensionWeight
(
dimensionWeight
);
value
.
setDimensionWeight
(
dimensionWeight
);
String
indName
=
ind
.
getIndName
();
String
indName
=
ind
.
getIndName
();
...
...
src/main/java/com/keymobile/indicators/model/entity/weight/ObjScoreIndWeightDetail.java
View file @
c2085ae8
...
@@ -7,6 +7,7 @@ import javax.persistence.GenerationType;
...
@@ -7,6 +7,7 @@ import javax.persistence.GenerationType;
import
javax.persistence.Id
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
javax.persistence.Table
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
/**
* @author DW
* @author DW
...
@@ -67,4 +68,7 @@ public class ObjScoreIndWeightDetail {
...
@@ -67,4 +68,7 @@ public class ObjScoreIndWeightDetail {
// 大类权重
// 大类权重
private
BigDecimal
bigWeight
;
private
BigDecimal
bigWeight
;
// 创建时间
private
Date
createTime
;
}
}
src/main/java/com/keymobile/indicators/service/hytobacco/ScoreRuleService.java
View file @
c2085ae8
...
@@ -545,8 +545,10 @@ public class ScoreRuleService {
...
@@ -545,8 +545,10 @@ public class ScoreRuleService {
objScoreCalResult
=
this
.
calGroupIndAverageOrSum
(
compareCatalog
,
objScoreCalResult
,
objScoreCalResult
=
this
.
calGroupIndAverageOrSum
(
compareCatalog
,
objScoreCalResult
,
scoreRule
,
compareObj
,
date
,
scoreRule
.
getCalType
(),
code
,
dateMark
);
scoreRule
,
compareObj
,
date
,
scoreRule
.
getCalType
(),
code
,
dateMark
);
}
else
{
//4:多层权重
}
else
{
//4:多层权重
logger
.
info
(
"多层权重结果1:"
+
objScoreCalResult
);
objScoreCalResult
=
this
.
calMoreIndWeight
(
compareCatalog
,
objScoreCalResult
,
scoreRule
,
objScoreCalResult
=
this
.
calMoreIndWeight
(
compareCatalog
,
objScoreCalResult
,
scoreRule
,
compareObj
,
date
,
code
,
dateMark
);
compareObj
,
date
,
code
,
dateMark
);
logger
.
info
(
"多层权重结果2:"
+
objScoreCalResult
);
}
}
objScoreCalResult
.
setCompareCatalog
(
compareCatalog
);
objScoreCalResult
.
setCompareCatalog
(
compareCatalog
);
objScoreCalResult
.
setCompareId
(
compareId
);
objScoreCalResult
.
setCompareId
(
compareId
);
...
@@ -560,7 +562,8 @@ public class ScoreRuleService {
...
@@ -560,7 +562,8 @@ public class ScoreRuleService {
for
(
ObjScoreCalResult
scoreResult
:
datas
)
{
for
(
ObjScoreCalResult
scoreResult
:
datas
)
{
//计算综合评价和改善提升总分
//计算综合评价和改善提升总分
Double
scoreSum
=
Double
.
parseDouble
(
scoreResult
.
getScoreValue
());
Double
scoreSum
=
Double
.
parseDouble
(
scoreResult
.
getScoreValue
());
if
(
"1"
.
equals
(
scoreRule
.
getScoreType
())){
// 新增判断是否为多层权重
if
(
"1"
.
equals
(
scoreRule
.
getScoreType
())
&&
!
"4"
.
equals
(
scoreRule
.
getCalType
())){
scoreSum
=
Double
.
parseDouble
(
scoreResult
.
getScoreValue
())+
scoreSum
=
Double
.
parseDouble
(
scoreResult
.
getScoreValue
())+
Double
.
parseDouble
(
scoreResult
.
getImproveValue
());
Double
.
parseDouble
(
scoreResult
.
getImproveValue
());
}
}
...
@@ -578,6 +581,7 @@ public class ScoreRuleService {
...
@@ -578,6 +581,7 @@ public class ScoreRuleService {
}
}
datas
=
null
;
datas
=
null
;
}
}
logger
.
info
(
"最终存表的结果集合:"
+
dbDatas
);
//批量新增或修改
//批量新增或修改
if
(!
dbDatas
.
isEmpty
())
{
if
(!
dbDatas
.
isEmpty
())
{
this
.
batchSaveOrUpdateObjScoreCalResult
(
dbDatas
);
this
.
batchSaveOrUpdateObjScoreCalResult
(
dbDatas
);
...
@@ -643,8 +647,10 @@ public class ScoreRuleService {
...
@@ -643,8 +647,10 @@ public class ScoreRuleService {
synthesizeWeight
=
weightIndValue
.
getSynthesizeWeight
().
divide
(
new
BigDecimal
(
100
));
synthesizeWeight
=
weightIndValue
.
getSynthesizeWeight
().
divide
(
new
BigDecimal
(
100
));
}
}
BigDecimal
finalScore
=
score
.
multiply
(
synthesizeWeight
).
multiply
(
dimensionWeight
);
BigDecimal
finalScore
=
score
.
multiply
(
synthesizeWeight
).
multiply
(
dimensionWeight
);
if
(
finalScore
.
doubleValue
()
>
0
)
{
scoreValues
.
add
(
String
.
valueOf
(
finalScore
));
scoreValues
.
add
(
String
.
valueOf
(
finalScore
));
}
}
}
if
(!
StringUtils
.
equals
(
"0.0"
,
map
.
get
(
"maxImproveScore"
)))
{
if
(!
StringUtils
.
equals
(
"0.0"
,
map
.
get
(
"maxImproveScore"
)))
{
BigDecimal
improveScore
=
new
BigDecimal
(
map
.
get
(
"maxImproveScore"
));
BigDecimal
improveScore
=
new
BigDecimal
(
map
.
get
(
"maxImproveScore"
));
BigDecimal
improveWeight
=
BigDecimal
.
ZERO
;
BigDecimal
improveWeight
=
BigDecimal
.
ZERO
;
...
@@ -652,8 +658,10 @@ public class ScoreRuleService {
...
@@ -652,8 +658,10 @@ public class ScoreRuleService {
improveWeight
=
weightIndValue
.
getImproveWeight
().
divide
(
new
BigDecimal
(
100
));
improveWeight
=
weightIndValue
.
getImproveWeight
().
divide
(
new
BigDecimal
(
100
));
}
}
BigDecimal
finalImproveScore
=
improveScore
.
multiply
(
improveWeight
).
multiply
(
dimensionWeight
);
BigDecimal
finalImproveScore
=
improveScore
.
multiply
(
improveWeight
).
multiply
(
dimensionWeight
);
if
(
finalImproveScore
.
doubleValue
()
>
0
)
{
improveValues
.
add
(
String
.
valueOf
(
finalImproveScore
));
improveValues
.
add
(
String
.
valueOf
(
finalImproveScore
));
}
}
}
for
(
TaskRuleIndicator
indicator
:
indicators
)
{
for
(
TaskRuleIndicator
indicator
:
indicators
)
{
groupIndIds
.
append
(
indicator
.
getIndId
());
groupIndIds
.
append
(
indicator
.
getIndId
());
}
}
...
@@ -671,21 +679,25 @@ public class ScoreRuleService {
...
@@ -671,21 +679,25 @@ public class ScoreRuleService {
improveWeight
=
weightIndValue
.
getImproveWeight
().
divide
(
new
BigDecimal
(
100
));
improveWeight
=
weightIndValue
.
getImproveWeight
().
divide
(
new
BigDecimal
(
100
));
}
}
BigDecimal
finalImproveScore
=
improveScore
.
multiply
(
improveWeight
).
multiply
(
dimensionWeight
);
BigDecimal
finalImproveScore
=
improveScore
.
multiply
(
improveWeight
).
multiply
(
dimensionWeight
);
if
(
finalImproveScore
.
doubleValue
()
>
0
)
{
improveValues
.
add
(
String
.
valueOf
(
finalImproveScore
));
improveValues
.
add
(
String
.
valueOf
(
finalImproveScore
));
}
}
if
(!
"NaN"
.
equals
(
calResult
.
getValue
())
&&
!
"Infinite"
.
equals
(
calResult
.
getValue
())
&&
!
"0"
.
equals
(
calResult
.
getValue
()))
{
}
if
(!
"No"
.
equals
(
calResult
.
getScore
())
&&
StringUtils
.
isNotBlank
(
calResult
.
getScore
()))
{
BigDecimal
score
=
new
BigDecimal
(
calResult
.
getScore
());
BigDecimal
score
=
new
BigDecimal
(
calResult
.
getScore
());
BigDecimal
synthesizeWeight
=
BigDecimal
.
ZERO
;
BigDecimal
synthesizeWeight
=
BigDecimal
.
ZERO
;
if
(
weightIndValue
.
getSynthesizeWeight
()
!=
null
&&
weightIndValue
.
getSynthesizeWeight
().
doubleValue
()
!=
0
)
{
if
(
weightIndValue
.
getSynthesizeWeight
()
!=
null
&&
weightIndValue
.
getSynthesizeWeight
().
doubleValue
()
!=
0
)
{
synthesizeWeight
=
weightIndValue
.
getSynthesizeWeight
().
divide
(
new
BigDecimal
(
100
));
synthesizeWeight
=
weightIndValue
.
getSynthesizeWeight
().
divide
(
new
BigDecimal
(
100
));
}
}
BigDecimal
finalScore
=
score
.
multiply
(
synthesizeWeight
).
multiply
(
dimensionWeight
);
BigDecimal
finalScore
=
score
.
multiply
(
synthesizeWeight
).
multiply
(
dimensionWeight
);
if
(
finalScore
.
doubleValue
()
>
0
)
{
scoreValues
.
add
(
String
.
valueOf
(
finalScore
));
scoreValues
.
add
(
String
.
valueOf
(
finalScore
));
}
}
}
}
}
}
}
}
}
}
}
String
averageImproveValue
=
"0.0"
;
String
averageImproveValue
=
"0.0"
;
String
improveSumValue
=
"0.0"
;
String
improveSumValue
=
"0.0"
;
String
scoreTmpSumValue
=
CalculateUtils
.
sumValue
(
scoreValues
);
String
scoreTmpSumValue
=
CalculateUtils
.
sumValue
(
scoreValues
);
...
@@ -743,7 +755,7 @@ public class ScoreRuleService {
...
@@ -743,7 +755,7 @@ public class ScoreRuleService {
maxImproveScore
=
driveIndCalResultDef
.
getImproveScore
();
maxImproveScore
=
driveIndCalResultDef
.
getImproveScore
();
}
}
}
}
if
(!
"N
aN"
.
equals
(
driveIndCalResultDef
.
getValue
())
&&
!
"Infinite"
.
equals
(
driveIndCalResultDef
.
getValue
())
&&
!
"0"
.
equals
(
driveIndCalResultDef
.
getValu
e
()))
{
if
(!
"N
o"
.
equals
(
driveIndCalResultDef
.
getScore
())
&&
StringUtils
.
isNotBlank
(
driveIndCalResultDef
.
getScor
e
()))
{
// 比较大小
// 比较大小
BigDecimal
score
=
new
BigDecimal
(
driveIndCalResultDef
.
getScore
());
BigDecimal
score
=
new
BigDecimal
(
driveIndCalResultDef
.
getScore
());
// 计算两个指标改善提升分数的差值
// 计算两个指标改善提升分数的差值
...
...
src/main/java/com/keymobile/indicators/service/weightDataEnter/impl/WeightIndValueServiceImpl.java
View file @
c2085ae8
...
@@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
...
@@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -60,6 +61,7 @@ public class WeightIndValueServiceImpl implements WeightIndValueService {
...
@@ -60,6 +61,7 @@ public class WeightIndValueServiceImpl implements WeightIndValueService {
for
(
WeightIndValue
indValue
:
values
)
{
for
(
WeightIndValue
indValue
:
values
)
{
DriveIndDef
indDef
=
driveIndDefMapper
.
selectByPrimaryKey
(
indValue
.
getIndId
());
DriveIndDef
indDef
=
driveIndDefMapper
.
selectByPrimaryKey
(
indValue
.
getIndId
());
ObjScoreIndWeightDetail
weightDetail
=
new
ObjScoreIndWeightDetail
();
ObjScoreIndWeightDetail
weightDetail
=
new
ObjScoreIndWeightDetail
();
weightDetail
.
setCreateTime
(
new
Date
());
weightDetail
.
setCfgId
(
weightId
);
weightDetail
.
setCfgId
(
weightId
);
weightDetail
.
setCode
(
weightCfg
.
getOrgNo
());
weightDetail
.
setCode
(
weightCfg
.
getOrgNo
());
weightDetail
.
setLevelName
(
weightCfg
.
getLevelName
());
weightDetail
.
setLevelName
(
weightCfg
.
getLevelName
());
...
...
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