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
b2749988
Commit
b2749988
authored
Jul 08, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改指标计分规则,单位评分和短板评分实体加载转换
parent
323bf45b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
9 deletions
+77
-9
IndScorecardCtrl.java
.../keymobile/indicators/api/hytobacco/IndScorecardCtrl.java
+1
-1
IndScorecardService.java
...ile/indicators/service/hytobacco/IndScorecardService.java
+42
-4
ScoreRuleService.java
...mobile/indicators/service/hytobacco/ScoreRuleService.java
+17
-2
ShortboardRuleService.java
...e/indicators/service/hytobacco/ShortboardRuleService.java
+17
-2
No files found.
src/main/java/com/keymobile/indicators/api/hytobacco/IndScorecardCtrl.java
View file @
b2749988
...
...
@@ -20,7 +20,7 @@ import com.keymobile.indicators.service.hytobacco.ScorecardCatalogService;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
@Api
(
tags
={
"规则管理-指标
积
分规则CRUD"
})
@Api
(
tags
={
"规则管理-指标
计
分规则CRUD"
})
@RestController
@RequestMapping
(
value
=
"/indScorecard"
)
public
class
IndScorecardCtrl
{
...
...
src/main/java/com/keymobile/indicators/service/hytobacco/IndScorecardService.java
View file @
b2749988
...
...
@@ -91,19 +91,31 @@ public class IndScorecardService {
}
public
List
<
IndScorecard
>
getAll
(){
return
indScorecardMapper
.
selectAll
();
List
<
IndScorecard
>
scorecards
=
indScorecardMapper
.
selectAll
();
List
<
IndScorecard
>
result
=
new
ArrayList
<>();
for
(
IndScorecard
scorecard
:
scorecards
)
{
IndScorecard
scorecard1
=
this
.
changeJson
(
scorecard
);
result
.
add
(
scorecard1
);
}
return
result
;
}
public
IndScorecard
findById
(
Integer
id
)
{
IndScorecard
result
=
indScorecardMapper
.
selectByPrimaryKey
(
id
);
if
(
result
!=
null
)
{
return
result
;
return
this
.
changeJson
(
result
)
;
}
return
null
;
}
public
List
<
IndScorecard
>
findByIdList
(
List
<
Integer
>
ids
)
throws
Exception
{
return
indScorecardMapper
.
findByIdList
(
ids
);
List
<
IndScorecard
>
scorecards
=
indScorecardMapper
.
findByIdList
(
ids
);
List
<
IndScorecard
>
result
=
new
ArrayList
<>();
for
(
IndScorecard
scorecard
:
scorecards
)
{
IndScorecard
scorecard1
=
this
.
changeJson
(
scorecard
);
result
.
add
(
scorecard1
);
}
return
result
;
}
public
Map
<
String
,
Object
>
getByCatalogId
(
Integer
catalogId
,
int
page
,
int
rows
){
...
...
@@ -113,8 +125,13 @@ public class IndScorecardService {
int
start
=
(
page
-
1
)*
rows
;
count
=
indScorecardMapper
.
countByCatalogId
(
catalogId
);
List
<
IndScorecard
>
datas
=
indScorecardMapper
.
findByCatalogId
(
catalogId
,
start
,
rows
);
List
<
IndScorecard
>
resultDatas
=
new
ArrayList
<>();
for
(
IndScorecard
data
:
datas
)
{
IndScorecard
data1
=
this
.
changeJson
(
data
);
resultDatas
.
add
(
data1
);
}
result
.
put
(
"count"
,
count
);
result
.
put
(
"data"
,
d
atas
);
result
.
put
(
"data"
,
resultD
atas
);
return
result
;
}
...
...
@@ -378,4 +395,25 @@ public class IndScorecardService {
}
return
value
;
}
private
IndScorecard
changeJson
(
IndScorecard
scorecard
)
{
Gson
gson
=
new
Gson
();
if
(
StringUtils
.
isNotBlank
(
scorecard
.
getAddScoreItemJson
()))
{
List
<
RankScoreDef
>
addScoreItem
=
gson
.
fromJson
(
scorecard
.
getAddScoreItemJson
(),
new
TypeToken
<
List
<
RankScoreDef
>>(){}.
getType
());
scorecard
.
setAddScoreItem
(
addScoreItem
);
}
if
(
StringUtils
.
isNotBlank
(
scorecard
.
getMinusScoreItemJson
()))
{
List
<
RankScoreDef
>
minusScoreItem
=
gson
.
fromJson
(
scorecard
.
getMinusScoreItemJson
(),
new
TypeToken
<
List
<
RankScoreDef
>>(){}.
getType
());
scorecard
.
setMinusScoreItem
(
minusScoreItem
);
}
if
(
StringUtils
.
isNotBlank
(
scorecard
.
getImproveScoreItemJson
()))
{
List
<
ImproveScoreDef
>
importScoreDefList
=
gson
.
fromJson
(
scorecard
.
getImproveScoreItemJson
(),
new
TypeToken
<
List
<
ImproveScoreDef
>>(){}.
getType
());
scorecard
.
setImproveScoreItem
(
importScoreDefList
);
}
return
scorecard
;
}
}
src/main/java/com/keymobile/indicators/service/hytobacco/ScoreRuleService.java
View file @
b2749988
...
...
@@ -77,15 +77,20 @@ public class ScoreRuleService {
int
start
=
(
page
-
1
)*
rows
;
count
=
scoreRuleMapper
.
countByCatalogId
(
catalogId
);
List
<
ScoreRule
>
datas
=
scoreRuleMapper
.
findByCatalogId
(
catalogId
,
start
,
rows
);
List
<
ScoreRule
>
resultDatas
=
new
ArrayList
<>();
for
(
ScoreRule
data
:
datas
)
{
ScoreRule
data1
=
this
.
changeJson
(
data
);
resultDatas
.
add
(
data1
);
}
result
.
put
(
"count"
,
count
);
result
.
put
(
"data"
,
d
atas
);
result
.
put
(
"data"
,
resultD
atas
);
return
result
;
}
public
ScoreRule
getById
(
Integer
id
)
{
ScoreRule
scoreRule
=
scoreRuleMapper
.
selectByPrimaryKey
(
id
);
if
(
scoreRule
!=
null
)
{
return
scoreRule
;
return
this
.
changeJson
(
scoreRule
)
;
}
return
null
;
}
...
...
@@ -348,4 +353,14 @@ public class ScoreRuleService {
logger
.
info
(
"单位评分卡id:"
+
scoreRuleId
+
" 不存在"
);
}
}
private
ScoreRule
changeJson
(
ScoreRule
scoreRule
)
{
Gson
gson
=
new
Gson
();
if
(
StringUtils
.
isNotBlank
(
scoreRule
.
getIndTypeWeightsJson
()))
{
List
<
IndTypeWeight
>
indTypeWeights
=
gson
.
fromJson
(
scoreRule
.
getIndTypeWeightsJson
(),
new
TypeToken
<
List
<
IndTypeWeight
>>(){}.
getType
());
scoreRule
.
setIndTypeWeights
(
indTypeWeights
);
}
return
scoreRule
;
}
}
src/main/java/com/keymobile/indicators/service/hytobacco/ShortboardRuleService.java
View file @
b2749988
...
...
@@ -69,15 +69,20 @@ public class ShortboardRuleService {
int
start
=
(
page
-
1
)*
rows
;
count
=
shortboardRuleMapper
.
countByCatalogId
(
catalogId
);
List
<
ShortboardRule
>
datas
=
shortboardRuleMapper
.
findByCatalogId
(
catalogId
,
start
,
rows
);
List
<
ShortboardRule
>
resultDatas
=
new
ArrayList
<>();
for
(
ShortboardRule
data
:
datas
)
{
ShortboardRule
data1
=
this
.
changeJson
(
data
);
resultDatas
.
add
(
data1
);
}
result
.
put
(
"count"
,
count
);
result
.
put
(
"data"
,
d
atas
);
result
.
put
(
"data"
,
resultD
atas
);
return
result
;
}
public
ShortboardRule
getById
(
Integer
id
)
{
ShortboardRule
shortboardRule
=
shortboardRuleMapper
.
selectByPrimaryKey
(
id
);
if
(
shortboardRule
!=
null
)
{
return
shortboardRule
;
return
this
.
changeJson
(
shortboardRule
)
;
}
return
null
;
}
...
...
@@ -502,4 +507,14 @@ public class ShortboardRuleService {
}
return
realCalResults
;
}
private
ShortboardRule
changeJson
(
ShortboardRule
shortboardRule
)
{
Gson
gson
=
new
Gson
();
if
(
StringUtils
.
isNotBlank
(
shortboardRule
.
getShortboardItemJson
()))
{
List
<
ShortboardItem
>
shortboardItems
=
gson
.
fromJson
(
shortboardRule
.
getShortboardItemJson
(),
new
TypeToken
<
List
<
ShortboardItem
>>(){}.
getType
());
shortboardRule
.
setShortboardItem
(
shortboardItems
);
}
return
shortboardRule
;
}
}
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