Commit e267d7f0 authored by W_Y's avatar W_Y

Merge branch 'dev' of http://gitlab.91isoft.com:90/wangfei/vehicle-quality-review into wangdingyi

 Conflicts:
	quality-review/src/main/java/com/ruoyi/mapper/ReviewSceneChangeTaskMapper.java
parents 47b1296e d381f419
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;
import lombok.experimental.Accessors;
/**
* 体系审查任务收件箱(目前用来获取审查场景变更通知)
* @TableName t_system_review_task_inbox
*/
@TableName(value ="t_system_review_task_inbox")
@Accessors(chain = true)
@Data
public class SystemReviewTaskInbox {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 体系审查任务id
*/
private Long systemReviewTaskId;
/**
* 场景变更任务id
*/
private Long reviewSceneChangeTaskId;
/**
* 该消息是否已确认(0未确认:1已确认)
*/
private Integer isConfirm;
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.ruoyi.mapper;
import com.ruoyi.domain.Book;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
......
......@@ -3,6 +3,7 @@ package com.ruoyi.mapper;
import com.ruoyi.domain.ReviewSceneChangeTask;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
......@@ -16,6 +17,7 @@ import java.util.List;
@Repository
public interface ReviewSceneChangeTaskMapper extends BaseMapper<ReviewSceneChangeTask> {
List<ReviewSceneChangeTask> findLastChangeByTaskId(@Param("taskId") Long taskId);
List<ReviewSceneChangeTask> findLastChangeByAfterTime(Date date);
}
......
package com.ruoyi.mapper;
import com.ruoyi.domain.SystemReviewTaskInbox;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author wangfei
* @description 针对表【t_system_review_task_inbox(体系审查任务收件箱(目前用来获取审查场景变更通知))】的数据库操作Mapper
* @createDate 2023-12-26 09:55:39
* @Entity com.ruoyi.domain.SystemReviewTaskInbox
*/
public interface SystemReviewTaskInboxMapper extends BaseMapper<SystemReviewTaskInbox> {
}
......@@ -2,8 +2,12 @@ package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.SystemReviewTask;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface SystemReviewTaskMapper extends BaseMapper<SystemReviewTask> {
List<SystemReviewTask> findListByStatus(@Param("status") String status);
}
......@@ -39,10 +39,10 @@ public interface ReviewSceneChangeTaskService extends IService<ReviewSceneChange
void close(Long taskId);
/**
* 获取指定时间之后的每个场景的最后变更记录
* @param date
* 获取体系审查任务的每个场景的最后变更记录
* @param taskId
* @return
*/
List<ReviewSceneChangeTask> findLastChangeByAfterTime(Date date);
List<ReviewSceneChangeTask> findLastChangeByTaskId(Long taskId);
}
package com.ruoyi.service;
import com.ruoyi.domain.SystemReviewTaskInbox;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author wangfei
* @description 针对表【t_system_review_task_inbox(体系审查任务收件箱(目前用来获取审查场景变更通知))】的数据库操作Service
* @createDate 2023-12-26 09:55:39
*/
public interface SystemReviewTaskInboxService extends IService<SystemReviewTaskInbox> {
/**
* 对受变更影响的问卷生成提醒消息
* @param reviewSceneChangeTaskId
*/
void saveNotify(Long reviewSceneChangeTaskId);
}
......@@ -6,6 +6,8 @@ import com.ruoyi.web.request.SystemReviewTaskCreateRequest;
import com.ruoyi.web.request.SystemReviewTaskStartRequest;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import java.util.List;
/**
* @author wangfei
* @description 针对表【t_system_review_task(体系审查任务)】的数据库操作Service
......@@ -32,4 +34,10 @@ public interface SystemReviewTaskService extends IService<SystemReviewTask> {
*/
void start(SystemReviewTaskStartRequest request);
/**
* 根据状态查找体系审查任务
* @return
*/
List<SystemReviewTask> findListByStatus(String status);
}
......@@ -11,6 +11,7 @@ import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.mapper.ReviewSceneChangeTaskMapper;
import com.ruoyi.service.ReviewSceneChangeTaskUserRelationService;
import com.ruoyi.service.ReviewSceneService;
import com.ruoyi.service.SystemReviewTaskInboxService;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -41,6 +42,9 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha
@Autowired
private ReviewSceneService reviewSceneService;
@Autowired
private SystemReviewTaskInboxService systemReviewTaskInboxService;
@Autowired
private ReviewSceneChangeTaskMapper reviewSceneChangeTaskMapper;
......@@ -117,9 +121,13 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha
reviewSceneChangeTaskService.updateById(task);
// 如果当前任务为全员通过,则对审查标准文件进行更新
// 如果当前任务为全员通过,则对审查标准文件进行更新,同时向受到变更影响的问卷的“收件箱”表中写入数据,记录变更用于提醒用户。
if(task.getTaskResult().equals(ReviewSceneChangeTaskUserRelation.DECISION_PASS)) {
// 更新审核标准
reviewSceneService.change(task);
// 通知受影响的问卷
systemReviewTaskInboxService.saveNotify(taskId);
}
}
......@@ -127,12 +135,11 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha
@Override
public void close(Long taskId) {
ReviewSceneChangeTask task = getById(taskId);
}
@Override
public List<ReviewSceneChangeTask> findLastChangeByAfterTime(Date date) {
return reviewSceneChangeTaskMapper.findLastChangeByAfterTime(date);
public List<ReviewSceneChangeTask> findLastChangeByTaskId(Long taskId) {
return reviewSceneChangeTaskMapper.findLastChangeByTaskId(taskId);
}
private void checkTaskStatus(String status) {
......
......@@ -75,7 +75,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
systemReviewTask.setStandard(standardTree);
// 查询场景变更任务便于提醒用户场景变动
List<ReviewSceneChangeTask> lastChanges = reviewSceneChangeTaskService.findLastChangeByAfterTime(systemReviewTask.getTaskBeginTime());
List<ReviewSceneChangeTask> lastChanges = reviewSceneChangeTaskService.findLastChangeByTaskId(systemReviewTask.getId());
// 构建返回结果
SystemReviewTaskViewResponse response = new SystemReviewTaskViewResponse();
......
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.SystemReviewTask;
import com.ruoyi.domain.SystemReviewTaskInbox;
import com.ruoyi.service.SystemReviewTaskInboxService;
import com.ruoyi.mapper.SystemReviewTaskInboxMapper;
import com.ruoyi.service.SystemReviewTaskService;
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.List;
/**
* @author wangfei
* @description 针对表【t_system_review_task_inbox(体系审查任务收件箱(目前用来获取审查场景变更通知))】的数据库操作Service实现
* @createDate 2023-12-26 09:55:39
*/
@Transactional
@Service
public class SystemReviewTaskInboxServiceImpl extends ServiceImpl<SystemReviewTaskInboxMapper, SystemReviewTaskInbox> implements SystemReviewTaskInboxService {
@Autowired
private SystemReviewTaskService systemReviewTaskService;
@Override
public void saveNotify(Long reviewSceneChangeTaskId) {
// 查找所有受变更影响的体系审查任务(所有PENDING状态的任务)
List<SystemReviewTask> pendingTasks = systemReviewTaskService.findListByStatus(SystemReviewTask.STATUS_PENDING);
// 构建并保存提醒消息
List<SystemReviewTaskInbox> inboxes = new ArrayList();
for(SystemReviewTask task : pendingTasks) {
SystemReviewTaskInbox inbox = new SystemReviewTaskInbox()
.setReviewSceneChangeTaskId(reviewSceneChangeTaskId)
.setSystemReviewTaskId(task.getId())
.setIsConfirm(0);
inboxes.add(inbox);
}
saveBatch(inboxes);
}
}
......@@ -36,6 +36,9 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
@Autowired
private StrategySystemReviewTaskContext strategySystemReviewTaskContext;
@Autowired
private SystemReviewTaskMapper systemReviewTaskMapper;
@Autowired
private ISysUserService sysUserService;
......@@ -90,6 +93,11 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
strategySystemReviewTaskContext.getResource(systemReviewTask.getTaskStatus()).doStart(systemReviewTask);
}
@Override
public List<SystemReviewTask> findListByStatus(String status) {
return systemReviewTaskMapper.findListByStatus(status);
}
}
......
package com.ruoyi.web;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.web.request.ReviewSceneChangeTaskCreateRequest;
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("/review/scene/change/task")
public class ReviewSceneChangeTaskController extends BaseController {
@Autowired
private ReviewSceneChangeTaskService reviewSceneChangeTaskService;
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "场景变更任务", businessType = BusinessType.INSERT)
@RequestMapping(method = RequestMethod.POST, value = "/create")
public AjaxResult create(@Validated @RequestBody ReviewSceneChangeTaskCreateRequest request) {
ReviewSceneChangeTask reviewSceneChangeTask = new ReviewSceneChangeTask();
BeanUtils.copyBeanProp(reviewSceneChangeTask, request);
reviewSceneChangeTaskService.create(reviewSceneChangeTask);
return success();
}
}
package com.ruoyi.web.request;
import lombok.Data;
@Data
public class ReviewSceneChangeTaskCreateRequest {
/**
* 章节
*/
private String chapter;
/**
* 审查标准id
*/
private Long standardId;
/**
* 审查标准
*/
private String standard;
/**
* 审查要点id
*/
private Long keypointId;
/**
* 审查要点
*/
private String keypoint;
/**
* 审查细则id
*/
private Long detailsId;
/**
* 审查细则
*/
private String details;
/**
* 操作(ADD DELETE UPDATE)
*/
private String operation;
/**
* 当 operation 为 ADD 时该字段为空
*/
private String oldText;
/**
* 当 operation 为 DELETE 时该字段为空
*/
private String newText;
/**
* 备注
*/
private String remark;
/**
* 审查场景id
* 若为修改、删除任务时,此id在创建任务时赋值
* 若为新增任务时,此id在审批通过并保存新场景后赋值
*/
private Long reviewSceneId;
}
......@@ -22,10 +22,10 @@
<result property="taskEndTime" column="task_end_time" jdbcType="TIMESTAMP"/>
</resultMap>
<select id="findLastChangeByAfterTime" resultType="com.ruoyi.domain.ReviewSceneChangeTask">
<select id="findLastChangeByTaskId" 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 MAX(id) FROM t_review_scene_change_task WHERE task_status = 'FINISH' AND task_result = 'PASS' AND id IN (SELECT review_scene_change_task_id FROM t_system_review_task_inbox WHERE system_review_task_id = 1737668929502830594 AND is_confirm = 0) GROUP BY review_scene_id
)
</select>
......
<?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.SystemReviewTaskInboxMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.domain.SystemReviewTaskInbox">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="systemReviewTaskId" column="system_review_task_id" jdbcType="BIGINT"/>
<result property="reviewSceneChangeTaskId" column="review_scene_change_task_id" jdbcType="BIGINT"/>
<result property="isConfirm" column="is_confirm" jdbcType="TINYINT"/>
</resultMap>
<sql id="Base_Column_List">
id,system_review_task_id,review_scene_change_task_id,
is_confirm
</sql>
</mapper>
......@@ -18,4 +18,9 @@
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<select id="findListByStatus" resultMap="BaseResultMap">
SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, biz_info, create_time
FROM t_system_review_task WHERE task_status = #{status}
</select>
</mapper>
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