Commit a602cf86 authored by 王飞's avatar 王飞

Merge branch 'wangdingyi' into 'dev'

提交审查问卷

See merge request !26
parents bd985bb0 9de8c6f9
...@@ -133,4 +133,14 @@ public class SystemReviewTask { ...@@ -133,4 +133,14 @@ public class SystemReviewTask {
*/ */
private String file; private String file;
/**
* 提交人id
*/
private Long submitById;
/**
* 提交人姓名
*/
private String submitByName;
} }
...@@ -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,7 +121,13 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap ...@@ -114,7 +121,13 @@ 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());
strategySystemReviewTaskContext.getResource(systemReviewTask.getTaskStatus()).doSubmit(systemReviewTask);
}
} }
} }
......
...@@ -61,6 +61,15 @@ public class SystemReviewTaskController extends BaseController { ...@@ -61,6 +61,15 @@ public class SystemReviewTaskController extends BaseController {
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 = "/submit")
public R<String> submit(@Validated @RequestBody SystemReviewTaskSubmitRequest request) {
systemReviewTaskService.submit(request);
return R.ok();
}
@ApiOperation("查询处理中的任务") @ApiOperation("查询处理中的任务")
@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")})
......
...@@ -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>
...@@ -20,16 +20,18 @@ ...@@ -20,16 +20,18 @@
<result property="name" column="name" jdbcType="VARCHAR"/> <result property="name" column="name" jdbcType="VARCHAR"/>
<result property="standardNo" column="standard_no" jdbcType="VARCHAR"/> <result property="standardNo" column="standard_no" jdbcType="VARCHAR"/>
<result property="file" column="file" jdbcType="VARCHAR"/> <result property="file" column="file" jdbcType="VARCHAR"/>
<result property="submitById" column="submit_by_id" jdbcType="BIGINT"/>
<result property="submitByName" column="submit_by_name" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<select id="findListByStatus" resultMap="BaseResultMap"> <select id="findListByStatus" resultMap="BaseResultMap">
SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, biz_info, create_time, standard_id, name, standard_no, file SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, biz_info, create_time, standard_id, name, standard_no, file, submit_by_id, submit_by_name
FROM t_system_review_task WHERE task_status = #{status} FROM t_system_review_task WHERE task_status = #{status}
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
<select id="findListInProcess" resultMap="BaseResultMap"> <select id="findListInProcess" resultMap="BaseResultMap">
SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, biz_info, create_time, standard_id, name, standard_no, file SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, biz_info, create_time, standard_id, name, standard_no, file, submit_by_id, submit_by_name
FROM t_system_review_task WHERE task_status IN ('NEW','PENDING') FROM t_system_review_task WHERE task_status IN ('NEW','PENDING')
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
......
...@@ -170,6 +170,11 @@ public class AjaxResult extends HashMap<String, Object> ...@@ -170,6 +170,11 @@ public class AjaxResult extends HashMap<String, Object>
return new AjaxResult(code, msg, null); return new AjaxResult(code, msg, null);
} }
public static AjaxResult error(int code, String msg, Object data)
{
return new AjaxResult(code, msg, data);
}
/** /**
* 是否为成功消息 * 是否为成功消息
* *
......
...@@ -60,7 +60,7 @@ public class GlobalExceptionHandler ...@@ -60,7 +60,7 @@ public class GlobalExceptionHandler
Integer code = e.getCode(); Integer code = e.getCode();
Object data = e.getData(); Object data = e.getData();
return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage()) : AjaxResult.error(e.getMessage(), data == null ? null : data); return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage(), data == null ? null : data) : AjaxResult.error(e.getMessage(), data == null ? null : data);
} }
/** /**
......
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