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
a66fa4e1
Commit
a66fa4e1
authored
Apr 17, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
考核指标公式脑图分析接口上传
parent
7bcd537d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
110 additions
and
0 deletions
+110
-0
IndAcsScoreInfoCtrl.java
.../keymobile/indicators/api/cmbkpi/IndAcsScoreInfoCtrl.java
+8
-0
IndRelTree.java
...ava/com/keymobile/indicators/model/entity/IndRelTree.java
+16
-0
IndAcsScoreInfoService.java
...ile/indicators/service/cmbkpi/IndAcsScoreInfoService.java
+59
-0
FormulaUtils.java
...ain/java/com/keymobile/indicators/utils/FormulaUtils.java
+27
-0
No files found.
src/main/java/com/keymobile/indicators/api/cmbkpi/IndAcsScoreInfoCtrl.java
View file @
a66fa4e1
...
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
...
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.keymobile.indicators.model.entity.IndAcsScoreInfo
;
import
com.keymobile.indicators.model.entity.IndAcsScoreInfo
;
import
com.keymobile.indicators.model.entity.IndRelTree
;
import
com.keymobile.indicators.service.cmbkpi.IndAcsScoreInfoService
;
import
com.keymobile.indicators.service.cmbkpi.IndAcsScoreInfoService
;
import
com.keymobile.indicators.utils.DateUtils
;
import
com.keymobile.indicators.utils.DateUtils
;
...
@@ -66,4 +67,11 @@ public class IndAcsScoreInfoCtrl {
...
@@ -66,4 +67,11 @@ public class IndAcsScoreInfoCtrl {
@RequestParam
(
required
=
false
)
String
type
)
throws
Exception
{
@RequestParam
(
required
=
false
)
String
type
)
throws
Exception
{
return
indAscScoreService
.
getIndByKeywordAndType
(
keyword
,
type
);
return
indAscScoreService
.
getIndByKeywordAndType
(
keyword
,
type
);
}
}
@ApiOperation
(
value
=
"分析考核指标公式脑图"
,
notes
=
"分析考核指标公式脑图"
)
@PostMapping
(
value
=
"/analysisIndTree"
)
public
IndRelTree
analysisIndTree
(
@RequestParam
String
orgId
,
@RequestParam
String
indId
,
@RequestParam
String
indAttrId
)
throws
Exception
{
return
indAscScoreService
.
analysisIndTree
(
orgId
,
indId
,
indAttrId
);
}
}
}
src/main/java/com/keymobile/indicators/model/entity/IndRelTree.java
0 → 100644
View file @
a66fa4e1
package
com
.
keymobile
.
indicators
.
model
.
entity
;
import
java.util.ArrayList
;
import
java.util.List
;
import
lombok.Data
;
@Data
public
class
IndRelTree
{
private
Double
weight
;
private
String
indId
;
private
String
indName
;
private
String
indAttrId
;
private
String
type
;
private
List
<
IndRelTree
>
children
=
new
ArrayList
<>();
}
src/main/java/com/keymobile/indicators/service/cmbkpi/IndAcsScoreInfoService.java
View file @
a66fa4e1
...
@@ -12,9 +12,11 @@ import org.springframework.stereotype.Service;
...
@@ -12,9 +12,11 @@ import org.springframework.stereotype.Service;
import
com.keymobile.indicators.model.entity.IndAcsDef
;
import
com.keymobile.indicators.model.entity.IndAcsDef
;
import
com.keymobile.indicators.model.entity.IndAcsScoreInfo
;
import
com.keymobile.indicators.model.entity.IndAcsScoreInfo
;
import
com.keymobile.indicators.model.entity.IndAnaDef
;
import
com.keymobile.indicators.model.entity.IndAnaDef
;
import
com.keymobile.indicators.model.entity.IndRelTree
;
import
com.keymobile.indicators.model.mapper.IndAcsDefMapper
;
import
com.keymobile.indicators.model.mapper.IndAcsDefMapper
;
import
com.keymobile.indicators.model.mapper.IndAcsScoreInfoMapper
;
import
com.keymobile.indicators.model.mapper.IndAcsScoreInfoMapper
;
import
com.keymobile.indicators.model.mapper.IndAnaDefMapper
;
import
com.keymobile.indicators.model.mapper.IndAnaDefMapper
;
import
com.keymobile.indicators.utils.FormulaUtils
;
@Service
@Service
public
class
IndAcsScoreInfoService
{
public
class
IndAcsScoreInfoService
{
...
@@ -122,4 +124,61 @@ public class IndAcsScoreInfoService {
...
@@ -122,4 +124,61 @@ public class IndAcsScoreInfoService {
}
}
return
resultList
;
return
resultList
;
}
}
public
Map
<
String
,
String
>
getIndicatorByInId
(
String
indId
){
Map
<
String
,
String
>
result
=
new
HashMap
<>();
IndAcsDef
indAscDef
=
new
IndAcsDef
();
indAscDef
.
setIndId
(
indId
);
IndAnaDef
indAnaDef
=
new
IndAnaDef
();
indAnaDef
.
setIndId
(
indId
);
IndAcsDef
ascDef
=
indAcsDefMapper
.
selectOne
(
indAscDef
);
if
(
ascDef
!=
null
)
{
result
.
put
(
"indId"
,
ascDef
.
getIndId
());
result
.
put
(
"indName"
,
ascDef
.
getIndName
());
result
.
put
(
"type"
,
"1"
);
}
else
{
IndAnaDef
anaDef
=
indAnaDefMapper
.
selectOne
(
indAnaDef
);
if
(
anaDef
!=
null
)
{
result
.
put
(
"indId"
,
anaDef
.
getIndId
());
result
.
put
(
"indName"
,
anaDef
.
getIndName
());
result
.
put
(
"type"
,
"0"
);
}
}
return
result
;
}
public
IndRelTree
analysisIndTree
(
String
orgId
,
String
indId
,
String
indAttrId
)
throws
Exception
{
IndRelTree
indRelTree
=
new
IndRelTree
();
//获取指标信息
Map
<
String
,
String
>
indInfo
=
this
.
getIndicatorByInId
(
indId
);
if
(
indInfo
.
isEmpty
())
{
indRelTree
.
setIndId
(
indId
+
" has been deleted"
);
indRelTree
.
setIndName
(
indId
+
" 被删除"
);
indRelTree
.
setType
(
indInfo
.
get
(
"unknown"
));
}
else
{
indRelTree
.
setIndId
(
indInfo
.
get
(
"indId"
));
indRelTree
.
setIndName
(
indInfo
.
get
(
"indName"
));
indRelTree
.
setType
(
indInfo
.
get
(
"type"
));
}
indRelTree
.
setChildren
(
new
ArrayList
<
IndRelTree
>());
//根据机构id,指标id和指标类型获取考核指标
IndAcsScoreInfo
indAcsScoreInfo
=
this
.
selectOneByOrgIdAndIndidAndIndtype
(
orgId
,
indId
,
indAttrId
);
if
(
indAcsScoreInfo
!=
null
)
{
indRelTree
.
setIndAttrId
(
indAcsScoreInfo
.
getIndexAttrId
());
indRelTree
.
setWeight
(
indAcsScoreInfo
.
getWeight
());
//分析公式
String
formula
=
indAcsScoreInfo
.
getScoreFormula
();
if
(
StringUtils
.
isNotBlank
(
formula
))
{
List
<
Map
<
String
,
String
>>
formulaInfo
=
FormulaUtils
.
analysisFormula
(
formula
);
for
(
Map
<
String
,
String
>
map
:
formulaInfo
)
{
indRelTree
.
getChildren
().
add
(
analysisIndTree
(
orgId
,
map
.
get
(
"indId"
),
map
.
get
(
"indAttrId"
)));
}
}
}
return
indRelTree
;
}
}
}
src/main/java/com/keymobile/indicators/utils/FormulaUtils.java
0 → 100644
View file @
a66fa4e1
package
com
.
keymobile
.
indicators
.
utils
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
public
class
FormulaUtils
{
public
static
List
<
Map
<
String
,
String
>>
analysisFormula
(
String
formula
){
List
<
Map
<
String
,
String
>>
result
=
new
ArrayList
<>();
Pattern
p
=
Pattern
.
compile
(
"(\\[[^\\]]*\\])"
);
Matcher
m
=
p
.
matcher
(
formula
);
while
(
m
.
find
()){
Map
<
String
,
String
>
map
=
new
HashMap
<>();
String
expression
=
m
.
group
().
substring
(
1
,
m
.
group
().
length
()-
1
);
String
[]
params
=
expression
.
split
(
":"
);
map
.
put
(
"indId"
,
params
[
0
]);
map
.
put
(
"indAttrId"
,
params
[
1
]);
map
.
put
(
"dateRef"
,
params
[
2
]);
result
.
add
(
map
);
}
return
result
;
}
}
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