BackInvokeService.java
1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.huaheng.pc.task.taskHeader.service;
import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class BackInvokeService {
@Resource
private BackQueue backQueue;
@Resource
private TaskHeaderService taskHeaderService;
public void invokeBack(int taskId){
new Thread(()->{
backQueue.receiveBack(taskId, new CallBack() {
@Override
public void back(Boolean flag, String message) {
if(!flag){
TaskHeader taskHeader = taskHeaderService.getById(taskId);
taskHeader.setBackInfo(message);
taskHeader.setIsReturn(1);
taskHeader.setCompleteStatus(1);
taskHeaderService.updateById(taskHeader);
}else{
TaskHeader taskHeader = taskHeaderService.getById(taskId);
taskHeader.setCompleteStatus(2);
taskHeader.setBackInfo(message);
taskHeader.setIsReturn(2);
taskHeaderService.updateById(taskHeader);
}
}
});
},"async-thread").start();
}
}