Commit 1cbb16e9 authored by 王飞's avatar 王飞

Feat

1、新增实体SystemReviewTaskInbox及相关业务代码框架。

Reference N/A
parent b747ae08
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
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);
}
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);
}
}
......
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);
}
}
......
<?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