Commit 8b04eabc authored by wdy's avatar wdy

编辑任务

parent 100c6ea9
package com.ruoyi.domain; package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.StandardJsonTypeHandler; import com.ruoyi.common.StandardJsonTypeHandler;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -62,10 +59,12 @@ public class Task { ...@@ -62,10 +59,12 @@ public class Task {
@ApiModelProperty("体系审查任务id") @ApiModelProperty("体系审查任务id")
@JsonFormat(shape = JsonFormat.Shape.STRING) @JsonFormat(shape = JsonFormat.Shape.STRING)
@TableField(insertStrategy = FieldStrategy.IGNORED,updateStrategy = FieldStrategy.IGNORED,whereStrategy = FieldStrategy.IGNORED)
private Long systemReviewTaskId; private Long systemReviewTaskId;
@ApiModelProperty("车辆检查任务id") @ApiModelProperty("车辆检查任务id")
@JsonFormat(shape = JsonFormat.Shape.STRING) @JsonFormat(shape = JsonFormat.Shape.STRING)
@TableField(insertStrategy = FieldStrategy.IGNORED,updateStrategy = FieldStrategy.IGNORED,whereStrategy = FieldStrategy.IGNORED)
private Long carReviewTaskId; private Long carReviewTaskId;
@ApiModelProperty("任务状态NEW(新建的)、PENDING(运行中的)、FINISH(已结束的)、TEMPORARILY(暂存)") @ApiModelProperty("任务状态NEW(新建的)、PENDING(运行中的)、FINISH(已结束的)、TEMPORARILY(暂存)")
...@@ -180,4 +179,12 @@ public class Task { ...@@ -180,4 +179,12 @@ public class Task {
return split[pointer + 1]; return split[pointer + 1];
} }
} }
public void setSystemReviewTaskIdNull(){
this.systemReviewTaskId = null;
}
public void setCarReviewTaskIdNull() {
this.carReviewTaskId = null;
}
} }
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.DataStatisticsUtils; import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
...@@ -212,38 +214,44 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -212,38 +214,44 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 构建并保存任务信息 // 构建并保存任务信息
// 总任务 // 总任务
Task task = new Task(); Task task = taskMapper.selectById(request.getId());
task.setLeaderId(leader.getUserId()); task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName()); task.setLeader(leader.getName());
String joinTaskList = StringUtils.join(request.getTaskList(),","); String joinTaskList = StringUtils.join(request.getTaskList(),",");
task.setTaskList(joinTaskList); task.setTaskList(joinTaskList);
BeanUtils.copyBeanProp(task, request); BeanUtils.copyBeanProp(task, request);
Task oldTask = taskMapper.selectById(request.getId());
if (task.getTaskStatus() == Task.TASK_STATUS_NEW) { if (Objects.equals(task.getTaskStatus(), Task.TASK_STATUS_NEW)) {
if(request.getTaskList().contains(Task.SUB_TASK_GRFIS) && oldTask.getCarReviewTaskId() == null) { if(request.getTaskList().contains(Task.SUB_TASK_GRFIS) && task.getCarReviewTaskId() == null) {
// 保存车型审查问卷任务 // 保存车型审查问卷任务
TaskCreateRequest createRequest = new TaskCreateRequest(); TaskCreateRequest createRequest = new TaskCreateRequest();
BeanUtils.copyBeanProp(createRequest, request); BeanUtils.copyBeanProp(createRequest, request);
task.setCarReviewTaskId(saveCarReview(createRequest,initiator,standard,leader)); task.setCarReviewTaskId(saveCarReview(createRequest,initiator,standard,leader));
} }
if ( !request.getTaskList().contains(Task.SUB_TASK_GRFIS) && oldTask.getCarReviewTaskId() != null) { if ( !request.getTaskList().contains(Task.SUB_TASK_GRFIS) && task.getCarReviewTaskId() != null) {
carReviewTaskMapper.deleteById(oldTask.getCarReviewTaskId()); carReviewTaskMapper.deleteById(task.getCarReviewTaskId());
task.setCarReviewTaskIdNull();
} }
if(request.getTaskList().contains(Task.SUB_TASK_SRAIF) && oldTask.getSystemReviewTaskId() == null) { if(request.getTaskList().contains(Task.SUB_TASK_SRAIF) && task.getSystemReviewTaskId() == null) {
// 保存体系审查任务 // 保存体系审查任务
TaskCreateRequest createRequest = new TaskCreateRequest(); TaskCreateRequest createRequest = new TaskCreateRequest();
BeanUtils.copyBeanProp(createRequest, request); BeanUtils.copyBeanProp(createRequest, request);
task.setSystemReviewTaskId(saveSystemReview(createRequest,initiator,standard,leader)); task.setSystemReviewTaskId(saveSystemReview(createRequest,initiator,standard,leader));
} }
if ( !request.getTaskList().contains(Task.SUB_TASK_SRAIF) && oldTask.getSystemReviewTaskId() != null) { if ( !request.getTaskList().contains(Task.SUB_TASK_SRAIF) && task.getSystemReviewTaskId() != null) {
systemReviewTaskMapper.deleteById(oldTask.getSystemReviewTaskId()); systemReviewTaskMapper.deleteById(task.getSystemReviewTaskId());
task.setSystemReviewTaskIdNull();
} }
taskStateFacade.doCreate(task, request.getTaskList());
} }
task.setMaxPointer(request.getTaskList().size());
taskService.updateById(task); taskService.updateById(task);
// 构建并保存该任务所关联的审核组信息 // 构建并保存该任务所关联的审核组信息
List<TaskUserRelation> list = taskUserRelationService.selectQTeamMembers(request.getId()); List<TaskUserRelation> list = taskUserRelationService.selectQTeamMembers(request.getId());
taskUserRelationService.removeBatchByIds(list); taskUserRelationService.removeBatchByIds(list);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment