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
0c96be2f
Commit
0c96be2f
authored
Oct 09, 2020
by
hzc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
从前台获取短板单元对象(短板预警保存或预览)
parent
76fb2c53
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
49 deletions
+75
-49
ShortboardUnitCtrl.java
...eymobile/indicators/api/hytobacco/ShortboardUnitCtrl.java
+10
-8
ShortBoardWarnData.java
...ndicators/model/entity/shortboard/ShortBoardWarnData.java
+29
-0
ShortboardRuleService.java
...e/indicators/service/hytobacco/ShortboardRuleService.java
+9
-14
ShortboardUnitService.java
...e/indicators/service/hytobacco/ShortboardUnitService.java
+27
-27
No files found.
src/main/java/com/keymobile/indicators/api/hytobacco/ShortboardUnitCtrl.java
View file @
0c96be2f
...
@@ -6,6 +6,7 @@ import java.util.Map;
...
@@ -6,6 +6,7 @@ import java.util.Map;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
com.keymobile.indicators.model.entity.shortboard.ShortBoardWarnData
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
@@ -135,18 +136,19 @@ public class ShortboardUnitCtrl {
...
@@ -135,18 +136,19 @@ public class ShortboardUnitCtrl {
@ApiOperation
(
value
=
"根据给定的短板规则筛选短板单位(预览)"
,
notes
=
"根据给定的短板规则筛选短板单位(预览)"
)
@ApiOperation
(
value
=
"根据给定的短板规则筛选短板单位(预览)"
,
notes
=
"根据给定的短板规则筛选短板单位(预览)"
)
@PostMapping
(
value
=
"/getObjFromShortboardRule"
)
@PostMapping
(
value
=
"/getObjFromShortboardRule"
)
public
List
<
ShortboardRecord
>
getObjFromShortboardRule
(
@RequestParam
int
date
,
@RequestParam
List
<
String
>
compareObjs
,
public
List
<
ShortboardRecord
>
getObjFromShortboardRule
(
@RequestBody
ShortBoardWarnData
shortBoardWarnData
)
throws
Exception
{
@RequestParam
List
<
String
>
driveIds
,
@RequestParam
List
<
Integer
>
shortboardRuleIds
,
@RequestParam
String
code
,
@RequestParam
(
required
=
false
)
String
user
)
throws
Exception
{
// @RequestParam int date,@RequestParam List<String> compareObjs,
return
shortboardRuleService
.
getObjFromShortboardRule
(
date
,
compareObjs
,
driveIds
,
// @RequestParam List<String> driveIds,@RequestParam List<Integer> shortboardRuleIds,
shortboardRuleIds
,
code
,
user
);
// @RequestParam String code,@RequestParam(required=false) String user
return
shortboardRuleService
.
getObjFromShortboardRule
(
shortBoardWarnData
);
}
}
@ApiOperation
(
value
=
"保存预览数据生成短板预警池数据"
,
notes
=
"保存预览数据生成短板预警池数据"
)
@ApiOperation
(
value
=
"保存预览数据生成短板预警池数据"
,
notes
=
"保存预览数据生成短板预警池数据"
)
@PostMapping
(
value
=
"/getShortboardWarnning"
)
@PostMapping
(
value
=
"/getShortboardWarnning"
)
public
String
getShortboardWarnning
(
@RequestParam
Integer
unitId
,
public
String
getShortboardWarnning
(
@RequestBody
ShortBoardWarnData
shortBoardWarnData
)
throws
Exception
{
@RequestParam
(
required
=
false
)
String
user
)
throws
Exception
{
return
shortboardUnitService
.
getShortboardObjFromUnit
(
shortBoardWarnData
);
return
shortboardUnitService
.
getShortboardObjFromUnit
(
unitId
,
user
);
}
}
@ApiOperation
(
value
=
"分页获取短板预警池数据"
,
notes
=
"分页获取短板预警池数据"
)
@ApiOperation
(
value
=
"分页获取短板预警池数据"
,
notes
=
"分页获取短板预警池数据"
)
...
...
src/main/java/com/keymobile/indicators/model/entity/shortboard/ShortBoardWarnData.java
0 → 100644
View file @
0c96be2f
package
com
.
keymobile
.
indicators
.
model
.
entity
.
shortboard
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
@Data
@ApiModel
(
"短板预警池-预览或保存"
)
public
class
ShortBoardWarnData
{
@ApiModelProperty
(
"短板单元id"
)
private
Integer
id
;
@ApiModelProperty
(
"短板对象集合"
)
private
List
<
String
>
commpareObjs
;
@ApiModelProperty
(
"考核指标id集合"
)
private
List
<
String
>
driveIndIds
;
//考核指标id,多个用分号隔开
@ApiModelProperty
(
"短板规则id集合"
)
private
List
<
Integer
>
shortboardIds
;
//短板规则id,多个用分号隔开
@ApiModelProperty
(
"考核时间"
)
private
Integer
date
;
//考核时间
@ApiModelProperty
(
"标识编码"
)
private
String
code
;
//标识编码
@ApiModelProperty
(
"部门"
)
private
String
department
;
//部门
@ApiModelProperty
(
"用户)保存更新者"
)
private
String
user
;
}
src/main/java/com/keymobile/indicators/service/hytobacco/ShortboardRuleService.java
View file @
0c96be2f
...
@@ -5,6 +5,7 @@ import java.util.HashMap;
...
@@ -5,6 +5,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
com.keymobile.indicators.model.entity.shortboard.*
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -15,10 +16,6 @@ import com.google.gson.Gson;
...
@@ -15,10 +16,6 @@ import com.google.gson.Gson;
import
com.google.gson.reflect.TypeToken
;
import
com.google.gson.reflect.TypeToken
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef
;
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.entity.shortboard.ShortboardItem
;
import
com.keymobile.indicators.model.entity.shortboard.ShortboardRecord
;
import
com.keymobile.indicators.model.entity.shortboard.ShortboardRule
;
import
com.keymobile.indicators.model.mapper.indmapper.DriveIndCalResultDefMapper
;
import
com.keymobile.indicators.model.mapper.indmapper.DriveIndCalResultDefMapper
;
import
com.keymobile.indicators.model.mapper.indmapper.ShortboardDriveIndRelMapper
;
import
com.keymobile.indicators.model.mapper.indmapper.ShortboardDriveIndRelMapper
;
import
com.keymobile.indicators.model.mapper.indmapper.ShortboardRuleMapper
;
import
com.keymobile.indicators.model.mapper.indmapper.ShortboardRuleMapper
;
...
@@ -95,21 +92,19 @@ public class ShortboardRuleService {
...
@@ -95,21 +92,19 @@ public class ShortboardRuleService {
}
}
//根据给定的短板规则筛选短板单位
//根据给定的短板规则筛选短板单位
public
List
<
ShortboardRecord
>
getObjFromShortboardRule
(
Integer
date
,
public
List
<
ShortboardRecord
>
getObjFromShortboardRule
(
ShortBoardWarnData
shortBoardWarnData
)
throws
Exception
{
List
<
String
>
compareObjs
,
List
<
String
>
driveIds
,
List
<
Integer
>
shortboardRuleIds
,
String
code
,
String
user
)
throws
Exception
{
List
<
ShortboardRecord
>
result
=
new
ArrayList
<>();
List
<
ShortboardRecord
>
result
=
new
ArrayList
<>();
Gson
gson
=
new
Gson
();
Gson
gson
=
new
Gson
();
int
status
=
0
;
int
status
=
0
;
List
<
DriveIndCalResultDef
>
compareCalResults
=
new
ArrayList
<>();
List
<
DriveIndCalResultDef
>
compareCalResults
=
new
ArrayList
<>();
for
(
String
driveId
:
driveIds
)
{
for
(
String
driveId
:
shortBoardWarnData
.
getDriveIndIds
()
)
{
DriveIndDef
driveIndDef
=
driveIndDefService
.
getById
(
driveId
);
DriveIndDef
driveIndDef
=
driveIndDefService
.
getById
(
driveId
);
if
(
driveIndDef
!=
null
)
{
if
(
driveIndDef
!=
null
)
{
StringBuilder
shortboardRuleIdString
=
new
StringBuilder
(
""
);
StringBuilder
shortboardRuleIdString
=
new
StringBuilder
(
""
);
StringBuilder
shortboardName
=
new
StringBuilder
(
""
);
StringBuilder
shortboardName
=
new
StringBuilder
(
""
);
StringBuilder
shortboardDesc
=
new
StringBuilder
(
""
);
StringBuilder
shortboardDesc
=
new
StringBuilder
(
""
);
StringBuilder
shortboardType
=
new
StringBuilder
(
""
);
StringBuilder
shortboardType
=
new
StringBuilder
(
""
);
for
(
Integer
sbRuleId
:
short
boardRuleIds
)
{
for
(
Integer
sbRuleId
:
short
BoardWarnData
.
getShortboardIds
()
)
{
ShortboardRule
shortboardRule
=
this
.
getById
(
sbRuleId
);
ShortboardRule
shortboardRule
=
this
.
getById
(
sbRuleId
);
if
(
shortboardRule
!=
null
)
{
if
(
shortboardRule
!=
null
)
{
shortboardRuleIdString
.
append
(
shortboardRule
.
getId
()).
append
(
";"
);
//拼接短板规则id
shortboardRuleIdString
.
append
(
shortboardRule
.
getId
()).
append
(
";"
);
//拼接短板规则id
...
@@ -121,7 +116,7 @@ public class ShortboardRuleService {
...
@@ -121,7 +116,7 @@ public class ShortboardRuleService {
for
(
ShortboardItem
shortboardItem
:
shortboardItems
)
{
for
(
ShortboardItem
shortboardItem
:
shortboardItems
)
{
shortboardType
.
append
(
shortboardItem
.
getType
()).
append
(
";"
);
//拼接短板类型
shortboardType
.
append
(
shortboardItem
.
getType
()).
append
(
";"
);
//拼接短板类型
List
<
DriveIndCalResultDef
>
driveIndCalResults
=
this
.
selectShortboardObj
(
List
<
DriveIndCalResultDef
>
driveIndCalResults
=
this
.
selectShortboardObj
(
shortboardItem
,
compareObjs
,
driveId
,
date
,
code
);
shortboardItem
,
shortBoardWarnData
.
getCommpareObjs
(),
driveId
,
shortBoardWarnData
.
getDate
(),
shortBoardWarnData
.
getCode
()
);
if
(
status
==
0
)
{
if
(
status
==
0
)
{
compareCalResults
.
addAll
(
driveIndCalResults
);
compareCalResults
.
addAll
(
driveIndCalResults
);
status
=
1
;
status
=
1
;
...
@@ -139,9 +134,9 @@ public class ShortboardRuleService {
...
@@ -139,9 +134,9 @@ public class ShortboardRuleService {
shortboardRecord
.
setDriveId
(
driveIndDef
.
getIndId
());
shortboardRecord
.
setDriveId
(
driveIndDef
.
getIndId
());
shortboardRecord
.
setDriveName
(
driveIndDef
.
getIndName
());
shortboardRecord
.
setDriveName
(
driveIndDef
.
getIndName
());
shortboardRecord
.
setValue
(
driveIndCalDef
.
getValue
());
shortboardRecord
.
setValue
(
driveIndCalDef
.
getValue
());
shortboardRecord
.
setDate
(
date
);
shortboardRecord
.
setDate
(
shortBoardWarnData
.
getDate
()
);
shortboardRecord
.
setCompareCalResultJson
(
gson
.
toJson
(
driveIndCalDef
));
shortboardRecord
.
setCompareCalResultJson
(
gson
.
toJson
(
driveIndCalDef
));
shortboardRecord
.
setDepartment
(
shortBoardWarnData
.
getDepartment
());
shortboardRecord
.
setShortboardRuleIds
(
shortboardRuleIdString
.
toString
());
shortboardRecord
.
setShortboardRuleIds
(
shortboardRuleIdString
.
toString
());
shortboardRecord
.
setShortboardName
(
shortboardName
.
toString
());
shortboardRecord
.
setShortboardName
(
shortboardName
.
toString
());
shortboardRecord
.
setShortboardDesc
(
shortboardDesc
.
toString
());
shortboardRecord
.
setShortboardDesc
(
shortboardDesc
.
toString
());
...
@@ -152,8 +147,8 @@ public class ShortboardRuleService {
...
@@ -152,8 +147,8 @@ public class ShortboardRuleService {
shortboardRecord
.
setUnitName
(
driveIndCalDef
.
getCompareObjDesc
());
shortboardRecord
.
setUnitName
(
driveIndCalDef
.
getCompareObjDesc
());
shortboardRecord
.
setIsIssue
(
"0"
);
shortboardRecord
.
setIsIssue
(
"0"
);
shortboardRecord
.
setCode
(
code
);
shortboardRecord
.
setCode
(
shortBoardWarnData
.
getCode
()
);
shortboardRecord
.
setLastUpdater
(
user
);
shortboardRecord
.
setLastUpdater
(
shortBoardWarnData
.
getUser
()
);
result
.
add
(
shortboardRecord
);
result
.
add
(
shortboardRecord
);
}
}
...
...
src/main/java/com/keymobile/indicators/service/hytobacco/ShortboardUnitService.java
View file @
0c96be2f
...
@@ -7,6 +7,7 @@ import java.util.HashMap;
...
@@ -7,6 +7,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
com.keymobile.indicators.model.entity.shortboard.ShortBoardWarnData
;
import
com.keymobile.indicators.utils.SystemUserUtil
;
import
com.keymobile.indicators.utils.SystemUserUtil
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -84,44 +85,43 @@ public class ShortboardUnitService {
...
@@ -84,44 +85,43 @@ public class ShortboardUnitService {
}
}
//保存预览数据生成短板预警池数据
//保存预览数据生成短板预警池数据
public
String
getShortboardObjFromUnit
(
Integer
id
,
String
user
)
throws
Exception
{
public
String
getShortboardObjFromUnit
(
ShortBoardWarnData
shortBoardWarnData
)
throws
Exception
{
List
<
ShortboardRecord
>
result
=
new
ArrayList
<>();
List
<
ShortboardRecord
>
result
=
new
ArrayList
<>();
ShortboardUnit
shortboardUnit
=
this
.
getById
(
id
);
//根据短板单元id获取短板单元
//
ShortboardUnit shortboardUnit = this.getById(id);//根据短板单元id获取短板单元
if
(
short
boardUnit
!=
null
)
{
if
(
short
BoardWarnData
!=
null
)
{
List
<
String
>
compareObjList
=
new
ArrayList
<>();
List
<
String
>
compareObjList
=
shortBoardWarnData
.
getCommpareObjs
();
//
new ArrayList<>();
List
<
String
>
driveIndIdList
=
new
ArrayList
<>();
List
<
String
>
driveIndIdList
=
shortBoardWarnData
.
getDriveIndIds
();
//
new ArrayList<>();
List
<
Integer
>
shortboardIdList
=
new
ArrayList
<>();
List
<
Integer
>
shortboardIdList
=
shortBoardWarnData
.
getShortboardIds
();
//
new ArrayList<>();
//转换短板对象
//转换短板对象
String
compareObjsString
=
shortboardUnit
.
getCommpareObjs
();
// String compareObjsString = shortBoardWarnData
.getCommpareObjs();
if
(
StringUtils
.
isNotBlank
(
compareObjsString
))
{
//
if(StringUtils.isNotBlank(compareObjsString)) {
String
[]
compareObjs
=
compareObjsString
.
split
(
";"
);
//
String[] compareObjs = compareObjsString.split(";");
compareObjList
=
Arrays
.
asList
(
compareObjs
);
//
compareObjList = Arrays.asList(compareObjs);
}
//
}
//转换考核指标id
//转换考核指标id
String
driveIndIdsString
=
shortboardUnit
.
getDriveIndIds
();
// String driveIndIdsString = shortBoardWarnData
.getDriveIndIds();
if
(
StringUtils
.
isNotBlank
(
driveIndIdsString
))
{
//
if(StringUtils.isNotBlank(driveIndIdsString)) {
String
[]
driveIndIds
=
driveIndIdsString
.
split
(
";"
);
//
String[] driveIndIds = driveIndIdsString.split(";");
driveIndIdList
=
Arrays
.
asList
(
driveIndIds
);
//
driveIndIdList = Arrays.asList(driveIndIds);
}
//
}
//转换短板规则id
//转换短板规则id
String
shortboardIdsString
=
shortboardUnit
.
getShortboardIds
();
// String shortboardIdsString = shortBoardWarnData
.getShortboardIds();
if
(
StringUtils
.
isNotBlank
(
shortboardIdsString
))
{
//
if(StringUtils.isNotBlank(shortboardIdsString)) {
String
[]
shortboardIds
=
shortboardIdsString
.
split
(
";"
);
//
String[] shortboardIds = shortboardIdsString.split(";");
for
(
String
shortboardId
:
shortboardIds
)
{
//
for(String shortboardId : shortboardIds) {
shortboardIdList
.
add
(
Integer
.
parseInt
(
shortboardId
));
//
shortboardIdList.add(Integer.parseInt(shortboardId));
}
//
}
}
//
}
if
(!
compareObjList
.
isEmpty
()
&&
!
driveIndIdList
.
isEmpty
()
&&
!
shortboardIdList
.
isEmpty
())
{
if
(!
compareObjList
.
isEmpty
()
&&
!
driveIndIdList
.
isEmpty
()
&&
!
shortboardIdList
.
isEmpty
())
{
result
=
shortboardRuleService
.
getObjFromShortboardRule
(
shortboardUnit
.
getDate
(),
result
=
shortboardRuleService
.
getObjFromShortboardRule
(
shortBoardWarnData
);
compareObjList
,
driveIndIdList
,
shortboardIdList
,
shortboardUnit
.
getCode
(),
user
);
}
}
if
(!
result
.
isEmpty
())
{
if
(!
result
.
isEmpty
())
{
String
currentUserId
=
SystemUserUtil
.
getCurrentUserId
();
String
currentUserId
=
SystemUserUtil
.
getCurrentUserId
();
for
(
ShortboardRecord
shortboardRecord
:
result
)
{
for
(
ShortboardRecord
shortboardRecord
:
result
)
{
shortboardRecord
.
setUserId
(
currentUserId
);
shortboardRecord
.
setUserId
(
currentUserId
);
shortboardRecord
.
setDepartment
(
short
boardUnit
.
getDepartment
());
shortboardRecord
.
setDepartment
(
short
BoardWarnData
.
getDepartment
());
shortboardRecord
.
setShortboardUnitId
(
id
);
shortboardRecord
.
setShortboardUnitId
(
shortBoardWarnData
.
getId
()
);
}
}
//批量保存
//批量保存
shortboardRecordMapper
.
batchSave
(
result
);
shortboardRecordMapper
.
batchSave
(
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