Commit 81c4a376 authored by W_Y's avatar W_Y

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

parent 05780c18
......@@ -185,4 +185,10 @@ public class CarReviewTask implements Serializable {
@ApiModelProperty("车型问卷提交人姓名")
private String reviewSubmitName;
/**
* 车型问卷审查结果
*/
@ApiModelProperty("车型问卷审查结果")
private String reviewResult;
}
......@@ -5,10 +5,8 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.SnowflakeUtil;
import com.ruoyi.domain.CarReviewTask;
import com.ruoyi.domain.ReviewTaskUserRelation;
import com.ruoyi.domain.Standard;
import com.ruoyi.domain.SystemReviewTask;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.service.CarReviewTaskService;
import com.ruoyi.mapper.CarReviewTaskMapper;
import com.ruoyi.service.ReviewTaskUserRelationService;
......@@ -54,6 +52,9 @@ public class CarReviewTaskServiceImpl extends ServiceImpl<CarReviewTaskMapper, C
@Autowired
private StrategyCarReviewTaskContext strategyCarReviewTaskContext;
@Autowired
private ReviewDetailsMapper reviewDetailsMapper;
@Override
public List<CarReviewTask> findListByReviewStatus(String reviewStatus) {
return carReviewTaskMapper.findListByReviewStatus(reviewStatus);
......@@ -123,11 +124,12 @@ public class CarReviewTaskServiceImpl extends ServiceImpl<CarReviewTaskMapper, C
@Override
public void startReviewTask(CarReviewTaskStartRequest request) {
CarReviewTask carReviewTask = carReviewTaskService.getById(request.getTaskId());
strategyCarReviewTaskContext.getResource(carReviewTask.getReviewStatus()).doStartReview(carReviewTask);
}
@Override
public void submitReviewTask(CarReviewTaskSubmitRequest request) {
List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(request.getTaskId());
}
@Override
......
......@@ -4,6 +4,7 @@ import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.CarReviewTask;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.mapper.CarReviewTaskMapper;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategyCarReviewTask;
import com.ruoyi.web.response.CarReviewTaskViewResponse;
......@@ -12,6 +13,7 @@ import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import java.util.Date;
import java.util.List;
public class StrategyCarReviewTaskNew implements StrategyCarReviewTask, InitializingBean {
......@@ -25,6 +27,9 @@ public class StrategyCarReviewTaskNew implements StrategyCarReviewTask, Initiali
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private CarReviewTaskMapper carReviewTaskMapper;
// NEW状态下
// 1.standard字段查询当前最新问卷
......@@ -47,7 +52,9 @@ public class StrategyCarReviewTaskNew implements StrategyCarReviewTask, Initiali
@Override
public void doStartReview(CarReviewTask carReviewTask) {
carReviewTask.setReviewStartTime(new Date());
carReviewTask.setReviewStatus(CarReviewTask.REVIEW_STATUS_PENDING);
carReviewTaskMapper.updateById(carReviewTask);
}
@Override
......
package com.ruoyi.service.impl;
import com.ruoyi.common.constant.HttpStatus;
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.CarReviewTaskMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.ReviewDetailsResultService;
......@@ -16,6 +19,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
......@@ -40,7 +44,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
private ReviewSceneChangeTaskService reviewSceneChangeTaskService;
@Autowired
private SystemReviewTaskMapper systemReviewTaskMapper;
private CarReviewTaskMapper carReviewTaskMapper;
@Autowired
private ReviewDetailsResultMapper reviewDetailsResultMapper;
......@@ -83,6 +87,33 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
@Override
public void doSubmitReview(CarReviewTask carReviewTask) {
// 1. 获取最新问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR);
// 2. 所有细则必须有对应答案
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(carReviewTask.getId());
// 3. 将最终问卷归档到 standard 字段
setDetailsResult(standardTree, results);
carReviewTask.setStandard(standardTree);
// 4. 填充review_submit_time
carReviewTask.setReviewSubmitTime(new Date());
// 5. 修改任务状态为 FINISH
carReviewTask.setReviewStatus(CarReviewTask.REVIEW_STATUS_FINISH);
// 6. 填写当前用户id
// 获取当前登陆人
SysUser loginUser = SecurityUtils.getLoginUser().getUser();
carReviewTask.setReviewSubmitId(loginUser.getUserId());
carReviewTask.setReviewSubmitName(loginUser.getNickName());
// 7. 设置问卷结果
if (reviewDetailsResultMapper.findNotPass(carReviewTask.getId()) > 0) {
carReviewTask.setReviewResult("REJECT");
} else {
carReviewTask.setReviewResult("PASS");
}
carReviewTaskMapper.updateById(carReviewTask);
}
private void setDetailsResult(List<ReviewStandard> standards, List<ReviewDetailsResult> results) {
......
......@@ -28,6 +28,7 @@
<result property="reviewSubmitTime" column="review_submit_time" jdbcType="TIMESTAMP"/>
<result property="reviewSubmitId" column="review_submit_id" jdbcType="BIGINT"/>
<result property="reviewSubmitName" column="review_submit_name" jdbcType="VARCHAR"/>
<result property="reviewResult" column="review_result" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -40,10 +41,11 @@
test_status,review_start_time,
review_submit_time,
review_submit_id,
review_submit_name
review_submit_name,
review_result
</sql>
<select id="findListByReviewStatus" resultType="com.ruoyi.domain.CarReviewTask">
SELECT id,task_no,task_status,task_initiator,task_initiator_dept,task_result,task_begin_time,task_end_time,standard,biz_info,create_time,leader_id,leader,standard_id,name,standard_no,file,review_status,test_status,review_start_time,review_submit_time,review_submit_id,review_submit_name
SELECT id,task_no,task_status,task_initiator,task_initiator_dept,task_result,task_begin_time,task_end_time,standard,biz_info,create_time,leader_id,leader,standard_id,name,standard_no,file,review_status,test_status,review_start_time,review_submit_time,review_submit_id,review_submit_name,review_result
FROM t_system_review_task WHERE review_status = #{reviewStatus} AND task_status = 'PENDING'
</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