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
583585ef
Commit
583585ef
authored
Jun 10, 2020
by
张祺
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定义数据填报controller接口
parent
e67d06d8
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
589 additions
and
9 deletions
+589
-9
ExcelTempCtrl.java
...com/keymobile/indicators/api/hytobacco/ExcelTempCtrl.java
+85
-0
TaskCtrl.java
...java/com/keymobile/indicators/api/hytobacco/TaskCtrl.java
+59
-0
TaskRuleCtrl.java
.../com/keymobile/indicators/api/hytobacco/TaskRuleCtrl.java
+57
-0
ConfigInfoCtrl.java
...m/keymobile/indicators/api/indicators/ConfigInfoCtrl.java
+1
-1
BaseModel.java
...java/com/keymobile/indicators/model/entity/BaseModel.java
+2
-2
ExcelTemplate.java
...bile/indicators/model/entity/dataenter/ExcelTemplate.java
+14
-2
TaskAssginParam.java
...le/indicators/model/entity/dataenter/TaskAssginParam.java
+30
-0
TaskRule.java
...keymobile/indicators/model/entity/dataenter/TaskRule.java
+2
-0
TaskRuleMapper.java
...le/indicators/model/mapper/indicators/TaskRuleMapper.java
+24
-0
ExcelTemplateService.java
...le/indicators/service/dataenter/ExcelTemplateService.java
+53
-0
TaskRuleService.java
...ymobile/indicators/service/dataenter/TaskRuleService.java
+10
-3
TaskService.java
...m/keymobile/indicators/service/dataenter/TaskService.java
+35
-1
ExcelTemplateServiceImpl.java
...tors/service/dataenter/impl/ExcelTemplateServiceImpl.java
+46
-0
TaskRuleServiceImpl.java
...ndicators/service/dataenter/impl/TaskRuleServiceImpl.java
+71
-0
TaskServiceImpl.java
...le/indicators/service/dataenter/impl/TaskServiceImpl.java
+62
-0
TaskRuleIndicatorMapper.xml
...ain/resources/mybatis/mapping/TaskRuleIndicatorMapper.xml
+1
-0
TaskRuleMapper.xml
src/main/resources/mybatis/mapping/TaskRuleMapper.xml
+37
-0
No files found.
src/main/java/com/keymobile/indicators/api/hytobacco/ExcelTempCtrl.java
0 → 100644
View file @
583585ef
package
com
.
keymobile
.
indicators
.
api
.
hytobacco
;
import
com.google.gson.Gson
;
import
com.keymobile.indicators.model.entity.dataenter.ExcelTemplate
;
import
com.keymobile.indicators.result.Result
;
import
com.keymobile.indicators.service.dataenter.ExcelTemplateService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.net.URLEncoder
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Api
(
tags
={
"填报excel模板"
})
@RestController
@RequestMapping
(
value
=
"/excel"
)
public
class
ExcelTempCtrl
{
@Autowired
private
ExcelTemplateService
excelTemplateService
;
@ApiOperation
(
"根据规则id任务id获取excel模板"
)
@GetMapping
(
"findByTaskRule"
)
public
List
<
ExcelTemplate
>
findByTaskRule
(
@ApiParam
(
name
=
"ruleId"
,
required
=
false
)
@RequestParam
(
"ruleId"
)
Integer
ruleId
,
@ApiParam
(
name
=
"taskId"
,
required
=
false
)
@RequestParam
(
"taskId"
)
String
taskId
)
{
return
null
;
}
@ApiOperation
(
"根据任务id获取excel模板"
)
@GetMapping
(
"findByTaskId"
)
public
ExcelTemplate
findByTaskId
(
@ApiParam
(
name
=
"taskId"
)
@RequestParam
(
"taskId"
)
String
taskId
)
{
return
null
;
}
@ApiOperation
(
"保存excel模板"
)
@PostMapping
(
"save"
)
public
Result
save
(
@RequestBody
ExcelTemplate
template
)
{
if
(
template
.
getId
()
==
null
)
{
excelTemplateService
.
create
(
template
);
}
else
{
excelTemplateService
.
update
(
template
);
}
return
Result
.
genOkResult
();
}
@ApiOperation
(
"根据id获取excel模板"
)
@GetMapping
(
"getById"
)
public
ExcelTemplate
getById
(
@RequestParam
(
"id"
)
Integer
id
)
{
return
null
;
}
@ApiOperation
(
"id删除excel模板"
)
@GetMapping
(
"deleteById"
)
public
Result
deleteById
(
@RequestParam
(
"id"
)
Integer
id
)
{
return
null
;
}
@ApiOperation
(
"根据id导出excel"
)
@GetMapping
(
"exportToExcel"
)
public
void
exportExcelTemplate
(
@RequestParam
(
"id"
)
Integer
id
,
HttpServletResponse
response
)
throws
IOException
{
try
{
response
.
setContentType
(
"application/vnd.ms-excel"
);
response
.
setCharacterEncoding
(
"utf-8"
);
String
fileName
=
URLEncoder
.
encode
(
""
,
"UTF-8"
);
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename="
+
fileName
+
".xlsx"
);
}
catch
(
Exception
e
)
{
response
.
reset
();
response
.
setContentType
(
"application/json"
);
response
.
setCharacterEncoding
(
"utf-8"
);
Map
<
String
,
String
>
map
=
new
HashMap
<>(
4
);
map
.
put
(
"status"
,
"failure"
);
map
.
put
(
"message"
,
"导出模板失败"
+
e
.
getMessage
());
Gson
gson
=
new
Gson
();
response
.
getWriter
().
write
(
gson
.
toJson
(
map
));
}
}
}
src/main/java/com/keymobile/indicators/api/hytobacco/TaskCtrl.java
0 → 100644
View file @
583585ef
package
com
.
keymobile
.
indicators
.
api
.
hytobacco
;
import
com.keymobile.indicators.model.entity.dataenter.Task
;
import
com.keymobile.indicators.model.entity.dataenter.TaskAssginParam
;
import
com.keymobile.indicators.result.Result
;
import
com.keymobile.indicators.service.dataenter.TaskRuleService
;
import
com.keymobile.indicators.service.dataenter.TaskService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.web.bind.annotation.*
;
@Api
(
tags
={
"填报任务相关接口"
})
@RestController
@RequestMapping
(
value
=
"/task"
)
public
class
TaskCtrl
{
@Autowired
private
TaskRuleService
taskRuleService
;
@Autowired
private
TaskService
taskService
;
@ApiOperation
(
"根据规则生成相关填报任务"
)
@GetMapping
(
"generateTaskByRule"
)
public
Result
generateTaskByRule
(
@ApiParam
(
"规则id"
)
@RequestParam
Integer
ruleId
)
{
Result
result
=
null
;
return
result
;
}
@ApiOperation
(
"根据关键字、规则类型、用户获取相关的填报任务"
)
@GetMapping
(
"findByPage"
)
public
Page
<
Task
>
findByPage
(
@ApiParam
(
name
=
"规则类型:1 省级 2 市级 3 县级"
)
@RequestParam
(
defaultValue
=
"1"
)
int
ruleType
,
@ApiParam
(
name
=
"所属用户id"
)
@RequestParam
String
userId
,
@ApiParam
(
name
=
"搜索关键字(名字)"
)
@RequestParam
(
required
=
false
)
String
keyword
,
@ApiParam
(
name
=
"页码,从1开始"
)
@RequestParam
(
defaultValue
=
"0"
)
int
page
,
@ApiParam
(
name
=
"每页条数"
)
@RequestParam
(
defaultValue
=
"10"
)
int
pageSize
)
{
taskRuleService
.
findRuleByPage
(
ruleType
,
keyword
,
pageSize
,
page
);
return
null
;
}
@ApiOperation
(
"根据id获取填报任务"
)
@GetMapping
(
"getById"
)
public
Task
getById
(
@ApiParam
(
name
=
"任务id"
)
@RequestParam
String
id
)
{
return
taskService
.
getById
(
id
);
}
@ApiOperation
(
"分发任务"
)
@PostMapping
(
"assign"
)
public
Result
assign
(
@RequestBody
TaskAssginParam
param
)
{
return
null
;
}
}
src/main/java/com/keymobile/indicators/api/hytobacco/TaskRuleCtrl.java
0 → 100644
View file @
583585ef
package
com
.
keymobile
.
indicators
.
api
.
hytobacco
;
import
com.keymobile.indicators.model.entity.dataenter.TaskRule
;
import
com.keymobile.indicators.result.Result
;
import
com.keymobile.indicators.service.dataenter.TaskRuleService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.web.bind.annotation.*
;
@Api
(
tags
={
"填报任务规则管理接口"
})
@RestController
@RequestMapping
(
value
=
"/taskRule"
)
public
class
TaskRuleCtrl
{
@Autowired
private
TaskRuleService
taskRuleService
;
@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
)
{
return
taskRuleService
.
findRuleByPage
(
ruleType
,
keyword
,
page
,
pageSize
);
}
@ApiOperation
(
"根据id获取任务规则"
)
@GetMapping
(
"getById"
)
public
TaskRule
getById
(
@ApiParam
(
name
=
"id"
)
@RequestParam
(
"id"
)
Integer
id
)
{
return
taskRuleService
.
getById
(
id
);
}
@ApiOperation
(
"根据id删除任务规则"
)
@GetMapping
(
"deleteById"
)
public
Result
deleteById
(
@ApiParam
(
name
=
"id"
)
@RequestParam
(
"id"
)
Integer
id
)
{
taskRuleService
.
delete
(
id
);
return
Result
.
genOkResult
();
}
@ApiOperation
(
"保存任务规则"
)
@PostMapping
(
"save"
)
public
Result
save
(
@RequestBody
TaskRule
rule
)
{
Result
result
=
null
;
if
(
rule
.
getId
()
==
null
||
rule
.
getId
()
==
0
)
{
taskRuleService
.
createRule
(
rule
);
}
else
{
taskRuleService
.
updateRule
(
rule
);
}
result
=
Result
.
genOkResult
();
return
result
;
}
}
src/main/java/com/keymobile/indicators/api/indicators/ConfigInfoCtrl.java
View file @
583585ef
...
...
@@ -36,7 +36,7 @@ public class ConfigInfoCtrl {
configInfo
.
setCreator
(
userId
);
configInfo
.
setCreateTime
(
now
);
configInfo
.
setUpdateTime
(
now
);
configInfo
.
set
Data
State
(
Constants
.
DATA_STATE_A
);
configInfo
.
setState
(
Constants
.
DATA_STATE_A
);
return
configInfoService
.
createConfigInfo
(
configInfo
);
}
...
...
src/main/java/com/keymobile/indicators/model/entity/BaseModel.java
View file @
583585ef
...
...
@@ -15,8 +15,8 @@ public abstract class BaseModel {
/**
* 数据状态
*/
@Field
(
"
data_
state"
)
private
Integer
dataS
tate
;
@Field
(
"state"
)
private
Integer
s
tate
;
/**
* 创建者
...
...
src/main/java/com/keymobile/indicators/model/entity/dataenter/ExcelTemplate.java
View file @
583585ef
package
com
.
keymobile
.
indicators
.
model
.
entity
.
dataenter
;
import
com.keymobile.indicators.model.entity.BaseModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.
Id
;
import
java
x.persistence.Table
;
import
javax.persistence.
*
;
import
java
.util.List
;
@Data
@Table
(
name
=
"data_enter_excel_temp"
)
public
class
ExcelTemplate
extends
BaseModel
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
/**
* 模板名字
*/
@ApiModelProperty
(
"模板名字"
)
private
String
name
;
/**
...
...
@@ -31,5 +34,14 @@ public class ExcelTemplate extends BaseModel {
/**
* 所属任务id
*/
@ApiModelProperty
(
"所属任务id"
)
private
String
taskId
;
@ApiModelProperty
(
"数据项列表"
)
@Transient
private
List
<
ExcelIndicator
>
inds
;
@ApiModelProperty
(
"考核对象列表"
)
@Transient
private
List
<
ExcelObj
>
objs
;
}
src/main/java/com/keymobile/indicators/model/entity/dataenter/TaskAssginParam.java
0 → 100644
View file @
583585ef
package
com
.
keymobile
.
indicators
.
model
.
entity
.
dataenter
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
@Data
@ApiModel
(
"任务下发、分发参数"
)
public
class
TaskAssginParam
{
@ApiModelProperty
(
"分发的当前任务id"
)
private
String
taskId
;
@ApiModelProperty
(
"分发后自己是否也需要填写"
)
private
Boolean
needSelfEnter
;
@ApiModelProperty
(
"分发填报后是否需要做汇总上报"
)
private
Boolean
needSum
;
@ApiModelProperty
(
"选择需要分发的指标"
)
private
List
<
String
>
indIds
;
@ApiModelProperty
(
"把任务分发给对象id"
)
private
List
<
String
>
objIds
;
@ApiModelProperty
(
"分发对象类型: 1 组织机构 2 人员"
)
private
int
objType
=
1
;
}
src/main/java/com/keymobile/indicators/model/entity/dataenter/TaskRule.java
View file @
583585ef
...
...
@@ -21,6 +21,8 @@ public class TaskRule extends BaseModel {
private
String
name
;
private
String
description
;
/**
* 任务规则所属类型:1、省 2、市 3、县
*/
...
...
src/main/java/com/keymobile/indicators/model/mapper/indicators/TaskRuleMapper.java
View file @
583585ef
...
...
@@ -2,14 +2,38 @@ package com.keymobile.indicators.model.mapper.indicators;
import
com.keymobile.indicators.model.entity.dataenter.TaskRule
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.BaseMapper
;
import
java.util.List
;
@Mapper
public
interface
TaskRuleMapper
extends
BaseMapper
<
TaskRule
>
{
void
createTaskRule
(
TaskRule
rule
);
/**
* 逻辑删除任务规则
* @param id
*/
void
deleteById
(
Integer
id
);
/**
* 分页查询填报任务规则
* @param ruleType
* @param keyword
* @param start
* @param pageSize
* @return
*/
List
<
TaskRule
>
findRuleByPage
(
@Param
(
"ruleType"
)
Integer
ruleType
,
@Param
(
"keyword"
)
String
keyword
,
@Param
(
"start"
)
long
start
,
@Param
(
"pageSize"
)
int
pageSize
);
/**
* 查询填报任务规则总数
* @param ruleType
* @param keyword
* @return
*/
long
findRuleCount
(
@Param
(
"ruleType"
)
Integer
ruleType
,
@Param
(
"keyword"
)
String
keyword
);
}
src/main/java/com/keymobile/indicators/service/dataenter/ExcelTemplateService.java
0 → 100644
View file @
583585ef
package
com
.
keymobile
.
indicators
.
service
.
dataenter
;
import
com.keymobile.indicators.model.entity.dataenter.ExcelTemplate
;
import
java.util.List
;
/**
* excel模板服务
*/
public
interface
ExcelTemplateService
{
/**
* 创建
* @param template
* @return
*/
int
create
(
ExcelTemplate
template
);
/**
* 根据id获取
* @param id
* @return
*/
ExcelTemplate
getById
(
Integer
id
);
/**
* 根据taskId获取
* @param taskId
* @return
*/
ExcelTemplate
getByTaskId
(
String
taskId
);
/**
* 根据规则id、任务id获取模板列表
* @param ruleId
* @param taskId
* @return
*/
List
<
ExcelTemplate
>
findByRuleTask
(
Integer
ruleId
,
String
taskId
);
/**
* 更新
* @param template
*/
void
update
(
ExcelTemplate
template
);
/**
* 删除
* @param id
*/
void
delete
(
Integer
id
);
}
src/main/java/com/keymobile/indicators/service/dataenter/TaskRuleService.java
View file @
583585ef
...
...
@@ -26,7 +26,7 @@ public interface TaskRuleService {
* @param rule
* @return
*/
TaskRule
createRule
(
TaskRule
rule
);
void
createRule
(
TaskRule
rule
);
/**
* 更新规则
...
...
@@ -38,9 +38,16 @@ public interface TaskRuleService {
* 根据规则类型、关键字分页查找规则
* @param ruleType
* @param keyword
* @param page
* @param pageSize
* @param start
* @return
*/
Page
<
TaskRule
>
findRuleByPage
(
Integer
ruleType
,
String
keyword
,
int
pageSize
,
int
start
);
Page
<
TaskRule
>
findRuleByPage
(
Integer
ruleType
,
String
keyword
,
int
page
,
int
pageSize
);
/**
* 根据规则生成填报任务
* @param ruleId
* @param valueTime
*/
void
createTaskByRule
(
Integer
ruleId
,
String
valueTime
);
}
src/main/java/com/keymobile/indicators/service/dataenter/TaskService.java
View file @
583585ef
...
...
@@ -3,9 +3,27 @@ package com.keymobile.indicators.service.dataenter;
import
com.keymobile.indicators.model.entity.dataenter.Task
;
import
org.springframework.data.domain.Page
;
import
java.util.List
;
/**
* 任务相关服务接口
*/
public
interface
TaskService
{
/**
* 创建任务
* @param task
* @return
*/
Task
createTask
(
Task
task
);
/**
* 更新任务
* @param task
*/
void
updateTask
(
Task
task
);
/**
* 根据id删除任务
* @param taskId
*/
...
...
@@ -27,14 +45,30 @@ public interface TaskService {
void
deleteByRuleId
(
Integer
ruleId
,
String
valueTime
);
/**
* 根据规则id和取数时间获取所有的任务
* @param ruleId
* @param valueTime
* @param includeChildren 是否包含子任务
*/
List
<
Task
>
findByRuleAndValueTime
(
Integer
ruleId
,
String
valueTime
,
boolean
includeChildren
);
/**
* 根据父任务id获取子任务
* @param parentId
*/
List
<
Task
>
getChildren
(
String
parentId
);
/**
* 根据用户id 和 任务规则关键字分页获取任务
* @param userId
* @param keyword
* @param valueTime
* @param status
* @param pageSize
* @param start
* @return
*/
Page
<
Task
>
findUserTask
(
String
userId
,
String
keyword
,
int
pageSize
,
int
start
);
Page
<
Task
>
findUserTask
(
String
userId
,
String
keyword
,
String
valueTime
,
Integer
status
,
int
pageSize
,
int
start
);
...
...
src/main/java/com/keymobile/indicators/service/dataenter/impl/ExcelTemplateServiceImpl.java
0 → 100644
View file @
583585ef
package
com
.
keymobile
.
indicators
.
service
.
dataenter
.
impl
;
import
com.keymobile.indicators.model.entity.dataenter.ExcelTemplate
;
import
com.keymobile.indicators.model.mapper.indicators.ExcelTemplateMapper
;
import
com.keymobile.indicators.service.dataenter.ExcelTemplateService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Service
public
class
ExcelTemplateServiceImpl
implements
ExcelTemplateService
{
@Autowired
private
ExcelTemplateMapper
excelTemplateMapper
;
@Override
public
int
create
(
ExcelTemplate
template
)
{
return
excelTemplateMapper
.
insert
(
template
);
}
@Override
public
ExcelTemplate
getById
(
Integer
id
)
{
return
excelTemplateMapper
.
selectByPrimaryKey
(
id
);
}
@Override
public
ExcelTemplate
getByTaskId
(
String
taskId
)
{
return
null
;
}
@Override
public
List
<
ExcelTemplate
>
findByRuleTask
(
Integer
ruleId
,
String
taskId
)
{
return
null
;
}
@Override
public
void
update
(
ExcelTemplate
template
)
{
}
@Override
public
void
delete
(
Integer
id
)
{
}
}
src/main/java/com/keymobile/indicators/service/dataenter/impl/TaskRuleServiceImpl.java
0 → 100644
View file @
583585ef
package
com
.
keymobile
.
indicators
.
service
.
dataenter
.
impl
;
import
com.keymobile.indicators.model.entity.dataenter.TaskRule
;
import
com.keymobile.indicators.model.mapper.indicators.TaskRuleIndicatorMapper
;
import
com.keymobile.indicators.model.mapper.indicators.TaskRuleMapper
;
import
com.keymobile.indicators.service.dataenter.TaskRuleService
;
import
com.keymobile.indicators.service.dataenter.TaskService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
public
class
TaskRuleServiceImpl
implements
TaskRuleService
{
@Autowired
private
TaskRuleMapper
taskRuleMapper
;
@Autowired
private
TaskRuleIndicatorMapper
taskRuleIndicatorMapper
;
@Autowired
private
TaskService
taskService
;
@Override
public
void
delete
(
Integer
ruleId
)
{
taskRuleMapper
.
deleteById
(
ruleId
);
}
@Override
public
TaskRule
getById
(
Integer
ruleId
)
{
return
taskRuleMapper
.
selectByPrimaryKey
(
ruleId
);
}
@Override
public
void
createRule
(
TaskRule
rule
)
{
taskRuleMapper
.
createTaskRule
(
rule
);
}
@Override
public
void
updateRule
(
TaskRule
rule
)
{
taskRuleMapper
.
updateByPrimaryKey
(
rule
);
}
@Override
public
Page
<
TaskRule
>
findRuleByPage
(
Integer
ruleType
,
String
keyword
,
int
page
,
int
pageSize
)
{
long
total
=
taskRuleMapper
.
findRuleCount
(
ruleType
,
keyword
);
PageRequest
request
=
PageRequest
.
of
(
page
-
1
,
pageSize
);
List
<
TaskRule
>
list
=
new
ArrayList
<>();
if
(
total
>
0
)
{
list
=
taskRuleMapper
.
findRuleByPage
(
ruleType
,
keyword
,
request
.
getOffset
(),
pageSize
);
}
Page
<
TaskRule
>
pageResult
=
new
PageImpl
<
TaskRule
>(
list
,
request
,
total
);
return
pageResult
;
}
@Override
@Transactional
public
void
createTaskByRule
(
Integer
ruleId
,
String
valueTime
)
{
// 先删除已有的任务
taskService
.
deleteByRuleId
(
ruleId
,
valueTime
);
}
}
src/main/java/com/keymobile/indicators/service/dataenter/impl/TaskServiceImpl.java
0 → 100644
View file @
583585ef
package
com
.
keymobile
.
indicators
.
service
.
dataenter
.
impl
;
import
com.keymobile.indicators.model.entity.dataenter.Task
;
import
com.keymobile.indicators.model.mapper.indicators.TaskIndicatorMapper
;
import
com.keymobile.indicators.model.mapper.indicators.TaskMapper
;
import
com.keymobile.indicators.model.mapper.indicators.TaskRuleIndicatorMapper
;
import
com.keymobile.indicators.service.dataenter.TaskService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Service
public
class
TaskServiceImpl
implements
TaskService
{
@Autowired
private
TaskMapper
taskMapper
;
@Autowired
private
TaskIndicatorMapper
taskIndicatorMapper
;
@Override
public
Task
createTask
(
Task
task
)
{
return
null
;
}
@Override
public
void
updateTask
(
Task
task
)
{
}
@Override
public
void
delete
(
String
taskId
)
{
}
@Override
public
Task
getById
(
String
taskId
)
{
return
null
;
}
@Override
public
void
deleteByRuleId
(
Integer
ruleId
,
String
valueTime
)
{
}
@Override
public
List
<
Task
>
findByRuleAndValueTime
(
Integer
ruleId
,
String
valueTime
,
boolean
includeChildren
)
{
return
null
;
}
@Override
public
List
<
Task
>
getChildren
(
String
parentId
)
{
return
null
;
}
@Override
public
Page
<
Task
>
findUserTask
(
String
userId
,
String
keyword
,
String
valueTime
,
Integer
status
,
int
pageSize
,
int
start
)
{
return
null
;
}
}
src/main/resources/mybatis/mapping/TaskRuleIndicatorMapper.xml
View file @
583585ef
...
...
@@ -3,6 +3,7 @@
<mapper
namespace=
"com.keymobile.indicators.model.mapper.indicators.TaskRuleIndicatorMapper"
>
<select
id=
"getByRuleId"
parameterType=
"java.lang.Integer"
resultType=
"com.keymobile.indicators.model.entity.dataenter.TaskRuleIndicator"
>
select *
from data_enter_rule_ind
...
...
src/main/resources/mybatis/mapping/TaskRuleMapper.xml
View file @
583585ef
...
...
@@ -2,9 +2,45 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.keymobile.indicators.model.mapper.indicators.TaskRuleMapper"
>
<insert
id=
"createTaskRule"
useGeneratedKeys=
"true"
keyProperty=
"id"
parameterType=
"com.keymobile.indicators.model.entity.dataenter.TaskRule"
>
insert into data_enter_task_rule (id,name,description,rule_type,active_type,
sch_id,cron_exp,exp_type,time_limit,to_role_ids,last_active_time,
state,creator,updater,create_time,update_time)
values (#{id}, #{name},#{description}, #{ruleType}, #{activeType},
#{schId},#{cronExp}, #{expType}, #{timeLimit}, #{toRoleIds}, #{lastActiveTime},
#{state}, #{creator}, #{updater}, #{createTime}, #{updateTime}
)
</insert>
<delete
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
update data_enter_task_rule
set state = 3
where id = #{id}
</delete>
<select
id=
"findRuleByPage"
resultType=
"com.keymobile.indicators.model.entity.dataenter.TaskRule"
>
select *
from data_enter_task_rule
where state = 1
<if
test=
"ruleType != null"
>
and rule_type = #{ruleType}
</if>
<if
test=
"keyword != null and keyword != ''"
>
and name name like concat('%', keyword, '%')
</if>
order by update_time desc, name asc
limit #{start}, #{pageSize}
</select>
<select
id=
"findRuleCount"
resultType=
"long"
>
select count(id)
from data_enter_task_rule
where state = 1
<if
test=
"ruleType != null"
>
and rule_type = #{ruleType}
</if>
<if
test=
"keyword != null and keyword != ''"
>
and name name like concat('%', keyword, '%')
</if>
</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