Commit ec1cdab3 authored by W_Y's avatar W_Y

添加待签字状态&确认体系审查问卷接口

parent fc0b7078
...@@ -39,6 +39,8 @@ public class CarReviewTask implements Serializable { ...@@ -39,6 +39,8 @@ public class CarReviewTask implements Serializable {
@TableField(exist = false) @TableField(exist = false)
public static final String REVIEW_STATUS_PENDING = "PENDING"; public static final String REVIEW_STATUS_PENDING = "PENDING";
@TableField(exist = false) @TableField(exist = false)
public static final String REVIEW_STATUS_SIGNED = "SIGNED";
@TableField(exist = false)
public static final String REVIEW_STATUS_FINISH = "FINISH"; public static final String REVIEW_STATUS_FINISH = "FINISH";
......
...@@ -29,6 +29,8 @@ public class SystemReviewTask { ...@@ -29,6 +29,8 @@ public class SystemReviewTask {
@TableField(exist = false) @TableField(exist = false)
public static final String STATUS_PENDING = "PENDING"; public static final String STATUS_PENDING = "PENDING";
@TableField(exist = false) @TableField(exist = false)
public static final String STATUS_SIGNED = "SIGNED";
@TableField(exist = false)
public static final String STATUS_FINISH = "FINISH"; public static final String STATUS_FINISH = "FINISH";
@TableField(exist = false) @TableField(exist = false)
public static final String STATUS_CLOSE = "CLOSE"; public static final String STATUS_CLOSE = "CLOSE";
......
...@@ -7,10 +7,14 @@ public interface StrategySystemReviewTask { ...@@ -7,10 +7,14 @@ public interface StrategySystemReviewTask {
void doStart(SystemReviewTask systemReviewTask); void doStart(SystemReviewTask systemReviewTask);
void doConfirm(SystemReviewTask systemReviewTask);
void doSubmit(SystemReviewTask systemReviewTask); void doSubmit(SystemReviewTask systemReviewTask);
void doClose(SystemReviewTask systemReviewTask); void doClose(SystemReviewTask systemReviewTask);
SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask); SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask);
} }
...@@ -2,6 +2,7 @@ package com.ruoyi.service; ...@@ -2,6 +2,7 @@ package com.ruoyi.service;
import com.ruoyi.domain.SystemReviewTask; import com.ruoyi.domain.SystemReviewTask;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.web.request.SystemReviewTaskConfirmRequest;
import com.ruoyi.web.request.SystemReviewTaskCreateRequest; import com.ruoyi.web.request.SystemReviewTaskCreateRequest;
import com.ruoyi.web.request.SystemReviewTaskStartRequest; import com.ruoyi.web.request.SystemReviewTaskStartRequest;
import com.ruoyi.web.request.SystemReviewTaskSubmitRequest; import com.ruoyi.web.request.SystemReviewTaskSubmitRequest;
...@@ -47,6 +48,12 @@ public interface SystemReviewTaskService extends IService<SystemReviewTask> { ...@@ -47,6 +48,12 @@ public interface SystemReviewTaskService extends IService<SystemReviewTask> {
*/ */
List<SystemReviewTask> findListInProcess(); List<SystemReviewTask> findListInProcess();
/**
* 确认审查问卷
* @param request
*/
void confirm(SystemReviewTaskConfirmRequest request);
/** /**
* 提交审查问卷 * 提交审查问卷
* @param request * @param request
......
...@@ -35,6 +35,11 @@ public class StrategySystemReviewTaskClose implements StrategySystemReviewTask, ...@@ -35,6 +35,11 @@ public class StrategySystemReviewTaskClose implements StrategySystemReviewTask,
throw new ServiceException("不能关闭一个已关闭的任务", HttpStatus.ERROR); throw new ServiceException("不能关闭一个已关闭的任务", HttpStatus.ERROR);
} }
@Override
public void doConfirm(SystemReviewTask systemReviewTask) {
throw new ServiceException("不能确认一个已关闭的任务", HttpStatus.ERROR);
}
// CLOSE状态下 // CLOSE状态下
// 1.standard字段使用task中归档的问卷 // 1.standard字段使用task中归档的问卷
// 2.不查询场景变更任务 // 2.不查询场景变更任务
......
...@@ -35,6 +35,11 @@ public class StrategySystemReviewTaskFinish implements StrategySystemReviewTask, ...@@ -35,6 +35,11 @@ public class StrategySystemReviewTaskFinish implements StrategySystemReviewTask,
throw new ServiceException("不能关闭一个已完成的任务", HttpStatus.ERROR); throw new ServiceException("不能关闭一个已完成的任务", HttpStatus.ERROR);
} }
@Override
public void doConfirm(SystemReviewTask systemReviewTask) {
throw new ServiceException("不能确认一个已完成的任务", HttpStatus.ERROR);
}
// FINISH状态下 // FINISH状态下
// 1.standard字段使用task中归档的问卷 // 1.standard字段使用task中归档的问卷
// 2.不查询场景变更任务 // 2.不查询场景变更任务
......
...@@ -51,6 +51,11 @@ public class StrategySystemReviewTaskNew implements StrategySystemReviewTask, In ...@@ -51,6 +51,11 @@ public class StrategySystemReviewTaskNew implements StrategySystemReviewTask, In
systemReviewTaskMapper.updateById(systemReviewTask); systemReviewTaskMapper.updateById(systemReviewTask);
} }
@Override
public void doConfirm(SystemReviewTask systemReviewTask) {
throw new ServiceException("不能确认一个尚未开始的任务", HttpStatus.ERROR);
}
// NEW状态下 // NEW状态下
// 1.standard字段查询当前最新问卷 // 1.standard字段查询当前最新问卷
// 2.不查询场景变更任务 // 2.不查询场景变更任务
......
...@@ -56,6 +56,18 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -56,6 +56,18 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
@Override @Override
public void doSubmit(SystemReviewTask systemReviewTask) { public void doSubmit(SystemReviewTask systemReviewTask) {
throw new ServiceException("不能提交一个未确认的任务", HttpStatus.ERROR);
}
@Override
public void doClose(SystemReviewTask systemReviewTask) {
systemReviewTask.setTaskEndTime(new Date());
systemReviewTask.setTaskStatus(SystemReviewTask.STATUS_CLOSE);
systemReviewTaskMapper.updateById(systemReviewTask);
}
@Override
public void doConfirm(SystemReviewTask systemReviewTask) {
// TODO // TODO
List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(systemReviewTask.getId()); List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(systemReviewTask.getId());
if (detailsList != null) { if (detailsList != null) {
...@@ -71,17 +83,10 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -71,17 +83,10 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
setDetailsResult(standardTree, results); setDetailsResult(standardTree, results);
systemReviewTask.setStandard(standardTree); systemReviewTask.setStandard(standardTree);
// 4. 填充task_end_time // 4. 修改任务状态为 SIGNED 待签字
systemReviewTask.setTaskEndTime(new Date()); systemReviewTask.setTaskStatus(SystemReviewTask.STATUS_SIGNED);
// 5. 修改任务状态为 FINISH
systemReviewTask.setTaskStatus(SystemReviewTask.STATUS_FINISH); // 5. 设置问卷结果
// 6. 填写当前用户id
// 获取当前登陆人
SysUser loginUser = SecurityUtils.getLoginUser().getUser();
systemReviewTask.setSubmitById(loginUser.getUserId());
systemReviewTask.setSubmitByName(loginUser.getNickName());
// 7. 设置问卷结果
if (reviewDetailsResultMapper.findNotPass(systemReviewTask.getId()) > 0) { if (reviewDetailsResultMapper.findNotPass(systemReviewTask.getId()) > 0) {
systemReviewTask.setTaskResult("REJECT"); systemReviewTask.setTaskResult("REJECT");
} else { } else {
...@@ -89,14 +94,6 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -89,14 +94,6 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
} }
systemReviewTaskMapper.updateById(systemReviewTask); systemReviewTaskMapper.updateById(systemReviewTask);
} }
}
@Override
public void doClose(SystemReviewTask systemReviewTask) {
systemReviewTask.setTaskEndTime(new Date());
systemReviewTask.setTaskStatus(SystemReviewTask.STATUS_CLOSE);
systemReviewTaskMapper.updateById(systemReviewTask);
} }
// PENDING状态下 // PENDING状态下
......
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.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategySystemReviewTask;
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 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;
import java.util.stream.Collectors;
@Transactional
@Service
public class StrategySystemReviewTaskSigned implements StrategySystemReviewTask, InitializingBean {
@Autowired
private StrategySystemReviewTaskContext strategySystemReviewTaskContext;
@Autowired
private ApplicationContext applicationContext;
@Autowired
private SystemReviewTaskMapper systemReviewTaskMapper;
@Override
public void doStart(SystemReviewTask systemReviewTask) {
throw new ServiceException("不能开始一个已确认的任务", HttpStatus.ERROR);
}
@Override
public void doConfirm(SystemReviewTask systemReviewTask) {
throw new ServiceException("不能确认一个已确认的任务", HttpStatus.ERROR);
}
@Override
public void doSubmit(SystemReviewTask systemReviewTask) {
// 1. 填充task_end_time
systemReviewTask.setTaskEndTime(new Date());
// 2. 修改任务状态为 FINISH
systemReviewTask.setTaskStatus(SystemReviewTask.STATUS_FINISH);
// 3. 填写当前用户id
// 获取当前登陆人
SysUser loginUser = SecurityUtils.getLoginUser().getUser();
systemReviewTask.setSubmitById(loginUser.getUserId());
systemReviewTask.setSubmitByName(loginUser.getNickName());
systemReviewTaskMapper.updateById(systemReviewTask);
}
@Override
public void doClose(SystemReviewTask systemReviewTask) {
throw new ServiceException("不能关闭一个已确认的任务", HttpStatus.ERROR);
}
// SIGNED状态下
// 1.standard字段使用task中归档的问卷
// 2.不查询场景变更任务
// 3.无需联查问卷答案
@Override
public SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask) {
SystemReviewTaskViewResponse response = new SystemReviewTaskViewResponse();
response.setSystemReviewTask(systemReviewTask);
return response;
}
@Override
public void afterPropertiesSet() throws Exception {
strategySystemReviewTaskContext.putResource(SystemReviewTask.STATUS_SIGNED, applicationContext.getBean(this.getClass()));
}
}
...@@ -10,6 +10,7 @@ import com.ruoyi.mapper.ReviewDetailsMapper; ...@@ -10,6 +10,7 @@ import com.ruoyi.mapper.ReviewDetailsMapper;
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;
import com.ruoyi.web.request.SystemReviewTaskConfirmRequest;
import com.ruoyi.web.request.SystemReviewTaskCreateRequest; import com.ruoyi.web.request.SystemReviewTaskCreateRequest;
import com.ruoyi.web.request.SystemReviewTaskStartRequest; import com.ruoyi.web.request.SystemReviewTaskStartRequest;
import com.ruoyi.web.request.SystemReviewTaskSubmitRequest; import com.ruoyi.web.request.SystemReviewTaskSubmitRequest;
...@@ -115,6 +116,12 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap ...@@ -115,6 +116,12 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
return systemReviewTaskMapper.findListInProcess(); return systemReviewTaskMapper.findListInProcess();
} }
@Override
public void confirm(SystemReviewTaskConfirmRequest request) {
SystemReviewTask systemReviewTask = systemReviewTaskService.getById(request.getTaskId());
strategySystemReviewTaskContext.getResource(systemReviewTask.getTaskStatus()).doConfirm(systemReviewTask);
}
@Override @Override
public void submit(SystemReviewTaskSubmitRequest request) { public void submit(SystemReviewTaskSubmitRequest request) {
SystemReviewTask systemReviewTask = systemReviewTaskService.getById(request.getTaskId()); SystemReviewTask systemReviewTask = systemReviewTaskService.getById(request.getTaskId());
......
...@@ -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 = "/confirm")
public R<String> confirm(@Validated @RequestBody SystemReviewTaskConfirmRequest request) {
systemReviewTaskService.confirm(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")})
......
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "SystemReviewTaskConfirmRequest", description = "确认体系审查问卷")
@Data
public class SystemReviewTaskConfirmRequest {
@ApiModelProperty("任务id")
private Long taskId;
}
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