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
dc60ded3
Commit
dc60ded3
authored
Jun 22, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改计算考核指标增幅逻辑代码
parent
7bfa8031
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
38 deletions
+40
-38
DriveIndDef.java
...obile/indicators/model/entity/indicators/DriveIndDef.java
+1
-0
IndScorecardService.java
...ile/indicators/service/hytobacco/IndScorecardService.java
+0
-0
IndicatorsValueService.java
.../indicators/service/hytobacco/IndicatorsValueService.java
+36
-30
ShortboardRuleService.java
...e/indicators/service/hytobacco/ShortboardRuleService.java
+0
-0
CalculateUtils.java
...n/java/com/keymobile/indicators/utils/CalculateUtils.java
+3
-8
No files found.
src/main/java/com/keymobile/indicators/model/entity/indicators/DriveIndDef.java
View file @
dc60ded3
...
@@ -29,6 +29,7 @@ public class DriveIndDef {
...
@@ -29,6 +29,7 @@ public class DriveIndDef {
private
String
indCalScoreRuleDesc
;
//计分规则描述
private
String
indCalScoreRuleDesc
;
//计分规则描述
private
String
isUnitCalScore
;
//是否参与单位得分计算 是:1 否:0
private
String
isUnitCalScore
;
//是否参与单位得分计算 是:1 否:0
private
String
indFrequency
;
//指标频度 0:月度给数 1:季度给数 2:年度给数
private
String
indFrequency
;
//指标频度 0:月度给数 1:季度给数 2:年度给数
private
String
growCalType
;
//增幅计算类型 0:本期-同期 1:(本期-同期)/同期*100
private
String
version
;
//版本号
private
String
version
;
//版本号
private
Integer
catalogId
;
//挂靠目录id
private
Integer
catalogId
;
//挂靠目录id
private
String
catalogIdPath
;
//挂靠目录idPath,方便用目录类别找到对应的挂靠指标
private
String
catalogIdPath
;
//挂靠目录idPath,方便用目录类别找到对应的挂靠指标
...
...
src/main/java/com/keymobile/indicators/service/hytobacco/IndScorecardService.java
View file @
dc60ded3
This diff is collapsed.
Click to expand it.
src/main/java/com/keymobile/indicators/service/hytobacco/IndicatorsValueService.java
View file @
dc60ded3
...
@@ -194,8 +194,9 @@ public class IndicatorsValueService {
...
@@ -194,8 +194,9 @@ public class IndicatorsValueService {
dataMap
.
put
(
"currentValue"
,
driveIndCalResult
.
getValue
());
dataMap
.
put
(
"currentValue"
,
driveIndCalResult
.
getValue
());
dataMap
.
put
(
"currentRank"
,
String
.
valueOf
(
driveIndCalResult
.
getRank
()));
dataMap
.
put
(
"currentRank"
,
String
.
valueOf
(
driveIndCalResult
.
getRank
()));
dataMap
.
put
(
"sameValue"
,
sameDriveIndCalResult
.
getValue
());
dataMap
.
put
(
"sameValue"
,
sameDriveIndCalResult
.
getValue
());
String
calGowth
=
CalculateUtils
.
calGowth
(
deiveIndDef
.
getIndUnit
(),
String
calGowth
=
CalculateUtils
.
calGowth
(
driveIndCalResult
.
getValue
(),
sameDriveIndCalResult
.
getValue
(),
"1"
);
driveIndCalResult
.
getValue
(),
sameDriveIndCalResult
.
getValue
(),
deiveIndDef
.
getGrowCalType
());
dataMap
.
put
(
"calGowth"
,
calGowth
);
dataMap
.
put
(
"calGowth"
,
calGowth
);
gowthMap
.
put
(
compareObj
,
calGowth
);
gowthMap
.
put
(
compareObj
,
calGowth
);
...
@@ -412,7 +413,8 @@ public class IndicatorsValueService {
...
@@ -412,7 +413,8 @@ public class IndicatorsValueService {
}
}
//根据指标id获取指标信息
//根据指标id获取指标信息
DriveIndDef
driveIndDef
=
driveIndDefService
.
getById
(
indId
);
DriveIndDef
driveIndDef
=
driveIndDefService
.
getById
(
indId
);
rate
=
CalculateUtils
.
calGowth
(
driveIndDef
.
getIndUnit
(),
currentValue
,
sameValue
,
"0"
);
rate
=
CalculateUtils
.
calGowth
(
currentValue
,
sameValue
,
driveIndDef
.
getGrowCalType
());
XSSFRow
row
=
excelSheet
.
getRow
(
rowMap
.
get
(
indId
));
XSSFRow
row
=
excelSheet
.
getRow
(
rowMap
.
get
(
indId
));
row
.
getCell
(
3
).
setCellValue
(
currentValue
);
row
.
getCell
(
3
).
setCellValue
(
currentValue
);
...
@@ -523,37 +525,41 @@ public class IndicatorsValueService {
...
@@ -523,37 +525,41 @@ public class IndicatorsValueService {
}
}
//根据考核指标id获取本期和同期的指标值
//根据考核指标id获取本期和同期的指标值
for
(
String
indId
:
indIds
)
{
for
(
String
indId
:
indIds
)
{
List
<
DriveIndCalResultDef
>
driveResult
=
driveIndCalResultDefMapper
.
findByIndId
(
indId
);
DriveIndDef
deiveIndDef
=
driveIndDefService
.
getById
(
indId
);
for
(
DriveIndCalResultDef
result
:
driveResult
)
{
if
(
deiveIndDef
!=
null
)
{
String
region
=
result
.
getCompareObj
();
List
<
DriveIndCalResultDef
>
driveResult
=
driveIndCalResultDefMapper
.
findByIndId
(
indId
);
if
(
rowMap
.
get
(
region
)!=
null
)
{
for
(
DriveIndCalResultDef
result
:
driveResult
)
{
XSSFRow
row
=
excelSheet
.
getRow
(
rowMap
.
get
(
region
));
String
region
=
result
.
getCompareObj
();
if
(
result
.
getDate
()==
201912
)
{
if
(
rowMap
.
get
(
region
)!=
null
)
{
row
.
getCell
(
cellMap
.
get
(
indId
)).
setCellValue
(
result
.
getValue
());
XSSFRow
row
=
excelSheet
.
getRow
(
rowMap
.
get
(
region
));
if
(
result
.
getDate
()==
201912
)
{
row
.
getCell
(
cellMap
.
get
(
indId
)).
setCellValue
(
result
.
getValue
());
}
else
{
row
.
getCell
((
cellMap
.
get
(
indId
)+
1
)).
setCellValue
(
result
.
getValue
());
}
}
else
{
}
else
{
row
.
getCell
((
cellMap
.
get
(
indId
)+
1
)).
setCellValue
(
result
.
getValue
()
);
logger
.
info
(
"找不到 "
+
region
+
" 对应的列"
);
}
}
}
else
{
logger
.
info
(
"找不到 "
+
region
+
" 对应的列"
);
//算一次
}
if
(
result
.
getDate
()==
201912
)
{
String
currentValue
=
""
;
//算一次
String
sameValue
=
""
;
if
(
result
.
getDate
()==
201912
)
{
//算增幅
String
currentValue
=
""
;
List
<
DriveIndCalResultDef
>
gowthValues
=
driveIndCalResultDefMapper
String
sameValue
=
""
;
.
findByIndIdAndCompareObj
(
indId
,
region
);
//算增幅
for
(
DriveIndCalResultDef
gowth
:
gowthValues
)
{
List
<
DriveIndCalResultDef
>
gowthValues
=
driveIndCalResultDefMapper
if
(
gowth
.
getDate
()==
201912
)
{
.
findByIndIdAndCompareObj
(
indId
,
region
);
currentValue
=
gowth
.
getValue
();
for
(
DriveIndCalResultDef
gowth
:
gowthValues
)
{
}
else
{
if
(
gowth
.
getDate
()==
201912
)
{
sameValue
=
gowth
.
getValue
();
currentValue
=
gowth
.
getValue
();
}
}
else
{
sameValue
=
gowth
.
getValue
();
}
}
XSSFRow
row
=
excelSheet
.
getRow
(
rowMap
.
get
(
region
));
row
.
getCell
((
cellMap
.
get
(
indId
)+
2
)).
setCellValue
(
CalculateUtils
.
calGowth
(
currentValue
,
sameValue
,
deiveIndDef
.
getGrowCalType
()));
}
}
XSSFRow
row
=
excelSheet
.
getRow
(
rowMap
.
get
(
region
));
row
.
getCell
((
cellMap
.
get
(
indId
)+
2
)).
setCellValue
(
CalculateUtils
.
calGowth
(
gowthValues
.
get
(
0
).
getUnit
(),
currentValue
,
sameValue
,
null
));
}
}
}
}
}
}
...
...
src/main/java/com/keymobile/indicators/service/hytobacco/ShortboardRuleService.java
View file @
dc60ded3
This diff is collapsed.
Click to expand it.
src/main/java/com/keymobile/indicators/utils/CalculateUtils.java
View file @
dc60ded3
package
com
.
keymobile
.
indicators
.
utils
;
package
com
.
keymobile
.
indicators
.
utils
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
...
@@ -18,19 +17,15 @@ import com.googlecode.aviator.AviatorEvaluator;
...
@@ -18,19 +17,15 @@ import com.googlecode.aviator.AviatorEvaluator;
public
class
CalculateUtils
{
public
class
CalculateUtils
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CalculateUtils
.
class
);
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CalculateUtils
.
class
);
public
static
String
calGowth
(
String
unit
,
String
currentValue
,
String
sameValue
,
String
type
)
{
//type:0 : 本期-同期 1:(本期-同期)/同期
public
static
String
calGowth
(
String
currentValue
,
String
sameValue
,
String
type
)
{
String
gowthValue
=
""
;
String
gowthValue
=
""
;
StringBuilder
formula
=
new
StringBuilder
();
StringBuilder
formula
=
new
StringBuilder
();
if
(!
"NaN"
.
equals
(
currentValue
)
&&
!
"Infinite"
.
equals
(
currentValue
)
if
(!
"NaN"
.
equals
(
currentValue
)
&&
!
"Infinite"
.
equals
(
currentValue
)
&&
!
"NaN"
.
equals
(
sameValue
)
&&
!
"Infinite"
.
equals
(
sameValue
))
{
&&
!
"NaN"
.
equals
(
sameValue
)
&&
!
"Infinite"
.
equals
(
sameValue
))
{
Object
value
=
null
;
Object
value
=
null
;
if
(
"0"
.
equals
(
type
))
{
if
(
"0"
.
equals
(
type
))
{
if
(
"%"
.
equals
(
unit
))
{
formula
.
append
(
currentValue
).
append
(
"-"
).
append
(
sameValue
);
formula
.
append
(
currentValue
).
append
(
"-"
).
append
(
sameValue
);
}
else
{
formula
.
append
(
"("
).
append
(
currentValue
).
append
(
"-"
).
append
(
sameValue
).
append
(
")"
)
.
append
(
"/"
).
append
(
sameValue
).
append
(
"*100"
);
}
}
else
{
}
else
{
formula
.
append
(
"("
).
append
(
currentValue
).
append
(
"-"
).
append
(
sameValue
).
append
(
")"
)
formula
.
append
(
"("
).
append
(
currentValue
).
append
(
"-"
).
append
(
sameValue
).
append
(
")"
)
.
append
(
"/"
).
append
(
sameValue
).
append
(
"*100"
);
.
append
(
"/"
).
append
(
sameValue
).
append
(
"*100"
);
...
...
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