Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
96d1778b
Commit
96d1778b
authored
Oct 24, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev] split startInstanceAndAssigne to two transextion
parent
2287fb7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
15 deletions
+25
-15
ApprovalService.java
...va/pwc/taxtech/atms/vat/service/impl/ApprovalService.java
+25
-15
No files found.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ApprovalService.java
View file @
96d1778b
...
...
@@ -39,15 +39,32 @@ public class ApprovalService {
@Autowired
PeriodReportMapper
reportMapper
;
@Transactional
public
void
startInstanceAndAssignee
(
ApprovalDto
dto
)
{
PeriodApprove
pa
=
new
PeriodApprove
();
String
instanceId
=
startInstance
(
dto
,
pa
);
startAssignee
(
pa
,
instanceId
);
}
public
List
<
ApprovalTask
>
getTask
(
String
assignee
)
{
List
<
Task
>
tasks
=
taskService
.
createTaskQuery
().
taskAssignee
(
assignee
).
list
();
List
<
ApprovalTask
>
list
=
new
ArrayList
<>();
for
(
Task
task
:
tasks
)
{
ApprovalTask
t
=
new
ApprovalTask
();
list
.
add
(
t
.
copyfrom
(
task
));
}
return
list
;
}
@Transactional
private
void
startInstance
(
ApprovalDto
dto
,
PeriodApprove
pa
)
{
PeriodReportExample
pre
=
new
PeriodReportExample
();
pre
.
createCriteria
().
andProjectIdEqualTo
(
dto
.
getProjectId
()).
andPeriodEqualTo
(
dto
.
getPeriod
());
List
<
PeriodReport
>
currentReports
=
reportMapper
.
selectByExample
(
pre
);
MyAsserts
.
assertNotEmpty
(
currentReports
,
Exceptions
.
NOT_FOUND_REPORT_EXCEPTION
);
PeriodApprove
pa
=
new
PeriodApprove
();
pa
.
setId
(
UUID
.
randomUUID
().
toString
());
pa
.
setPeriod
(
dto
.
getPeriod
());
pa
.
setYear
(
dto
.
getYear
());
...
...
@@ -74,10 +91,13 @@ public class ApprovalService {
pa
.
setReportIds
(
reportIds
.
toString
());
pa
.
setTemplateIds
(
reportTemplateIds
.
toString
());
pa
.
setStatus
(
Constant
.
APPROVAL_COMMITTED
);
periodApproveMapper
.
insert
(
pa
);
}
@Transactional
private
void
startAssignee
(
PeriodApprove
pa
)
{
List
<
Task
>
tasks
=
taskService
.
createTaskQuery
().
taskAssignee
(
Constant
.
ASSIGNEE_ACCOUNTANT
).
processInstanceId
(
p
i
.
get
Id
()).
list
();
p
a
.
getInstance
Id
()).
list
();
if
(
tasks
!=
null
&&
tasks
.
size
()
==
1
)
{
Task
task
=
tasks
.
get
(
0
);
...
...
@@ -87,23 +107,13 @@ public class ApprovalService {
taskService
.
complete
(
task
.
getId
(),
map
);
taskService
.
createAttachment
(
"java.lang.String"
,
task
.
getId
(),
task
.
getProcessInstanceId
(),
"period_approval_uuid"
,
pa
.
getId
(),
pa
.
getId
());
periodApproveMapper
.
insert
(
pa
);
periodApproveMapper
.
updateByPrimaryKeySelective
(
pa
);
}
else
{
logger
.
warn
(
"task must not null or size eq 1"
);
}
}
public
List
<
ApprovalTask
>
getTask
(
String
assignee
)
{
List
<
Task
>
tasks
=
taskService
.
createTaskQuery
().
taskAssignee
(
assignee
).
list
();
List
<
ApprovalTask
>
list
=
new
ArrayList
<>();
for
(
Task
task
:
tasks
)
{
ApprovalTask
t
=
new
ApprovalTask
();
list
.
add
(
t
.
copyfrom
(
task
));
}
return
list
;
}
@Transactional
public
void
checkTask
(
String
taskId
,
String
decide
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
...
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