Commit 7153c359 authored by 王飞's avatar 王飞

Refactor

1、删除场景变更日志相关的表&代码。
2、实现基于“任务”驱动“问卷场景”的新增、删除、修改。

Reference N/A
parent 05099dd8
......@@ -4,11 +4,13 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 审查场景
*/
@TableName(value ="t_review_scene")
@Accessors(chain = true)
@Data
public class ReviewScene {
......
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 审查场景变更日志
* @TableName t_review_scene_change_log
*/
@TableName(value ="t_review_scene_change_log")
@Accessors(chain = true)
@Data
public class ReviewSceneChangeLog {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 任务编号
*/
private String taskNo;
/**
* 章节
*/
private String chapter;
/**
* 审查标准
*/
private String standard;
/**
* 审查要点
*/
private String keypoint;
/**
* 审查细则
*/
private String details;
/**
* 操作(INIT ADD DELETE UPDATE)
*/
private String operation;
/**
* 当 operation 为 ADD 时该字段为空
*/
private String oldText;
/**
* 当 operation 为 DELETE 时该字段为空
*/
private String newText;
/**
* 任务发起人姓名
*/
private String taskInitiator;
/**
* 任务发起人岗位
*/
private String taskInitiatorOrg;
/**
* 任务发起人部门
*/
private String taskInitiatorDept;
/**
* 任务状态(NEW、RUNNING、FINISH、CLOSE)
*/
private String taskStatus;
/**
* 任务结果(PASS、RJECT)
*/
private String taskResult;
/**
* 任务开始时间
*/
private Date taskBeginTime;
/**
* 任务结束时间
*/
private Date taskEndTime;
/**
* 任务审批人列表
*/
private String taskApprover;
/**
* 任务备注
*/
private String taskRemark;
/**
* 关联场景id
*/
private Long reviewSceneId;
/**
* 数据创建时间
*/
private Date createTime;
}
\ No newline at end of file
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 审查场景变更任务
* @TableName t_review_scene_change_task
*/
@TableName(value ="t_review_scene_change_task")
@Accessors(chain = true)
@Data
public class ReviewSceneChangeTask {
@TableField(exist = false)
public static final String OPERATION_ADD = "ADD";
@TableField(exist = false)
public static final String OPERATION_DELETE = "DELETE";
@TableField(exist = false)
public static final String OPERATION_UPDATE = "UPDATE";
@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";
@TableField(exist = false)
public static final String RESULT_PASS = "PASS";
@TableField(exist = false)
public static final String RESULT_REJECT = "REJECT";
/**
* 参与审核的角色
*/
@TableField(exist = false)
public static final Long REVIEW_ROLE_ID = 103L;
/**
* 主键
*/
......@@ -22,23 +51,38 @@ public class ReviewSceneChangeTask {
/**
* 任务编号
*/
private String no;
private String taskNo;
/**
* 章节
*/
private String chapter;
/**
* 审查标准id
*/
private Long standardId;
/**
* 审查标准
*/
private String standard;
/**
* 审查要点id
*/
private Long keypointId;
/**
* 审查要点
*/
private String keypoint;
/**
* 审查细则id
*/
private Long detailsId;
/**
* 审查细则
*/
......@@ -70,7 +114,7 @@ public class ReviewSceneChangeTask {
private String taskInitiatorDept;
/**
* 任务状态(NEW、PENDING、FINISH、CLOSE)
* 任务状态(PENDING、FINISH、CLOSE)
*/
private String taskStatus;
......@@ -89,4 +133,16 @@ public class ReviewSceneChangeTask {
*/
private Date taskEndTime;
/**
* 备注
*/
private String remark;
/**
* 审查场景id
* 若为修改、删除任务时,此id在创建任务时赋值
* 若为新增任务时,此id在审批通过并保存新场景后赋值
*/
private Long reviewSceneId;
}
\ No newline at end of file
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 审查场景变更任务&用户映射关系
* @TableName t_review_scene_change_task_user_relation
*/
@TableName(value ="t_review_scene_change_task_user_relation")
@Accessors(chain = true)
@Data
public class ReviewSceneChangeTaskUserRelation {
@TableField(exist = false)
public static final String DECISION_PASS = "PASS";
@TableField(exist = false)
public static final String DECISION_REJECT = "REJECT";
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 任务id
*/
......@@ -42,4 +58,9 @@ public class ReviewSceneChangeTaskUserRelation {
*/
private String name;
/**
* 部门名称
*/
private String dept;
}
\ No newline at end of file
package com.ruoyi.mapper;
import com.ruoyi.domain.ReviewSceneChangeLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author wangfei
* @description 针对表【t_review_scene_change_log(审查场景变更日志)】的数据库操作Mapper
* @createDate 2023-12-14 16:23:07
* @Entity com.ruoyi.domain.ReviewSceneChangeLog
*/
public interface ReviewSceneChangeLogMapper extends BaseMapper<ReviewSceneChangeLog> {
}
......@@ -2,6 +2,9 @@ package com.ruoyi.mapper;
import com.ruoyi.domain.ReviewSceneChangeTaskUserRelation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author wangfei
......@@ -11,6 +14,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface ReviewSceneChangeTaskUserRelationMapper extends BaseMapper<ReviewSceneChangeTaskUserRelation> {
List<ReviewSceneChangeTaskUserRelation> findListByTaskId(@Param("taskId") Long taskId);
}
......
package com.ruoyi.service;
import com.ruoyi.domain.ReviewSceneChangeLog;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author wangfei
* @description 针对表【t_review_scene_change_log(审查场景变更日志)】的数据库操作Service
* @createDate 2023-12-14 16:23:07
*/
public interface ReviewSceneChangeLogService extends IService<ReviewSceneChangeLog> {
}
......@@ -10,4 +10,29 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface ReviewSceneChangeTaskService extends IService<ReviewSceneChangeTask> {
/**
* 新建一个任务
*/
void create(ReviewSceneChangeTask reviewSceneChangeTask);
/**
* 审核通过一个任务
* @param taskId
* @param comment
*/
void pass(Long taskId, String comment);
/**
* 审核驳回一个任务
* @param taskId
* @param comment
*/
void reject(Long taskId, String comment);
/**
* 关闭一个任务
* @param taskId
*/
void close(Long taskId);
}
......@@ -3,6 +3,8 @@ package com.ruoyi.service;
import com.ruoyi.domain.ReviewSceneChangeTaskUserRelation;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @author wangfei
* @description 针对表【t_review_scene_change_task_user_relation(审查场景变更任务&用户映射关系)】的数据库操作Service
......@@ -10,4 +12,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface ReviewSceneChangeTaskUserRelationService extends IService<ReviewSceneChangeTaskUserRelation> {
List<ReviewSceneChangeTaskUserRelation> findListByTaskId(Long taskId);
}
......@@ -3,11 +3,23 @@ package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.ReviewDetails;
import com.ruoyi.domain.ReviewScene;
import com.ruoyi.domain.ReviewSceneChangeTask;
import java.util.List;
public interface ReviewSceneService extends IService<ReviewScene> {
/**
* 根据细则id查询属于这些细则的场景
* @param reviewDetailsList
* @return
*/
List<ReviewScene> findByDetailsList(List<ReviewDetails> reviewDetailsList);
/**
* 场景变更,包括(新增场景、删除场景、修改场景)
* @param reviewSceneChangeTask
*/
void change(ReviewSceneChangeTask reviewSceneChangeTask);
}
package com.ruoyi.service;
public interface StateReviewSceneChangeTask {
/**
* 审核通过一个任务
* @param taskId
* @param comment
*/
void pass(Long taskId, String comment);
/**
* 审核驳回一个任务
* @param taskId
* @param comment
*/
void reject(Long taskId, String comment);
/**
* 关闭一个任务
* @param taskId
*/
void close(Long taskId);
}
package com.ruoyi.service;
import com.ruoyi.domain.ReviewSceneChangeTask;
public interface StrategyReviewSceneChange {
void doChange(ReviewSceneChangeTask reviewSceneChangeTask);
}
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.ReviewSceneChangeLog;
import com.ruoyi.service.ReviewSceneChangeLogService;
import com.ruoyi.mapper.ReviewSceneChangeLogMapper;
import org.springframework.stereotype.Service;
/**
* @author wangfei
* @description 针对表【t_review_scene_change_log(审查场景变更日志)】的数据库操作Service实现
* @createDate 2023-12-14 16:23:07
*/
@Service
public class ReviewSceneChangeLogServiceImpl extends ServiceImpl<ReviewSceneChangeLogMapper, ReviewSceneChangeLog>
implements ReviewSceneChangeLogService{
}
package com.ruoyi.service.impl;
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.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.domain.ReviewSceneChangeTaskUserRelation;
import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.mapper.ReviewSceneChangeTaskMapper;
import com.ruoyi.service.ReviewSceneChangeTaskUserRelationService;
import com.ruoyi.service.ReviewSceneService;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author wangfei
* @description 针对表【t_review_scene_change_task(审查场景变更任务)】的数据库操作Service实现
* @createDate 2023-12-14 14:28:17
*/
@Transactional
@Service
public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneChangeTaskMapper, ReviewSceneChangeTask>
implements ReviewSceneChangeTaskService{
public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneChangeTaskMapper, ReviewSceneChangeTask> implements ReviewSceneChangeTaskService {
@Autowired
private ReviewSceneChangeTaskUserRelationService reviewSceneChangeTaskUserRelationService;
@Autowired
private ReviewSceneChangeTaskService reviewSceneChangeTaskService;
@Autowired
private ISysUserService sysUserService;
@Autowired
private ReviewSceneService reviewSceneService;
@Override
public void create(ReviewSceneChangeTask reviewSceneChangeTask) {
// 获取当前登陆人
SysUser loginUser = SecurityUtils.getLoginUser().getUser();
// 创建任务
reviewSceneChangeTask
.setTaskInitiator(loginUser.getNickName())
.setTaskInitiatorDept(loginUser.getDept().getDeptName())
.setTaskStatus(ReviewSceneChangeTask.STATUS_PENDING)
.setTaskBeginTime(new Date());
// 保存任务
save(reviewSceneChangeTask);
// 绑定审核人
List<SysUser> sysUsers = sysUserService.selectUserListByRoleId(ReviewSceneChangeTask.REVIEW_ROLE_ID);
List<ReviewSceneChangeTaskUserRelation> relations = new ArrayList();
for(SysUser sysUser : sysUsers) {
ReviewSceneChangeTaskUserRelation relation = new ReviewSceneChangeTaskUserRelation()
.setTaskId(reviewSceneChangeTask.getId())
.setUserId(sysUser.getUserId())
.setName(sysUser.getNickName())
.setDept(sysUser.getDept().getDeptName());
relations.add(relation);
}
reviewSceneChangeTaskUserRelationService.saveBatch(relations);
}
@Override
public void pass(Long taskId, String comment) {
doProcess(taskId, comment, ReviewSceneChangeTask.RESULT_PASS);
}
@Override
public void reject(Long taskId, String comment) {
doProcess(taskId, comment, ReviewSceneChangeTask.RESULT_REJECT);
}
public void doProcess(Long taskId, String comment, String decision) {
ReviewSceneChangeTask task = getById(taskId);
checkTaskStatus(task.getTaskStatus());
// 获取当前登陆人
SysUser loginUser = SecurityUtils.getLoginUser().getUser();
// 1.获取该任务的所有审批人
// 2.获取当前用户对应的审批信息
// 3.保存评审意见
List<ReviewSceneChangeTaskUserRelation> relations = reviewSceneChangeTaskUserRelationService.findListByTaskId(taskId);
for(ReviewSceneChangeTaskUserRelation relation : relations) {
if(relation.getUserId().equals(loginUser.getUserId())) {
relation.setDecision(decision);
relation.setComment(comment);
relation.setDecisionTime(new Date());
reviewSceneChangeTaskUserRelationService.updateById(relation);
break;
}
}
// 判断当前任务是否全员审核完毕,如果是则将当前任务设置为完成。
if(isFinish(relations)) {
task.setTaskStatus(ReviewSceneChangeTask.STATUS_FINISH);
task.setTaskEndTime(new Date());
task.setTaskResult(isPassed(relations) ? ReviewSceneChangeTaskUserRelation.DECISION_PASS : ReviewSceneChangeTaskUserRelation.DECISION_REJECT);
reviewSceneChangeTaskService.updateById(task);
// 如果当前任务为全员通过,则对审查标准文件进行更新
if(task.getTaskResult().equals(ReviewSceneChangeTaskUserRelation.DECISION_PASS)) {
reviewSceneService.change(task);
}
}
}
@Override
public void close(Long taskId) {
ReviewSceneChangeTask task = getById(taskId);
}
private void checkTaskStatus(String status) {
if(status != null && ReviewSceneChangeTask.STATUS_FINISH.equals(status)) {
throw new ServiceException("不能处理一个已经完成的任务", HttpStatus.ERROR);
}
if(status != null && ReviewSceneChangeTask.STATUS_CLOSE.equals(status)) {
throw new ServiceException("不能处理一个已经关闭的任务", HttpStatus.ERROR);
}
}
/**
* 检查当前任务是否完成(所有审核人都发表了意见)
* @param relations
* @return
*/
private boolean isFinish(List<ReviewSceneChangeTaskUserRelation> relations) {
for(ReviewSceneChangeTaskUserRelation relation : relations) {
String decision = relation.getDecision();
if(decision == null || "".equals(decision)) {
return false;
}
}
return true;
}
/**
* 检查是否全员通过
* @param relations
* @return
*/
private boolean isPassed(List<ReviewSceneChangeTaskUserRelation> relations) {
for(ReviewSceneChangeTaskUserRelation relation : relations) {
if(relation.getDecision().equals(ReviewSceneChangeTaskUserRelation.DECISION_REJECT)) {
return false;
}
}
return true;
}
}
......
......@@ -4,17 +4,28 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.ReviewSceneChangeTaskUserRelation;
import com.ruoyi.service.ReviewSceneChangeTaskUserRelationService;
import com.ruoyi.mapper.ReviewSceneChangeTaskUserRelationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author wangfei
* @description 针对表【t_review_scene_change_task_user_relation(审查场景变更任务&用户映射关系)】的数据库操作Service实现
* @createDate 2023-12-15 10:54:57
*/
@Transactional
@Service
public class ReviewSceneChangeTaskUserRelationServiceImpl extends ServiceImpl<ReviewSceneChangeTaskUserRelationMapper, ReviewSceneChangeTaskUserRelation>
implements ReviewSceneChangeTaskUserRelationService{
public class ReviewSceneChangeTaskUserRelationServiceImpl extends ServiceImpl<ReviewSceneChangeTaskUserRelationMapper, ReviewSceneChangeTaskUserRelation> implements ReviewSceneChangeTaskUserRelationService {
@Autowired
private ReviewSceneChangeTaskUserRelationMapper reviewSceneChangeTaskUserRelationMapper;
@Override
public List<ReviewSceneChangeTaskUserRelation> findListByTaskId(Long taskId) {
return reviewSceneChangeTaskUserRelationMapper.findListByTaskId(taskId);
}
}
......
......@@ -3,18 +3,22 @@ package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.ReviewDetails;
import com.ruoyi.domain.ReviewScene;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.mapper.ReviewSceneMapper;
import com.ruoyi.service.ReviewDetailsService;
import com.ruoyi.service.ReviewSceneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Transactional
@Service
public class ReviewSceneServiceImpl extends ServiceImpl<ReviewSceneMapper, ReviewScene> implements ReviewSceneService {
@Autowired
private StrategyReviewSceneChangeContext strategyReviewSceneChangeContext;
@Autowired
private ReviewSceneMapper reviewSceneMapper;
......@@ -22,4 +26,10 @@ public class ReviewSceneServiceImpl extends ServiceImpl<ReviewSceneMapper, Revie
public List<ReviewScene> findByDetailsList(List<ReviewDetails> reviewDetailsList) {
return reviewSceneMapper.findByDetailsList(reviewDetailsList);
}
@Override
public void change(ReviewSceneChangeTask reviewSceneChangeTask) {
String operation = reviewSceneChangeTask.getOperation();
strategyReviewSceneChangeContext.getResource(operation).doChange(reviewSceneChangeTask);
}
}
......@@ -26,8 +26,6 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
@Autowired
private ReviewSceneService reviewSceneService;
@Autowired
private ReviewSceneChangeLogService reviewSceneChangeLogService;
/**
* 查询所有审查 标准、要点、细则、场景 并组织成树状结构返回
......@@ -114,13 +112,6 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
reviewScene.setReviewDetailsId(parentId);
reviewSceneService.save(reviewScene);
ReviewSceneChangeLog changeLog = new ReviewSceneChangeLog()
.setReviewSceneId(reviewScene.getId())
.setCreateTime(now)
.setNewText(reviewScene.getText())
.setOperation("INIT");
reviewSceneChangeLogService.save(changeLog);
}
}
......
package com.ruoyi.service.impl;
import com.ruoyi.domain.ReviewScene;
import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.mapper.ReviewSceneMapper;
import com.ruoyi.service.StrategyReviewSceneChange;
import com.ruoyi.service.ReviewSceneChangeTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Transactional
@Service(ReviewSceneChangeTask.OPERATION_ADD)
public class StrategyReviewSceneChangeAdd implements StrategyReviewSceneChange {
@Autowired
private ReviewSceneMapper reviewSceneMapper;
@Autowired
private ReviewSceneChangeTaskService reviewSceneChangeTaskService;
/**
* 新增审查场景
* @param reviewSceneChangeTask
*/
@Override
public void doChange(ReviewSceneChangeTask reviewSceneChangeTask) {
// 保存新增的场景
ReviewScene reviewScene = new ReviewScene()
.setText(reviewSceneChangeTask.getNewText())
.setReviewDetailsId(reviewSceneChangeTask.getDetailsId());
reviewSceneMapper.insert(reviewScene);
// 为场景变更任务的 场景关联id字段赋值
reviewSceneChangeTask.setReviewSceneId(reviewScene.getId());
reviewSceneChangeTaskService.updateById(reviewSceneChangeTask);
}
}
package com.ruoyi.service.impl;
import com.ruoyi.service.StrategyReviewSceneChange;
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 StrategyReviewSceneChangeContext {
@Autowired
private final Map<String, StrategyReviewSceneChange> strategyMap = new ConcurrentHashMap<>();
public StrategyReviewSceneChangeContext(Map<String, StrategyReviewSceneChange> strategyMap) {
this.strategyMap.clear();
strategyMap.forEach(strategyMap::put);
}
public StrategyReviewSceneChange getResource(String operation){
return strategyMap.get(operation);
}
}
package com.ruoyi.service.impl;
import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.service.StrategyReviewSceneChange;
import com.ruoyi.service.ReviewSceneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Transactional
@Service(ReviewSceneChangeTask.OPERATION_DELETE)
public class StrategyReviewSceneChangeDelete implements StrategyReviewSceneChange {
@Autowired
private ReviewSceneService reviewSceneService;
@Override
public void doChange(ReviewSceneChangeTask reviewSceneChangeTask) {
reviewSceneService.removeById(reviewSceneChangeTask.getReviewSceneId());
}
}
package com.ruoyi.service.impl;
import com.ruoyi.domain.ReviewScene;
import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.service.StrategyReviewSceneChange;
import com.ruoyi.service.ReviewSceneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Transactional
@Service(ReviewSceneChangeTask.OPERATION_UPDATE)
public class StrategyReviewSceneChangeUpdate implements StrategyReviewSceneChange {
@Autowired
private ReviewSceneService reviewSceneService;
@Override
public void doChange(ReviewSceneChangeTask reviewSceneChangeTask) {
ReviewScene reviewScene = reviewSceneService.getById(reviewSceneChangeTask.getReviewSceneId());
reviewScene.setText(reviewSceneChangeTask.getNewText());
reviewSceneService.updateById(reviewScene);
}
}
......@@ -97,13 +97,17 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
@Override
public SystemReviewTask loadTaskById(Long id) {
// 根据id获取体系审查任务
SystemReviewTask task = getById(id);
// 构建该任务的问卷与答案
List<ReviewStandard> standard = task.getStandard();
List<ReviewDetailsResult> results = reviewDetailsResultMapper.findByTaskNo(task.getNo());
setDetailsResult(standard, results);
// 返回任务
return task;
}
......
......@@ -11,7 +11,7 @@
<result property="scene" column="scene" jdbcType="VARCHAR"/>
<result property="imagesurl" column="imagesUrl" jdbcType="VARCHAR"/>
<result property="reviewDetailsId" column="review_details_id" jdbcType="BIGINT"/>
<result property="taskNo" column="task_no" jdbcType="VARCHAR"/>
<result property="taskId" column="task_id" jdbcType="BIGINT"/>
</resultMap>
<sql id="Base_Column_List">
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.mapper.ReviewSceneChangeLogMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.domain.ReviewSceneChangeLog">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="no" column="no" jdbcType="VARCHAR"/>
<result property="chapter" column="chapter" jdbcType="VARCHAR"/>
<result property="standard" column="standard" jdbcType="VARCHAR"/>
<result property="keypoint" column="keypoint" jdbcType="VARCHAR"/>
<result property="details" column="details" jdbcType="VARCHAR"/>
<result property="operation" column="operation" jdbcType="VARCHAR"/>
<result property="oldText" column="old_text" jdbcType="VARCHAR"/>
<result property="newText" column="new_text" jdbcType="VARCHAR"/>
<result property="taskInitiator" column="task_initiator" jdbcType="VARCHAR"/>
<result property="taskInitiatorOrg" column="task_initiator_org" jdbcType="VARCHAR"/>
<result property="taskInitiatorDept" column="task_initiator_dept" jdbcType="VARCHAR"/>
<result property="taskStatus" column="task_status" jdbcType="VARCHAR"/>
<result property="taskResult" column="task_result" jdbcType="VARCHAR"/>
<result property="taskBeginTime" column="task_begin_time" jdbcType="TIMESTAMP"/>
<result property="taskEndTime" column="task_end_time" jdbcType="TIMESTAMP"/>
<result property="taskApprover" column="task_approver" jdbcType="VARCHAR"/>
<result property="taskRemark" column="task_remark" jdbcType="VARCHAR"/>
<result property="reviewSceneId" column="review_scene_id" jdbcType="BIGINT"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,no,chapter,
standard,keypoint,details,
operation,old_text,new_text,
task_initiator,task_initiator_org,task_initiator_dept,
task_status,task_result,task_begin_time,
task_end_time,task_approver,task_remark,
review_scene_id,create_time
</sql>
</mapper>
......@@ -6,7 +6,7 @@
<resultMap id="BaseResultMap" type="com.ruoyi.domain.ReviewSceneChangeTask">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="no" column="no" jdbcType="VARCHAR"/>
<result property="taskNo" column="no" jdbcType="VARCHAR"/>
<result property="chapter" column="chapter" jdbcType="VARCHAR"/>
<result property="standard" column="standard" jdbcType="VARCHAR"/>
<result property="keypoint" column="keypoint" jdbcType="VARCHAR"/>
......@@ -15,7 +15,6 @@
<result property="oldText" column="old_text" jdbcType="VARCHAR"/>
<result property="newText" column="new_text" jdbcType="VARCHAR"/>
<result property="taskInitiator" column="task_initiator" jdbcType="VARCHAR"/>
<result property="taskInitiatorOrg" column="task_initiator_org" jdbcType="VARCHAR"/>
<result property="taskInitiatorDept" column="task_initiator_dept" jdbcType="VARCHAR"/>
<result property="taskStatus" column="task_status" jdbcType="VARCHAR"/>
<result property="taskResult" column="task_result" jdbcType="VARCHAR"/>
......@@ -23,12 +22,4 @@
<result property="taskEndTime" column="task_end_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,no,chapter,
standard,keypoint,details,
operation,old_text,new_text,
task_initiator,task_initiator_org,task_initiator_dept,
task_status,task_result,task_begin_time,
task_end_time
</sql>
</mapper>
......@@ -5,6 +5,7 @@
<mapper namespace="com.ruoyi.mapper.ReviewSceneChangeTaskUserRelationMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.domain.ReviewSceneChangeTaskUserRelation">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="taskId" column="task_id" jdbcType="BIGINT"/>
<result property="userId" column="user_id" jdbcType="BIGINT"/>
<result property="decision" column="decision" jdbcType="VARCHAR"/>
......@@ -16,4 +17,7 @@
task_id,user_id,decision,
decision_time,name
</sql>
<select id="findListByTaskId" resultType="com.ruoyi.domain.ReviewSceneChangeTaskUserRelation">
SELECT id, task_id, user_id, decision, decision_time, name FROM t_review_scene_change_task_user_relation WHERE task_id = #{taskId}
</select>
</mapper>
package com.ruoyi;
import com.ruoyi.common.utils.SnowflakeUtil;
import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.service.ReviewSceneChangeTaskService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
public class ReviewSceneChangeTaskTest {
@Autowired
private ReviewSceneChangeTaskService reviewSceneChangeTaskService;
/**
* 创建一个新增场景的任务
*/
@Test
public void createTest_add() {
ReviewSceneChangeTask reviewSceneChangeTask = new ReviewSceneChangeTask()
.setTaskNo(SnowflakeUtil.generate().toString())
.setChapter("5.1")
.setStandardId(1735216941104238592L)
.setStandard("车辆制造商应具备车辆全生命周期的汽车信息安全管理体系。注:车辆全生命周期包括车辆的开发阶段、生产阶段及后生产阶段。")
.setKeypointId(1735216941104238593L)
.setKeypoint("车辆制造商是否建立汽车信息安全管理制度。")
.setDetailsId(1735216941104238594L)
.setDetails("车辆制造商是否能够提供/展示汽车信息安全管理制度正式发布的证明材料。")
.setOperation(ReviewSceneChangeTask.OPERATION_ADD)
.setOldText(null)
.setNewText("测试新增一个场景")
.setRemark("为了测试");
reviewSceneChangeTaskService.create(reviewSceneChangeTask);
}
/**
* 创建一个删除场景的任务
*/
@Test
public void createTest_delete() {
ReviewSceneChangeTask reviewSceneChangeTask = new ReviewSceneChangeTask()
.setTaskNo(SnowflakeUtil.generate().toString())
.setChapter("5.1")
.setStandardId(1735216941104238592L)
.setStandard("车辆制造商应具备车辆全生命周期的汽车信息安全管理体系。注:车辆全生命周期包括车辆的开发阶段、生产阶段及后生产阶段。")
.setKeypointId(1735216941104238593L)
.setKeypoint("车辆制造商是否建立汽车信息安全管理制度。")
.setDetailsId(1735216941104238594L)
.setDetails("车辆制造商是否能够提供/展示汽车信息安全管理制度正式发布的证明材料。")
.setOperation(ReviewSceneChangeTask.OPERATION_DELETE)
.setOldText("测试新增一个场景")
.setNewText(null)
.setReviewSceneId(1737385976545681410L)
.setRemark("为了测试");
reviewSceneChangeTaskService.create(reviewSceneChangeTask);
}
/**
* 创建一个修改场景的任务
*/
@Test
public void createTest_update() {
ReviewSceneChangeTask reviewSceneChangeTask = new ReviewSceneChangeTask()
.setTaskNo(SnowflakeUtil.generate().toString())
.setChapter("5.1")
.setStandardId(1735216941104238592L)
.setStandard("车辆制造商应具备车辆全生命周期的汽车信息安全管理体系。注:车辆全生命周期包括车辆的开发阶段、生产阶段及后生产阶段。")
.setKeypointId(1735216941104238593L)
.setKeypoint("车辆制造商是否建立汽车信息安全管理制度。")
.setDetailsId(1735216941104238594L)
.setDetails("车辆制造商是否能够提供/展示汽车信息安全管理制度正式发布的证明材料。")
.setOperation(ReviewSceneChangeTask.OPERATION_UPDATE)
.setOldText("测试新增一个场景")
.setNewText("修改一个场景")
.setReviewSceneId(1737393098847203330L)
.setRemark("为了测试");
reviewSceneChangeTaskService.create(reviewSceneChangeTask);
}
@Test
public void passTest() {
reviewSceneChangeTaskService.pass(1737393813195902977L, "同意");
}
@Test
public void rejectTest() {
reviewSceneChangeTaskService.reject(1737390991951810562L, "不同意");
}
}
package com.ruoyi;
import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.service.ReviewSceneService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.Date;
@SpringBootTest
public class ReviewSceneTest {
@Autowired
private ReviewSceneService reviewSceneService;
@Test
public void changeAddTest() {
ReviewSceneChangeTask reviewSceneChangeTask = new ReviewSceneChangeTask()
.setTaskNo("10000000")
.setChapter("5.1")
.setStandardId(1735216941104238592L)
.setStandard("车辆制造商应具备车辆全生命周期的汽车信息安全管理体系。注:车辆全生命周期包括车辆的开发阶段、生产阶段及后生产阶段。")
.setKeypointId(1735216941104238593L)
.setKeypoint("车辆制造商是否建立汽车信息安全管理制度。")
.setDetailsId(1735216941104238594L)
.setDetails("车辆制造商是否能够提供/展示汽车信息安全管理制度正式发布的证明材料。")
.setOperation(ReviewSceneChangeTask.OPERATION_ADD)
.setOldText(null)
.setNewText("测试新增场景")
.setTaskInitiator("超级管理员")
.setTaskInitiatorDept("天津检测机构")
.setTaskStatus(ReviewSceneChangeTask.STATUS_FINISH)
.setTaskResult(ReviewSceneChangeTask.RESULT_PASS)
.setTaskBeginTime(new Date())
.setTaskEndTime(new Date())
.setRemark("为了测试");
reviewSceneService.change(reviewSceneChangeTask);
}
@Test
public void changeUpdateTest() {
ReviewSceneChangeTask reviewSceneChangeTask = new ReviewSceneChangeTask()
.setTaskNo("10000001")
.setChapter("5.1")
.setStandardId(1735216941104238592L)
.setStandard("车辆制造商应具备车辆全生命周期的汽车信息安全管理体系。注:车辆全生命周期包括车辆的开发阶段、生产阶段及后生产阶段。")
.setKeypointId(1735216941104238593L)
.setKeypoint("车辆制造商是否建立汽车信息安全管理制度。")
.setDetailsId(1735216941104238594L)
.setDetails("车辆制造商是否能够提供/展示汽车信息安全管理制度正式发布的证明材料。")
.setOperation(ReviewSceneChangeTask.OPERATION_UPDATE)
.setReviewSceneId(1737311815420813313L)
.setOldText("测试新增场景")
.setNewText("测试新增场景修改")
.setTaskInitiator("超级管理员")
.setTaskInitiatorDept("天津检测机构")
.setTaskStatus(ReviewSceneChangeTask.STATUS_FINISH)
.setTaskResult(ReviewSceneChangeTask.RESULT_PASS)
.setTaskBeginTime(new Date())
.setTaskEndTime(new Date())
.setRemark("为了测试");
reviewSceneService.change(reviewSceneChangeTask);
}
@Test
public void changeDeleteTest() {
ReviewSceneChangeTask reviewSceneChangeTask = new ReviewSceneChangeTask()
.setTaskNo("10000003")
.setChapter("5.1")
.setStandardId(1735216941104238592L)
.setStandard("车辆制造商应具备车辆全生命周期的汽车信息安全管理体系。注:车辆全生命周期包括车辆的开发阶段、生产阶段及后生产阶段。")
.setKeypointId(1735216941104238593L)
.setKeypoint("车辆制造商是否建立汽车信息安全管理制度。")
.setDetailsId(1735216941104238594L)
.setDetails("车辆制造商是否能够提供/展示汽车信息安全管理制度正式发布的证明材料。")
.setOperation(ReviewSceneChangeTask.OPERATION_DELETE)
.setReviewSceneId(1737311815420813313L)
.setOldText("测试新增场景修改")
.setNewText(null)
.setTaskInitiator("超级管理员")
.setTaskInitiatorDept("天津检测机构")
.setTaskStatus(ReviewSceneChangeTask.STATUS_FINISH)
.setTaskResult(ReviewSceneChangeTask.RESULT_PASS)
.setTaskBeginTime(new Date())
.setTaskEndTime(new Date())
.setRemark("为了测试");
reviewSceneService.change(reviewSceneChangeTask);
}
}
package com.ruoyi;
import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.system.service.ISysUserService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
public class SysUserTest {
@Autowired
private ISysUserService sysUserService;
@Test
public void selectUserListByRoleIdTest() {
System.out.println(sysUserService.selectUserListByRoleId(ReviewSceneChangeTask.REVIEW_ROLE_ID));
}
}
......@@ -125,5 +125,17 @@ public interface SysUserMapper
*/
public SysUser checkEmailUnique(String email);
/**
* 根据id查找用户
* @param ids
* @return
*/
List<SysUser> selectUserListByIds(@Param("ids") List<Long> ids);
/**
* 根据角色查找用户
* @param roleId
* @return
*/
List<SysUser> selectUserListByRoleId(@Param("roleId") Long roleId);
}
......@@ -10,6 +10,14 @@ import com.ruoyi.common.core.domain.entity.SysUser;
*/
public interface ISysUserService
{
/**
* 根据角色id,查找用户
* @param roleId
* @return
*/
public List<SysUser> selectUserListByRoleId(Long roleId);
/**
* 根据条件分页查询用户列表
*
......
......@@ -61,6 +61,11 @@ public class SysUserServiceImpl implements ISysUserService
@Autowired
protected Validator validator;
@Override
public List<SysUser> selectUserListByRoleId(Long roleId) {
return userMapper.selectUserListByRoleId(roleId);
}
/**
* 根据条件分页查询用户列表
*
......
......@@ -148,6 +148,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{userId}
</foreach>
</select>
<select id="selectUserListByRoleId" resultMap="SysUserResult">
SELECT u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
LEFT JOIN sys_dept d ON u.dept_id = d.dept_id
WHERE u.del_flag = '0' AND u.user_id IN (SELECT user_id FROM sys_user_role WHERE role_id = #{roleId})
</select>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_user(
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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