Commit 51ced3cc by xmh

可以回收人员也可以回收子任务

1 parent 3dfe88b1
...@@ -200,8 +200,8 @@ public class ReidController { ...@@ -200,8 +200,8 @@ public class ReidController {
} }
@GetMapping("recovery") @GetMapping("recovery")
public Object recovery(@RequestParam String personUnid, @RequestParam Long packId) throws Exception { public Object recovery(@RequestParam(required = false) String personUnid,@RequestParam(required = false) Long[] subTaskIdArr, @RequestParam Long packId) throws Exception {
reidService.recovery(personUnid, packId); reidService.recovery(personUnid,subTaskIdArr, packId);
return JsonMessageUtil.getSuccessJsonMsg("success"); return JsonMessageUtil.getSuccessJsonMsg("success");
} }
......
...@@ -4,7 +4,6 @@ import cn.dev33.satoken.stp.StpUtil; ...@@ -4,7 +4,6 @@ import cn.dev33.satoken.stp.StpUtil;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.viontech.keliu.exception.ParameterExceptin;
import com.viontech.keliu.model.*; import com.viontech.keliu.model.*;
import com.viontech.keliu.util.DateUtil; import com.viontech.keliu.util.DateUtil;
import com.viontech.keliu.websocket.AlgApiClient; import com.viontech.keliu.websocket.AlgApiClient;
...@@ -31,10 +30,8 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -31,10 +30,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.websocket.DeploymentException;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -505,25 +502,39 @@ public class ReidService { ...@@ -505,25 +502,39 @@ public class ReidService {
* 回收人员 * 回收人员
*/ */
@Transactional(rollbackFor = Throwable.class) @Transactional(rollbackFor = Throwable.class)
public synchronized void recovery(String personUnid, Long packId) throws Exception { public synchronized void recovery(String personUnid, Long[] subtaskIdArr, Long packId) throws Exception {
String recoveryPersonUnid = null;
SubTaskExample subTaskExample = new SubTaskExample(); SubTaskExample subTaskExample = new SubTaskExample();
subTaskExample.createCriteria().andPackIdEqualTo(packId).andStatusEqualTo(SubTaskStatus.recycled.val); subTaskExample.createCriteria().andPackIdEqualTo(packId).andStatusEqualTo(SubTaskStatus.recycled.val);
List<SubTask> subTasks = subTaskService.selectByExample(subTaskExample); List<SubTask> subTasks = subTaskService.selectByExample(subTaskExample);
SubTask subTask = new SubTask();
subTask.setStatus(SubTaskStatus.recycled.val);
if (subTasks.size() > 0) { if (subTasks.size() > 0) {
subTask.setPersonUnid(subTasks.get(0).getPersonUnid()); recoveryPersonUnid = subTasks.get(0).getPersonUnid();
} }
subTaskExample = new SubTaskExample(); SubTask subTask = new SubTask();
subTaskExample.createCriteria().andPersonUnidEqualTo(personUnid).andPackIdEqualTo(packId); subTask.setStatus(SubTaskStatus.recycled.val);
subTaskService.updateByExampleSelective(subTask, subTaskExample); subTask.setPersonUnid(recoveryPersonUnid);
String poolName = Constants.getReidPoolName(packId); String poolName = Constants.getReidPoolName(packId);
matchClient.EASY_PERSON_API.deletePerson(poolName, Collections.singletonList(personUnid));
if (subtaskIdArr != null) {
subTaskExample = new SubTaskExample();
subTaskExample.createCriteria().andIdIn(Arrays.asList(subtaskIdArr));
subTasks = subTaskService.selectByExample(subTaskExample);
if (subTasks.size() > 0) {
Set<String> personUnidNeedUpdate = subTasks.stream().map(SubTask::getPersonUnid).collect(Collectors.toSet());
subTaskService.updateByExampleSelective(subTask, subTaskExample);
for (String s : personUnidNeedUpdate) {
updatePoolByPersonUnid(s, poolName);
}
}
}
if (personUnid != null) {
subTaskExample = new SubTaskExample();
subTaskExample.createCriteria().andPersonUnidEqualTo(personUnid).andPackIdEqualTo(packId);
subTaskService.updateByExampleSelective(subTask, subTaskExample);
matchClient.EASY_PERSON_API.deletePerson(poolName, Collections.singletonList(personUnid));
}
} }
public void exitLabeling(String personUnid, Long packId) { public void exitLabeling(String personUnid, Long packId) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!