Commit 17b83466 authored by W_Y's avatar W_Y

提交问卷审核

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