Commit 4b3c5ee5 authored by W_Y's avatar W_Y

开始一个车辆审查任务中的问卷任务

parent 7dad8312
...@@ -6,4 +6,8 @@ import com.ruoyi.web.response.CarReviewTaskViewResponse; ...@@ -6,4 +6,8 @@ import com.ruoyi.web.response.CarReviewTaskViewResponse;
public interface StrategyCarReviewTask { public interface StrategyCarReviewTask {
CarReviewTaskViewResponse doView(CarReviewTask carReviewTask); CarReviewTaskViewResponse doView(CarReviewTask carReviewTask);
void doStartReview(CarReviewTask carReviewTask);
void doSubmitReview(CarReviewTask carReviewTask);
} }
package com.ruoyi.service.impl;
import com.ruoyi.domain.CarReviewTask;
import com.ruoyi.service.StrategyCarReviewTask;
import com.ruoyi.web.response.CarReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
public class StrategyCarReviewTaskFinish implements StrategyCarReviewTask, InitializingBean {
@Autowired
private StrategyCarReviewTaskContext strategyCarReviewTaskContext;
@Autowired
private ApplicationContext applicationContext;
// FINISH状态下
// 1.standard字段使用task中归档的问卷
// 2.不查询场景变更任务
// 3.无需联查问卷答案
@Override
public CarReviewTaskViewResponse doView(CarReviewTask carReviewTask) {
CarReviewTaskViewResponse response = new CarReviewTaskViewResponse();
response.setCarReviewTask(carReviewTask);
return response;
}
@Override
public void doStartReview(CarReviewTask carReviewTask) {
}
@Override
public void doSubmitReview(CarReviewTask carReviewTask) {
}
@Override
public void afterPropertiesSet() throws Exception {
strategyCarReviewTaskContext.putResource(CarReviewTask.REVIEW_STATUS_FINISH, applicationContext.getBean(this.getClass()));
}
}
package com.ruoyi.service.impl;
import com.ruoyi.domain.CarReviewTask;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategyCarReviewTask;
import com.ruoyi.web.response.CarReviewTaskViewResponse;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import java.util.List;
public class StrategyCarReviewTaskNew implements StrategyCarReviewTask, InitializingBean {
@Autowired
private StrategyCarReviewTaskContext strategyCarReviewTaskContext;
@Autowired
private ApplicationContext applicationContext;
@Autowired
private ReviewStandardService reviewStandardService;
// NEW状态下
// 1.standard字段查询当前最新问卷
// 2.不查询场景变更任务
// 3.无需联查问卷答案
@Override
public CarReviewTaskViewResponse doView(CarReviewTask carReviewTask) {
// 获取最新问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR);
// 将问卷赋值到任务
carReviewTask.setStandard(standardTree);
// 生成返回结果
CarReviewTaskViewResponse response = new CarReviewTaskViewResponse();
response.setCarReviewTask(carReviewTask);
return response;
}
@Override
public void doStartReview(CarReviewTask carReviewTask) {
}
@Override
public void doSubmitReview(CarReviewTask carReviewTask) {
}
@Override
public void afterPropertiesSet() throws Exception {
strategyCarReviewTaskContext.putResource(CarReviewTask.REVIEW_STATUS_NEW, applicationContext.getBean(this.getClass()));
}
}
package com.ruoyi.service.impl;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.CarReviewTask;
import com.ruoyi.service.StrategyCarReviewTask;
import com.ruoyi.web.response.CarReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
public class StrategyCarReviewTaskNone implements StrategyCarReviewTask, InitializingBean {
@Autowired
private StrategyCarReviewTaskContext strategyCarReviewTaskContext;
@Autowired
private ApplicationContext applicationContext;
@Override
public CarReviewTaskViewResponse doView(CarReviewTask carReviewTask) {
throw new ServiceException("不能查看一个不存在的任务", HttpStatus.ERROR);
}
@Override
public void doStartReview(CarReviewTask carReviewTask) {
}
@Override
public void doSubmitReview(CarReviewTask carReviewTask) {
}
@Override
public void afterPropertiesSet() throws Exception {
strategyCarReviewTaskContext.putResource(CarReviewTask.REVIEW_STATUS_NONE, applicationContext.getBean(this.getClass()));
}
}
...@@ -73,6 +73,16 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -73,6 +73,16 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
return response; return response;
} }
@Override
public void doStartReview(CarReviewTask carReviewTask) {
}
@Override
public void doSubmitReview(CarReviewTask 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));
...@@ -92,6 +102,6 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -92,6 +102,6 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
strategyCarReviewTaskContext.putResource(CarReviewTask.TASK_STATUS_PENDING, applicationContext.getBean(this.getClass())); strategyCarReviewTaskContext.putResource(CarReviewTask.REVIEW_STATUS_PENDING, applicationContext.getBean(this.getClass()));
} }
} }
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