Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
datacollector
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
chenweisong
datacollector
Commits
c8c89bc8
Commit
c8c89bc8
authored
Mar 07, 2020
by
chenweisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
3f59594c
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
218 additions
and
169 deletions
+218
-169
ApiResponse.java
...main/java/com/keymobile/rest/common/bean/ApiResponse.java
+36
-0
Swagger2Config.java
...n/java/com/keymobile/rest/common/conf/Swagger2Config.java
+1
-1
ApiConstant.java
.../java/com/keymobile/rest/common/constant/ApiConstant.java
+18
-0
IndexCtrl.java
src/main/java/com/keymobile/rest/ctrl/IndexCtrl.java
+47
-85
JobDao.java
src/main/java/com/keymobile/rest/dao/JobDao.java
+4
-4
Excel.java
src/main/java/com/keymobile/rest/model/Excel.java
+1
-1
Job.java
src/main/java/com/keymobile/rest/model/Job.java
+2
-1
User.java
src/main/java/com/keymobile/rest/model/User.java
+0
-1
ExcelService.java
src/main/java/com/keymobile/rest/service/ExcelService.java
+6
-9
JobService.java
src/main/java/com/keymobile/rest/service/JobService.java
+33
-18
RecordDataService.java
...in/java/com/keymobile/rest/service/RecordDataService.java
+7
-5
RecordInfoService.java
...in/java/com/keymobile/rest/service/RecordInfoService.java
+14
-4
DataVo.java
src/main/java/com/keymobile/rest/vo/DataVo.java
+0
-4
ExcelForm.java
src/main/java/com/keymobile/rest/vo/ExcelForm.java
+6
-2
JobForm.java
src/main/java/com/keymobile/rest/vo/JobForm.java
+30
-0
RecordDataForm.java
src/main/java/com/keymobile/rest/vo/RecordDataForm.java
+11
-0
TaskVO.java
src/main/java/com/keymobile/rest/vo/TaskVO.java
+0
-32
application-test.yml
src/main/resources/application-test.yml
+2
-2
No files found.
src/main/java/com/keymobile/rest/common/bean/ApiResponse.java
0 → 100644
View file @
c8c89bc8
package
com
.
keymobile
.
rest
.
common
.
bean
;
import
com.keymobile.rest.common.constant.ApiConstant
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
@Builder
@AllArgsConstructor
public
class
ApiResponse
<
T
>
implements
Serializable
{
private
int
code
;
private
String
msg
;
private
T
data
;
public
static
ApiResponse
ok
()
{
return
ApiResponse
.
builder
().
code
(
ApiConstant
.
SUCCEED_CODE
).
msg
(
ApiConstant
.
SUCCEED
).
build
();
}
public
static
<
T
>
ApiResponse
ok
(
T
data
)
{
return
ApiResponse
.
builder
().
code
(
ApiConstant
.
SUCCEED_CODE
).
msg
(
ApiConstant
.
SUCCEED
).
data
(
data
).
build
();
}
public
static
ApiResponse
fail
()
{
return
ApiResponse
.
builder
().
code
(
ApiConstant
.
FAILED_CODE
).
msg
(
ApiConstant
.
FAILED
).
build
();
}
public
static
ApiResponse
fail
(
int
code
,
String
msg
)
{
return
ApiResponse
.
builder
().
code
(
code
).
msg
(
msg
).
build
();
}
}
src/main/java/com/keymobile/rest/conf/Swagger2Config.java
→
src/main/java/com/keymobile/rest/co
mmon/co
nf/Swagger2Config.java
View file @
c8c89bc8
package
com
.
keymobile
.
rest
.
conf
;
package
com
.
keymobile
.
rest
.
co
mmon
.
co
nf
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
src/main/java/com/keymobile/rest/common/constant/ApiConstant.java
0 → 100644
View file @
c8c89bc8
package
com
.
keymobile
.
rest
.
common
.
constant
;
public
interface
ApiConstant
{
int
SUCCEED_CODE
=
200
;
int
FAILED_CODE
=
500
;
String
SUCCEED
=
"成功"
;
String
FAILED
=
"失败"
;
String
ERROR
=
"系统错误"
;
String
UNAUTHORIZED
=
"未授权"
;
String
PARAM_ERROR
=
"参数错误"
;
}
src/main/java/com/keymobile/rest/ctrl/IndexCtrl.java
View file @
c8c89bc8
...
@@ -2,18 +2,18 @@ package com.keymobile.rest.ctrl;
...
@@ -2,18 +2,18 @@ package com.keymobile.rest.ctrl;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.ImmutableMap
;
import
com.keymobile.activiti.service.formService.FormExcelFileService
;
import
com.keymobile.activiti.service.formService.FormExcelFileService
;
import
com.keymobile.
activiti.utils.DateUtil
;
import
com.keymobile.
rest.common.bean.ApiResponse
;
import
com.keymobile.rest.model.Excel
;
import
com.keymobile.rest.model.Excel
;
import
com.keymobile.rest.model.RecordInfo
;
import
com.keymobile.rest.model.Job
;
import
com.keymobile.rest.model.Task
;
import
com.keymobile.rest.model.User
;
import
com.keymobile.rest.model.User
;
import
com.keymobile.rest.service.*
;
import
com.keymobile.rest.service.*
;
import
com.keymobile.rest.service.TaskService
;
import
com.keymobile.rest.vo.ExcelForm
;
import
com.keymobile.rest.vo.DataVo
;
import
com.keymobile.rest.vo.RecordDataForm
;
import
io.swagger.annotations.ApiImplicitParam
;
import
com.keymobile.rest.vo.JobForm
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.activiti.engine.*
;
import
org.activiti.engine.*
;
import
org.activiti.engine.TaskService
;
import
org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl
;
import
org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl
;
import
org.activiti.engine.repository.Deployment
;
import
org.activiti.engine.repository.Deployment
;
import
org.activiti.engine.repository.ProcessDefinition
;
import
org.activiti.engine.repository.ProcessDefinition
;
...
@@ -21,12 +21,8 @@ import org.activiti.engine.runtime.ProcessInstance;
...
@@ -21,12 +21,8 @@ import org.activiti.engine.runtime.ProcessInstance;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.sql.Timestamp
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -37,7 +33,7 @@ import java.util.stream.Collectors;
...
@@ -37,7 +33,7 @@ import java.util.stream.Collectors;
public
class
IndexCtrl
{
public
class
IndexCtrl
{
@Autowired
@Autowired
private
TaskService
task
Service
;
private
JobService
job
Service
;
@Autowired
@Autowired
private
ExcelService
excelService
;
private
ExcelService
excelService
;
@Autowired
@Autowired
...
@@ -46,13 +42,12 @@ public class IndexCtrl {
...
@@ -46,13 +42,12 @@ public class IndexCtrl {
private
RecordInfoService
recordInfoService
;
private
RecordInfoService
recordInfoService
;
@Autowired
@Autowired
private
UserService
userService
;
private
UserService
userService
;
@Autowired
@Autowired
private
RepositoryService
repositoryService
;
private
RepositoryService
repositoryService
;
@Autowired
@Autowired
private
RuntimeService
runtimeService
;
private
RuntimeService
runtimeService
;
@Autowired
@Autowired
private
org
.
activiti
.
engine
.
TaskService
engineT
askService
;
private
TaskService
t
askService
;
@Autowired
@Autowired
private
HistoryService
historyService
;
private
HistoryService
historyService
;
@Autowired
@Autowired
...
@@ -65,81 +60,55 @@ public class IndexCtrl {
...
@@ -65,81 +60,55 @@ public class IndexCtrl {
@ApiOperation
(
value
=
"获取首页收数列表"
)
@ApiOperation
(
value
=
"获取首页收数列表"
)
@PostMapping
(
value
=
"/task/list"
)
@PostMapping
(
value
=
"/task/list"
)
public
Map
getTaskList
(
@RequestParam
Integer
pageNo
,
@RequestParam
Integer
pageSize
,
@RequestParam
(
required
=
false
)
String
name
)
{
public
ApiResponse
getTaskList
(
@RequestParam
Integer
pageNo
,
@RequestParam
Integer
pageSize
,
@RequestParam
(
required
=
false
)
@ApiParam
(
name
=
"name"
,
value
=
"收数名称"
)
String
name
)
{
Page
<
Task
>
taskList
;
Page
<
Job
>
taskList
;
String
orderBy
=
"descending"
;
//
String
orderBy
=
"descending"
;
//
String
propBy
=
"id"
;
// groupBy
String
propBy
=
"id"
;
// groupBy
if
(
name
!=
null
)
{
if
(
name
!=
null
)
{
taskList
=
task
Service
.
findAllByName
(
name
,
pageNo
,
pageSize
,
orderBy
,
propBy
);
taskList
=
job
Service
.
findAllByName
(
name
,
pageNo
,
pageSize
,
orderBy
,
propBy
);
}
else
{
}
else
{
taskList
=
task
Service
.
findAll
(
pageNo
,
pageSize
,
orderBy
,
propBy
);
taskList
=
job
Service
.
findAll
(
pageNo
,
pageSize
,
orderBy
,
propBy
);
}
}
return
ImmutableMap
.
of
(
"code"
,
200
,
"data"
,
ImmutableMap
.
of
(
"list"
,
taskList
.
getContent
(),
"total"
,
taskList
.
getTotalElements
()));
return
ApiResponse
.
ok
(
ImmutableMap
.
of
(
"list"
,
taskList
.
getContent
(),
"total"
,
taskList
.
getTotalElements
()));
}
}
@ApiOperation
(
value
=
"查看收数"
)
@ApiOperation
(
value
=
"查看收数"
)
@PostMapping
(
value
=
"/task/get"
)
@PostMapping
(
value
=
"/task/get"
)
public
Map
get
(
@RequestParam
int
id
)
{
public
ApiResponse
get
(
@RequestParam
@ApiParam
(
name
=
"id"
,
value
=
"收数id"
)
long
id
)
{
Task
task
=
task
Service
.
get
(
id
);
Job
job
=
job
Service
.
get
(
id
);
return
ImmutableMap
.
of
(
"code"
,
200
,
"data"
,
task
);
return
ApiResponse
.
ok
(
job
);
}
}
@ApiOperation
(
value
=
"新建收数"
)
@ApiOperation
(
value
=
"新建收数"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"name"
,
value
=
"收数名称"
,
dataType
=
"String"
,
required
=
true
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"收数类型 1为手动发起 2为自动发起"
,
dataType
=
"Integer"
,
required
=
true
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"startAt"
,
value
=
"自动发起需要提写的时间"
,
dataType
=
"String"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"userIds"
,
value
=
"补录人员ids 用逗号隔开"
,
dataType
=
"String"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"excelIds"
,
value
=
"新建的模板ids 用逗号隔开"
,
dataType
=
"String"
,
paramType
=
"query"
),
})
@PostMapping
(
value
=
"/task/create"
)
@PostMapping
(
value
=
"/task/create"
)
public
Map
createTask
(
@RequestParam
String
name
,
@RequestParam
Integer
type
,
public
ApiResponse
createTask
(
@RequestBody
JobForm
form
)
{
@RequestParam
(
required
=
false
)
String
startAt
,
@RequestParam
(
required
=
false
)
String
userIds
,
@RequestParam
(
required
=
false
)
String
excelIds
)
{
Job
job
=
jobService
.
save
(
form
);
Task
task
=
new
Task
();
Timestamp
now
=
Timestamp
.
valueOf
(
DateUtil
.
getDateTime
());
task
.
setCreateAt
(
now
);
task
.
setStatus
(
Task
.
STATUS_UNRELEASED
);
task
.
setJudge
(
Task
.
JUDGE_NEED
);
task
.
setName
(
name
);
task
.
setType
(
type
);
if
(
type
==
Task
.
TYPE_AUTO
)
{
task
.
setStartAt
(
Timestamp
.
valueOf
(
startAt
));
}
task
.
setUser
(
userService
.
getManager
());
long
id
=
taskService
.
save
(
task
);
// 新建excel实例
// 新建excel实例
if
(
excelIds
!=
null
)
{
if
(
form
.
getExcelIds
()
!=
null
)
{
String
[]
excelId
Arr
=
excelIds
.
split
(
","
);
String
[]
excelId
s
=
form
.
getExcelIds
()
.
split
(
","
);
List
<
Long
>
ids
=
Arrays
.
asList
(
excelIdArr
).
stream
().
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
List
<
Long
>
excelIdList
=
Arrays
.
asList
(
excelIds
).
stream
().
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
List
<
Excel
>
excelList
=
excelService
.
findAllByIdIn
(
ids
);
List
<
Excel
>
excelList
=
excelService
.
findAllByIdIn
(
excelIdList
);
excelList
.
forEach
(
excel
->
{
excelList
.
forEach
(
excel
->
{
excel
.
set
Task
(
task
);
excel
.
set
Job
(
job
);
// 新建补录人员任务关联
// 新建补录人员任务关联
if
(
userIds
!=
null
)
{
if
(
form
.
getUserIds
()
!=
null
)
{
String
[]
user
StrIdArr
=
userIds
.
split
(
","
);
String
[]
user
Ids
=
form
.
getUserIds
()
.
split
(
","
);
List
<
Long
>
userIdList
=
Arrays
.
asList
(
user
StrIdArr
).
stream
().
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
List
<
Long
>
userIdList
=
Arrays
.
asList
(
user
Ids
).
stream
().
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
List
<
User
>
userList
=
userService
.
findAllByIdIn
(
userIdList
);
List
<
User
>
userList
=
userService
.
findAllByIdIn
(
userIdList
);
userList
.
forEach
(
user
->
{
userList
.
forEach
(
user
->
{
RecordInfo
info
=
new
RecordInfo
();
recordInfoService
.
save
(
user
,
excel
);
info
.
setUser
(
user
);
info
.
setExcel
(
excel
);
info
.
setCreateAt
(
now
);
recordInfoService
.
save
(
info
);
});
});
}
}
});
});
excelService
.
saveAll
(
excelList
);
excelService
.
saveAll
(
excelList
);
}
}
return
ApiResponse
.
ok
();
return
ImmutableMap
.
of
(
"code"
,
200
,
"data"
,
id
);
}
}
@ApiOperation
(
value
=
"手动发起收数"
)
@ApiOperation
(
value
=
"手动发起收数"
)
@PostMapping
(
value
=
"/task/start"
)
@PostMapping
(
value
=
"/task/start"
)
public
Map
startTask
(
@RequestParam
int
id
)
{
public
ApiResponse
startTask
(
@RequestParam
long
id
)
{
Task
task
=
task
Service
.
get
(
id
);
Job
job
=
job
Service
.
get
(
id
);
// 启动流程
// 启动流程
// 获取流的引擎
// 获取流的引擎
ProcessEngine
processEngine
=
ProcessEngines
.
getDefaultProcessEngine
();
ProcessEngine
processEngine
=
ProcessEngines
.
getDefaultProcessEngine
();
...
@@ -161,57 +130,50 @@ public class IndexCtrl {
...
@@ -161,57 +130,50 @@ public class IndexCtrl {
//审批任务
//审批任务
processEngine
.
getTaskService
().
complete
(
resultTask
.
getId
());
processEngine
.
getTaskService
().
complete
(
resultTask
.
getId
());
return
ImmutableMap
.
of
(
"code"
,
200
);
return
ApiResponse
.
ok
(
);
}
}
@ApiOperation
(
value
=
"审核通过收数"
)
@ApiOperation
(
value
=
"审核通过收数"
)
@PostMapping
(
value
=
"/task/pass"
)
@PostMapping
(
value
=
"/task/pass"
)
public
Map
passTask
(
@RequestParam
int
id
)
{
public
ApiResponse
passTask
(
@RequestParam
long
id
)
{
return
ImmutableMap
.
of
(
"code"
,
200
);
return
ApiResponse
.
ok
(
);
}
}
@ApiOperation
(
value
=
"审核驳回收数"
)
@ApiOperation
(
value
=
"审核驳回收数"
)
@PostMapping
(
value
=
"/task/reject"
)
@PostMapping
(
value
=
"/task/reject"
)
public
Map
rejectTask
(
@RequestParam
int
id
)
{
public
ApiResponse
rejectTask
(
@RequestParam
long
id
)
{
return
ImmutableMap
.
of
(
"code"
,
200
);
return
ApiResponse
.
ok
(
);
}
}
@ApiOperation
(
value
=
"查看当前收数进度"
)
@ApiOperation
(
value
=
"查看当前收数进度"
)
@PostMapping
(
value
=
"/task/saveData"
)
@PostMapping
(
value
=
"/task/saveData"
)
public
Map
viewTaskProcess
(
@RequestParam
int
id
)
{
public
ApiResponse
viewTaskProcess
(
@RequestParam
long
id
)
{
return
ImmutableMap
.
of
(
"code"
,
200
);
return
ApiResponse
.
ok
(
);
}
}
@ApiOperation
(
value
=
"获取补录人员列表"
)
@ApiOperation
(
value
=
"获取补录人员列表"
)
@PostMapping
(
value
=
"/user/list"
)
@PostMapping
(
value
=
"/user/list"
)
public
Map
getUserList
()
{
public
ApiResponse
getUserList
()
{
List
<
User
>
userList
=
userService
.
findAllByRole
(
User
.
ROLE_NORMAL
);
List
<
User
>
userList
=
userService
.
findAllByRole
(
User
.
ROLE_NORMAL
);
return
ImmutableMap
.
of
(
"code"
,
200
,
"data"
,
userList
);
return
ApiResponse
.
ok
(
userList
);
}
}
@ApiOperation
(
value
=
"新建模板"
)
@ApiOperation
(
value
=
"新建模板"
)
@PostMapping
(
value
=
"/excel/create"
)
@PostMapping
(
value
=
"/excel/create"
)
public
Map
saveExcel
(
@RequestParam
String
config
,
@RequestParam
(
required
=
false
)
String
desc
)
{
public
ApiResponse
saveExcel
(
@RequestBody
ExcelForm
form
)
{
Excel
excel
=
new
Excel
();
Excel
excel
=
excelService
.
save
(
form
);
excel
.
setConfig
(
config
);
return
ApiResponse
.
ok
();
excel
.
setDesc
(
config
);
long
id
=
excelService
.
save
(
excel
);
return
ImmutableMap
.
of
(
"code"
,
200
,
"data"
,
id
);
}
}
@ApiOperation
(
value
=
"填写补录数据"
)
@ApiOperation
(
value
=
"填写补录数据"
)
@PostMapping
(
value
=
"/excel/saveData"
)
@PostMapping
(
value
=
"/excel/saveData"
)
public
Map
saveRecordData
(
DataVo
vo
)
{
public
ApiResponse
saveRecordData
(
RecordDataForm
form
)
{
// Excel excel = new Excel();
// excel.setConfig(config);
return
ApiResponse
.
ok
();
// excel.setDesc(config);
// long id = excelService.save(excel);
// recordDataService.save(vo);
return
ImmutableMap
.
of
(
"code"
,
200
);
}
}
...
...
src/main/java/com/keymobile/rest/dao/
Task
Dao.java
→
src/main/java/com/keymobile/rest/dao/
Job
Dao.java
View file @
c8c89bc8
package
com
.
keymobile
.
rest
.
dao
;
package
com
.
keymobile
.
rest
.
dao
;
import
com.keymobile.rest.model.
Task
;
import
com.keymobile.rest.model.
Job
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
public
interface
TaskDao
extends
JpaRepository
<
Task
,
Long
>
{
public
interface
JobDao
extends
JpaRepository
<
Job
,
Long
>
{
Page
<
Task
>
findAll
(
Pageable
pageable
);
Page
<
Job
>
findAll
(
Pageable
pageable
);
Page
<
Task
>
findAllByNameLike
(
String
valueOf
,
Pageable
pageable
);
Page
<
Job
>
findAllByNameLike
(
String
valueOf
,
Pageable
pageable
);
}
}
src/main/java/com/keymobile/rest/model/Excel.java
View file @
c8c89bc8
...
@@ -36,7 +36,7 @@ public class Excel implements Serializable {
...
@@ -36,7 +36,7 @@ public class Excel implements Serializable {
// 级别游离关联, 当加载的时候急加载这个对象
// 级别游离关联, 当加载的时候急加载这个对象
@ManyToOne
(
cascade
=
CascadeType
.
DETACH
,
fetch
=
FetchType
.
EAGER
)
@ManyToOne
(
cascade
=
CascadeType
.
DETACH
,
fetch
=
FetchType
.
EAGER
)
private
Task
task
;
private
Job
job
;
@OneToMany
@OneToMany
@JsonIgnore
@JsonIgnore
...
...
src/main/java/com/keymobile/rest/model/
Task
.java
→
src/main/java/com/keymobile/rest/model/
Job
.java
View file @
c8c89bc8
...
@@ -20,7 +20,8 @@ import java.util.List;
...
@@ -20,7 +20,8 @@ import java.util.List;
@AllArgsConstructor
// 自动生成全参数构造函数。
@AllArgsConstructor
// 自动生成全参数构造函数。
@Data
@Data
@Entity
@Entity
public
class
Task
implements
Serializable
{
@Table
(
name
=
"task"
)
public
class
Job
implements
Serializable
{
public
static
int
TYPE_AUTO
=
2
;
public
static
int
TYPE_AUTO
=
2
;
public
static
int
TYPE_MANUAL
=
1
;
public
static
int
TYPE_MANUAL
=
1
;
...
...
src/main/java/com/keymobile/rest/model/User.java
View file @
c8c89bc8
...
@@ -13,7 +13,6 @@ import java.io.Serializable;
...
@@ -13,7 +13,6 @@ import java.io.Serializable;
@Entity
@Entity
public
class
User
implements
Serializable
{
public
class
User
implements
Serializable
{
public
static
int
ROLE_NORMAL
=
1
;
public
static
int
ROLE_NORMAL
=
1
;
public
static
int
ROLE_JUDGE
=
2
;
public
static
int
ROLE_JUDGE
=
2
;
public
static
int
ROLE_MANAGER
=
3
;
public
static
int
ROLE_MANAGER
=
3
;
...
...
src/main/java/com/keymobile/rest/service/ExcelService.java
View file @
c8c89bc8
...
@@ -2,7 +2,7 @@ package com.keymobile.rest.service;
...
@@ -2,7 +2,7 @@ package com.keymobile.rest.service;
import
com.keymobile.rest.dao.*
;
import
com.keymobile.rest.dao.*
;
import
com.keymobile.rest.model.Excel
;
import
com.keymobile.rest.model.Excel
;
import
com.keymobile.rest.vo.Excel
VO
;
import
com.keymobile.rest.vo.Excel
Form
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -12,17 +12,14 @@ import java.util.List;
...
@@ -12,17 +12,14 @@ import java.util.List;
public
class
ExcelService
{
public
class
ExcelService
{
@Autowired
@Autowired
private
TaskDao
taskDao
;
@Autowired
private
UserDao
userDao
;
@Autowired
private
ExcelDao
excelDao
;
private
ExcelDao
excelDao
;
@Autowired
private
RecordInfoDao
recordInfoDao
;
public
long
save
(
Excel
excel
)
{
public
Excel
save
(
ExcelForm
form
)
{
Excel
excel
=
new
Excel
();
excel
.
setConfig
(
form
.
getConfig
());
excel
.
setDesc
(
form
.
getDesc
());
excelDao
.
save
(
excel
);
excelDao
.
save
(
excel
);
return
excel
.
getId
()
;
return
excel
;
}
}
public
List
<
Excel
>
findAllByIdIn
(
List
<
Long
>
ids
)
{
public
List
<
Excel
>
findAllByIdIn
(
List
<
Long
>
ids
)
{
...
...
src/main/java/com/keymobile/rest/service/
Task
Service.java
→
src/main/java/com/keymobile/rest/service/
Job
Service.java
View file @
c8c89bc8
package
com
.
keymobile
.
rest
.
service
;
package
com
.
keymobile
.
rest
.
service
;
import
com.keymobile.rest.dao.TaskDao
;
import
com.keymobile.activiti.utils.DateUtil
;
import
com.keymobile.rest.model.Task
;
import
com.keymobile.rest.dao.JobDao
;
import
com.keymobile.rest.model.Job
;
import
com.keymobile.rest.vo.JobForm
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.PageRequest
;
...
@@ -9,39 +11,52 @@ import org.springframework.data.domain.Pageable;
...
@@ -9,39 +11,52 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
@Service
(
"ApiTaskService"
)
import
java.sql.Timestamp
;
public
class
TaskService
{
@Service
public
class
JobService
{
@Autowired
@Autowired
private
TaskDao
task
Dao
;
private
JobDao
job
Dao
;
public
Task
get
(
long
id
)
{
public
Job
get
(
long
id
)
{
return
task
Dao
.
getOne
(
id
);
return
job
Dao
.
getOne
(
id
);
}
}
public
long
save
(
Task
task
)
{
public
Job
save
(
JobForm
form
)
{
taskDao
.
save
(
task
);
Job
job
=
new
Job
();
return
task
.
getId
();
Timestamp
now
=
Timestamp
.
valueOf
(
DateUtil
.
getDateTime
());
job
.
setCreateAt
(
now
);
job
.
setStatus
(
Job
.
STATUS_UNRELEASED
);
job
.
setJudge
(
Job
.
JUDGE_NEED
);
job
.
setName
(
form
.
getName
());
job
.
setType
(
form
.
getType
());
if
(
form
.
getType
()
==
Job
.
TYPE_AUTO
)
{
job
.
setStartAt
(
Timestamp
.
valueOf
(
form
.
getStartAt
()));
}
job
.
setUser
(
form
.
getUser
());
jobDao
.
save
(
job
);
return
job
;
}
}
public
Page
<
Task
>
findAll
(
int
pageNo
,
int
pageSize
)
{
public
Page
<
Job
>
findAll
(
int
pageNo
,
int
pageSize
)
{
Pageable
pageable
=
convert
(
pageNo
,
pageSize
);
Pageable
pageable
=
convert
(
pageNo
,
pageSize
);
return
task
Dao
.
findAll
(
pageable
);
return
job
Dao
.
findAll
(
pageable
);
}
}
public
Page
<
Task
>
findAllByName
(
String
name
,
int
pageNo
,
int
pageSize
)
{
public
Page
<
Job
>
findAllByName
(
String
name
,
int
pageNo
,
int
pageSize
)
{
Pageable
pageable
=
convert
(
pageNo
,
pageSize
);
Pageable
pageable
=
convert
(
pageNo
,
pageSize
);
return
task
Dao
.
findAllByNameLike
((
"%"
+
name
+
"%"
),
pageable
);
return
job
Dao
.
findAllByNameLike
((
"%"
+
name
+
"%"
),
pageable
);
}
}
public
Page
<
Task
>
findAll
(
int
pageNo
,
int
pageSize
,
String
orderBy
,
String
propBy
)
{
public
Page
<
Job
>
findAll
(
int
pageNo
,
int
pageSize
,
String
orderBy
,
String
propBy
)
{
Pageable
pageable
=
convert
(
pageNo
,
pageSize
,
orderBy
,
propBy
);
Pageable
pageable
=
convert
(
pageNo
,
pageSize
,
orderBy
,
propBy
);
return
task
Dao
.
findAll
(
pageable
);
return
job
Dao
.
findAll
(
pageable
);
}
}
public
Page
<
Task
>
findAllByName
(
String
name
,
int
pageNo
,
int
pageSize
,
String
orderBy
,
String
propBy
)
{
public
Page
<
Job
>
findAllByName
(
String
name
,
int
pageNo
,
int
pageSize
,
String
orderBy
,
String
propBy
)
{
Pageable
pageable
=
convert
(
pageNo
,
pageSize
,
orderBy
,
propBy
);
Pageable
pageable
=
convert
(
pageNo
,
pageSize
,
orderBy
,
propBy
);
return
task
Dao
.
findAllByNameLike
((
"%"
+
name
+
"%"
),
pageable
);
return
job
Dao
.
findAllByNameLike
((
"%"
+
name
+
"%"
),
pageable
);
}
}
private
Pageable
convert
(
int
pageNo
,
int
pageSize
,
String
orderBy
,
String
propBy
)
{
private
Pageable
convert
(
int
pageNo
,
int
pageSize
,
String
orderBy
,
String
propBy
)
{
...
...
src/main/java/com/keymobile/rest/service/RecordDataService.java
View file @
c8c89bc8
...
@@ -2,17 +2,19 @@ package com.keymobile.rest.service;
...
@@ -2,17 +2,19 @@ package com.keymobile.rest.service;
import
com.keymobile.rest.dao.*
;
import
com.keymobile.rest.dao.*
;
import
com.keymobile.rest.model.RecordData
;
import
com.keymobile.rest.model.RecordData
;
import
com.keymobile.rest.vo.DataVo
;
import
com.keymobile.rest.vo.ExcelVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
@Service
@Service
public
class
RecordDataService
{
public
class
RecordDataService
{
@Autowired
private
RecordDataDao
recordDataDao
;
private
RecordDataDao
recordDataDao
;
public
long
save
(
RecordData
recordData
)
{
public
RecordData
save
()
{
recordDataDao
.
save
(
recordData
);
RecordData
data
=
new
RecordData
();
return
recordData
.
getId
();
recordDataDao
.
save
(
data
);
return
data
;
}
}
}
}
src/main/java/com/keymobile/rest/service/RecordInfoService.java
View file @
c8c89bc8
package
com
.
keymobile
.
rest
.
service
;
package
com
.
keymobile
.
rest
.
service
;
import
com.keymobile.activiti.utils.DateUtil
;
import
com.keymobile.rest.dao.*
;
import
com.keymobile.rest.dao.*
;
import
com.keymobile.rest.model.
RecordData
;
import
com.keymobile.rest.model.
Excel
;
import
com.keymobile.rest.model.RecordInfo
;
import
com.keymobile.rest.model.RecordInfo
;
import
com.keymobile.rest.model.User
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.sql.Timestamp
;
@Service
@Service
public
class
RecordInfoService
{
public
class
RecordInfoService
{
@Autowired
private
RecordInfoDao
recordInfoDao
;
private
RecordInfoDao
recordInfoDao
;
public
long
save
(
RecordInfo
recordInfo
)
{
public
RecordInfo
save
(
User
user
,
Excel
excel
)
{
recordInfoDao
.
save
(
recordInfo
);
RecordInfo
info
=
new
RecordInfo
();
return
recordInfo
.
getId
();
info
.
setExcel
(
excel
);
info
.
setUser
(
user
);
Timestamp
now
=
Timestamp
.
valueOf
(
DateUtil
.
getDateTime
());
info
.
setCreateAt
(
now
);
recordInfoDao
.
save
(
info
);
return
info
;
}
}
}
}
src/main/java/com/keymobile/rest/vo/DataVo.java
deleted
100644 → 0
View file @
3f59594c
package
com
.
keymobile
.
rest
.
vo
;
public
class
DataVo
{
}
src/main/java/com/keymobile/rest/vo/Excel
VO
.java
→
src/main/java/com/keymobile/rest/vo/Excel
Form
.java
View file @
c8c89bc8
package
com
.
keymobile
.
rest
.
vo
;
package
com
.
keymobile
.
rest
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
...
@@ -9,11 +11,13 @@ import javax.persistence.Id;
...
@@ -9,11 +11,13 @@ import javax.persistence.Id;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
@Data
@Data
public
class
ExcelVO
{
@ApiModel
private
long
id
;
public
class
ExcelForm
{
@ApiModelProperty
(
name
=
"config"
,
value
=
"表格配置"
,
required
=
true
)
private
String
config
;
private
String
config
;
@ApiModelProperty
(
name
=
"desc"
,
value
=
"表格描述"
)
private
String
desc
;
private
String
desc
;
}
}
src/main/java/com/keymobile/rest/vo/JobForm.java
0 → 100644
View file @
c8c89bc8
package
com
.
keymobile
.
rest
.
vo
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.keymobile.rest.model.User
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
public
class
JobForm
{
@ApiModelProperty
(
required
=
true
,
name
=
"name"
,
value
=
"收数名称"
)
private
String
name
;
@ApiModelProperty
(
required
=
true
,
name
=
"type"
,
value
=
"收数类型 1手动 2自动"
)
private
int
type
;
@ApiModelProperty
(
name
=
"startAt"
,
value
=
"自动发起需要提写的时间"
)
private
String
startAt
;
@ApiModelProperty
(
name
=
"excelIds"
,
value
=
"新建的模板ids, 用逗号隔开"
)
private
String
excelIds
;
@ApiModelProperty
(
name
=
"excelIds"
,
value
=
"补录人员ids, 用逗号隔开"
)
private
String
userIds
;
@JsonIgnore
private
User
user
;
}
src/main/java/com/keymobile/rest/vo/RecordDataForm.java
0 → 100644
View file @
c8c89bc8
package
com
.
keymobile
.
rest
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@ApiModel
@Data
public
class
RecordDataForm
{
}
src/main/java/com/keymobile/rest/vo/TaskVO.java
deleted
100644 → 0
View file @
3f59594c
package
com
.
keymobile
.
rest
.
vo
;
import
lombok.Data
;
import
java.sql.Timestamp
;
@Data
public
class
TaskVO
{
private
long
id
;
private
String
name
;
private
int
type
;
private
int
status
;
private
int
judge
;
private
Timestamp
startAt
;
private
long
userId
;
/*
新建文件id, 逗号隔开
*/
private
String
excelIds
;
/*
补录人员id, 逗号隔开
*/
private
String
userIds
;
}
src/main/resources/application-test.yml
View file @
c8c89bc8
...
@@ -52,8 +52,8 @@ app:
...
@@ -52,8 +52,8 @@ app:
active-process
:
RecordProcess.bpmn
active-process
:
RecordProcess.bpmn
swagger2
:
swagger2
:
#
host: localhost:8110
host
:
localhost:8110
host
:
47.105.236.43/activiti
#
host: 47.105.236.43/activiti
...
...
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