Commit 17b83466 authored by W_Y's avatar W_Y

提交问卷审核

parent fdccaf92
......@@ -131,15 +131,10 @@ public class CarReviewTaskServiceImpl extends ServiceImpl<CarReviewTaskMapper, C
@Override
public void submitReviewTask(CarReviewTaskSubmitRequest request) {
List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(request.getTaskId());
if (detailsList != null) {
throw new ServiceException("存在未填写的问卷,请填写完整", HttpStatus.ERROR, detailsList);
} else {
CarReviewTask carReviewTask = carReviewTaskService.getById(request.getTaskId());
strategyCarReviewTaskContext.getResource(carReviewTask.getReviewStatus()).doSubmitReview(carReviewTask);
}
}
@Override
public List<CarReviewTask> findListByStatus(String status) {
......
......@@ -6,6 +6,7 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.CarReviewTaskMapper;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.ReviewDetailsResultService;
......@@ -49,6 +50,9 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
@Autowired
private ReviewDetailsResultMapper reviewDetailsResultMapper;
@Autowired
private ReviewDetailsMapper reviewDetailsMapper;
// PENDING状态下
// 1.standard字段查询当前最新问卷
// 2.查询场景变更任务
......@@ -87,6 +91,11 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
@Override
public void doSubmitReview(CarReviewTask carReviewTask) {
List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(carReviewTask.getId());
if (detailsList != null) {
throw new ServiceException("存在未填写的问卷,请填写完整", HttpStatus.ERROR, detailsList);
} else {
// 1. 获取最新问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR);
......@@ -116,6 +125,8 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
carReviewTaskMapper.updateById(carReviewTask);
}
}
private void setDetailsResult(List<ReviewStandard> standards, List<ReviewDetailsResult> results) {
Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1));
......
......@@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.*;
......@@ -45,6 +46,9 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
@Autowired
private ReviewDetailsResultMapper reviewDetailsResultMapper;
@Autowired
private ReviewDetailsMapper reviewDetailsMapper;
@Override
public void doStart(SystemReviewTask systemReviewTask) {
throw new ServiceException("不能开始一个已经开始的任务", HttpStatus.ERROR);
......@@ -53,6 +57,10 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
@Override
public void doSubmit(SystemReviewTask systemReviewTask) {
// TODO
List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(systemReviewTask.getId());
if (detailsList != null) {
throw new ServiceException("存在未填写的问卷,请填写完整", HttpStatus.ERROR, detailsList);
} else {
// 1. 获取最新问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(systemReviewTask.getStandardId(), ReviewStandard.TYPE_SYSTEM);
......@@ -80,6 +88,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
systemReviewTask.setTaskResult("PASS");
}
systemReviewTaskMapper.updateById(systemReviewTask);
}
}
......
......@@ -120,14 +120,9 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
@Override
public void submit(SystemReviewTaskSubmitRequest request) {
List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(request.getTaskId());
if (detailsList != null) {
throw new ServiceException("存在未填写的问卷,请填写完整", HttpStatus.ERROR, detailsList);
} else {
SystemReviewTask systemReviewTask = systemReviewTaskService.getById(request.getTaskId());
strategySystemReviewTaskContext.getResource(systemReviewTask.getTaskStatus()).doSubmit(systemReviewTask);
}
}
}
......
......@@ -5,10 +5,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.service.CarReviewTaskService;
import com.ruoyi.web.request.CarReviewTaskCreateRequest;
import com.ruoyi.web.request.CarReviewTaskStartRequest;
import com.ruoyi.web.request.CarReviewTaskViewRequest;
import com.ruoyi.web.request.SystemReviewTaskViewRequest;
import com.ruoyi.web.request.*;
import com.ruoyi.web.response.CarReviewTaskViewResponse;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import io.swagger.annotations.Api;
......@@ -54,10 +51,19 @@ public class CarReviewTaskController extends BaseController {
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/startReview")
public R<String>startReview(@Validated @RequestBody CarReviewTaskStartRequest request) {
public R<String> startReview(@Validated @RequestBody CarReviewTaskStartRequest request) {
carReviewTaskService.startReviewTask(request);
return R.ok();
}
@ApiOperation("提交车辆问卷审查任务")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/submitReview")
public R<String> submitReview(@Validated @RequestBody CarReviewTaskSubmitRequest request) {
carReviewTaskService.submitReviewTask(request);
return R.ok();
}
}
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