Commit dc69b020 authored by W_Y's avatar W_Y

提交体系审查任务

parent 8e7a14ce
...@@ -11,4 +11,11 @@ import java.util.List; ...@@ -11,4 +11,11 @@ import java.util.List;
@Repository @Repository
public interface ReviewDetailsMapper extends BaseMapper<ReviewDetails> { public interface ReviewDetailsMapper extends BaseMapper<ReviewDetails> {
List<ReviewDetails> findByKeyPointList(@Param("reviewKeyPointList") List<ReviewKeyPoint> reviewKeyPointList); List<ReviewDetails> findByKeyPointList(@Param("reviewKeyPointList") List<ReviewKeyPoint> reviewKeyPointList);
/**
* 根据任务id查询没有回答细则的数量
* @param taskId
* @return
*/
List<ReviewDetails> findNoResult(@Param("taskId") Long taskId);
} }
...@@ -20,6 +20,11 @@ public interface ReviewDetailsResultMapper extends BaseMapper<ReviewDetailsResul ...@@ -20,6 +20,11 @@ public interface ReviewDetailsResultMapper extends BaseMapper<ReviewDetailsResul
ReviewDetailsResult findByTaskIdAndDetailsId(@Param("taskId") Long taskId,@Param("reviewDetailsId") Long reviewDetailsId); ReviewDetailsResult findByTaskIdAndDetailsId(@Param("taskId") Long taskId,@Param("reviewDetailsId") Long reviewDetailsId);
/**
* 根据任务id查询不通过的数量
* @param taskId
* @return
*/
Long findNotPass(@Param("taskId") Long taskId); Long findNotPass(@Param("taskId") Long taskId);
} }
......
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
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.domain.*; import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper; import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.*; import com.ruoyi.service.*;
import com.ruoyi.web.response.SystemReviewTaskViewResponse; import com.ruoyi.web.response.SystemReviewTaskViewResponse;
...@@ -32,6 +35,10 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -32,6 +35,10 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
@Autowired @Autowired
private SystemReviewTaskMapper systemReviewTaskMapper; private SystemReviewTaskMapper systemReviewTaskMapper;
@Autowired
private ReviewDetailsResultMapper reviewDetailsResultMapper;
@Override @Override
public void doStart(SystemReviewTask systemReviewTask) { public void doStart(SystemReviewTask systemReviewTask) {
throw new ServiceException("不能开始一个已经开始的任务", HttpStatus.ERROR); throw new ServiceException("不能开始一个已经开始的任务", HttpStatus.ERROR);
...@@ -41,11 +48,33 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -41,11 +48,33 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
public void doSubmit(SystemReviewTask systemReviewTask) { public void doSubmit(SystemReviewTask systemReviewTask) {
// TODO // TODO
// 1. 获取最新问卷 // 1. 获取最新问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(systemReviewTask.getStandardId(), ReviewStandard.TYPE_SYSTEM);
// 2. 所有细则必须有对应答案 // 2. 所有细则必须有对应答案
// 3. 答案的 id + text 必须与细则对应的答案一致 List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(systemReviewTask.getId());
// 4. 将最终问卷归档到 standard 字段
// 5. 填充task_end_time // 3. 将最终问卷归档到 standard 字段
// 6. 修改任务状态为 FINISH setDetailsResult(standardTree, results);
systemReviewTask.setStandard(standardTree);
// 4. 填充task_end_time
systemReviewTask.setTaskEndTime(new Date());
// 5. 修改任务状态为 FINISH
systemReviewTask.setTaskStatus(SystemReviewTask.STATUS_FINISH);
// 6. 填写当前用户id
// 获取当前登陆人
SysUser loginUser = SecurityUtils.getLoginUser().getUser();
systemReviewTask.setSubmitById(loginUser.getUserId());
systemReviewTask.setSubmitByName(loginUser.getNickName());
// 7. 设置问卷结果
if (reviewDetailsResultMapper.findNotPass(systemReviewTask.getId()) > 0) {
systemReviewTask.setTaskResult("REJECT");
} else {
systemReviewTask.setTaskResult("PASS");
}
systemReviewTaskMapper.updateById(systemReviewTask);
} }
@Override @Override
......
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.SnowflakeUtil; import com.ruoyi.common.utils.SnowflakeUtil;
import com.ruoyi.domain.*; import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper; import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.*; import com.ruoyi.service.*;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
...@@ -46,6 +50,9 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap ...@@ -46,6 +50,9 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
@Autowired @Autowired
private StandardService standardService; private StandardService standardService;
@Autowired
private ReviewDetailsMapper reviewDetailsMapper;
@Override @Override
public void createTaskTest(SystemReviewTaskCreateRequest request) { public void createTaskTest(SystemReviewTaskCreateRequest request) {
...@@ -114,8 +121,13 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap ...@@ -114,8 +121,13 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
@Override @Override
public void submit(SystemReviewTaskSubmitRequest request) { public void submit(SystemReviewTaskSubmitRequest request) {
SystemReviewTask systemReviewTask = systemReviewTaskService.getById(request.getTaskId()); List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(request.getTaskId());
strategySystemReviewTaskContext.getResource(systemReviewTask.getTaskStatus()).doSubmit(systemReviewTask); if (detailsList != null) {
throw new ServiceException("存在未填写的问卷,请填写完整", HttpStatus.ERROR);
} else {
SystemReviewTask systemReviewTask = systemReviewTaskService.getById(request.getTaskId());
strategySystemReviewTaskContext.getResource(systemReviewTask.getTaskStatus()).doSubmit(systemReviewTask);
}
} }
} }
......
...@@ -13,4 +13,8 @@ ...@@ -13,4 +13,8 @@
</foreach> </foreach>
</select> </select>
<select id="findNoResult" resultType="com.ruoyi.domain.ReviewDetails">
SELECT * FROM t_review_details WHERE id NOT IN (SELECT review_details_id FROM t_review_details_result WHERE task_id = #{taskId})
</select>
</mapper> </mapper>
...@@ -33,8 +33,4 @@ ...@@ -33,8 +33,4 @@
WHERE passed = 0 AND task_id = #{taskId} WHERE passed = 0 AND task_id = #{taskId}
</select> </select>
<select id="findNoResult" resultType="long">
SELECT COUNT(*) sum FROM t_review_details_result
WHERE passed is null AND task_id = #{taskId}
</select>
</mapper> </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