Commit 27992083 authored by wdy's avatar wdy

审查任务

parent 8b04eabc
...@@ -11,6 +11,7 @@ import lombok.AllArgsConstructor; ...@@ -11,6 +11,7 @@ import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.List; import java.util.List;
...@@ -19,6 +20,7 @@ import java.util.List; ...@@ -19,6 +20,7 @@ import java.util.List;
*/ */
@ApiModel @ApiModel
@TableName(value ="t_review_details") @TableName(value ="t_review_details")
@Accessors(chain = true)
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
......
...@@ -11,6 +11,7 @@ import lombok.AllArgsConstructor; ...@@ -11,6 +11,7 @@ import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.List; import java.util.List;
...@@ -19,6 +20,7 @@ import java.util.List; ...@@ -19,6 +20,7 @@ import java.util.List;
*/ */
@ApiModel @ApiModel
@TableName(value ="t_review_keypoint") @TableName(value ="t_review_keypoint")
@Accessors(chain = true)
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
......
...@@ -77,8 +77,8 @@ public class ReviewSceneChangeTask { ...@@ -77,8 +77,8 @@ public class ReviewSceneChangeTask {
@ApiModelProperty("检验标准id") @ApiModelProperty("检验标准id")
private String inspectStandardId; private String inspectStandardId;
@ApiModelProperty("检验标准名称") @ApiModelProperty("检验标准")
private String inspectStandardName; private String inspectStandardNo;
/** /**
* 章节 * 章节
......
...@@ -19,6 +19,8 @@ public interface CarReviewTaskMapper extends BaseMapper<CarReviewTask> { ...@@ -19,6 +19,8 @@ public interface CarReviewTaskMapper extends BaseMapper<CarReviewTask> {
List<CarReviewTask> findListByReviewStatus(@Param("reviewStatus") String reviewStatus); List<CarReviewTask> findListByReviewStatus(@Param("reviewStatus") String reviewStatus);
List<CarReviewTask> findListByTaskStatus(@Param("taskStatus") String taskStatus); List<CarReviewTask> findListByTaskStatus(@Param("taskStatus") String taskStatus);
List<CarReviewTask> findByDetailsResult(@Param("detailId") Long detailId);
} }
......
...@@ -13,4 +13,6 @@ public interface SystemReviewTaskMapper extends BaseMapper<SystemReviewTask> { ...@@ -13,4 +13,6 @@ public interface SystemReviewTaskMapper extends BaseMapper<SystemReviewTask> {
// 查询处理中的任务 // 查询处理中的任务
List<SystemReviewTask> findListInProcess(); List<SystemReviewTask> findListInProcess();
List<SystemReviewTask> findByDetailsResult(@Param("detailId") Long detailId);
} }
...@@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* @author wangfei * @author wangfei
...@@ -145,8 +146,12 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha ...@@ -145,8 +146,12 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha
// 更新审核标准 // 更新审核标准
reviewSceneService.change(task); reviewSceneService.change(task);
// 通知受影响的问卷 //场景变更时发送信息
reviewTaskInboxService.saveNotify(taskId, task.getType()); if (Objects.equals(task.getOperationSort(), "ADD_SCENE") || Objects.equals(task.getOperationSort(), "DELETE_SCENE")) {
// 通知受影响的问卷
reviewTaskInboxService.saveNotify(taskId, task.getType());
}
} }
} }
......
...@@ -3,11 +3,11 @@ package com.ruoyi.service.impl; ...@@ -3,11 +3,11 @@ package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.CarReviewTask; import com.ruoyi.domain.*;
import com.ruoyi.domain.ReviewStandard; import com.ruoyi.mapper.CarReviewTaskMapper;
import com.ruoyi.domain.SystemReviewTask; import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.domain.ReviewTaskInbox;
import com.ruoyi.service.CarReviewTaskService; import com.ruoyi.service.CarReviewTaskService;
import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.service.ReviewTaskInboxService; import com.ruoyi.service.ReviewTaskInboxService;
import com.ruoyi.mapper.ReviewTaskInboxMapper; import com.ruoyi.mapper.ReviewTaskInboxMapper;
import com.ruoyi.service.SystemReviewTaskService; import com.ruoyi.service.SystemReviewTaskService;
...@@ -37,6 +37,15 @@ public class ReviewTaskInboxServiceImpl extends ServiceImpl<ReviewTaskInboxMappe ...@@ -37,6 +37,15 @@ public class ReviewTaskInboxServiceImpl extends ServiceImpl<ReviewTaskInboxMappe
@Autowired @Autowired
private ReviewTaskInboxMapper reviewTaskInboxMapper; private ReviewTaskInboxMapper reviewTaskInboxMapper;
@Autowired
private ReviewSceneChangeTaskService reviewSceneChangeTaskService;
@Autowired
private SystemReviewTaskMapper systemReviewTaskMapper;
@Autowired
private CarReviewTaskMapper carReviewTaskMapper;
/** /**
* 保存场景变更对进行中的问卷产生的影响,用于提醒问卷使用者场景发生了变更。 * 保存场景变更对进行中的问卷产生的影响,用于提醒问卷使用者场景发生了变更。
* 体系审查任务、侧性审查任务分别查询不同的表 * 体系审查任务、侧性审查任务分别查询不同的表
...@@ -72,7 +81,11 @@ public class ReviewTaskInboxServiceImpl extends ServiceImpl<ReviewTaskInboxMappe ...@@ -72,7 +81,11 @@ public class ReviewTaskInboxServiceImpl extends ServiceImpl<ReviewTaskInboxMappe
public void doSaveNotifyByCarReview(Long reviewSceneChangeTaskId) { public void doSaveNotifyByCarReview(Long reviewSceneChangeTaskId) {
// 查找所有受变更影响的体系审查任务(所有PENDING状态的任务) // 查找所有受变更影响的体系审查任务(所有PENDING状态的任务)
List<CarReviewTask> pendingTasks = carReviewTaskService.findListByStatus(CarReviewTask.TASK_STATUS_PENDING); // List<CarReviewTask> pendingTasks = carReviewTaskService.findListByStatus(CarReviewTask.TASK_STATUS_PENDING);
ReviewSceneChangeTask reviewSceneChangeTask = reviewSceneChangeTaskService.getById(reviewSceneChangeTaskId);
List<CarReviewTask> pendingTasks = carReviewTaskMapper.findByDetailsResult(reviewSceneChangeTask.getDetailsId());
// 构建并保存提醒消息 // 构建并保存提醒消息
List<ReviewTaskInbox> inboxes = new ArrayList(); List<ReviewTaskInbox> inboxes = new ArrayList();
...@@ -89,8 +102,12 @@ public class ReviewTaskInboxServiceImpl extends ServiceImpl<ReviewTaskInboxMappe ...@@ -89,8 +102,12 @@ public class ReviewTaskInboxServiceImpl extends ServiceImpl<ReviewTaskInboxMappe
public void doSaveNotifyBySystemReview(Long reviewSceneChangeTaskId) { public void doSaveNotifyBySystemReview(Long reviewSceneChangeTaskId) {
// 查找所有受变更影响的体系审查任务(所有PENDING状态的任务) // 查找所有受变更影响的体系审查任务(所有PENDING状态的任务 且回答过的)
List<SystemReviewTask> pendingTasks = systemReviewTaskService.findListByStatus(SystemReviewTask.STATUS_PENDING); // List<SystemReviewTask> pendingTasks = systemReviewTaskService.findListByStatus(SystemReviewTask.STATUS_PENDING);
ReviewSceneChangeTask reviewSceneChangeTask = reviewSceneChangeTaskService.getById(reviewSceneChangeTaskId);
List<SystemReviewTask> pendingTasks = systemReviewTaskMapper.findByDetailsResult(reviewSceneChangeTask.getDetailsId());
// 构建并保存提醒消息 // 构建并保存提醒消息
List<ReviewTaskInbox> inboxes = new ArrayList(); List<ReviewTaskInbox> inboxes = new ArrayList();
......
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import com.ruoyi.domain.ReviewDetails;
import com.ruoyi.domain.ReviewKeyPoint;
import com.ruoyi.domain.ReviewScene; import com.ruoyi.domain.ReviewScene;
import com.ruoyi.domain.ReviewSceneChangeTask; import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewKeyPointMapper;
import com.ruoyi.mapper.ReviewSceneMapper; import com.ruoyi.mapper.ReviewSceneMapper;
import com.ruoyi.service.StrategyReviewSceneChange; import com.ruoyi.service.StrategyReviewSceneChange;
import com.ruoyi.service.ReviewSceneChangeTaskService; import com.ruoyi.service.ReviewSceneChangeTaskService;
...@@ -11,6 +15,8 @@ import org.springframework.context.ApplicationContext; ...@@ -11,6 +15,8 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Objects;
@Transactional @Transactional
@Service @Service
public class StrategyReviewSceneChangeAdd implements StrategyReviewSceneChange, InitializingBean { public class StrategyReviewSceneChangeAdd implements StrategyReviewSceneChange, InitializingBean {
...@@ -26,6 +32,12 @@ public class StrategyReviewSceneChangeAdd implements StrategyReviewSceneChange, ...@@ -26,6 +32,12 @@ public class StrategyReviewSceneChangeAdd implements StrategyReviewSceneChange,
@Autowired @Autowired
private ReviewSceneChangeTaskService reviewSceneChangeTaskService; private ReviewSceneChangeTaskService reviewSceneChangeTaskService;
@Autowired
private ReviewKeyPointMapper reviewKeyPointMapper;
@Autowired
private ReviewDetailsMapper reviewDetailsMapper;
/** /**
* 新增审查场景 * 新增审查场景
* @param reviewSceneChangeTask * @param reviewSceneChangeTask
...@@ -33,15 +45,45 @@ public class StrategyReviewSceneChangeAdd implements StrategyReviewSceneChange, ...@@ -33,15 +45,45 @@ public class StrategyReviewSceneChangeAdd implements StrategyReviewSceneChange,
@Override @Override
public void doChange(ReviewSceneChangeTask reviewSceneChangeTask) { public void doChange(ReviewSceneChangeTask reviewSceneChangeTask) {
// 保存新增的场景 if (Objects.equals(reviewSceneChangeTask.getOperationSort(), "ADD_SCENE")) {
ReviewScene reviewScene = new ReviewScene()
.setText(reviewSceneChangeTask.getNewText()) // 保存新增的场景
.setReviewDetailsId(reviewSceneChangeTask.getDetailsId()); ReviewScene reviewScene = new ReviewScene()
reviewSceneMapper.insert(reviewScene); .setText(reviewSceneChangeTask.getNewText())
.setReviewDetailsId(reviewSceneChangeTask.getDetailsId());
reviewSceneMapper.insert(reviewScene);
// 为场景变更任务的 场景关联id字段赋值
reviewSceneChangeTask.setReviewSceneId(reviewScene.getId());
reviewSceneChangeTaskService.updateById(reviewSceneChangeTask);
}
// 保存新增的要点
if (Objects.equals(reviewSceneChangeTask.getOperationSort(), "ADD_KEYPOINT")) {
// 要点
ReviewKeyPoint reviewKeyPoint = new ReviewKeyPoint()
.setText(reviewSceneChangeTask.getKeypoint())
.setReviewStandardId(reviewSceneChangeTask.getStandardId());
reviewKeyPointMapper.insert(reviewKeyPoint);
// 细则
ReviewDetails reviewDetails = new ReviewDetails()
.setText(reviewSceneChangeTask.getDetails())
.setReviewKeypointId(reviewKeyPoint.getId());
reviewDetailsMapper.insert(reviewDetails);
}
// 保存新增的细则
if (Objects.equals(reviewSceneChangeTask.getOperationSort(), "ADD_DETAILS")) {
// 细则
ReviewDetails reviewDetails = new ReviewDetails()
.setText(reviewSceneChangeTask.getDetails())
.setReviewKeypointId(reviewSceneChangeTask.getKeypointId());
reviewDetailsMapper.insert(reviewDetails);
}
// 为场景变更任务的 场景关联id字段赋值
reviewSceneChangeTask.setReviewSceneId(reviewScene.getId());
reviewSceneChangeTaskService.updateById(reviewSceneChangeTask);
} }
......
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import com.ruoyi.domain.ReviewDetails;
import com.ruoyi.domain.ReviewDetailsResult;
import com.ruoyi.domain.ReviewScene;
import com.ruoyi.domain.ReviewSceneChangeTask; import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.ReviewKeyPointMapper;
import com.ruoyi.mapper.ReviewSceneMapper;
import com.ruoyi.service.ReviewDetailsService;
import com.ruoyi.service.ReviewKeyPointService;
import com.ruoyi.service.StrategyReviewSceneChange; import com.ruoyi.service.StrategyReviewSceneChange;
import com.ruoyi.service.ReviewSceneService; import com.ruoyi.service.ReviewSceneService;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
...@@ -9,6 +18,9 @@ import org.springframework.context.ApplicationContext; ...@@ -9,6 +18,9 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
@Transactional @Transactional
@Service @Service
public class StrategyReviewSceneChangeDelete implements StrategyReviewSceneChange, InitializingBean { public class StrategyReviewSceneChangeDelete implements StrategyReviewSceneChange, InitializingBean {
...@@ -21,9 +33,70 @@ public class StrategyReviewSceneChangeDelete implements StrategyReviewSceneChang ...@@ -21,9 +33,70 @@ public class StrategyReviewSceneChangeDelete implements StrategyReviewSceneChang
@Autowired @Autowired
private ReviewSceneService reviewSceneService; private ReviewSceneService reviewSceneService;
@Autowired
private ReviewKeyPointService reviewKeyPointService;
@Autowired
private ReviewDetailsService reviewDetailsService;
@Autowired
private ReviewDetailsMapper reviewDetailsMapper;
@Autowired
private ReviewSceneMapper reviewSceneMapper;
@Autowired
private ReviewDetailsResultMapper reviewDetailsResultMapper;
@Override @Override
public void doChange(ReviewSceneChangeTask reviewSceneChangeTask) { public void doChange(ReviewSceneChangeTask reviewSceneChangeTask) {
reviewSceneService.removeById(reviewSceneChangeTask.getReviewSceneId()); // 删除场景
if (Objects.equals(reviewSceneChangeTask.getOperationSort(), "DELETE_SCENE")) {
reviewSceneService.removeById(reviewSceneChangeTask.getReviewSceneId());
}
// 删除要点
if (Objects.equals(reviewSceneChangeTask.getOperationSort(), "DELETE_KEYPOINT")) {
// 删除要点
reviewKeyPointService.removeById(reviewSceneChangeTask.getKeypointId());
// 删除包含的细则
List<ReviewDetails> reviewDetailsList = reviewDetailsMapper.findByKeyPointId(reviewSceneChangeTask.getKeypointId());
if (reviewDetailsList != null && reviewDetailsList.size() != 0) {
reviewDetailsService.removeBatchByIds(reviewDetailsList);
}
// 删除细则对应的结果
List<ReviewDetailsResult> resultList = reviewDetailsResultMapper.findByDetailsList(reviewDetailsList);
if (resultList != null && resultList.size() != 0) {
reviewDetailsResultMapper.deleteBatchIds(resultList);
}
// 删除包含的场景
List<ReviewScene> reviewScenesList = reviewSceneService.findByDetailsList(reviewDetailsList);
if (reviewScenesList != null && reviewScenesList.size() != 0) {
reviewSceneService.removeBatchByIds(reviewScenesList);
}
}
// 删除细则
if (Objects.equals(reviewSceneChangeTask.getOperationSort(), "DELETE_DETAILS")) {
// 删除细则
reviewDetailsService.removeById(reviewSceneChangeTask.getDetailsId());
// 删除细则对应的结果
List<ReviewDetailsResult> resultList = reviewDetailsResultMapper.findByDetailsId(reviewSceneChangeTask.getDetailsId());
if (resultList != null && resultList.size() != 0) {
reviewDetailsResultMapper.deleteBatchIds(resultList);
}
// 删除包含的场景
List<ReviewScene> reviewScenesList = reviewSceneMapper.findByDetailId(reviewSceneChangeTask.getDetailsId());
if (reviewScenesList != null && reviewScenesList.size() != 0) {
reviewSceneService.removeBatchByIds(reviewScenesList);
}
}
} }
@Override @Override
......
...@@ -8,6 +8,12 @@ import lombok.Data; ...@@ -8,6 +8,12 @@ import lombok.Data;
@Data @Data
public class ReviewSceneChangeTaskCreateRequest { public class ReviewSceneChangeTaskCreateRequest {
@ApiModelProperty("检验标准id")
private String inspectStandardId;
@ApiModelProperty("检验标准名称")
private String inspectStandardNo;
/** /**
* 章节 * 章节
*/ */
......
...@@ -25,8 +25,8 @@ public class ReviewSceneChangeTaskResponse { ...@@ -25,8 +25,8 @@ public class ReviewSceneChangeTaskResponse {
@ApiModelProperty("检验标准id") @ApiModelProperty("检验标准id")
private String inspectStandardId; private String inspectStandardId;
@ApiModelProperty("检验标准名称") @ApiModelProperty("检验标准")
private String inspectStandardName; private String inspectStandardNo;
/** /**
* 章节 * 章节
......
...@@ -45,4 +45,13 @@ ...@@ -45,4 +45,13 @@
SELECT id,task_no,task_status,task_initiator,task_initiator_dept,task_result,task_begin_time,task_end_time,standard,create_time,leader_id,leader,standard_id,name,standard_no,file,submit_id,submit_name,images_url SELECT id,task_no,task_status,task_initiator,task_initiator_dept,task_result,task_begin_time,task_end_time,standard,create_time,leader_id,leader,standard_id,name,standard_no,file,submit_id,submit_name,images_url
FROM t_car_review_task WHERE task_status = #{taskStatus} FROM t_car_review_task WHERE task_status = #{taskStatus}
</select> </select>
<select id="findByDetailsResult" resultType="com.ruoyi.domain.CarReviewTask">
SELECT tr.id,tr.task_no,tr.task_status,tr.task_initiator,tr.task_initiator_dept,
tr.task_result,tr.task_begin_time,tr.task_end_time,tr.standard,tr.create_time,
tr.leader_id,tr.leader,tr.standard_id,tr.name,tr.standard_no,tr.file,tr.submit_id,
tr.submit_name,tr.images_url
FROM t_car_review_task tr
LEFT JOIN t_review_details_result trdr ON tr.id = trdr.task_id
WHERE trdr.review_details_id = #{detailId} and tr.task_status = 'PENDING'
</select>
</mapper> </mapper>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<result property="taskBeginTime" column="task_begin_time" jdbcType="TIMESTAMP"/> <result property="taskBeginTime" column="task_begin_time" jdbcType="TIMESTAMP"/>
<result property="taskEndTime" column="task_end_time" jdbcType="TIMESTAMP"/> <result property="taskEndTime" column="task_end_time" jdbcType="TIMESTAMP"/>
<result property="inspectStandardId" column="inspect_standard_id" jdbcType="BIGINT"/> <result property="inspectStandardId" column="inspect_standard_id" jdbcType="BIGINT"/>
<result property="inspectStandardName" column="inspect_standard_name" jdbcType="VARCHAR"/> <result property="inspectStandardNo" column="inspect_standard_no" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<resultMap id="ResponseResultMap" type="com.ruoyi.web.response.ReviewSceneChangeTaskResponse"> <resultMap id="ResponseResultMap" type="com.ruoyi.web.response.ReviewSceneChangeTaskResponse">
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<result property="taskEndTime" column="task_end_time" jdbcType="TIMESTAMP"/> <result property="taskEndTime" column="task_end_time" jdbcType="TIMESTAMP"/>
<result property="decision" column="decision" jdbcType="VARCHAR"/> <result property="decision" column="decision" jdbcType="VARCHAR"/>
<result property="inspectStandardId" column="inspect_standard_id" jdbcType="BIGINT"/> <result property="inspectStandardId" column="inspect_standard_id" jdbcType="BIGINT"/>
<result property="inspectStandardName" column="inspect_standard_name" jdbcType="VARCHAR"/> <result property="inspectStandardNo" column="inspect_standard_no" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<select id="findLastChangeByTaskId" resultType="com.ruoyi.domain.ReviewSceneChangeTask"> <select id="findLastChangeByTaskId" resultType="com.ruoyi.domain.ReviewSceneChangeTask">
......
...@@ -37,5 +37,14 @@ ...@@ -37,5 +37,14 @@
FROM t_system_review_task WHERE task_status IN ('NEW','PENDING') FROM t_system_review_task WHERE task_status IN ('NEW','PENDING')
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
<select id="findByDetailsResult" resultType="com.ruoyi.domain.SystemReviewTask">
SELECT ts.id, ts.task_no, ts.task_status, ts.task_initiator, ts.task_initiator_dept,
ts.task_result, ts.task_begin_time, ts.task_end_time, ts.standard, ts.create_time,
ts.leader,ts.leader_id, ts.standard_id, ts.name, ts.standard_no, ts.file, ts.submit_by_id,
ts.submit_by_name,ts.images_url
FROM t_system_review_task ts
LEFT JOIN t_review_details_result trdr ON ts.id = trdr.task_id
WHERE trdr.review_details_id = #{detailId} and ts.task_status = 'PENDING'
</select>
</mapper> </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