Commit 3b05cea6 authored by 王飞's avatar 王飞

Feat

1、实现审查任务在不同的状态下具有不同的view行为。

Reference N/A
parent 6d9e40c3
package com.ruoyi.domain; package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
...@@ -38,7 +37,7 @@ public class ReviewDetailsResult implements Serializable { ...@@ -38,7 +37,7 @@ public class ReviewDetailsResult implements Serializable {
/** /**
* 厂商适用于该细则的场景截图或照片(多个url用","分隔) * 厂商适用于该细则的场景截图或照片(多个url用","分隔)
*/ */
private String imagesurl; private String imagesUrl;
/** /**
* 关联到的细则id * 关联到的细则id
......
...@@ -19,6 +19,17 @@ import lombok.experimental.Accessors; ...@@ -19,6 +19,17 @@ import lombok.experimental.Accessors;
@Accessors(chain = true) @Accessors(chain = true)
@Data @Data
public class SystemReviewTask { public class SystemReviewTask {
@TableField(exist = false)
public static final String STATUS_NEW = "NEW";
@TableField(exist = false)
public static final String STATUS_PENDING = "PENDING";
@TableField(exist = false)
public static final String STATUS_FINISH = "FINISH";
@TableField(exist = false)
public static final String STATUS_CLOSE = "CLOSE";
/** /**
* 主键 * 主键
*/ */
...@@ -45,11 +56,6 @@ public class SystemReviewTask { ...@@ -45,11 +56,6 @@ public class SystemReviewTask {
*/ */
private String taskInitiatorDept; private String taskInitiatorDept;
/**
* 任务发起人岗位
*/
private String taskInitiatorOrg;
/** /**
* 任务结果(PASS、REJECT) * 任务结果(PASS、REJECT)
*/ */
...@@ -66,7 +72,7 @@ public class SystemReviewTask { ...@@ -66,7 +72,7 @@ public class SystemReviewTask {
private Date taskEndTime; private Date taskEndTime;
/** /**
* 审查标准归档 * 审查标准
*/ */
@TableField(value="standard", typeHandler = StandardJsonTypeHandler. class) @TableField(value="standard", typeHandler = StandardJsonTypeHandler. class)
private List<ReviewStandard> standard; private List<ReviewStandard> standard;
......
...@@ -16,7 +16,7 @@ import java.util.List; ...@@ -16,7 +16,7 @@ import java.util.List;
@Repository @Repository
public interface ReviewDetailsResultMapper extends BaseMapper<ReviewDetailsResult> { public interface ReviewDetailsResultMapper extends BaseMapper<ReviewDetailsResult> {
List<ReviewDetailsResult> findByTaskNo(@Param("taskNo") String taskNo); List<ReviewDetailsResult> findByTaskId(@Param("taskId") Long taskId);
} }
......
...@@ -3,6 +3,9 @@ package com.ruoyi.mapper; ...@@ -3,6 +3,9 @@ package com.ruoyi.mapper;
import com.ruoyi.domain.ReviewSceneChangeTask; import com.ruoyi.domain.ReviewSceneChangeTask;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.Date;
import java.util.List;
/** /**
* @author wangfei * @author wangfei
* @description 针对表【t_review_scene_change_task(审查场景变更任务)】的数据库操作Mapper * @description 针对表【t_review_scene_change_task(审查场景变更任务)】的数据库操作Mapper
...@@ -11,6 +14,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -11,6 +14,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface ReviewSceneChangeTaskMapper extends BaseMapper<ReviewSceneChangeTask> { public interface ReviewSceneChangeTaskMapper extends BaseMapper<ReviewSceneChangeTask> {
List<ReviewSceneChangeTask> findLastChangeByAfterTime(Date date);
} }
......
...@@ -12,6 +12,6 @@ import java.util.List; ...@@ -12,6 +12,6 @@ import java.util.List;
*/ */
public interface ReviewDetailsResultService extends IService<ReviewDetailsResult> { public interface ReviewDetailsResultService extends IService<ReviewDetailsResult> {
List<ReviewDetailsResult> findByTaskNo(String taskNo); List<ReviewDetailsResult> findByTaskId(Long taskId);
} }
...@@ -3,6 +3,9 @@ package com.ruoyi.service; ...@@ -3,6 +3,9 @@ package com.ruoyi.service;
import com.ruoyi.domain.ReviewSceneChangeTask; import com.ruoyi.domain.ReviewSceneChangeTask;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Date;
import java.util.List;
/** /**
* @author wangfei * @author wangfei
* @description 针对表【t_review_scene_change_task(审查场景变更任务)】的数据库操作Service * @description 针对表【t_review_scene_change_task(审查场景变更任务)】的数据库操作Service
...@@ -35,4 +38,11 @@ public interface ReviewSceneChangeTaskService extends IService<ReviewSceneChange ...@@ -35,4 +38,11 @@ public interface ReviewSceneChangeTaskService extends IService<ReviewSceneChange
*/ */
void close(Long taskId); void close(Long taskId);
/**
* 获取指定时间之后的每个场景的最后变更记录
* @param date
* @return
*/
List<ReviewSceneChangeTask> findLastChangeByAfterTime(Date date);
} }
package com.ruoyi.service;
import com.ruoyi.domain.SystemReviewTask;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
public interface StrategySystemReviewTask {
SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask);
}
...@@ -2,8 +2,8 @@ package com.ruoyi.service; ...@@ -2,8 +2,8 @@ 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.SystemReviewTaskCreateRequest;
import java.util.List; import com.ruoyi.web.response.SystemReviewTaskViewResponse;
/** /**
* @author wangfei * @author wangfei
...@@ -12,8 +12,17 @@ import java.util.List; ...@@ -12,8 +12,17 @@ import java.util.List;
*/ */
public interface SystemReviewTaskService extends IService<SystemReviewTask> { public interface SystemReviewTaskService extends IService<SystemReviewTask> {
void createTaskTest(String bizInfo, List<Long> userIds); /**
* 创建一个体系审查任务
* @param request
*/
void createTaskTest(SystemReviewTaskCreateRequest request);
SystemReviewTask loadTaskById(Long id); /**
* 查看
* @param taskId
* @return
*/
SystemReviewTaskViewResponse view(Long taskId);
} }
...@@ -17,15 +17,14 @@ import java.util.List; ...@@ -17,15 +17,14 @@ import java.util.List;
*/ */
@Transactional @Transactional
@Service @Service
public class ReviewDetailsResultServiceImpl extends ServiceImpl<ReviewDetailsResultMapper, ReviewDetailsResult> public class ReviewDetailsResultServiceImpl extends ServiceImpl<ReviewDetailsResultMapper, ReviewDetailsResult> implements ReviewDetailsResultService {
implements ReviewDetailsResultService{
@Autowired @Autowired
private ReviewDetailsResultMapper reviewDetailsResultMapper; private ReviewDetailsResultMapper reviewDetailsResultMapper;
@Override @Override
public List<ReviewDetailsResult> findByTaskNo(String taskNo) { public List<ReviewDetailsResult> findByTaskId(Long taskId) {
return reviewDetailsResultMapper.findByTaskNo(taskNo); return reviewDetailsResultMapper.findByTaskId(taskId);
} }
} }
......
...@@ -41,6 +41,9 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha ...@@ -41,6 +41,9 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha
@Autowired @Autowired
private ReviewSceneService reviewSceneService; private ReviewSceneService reviewSceneService;
@Autowired
private ReviewSceneChangeTaskMapper reviewSceneChangeTaskMapper;
@Override @Override
public void create(ReviewSceneChangeTask reviewSceneChangeTask) { public void create(ReviewSceneChangeTask reviewSceneChangeTask) {
...@@ -127,6 +130,11 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha ...@@ -127,6 +130,11 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha
ReviewSceneChangeTask task = getById(taskId); ReviewSceneChangeTask task = getById(taskId);
} }
@Override
public List<ReviewSceneChangeTask> findLastChangeByAfterTime(Date date) {
return reviewSceneChangeTaskMapper.findLastChangeByAfterTime(date);
}
private void checkTaskStatus(String status) { private void checkTaskStatus(String status) {
if(status != null && ReviewSceneChangeTask.STATUS_FINISH.equals(status)) { if(status != null && ReviewSceneChangeTask.STATUS_FINISH.equals(status)) {
throw new ServiceException("不能处理一个已经完成的任务", HttpStatus.ERROR); throw new ServiceException("不能处理一个已经完成的任务", HttpStatus.ERROR);
......
package com.ruoyi.service.impl;
import com.ruoyi.service.StrategySystemReviewTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Transactional
@Service
public class StateSystemReviewTaskContext {
@Autowired
private final Map<String, StrategySystemReviewTask> resourceMap = new ConcurrentHashMap<>();
public StateSystemReviewTaskContext(Map<String, StrategySystemReviewTask> strategyMap) {
this.resourceMap.clear();
strategyMap.forEach(resourceMap::put);
}
public StrategySystemReviewTask getResource(String operation){
return resourceMap.get(operation);
}
}
package com.ruoyi.service.impl;
import com.ruoyi.domain.SystemReviewTask;
import com.ruoyi.service.StrategySystemReviewTask;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Transactional
@Service(SystemReviewTask.STATUS_CLOSE)
public class StrategySystemReviewTaskClose implements StrategySystemReviewTask {
// CLOSE状态下
// 1.standard字段使用task中归档的问卷
// 2.不查询场景变更任务
// 3.无需联查问卷答案
@Override
public SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask) {
SystemReviewTaskViewResponse response = new SystemReviewTaskViewResponse();
response.setSystemReviewTask(systemReviewTask);
return response;
}
}
package com.ruoyi.service.impl;
import com.ruoyi.domain.SystemReviewTask;
import com.ruoyi.service.StrategySystemReviewTask;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Transactional
@Service(SystemReviewTask.STATUS_FINISH)
public class StrategySystemReviewTaskFinish implements StrategySystemReviewTask {
// FINISH状态下
// 1.standard字段使用task中归档的问卷
// 2.不查询场景变更任务
// 3.无需联查问卷答案
@Override
public SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask) {
SystemReviewTaskViewResponse response = new SystemReviewTaskViewResponse();
response.setSystemReviewTask(systemReviewTask);
return response;
}
}
package com.ruoyi.service.impl;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.domain.SystemReviewTask;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategySystemReviewTask;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Transactional
@Service(SystemReviewTask.STATUS_NEW)
public class StrategySystemReviewTaskNew implements StrategySystemReviewTask {
@Autowired
private ReviewStandardService reviewStandardService;
// NEW状态下
// 1.standard字段查询当前最新问卷
// 2.不查询场景变更任务
// 3.无需联查问卷答案
@Override
public SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask) {
// 获取最新问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree();
// 将问卷赋值到任务
systemReviewTask.setStandard(standardTree);
// 生成返回结果
SystemReviewTaskViewResponse response = new SystemReviewTaskViewResponse();
response.setSystemReviewTask(systemReviewTask);
return response;
}
}
package com.ruoyi.service.impl;
import com.ruoyi.domain.*;
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.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@Transactional
@Service(SystemReviewTask.STATUS_PENDING)
public class StrategySystemReviewTaskPending implements StrategySystemReviewTask {
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private ReviewDetailsResultService reviewDetailsResultService;
@Autowired
private ReviewSceneChangeTaskService reviewSceneChangeTaskService;
// PENDING状态下
// 1.standard字段查询当前最新问卷
// 2.查询场景变更任务
// 3.需要联查问卷答案
@Override
public SystemReviewTaskViewResponse doView(SystemReviewTask systemReviewTask) {
// 获取最新问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree();
// 获取当前问卷答案
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(systemReviewTask.getId());
// 绑定问卷与答案
setDetailsResult(standardTree, results);
// 赋值给任务
systemReviewTask.setStandard(standardTree);
// 查询场景变更任务便于提醒用户场景变动
List<ReviewSceneChangeTask> lastChanges = reviewSceneChangeTaskService.findLastChangeByAfterTime(systemReviewTask.getTaskBeginTime());
// 构建返回结果
SystemReviewTaskViewResponse response = new SystemReviewTaskViewResponse();
response.setSystemReviewTask(systemReviewTask);
response.setReviewSceneChangeTasks(lastChanges);
return response;
}
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));
for(ReviewStandard standard : standards) {
List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
for(ReviewKeyPoint keypoint : keyPointList) {
List<ReviewDetails> reviewDetailsList = keypoint.getReviewDetailsList();
for(ReviewDetails details : reviewDetailsList) {
details.setResult(resultMap.get(details.getId()));
}
}
}
}
}
...@@ -6,12 +6,11 @@ import com.ruoyi.common.core.domain.model.LoginUser; ...@@ -6,12 +6,11 @@ import com.ruoyi.common.core.domain.model.LoginUser;
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.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper; import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.ReviewStandardService; import com.ruoyi.service.*;
import com.ruoyi.service.SystemReviewTaskService;
import com.ruoyi.service.SystemReviewTaskUserRelationService;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.web.request.SystemReviewTaskCreateRequest;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -20,8 +19,6 @@ import java.util.*; ...@@ -20,8 +19,6 @@ import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static java.util.stream.Collectors.toList;
/** /**
* @author wangfei * @author wangfei
* @description 针对表【t_system_review_task(体系审查任务)】的数据库操作Service实现 * @description 针对表【t_system_review_task(体系审查任务)】的数据库操作Service实现
...@@ -29,104 +26,71 @@ import static java.util.stream.Collectors.toList; ...@@ -29,104 +26,71 @@ import static java.util.stream.Collectors.toList;
*/ */
@Transactional @Transactional
@Service @Service
public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMapper, SystemReviewTask> implements SystemReviewTaskService{ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMapper, SystemReviewTask> implements SystemReviewTaskService {
@Autowired
private SystemReviewTaskUserRelationService systemReviewTaskUserRelationService;
@Autowired @Autowired
private ReviewDetailsResultMapper reviewDetailsResultMapper; private SystemReviewTaskService systemReviewTaskService;
@Autowired @Autowired
private ReviewStandardService reviewStandardService; private ReviewStandardService reviewStandardService;
@Autowired @Autowired
private SystemReviewTaskUserRelationService systemReviewTaskUserRelationService; private ReviewDetailsResultService reviewDetailsResultService;
@Autowired @Autowired
private SystemReviewTaskService systemReviewTaskService; private StateSystemReviewTaskContext stateSystemReviewTaskContext;
@Autowired @Autowired
private ISysUserService sysUserService; private ISysUserService sysUserService;
@Override @Override
public void createTaskTest(String bizInfo, List<Long> userIds) { public void createTaskTest(SystemReviewTaskCreateRequest request) {
// 构建任务创建者 // 构建任务创建者
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser initiator = sysUserService.selectUserById(loginUser.getUserId()); SysUser initiator = sysUserService.selectUserById(loginUser.getUserId());
// 构建任务参与者 // 找到审查组长
Long leaderId = userIds.get(0); SystemReviewTaskUserRelation leader = null;
List<SysUser> sysUsers = sysUserService.selectUserListByIds(userIds); List<SystemReviewTaskUserRelation> auditors = request.getAuditors();
SysUser leader = null; for(SystemReviewTaskUserRelation auditor : auditors) {
for(SysUser sysUser : sysUsers) { if(auditor.getIsLeader() == 1) {
if(sysUser.getUserId().equals(leaderId)) { leader = auditor;
leader = sysUser; break;
} }
} }
// 构建并保存任务信息 // 构建并保存任务信息
List<ReviewStandard> allStandardTree = reviewStandardService.findTree();
SystemReviewTask task = new SystemReviewTask() SystemReviewTask task = new SystemReviewTask()
.setNo(SnowflakeUtil.generate().toString()) .setTaskNo(SnowflakeUtil.generate().toString())
.setTaskInitiator(initiator.getNickName()) .setTaskInitiator(initiator.getNickName())
.setTaskInitiatorDept(initiator.getDept().getDeptName()) .setTaskInitiatorDept(initiator.getDept().getDeptName())
.setTaskStatus("NEW") .setTaskStatus(SystemReviewTask.STATUS_NEW)
.setBizInfo(bizInfo) .setBizInfo(request.getBizInfo())
.setLeaderId(leaderId) .setLeaderId(leader.getUserId())
.setLeader(leader.getNickName()) .setLeader(leader.getName())
.setCreateTime(new Date()) .setCreateTime(new Date());
.setStandard(allStandardTree);
systemReviewTaskService.save(task); systemReviewTaskService.save(task);
// 构建并保存该任务所关联的审核组信息 // 构建并保存该任务所关联的审核组信息
List<SystemReviewTaskUserRelation> relations = new ArrayList(); for(SystemReviewTaskUserRelation auditor : auditors) {
auditor.setTaskId(task.getId());
for(SysUser sysUser : sysUsers) {
SystemReviewTaskUserRelation relation = new SystemReviewTaskUserRelation()
.setTaskId(task.getId())
.setUserId(sysUser.getUserId())
.setName(sysUser.getNickName())
.setIsLeader(sysUser.getUserId().equals(leaderId) ? 1 : 0);
relations.add(relation);
} }
systemReviewTaskUserRelationService.saveBatch(auditors);
systemReviewTaskUserRelationService.saveBatch(relations);
} }
@Override @Override
public SystemReviewTask loadTaskById(Long id) { public SystemReviewTaskViewResponse view(Long taskId) {
SystemReviewTask systemReviewTask = systemReviewTaskService.getById(taskId);
// 根据id获取体系审查任务 return stateSystemReviewTaskContext.getResource(systemReviewTask.getTaskStatus()).doView(systemReviewTask);
SystemReviewTask task = getById(id);
// 构建该任务的问卷与答案
List<ReviewStandard> standard = task.getStandard();
List<ReviewDetailsResult> results = reviewDetailsResultMapper.findByTaskNo(task.getNo());
setDetailsResult(standard, results);
// 返回任务
return task;
} }
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));
for(ReviewStandard standard : standards) {
List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
for(ReviewKeyPoint keypoint : keyPointList) {
List<ReviewDetails> reviewDetailsList = keypoint.getReviewDetailsList();
for(ReviewDetails details : reviewDetailsList) {
details.setResult(resultMap.get(details.getId()));
}
}
}
}
} }
......
...@@ -5,7 +5,9 @@ import com.ruoyi.common.core.controller.BaseController; ...@@ -5,7 +5,9 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.service.SystemReviewTaskService; import com.ruoyi.service.SystemReviewTaskService;
import com.ruoyi.web.request.CreateSystemReviewTaskRequest; import com.ruoyi.web.request.SystemReviewTaskCreateRequest;
import com.ruoyi.web.request.SystemReviewTaskViewRequest;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.apache.skywalking.apm.toolkit.trace.Tag; import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags; import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace; import org.apache.skywalking.apm.toolkit.trace.Trace;
...@@ -27,9 +29,17 @@ public class SystemReviewTaskController extends BaseController { ...@@ -27,9 +29,17 @@ public class SystemReviewTaskController extends BaseController {
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "体系审查任务", businessType = BusinessType.INSERT) @Log(title = "体系审查任务", businessType = BusinessType.INSERT)
@RequestMapping(method = RequestMethod.POST, value = "/create") @RequestMapping(method = RequestMethod.POST, value = "/create")
public AjaxResult create(@Validated @RequestBody CreateSystemReviewTaskRequest request) { public AjaxResult create(@Validated @RequestBody SystemReviewTaskCreateRequest request) {
systemReviewTaskService.createTaskTest(request.getBizInfo(), request.getUserIds()); systemReviewTaskService.createTaskTest(request);
return success(); return success();
} }
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/view")
public AjaxResult view(@Validated @RequestBody SystemReviewTaskViewRequest request) {
SystemReviewTaskViewResponse systemReviewTaskViewResponse = systemReviewTaskService.view(request.getTaskId());
return AjaxResult.success(systemReviewTaskViewResponse);
}
} }
package com.ruoyi.web.request; package com.ruoyi.web.request;
import com.ruoyi.domain.SystemReviewTaskUserRelation;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@Data @Data
public class CreateSystemReviewTaskRequest { public class SystemReviewTaskCreateRequest {
private String bizInfo; private String bizInfo;
private List<Long> userIds; private List<SystemReviewTaskUserRelation> auditors;
} }
package com.ruoyi.web.request;
import lombok.Data;
@Data
public class SystemReviewTaskViewRequest {
private Long taskId;
}
package com.ruoyi.web.response;
import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.domain.SystemReviewTask;
import lombok.Data;
import java.util.List;
@Data
public class SystemReviewTaskViewResponse {
/**
* 任务信息
*/
private SystemReviewTask systemReviewTask;
/**
* 任务开始后的场景变更信息
*/
private List<ReviewSceneChangeTask> reviewSceneChangeTasks;
}
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<result property="passed" column="passed" jdbcType="TINYINT"/> <result property="passed" column="passed" jdbcType="TINYINT"/>
<result property="sceneId" column="scene_id" jdbcType="BIGINT"/> <result property="sceneId" column="scene_id" jdbcType="BIGINT"/>
<result property="scene" column="scene" jdbcType="VARCHAR"/> <result property="scene" column="scene" jdbcType="VARCHAR"/>
<result property="imagesurl" column="imagesUrl" jdbcType="VARCHAR"/> <result property="imagesUrl" column="images_url" jdbcType="VARCHAR"/>
<result property="reviewDetailsId" column="review_details_id" jdbcType="BIGINT"/> <result property="reviewDetailsId" column="review_details_id" jdbcType="BIGINT"/>
<result property="taskId" column="task_id" jdbcType="BIGINT"/> <result property="taskId" column="task_id" jdbcType="BIGINT"/>
</resultMap> </resultMap>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
scene,imagesUrl,review_details_id, scene,imagesUrl,review_details_id,
task_no task_no
</sql> </sql>
<select id="findByTaskNo" resultType="com.ruoyi.domain.ReviewDetailsResult"> <select id="findByTaskId" resultType="com.ruoyi.domain.ReviewDetailsResult">
SELECT id, passed, scene_id, scene, imagesUrl, review_details_id, task_no FROM t_review_details_result WHERE task_no = #{taskNo} SELECT id, passed, scene_id, scene, images_url, review_details_id, task_id FROM t_review_details_result WHERE task_id = #{taskId}
</select> </select>
</mapper> </mapper>
...@@ -22,4 +22,11 @@ ...@@ -22,4 +22,11 @@
<result property="taskEndTime" column="task_end_time" jdbcType="TIMESTAMP"/> <result property="taskEndTime" column="task_end_time" jdbcType="TIMESTAMP"/>
</resultMap> </resultMap>
<select id="findLastChangeByAfterTime" resultType="com.ruoyi.domain.ReviewSceneChangeTask">
SELECT * FROM t_review_scene_change_task WHERE id IN
(
SELECT MAX(id) FROM t_review_scene_change_task WHERE task_status = 'FINISH' AND task_result = 'PASS' AND task_end_time >= #{date} GROUP BY review_scene_id
)
</select>
</mapper> </mapper>
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
<result property="taskStatus" column="task_status" jdbcType="VARCHAR"/> <result property="taskStatus" column="task_status" jdbcType="VARCHAR"/>
<result property="taskInitiator" column="task_initiator" jdbcType="VARCHAR"/> <result property="taskInitiator" column="task_initiator" jdbcType="VARCHAR"/>
<result property="taskInitiatorDept" column="task_initiator_dept" jdbcType="VARCHAR"/> <result property="taskInitiatorDept" column="task_initiator_dept" jdbcType="VARCHAR"/>
<result property="taskInitiatorOrg" column="task_initiator_org" jdbcType="VARCHAR"/>
<result property="taskResult" column="task_result" jdbcType="VARCHAR"/> <result property="taskResult" column="task_result" jdbcType="VARCHAR"/>
<result property="taskBeginTime" column="task_begin_time" jdbcType="TIMESTAMP"/> <result property="taskBeginTime" column="task_begin_time" jdbcType="TIMESTAMP"/>
<result property="taskEndTime" column="task_end_time" jdbcType="TIMESTAMP"/> <result property="taskEndTime" column="task_end_time" jdbcType="TIMESTAMP"/>
......
package com.ruoyi; package com.ruoyi;
import cn.hutool.json.JSONUtil;
import com.ruoyi.domain.SystemReviewTask;
import com.ruoyi.service.SystemReviewTaskService;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest @SpringBootTest
public class SystemReviewTaskTest { public class SystemReviewTaskTest {
@Autowired
private SystemReviewTaskService systemReviewTaskService;
@Test
public void loadTaskByIdTest() {
Long id = 1735530241750740994L;
SystemReviewTask task = systemReviewTaskService.loadTaskById(id);
System.out.println(JSONUtil.toJsonPrettyStr(task));
}
@Test @Test
public void testOSSUrl() { public void testOSSUrl() {
String bucket = "vehicle-quality-review-oss"; String bucket = "vehicle-quality-review-oss";
......
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