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
a44beb64
Commit
a44beb64
authored
Jun 16, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
指标短板筛选规则接口代码提交
parent
60785873
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
8 deletions
+50
-8
IndicatorsDefCtrl.java
...keymobile/indicators/api/hytobacco/IndicatorsDefCtrl.java
+3
-2
ShortboardRuleCtrl.java
...eymobile/indicators/api/hytobacco/ShortboardRuleCtrl.java
+7
-0
ShortboardDriveIndRel.java
...cators/model/entity/shortboard/ShortboardDriveIndRel.java
+2
-2
DriveIndDefService.java
...bile/indicators/service/hytobacco/DriveIndDefService.java
+27
-2
ShortboardRuleService.java
...e/indicators/service/hytobacco/ShortboardRuleService.java
+0
-0
CalculateUtils.java
...n/java/com/keymobile/indicators/utils/CalculateUtils.java
+9
-2
DriveIndCalResultDefMapper.xml
.../resources/mybatis/mapping/DriveIndCalResultDefMapper.xml
+2
-0
No files found.
src/main/java/com/keymobile/indicators/api/hytobacco/IndicatorsDefCtrl.java
View file @
a44beb64
...
@@ -54,8 +54,9 @@ public class IndicatorsDefCtrl {
...
@@ -54,8 +54,9 @@ public class IndicatorsDefCtrl {
@ApiOperation
(
value
=
"新建考核指标"
,
notes
=
"新建考核指标"
)
@ApiOperation
(
value
=
"新建考核指标"
,
notes
=
"新建考核指标"
)
@PostMapping
(
value
=
"/createDriveInd"
)
@PostMapping
(
value
=
"/createDriveInd"
)
public
void
createDriveInd
(
@RequestBody
DriveIndDef
driveIndDef
,
@RequestParam
Integer
catalogId
,
public
void
createDriveInd
(
@RequestBody
DriveIndDef
driveIndDef
,
@RequestParam
Integer
catalogId
,
@RequestParam
String
catalogIdPath
,
@RequestParam
String
user
)
throws
Exception
{
@RequestParam
String
catalogIdPath
,
@RequestParam
String
user
,
driveIndDefService
.
saveOrUpdate
(
driveIndDef
,
catalogId
,
catalogIdPath
,
user
);
@RequestParam
String
shortboardIds
)
throws
Exception
{
driveIndDefService
.
saveOrUpdate
(
driveIndDef
,
catalogId
,
catalogIdPath
,
user
,
shortboardIds
);
}
}
@ApiOperation
(
value
=
"删除考核指标"
,
notes
=
"删除考核指标"
)
@ApiOperation
(
value
=
"删除考核指标"
,
notes
=
"删除考核指标"
)
...
...
src/main/java/com/keymobile/indicators/api/hytobacco/ShortboardRuleCtrl.java
View file @
a44beb64
...
@@ -73,4 +73,11 @@ public class ShortboardRuleCtrl {
...
@@ -73,4 +73,11 @@ public class ShortboardRuleCtrl {
public
ShortboardRule
findById
(
@RequestParam
Integer
id
)
{
public
ShortboardRule
findById
(
@RequestParam
Integer
id
)
{
return
shortboardRuleService
.
getById
(
id
);
return
shortboardRuleService
.
getById
(
id
);
}
}
@ApiOperation
(
value
=
"根据短板规则筛选短板单位"
,
notes
=
"根据短板规则筛选短板单位"
)
@PostMapping
(
value
=
"/getShortboardObj"
)
public
List
<
Map
<
String
,
Object
>>
getObjShortboard
(
@RequestParam
String
compareId
,
@RequestParam
int
date
,
@RequestParam
List
<
String
>
compareObjs
,
@RequestParam
List
<
String
>
driveIds
)
throws
Exception
{
return
shortboardRuleService
.
getObjShortboard
(
compareId
,
date
,
compareObjs
,
driveIds
);
}
}
}
src/main/java/com/keymobile/indicators/model/entity/shortboard/ShortboardDriveIndRel.java
View file @
a44beb64
...
@@ -18,9 +18,9 @@ public class ShortboardDriveIndRel{
...
@@ -18,9 +18,9 @@ public class ShortboardDriveIndRel{
private
Integer
id
;
private
Integer
id
;
private
Integer
shortboardRuleId
;
//短板规则id
private
Integer
shortboardRuleId
;
//短板规则id
private
Integer
driveIndDefId
;
//考核指标id
private
String
driveIndDefId
;
//考核指标id
public
ShortboardDriveIndRel
(
Integer
driveIndDefId
,
Integer
shortboardRuleId
)
{
public
ShortboardDriveIndRel
(
String
driveIndDefId
,
Integer
shortboardRuleId
)
{
this
.
driveIndDefId
=
driveIndDefId
;
this
.
driveIndDefId
=
driveIndDefId
;
this
.
shortboardRuleId
=
shortboardRuleId
;
this
.
shortboardRuleId
=
shortboardRuleId
;
}
}
...
...
src/main/java/com/keymobile/indicators/service/hytobacco/DriveIndDefService.java
View file @
a44beb64
...
@@ -16,7 +16,9 @@ import org.springframework.stereotype.Service;
...
@@ -16,7 +16,9 @@ import org.springframework.stereotype.Service;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.googlecode.aviator.AviatorEvaluator
;
import
com.googlecode.aviator.AviatorEvaluator
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndDef
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndDef
;
import
com.keymobile.indicators.model.entity.shortboard.ShortboardDriveIndRel
;
import
com.keymobile.indicators.model.mapper.indicators.DriveIndDefMapper
;
import
com.keymobile.indicators.model.mapper.indicators.DriveIndDefMapper
;
import
com.keymobile.indicators.model.mapper.indmapper.ShortboardDriveIndRelMapper
;
import
com.keymobile.indicators.utils.CalculateUtils
;
import
com.keymobile.indicators.utils.CalculateUtils
;
@Service
@Service
...
@@ -27,9 +29,11 @@ public class DriveIndDefService {
...
@@ -27,9 +29,11 @@ public class DriveIndDefService {
private
DriveIndDefVersionService
driveIndDefVersionService
;
private
DriveIndDefVersionService
driveIndDefVersionService
;
@Autowired
@Autowired
private
BaseIndDataService
baseIndDataService
;
private
BaseIndDataService
baseIndDataService
;
@Autowired
private
ShortboardDriveIndRelMapper
shortboardDriveIndRelMapper
;
public
String
saveOrUpdate
(
DriveIndDef
driveIndDef
,
Integer
catalogId
,
String
catalogIdPath
,
String
user
)
public
String
saveOrUpdate
(
DriveIndDef
driveIndDef
,
Integer
catalogId
,
String
catalogIdPath
,
throws
Exception
{
String
user
,
String
shortboardIds
)
throws
Exception
{
if
(
StringUtils
.
isBlank
(
driveIndDef
.
getIndId
()))
{
if
(
StringUtils
.
isBlank
(
driveIndDef
.
getIndId
()))
{
return
"indId can not be null"
;
return
"indId can not be null"
;
}
}
...
@@ -56,6 +60,27 @@ public class DriveIndDefService {
...
@@ -56,6 +60,27 @@ public class DriveIndDefService {
driveIndDefMapper
.
updateByPrimaryKey
(
driveIndDef
);
driveIndDefMapper
.
updateByPrimaryKey
(
driveIndDef
);
}
}
}
}
//插入短板筛选规则
if
(
StringUtils
.
isNotBlank
(
shortboardIds
))
{
//查找考核指标之前关联的短板筛选规则
List
<
ShortboardDriveIndRel
>
relations
=
shortboardDriveIndRelMapper
.
findByDriveIndDefId
(
driveIndDef
.
getIndId
());
if
(!
relations
.
isEmpty
())
{
for
(
ShortboardDriveIndRel
relation
:
relations
)
{
shortboardDriveIndRelMapper
.
delete
(
relation
);
}
}
//新建关联关系
String
[]
shortboards
=
shortboardIds
.
split
(
";"
);
for
(
String
shortboardId
:
shortboards
)
{
ShortboardDriveIndRel
relation
=
new
ShortboardDriveIndRel
(
driveIndDef
.
getIndId
(),
Integer
.
parseInt
(
shortboardId
));
ShortboardDriveIndRel
isExistRel
=
shortboardDriveIndRelMapper
.
selectOne
(
relation
);
if
(
isExistRel
==
null
)
{
shortboardDriveIndRelMapper
.
insert
(
relation
);
}
}
}
return
"success;driveIndId:"
+
driveIndDef
.
getIndId
();
return
"success;driveIndId:"
+
driveIndDef
.
getIndId
();
}
}
...
...
src/main/java/com/keymobile/indicators/service/hytobacco/ShortboardRuleService.java
View file @
a44beb64
This diff is collapsed.
Click to expand it.
src/main/java/com/keymobile/indicators/utils/CalculateUtils.java
View file @
a44beb64
...
@@ -232,7 +232,14 @@ public class CalculateUtils {
...
@@ -232,7 +232,14 @@ public class CalculateUtils {
// formula = formula.replace("[1002]", "5");
// formula = formula.replace("[1002]", "5");
// String result1 = AviatorEvaluator.execute(formula).toString();
// String result1 = AviatorEvaluator.execute(formula).toString();
// System.out.println(result1);
// System.out.println(result1);
Double
b
=
(
double
)
Math
.
abs
(
34
-
50
);
// Double b = (double) Math.abs(34-50);
System
.
out
.
println
(
b
);
// System.out.println(b);
List
<
String
>
listA
=
new
ArrayList
<>();
listA
.
add
(
"a"
);
listA
.
add
(
"b"
);
listA
.
add
(
"c"
);
List
<
String
>
listB
=
new
ArrayList
<>();
listA
.
retainAll
(
listB
);
System
.
out
.
println
(
listA
);
}
}
}
}
src/main/resources/mybatis/mapping/DriveIndCalResultDefMapper.xml
View file @
a44beb64
...
@@ -127,5 +127,6 @@
...
@@ -127,5 +127,6 @@
<foreach
item=
"id"
collection=
"compareObjs"
open=
"("
close=
")"
separator=
","
>
<foreach
item=
"id"
collection=
"compareObjs"
open=
"("
close=
")"
separator=
","
>
#{id}
#{id}
</foreach>
</foreach>
order by rank asc
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
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