Commit 621bcde3 authored by 王飞's avatar 王飞

Merge branch 'wangdingyi' into 'dev'

开始总任务,子任务完成修改对应总任务状态

See merge request !62
parents d4347e51 cf150154
......@@ -19,4 +19,8 @@ public interface TaskMapper extends BaseMapper<Task> {
List<TaskFindPendingResponse> findPending(TaskFindPendingRequest request);
List<Task> findFinish(TaskFindFinishRequest request);
Long findByCarReviewTaskId(@Param("carReviewId") Long carReviewId);
Long findBySystemReviewTaskId(@Param("systemReviewId") Long systemReviewId);
}
......@@ -36,4 +36,6 @@ public interface TaskService extends IService<Task> {
void editTask(TaskEditRequest request);
void deleteTask(TaskDeleteRequest request);
void startTask(TaskStartRequest request);
}
......@@ -8,6 +8,7 @@ import com.ruoyi.domain.*;
import com.ruoyi.mapper.CarReviewTaskMapper;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.service.ReviewStandardService;
......@@ -19,6 +20,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.swing.table.TableModel;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -38,6 +40,9 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
@Autowired
private CarReviewTaskMapper carReviewTaskMapper;
@Autowired
private TaskMapper taskMapper;
// SIGNED状态下
// 1.standard字段使用task中归档的问卷
// 2.不查询场景变更任务
......@@ -77,7 +82,12 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
// 4. 保存签名图片地址
carReviewTask.setImagesUrl(imagesUrl);
// 5.再找带该子任务所属的总任务,将总任务的状态由 RUNNING 改回 RUNNABLE
Task task = taskMapper.selectById(taskMapper.findByCarReviewTaskId(carReviewTask.getId()));
task.setTaskStatus(Task.STATUS_RUNNABLE);
carReviewTaskMapper.updateById(carReviewTask);
taskMapper.updateById(task);
}
......
......@@ -8,6 +8,7 @@ import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.service.ReviewStandardService;
......@@ -38,6 +39,9 @@ public class StrategySystemReviewTaskSigned implements StrategySystemReviewTask,
@Autowired
private SystemReviewTaskMapper systemReviewTaskMapper;
@Autowired
private TaskMapper taskMapper;
@Override
public void doStart(SystemReviewTask systemReviewTask) {
......@@ -67,7 +71,12 @@ public class StrategySystemReviewTaskSigned implements StrategySystemReviewTask,
// 4.保存签名图片地址
systemReviewTask.setImagesUrl(imagesUrl);
// 5.再找带该子任务所属的总任务,将总任务的状态由 RUNNING 改回 RUNNABLE
Task task = taskMapper.selectById(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId()));
task.setTaskStatus(Task.STATUS_RUNNABLE);
systemReviewTaskMapper.updateById(systemReviewTask);
taskMapper.updateById(task);
}
@Override
......
......@@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@Transactional
@Service
......@@ -184,6 +185,31 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
taskMapper.deleteById(request.getId());
}
@Override
public void startTask(TaskStartRequest request) {
Task task = taskMapper.selectById(request.getId());
SystemReviewTaskStartRequest systemRequest = new SystemReviewTaskStartRequest();
systemRequest.setTaskId(task.getSystemReviewTaskId());
CarReviewTaskStartRequest carRequest = new CarReviewTaskStartRequest();
carRequest.setTaskId(task.getCarReviewTaskId());
if (Objects.equals(task.getNextNode(), Task.SUB_TASK_SRAIF)) {
systemReviewTaskService.start(systemRequest);
task.setTaskStatus(Task.STATUS_RUNNING);
task.setNextNode(Task.SUB_TASK_GRFIS);
taskMapper.updateById(task);
} else if (Objects.equals(task.getNextNode(), Task.SUB_TASK_GRFIS)) {
carReviewTaskService.startReviewTask(carRequest);
task.setTaskStatus(Task.STATUS_RUNNING);
task.setNextNode(Task.SUB_TASK_TRFIS);
taskMapper.updateById(task);
}
}
public Long saveSystemReview(TaskCreateRequest request,SysUser initiator,Standard standard,TaskUserRelation leader) {
// 构建并保存任务信息
......
......@@ -109,4 +109,15 @@ public class TaskController extends BaseController {
return R.ok();
}
@ApiOperation("开始任务")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "开始任务", businessType = BusinessType.UPDATE)
@RequestMapping(method = RequestMethod.POST, value = "/startTask")
public R<String> startTask(@Validated @RequestBody TaskStartRequest request) {
taskService.startTask(request);
return R.ok();
}
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "TaskStartRequest", description = "开始任务")
@Data
public class TaskStartRequest {
@ApiModelProperty("ID")
private Long id;
}
......@@ -131,6 +131,16 @@
</if>
</where>
</select>
<select id="findByCarReviewTaskId" resultType="java.lang.Long">
SELECT id
FROM t_task
WHERE system_review_task_id = #{systemReviewId}
</select>
<select id="findBySystemReviewTaskId" resultType="java.lang.Long">
SELECT id
FROM t_task
WHERE car_review_task_id = #{carReviewId}
</select>
</mapper>
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