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
8a66fd97
Commit
8a66fd97
authored
Mar 26, 2020
by
chenweisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
5475c19a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
41 deletions
+41
-41
ExcelController.java
...n/java/com/keymobile/rest/controller/ExcelController.java
+2
-0
TaskController.java
...in/java/com/keymobile/rest/controller/TaskController.java
+28
-37
UserController.java
...in/java/com/keymobile/rest/controller/UserController.java
+6
-4
MissionDao.java
src/main/java/com/keymobile/rest/dao/MissionDao.java
+1
-0
MissionService.java
src/main/java/com/keymobile/rest/service/MissionService.java
+4
-0
MoreSubProcessTestV2.bpmn
src/main/resources/MoreSubProcessTestV2.bpmn
+0
-0
No files found.
src/main/java/com/keymobile/rest/controller/ExcelController.java
View file @
8a66fd97
...
...
@@ -59,9 +59,11 @@ public class ExcelController {
String
processId
=
mission
.
getProcess
().
getProcessId
();
String
taskId
=
mission
.
getTaskId
();
// 发起人把流程发送到下一个人
Task
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processId
).
taskId
(
taskId
)
.
singleResult
();
Map
vars
=
new
HashMap
<>();
if
(
template
.
getNeedAudit
()
==
Template
.
NEED_AUDIT
)
{
vars
.
put
(
"sign"
,
true
);
...
...
src/main/java/com/keymobile/rest/controller/TaskController.java
View file @
8a66fd97
...
...
@@ -98,44 +98,35 @@ public class TaskController {
// TwinkleValidator.notNull(user, "用户不存在");
List
<
Map
>
missions
=
new
ArrayList
<>();
List
<
User
>
userList
=
userService
.
findAll
();
StringBuilder
assigneesBuilder
=
new
StringBuilder
();
assigneesBuilder
.
append
(
"("
);
userList
.
forEach
(
user
->
{
assigneesBuilder
.
append
(
"'"
+
user
.
getUsername
()
+
"'"
).
append
(
","
);
// 查找当前用户所有的activiti task
String
sql
=
"SELECT * FROM "
+
managementService
.
getTableName
(
Task
.
class
)
+
" T WHERE T.ASSIGNEE_ like #{assignee}"
;
List
<
Task
>
tasks
=
taskService
.
createNativeTaskQuery
()
.
sql
(
sql
)
.
parameter
(
"assignee"
,
user
.
getUsername
()
+
":templateId:"
)
.
list
();
tasks
.
forEach
(
task
->
{
String
assignee
=
task
.
getAssignee
();
long
templateId
=
Long
.
parseLong
(
assignee
.
split
(
":templateId:"
)[
1
]);
String
processId
=
task
.
getProcessInstanceId
();
Mission
mission
=
missionService
.
findByProcessIdAndUsernameAndTemplateIdAndStatus
(
processId
,
user
.
getUsername
(),
templateId
,
Mission
.
STATUS_BEGIN
);
mission
.
setTaskId
(
task
.
getId
());
missionService
.
save
(
mission
);
Map
map
=
new
HashMap
();
map
.
put
(
"id"
,
mission
.
getId
());
map
.
put
(
"userId"
,
mission
.
getUser
().
getId
());
map
.
put
(
"username"
,
mission
.
getUser
().
getUsername
());
map
.
put
(
"excelList"
,
Arrays
.
asList
(
mission
.
getTemplate
()));
if
(
task
.
getTaskDefinitionKey
().
equals
(
"dataEntrySubTask"
))
{
map
.
put
(
"kind"
,
1
);
}
else
{
map
.
put
(
"kind"
,
2
);
}
missions
.
add
(
map
);
});
});
String
assignees
=
assigneesBuilder
.
substring
(
0
,
assigneesBuilder
.
length
()
-
1
)
+
")"
;
// 获取任务
String
sql
=
"SELECT * FROM "
+
managementService
.
getTableName
(
Task
.
class
)
+
" T WHERE T.ASSIGNEE_ in "
+
assignees
;
List
<
Task
>
tasks
=
taskService
.
createNativeTaskQuery
()
.
sql
(
sql
)
.
list
();
for
(
Task
task
:
tasks
)
{
String
processId
=
task
.
getProcessInstanceId
();
Process
process
=
processService
.
findByProcessId
(
processId
);
List
<
Mission
>
missionList
=
process
.
getMissionList
();
if
(
process
!=
null
&&
missionList
.
size
()
>
0
)
{
missionList
.
forEach
(
mission
->
{
// 只能查看得时候更新这个人属于这个进行得任务id
mission
.
setTaskId
(
task
.
getId
());
missionService
.
save
(
mission
);
Map
map
=
new
HashMap
();
map
.
put
(
"id"
,
mission
.
getId
());
map
.
put
(
"userId"
,
mission
.
getUser
().
getId
());
map
.
put
(
"username"
,
mission
.
getUser
().
getUsername
());
map
.
put
(
"excelList"
,
Arrays
.
asList
(
mission
.
getTemplate
()));
if
(
task
.
getTaskDefinitionKey
().
equals
(
"dataEntrySubTask"
))
{
map
.
put
(
"kind"
,
1
);
}
else
{
map
.
put
(
"kind"
,
2
);
}
missions
.
add
(
map
);
});
}
}
return
ApiResponse
.
ok
(
missions
);
}
...
...
@@ -256,7 +247,7 @@ public class TaskController {
// 更新mission
missionService
.
save
(
mission
);
User
user
=
mission
.
getUser
();
userNameList
.
add
(
user
.
getUsername
());
userNameList
.
add
(
user
.
getUsername
()
+
":template:"
+
template
.
getId
()
);
});
allMissions
.
addAll
(
missionList
);
});
...
...
src/main/java/com/keymobile/rest/controller/UserController.java
View file @
8a66fd97
...
...
@@ -77,10 +77,12 @@ public class UserController {
User
user
=
userService
.
findById
(
userId
);
TwinkleValidator
.
notNull
(
user
,
"所选用户不存在"
);
TwinkleValidator
.
isTrue
(
scope
.
getGroup
().
getId
()
==
user
.
getGroup
().
getId
(),
"所选用户与所选范围不属于同一机构"
);
List
<
User
>
userList
=
new
ArrayList
<>();
userList
.
add
(
user
);
scope
.
setUserList
(
userList
);
recordScopeService
.
save
(
scope
);
List
<
User
>
userList
=
scope
.
getUserList
();
if
(!
userList
.
contains
(
user
))
{
userList
.
add
(
user
);
scope
.
setUserList
(
userList
);
recordScopeService
.
save
(
scope
);
}
return
ApiResponse
.
ok
();
}
...
...
src/main/java/com/keymobile/rest/dao/MissionDao.java
View file @
8a66fd97
...
...
@@ -10,4 +10,5 @@ public interface MissionDao extends JpaRepository<Mission, Long> {
List
<
Mission
>
findAllByTemplateIdAndStatus
(
long
templateId
,
int
status
);
Mission
findByProcessIdAndUserUsernameAndTemplateIdAndStatus
(
String
processId
,
String
username
,
long
templateId
,
int
status
);
}
src/main/java/com/keymobile/rest/service/MissionService.java
View file @
8a66fd97
...
...
@@ -38,6 +38,10 @@ public class MissionService {
return
missionDao
.
getOne
(
missionId
);
}
public
Mission
findByProcessIdAndUsernameAndTemplateIdAndStatus
(
String
processId
,
String
username
,
long
templateId
,
int
status
)
{
return
missionDao
.
findByProcessIdAndUserUsernameAndTemplateIdAndStatus
(
processId
,
username
,
templateId
,
status
);
}
public
List
<
Mission
>
findAllByTemplateIdAndStatus
(
long
templateId
,
int
status
)
{
return
missionDao
.
findAllByTemplateIdAndStatus
(
templateId
,
status
);
}
...
...
src/main/resources/MoreSubProcessTestV2.bpmn
View file @
8a66fd97
This diff is collapsed.
Click to expand it.
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