修复了交接时会将已完成或关闭的项目一并交接的问题

master
ArgonarioD 2022-07-13 14:54:32 +08:00
parent f2f6bb8d8a
commit 7dbf52d915
2 changed files with 15 additions and 4 deletions

View File

@ -213,7 +213,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
private int upperBound(List<Task> data, long x) {
int l = 0, r = data.size() - 1;
if(data.get(r).getTaskFatherId().equals(x))
if (data.get(r).getTaskFatherId().equals(x))
return r;
while (l < r) {
int mid = (l + r) / 2;
@ -227,7 +227,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
@Override
public List<TaskDTO> listMyTasks(String token, Integer projectId) throws ForbiddenException {
Integer staffId = TokenUtils.getStaffId(token);
if(projectGroupService.getProjectAccessLevel(token,projectId)==0){
if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) {
throw new ForbiddenException("不可操作的项目");
}
List<Task> resList = baseMapper.selectList(Wrappers.<Task>lambdaQuery()
@ -519,11 +519,22 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
if (projectGroupService.compareProjectAccessLevel(projectId, token, transferredStaffId) > 0) {
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
}
Long transferredTaskCount = baseMapper.selectCount(Wrappers.<Task>lambdaQuery().eq(Task::getTaskHolderId, transferredStaffId));
Long transferredTaskCount = baseMapper.selectCount(Wrappers.<Task>lambdaQuery()
.eq(Task::getTaskHolderId, transferredStaffId)
.and(wrapper -> wrapper
.eq(Task::getTaskStatus, Task.STATUS_WAITING)
.or()
.eq(Task::getTaskStatus, Task.STATUS_PROCESSING)
));
int updatedTaskCount = baseMapper.update(
null,
Wrappers.<Task>lambdaUpdate()
.eq(Task::getTaskHolderId, transferredStaffId)
.and(wrapper -> wrapper
.eq(Task::getTaskStatus, Task.STATUS_WAITING)
.or()
.eq(Task::getTaskStatus, Task.STATUS_PROCESSING)
)
.set(Task::getTaskHolderId, targetStaffId)
);
return transferredTaskCount.intValue() == updatedTaskCount;

View File

@ -24,7 +24,7 @@ public class SerializeTests {
public void serializeTime() {
String timestamp = objectMapper.writeValueAsString(LocalDateTime.now());
System.out.println(timestamp);
System.out.println(objectMapper.readValue(timestamp, LocalDateTime.class));
System.out.println(objectMapper.readValue("1657693261", LocalDateTime.class));
}
@SneakyThrows