Commit b5d9a98d authored by W_Y's avatar W_Y

创建车辆审查任务

parent e4224c73
......@@ -9,12 +9,14 @@ import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 车型审查任务
* @TableName t_car_review_task
*/
@TableName(value ="t_car_review_task")
@Accessors(chain = true)
@Data
public class CarReviewTask implements Serializable {
......@@ -157,4 +159,4 @@ public class CarReviewTask implements Serializable {
@ApiModelProperty("车型测试任务状态[NONE、NEW、PENDING、FINISH]")
private String testStatus;
}
\ 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 io.swagger.annotations.ApiModel;
......@@ -11,13 +10,13 @@ import lombok.experimental.Accessors;
/**
* 体系审查任务&用户映射关系
* @TableName t_system_review_task_user_relation
* @TableName t_review_task_user_relation
*/
@ApiModel
@TableName(value ="t_system_review_task_user_relation")
@TableName(value ="t_review_task_user_relation")
@Accessors(chain = true)
@Data
public class SystemReviewTaskUserRelation {
public class ReviewTaskUserRelation {
/**
* 任务id
......@@ -44,4 +43,4 @@ public class SystemReviewTaskUserRelation {
@ApiModelProperty("用户姓名")
private String name;
}
\ No newline at end of file
}
package com.ruoyi.mapper;
import com.ruoyi.domain.SystemReviewTaskUserRelation;
import com.ruoyi.domain.ReviewTaskUserRelation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
......@@ -11,7 +11,7 @@ import org.springframework.stereotype.Repository;
* @Entity com.ruoyi.domain.SystemReviewTaskUserRelation
*/
@Repository
public interface SystemReviewTaskUserRelationMapper extends BaseMapper<SystemReviewTaskUserRelation> {
public interface ReviewTaskUserRelationMapper extends BaseMapper<ReviewTaskUserRelation> {
}
......
......@@ -32,7 +32,7 @@ public interface CarReviewTaskService extends IService<CarReviewTask> {
* @param taskId
* @return
*/
SystemReviewTaskViewResponse view(Long taskId);
SystemReviewTaskViewResponse viewReviewTask(Long taskId);
/**
......
package com.ruoyi.service;
import com.ruoyi.domain.SystemReviewTaskUserRelation;
import com.ruoyi.domain.ReviewTaskUserRelation;
import com.baomidou.mybatisplus.extension.service.IService;
/**
......@@ -8,6 +8,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @description 针对表【t_system_review_task_user_relation(体系审查任务&用户映射关系)】的数据库操作Service
* @createDate 2023-12-15 10:41:16
*/
public interface SystemReviewTaskUserRelationService extends IService<SystemReviewTaskUserRelation> {
public interface ReviewTaskUserRelationService extends IService<ReviewTaskUserRelation> {
}
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.CarReviewTask;
import com.ruoyi.domain.ReviewTaskUserRelation;
import com.ruoyi.domain.Standard;
import com.ruoyi.domain.SystemReviewTask;
import com.ruoyi.service.CarReviewTaskService;
import com.ruoyi.mapper.CarReviewTaskMapper;
import com.ruoyi.service.ReviewTaskUserRelationService;
import com.ruoyi.service.StandardService;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.web.request.CarReviewTaskCreateRequest;
import com.ruoyi.web.request.CarReviewTaskStartRequest;
import com.ruoyi.web.request.CarReviewTaskSubmitRequest;
......@@ -12,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
......@@ -27,6 +38,18 @@ public class CarReviewTaskServiceImpl extends ServiceImpl<CarReviewTaskMapper, C
@Autowired
private CarReviewTaskMapper carReviewTaskMapper;
@Autowired
private ISysUserService sysUserService;
@Autowired
private StandardService standardService;
@Autowired
private CarReviewTaskService carReviewTaskService;
@Autowired
private ReviewTaskUserRelationService relationService;
@Override
public List<CarReviewTask> findListByReviewStatus(String reviewStatus) {
return carReviewTaskMapper.findListByReviewStatus(reviewStatus);
......@@ -35,10 +58,59 @@ public class CarReviewTaskServiceImpl extends ServiceImpl<CarReviewTaskMapper, C
@Override
public void createTask(CarReviewTaskCreateRequest request) {
// 构建任务创建者
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser initiator = sysUserService.selectUserById(loginUser.getUserId());
Standard standard = standardService.findListById(request.getStandardId());
// 找到审查组长
ReviewTaskUserRelation leader = null;
List<ReviewTaskUserRelation> auditors = request.getAuditors();
for(ReviewTaskUserRelation auditor : auditors) {
if(auditor.getIsLeader() == 1) {
leader = auditor;
break;
}
}
// 构建并保存任务信息
CarReviewTask task = new CarReviewTask()
.setTaskNo(SnowflakeUtil.generate().toString())
.setTaskInitiator(initiator.getNickName())
.setTaskInitiatorDept(initiator.getDept().getDeptName())
.setTaskStatus(CarReviewTask.TASK_STATUS_PENDING)
.setBizInfo(request.getBizInfo())
.setLeaderId(leader.getUserId())
.setLeader(leader.getName())
.setCreateTime(new Date())
.setStandardId(standard.getId())
.setName(standard.getName())
.setStandardNo(standard.getStandardNo())
.setFile(standard.getFile());
if (request.getReview()) {
task.setReviewStatus(CarReviewTask.REVIEW_STATUS_NEW);
} else {
task.setReviewStatus(CarReviewTask.REVIEW_STATUS_NONE);
}
if (request.getTest()) {
task.setTestStatus(CarReviewTask.TEST_STATUS_NEW);
} else {
task.setTestStatus(CarReviewTask.TEST_STATUS_NONE);
}
carReviewTaskService.save(task);
// 构建并保存该任务所关联的审核组信息
for(ReviewTaskUserRelation auditor : auditors) {
auditor.setTaskId(task.getId());
}
relationService.saveBatch(auditors);
}
@Override
public SystemReviewTaskViewResponse view(Long taskId) {
public SystemReviewTaskViewResponse viewReviewTask(Long taskId) {
return null;
}
......
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 com.ruoyi.domain.ReviewTaskUserRelation;
import com.ruoyi.service.ReviewTaskUserRelationService;
import com.ruoyi.mapper.ReviewTaskUserRelationMapper;
import org.springframework.stereotype.Service;
/**
* @author wangfei
* @description 针对表【t_system_review_task_user_relation(体系审查任务&用户映射关系)】的数据库操作Service实现
* @description 针对表【t_review_task_user_relation(体系审查任务&用户映射关系)】的数据库操作Service实现
* @createDate 2023-12-15 10:41:16
*/
@Service
public class SystemReviewTaskUserRelationServiceImpl extends ServiceImpl<SystemReviewTaskUserRelationMapper, SystemReviewTaskUserRelation>
implements SystemReviewTaskUserRelationService{
public class ReviewTaskUserRelationServiceImpl extends ServiceImpl<ReviewTaskUserRelationMapper, ReviewTaskUserRelation>
implements ReviewTaskUserRelationService {
}
......
......@@ -9,7 +9,6 @@ import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.SnowflakeUtil;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.*;
import com.ruoyi.system.service.ISysUserService;
......@@ -33,7 +32,7 @@ import java.util.*;
public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMapper, SystemReviewTask> implements SystemReviewTaskService {
@Autowired
private SystemReviewTaskUserRelationService systemReviewTaskUserRelationService;
private ReviewTaskUserRelationService systemReviewTaskUserRelationService;
@Autowired
private SystemReviewTaskService systemReviewTaskService;
......@@ -63,9 +62,9 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
Standard standard = standardService.findListById(request.getStandardId());
// 找到审查组长
SystemReviewTaskUserRelation leader = null;
List<SystemReviewTaskUserRelation> auditors = request.getAuditors();
for(SystemReviewTaskUserRelation auditor : auditors) {
ReviewTaskUserRelation leader = null;
List<ReviewTaskUserRelation> auditors = request.getAuditors();
for(ReviewTaskUserRelation auditor : auditors) {
if(auditor.getIsLeader() == 1) {
leader = auditor;
break;
......@@ -91,7 +90,7 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
// 构建并保存该任务所关联的审核组信息
for(SystemReviewTaskUserRelation auditor : auditors) {
for(ReviewTaskUserRelation auditor : auditors) {
auditor.setTaskId(task.getId());
}
systemReviewTaskUserRelationService.saveBatch(auditors);
......
package com.ruoyi.web.request;
import com.ruoyi.domain.ReviewTaskUserRelation;
import lombok.Data;
import java.util.List;
@Data
public class CarReviewTaskCreateRequest {
private String bizInfo;
private List<ReviewTaskUserRelation> auditors;
/**
* 是否创建车型问卷审查任务
*/
private Boolean review;
/**
* 是否创建车型测试任务
*/
private Boolean test;
/**
* 标准id
* 根据哪个标准新建的审查任务
*/
private Long standardId;
}
package com.ruoyi.web.request;
import com.ruoyi.domain.SystemReviewTaskUserRelation;
import com.ruoyi.domain.ReviewTaskUserRelation;
import lombok.Data;
import java.util.List;
......@@ -10,7 +10,7 @@ public class SystemReviewTaskCreateRequest {
private String bizInfo;
private List<SystemReviewTaskUserRelation> auditors;
private List<ReviewTaskUserRelation> auditors;
/**
* 标准id
......
......@@ -2,15 +2,16 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.mapper.SystemReviewTaskUserRelationMapper">
<mapper namespace="com.ruoyi.mapper.ReviewTaskUserRelationMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.domain.SystemReviewTaskUserRelation">
<resultMap id="BaseResultMap" type="com.ruoyi.domain.ReviewTaskUserRelation">
<result property="taskId" column="task_id" jdbcType="BIGINT"/>
<result property="userId" column="user_id" jdbcType="BIGINT"/>
<result property="isLeader" column="is_leader" jdbcType="TINYINT"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
task_id,user_id,is_leader
task_id,user_id,is_leader,name
</sql>
</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