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
323bf45b
Commit
323bf45b
authored
Jul 08, 2020
by
张祺
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改任务规则相关功能
parent
b6e1badb
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
349 additions
and
27 deletions
+349
-27
RuleObjCtrl.java
...a/com/keymobile/indicators/api/hytobacco/RuleObjCtrl.java
+20
-0
TaskCtrl.java
...java/com/keymobile/indicators/api/hytobacco/TaskCtrl.java
+77
-9
TaskRuleCtrl.java
.../com/keymobile/indicators/api/hytobacco/TaskRuleCtrl.java
+52
-9
ConfigInfoCtrl.java
...m/keymobile/indicators/api/indicators/ConfigInfoCtrl.java
+5
-2
Constants.java
...ain/java/com/keymobile/indicators/constant/Constants.java
+30
-0
QueryAllTaskParam.java
.../indicators/model/entity/dataenter/QueryAllTaskParam.java
+28
-0
TaskIndicator.java
...bile/indicators/model/entity/dataenter/TaskIndicator.java
+7
-0
TaskRuleGroupObj.java
...e/indicators/model/entity/dataenter/TaskRuleGroupObj.java
+6
-0
TaskStatusCountResult.java
...icators/model/entity/dataenter/TaskStatusCountResult.java
+17
-0
ConfigInfoMapper.java
.../indicators/model/mapper/indicators/ConfigInfoMapper.java
+2
-0
TaskMapper.java
...mobile/indicators/model/mapper/indicators/TaskMapper.java
+10
-0
SystemAuthService.java
...a/com/keymobile/indicators/service/SystemAuthService.java
+9
-0
TaskService.java
...m/keymobile/indicators/service/dataenter/TaskService.java
+14
-0
TaskServiceImpl.java
...le/indicators/service/dataenter/impl/TaskServiceImpl.java
+19
-0
ConfigInfoServiceImpl.java
...mobile/indicators/service/impl/ConfigInfoServiceImpl.java
+1
-1
DateUtils.java
src/main/java/com/keymobile/indicators/utils/DateUtils.java
+14
-0
SystemUserUtil.java
...n/java/com/keymobile/indicators/utils/SystemUserUtil.java
+8
-4
ConfigInfoMapper.xml
src/main/resources/mybatis/mapping/ConfigInfoMapper.xml
+6
-1
TaskMapper.xml
src/main/resources/mybatis/mapping/TaskMapper.xml
+24
-1
No files found.
src/main/java/com/keymobile/indicators/api/hytobacco/RuleObjCtrl.java
0 → 100644
View file @
323bf45b
package
com
.
keymobile
.
indicators
.
api
.
hytobacco
;
import
com.keymobile.indicators.model.entity.dataenter.TaskRuleGroupObj
;
import
com.keymobile.indicators.result.Result
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
tags
={
"数据填报-填报单位配置管理"
})
@RestController
@RequestMapping
(
value
=
"/ruleGroupObj"
)
public
class
RuleObjCtrl
{
public
Result
save
(
TaskRuleGroupObj
taskRuleGroupObj
)
{
return
Result
.
genOkResult
();
}
}
src/main/java/com/keymobile/indicators/api/hytobacco/TaskCtrl.java
View file @
323bf45b
package
com
.
keymobile
.
indicators
.
api
.
hytobacco
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.base.Function
;
import
com.google.common.collect.ImmutableListMultimap
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Multimaps
;
import
com.keymobile.indicators.constant.Constants
;
import
com.keymobile.indicators.model.entity.RoleRefUserModel
;
import
com.keymobile.indicators.model.entity.dataenter.*
;
...
...
@@ -10,6 +14,7 @@ import com.keymobile.indicators.service.SystemAuthService;
import
com.keymobile.indicators.service.dataenter.TaskRuleService
;
import
com.keymobile.indicators.service.dataenter.TaskService
;
import
com.keymobile.indicators.service.hytobacco.IndicatorsRelService
;
import
com.keymobile.indicators.utils.DateUtils
;
import
com.keymobile.indicators.utils.SystemUserUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -21,6 +26,7 @@ import org.springframework.data.domain.Page;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
@Api
(
tags
={
"数据填报-填报任务管理"
})
...
...
@@ -40,7 +46,7 @@ public class TaskCtrl {
@Autowired
private
IndicatorsRelService
indRelService
;
@ApiOperation
(
"根据规则生成相关填报任务"
)
@ApiOperation
(
"
(启动)
根据规则生成相关填报任务"
)
@GetMapping
(
"generateTaskByRule"
)
public
Result
generateTaskByRule
(
@ApiParam
(
"规则id"
)
@RequestParam
(
"ruleId"
)
Integer
ruleId
,
@ApiParam
(
"收数月份, 格式: 2020-03、2020-06、2020-09、2020-12"
)
@RequestParam
(
"valueTime"
)
String
valueTime
)
{
...
...
@@ -60,6 +66,12 @@ public class TaskCtrl {
RoleRefUserModel
user
=
new
RoleRefUserModel
();
user
.
setId
(
jo
.
getString
(
"id"
));
user
.
setDisName
(
jo
.
getString
(
"disname"
));
user
.
setRefIndDept
(
jo
.
getString
(
"refIndDept"
));
String
refIndDept
=
user
.
getRefIndDept
();
if
(
StringUtils
.
isBlank
(
refIndDept
))
{
continue
;
}
if
(!
users
.
contains
(
user
))
{
users
.
add
(
user
);
}
...
...
@@ -76,7 +88,56 @@ public class TaskCtrl {
getBaseIndDef
(
ruleId
,
null
,
baseIndDefs
,
taskIndicators
);
}
if
(
CollectionUtils
.
isNotEmpty
(
taskIndicators
))
{
//TODO
//数据项按归属部门分组
ImmutableListMultimap
<
String
,
TaskIndicator
>
deptMapInds
=
Multimaps
.
index
(
taskIndicators
,
(
taskIndicator
)->
taskIndicator
.
getIndDept
());
//角色关联用户按归属部门分组
ImmutableListMultimap
<
String
,
RoleRefUserModel
>
deptUsers
=
Multimaps
.
index
(
users
,
(
roleRefUser
)->
roleRefUser
.
getRefIndDept
());
//每个分组组成一个任务
Date
now
=
new
Date
();
int
addEndDate
=
rule
.
getTimeLimit
();
int
addAuditDate
=
rule
.
getAuditLimit
();
Date
editEndDate
=
DateUtils
.
addDay
(
now
,
addEndDate
);
Date
auditEndDate
=
DateUtils
.
addDay
(
now
,
addEndDate
+
addAuditDate
);
String
userId
=
SystemUserUtil
.
getCurrentUserId
();
List
<
Task
>
allTasks
=
new
ArrayList
<>();
for
(
String
dept
:
deptMapInds
.
keys
())
{
List
<
TaskIndicator
>
tis
=
deptMapInds
.
get
(
dept
);
List
<
RoleRefUserModel
>
refUsers
=
deptUsers
.
get
(
dept
);
if
(
CollectionUtils
.
isEmpty
(
refUsers
))
{
result
=
Result
.
genFailedResult
(
"该规则对应的数据项所属部门{"
+
dept
+
"}找不到对应的用户"
);
break
;
}
else
{
Task
task
=
new
Task
();
task
.
setValueTime
(
valueTime
);
task
.
setStatus
(
Constants
.
APPLY_STATE_DRAFT
);
task
.
setIndicators
(
tis
);
task
.
setCreateTime
(
now
);
task
.
setCreator
(
userId
);
task
.
setUpdateTime
(
now
);
task
.
setUpdater
(
userId
);
task
.
setNeedSelfEnter
(
false
);
task
.
setNeedSum
(
false
);
task
.
setEndDate
(
editEndDate
);
task
.
setAuditEndDate
(
auditEndDate
);
task
.
setRuleName
(
rule
.
getName
());
task
.
setRuleType
(
rule
.
getRuleType
());
task
.
setDescription
(
rule
.
getDescription
());
task
.
setRuleId
(
rule
.
getId
());
StringBuilder
userNames
=
new
StringBuilder
(
Constants
.
SEP_COMMA
);
StringBuilder
userIds
=
new
StringBuilder
(
Constants
.
SEP_COMMA
);
for
(
RoleRefUserModel
um
:
refUsers
)
{
userNames
.
append
(
um
.
getDisName
());
userNames
.
append
(
Constants
.
SEP_COMMA
);
userIds
.
append
(
um
.
getId
());
userIds
.
append
(
Constants
.
SEP_COMMA
);
}
task
.
setEnterUsers
(
userIds
.
toString
());
task
.
setEnterUserNames
(
userNames
.
toString
());
}
taskService
.
createTaskByRule
(
allTasks
,
valueTime
,
ruleId
);
}
}
else
{
result
=
Result
.
genFailedResult
(
"规则配置的指标没有可用的数据项"
);
}
...
...
@@ -112,6 +173,7 @@ public class TaskCtrl {
taskIndicator
.
setIndSource
(
baseIndDef
.
getIndSource
());
taskIndicator
.
setIndUnit
(
baseIndDef
.
getIndUnit
());
taskIndicator
.
setIndId
(
baseIndDef
.
getIndId
());
taskIndicator
.
setIndDept
(
baseIndDef
.
getIndDept
());
if
(!
taskIndicators
.
contains
(
taskIndicator
))
{
taskIndicators
.
add
(
taskIndicator
);
}
else
{
...
...
@@ -132,13 +194,19 @@ public class TaskCtrl {
@ApiOperation
(
"根据关键字、规则类型、用户获取相关的填报任务"
)
@PostMapping
(
"findByPage"
)
public
Page
<
Task
>
findByPage
(
@RequestBody
QueryTaskParam
param
)
{
param
.
setUserId
(
SystemUserUtil
.
getCurrentUserId
());
return
taskService
.
findTask
(
param
);
}
@ApiOperation
(
"获取我的任务"
)
@PostMapping
(
"findMyTask"
)
public
List
<
Task
>
findMyTask
(
@RequestBody
QueryAllTaskParam
param
)
{
param
.
setUserId
(
SystemUserUtil
.
getCurrentUserId
());
return
taskService
.
findAllTask
(
param
);
}
@ApiOperation
(
"根据id获取填报任务"
)
@GetMapping
(
"getById"
)
public
Task
getById
(
@ApiParam
(
name
=
"任务id"
)
@RequestParam
String
id
)
{
public
Task
getById
(
@ApiParam
(
"任务id"
)
@RequestParam
String
id
)
{
return
taskService
.
getById
(
id
,
true
,
true
);
}
...
...
@@ -152,27 +220,27 @@ public class TaskCtrl {
@ApiOperation
(
"提交任务去审核"
)
@GetMapping
(
"toSubmit"
)
public
Result
toSubmit
(
@ApiParam
(
name
=
"任务id"
)
@RequestParam
(
"taskId"
)
String
id
)
{
public
Result
toSubmit
(
@ApiParam
(
"任务id"
)
@RequestParam
(
"taskId"
)
String
id
)
{
taskService
.
submitTask
(
id
,
SystemUserUtil
.
getCurrentUserId
());
return
Result
.
genOkResult
();
}
@ApiOperation
(
"审核任务"
)
@PostMapping
(
"audit"
)
public
Result
audit
(
@ApiParam
(
name
=
"审核信息"
)
@RequestBody
TaskAuditResult
param
)
{
public
Result
audit
(
@ApiParam
(
"审核信息"
)
@RequestBody
TaskAuditResult
param
)
{
taskService
.
auditTask
(
param
,
SystemUserUtil
.
getCurrentUserId
());
return
Result
.
genOkResult
();
}
@ApiOperation
(
"根据任务id获取审批记录"
)
@GetMapping
(
"findAuditRecord"
)
public
List
<
AuditRecord
>
findAuditRecord
(
@ApiParam
(
name
=
"任务id"
)
@RequestParam
(
"taskId"
)
String
id
)
{
public
List
<
AuditRecord
>
findAuditRecord
(
@ApiParam
(
"任务id"
)
@RequestParam
(
"taskId"
)
String
id
)
{
return
taskService
.
findAuditRecordByTaskId
(
id
);
}
@ApiOperation
(
"任务总体分析"
)
@
Ge
tMapping
(
"analysis"
)
public
TaskAnalysisResult
analysis
()
{
@
Pos
tMapping
(
"analysis"
)
public
TaskAnalysisResult
analysis
(
@RequestBody
QueryTaskParam
param
)
{
TaskAnalysisResult
result
=
new
TaskAnalysisResult
();
return
result
;
}
...
...
src/main/java/com/keymobile/indicators/api/hytobacco/TaskRuleCtrl.java
View file @
323bf45b
package
com
.
keymobile
.
indicators
.
api
.
hytobacco
;
import
com.alibaba.fastjson.JSONObject
;
import
com.keymobile.indicators.constant.Constants
;
import
com.keymobile.indicators.model.entity.ConfigInfo
;
import
com.keymobile.indicators.model.entity.RoleModel
;
import
com.keymobile.indicators.model.entity.dataenter.TaskRule
;
import
com.keymobile.indicators.model.entity.dataenter.TaskRuleGroupObj
;
import
com.keymobile.indicators.result.Result
;
import
com.keymobile.indicators.service.ConfigInfoService
;
import
com.keymobile.indicators.service.SystemAuthService
;
import
com.keymobile.indicators.service.dataenter.TaskRuleService
;
import
com.keymobile.indicators.utils.LogManager
;
import
com.keymobile.indicators.utils.SystemUserUtil
;
...
...
@@ -12,10 +16,13 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -28,24 +35,32 @@ public class TaskRuleCtrl {
@Autowired
private
TaskRuleService
taskRuleService
;
@Autowired
private
ConfigInfoService
configInfoService
;
@Autowired
private
SystemAuthService
systemAuthService
;
@ApiOperation
(
"根据规则类型和关键字分页查找任务规则"
)
@GetMapping
(
"findByPage"
)
public
Page
<
TaskRule
>
findByPage
(
@ApiParam
(
name
=
"规则类型:1 省级 2 市级 3 县级"
)
@RequestParam
(
defaultValue
=
"1"
)
int
ruleType
,
@ApiParam
(
name
=
"搜索关键字(名字)"
)
@RequestParam
(
required
=
false
)
String
keyword
,
@ApiParam
(
name
=
"页码,从1开始"
)
@RequestParam
(
defaultValue
=
"0"
)
int
page
,
@ApiParam
(
name
=
"每页条数"
)
@RequestParam
(
defaultValue
=
"10"
)
int
pageSize
)
{
public
Page
<
TaskRule
>
findByPage
(
@ApiParam
(
"规则类型:1 省级 2 市级 3 县级"
)
@RequestParam
(
value
=
"ruleType"
,
defaultValue
=
"1"
)
int
ruleType
,
@ApiParam
(
"搜索关键字(名字)"
)
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
@ApiParam
(
"页码,从1开始"
)
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@ApiParam
(
"每页条数"
)
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
int
pageSize
)
{
return
taskRuleService
.
findRuleByPage
(
ruleType
,
keyword
,
page
,
pageSize
);
}
@ApiOperation
(
"根据id获取任务规则"
)
@GetMapping
(
"getById"
)
public
TaskRule
getById
(
@ApiParam
(
name
=
"id"
)
@RequestParam
(
"id"
)
Integer
id
)
{
public
TaskRule
getById
(
@ApiParam
(
"id"
)
@RequestParam
(
"id"
)
Integer
id
)
{
return
taskRuleService
.
getById
(
id
);
}
@ApiOperation
(
"根据id删除任务规则"
)
@GetMapping
(
"deleteById"
)
public
Result
deleteById
(
@ApiParam
(
name
=
"id"
)
@RequestParam
(
"id"
)
Integer
id
)
{
public
Result
deleteById
(
@ApiParam
(
"id"
)
@RequestParam
(
"id"
)
Integer
id
)
{
taskRuleService
.
delete
(
id
);
LogManager
.
logInfo
(
Constants
.
LOG_CONTEXT_API
,
"删除id={}的任务规则"
,
id
);
return
Result
.
genOkResult
();
...
...
@@ -85,12 +100,40 @@ public class TaskRuleCtrl {
return
taskRuleService
.
findRuleGroupObj
(
ruleType
);
}
@ApiOperation
(
"根据规则类型获取
任务单位列表
"
)
@ApiOperation
(
"根据规则类型获取
可配置的角色
"
)
@GetMapping
(
"findTaskRoles"
)
public
List
<
RoleModel
>
findTaskRoles
(
@ApiParam
(
"规则类型:1 省 2 市 3 县"
)
@RequestParam
(
value
=
"ruleType"
,
required
=
false
)
Integer
ruleType
)
{
return
null
;
List
<
RoleModel
>
result
=
new
ArrayList
<>();
ConfigInfo
configInfo
=
null
;
switch
(
ruleType
)
{
case
1
:
configInfo
=
configInfoService
.
getConfigInfoById
(
Constants
.
RULE_PROVINCE_ENTER_ROLE
);
break
;
case
2
:
configInfo
=
configInfoService
.
getConfigInfoById
(
Constants
.
RULE_CITY_ENTER_ROLE
);
break
;
case
3
:
configInfo
=
configInfoService
.
getConfigInfoById
(
Constants
.
RULE_COUNTY_ENTER_ROLE
);
break
;
default
:
break
;
}
if
(
configInfo
!=
null
)
{
String
value
=
configInfo
.
getCfValue
();
List
<
String
>
ids
=
Arrays
.
asList
(
StringUtils
.
split
(
value
,
Constants
.
SEP_COMMA
));
List
<
JSONObject
>
roles
=
systemAuthService
.
getRolesByIds
(
ids
);
for
(
JSONObject
role
:
roles
)
{
RoleModel
r
=
new
RoleModel
();
r
.
setId
(
role
.
getString
(
"id"
));
r
.
setName
(
role
.
getString
(
"disname"
));
result
.
add
(
r
);
}
}
return
result
;
}
}
src/main/java/com/keymobile/indicators/api/indicators/ConfigInfoCtrl.java
View file @
323bf45b
...
...
@@ -4,6 +4,7 @@ import com.keymobile.indicators.constant.Constants;
import
com.keymobile.indicators.model.entity.ConfigInfo
;
import
com.keymobile.indicators.result.Result
;
import
com.keymobile.indicators.service.ConfigInfoService
;
import
com.keymobile.indicators.utils.SystemUserUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
...
...
@@ -30,8 +31,9 @@ public class ConfigInfoCtrl {
*/
@PostMapping
(
"createConfigInfo"
)
@ApiOperation
(
value
=
"添加配置项信息"
,
notes
=
"添加配置项信息"
)
public
ConfigInfo
addConfigInfo
(
@RequestBody
ConfigInfo
configInfo
,
@RequestParam
(
"userId"
)
String
userId
)
{
public
ConfigInfo
addConfigInfo
(
@RequestBody
ConfigInfo
configInfo
)
{
Date
now
=
new
Date
();
String
userId
=
SystemUserUtil
.
getCurrentUserId
();
configInfo
.
setUpdater
(
userId
);
configInfo
.
setCreator
(
userId
);
configInfo
.
setCreateTime
(
now
);
...
...
@@ -47,7 +49,8 @@ public class ConfigInfoCtrl {
*/
@PostMapping
(
"updateConfigInfo"
)
@ApiOperation
(
value
=
"修改配置项信息"
,
notes
=
"修改配置项信息"
)
public
ConfigInfo
updateConfigInfo
(
@RequestBody
ConfigInfo
configInfo
,
@RequestParam
(
"userId"
)
String
userId
)
{
public
ConfigInfo
updateConfigInfo
(
@RequestBody
ConfigInfo
configInfo
)
{
String
userId
=
SystemUserUtil
.
getCurrentUserId
();
ConfigInfo
tmp
=
configInfoService
.
getConfigInfoById
(
configInfo
.
getId
());
tmp
.
setCfDesc
(
configInfo
.
getCfDesc
());
tmp
.
setCfValue
(
configInfo
.
getCfValue
());
...
...
src/main/java/com/keymobile/indicators/constant/Constants.java
View file @
323bf45b
...
...
@@ -109,5 +109,35 @@ public class Constants {
public
static
final
int
OBJ_TYPE_USER
=
2
;
/**
* 任务规则-省级填报可选角色
*/
public
static
final
String
RULE_PROVINCE_ENTER_ROLE
=
"PROVINCE_ENTER_ROLE"
;
/**
* 任务规则-省级审核角色id
*/
public
static
final
String
RULE_PROVINCE_AUDIT_ROLE
=
"PROVINCE_AUDIT_ROLE"
;
/**
* 任务规则-市填报可选角色
*/
public
static
final
String
RULE_CITY_ENTER_ROLE
=
"CITY_ENTER_ROLE"
;
/**
* 任务规则-市填审核角色id
*/
public
static
final
String
RULE_CITY_AUDIT_ROLE
=
"CITY_AUDIT_ROLE"
;
/**
* 任务规则-县级填报可选角色
*/
public
static
final
String
RULE_COUNTY_ENTER_ROLE
=
"COUNTY_ENTER_ROLE"
;
/**
* 任务规则-县级审核角色id
*/
public
static
final
String
RULE_COUNTY_AUDIT_ROLE
=
"COUNTY_AUDIT_ROLE"
;
}
src/main/java/com/keymobile/indicators/model/entity/dataenter/QueryAllTaskParam.java
0 → 100644
View file @
323bf45b
package
com
.
keymobile
.
indicators
.
model
.
entity
.
dataenter
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@ApiModel
(
"查询任务参数"
)
@Data
public
class
QueryAllTaskParam
{
@ApiModelProperty
(
name
=
"规则类型:1 省级 2 市级 3 县级"
)
private
Integer
ruleType
;
/**
* 查询类型:1 查找填报人任务 2 查找审核人任务 3 查找全部
*/
@ApiModelProperty
(
name
=
"查询类型:1 查找填报人任务 2 查找审核人任务 3 查找全部"
)
private
int
queryType
=
1
;
@ApiModelProperty
(
name
=
"搜索关键字(名字)"
)
private
String
keyword
;
@ApiModelProperty
(
name
=
"填报时间"
)
private
String
valueTime
;
@ApiModelProperty
(
name
=
"任务状态:1、填报中 2、审批中 3、审核通过 4、驳回"
)
private
Integer
status
;
@ApiModelProperty
(
"当前用户id,不用传"
)
private
String
userId
;
}
src/main/java/com/keymobile/indicators/model/entity/dataenter/TaskIndicator.java
View file @
323bf45b
...
...
@@ -5,6 +5,7 @@ import lombok.Data;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
javax.persistence.Transient
;
import
java.util.Objects
;
/**
...
...
@@ -62,6 +63,12 @@ public class TaskIndicator extends BaseModel {
*/
private
String
indFormula
;
/**
* 指标归属部门
*/
@Transient
private
String
indDept
;
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
{
...
...
src/main/java/com/keymobile/indicators/model/entity/dataenter/TaskRuleGroupObj.java
View file @
323bf45b
...
...
@@ -19,6 +19,12 @@ public class TaskRuleGroupObj extends BaseModel {
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
/**
* 任务规则所属类型:1、省 2、市 3、县
*/
@ApiModelProperty
(
"规则类型"
)
private
Integer
ruleType
;
@ApiModelProperty
(
"数据对象类型:1、组织机构 2、人员 3、岗位"
)
private
Integer
objType
;
...
...
src/main/java/com/keymobile/indicators/model/entity/dataenter/TaskStatusCountResult.java
0 → 100644
View file @
323bf45b
package
com
.
keymobile
.
indicators
.
model
.
entity
.
dataenter
;
import
lombok.Data
;
@Data
public
class
TaskStatusCountResult
{
/**
* 状态
*/
private
Integer
status
;
/**
* 总数
*/
private
Integer
count
;
}
src/main/java/com/keymobile/indicators/model/mapper/indicators/ConfigInfoMapper.java
View file @
323bf45b
...
...
@@ -28,4 +28,6 @@ public interface ConfigInfoMapper extends BaseMapper<ConfigInfo> {
* @return
*/
long
findConfigInfoCount
(
@Param
(
"keyword"
)
String
keyword
);
ConfigInfo
getById
(
@Param
(
"id"
)
String
id
);
}
src/main/java/com/keymobile/indicators/model/mapper/indicators/TaskMapper.java
View file @
323bf45b
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
indicators
;
import
com.keymobile.indicators.model.entity.dataenter.QueryAllTaskParam
;
import
com.keymobile.indicators.model.entity.dataenter.QueryTaskParam
;
import
com.keymobile.indicators.model.entity.dataenter.Task
;
import
com.keymobile.indicators.model.entity.dataenter.TaskStatusCountResult
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.BaseMapper
;
...
...
@@ -49,4 +51,12 @@ public interface TaskMapper extends BaseMapper<Task> {
*/
List
<
Task
>
findTask
(
QueryTaskParam
param
);
/**
* 查找填报任务(非翻页)
* @param param
* @return
*/
List
<
Task
>
findAllTask
(
QueryAllTaskParam
param
);
List
<
TaskStatusCountResult
>
countTask
(
QueryTaskParam
param
);
}
src/main/java/com/keymobile/indicators/service/SystemAuthService.java
View file @
323bf45b
...
...
@@ -30,4 +30,13 @@ public interface SystemAuthService {
@RequestParam
(
value
=
"orgNo"
,
required
=
false
)
String
orgNo
,
@RequestParam
(
value
=
"disname"
,
required
=
false
)
String
disname
,
@RequestParam
(
value
=
"page"
)
int
page
,
@RequestParam
(
value
=
"size"
)
int
size
);
/**
* 根据角色id列表获取角色列表
* @param roleIds
* @return
*/
@GetMapping
(
"/role/getByIds"
)
List
<
JSONObject
>
getRolesByIds
(
@RequestParam
(
"roleIds"
)
List
<
String
>
roleIds
);
}
src/main/java/com/keymobile/indicators/service/dataenter/TaskService.java
View file @
323bf45b
...
...
@@ -74,6 +74,13 @@ public interface TaskService {
*/
Page
<
Task
>
findTask
(
QueryTaskParam
param
);
/**
* 根据条件查询所有任务
* @param param
* @return
*/
List
<
Task
>
findAllTask
(
QueryAllTaskParam
param
);
/**
* 保存填报数据
...
...
@@ -126,4 +133,11 @@ public interface TaskService {
* @return
*/
List
<
AuditRecord
>
findAuditRecordByTaskId
(
String
taskId
);
/**
* 分析任务情况
* @param param
* @return
*/
TaskAnalysisResult
analysisTask
(
QueryTaskParam
param
);
}
src/main/java/com/keymobile/indicators/service/dataenter/impl/TaskServiceImpl.java
View file @
323bf45b
...
...
@@ -135,6 +135,11 @@ public class TaskServiceImpl implements TaskService {
}
@Override
public
List
<
Task
>
findAllTask
(
QueryAllTaskParam
param
)
{
return
taskMapper
.
findAllTask
(
param
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveTaskValues
(
List
<
TaskIndValue
>
values
,
String
taskId
,
Integer
indSource
)
{
taskIndValueMapper
.
deleteByTaskAndSource
(
taskId
,
indSource
);
...
...
@@ -252,4 +257,18 @@ public class TaskServiceImpl implements TaskService {
public
List
<
AuditRecord
>
findAuditRecordByTaskId
(
String
taskId
)
{
return
taskAuditRecordMapper
.
getByTaskId
(
taskId
);
}
@Override
public
TaskAnalysisResult
analysisTask
(
QueryTaskParam
param
)
{
List
<
TaskStatusCountResult
>
countResults
=
taskMapper
.
countTask
(
param
);
TaskAnalysisResult
result
=
new
TaskAnalysisResult
();
if
(
CollectionUtils
.
isNotEmpty
(
countResults
))
{
for
(
TaskStatusCountResult
countResult
:
countResults
)
{
if
(
Constants
.
APPLY_STATE_DRAFT
==
countResult
.
getStatus
())
{
result
.
setToEditCount
(
countResult
.
getCount
());
}
}
}
return
result
;
}
}
src/main/java/com/keymobile/indicators/service/impl/ConfigInfoServiceImpl.java
View file @
323bf45b
...
...
@@ -28,7 +28,7 @@ public class ConfigInfoServiceImpl implements ConfigInfoService {
public
ConfigInfo
getConfigInfoById
(
String
id
)
{
ConfigInfo
info
=
(
ConfigInfo
)
redisCacheService
.
get
(
CACHE_CONFIG_KEY_PRE
+
id
);
if
(
info
==
null
)
{
info
=
configInfoMapper
.
selectByPrimaryKey
(
id
);
info
=
configInfoMapper
.
getById
(
id
);
if
(
info
!=
null
)
{
redisCacheService
.
add
(
CACHE_CONFIG_KEY_PRE
+
id
,
info
);
}
...
...
src/main/java/com/keymobile/indicators/utils/DateUtils.java
View file @
323bf45b
package
com
.
keymobile
.
indicators
.
utils
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
...
...
@@ -32,4 +33,17 @@ public class DateUtils {
}
return
formatDate
;
}
/**
* 获取指定日期增加天数后的日期
* @param time
* @param dates
* @return
*/
public
static
Date
addDay
(
Date
time
,
int
dates
)
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTimeInMillis
(
time
.
getTime
());
c
.
add
(
Calendar
.
DATE
,
dates
);
return
c
.
getTime
();
}
}
src/main/java/com/keymobile/indicators/utils/SystemUserUtil.java
View file @
323bf45b
...
...
@@ -29,12 +29,16 @@ public class SystemUserUtil {
public
static
String
getCurrentUserId
()
{
Authentication
auth
=
SecurityContextHolder
.
getContext
().
getAuthentication
();
String
userId
=
"NO_USER"
;
if
(
auth
!=
null
)
{
if
(
auth
!=
null
)
{
Object
obj
=
auth
.
getPrincipal
();
if
(
obj
!=
null
)
{
UserDetails
userDetails
=
(
UserDetails
)
obj
;
String
userNameWithIdAttached
=
userDetails
.
getUsername
();
userId
=
userNameWithIdAttached
.
split
(
":"
)[
1
];
if
(
obj
instanceof
String
)
{
userId
=
obj
.
toString
();
}
else
{
UserDetails
userDetails
=
(
UserDetails
)
obj
;
String
userNameWithIdAttached
=
userDetails
.
getUsername
();
userId
=
userNameWithIdAttached
.
split
(
":"
)[
1
];
}
}
}
return
userId
;
...
...
src/main/resources/mybatis/mapping/ConfigInfoMapper.xml
View file @
323bf45b
...
...
@@ -20,6 +20,10 @@
and id like concat('%', #{keyword}, '%')
</if>
</select>
<select
id=
"getById"
resultType=
"com.keymobile.indicators.model.entity.ConfigInfo"
>
select *
from config_info
where id = #{id}
</select>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/TaskMapper.xml
View file @
323bf45b
...
...
@@ -29,13 +29,21 @@
<select
id=
"findTask"
parameterType=
"com.keymobile.indicators.model.entity.dataenter.QueryTaskParam"
resultType=
"com.keymobile.indicators.model.entity.dataenter.Task"
>
select
count(1)
select
*
from data_enter_task
<include
refid=
"findTaskWhereSql"
></include>
order by status asc, value_time desc
limit #{start}, #{pageSize}
</select>
<select
id=
"findAllTask"
parameterType=
"com.keymobile.indicators.model.entity.dataenter.QueryAllTaskParam"
resultType=
"com.keymobile.indicators.model.entity.dataenter.Task"
>
select *
from data_enter_task
<include
refid=
"findTaskWhereSql"
></include>
order by status asc, value_time desc
</select>
<sql
id=
"findTaskWhereSql"
>
where state = 1
<if
test=
"ruleType != null"
>
...
...
@@ -73,4 +81,18 @@
set state = 3
where rule_id = #{ruleId} and value_time = #{valueTime
</update>
<resultMap
type=
"com.keymobile.indicators.model.entity.dataenter.TaskStatusCountResult"
id=
"taskStatusCountResult"
>
<result
property=
"status"
column=
"status"
javaType=
"INTEGER"
jdbcType=
"INTEGER"
/>
<result
property=
"count"
column=
"cf_value"
javaType=
"INTEGER"
jdbcType=
"INTEGER"
/>
</resultMap>
<select
id=
"countTask"
parameterType=
"com.keymobile.indicators.model.entity.dataenter.QueryAllTaskParam"
resultMap=
"taskStatusCountResult"
>
select count(id) as count,
status,
from data_enter_task
<include
refid=
"findTaskWhereSql"
></include>
group by status
</select>
</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