Commit 8c83550d authored by 王飞's avatar 王飞

Feat

1、增加 "体系标准"、"体系审查"、"场景变更" 等相关业务的表设计。
2、针对表设计生成业务代码基本结构。

Reference N/A
parent e0f73f73
...@@ -25,6 +25,11 @@ ...@@ -25,6 +25,11 @@
<artifactId>ruoyi-common</artifactId> <artifactId>ruoyi-common</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-system</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
......
package com.ruoyi.common;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
import com.ruoyi.domain.ReviewStandard;
import java.util.List;
public class StandardJsonTypeHandler extends AbstractJsonTypeHandler<List<ReviewStandard>> {
@Override
protected List<ReviewStandard> parse(String json) {
return JSONUtil.toList(json, ReviewStandard.class);
}
@Override
protected String toJson(List<ReviewStandard> obj) {
return JSONUtil.toJsonStr(obj);
}
}
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 lombok.Data;
import java.util.List;
/**
* 审查细则
*/
@TableName(value ="t_review_details")
@Data
public class ReviewDetails {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 文本内容
*/
private String text;
/**
* 审查要点id
*/
private Long reviewKeypointId;
/**
* 审核场景列表
*/
@TableField(exist = false)
private List<ReviewScene> reviewSceneList;
/**
* 该明细的审查结果
*/
@TableField(exist = false)
private ReviewDetailsResult result;
}
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.io.Serializable;
import lombok.Data;
/**
* 审查细则的审查结果
* @TableName t_review_details_result
*/
@TableName(value ="t_review_details_result")
@Data
public class ReviewDetailsResult implements Serializable {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 审核是否通过(0未通过、1通过)
*/
private Integer passed;
/**
* 厂商适用于该细则的场景id
*/
private Long sceneId;
/**
* 厂商适用于该细则的场景
*/
private String scene;
/**
* 厂商适用于该细则的场景截图或照片(多个url用","分隔)
*/
private String imagesurl;
/**
* 关联到的细则id
*/
private Long reviewDetailsId;
/**
* 关联的任务id
*/
private Long taskId;
}
\ 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 lombok.Data;
import java.util.List;
/**
* 审查要点
*/
@TableName(value ="t_review_keypoint")
@Data
public class ReviewKeyPoint {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 文本内容
*/
private String text;
/**
* 审查标准id
*/
private Long reviewStandardId;
/**
* 审查细则列表
*/
@TableField(exist = false)
private List<ReviewDetails> reviewDetailsList;
}
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* 审查场景
*/
@TableName(value ="t_review_scene")
@Data
public class ReviewScene {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 文本内容
*/
private String text;
/**
* 审查细则id
*/
private Long reviewDetailsId;
}
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 no;
/**
* 章节
*/
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.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Data;
/**
* 审查场景变更任务
* @TableName t_review_scene_change_task
*/
@TableName(value ="t_review_scene_change_task")
@Data
public class ReviewSceneChangeTask {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 任务编号
*/
private String no;
/**
* 章节
*/
private String chapter;
/**
* 审查标准
*/
private String standard;
/**
* 审查要点
*/
private String keypoint;
/**
* 审查细则
*/
private String details;
/**
* 操作(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、PENDING、FINISH、CLOSE)
*/
private String taskStatus;
/**
* 任务结果(PASS、REJECT)
*/
private String taskResult;
/**
* 任务开始时间
*/
private Date taskBeginTime;
/**
* 任务结束时间
*/
private Date taskEndTime;
}
\ No newline at end of file
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Data;
/**
* 审查场景变更任务&用户映射关系
* @TableName t_review_scene_change_task_user_relation
*/
@TableName(value ="t_review_scene_change_task_user_relation")
@Data
public class ReviewSceneChangeTaskUserRelation {
/**
* 任务id
*/
private Long taskId;
/**
* 用户id
*/
private Long userId;
/**
* 审核意见(PASS、REJECT)
*/
private String decision;
/**
* 审核时间
*/
private Date decisionTime;
/**
* 用户姓名
*/
private String name;
}
\ 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 lombok.Data;
import java.util.List;
/**
* 审查标准
*/
@TableName(value ="t_review_standard")
@Data
public class ReviewStandard {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 章节
*/
private String chapter;
/**
* 文本内容
*/
private String text;
/**
* 要点列表
*/
@TableField(exist = false)
private List<ReviewKeyPoint> keyPointList;
}
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 java.util.List;
import com.ruoyi.common.StandardJsonTypeHandler;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 体系审查任务
* @TableName t_system_review_task
*/
@TableName(value ="t_system_review_task", autoResultMap = true)
@Accessors(chain = true)
@Data
public class SystemReviewTask {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 任务编号
*/
private String no;
/**
* 任务状态(NEW、PENDING、FINISH、CLOSE)
*/
private String taskStatus;
/**
* 任务发起人姓名
*/
private String taskInitiator;
/**
* 任务发起人部门
*/
private String taskInitiatorDept;
/**
* 任务发起人岗位
*/
private String taskInitiatorOrg;
/**
* 任务结果(PASS、REJECT)
*/
private String taskResult;
/**
* 任务开始时间
*/
private Date taskBeginTime;
/**
* 任务结束时间
*/
private Date taskEndTime;
/**
* 审查标准
*/
@TableField(value="standard", typeHandler = StandardJsonTypeHandler. class)
private List<ReviewStandard> standard;
/**
* 占位(开发人员根据具体业务自行增加业务字段)
*/
private String bizInfo;
/**
* 审核组长id
*/
private Long leaderId;
/**
* 审核组长姓名
*/
private String leader;
/**
* 创建时间
*/
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 lombok.Data;
import lombok.experimental.Accessors;
/**
* 体系审查任务&用户映射关系
* @TableName t_system_review_task_user_relation
*/
@TableName(value ="t_system_review_task_user_relation")
@Accessors(chain = true)
@Data
public class SystemReviewTaskUserRelation {
/**
* 任务id
*/
@TableId(type = IdType.ASSIGN_ID)
private Long taskId;
/**
* 用户id
*/
private Long userId;
/**
* 是否是组长(1是、0不是)
*/
private Integer isLeader;
/**
* 用户姓名
*/
private String name;
}
\ No newline at end of file
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
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;
import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
...@@ -14,6 +15,7 @@ import java.util.List; ...@@ -14,6 +15,7 @@ import java.util.List;
* @createDate 2023-12-05 14:50:11 * @createDate 2023-12-05 14:50:11
* @Entity com.ruoyi.domain.Book * @Entity com.ruoyi.domain.Book
*/ */
@Repository
public interface BookMapper extends BaseMapper<Book> { public interface BookMapper extends BaseMapper<Book> {
List<Book> selectBookList(Book book); List<Book> selectBookList(Book book);
......
package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.ReviewDetails;
import com.ruoyi.domain.ReviewKeyPoint;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ReviewDetailsMapper extends BaseMapper<ReviewDetails> {
List<ReviewDetails> findByKeyPointList(@Param("reviewKeyPointList") List<ReviewKeyPoint> reviewKeyPointList);
}
package com.ruoyi.mapper;
import com.ruoyi.domain.ReviewDetailsResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author wangfei
* @description 针对表【t_review_details_result(审查细则的审查结果)】的数据库操作Mapper
* @createDate 2023-12-15 15:42:40
* @Entity com.ruoyi.domain.ReviewDetailsResult
*/
@Repository
public interface ReviewDetailsResultMapper extends BaseMapper<ReviewDetailsResult> {
List<ReviewDetailsResult> findByTaskNo(@Param("taskNo") String taskNo);
}
package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.ReviewKeyPoint;
import com.ruoyi.domain.ReviewStandard;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ReviewKeyPointMapper extends BaseMapper<ReviewKeyPoint> {
List<ReviewKeyPoint> findByStandardList(@Param("reviewStandardList") List<ReviewStandard> reviewStandardList);
}
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> {
}
package com.ruoyi.mapper;
import com.ruoyi.domain.ReviewSceneChangeTask;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author wangfei
* @description 针对表【t_review_scene_change_task(审查场景变更任务)】的数据库操作Mapper
* @createDate 2023-12-14 14:28:17
* @Entity com.ruoyi.domain.ReviewSceneChangeTask
*/
public interface ReviewSceneChangeTaskMapper extends BaseMapper<ReviewSceneChangeTask> {
}
package com.ruoyi.mapper;
import com.ruoyi.domain.ReviewSceneChangeTaskUserRelation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author wangfei
* @description 针对表【t_review_scene_change_task_user_relation(审查场景变更任务&用户映射关系)】的数据库操作Mapper
* @createDate 2023-12-15 10:54:57
* @Entity com.ruoyi.domain.ReviewSceneChangeTaskUserRelation
*/
public interface ReviewSceneChangeTaskUserRelationMapper extends BaseMapper<ReviewSceneChangeTaskUserRelation> {
}
package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.ReviewDetails;
import com.ruoyi.domain.ReviewScene;
import com.ruoyi.domain.ReviewStandard;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ReviewSceneMapper extends BaseMapper<ReviewScene> {
List<ReviewScene> findByDetailsList(@Param("reviewDetailsList") List<ReviewDetails> reviewDetailsList);
}
package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.ReviewStandard;
import org.springframework.stereotype.Repository;
@Repository
public interface ReviewStandardMapper extends BaseMapper<ReviewStandard> {
}
package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.SystemReviewTask;
import org.springframework.stereotype.Repository;
@Repository
public interface SystemReviewTaskMapper extends BaseMapper<SystemReviewTask> {
}
package com.ruoyi.mapper;
import com.ruoyi.domain.SystemReviewTaskUserRelation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author wangfei
* @description 针对表【t_system_review_task_user_relation(体系审查任务&用户映射关系)】的数据库操作Mapper
* @createDate 2023-12-15 10:41:16
* @Entity com.ruoyi.domain.SystemReviewTaskUserRelation
*/
public interface SystemReviewTaskUserRelationMapper extends BaseMapper<SystemReviewTaskUserRelation> {
}
package com.ruoyi.service;
import com.ruoyi.domain.ReviewDetailsResult;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @author wangfei
* @description 针对表【t_review_details_result(审查细则的审查结果)】的数据库操作Service
* @createDate 2023-12-15 15:42:40
*/
public interface ReviewDetailsResultService extends IService<ReviewDetailsResult> {
List<ReviewDetailsResult> findByTaskNo(String taskNo);
}
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.ReviewDetails;
import com.ruoyi.domain.ReviewKeyPoint;
import java.util.List;
public interface ReviewDetailsService extends IService<ReviewDetails> {
List<ReviewDetails> findByKeyPointsList(List<ReviewKeyPoint> reviewKeyPointList);
}
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.ReviewKeyPoint;
import com.ruoyi.domain.ReviewStandard;
import java.util.List;
public interface ReviewKeyPointService extends IService<ReviewKeyPoint> {
List<ReviewKeyPoint> findByStandardList(List<ReviewStandard> reviewStandardList);
}
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> {
}
package com.ruoyi.service;
import com.ruoyi.domain.ReviewSceneChangeTask;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author wangfei
* @description 针对表【t_review_scene_change_task(审查场景变更任务)】的数据库操作Service
* @createDate 2023-12-14 14:28:17
*/
public interface ReviewSceneChangeTaskService extends IService<ReviewSceneChangeTask> {
}
package com.ruoyi.service;
import com.ruoyi.domain.ReviewSceneChangeTaskUserRelation;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author wangfei
* @description 针对表【t_review_scene_change_task_user_relation(审查场景变更任务&用户映射关系)】的数据库操作Service
* @createDate 2023-12-15 10:54:57
*/
public interface ReviewSceneChangeTaskUserRelationService extends IService<ReviewSceneChangeTaskUserRelation> {
}
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.ReviewDetails;
import com.ruoyi.domain.ReviewScene;
import java.util.List;
public interface ReviewSceneService extends IService<ReviewScene> {
List<ReviewScene> findByDetailsList(List<ReviewDetails> reviewDetailsList);
}
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.ReviewStandard;
import java.util.List;
public interface ReviewStandardService extends IService<ReviewStandard> {
void initData(List<ReviewStandard> reviewStandardList);
List<ReviewStandard> findTree();
}
package com.ruoyi.service;
import com.ruoyi.domain.SystemReviewTask;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @author wangfei
* @description 针对表【t_system_review_task(体系审查任务)】的数据库操作Service
* @createDate 2023-12-15 09:56:07
*/
public interface SystemReviewTaskService extends IService<SystemReviewTask> {
void createTaskTest(String bizInfo, List<Long> userIds);
SystemReviewTask loadTaskById(Long id);
}
package com.ruoyi.service;
import com.ruoyi.domain.SystemReviewTaskUserRelation;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author wangfei
* @description 针对表【t_system_review_task_user_relation(体系审查任务&用户映射关系)】的数据库操作Service
* @createDate 2023-12-15 10:41:16
*/
public interface SystemReviewTaskUserRelationService extends IService<SystemReviewTaskUserRelation> {
}
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.ReviewDetailsResult;
import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
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_details_result(审查细则的审查结果)】的数据库操作Service实现
* @createDate 2023-12-15 15:42:40
*/
@Transactional
@Service
public class ReviewDetailsResultServiceImpl extends ServiceImpl<ReviewDetailsResultMapper, ReviewDetailsResult>
implements ReviewDetailsResultService{
@Autowired
private ReviewDetailsResultMapper reviewDetailsResultMapper;
@Override
public List<ReviewDetailsResult> findByTaskNo(String taskNo) {
return reviewDetailsResultMapper.findByTaskNo(taskNo);
}
}
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.ReviewDetails;
import com.ruoyi.domain.ReviewKeyPoint;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.service.ReviewDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ReviewDetailsServiceImpl extends ServiceImpl<ReviewDetailsMapper, ReviewDetails> implements ReviewDetailsService {
@Autowired
private ReviewDetailsMapper reviewDetailsMapper;
@Override
public List<ReviewDetails> findByKeyPointsList(List<ReviewKeyPoint> reviewKeyPointList) {
return reviewDetailsMapper.findByKeyPointList(reviewKeyPointList);
}
}
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.ReviewKeyPoint;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.mapper.ReviewKeyPointMapper;
import com.ruoyi.service.ReviewKeyPointService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ReviewKeyPointServiceImpl extends ServiceImpl<ReviewKeyPointMapper, ReviewKeyPoint> implements ReviewKeyPointService {
@Autowired
private ReviewKeyPointMapper reviewKeyPointMapper;
@Override
public List<ReviewKeyPoint> findByStandardList(List<ReviewStandard> reviewStandardList) {
return reviewKeyPointMapper.findByStandardList(reviewStandardList);
}
}
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.domain.ReviewSceneChangeTask;
import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.mapper.ReviewSceneChangeTaskMapper;
import org.springframework.stereotype.Service;
/**
* @author wangfei
* @description 针对表【t_review_scene_change_task(审查场景变更任务)】的数据库操作Service实现
* @createDate 2023-12-14 14:28:17
*/
@Service
public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneChangeTaskMapper, ReviewSceneChangeTask>
implements ReviewSceneChangeTaskService{
}
package com.ruoyi.service.impl;
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.stereotype.Service;
/**
* @author wangfei
* @description 针对表【t_review_scene_change_task_user_relation(审查场景变更任务&用户映射关系)】的数据库操作Service实现
* @createDate 2023-12-15 10:54:57
*/
@Service
public class ReviewSceneChangeTaskUserRelationServiceImpl extends ServiceImpl<ReviewSceneChangeTaskUserRelationMapper, ReviewSceneChangeTaskUserRelation>
implements ReviewSceneChangeTaskUserRelationService{
}
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.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 java.util.List;
@Service
public class ReviewSceneServiceImpl extends ServiceImpl<ReviewSceneMapper, ReviewScene> implements ReviewSceneService {
@Autowired
private ReviewSceneMapper reviewSceneMapper;
@Override
public List<ReviewScene> findByDetailsList(List<ReviewDetails> reviewDetailsList) {
return reviewSceneMapper.findByDetailsList(reviewDetailsList);
}
}
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.SnowflakeUtil;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewStandardMapper;
import com.ruoyi.service.*;
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;
@Transactional
@Service
public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper, ReviewStandard> implements ReviewStandardService {
@Autowired
private ReviewKeyPointService reviewKeyPointService;
@Autowired
private ReviewDetailsService reviewDetailsService;
@Autowired
private ReviewSceneService reviewSceneService;
@Autowired
private ReviewSceneChangeLogService reviewSceneChangeLogService;
/**
* 查询所有审查 标准、要点、细则、场景 并组织成树状结构返回
* @return
*/
public List<ReviewStandard> findTree() {
List<ReviewStandard> reviewStandardList = list(); // 查询审查标准
List<ReviewKeyPoint> reviewKeyPointList = reviewKeyPointService.findByStandardList(reviewStandardList); // 查询审查要点
List<ReviewDetails> reivewDetailsList = reviewDetailsService.findByKeyPointsList(reviewKeyPointList); // 查询审查细则
List<ReviewScene> reviewSceneList = reviewSceneService.findByDetailsList(reivewDetailsList); // 查询审查场景
return buildTree(reviewStandardList, reviewKeyPointList, reivewDetailsList, reviewSceneList);
}
/**
* 将审查 标准、要点、细则、场景 按照父子关系拆分写入到各自的表中
* @param reviewStandardList
*/
@Override
public void initData(List<ReviewStandard> reviewStandardList) {
Date now = new Date();
for(ReviewStandard reviewStandard : reviewStandardList) {
initStandard(SnowflakeUtil.generate(), reviewStandard);
}
}
/**
* 保存审查标准数据
* @param id
* @param reviewStandard
*/
private void initStandard(Long id, ReviewStandard reviewStandard) {
reviewStandard.setId(id);
initKeyPoint(id, reviewStandard.getKeyPointList());
save(reviewStandard);
}
/**
* 保存审查要点数据
* @param parentId
* @param reviewKeyPointList
*/
private void initKeyPoint(Long parentId, List<ReviewKeyPoint> reviewKeyPointList) {
for(ReviewKeyPoint reviewKeyPoint : reviewKeyPointList) {
Long id = SnowflakeUtil.generate();
reviewKeyPoint.setId(id);
reviewKeyPoint.setReviewStandardId(parentId);
initDetails(id, reviewKeyPoint.getReviewDetailsList());
reviewKeyPointService.save(reviewKeyPoint);
}
}
/**
* 保存审查细则数据
* @param parentId
* @param reviewDetailsList
*/
private void initDetails(Long parentId, List<ReviewDetails> reviewDetailsList) {
for(ReviewDetails reviewDetails : reviewDetailsList) {
Long id = SnowflakeUtil.generate();
reviewDetails.setId(id);
reviewDetails.setReviewKeypointId(parentId);
initScene(id, reviewDetails.getReviewSceneList());
reviewDetailsService.save(reviewDetails);
}
}
/**
* 保存审查场景数据
* @param parentId
* @param reviewSceneList
*/
private void initScene(Long parentId, List<ReviewScene> reviewSceneList) {
Date now = new Date();
for(ReviewScene reviewScene : reviewSceneList) {
Long id = SnowflakeUtil.generate();
reviewScene.setId(id);
reviewScene.setReviewDetailsId(parentId);
reviewSceneService.save(reviewScene);
ReviewSceneChangeLog changeLog = new ReviewSceneChangeLog()
.setReviewSceneId(reviewScene.getId())
.setCreateTime(now)
.setNewText(reviewScene.getText())
.setOperation("INIT");
reviewSceneChangeLogService.save(changeLog);
}
}
/**
* 将审查 标准、要点、细则、场景 组织成树状结构返回
* @param reviewStandardList 审查标准集合
* @param reviewKeyPointList 审查要点集合
* @param reviewDetailsList 审查细则集合
* @param reviewSceneList 审查场景集合
* @return
*/
private List<ReviewStandard> buildTree(List<ReviewStandard> reviewStandardList, List<ReviewKeyPoint> reviewKeyPointList, List<ReviewDetails> reviewDetailsList, List<ReviewScene> reviewSceneList) {
List<ReviewDetails> reviewDetails = buildDetails(reviewDetailsList, reviewSceneList);
List<ReviewKeyPoint> keyPoints = buildKeyPoint(reviewKeyPointList, reviewDetails);
List<ReviewStandard> standards = buildStandard(reviewStandardList, keyPoints);
return standards;
}
/**
* 构建父子关系 - 审查细则&审查场景
* @param reviewDetailsList 审查细则集合
* @param reviewSceneList 审查场景集合
* @return
*/
private List<ReviewDetails> buildDetails(List<ReviewDetails> reviewDetailsList, List<ReviewScene> reviewSceneList) {
for(ReviewDetails reviewDetails : reviewDetailsList) {
Long detailsId = reviewDetails.getId();
List<ReviewScene> children = new ArrayList<>();
for(ReviewScene reviewScene : reviewSceneList) {
if(reviewScene.getReviewDetailsId().equals(detailsId)) {
children.add(reviewScene);
}
}
if(children.size() > 0) {
reviewDetails.setReviewSceneList(children);
}
}
return reviewDetailsList;
}
/**
* 构建父子关系 - 审查要点&审查细则
* @param reviewKeyPointList 审查要点集合
* @param reviewDetailsList 审查细则集合
* @return
*/
private List<ReviewKeyPoint> buildKeyPoint(List<ReviewKeyPoint> reviewKeyPointList, List<ReviewDetails> reviewDetailsList) {
for(ReviewKeyPoint reviewKeyPoint : reviewKeyPointList) {
Long keyPointId = reviewKeyPoint.getId();
List<ReviewDetails> children = new ArrayList<>();
for(ReviewDetails reviewDetails : reviewDetailsList) {
if(reviewDetails.getReviewKeypointId().equals(keyPointId)) {
children.add(reviewDetails);
}
}
if(children.size() > 0) {
reviewKeyPoint.setReviewDetailsList(children);
}
}
return reviewKeyPointList;
}
/**
* 构建负责关系 - 审查标准&审查要点
* @param reviewStandardList 审查标准集合
* @param reviewKeyPointList 审查要点集合
* @return
*/
private List<ReviewStandard> buildStandard(List<ReviewStandard> reviewStandardList, List<ReviewKeyPoint> reviewKeyPointList) {
for(ReviewStandard reviewStandard : reviewStandardList) {
Long standardId = reviewStandard.getId();
List<ReviewKeyPoint> children = new ArrayList<>();
for(ReviewKeyPoint reviewKeyPoint : reviewKeyPointList) {
if(reviewKeyPoint.getReviewStandardId().equals(standardId)) {
children.add(reviewKeyPoint);
}
}
if(children.size() > 0) {
reviewStandard.setKeyPointList(children);
}
}
return reviewStandardList;
}
}
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.SnowflakeUtil;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.SystemReviewTaskService;
import com.ruoyi.service.SystemReviewTaskUserRelationService;
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.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.toList;
/**
* @author wangfei
* @description 针对表【t_system_review_task(体系审查任务)】的数据库操作Service实现
* @createDate 2023-12-15 09:56:07
*/
@Transactional
@Service
public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMapper, SystemReviewTask> implements SystemReviewTaskService{
@Autowired
private ReviewDetailsResultMapper reviewDetailsResultMapper;
@Autowired
private ReviewStandardService reviewStandardService;
@Autowired
private SystemReviewTaskUserRelationService systemReviewTaskUserRelationService;
@Autowired
private SystemReviewTaskService systemReviewTaskService;
@Autowired
private ISysUserService sysUserService;
@Override
public void createTaskTest(String bizInfo, List<Long> userIds) {
// 构建任务创建者
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser initiator = sysUserService.selectUserById(loginUser.getUserId());
// 构建任务参与者
Long leaderId = userIds.get(0);
List<SysUser> sysUsers = sysUserService.selectUserListByIds(userIds);
SysUser leader = null;
for(SysUser sysUser : sysUsers) {
if(sysUser.getUserId().equals(leaderId)) {
leader = sysUser;
}
}
// 构建并保存任务信息
List<ReviewStandard> allStandardTree = reviewStandardService.findTree();
SystemReviewTask task = new SystemReviewTask()
.setNo(SnowflakeUtil.generate().toString())
.setTaskInitiator(initiator.getNickName())
.setTaskInitiatorDept(initiator.getDept().getDeptName())
.setTaskStatus("NEW")
.setBizInfo(bizInfo)
.setLeaderId(leaderId)
.setLeader(leader.getNickName())
.setCreateTime(new Date())
.setStandard(allStandardTree);
systemReviewTaskService.save(task);
// 构建并保存该任务所关联的审核组信息
List<SystemReviewTaskUserRelation> relations = new ArrayList();
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(relations);
}
@Override
public SystemReviewTask loadTaskById(Long id) {
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()));
}
}
}
}
}
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.SystemReviewTaskUserRelation;
import com.ruoyi.service.SystemReviewTaskUserRelationService;
import com.ruoyi.mapper.SystemReviewTaskUserRelationMapper;
import org.springframework.stereotype.Service;
/**
* @author wangfei
* @description 针对表【t_system_review_task_user_relation(体系审查任务&用户映射关系)】的数据库操作Service实现
* @createDate 2023-12-15 10:41:16
*/
@Service
public class SystemReviewTaskUserRelationServiceImpl extends ServiceImpl<SystemReviewTaskUserRelationMapper, SystemReviewTaskUserRelation>
implements SystemReviewTaskUserRelationService{
}
package com.ruoyi.web;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.service.SystemReviewTaskService;
import com.ruoyi.web.request.CreateSystemReviewTaskRequest;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/system/review/task")
public class SystemReviewTaskController extends BaseController {
@Autowired
private SystemReviewTaskService systemReviewTaskService;
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/create")
public AjaxResult create(@Validated @RequestBody CreateSystemReviewTaskRequest request) {
systemReviewTaskService.createTaskTest(request.getBizInfo(), request.getUserIds());
return success();
}
}
package com.ruoyi.web.request;
import lombok.Data;
import java.util.List;
@Data
public class CreateSystemReviewTaskRequest {
private String bizInfo;
private List<Long> userIds;
}
<?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.ReviewDetailsMapper">
<select id="findByKeyPointList" resultType="com.ruoyi.domain.ReviewDetails">
SELECT id, text, review_keypoint_id FROM t_review_details WHERE review_keypoint_id IN
<foreach collection="reviewKeyPointList" item="keyPoint" open="(" separator="," close=")">
#{keyPoint.id}
</foreach>
</select>
</mapper>
<?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.ReviewDetailsResultMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.domain.ReviewDetailsResult">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="passed" column="passed" jdbcType="TINYINT"/>
<result property="sceneId" column="scene_id" jdbcType="BIGINT"/>
<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"/>
</resultMap>
<sql id="Base_Column_List">
id,passed,scene_id,
scene,imagesUrl,review_details_id,
task_no
</sql>
<select id="findByTaskNo" 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>
</mapper>
<?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.ReviewKeyPointMapper">
<select id="findByStandardList" resultType="com.ruoyi.domain.ReviewKeyPoint">
SELECT id, text, review_standard_id FROM t_review_keypoint WHERE review_standard_id IN
<foreach collection="reviewStandardList" item="standard" open="(" separator="," close=")">
#{standard.id}
</foreach>
</select>
</mapper>
<?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>
<?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.ReviewSceneChangeTaskMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.domain.ReviewSceneChangeTask">
<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"/>
</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>
<?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.ReviewSceneChangeTaskUserRelationMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.domain.ReviewSceneChangeTaskUserRelation">
<result property="taskId" column="task_id" jdbcType="BIGINT"/>
<result property="userId" column="user_id" jdbcType="BIGINT"/>
<result property="decision" column="decision" jdbcType="VARCHAR"/>
<result property="decisionTime" column="decision_time" jdbcType="TIMESTAMP"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
task_id,user_id,decision,
decision_time,name
</sql>
</mapper>
<?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.ReviewSceneMapper">
<select id="findByDetailsList" resultType="com.ruoyi.domain.ReviewScene">
SELECT id, text, review_details_id FROM t_review_scene WHERE review_details_id IN
<foreach collection="reviewDetailsList" item="details" open="(" separator="," close=")">
#{details.id}
</foreach>
</select>
</mapper>
<?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.ReviewStandardMapper">
<resultMap id="StandardTreeResultMap" type="com.ruoyi.domain.ReviewStandard">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="chapter" column="chapter" jdbcType="VARCHAR"/>
<result property="text" column="text" jdbcType="VARCHAR"/>
<collection property="keyPointList" ofType="com.ruoyi.domain.ReviewKeyPoint" select="com.ruoyi.mapper.ReviewKeyPointMapper.findAllByReviewStandardId" column="id">
<result property="id" column="u_id" jdbcType="BIGINT"/>
<result property="text" column="text" jdbcType="VARCHAR"/>
</collection>
</resultMap>
<select id="findTree" resultMap="StandardTreeResultMap">
SELECT id, chapter, text FROM t_review_standard;
</select>
</mapper>
<?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.SystemReviewTaskMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.domain.SystemReviewTask">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="no" column="no" jdbcType="VARCHAR"/>
<result property="taskStatus" column="task_status" jdbcType="VARCHAR"/>
<result property="taskInitiator" column="task_initiator" 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="taskBeginTime" column="task_begin_time" jdbcType="TIMESTAMP"/>
<result property="taskEndTime" column="task_end_time" jdbcType="TIMESTAMP"/>
<result property="standard" column="standard" typeHandler="com.ruoyi.common.StandardJsonTypeHandler"/>
<result property="bizInfo" column="biz_info" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,no,task_status,
task_initiator,task_initiator_dept,task_initiator_org,
task_result,task_begin_time,task_end_time,
standard,biz_info, create_time
</sql>
</mapper>
<?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.SystemReviewTaskUserRelationMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.domain.SystemReviewTaskUserRelation">
<result property="taskId" column="task_id" jdbcType="BIGINT"/>
<result property="userId" column="user_id" jdbcType="BIGINT"/>
<result property="isLeader" column="is_leader" jdbcType="TINYINT"/>
</resultMap>
<sql id="Base_Column_List">
task_id,user_id,is_leader
</sql>
</mapper>
package com.ruoyi;
import cn.hutool.json.JSONUtil;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.service.ReviewStandardService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.List;
@SpringBootTest
public class ReviewStandardTest {
@Autowired
private ReviewStandardService reviewStandardService;
@Test
public void converterTest() {
String json = "[{\"id\":\"\",\"chapter\":\"5.1\",\"text\":\"车辆制造商应具备车辆全生命周期的汽车信息安全管理体系。注:车辆全生命周期包括车辆的开发阶段、生产阶段及后生产阶段。\",\"keyPointList\":[{\"id\":\"\",\"text\":\"车辆制造商是否建立汽车信息安全管理制度。\",\"reviewDetailsList\":[{\"id\":\"\",\"text\":\"车辆制造商是否能够提供/展示汽车信息安全管理制度正式发布的证明材料。\",\"reviewSceneList\":[{\"id\":\"\",\"text\":\"1.管理制度发布会红头文件\"},{\"id\":\"\",\"text\":\"2.管理制度正式发布会议纪要\"},{\"id\":\"\",\"text\":\"3.专用系统正式发布流程或记录\"}]}]}]},{\"id\":\"\",\"chapter\":\"5.2\",\"text\":\"汽车信息安全管理体系应包括以下内容。建立企业内部管理汽车信息安全的过程。\",\"keyPointList\":[{\"id\":\"\",\"text\":\"车辆制造商汽车信息安全管理制度是否建立并明确汽车信息安全管理制度的组织架构及权责。\",\"reviewDetailsList\":[{\"id\":\"\",\"text\":\"车辆制造商汽车信息安全管理制度的角色应覆盖车辆/车辆产品在生命周期中的信息安全活动。\",\"reviewSceneList\":[{\"id\":\"\",\"text\":\"1.汽车信息安全管理制度或其配套的流程文件中包含流程图,定义了信息安全活动及对应的角色,并有角色的权责定义。\"}]},{\"id\":\"\",\"text\":\"车辆制造商汽车信息安全管理制度的角色应与车辆制造商的组织架构匹配。\",\"reviewSceneList\":[{\"id\":\"\",\"text\":\"1.汽车信息安全管理制度中定义的角色与车辆制造商的组织架构岗位名称一致。\"},{\"id\":\"\",\"text\":\"2.汽车信息安全管理制度中定义的角色与车辆制造商的组织架构岗位有映射关系。\"}]}]},{\"id\":\"\",\"text\":\"车辆制造商汽车信息安全管理制度是否明确为保障汽车信息安全需求实现和维持所投入的资源。\",\"reviewDetailsList\":[{\"id\":\"\",\"text\":\"车辆制造商应提供在信息安全方面提供资源支持的证明材料,包括投入的场地、基础软硬件设备、技术人员和资金等。\",\"reviewSceneList\":[{\"id\":\"\",\"text\":\"1.典型的资源要求为人力投入,例如负责网络安全风险管理的人员、研发人员和事件管理响应人员。\"}]}]},{\"id\":\"\",\"text\":\"车辆制造商汽车信息安全管理制度是否明确与其它管理流程(如QMS、ISMS)的适配性。\",\"reviewDetailsList\":[{\"id\":\"\",\"text\":\"车辆制造商应提供信息安全管理制度在建设实施中与企业其他管理流程相适配的证明材料。\",\"reviewSceneList\":[{\"id\":\"\",\"text\":\"1.明确信息安全管理要求融合到现有管理制度流程中,如在现有ISMS制度中增加汽车信息安全管理要求。\"},{\"id\":\"\",\"text\":\"2.在信息安全管理制度中明确与其它管理流程的接口。\"}]}]}]}]";
List<ReviewStandard> list = JSONUtil.toList(JSONUtil.parseArray(json), ReviewStandard.class);
reviewStandardService.initData(list);
System.out.println(list);
}
@Test
public void findTreeTest() {
List<ReviewStandard> tree = reviewStandardService.findTree();
System.out.println(JSONUtil.toJsonPrettyStr(tree));
}
}
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
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));
}
}
...@@ -132,6 +132,18 @@ ...@@ -132,6 +132,18 @@
<artifactId>mybatis-plus-boot-starter</artifactId> <artifactId>mybatis-plus-boot-starter</artifactId>
</dependency> </dependency>
<!-- spring-boot-test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.23</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
package com.ruoyi.common.utils; package com.ruoyi.common.utils;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
...@@ -21,6 +23,8 @@ import com.ruoyi.common.exception.ServiceException; ...@@ -21,6 +23,8 @@ import com.ruoyi.common.exception.ServiceException;
public class SecurityUtils public class SecurityUtils
{ {
private static Boolean isRunningTest = null;
/** /**
* 用户ID * 用户ID
**/ **/
......
package com.ruoyi.common.utils;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
public class SnowflakeUtil {
private static final Snowflake snowflake = IdUtil.createSnowflake(1,1);
public static Long generate() {
return snowflake.nextId();
}
}
...@@ -124,4 +124,6 @@ public interface SysUserMapper ...@@ -124,4 +124,6 @@ public interface SysUserMapper
* @return 结果 * @return 结果
*/ */
public SysUser checkEmailUnique(String email); public SysUser checkEmailUnique(String email);
List<SysUser> selectUserListByIds(@Param("ids") List<Long> ids);
} }
...@@ -26,6 +26,13 @@ public interface ISysUserService ...@@ -26,6 +26,13 @@ public interface ISysUserService
*/ */
public List<SysUser> selectAllocatedList(SysUser user); public List<SysUser> selectAllocatedList(SysUser user);
/**
* 根据 id 数组查询多个用户
* @param ids
* @return
*/
public List<SysUser> selectUserListByIds(List<Long> ids);
/** /**
* 根据条件分页查询未分配用户角色列表 * 根据条件分页查询未分配用户角色列表
* *
......
...@@ -87,6 +87,12 @@ public class SysUserServiceImpl implements ISysUserService ...@@ -87,6 +87,12 @@ public class SysUserServiceImpl implements ISysUserService
return userMapper.selectAllocatedList(user); return userMapper.selectAllocatedList(user);
} }
@DataScope(deptAlias = "d", userAlias = "u")
@Override
public List<SysUser> selectUserListByIds(List<Long> ids) {
return userMapper.selectUserListByIds(ids);
}
/** /**
* 根据条件分页查询未分配用户角色列表 * 根据条件分页查询未分配用户角色列表
* *
......
...@@ -141,8 +141,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -141,8 +141,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult"> <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1 select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
</select> </select>
<select id="selectUserListByIds" resultType="com.ruoyi.common.core.domain.entity.SysUser">
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId"> <include refid="selectUserVo"/>
where u.del_flag = '0' and u.user_id in
<foreach collection="ids" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</select>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_user( insert into sys_user(
<if test="userId != null and userId != 0">user_id,</if> <if test="userId != null and userId != 0">user_id,</if>
<if test="deptId != null and deptId != 0">dept_id,</if> <if test="deptId != null and deptId != 0">dept_id,</if>
......
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