Commit 2099bf60 authored by 盖献康's avatar 盖献康

Merge branch 'gaixiankang' into 'dev'

1

See merge request !185
parents 12fc0de8 9f66b059
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 com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.StandardJsonTypeHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* 车型试验任务
* @author gxk
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("车型试验任务")
@TableName(value ="t_model_test_task")
public class ModelTestTask {
/**
* 任务类型
*/
@TableField(exist = false)
public static final String TYPE = "car";
/**
* 任务状态
*/
@TableField(exist = false)
public static final String TASK_STATUS_NEW = "NEW";
@TableField(exist = false)
public static final String TASK_STATUS_PENDING = "PENDING";
@TableField(exist = false)
public static final String TASK_STATUS_SIGNED = "SIGNED";
@TableField(exist = false)
public static final String TASK_STATUS_FINISH = "FINISH";
@ApiModelProperty("主键")
@TableId(type = IdType.ASSIGN_ID)
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
@ApiModelProperty("任务编号")
private String taskNo;
@ApiModelProperty("任务状态[NEW、PENDING、SIGNED、FINISH]")
private String taskStatus;
@ApiModelProperty("任务发起人姓名")
private String taskInitiator;
@ApiModelProperty("任务发起人部门")
private String taskInitiatorDept;
@ApiModelProperty("任务结果(PASS、REJECT)")
private String taskResult;
@ApiModelProperty("任务开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskBeginTime;
@ApiModelProperty("任务结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date taskEndTime;
@ApiModelProperty("测试用例")
@TableField(value="testCase", typeHandler = StandardJsonTypeHandler. class)
private List<ReviewStandard> testCase;
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date createTime;
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("审查组长id")
private Long leaderId;
@ApiModelProperty("审查组长姓名")
private String leader;
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("关联标准表id")
private Long standardId;
@ApiModelProperty("标准名称")
private String name;
@ApiModelProperty("标准号")
private String standardNo;
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("提交人id")
private Long submitId;
@ApiModelProperty("提交人姓名")
private String submitName;
@ApiModelProperty("签名图片地址")
private String imagesUrl;
@ApiModelProperty("车型试验测试用例数")
private Integer details;
@ApiModelProperty("车型试验标准条款数")
private Integer standards;
}
......@@ -68,6 +68,11 @@ public class Task {
@TableField(insertStrategy = FieldStrategy.IGNORED,updateStrategy = FieldStrategy.IGNORED,whereStrategy = FieldStrategy.IGNORED)
private Long carReviewTaskId;
@ApiModelProperty("车型检验任务id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
@TableField(insertStrategy = FieldStrategy.IGNORED,updateStrategy = FieldStrategy.IGNORED,whereStrategy = FieldStrategy.IGNORED)
private Long modelTestTaskId;
@ApiModelProperty("任务状态NEW(新建的)、PENDING(运行中的)、FINISH(已结束的)、TEMPORARILY(暂存)")
private String taskStatus;
......
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 任务场景关系实体类
* @author gxk
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("任务场景关系实体类")
@TableName(value ="t_task_scenario_relation")
public class TaskScenarioRelation {
@ApiModelProperty("主键")
@TableId(type = IdType.ASSIGN_ID)
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
@ApiModelProperty("任务ID")
private Long taskId;
@ApiModelProperty("测试场景ID")
private Long testScenarioId;
}
package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.ModelTestTask;
import org.springframework.stereotype.Repository;
/**
* 车型试验Mapper层
* @author gxk
*/
@Repository
public interface ModelTestTaskMapper extends BaseMapper<ModelTestTask> {
}
package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.TaskScenarioRelation;
import org.springframework.stereotype.Repository;
/**
* 任务与场景关系Mapper接口
* @author gxk
*/
@Repository
public interface TaskScenarioRelationMapper extends BaseMapper<TaskScenarioRelation> {
}
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.ModelTestTask;
import org.springframework.stereotype.Service;
/**
* 车型试验任务Service接口
* @author gxk
*/
public interface ModelTestTaskService extends IService<ModelTestTask> {
}
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.ModelTestTask;
import com.ruoyi.mapper.ModelTestTaskMapper;
import com.ruoyi.service.ModelTestTaskService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 车型试验Service业务层处理
* @author gxk
*/
@Service
@Transactional
public class ModelTestTaskServiceImpl extends ServiceImpl<ModelTestTaskMapper, ModelTestTask> implements ModelTestTaskService {
}
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
......@@ -22,10 +23,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -90,6 +88,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
@Autowired
private AutomobileEnterpriseMapper automobileEnterpriseMapper;
@Autowired
private ModelTestTaskService modelTestTaskService;
@Autowired
private TaskScenarioRelationMapper taskScenarioRelationMapper;
@Override
public List<Task> findList(TaskListRequest request) {
......@@ -142,9 +145,23 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 保存体系审查任务
task.setSystemReviewTaskId(saveSystemReview(request,initiator,standard,leader));
}
if (request.getTaskList().contains(Task.SUB_TASK_TRFIS)) {
task.setModelTestTaskId(saveModelTest(request, initiator, standard, leader));
}
taskService.save(task);
// 总任务包含车型试验,添加任务-场景关联信息
if (CollUtil.isNotEmpty(request.getTestScenarioList())) {
for (Long sceneId : request.getTestScenarioList()) {
TaskScenarioRelation taskScenario = TaskScenarioRelation.builder()
.taskId(task.getId())
.testScenarioId(sceneId)
.build();
taskScenarioRelationMapper.insert(taskScenario);
}
}
// 构建并保存该任务所关联的审核组信息
saveUserRelation(auditors,task);
......@@ -269,6 +286,17 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
if (task != null) {
BeanUtils.copyBeanProp(response, task);
// 测试场景
List<String> taskList = Arrays.asList(task.getTaskList().split(","));
if (taskList.contains(Task.SUB_TASK_TRFIS) && taskList.size() == 1) {
List<Long> testkScenarioList = taskScenarioRelationMapper
.selectList(new QueryWrapper<TaskScenarioRelation>().eq("task_id", request.getId()))
.stream()
.map(TaskScenarioRelation::getTestScenarioId)
.collect(Collectors.toList());
response.setTestScenarioList(testkScenarioList);
}
// 小组成员
response.setAuditors(setAuditors(request.getId()));
......@@ -720,5 +748,35 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
return task.getId();
}
/**
* 保存车型试验任务
* @param request
* @param initiator
* @param standard
* @param leader
* @return
*/
public Long saveModelTest(TaskCreateRequest request,SysUser initiator,Standard standard,TaskUserRelation leader) {
// 构建并保存任务信息
ModelTestTask modelTestTask = ModelTestTask.builder()
.taskNo(request.getTaskNo())
.taskInitiator(initiator.getNickName())
.taskStatus(ModelTestTask.TASK_STATUS_NEW)
.leaderId(leader.getUserId())
.leader(leader.getName())
.createTime(DateUtils.getNowDate())
.standardId(standard.getId())
.name(standard.getName())
.standardNo(standard.getStandardNo())
.build();
if (initiator.getDept() != null) {
modelTestTask.setTaskInitiatorDept(initiator.getDept().getDeptName());
}
modelTestTaskService.save(modelTestTask);
return modelTestTask.getId();
}
}
package com.ruoyi.web;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 车型测试任务Controller
* @author gxk
*/
@RestController
@RequestMapping("/car/test/task")
public class ModelTestTaskController {
}
......@@ -62,5 +62,7 @@ public class TaskCreateRequest {
@ApiModelProperty("选择的任务")
List<String> taskList;
@ApiModelProperty("选择的测试场景")
private List<Long> testScenarioList;
}
......@@ -127,4 +127,7 @@ public class TaskGetInfoResponse {
@ApiModelProperty("零件样品信息")
private List<Sample> partVehicleSample;
@ApiModelProperty("测试场景")
private List<Long> testScenarioList;
}
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