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
25eeac76
Commit
25eeac76
authored
May 15, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改改善提升评分逻辑
parent
05a0e356
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
94 additions
and
12 deletions
+94
-12
DriveIndCalculateRegionActor.java
...ors/akka/actor/specific/DriveIndCalculateRegionActor.java
+1
-1
IndScorecardCtrl.java
.../keymobile/indicators/api/hytobacco/IndScorecardCtrl.java
+4
-2
IndicatorsValueCtrl.java
...ymobile/indicators/api/hytobacco/IndicatorsValueCtrl.java
+7
-0
DriveIndCalResultRepository.java
...persistence/hyindicators/DriveIndCalResultRepository.java
+2
-0
IndScorecardService.java
...ile/indicators/service/hytobacco/IndScorecardService.java
+25
-6
IndicatorsValueService.java
.../indicators/service/hytobacco/IndicatorsValueService.java
+55
-3
No files found.
src/main/java/com/keymobile/indicators/akka/actor/specific/DriveIndCalculateRegionActor.java
View file @
25eeac76
...
...
@@ -113,7 +113,7 @@ public class DriveIndCalculateRegionActor extends AbstractActor{
Map
<
String
,
String
>
scoreMap
=
indScorecardService
.
calculateIndiScore
(
driveIndCalResult
.
getIndId
(),
driveIndCalResult
.
getDate
(),
driveIndCalResult
.
getCompareObj
(),
markType
,
driveIndCalResult
.
getCompareId
());
driveIndCalResult
.
getCompareId
()
,
compareObjs
);
driveIndCalResult
.
setScore
(
scoreMap
.
get
(
"score"
));
driveIndCalResult
.
setImproveScore
(
scoreMap
.
get
(
"improveScore"
));
driveIndCalResultService
.
saveOrUpdate
(
driveIndCalResult
);
...
...
src/main/java/com/keymobile/indicators/api/hytobacco/IndScorecardCtrl.java
View file @
25eeac76
package
com
.
keymobile
.
indicators
.
api
.
hytobacco
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -51,7 +52,8 @@ public class IndScorecardCtrl {
@PostMapping
(
value
=
"/calculateIndiScore"
)
public
Map
<
String
,
String
>
calculateIndiScore
(
@RequestParam
String
indId
,
@RequestParam
int
date
,
@RequestParam
String
compareObj
,
@RequestParam
String
indScorecardId
,
@RequestParam
String
compareId
)
{
return
indScorecardService
.
calculateIndiScore
(
indId
,
date
,
compareObj
,
indScorecardId
,
compareId
);
@RequestParam
String
compareId
,
@RequestBody
List
<
String
>
compareObjs
)
{
return
indScorecardService
.
calculateIndiScore
(
indId
,
date
,
compareObj
,
indScorecardId
,
compareId
,
compareObjs
);
}
}
src/main/java/com/keymobile/indicators/api/hytobacco/IndicatorsValueCtrl.java
View file @
25eeac76
...
...
@@ -84,4 +84,11 @@ public class IndicatorsValueCtrl {
@RequestParam
String
type
,
@RequestParam
(
required
=
false
)
String
compareIds
)
throws
Exception
{
indicatorsValueService
.
fillExcelFileFive
(
indIds
,
date
,
type
,
compareIds
);
}
@ApiOperation
(
value
=
"填充excel file6数据"
,
notes
=
"填充excel file6数据"
)
@PostMapping
(
value
=
"/fillExcelFileSix"
)
public
void
fillExcelFileSix
(
@RequestBody
List
<
String
>
indIds
,
@RequestParam
String
dateString
)
throws
Exception
{
indicatorsValueService
.
fillExcelFileSix
(
indIds
,
dateString
);
}
}
src/main/java/com/keymobile/indicators/persistence/hyindicators/DriveIndCalResultRepository.java
View file @
25eeac76
...
...
@@ -12,6 +12,8 @@ public interface DriveIndCalResultRepository extends MongoRepository<DriveIndCal
public
List
<
DriveIndCalResult
>
findByIndId
(
String
indId
);
public
List
<
DriveIndCalResult
>
findByIndIdAndDateIn
(
String
indId
,
List
<
Integer
>
dates
);
public
List
<
DriveIndCalResult
>
findByIndIdAndCompareObj
(
String
indId
,
String
compareObj
);
public
Optional
<
DriveIndCalResult
>
findByIndIdAndDateAndCompareObj
(
String
indId
,
int
date
,
String
compareObj
);
...
...
src/main/java/com/keymobile/indicators/service/hytobacco/IndScorecardService.java
View file @
25eeac76
...
...
@@ -62,7 +62,7 @@ public class IndScorecardService {
}
public
Map
<
String
,
String
>
calculateIndiScore
(
String
indId
,
int
date
,
String
compareObj
,
String
indScorecardId
,
String
compareId
)
{
String
indScorecardId
,
String
compareId
,
List
<
String
>
compareObjs
)
{
Map
<
String
,
String
>
result
=
new
HashMap
<>();
String
indScoreValue
=
"0.0"
;
String
indImproveScoreValue
=
"0.0"
;
...
...
@@ -163,6 +163,8 @@ public class IndScorecardService {
}
}
}
}
}
//改善提升
//同期
Optional
<
DriveIndCalResult
>
sameCompareObjResult
=
driveIndResultRepo
...
...
@@ -170,7 +172,7 @@ public class IndScorecardService {
if
(
sameCompareObjResult
.
isPresent
())
{
double
improveScore
=
this
.
calImproveValue
(
acsType
,
unit
,
scoreCard
.
getImproveScoreItem
(),
currentCompareObjResult
.
get
(),
sameCompareObjResult
.
get
()
);
sameCompareObjResult
.
get
(),
compareObjs
);
if
(
scoreCard
.
getLimitScore
()!=
0
)
{
if
(
improveScore
>
scoreCard
.
getLimitScore
())
{
improveScore
=
scoreCard
.
getLimitScore
();
...
...
@@ -180,8 +182,6 @@ public class IndScorecardService {
result
.
put
(
"improveScore"
,
indImproveScoreValue
);
}
}
}
}
}
else
{
logger
.
error
(
"id:"
+
indScorecardId
+
" 的评分卡不存在"
);
}
...
...
@@ -194,12 +194,31 @@ public class IndScorecardService {
}
private
double
calImproveValue
(
String
acsType
,
String
unit
,
List
<
ImproveScoreDef
>
importScoreDefList
,
DriveIndCalResult
current
,
DriveIndCalResult
same
)
{
DriveIndCalResult
current
,
DriveIndCalResult
same
,
List
<
String
>
compareObjs
)
{
double
sumValue
=
0
;
for
(
ImproveScoreDef
scoreDef
:
importScoreDefList
)
{
// 0:同期排位比 1:单位同期比
if
(
"0"
.
equals
(
scoreDef
.
getGradeType
()))
{
int
rankDiff
=
same
.
getRank
()-
current
.
getRank
();
int
rankDiff
=
0
;
if
(
compareObjs
.
isEmpty
())
{
rankDiff
=
same
.
getRank
()-
current
.
getRank
();
}
else
{
//考虑同期分组有变的情况,把组内成原同期的指标值拿出来再进行排名
Map
<
String
,
String
>
values
=
new
HashMap
<>();
for
(
String
compareObj
:
compareObjs
)
{
Optional
<
DriveIndCalResult
>
sameCompareObjResult
=
driveIndResultRepo
.
findByIndIdAndDateAndCompareObj
(
current
.
getIndId
(),
(
current
.
getDate
()-
100
),
compareObj
);
if
(
sameCompareObjResult
.
isPresent
())
{
values
.
put
(
compareObj
,
sameCompareObjResult
.
get
().
getValue
());
}
else
{
values
.
put
(
compareObj
,
"0"
);
}
}
//排名
Map
<
String
,
Integer
>
rankValue
=
CalculateUtils
.
rankValue
(
values
,
acsType
);
rankDiff
=
rankValue
.
get
(
current
.
getCompareObj
())-
current
.
getRank
();
}
//加减分操作 0:加分 1:减分
if
(
"0"
.
equals
(
scoreDef
.
getGradeOp
()))
{
if
(
rankDiff
>
0
)
{
...
...
src/main/java/com/keymobile/indicators/service/hytobacco/IndicatorsValueService.java
View file @
25eeac76
...
...
@@ -255,6 +255,56 @@ public class IndicatorsValueService {
logger
.
info
(
"填充完成"
);
}
//填充2020第一季度县数据
public
void
fillExcelFileSix
(
List
<
String
>
indIds
,
String
dateString
)
throws
Exception
{
FileInputStream
fs
=
new
FileInputStream
(
"D://indicatorsFile/file6.xlsx"
);
XSSFWorkbook
xssfWorkbook
=
new
XSSFWorkbook
(
fs
);
XSSFSheet
excelSheet
=
xssfWorkbook
.
getSheet
(
"Sheet1"
);
Map
<
String
,
Integer
>
cellMap
=
new
HashMap
<>();
cellMap
.
put
(
"FC001"
,
2
);
cellMap
.
put
(
"FC002"
,
4
);
cellMap
.
put
(
"FC003"
,
6
);
cellMap
.
put
(
"FC004"
,
8
);
cellMap
.
put
(
"FC005"
,
10
);
cellMap
.
put
(
"FC0011"
,
12
);
cellMap
.
put
(
"FC0012"
,
14
);
cellMap
.
put
(
"FC0020"
,
16
);
Map
<
String
,
Integer
>
rowMap
=
new
HashMap
<>();
//获取行值
for
(
int
i
=
1
;
i
<
91
;
i
++)
{
XSSFRow
row
=
excelSheet
.
getRow
(
i
);
String
value
=
row
.
getCell
(
1
)==
null
?
""
:
row
.
getCell
(
1
).
getStringCellValue
();
if
(
StringUtils
.
isNotBlank
(
value
))
{
rowMap
.
put
(
value
,
i
);
}
}
String
[]
dates
=
dateString
.
split
(
";"
);
List
<
Integer
>
dateList
=
new
ArrayList
<>();
for
(
String
date
:
dates
)
{
dateList
.
add
(
Integer
.
valueOf
(
date
));
}
//根据考核指标id获取本期和同期的指标值
for
(
String
indId
:
indIds
)
{
List
<
DriveIndCalResult
>
driveResult
=
driveIndResultRepo
.
findByIndIdAndDateIn
(
indId
,
dateList
);
for
(
DriveIndCalResult
result
:
driveResult
)
{
String
region
=
result
.
getCompareObj
();
if
(
rowMap
.
get
(
region
)!=
null
)
{
XSSFRow
row
=
excelSheet
.
getRow
(
rowMap
.
get
(
region
));
if
(
result
.
getDate
()==
dateList
.
get
(
0
))
{
row
.
getCell
(
cellMap
.
get
(
indId
)).
setCellValue
(
result
.
getValue
());
}
else
{
row
.
getCell
((
cellMap
.
get
(
indId
)+
1
)).
setCellValue
(
result
.
getValue
());
}
}
else
{
logger
.
info
(
"找不到 "
+
region
+
" 对应的列"
);
}
}
}
FileOutputStream
out
=
new
FileOutputStream
(
"D://indicatorsFile/file6.xlsx"
);
out
.
flush
();
xssfWorkbook
.
write
(
out
);
out
.
close
();
fs
.
close
();
logger
.
info
(
"填充完成"
);
}
//填充县考核指标值
public
void
fillExcelFileTwo
(
List
<
String
>
indIds
)
throws
Exception
{
FileInputStream
fs
=
new
FileInputStream
(
"D://indicatorsFile/file2.xlsx"
);
...
...
@@ -507,9 +557,9 @@ public class IndicatorsValueService {
indMappingIndId
.
put
(
"零售客户进货规格数之和(个)"
,
"F006"
);
indMappingIndId
.
put
(
"零售客户总数(个)"
,
"F008"
);
indMappingIndId
.
put
(
"卷烟销售单箱均价(万元)"
,
"F0010"
);
indMappingIndId
.
put
(
"卷烟营销费用(万元)"
,
"F0016"
);
indMappingIndId
.
put
(
"卷烟管理费用(万元)"
,
"F0018"
);
indMappingIndId
.
put
(
"查获烟叶量(千克)"
,
"F0032"
);
indMappingIndId
.
put
(
"查获烟丝量(千克)"
,
"F0034"
);
indMappingIndId
.
put
(
"查获
真烟量(万支)"
,
"F0040
"
);
indMappingIndId
.
put
(
"查获
未当案件卷烟量(万支)"
,
"F0058"
);
indMappingIndId
.
put
(
"专卖线在岗人员数(人)"
,
"F003
8"
);
indMappingIndId
.
put
(
"营销线在岗人员数(人)"
,
"F0014"
);
indMappingIndId
.
put
(
"查获烟丝量(千克)"
,
"F0034"
);
indMappingIndId
.
put
(
"查获
假私烟量(万支)"
,
"F0036
"
);
indMappingIndId
.
put
(
"查获
真烟量(万支)"
,
"F0040"
);
indMappingIndId
.
put
(
"查获未当案件卷烟量(万支)"
,
"F005
8"
);
indMappingIndId
.
put
(
"
专卖线在岗人员数(人)"
,
"F0038"
);
indMappingIndId
.
put
(
"
营销线在岗人员数(人)"
,
"F0014"
);
String
regex
=
"\\((.*?))"
;
Pattern
pattern
=
Pattern
.
compile
(
regex
);
...
...
@@ -575,6 +625,8 @@ public class IndicatorsValueService {
}
}
}
this
.
addIndicatorData
(
datas
);
logger
.
info
(
"导入完成"
);
}
public
void
importIndicatorsData
(
XSSFWorkbook
xssfWorkbook
)
throws
Exception
{
...
...
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