Commit 545fa439 authored by 盖献康's avatar 盖献康

Merge branch 'dev' of...

Merge branch 'dev' of ssh://gitlab.91isoft.com:10022/wangfei/vehicle-quality-review into gaixiankang
parents f78a324a c1cb6e17
......@@ -74,9 +74,6 @@ public class Task {
@ApiModelProperty("任务运行状态[RUNNABLE(可运行的)、RUNNING(运行中的)]")
private String runStatus;
@ApiModelProperty("下一个节点 SUB_TASK_SRAIF(体系审查子任务)、SUB_TASK_TRFIS(车辆实验子任务)、SUB_TASK_GRFIS(车辆问卷子任务)")
private String nextNode;
@ApiModelProperty("任务编号")
private String taskNo;
......@@ -157,4 +154,21 @@ public class Task {
@ApiModelProperty("选择的项目")
private String taskList;
@ApiModelProperty("指向待执行节点的指针[0、1、2]")
private int pointer;
@ApiModelProperty("子任务指针最大值")
private int maxPointer;
// 返回当前节点的下一个节点
public String getNextNode() {
String[] split = taskList.split(",");
if(pointer + 1 > maxPointer) {
return null;
} else {
return split[pointer + 1];
}
}
}
......@@ -79,10 +79,12 @@ public class TestUseCase implements Serializable {
/** 测试场景 */
@ApiModelProperty("测试场景")
@TableField(exist = false)
private String testScenario;
/** 测试类型*/
@ApiModelProperty("测试类型")
@TableField(exist = false)
private String testType;
/**
......
......@@ -3,6 +3,7 @@ package com.ruoyi.mapper;
import com.ruoyi.domain.ReviewEnterpriseArchive;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewItemVO;
import com.ruoyi.web.request.ReviewEnterpriseArchiveFindByTaskIdRequest;
import com.ruoyi.web.request.ReviewEnterpriseArchiveFindRequest;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -29,6 +30,8 @@ public interface ReviewEnterpriseArchiveMapper extends BaseMapper<ReviewEnterpri
ReviewEnterpriseArchive findByFileName(@Param("fileName") String fileName);
List<ReviewEnterpriseArchive> findList(@Param("taskId") Long taskId);
List<ReviewEnterpriseArchive> findEnterpriseArchiveByTaskId(ReviewEnterpriseArchiveFindByTaskIdRequest request);
}
......
......@@ -33,4 +33,6 @@ public interface TaskMapper extends BaseMapper<Task> {
Long findBySystemReviewTaskId(@Param("systemReviewId") Long systemReviewId);
Task getByUserIdTemporary(@Param("userId") Long userId);
Task getBySubtaskId(@Param("subId") Long subId);
}
......@@ -3,6 +3,7 @@ package com.ruoyi.service;
import com.ruoyi.domain.ReviewEnterpriseArchive;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO;
import com.ruoyi.web.request.ReviewEnterpriseArchiveFindByTaskIdRequest;
import com.ruoyi.web.request.ReviewEnterpriseArchiveFindFileNameListRequest;
import com.ruoyi.web.request.ReviewEnterpriseArchiveFindRequest;
import com.ruoyi.web.request.ReviewEnterpriseArchiveGetInfoRequest;
......@@ -36,4 +37,6 @@ public interface ReviewEnterpriseArchiveService extends IService<ReviewEnterpris
ReviewEnterpriseArchive getInfo(ReviewEnterpriseArchiveGetInfoRequest request);
List<ReviewEnterpriseArchive> findList(ReviewEnterpriseArchiveFindFileNameListRequest request);
List<ReviewEnterpriseArchive> findEnterpriseArchiveByTaskId(ReviewEnterpriseArchiveFindByTaskIdRequest request);
}
......@@ -58,4 +58,6 @@ public interface TaskService extends IService<Task> {
void temporaryStorageTask(TaskCreateRequest request);
TaskGetInfoResponse getByUserId(Long userId);
TaskGetInfoResponse getBySubtaskId(TaskSubGetInfoRequest request);
}
......@@ -8,7 +8,8 @@ public interface TaskState {
void doCreate(Task task, List<String> taskList);
void doStart(Task task);
void doSubmit(Task task);
}
......@@ -7,11 +7,14 @@ import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.ReviewEnterpriseArchive;
import com.ruoyi.domain.Task;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewItemVO;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.service.ReviewEnterpriseArchiveService;
import com.ruoyi.mapper.ReviewEnterpriseArchiveMapper;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.web.request.ReviewEnterpriseArchiveFindByTaskIdRequest;
import com.ruoyi.web.request.ReviewEnterpriseArchiveFindFileNameListRequest;
import com.ruoyi.web.request.ReviewEnterpriseArchiveFindRequest;
import com.ruoyi.web.request.ReviewEnterpriseArchiveGetInfoRequest;
......@@ -40,14 +43,29 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp
@Autowired
private ReviewEnterpriseArchiveService reviewEnterpriseArchiveService;
@Autowired
private TaskMapper taskMapper;
@Override
public List<ReviewEnterpriseArchiveViewVO> view(Long taskId) {
Task task = taskMapper.selectById(taskId);
List<ReviewEnterpriseArchive> archives = reviewEnterpriseArchiveMapper.findByTaskId(taskId);
List<ReviewEnterpriseArchiveViewItemVO> viewItems = reviewEnterpriseArchiveMapper.findViewItemVOByTaskId(taskId);
return buildReviewEnterpriseArchiveViewVO(archives, viewItems);
List<ReviewEnterpriseArchiveViewVO> resultList = new ArrayList<>();
resultList.addAll(
buildReviewEnterpriseArchiveViewVO(archives, reviewEnterpriseArchiveMapper.findViewItemVOByTaskId(task.getSystemReviewTaskId()))
);
resultList.addAll(
buildReviewEnterpriseArchiveViewVO(archives, reviewEnterpriseArchiveMapper.findViewItemVOByTaskId(task.getCarReviewTaskId()))
);
return resultList;
}
@Override
......@@ -88,6 +106,11 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp
return reviewEnterpriseArchiveMapper.findList(request.getTaskId());
}
@Override
public List<ReviewEnterpriseArchive> findEnterpriseArchiveByTaskId(ReviewEnterpriseArchiveFindByTaskIdRequest request) {
return reviewEnterpriseArchiveMapper.findEnterpriseArchiveByTaskId(request);
}
private List<ReviewEnterpriseArchiveViewVO> buildReviewEnterpriseArchiveViewVO(List<ReviewEnterpriseArchive> archives, List<ReviewEnterpriseArchiveViewItemVO> viewItems) {
List<ReviewEnterpriseArchiveViewVO> viewList = new ArrayList();
......@@ -105,6 +128,7 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp
}
private void setReviewEnterpriseArchiveViewItemVO(ReviewEnterpriseArchiveViewVO view, List<ReviewEnterpriseArchiveViewItemVO> viewItems) {
if (viewItems == null) return;
List<ReviewEnterpriseArchiveViewItemVO> subList = new ArrayList();
Long archiveId = view.getId();
......
......@@ -16,6 +16,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -165,12 +166,36 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1));
for(ReviewStandard standard : standards) {
standard.setPassed(ReviewStandard.PASSED);
List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
for(ReviewKeyPoint keypoint : keyPointList) {
List<ReviewDetails> reviewDetailsList = keypoint.getReviewDetailsList();
for(ReviewDetails details : reviewDetailsList) {
ReviewDetailsResult reviewDetailsResult = resultMap.get(details.getId());
if(reviewDetailsResult == null || Objects.equals(reviewDetailsResult.getPassed(), ReviewStandard.NO_PASSED)) {
standard.setPassed(ReviewStandard.NO_PASSED);
}
if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) {
ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId());
reviewDetailsResult.setEnterpriseName(reviewEnterpriseArchive.getEnterpriseName());
}
details.setResult(reviewDetailsResult);
}
}
}
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findByCarReviewTaskId(carReviewTask.getId()));
carReviewTask.setStandards(calculateStandards(standards));
carReviewTask.setStandardsPass( calculateStandardsPass(standards, resultMap) / (double) carReviewTask.getStandards());
BigDecimal standardPass = new BigDecimal(calculateStandardsPass(standards, resultMap) / (double) carReviewTask.getStandards());
carReviewTask.setStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
carReviewTask.setDetails(calculateDetails(standards));
carReviewTask.setDetailsPass((calculateDetailsPass(standards, resultMap) / (double) carReviewTask.getDetails()));
BigDecimal detailsPass = new BigDecimal(calculateDetailsPass(standards, resultMap) / (double) carReviewTask.getDetails());
carReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
carReviewTask.setPerson(relationList.size());
}
......
......@@ -14,6 +14,8 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -160,12 +162,35 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1));
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findByCarReviewTaskId(systemReviewTask.getId()));
for(ReviewStandard standard : standards) {
standard.setPassed(ReviewStandard.PASSED);
List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
for(ReviewKeyPoint keypoint : keyPointList) {
List<ReviewDetails> reviewDetailsList = keypoint.getReviewDetailsList();
for(ReviewDetails details : reviewDetailsList) {
ReviewDetailsResult reviewDetailsResult = resultMap.get(details.getId());
if(reviewDetailsResult == null || Objects.equals(reviewDetailsResult.getPassed(), ReviewStandard.NO_PASSED)) {
standard.setPassed(ReviewStandard.NO_PASSED);
}
if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) {
ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId());
reviewDetailsResult.setEnterpriseName(reviewEnterpriseArchive.getEnterpriseName());
}
details.setResult(reviewDetailsResult);
}
}
}
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId()));
systemReviewTask.setStandards(calculateStandards(standards));
systemReviewTask.setStandardsPass( calculateStandardsPass(standards, resultMap) / (double) systemReviewTask.getStandards());
BigDecimal standardPass = new BigDecimal(calculateStandardsPass(standards, resultMap) / (double) systemReviewTask.getStandards());
systemReviewTask.setStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
systemReviewTask.setDetails(calculateDetails(standards));
systemReviewTask.setDetailsPass((calculateDetailsPass(standards, resultMap) / (double) systemReviewTask.getDetails()));
BigDecimal detailsPass = new BigDecimal(calculateDetailsPass(standards, resultMap) / (double) systemReviewTask.getDetails());
systemReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
systemReviewTask.setPerson(relationList.size());
}
......
......@@ -55,9 +55,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
@Autowired
private ReviewDetailsMapper reviewDetailsMapper;
@Autowired
private AutomobileEnterpriseMapper automobileEnterpriseMapper;
@Autowired
private TaskStateFacade taskStateFacade;
......@@ -302,25 +299,24 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
TaskGetInfoResponse response = new TaskGetInfoResponse();
Task task = taskService.getById(request.getId());
BeanUtils.copyBeanProp(response, task);
// 小组成员
List<TaskUserRelation> relation = taskUserRelationService.selectQTeamMembers(request.getId());
response.setAuditors(relation);
// 整车样品信息
List<TaskSampleRelation> relationList = taskSampleRelationService.selectByTaskId(request.getId(),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE);
if (relationList.size() != 0 && relationList != null) {
List<Sample> completeVehicleSampleList = sampleManagementMapper.findByIdList(relationList);
response.setCompleteVehicleSample(completeVehicleSampleList);
}
// 零部件样品信息
List<TaskSampleRelation> partRelationList = taskSampleRelationService.selectByTaskId(request.getId(),TaskSampleRelation.PART_VEHICLE_SAMPLE);
if (partRelationList.size() != 0 && partRelationList != null) {
List<Sample> partVehicleSampleList = sampleManagementMapper.findByIdList(partRelationList);
response.setPartVehicleSample(partVehicleSampleList);
if (task != null) {
BeanUtils.copyBeanProp(response, task);
// 小组成员
response.setAuditors(setAuditors(request.getId()));
// 整车样品信息
response.setCompleteVehicleSample(setSampleList(request.getId(),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE));
// 零部件样品信息
response.setPartVehicleSample(setSampleList(request.getId(),TaskSampleRelation.PART_VEHICLE_SAMPLE));
return response;
} else {
return null;
}
return response;
}
@Override
......@@ -337,16 +333,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
SysUser initiator = sysUserService.selectUserById(loginUser.getUserId());
Standard standard = standardService.findListById(request.getStandardId());
// 找到审查组长
TaskUserRelation leader = null;
List<TaskUserRelation> auditors = request.getAuditors();
for(TaskUserRelation auditor : auditors) {
if(auditor.getIsLeader() == 1) {
leader = auditor;
break;
}
}
// 构建并保存任务信息
// 总任务
Task task = new Task();
......@@ -354,8 +340,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
task.setTaskInitiator(initiator.getNickName());
task.setTaskInitiatorDept(initiator.getDept().getDeptName());
task.setTaskStatus(Task.TASK_STATUS_TEMPORARILY);
task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName());
task.setName(standard.getName());
task.setStandardNo(standard.getStandardNo());
task.setFile(standard.getFile());
......@@ -363,14 +347,32 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
task.setTaskList(joinTaskList);
BeanUtils.copyBeanProp(task, request);
taskService.save(task);
// 找到审查组长
TaskUserRelation leader = null;
List<TaskUserRelation> auditors = request.getAuditors();
if (auditors.size() != 0 && auditors != null) {
for(TaskUserRelation auditor : auditors) {
if(auditor.getIsLeader() == 1) {
leader = auditor;
break;
}
}
// 构建并保存该任务所关联的审核组信息
for(TaskUserRelation auditor : auditors) {
auditor.setTaskId(task.getId());
// 构建并保存该任务所关联的审核组信息
for(TaskUserRelation auditor : auditors) {
auditor.setTaskId(task.getId());
}
taskUserRelationService.saveBatch(auditors);
// 任务组长
task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName());
}
taskUserRelationService.saveBatch(auditors);
// 暂存
taskService.save(task);
// 保存关联的整车样品信息
List<TaskSampleRelation> relations = request.getSample();
......@@ -402,28 +404,66 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
if (task != null && task.getId() != null) {
BeanUtils.copyBeanProp(response, task);
// 小组成员
List<TaskUserRelation> relation = taskUserRelationService.selectQTeamMembers(task.getId());
response.setAuditors(relation);
response.setAuditors(setAuditors(task.getId()));
// 整车样品信息
List<TaskSampleRelation> relationList = taskSampleRelationService.selectByTaskId(task.getId(), TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE);
if (relationList.size() != 0 && relationList != null) {
List<Sample> completeVehicleSampleList = sampleManagementMapper.findByIdList(relationList);
response.setCompleteVehicleSample(completeVehicleSampleList);
}
response.setCompleteVehicleSample(setSampleList(task.getId(), TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE));
// 零部件样品信息
List<TaskSampleRelation> partRelationList = taskSampleRelationService.selectByTaskId(task.getId(), TaskSampleRelation.PART_VEHICLE_SAMPLE);
if (partRelationList.size() != 0 && partRelationList != null) {
List<Sample> partVehicleSampleList = sampleManagementMapper.findByIdList(partRelationList);
response.setPartVehicleSample(partVehicleSampleList);
}
response.setPartVehicleSample(setSampleList(task.getId(), TaskSampleRelation.PART_VEHICLE_SAMPLE));
return response;
} else {
return null;
}
}
@Override
public TaskGetInfoResponse getBySubtaskId(TaskSubGetInfoRequest request) {
TaskGetInfoResponse response = new TaskGetInfoResponse();
Task task = taskMapper.getBySubtaskId(request.getId());
if (task != null) {
BeanUtils.copyBeanProp(response, task);
// 小组成员
response.setAuditors(setAuditors(task.getId()));
// 整车样品信息
response.setCompleteVehicleSample(setSampleList(task.getId(),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE));
// 零部件样品信息
response.setPartVehicleSample(setSampleList(task.getId(),TaskSampleRelation.PART_VEHICLE_SAMPLE));
return response;
} else {
return null;
}
}
public List<TaskUserRelation> setAuditors ( Long id) {
// 小组成员
List<TaskUserRelation> relation = taskUserRelationService.selectQTeamMembers(id);
return relation;
}
public List<Sample> setSampleList(Long id,String type) {
// 样品信息
List<TaskSampleRelation> relationList = taskSampleRelationService.selectByTaskId(id,type);
if (relationList.size() != 0 && relationList != null) {
List<Sample> SampleList = sampleManagementMapper.findByIdList(relationList);
return SampleList;
} else {
return null;
}
}
public Long saveSystemReview(TaskCreateRequest request,SysUser initiator,Standard standard,TaskUserRelation leader) {
......
package com.ruoyi.service.impl;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.Task;
import com.ruoyi.service.CarReviewTaskService;
import com.ruoyi.service.SystemReviewTaskService;
import com.ruoyi.service.TaskService;
import com.ruoyi.service.TaskState;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Objects;
@Component
public abstract class TaskStateAdapter implements TaskState {
@Autowired
private SystemReviewTaskService systemReviewTaskService;
@Autowired
private CarReviewTaskService carReviewTaskService;
@Autowired
private TaskService taskService;
@Override
public void doStart(Task task) {
task.setTaskStatus(Task.TASK_STATUS_PENDING);
task.setRunStatus(Task.RUN_STATUS_STATUS_RUNNING);
if (Objects.equals(task.getNextNode(), Task.SUB_TASK_SRAIF)) {
systemReviewTaskService.start(task.getSystemReviewTaskId());
taskService.updateById(task);
} else if (Objects.equals(task.getNextNode(), Task.SUB_TASK_GRFIS)) {
carReviewTaskService.startReviewTask(task.getCarReviewTaskId());
taskService.updateById(task);
} else {
throw new ServiceException("已没有可执行的子任务节点", HttpStatus.ERROR);
}
task.setPointer(task.getPointer() + 1);
taskService.updateById(task);
}
}
......@@ -14,7 +14,7 @@ import java.util.List;
@Transactional
@Service
public class TaskStateFinish implements TaskState, InitializingBean {
public class TaskStateFinish extends TaskStateAdapter implements TaskState, InitializingBean {
@Autowired
private TaskStateContext taskStateContext;
......
......@@ -3,8 +3,6 @@ package com.ruoyi.service.impl;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.Task;
import com.ruoyi.service.CarReviewTaskService;
import com.ruoyi.service.SystemReviewTaskService;
import com.ruoyi.service.TaskService;
import com.ruoyi.service.TaskState;
import org.springframework.beans.factory.InitializingBean;
......@@ -13,12 +11,12 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Transactional
@Service
public class TaskStateNew implements TaskState, InitializingBean {
public class TaskStateNew extends TaskStateAdapter implements TaskState, InitializingBean {
@Autowired
private TaskStateContext taskStateContext;
......@@ -29,52 +27,29 @@ public class TaskStateNew implements TaskState, InitializingBean {
@Autowired
private TaskService taskService;
@Autowired
private SystemReviewTaskService systemReviewTaskService;
@Autowired
private CarReviewTaskService carReviewTaskService;
@Override
public void doCreate(Task task, List<String> taskList) {
String nextNode = null;
List<String> subTasks = new ArrayList<>();
if(taskList.contains(Task.SUB_TASK_TRFIS)) {
nextNode = Task.SUB_TASK_TRFIS;
}
if(taskList.contains(Task.SUB_TASK_GRFIS)) {
// 保存车型审查问卷任务
nextNode = Task.SUB_TASK_GRFIS;;
}
// 保存体系审查任务
if(taskList.contains(Task.SUB_TASK_SRAIF)) {
// 保存体系审查任务
nextNode = Task.SUB_TASK_SRAIF;
subTasks.add(Task.SUB_TASK_SRAIF);
}
task.setNextNode(nextNode);
taskService.updateById(task);
}
@Override
public void doStart(Task task) {
task.setTaskStatus(Task.TASK_STATUS_PENDING);
task.setRunStatus(Task.RUN_STATUS_STATUS_RUNNING);
if (Objects.equals(task.getNextNode(), Task.SUB_TASK_SRAIF)) {
systemReviewTaskService.start(task.getSystemReviewTaskId());
task.setNextNode(Task.SUB_TASK_GRFIS);
taskService.updateById(task);
} else if (Objects.equals(task.getNextNode(), Task.SUB_TASK_GRFIS)) {
carReviewTaskService.startReviewTask(task.getCarReviewTaskId());
task.setNextNode(Task.SUB_TASK_TRFIS);
taskService.updateById(task);
// 保存车型审查问卷任务
if(taskList.contains(Task.SUB_TASK_GRFIS)) {
subTasks.add(Task.SUB_TASK_GRFIS);
}
// 车型试验任务
if(taskList.contains(Task.SUB_TASK_TRFIS)) {
subTasks.add(Task.SUB_TASK_TRFIS);
}
task.setPointer(0);
task.setMaxPointer(subTasks.size());
taskService.updateById(task);
}
......@@ -87,4 +62,5 @@ public class TaskStateNew implements TaskState, InitializingBean {
public void afterPropertiesSet() throws Exception {
taskStateContext.putResource(Task.TASK_STATUS_NEW, applicationContext.getBean(this.getClass()));
}
}
......@@ -6,8 +6,7 @@ import com.ruoyi.domain.CarReviewTask;
import com.ruoyi.domain.SystemReviewTask;
import com.ruoyi.domain.Task;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.service.CarReviewTaskService;
import com.ruoyi.service.SystemReviewTaskService;
import com.ruoyi.service.TaskService;
import com.ruoyi.service.TaskState;
import org.springframework.beans.factory.InitializingBean;
......@@ -17,11 +16,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
@Transactional
@Service
public class TaskStatePending implements TaskState, InitializingBean {
public class TaskStatePending extends TaskStateAdapter implements TaskState, InitializingBean {
@Autowired
private TaskStateContext taskStateContext;
......@@ -35,37 +33,13 @@ public class TaskStatePending implements TaskState, InitializingBean {
@Autowired
private ApplicationContext applicationContext;
@Autowired
private SystemReviewTaskService systemReviewTaskService;
@Autowired
private CarReviewTaskService carReviewTaskService;
@Override
public void doCreate(Task task, List<String> taskList) {
throw new ServiceException("不能创建一个已经开始的任务", HttpStatus.ERROR);
}
@Override
public void doStart(Task task) {
task.setTaskStatus(Task.TASK_STATUS_PENDING);
task.setRunStatus(Task.RUN_STATUS_STATUS_RUNNING);
if (Objects.equals(task.getNextNode(), Task.SUB_TASK_SRAIF)) {
systemReviewTaskService.start(task.getSystemReviewTaskId());
task.setNextNode(Task.SUB_TASK_GRFIS);
taskService.updateById(task);
} else if (Objects.equals(task.getNextNode(), Task.SUB_TASK_GRFIS)) {
carReviewTaskService.startReviewTask(task.getCarReviewTaskId());
task.setNextNode(Task.SUB_TASK_TRFIS);
taskService.updateById(task);
}
}
@Override
public void doSubmit(Task task) {
......
......@@ -40,6 +40,15 @@ public class ReviewEnterpriseArchiveController extends BaseController {
return getDataTable(reviewEnterpriseArchiveService.findEnterpriseArchive(request));
}
@ApiOperation("根据任务id分页查询车企文件")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/findEnterpriseArchiveByTaskId")
public TableDataInfo<ReviewEnterpriseArchive> findEnterpriseArchiveByTaskId(@Validated @RequestBody ReviewEnterpriseArchiveFindByTaskIdRequest request) {
startPage(request);
return getDataTable(reviewEnterpriseArchiveService.findEnterpriseArchiveByTaskId(request));
}
@ApiOperation("根据id查询")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
......
......@@ -91,6 +91,16 @@ public class TaskController extends BaseController {
return R.ok(response);
}
@ApiOperation("根据子任务id查看任务详情")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getBySubtaskId")
public R<TaskGetInfoResponse> getBySubtaskId(@Validated @RequestBody TaskSubGetInfoRequest request) {
TaskGetInfoResponse response = taskService.getBySubtaskId(request);
return R.ok(response);
}
@ApiOperation("用户发布的任务")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
......
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "ReviewEnterpriseArchiveFindByTaskIdRequest", description = "根据任务id查询车企文件")
@Data
public class ReviewEnterpriseArchiveFindByTaskIdRequest extends PageDomain {
@ApiModelProperty("文件名称")
private String fileName;
@ApiModelProperty("文件状态")
private String status;
@ApiModelProperty("文件识别号")
private String identifyNumber;
@ApiModelProperty("任务id")
private Long taskId;
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "TaskSubGetInfoRequest", description = "根据子任务id查看任务详情")
@Data
public class TaskSubGetInfoRequest {
@ApiModelProperty("id")
private Long id;
}
......@@ -42,9 +42,6 @@ public class TaskFindResponse {
@ApiModelProperty("任务运行状态[RUNNABLE(可运行的)、RUNNING(运行中的)]")
private String runStatus;
@ApiModelProperty("下一个节点 SUB_TASK_SRAIF(体系审查子任务)、SUB_TASK_TRFIS(车辆实验子任务)、SUB_TASK_GRFIS(车辆问卷子任务)")
private String nextNode;
@ApiModelProperty("总任务开始时间")
private Date taskBeginTime;
......
......@@ -35,9 +35,6 @@ public class TaskGetInfoResponse {
@ApiModelProperty("任务运行状态[RUNNABLE(可运行的)、RUNNING(运行中的)]")
private String runStatus;
@ApiModelProperty("下一个节点 SUB_TASK_SRAIF(体系审查子任务)、SUB_TASK_TRFIS(车辆实验子任务)、SUB_TASK_GRFIS(车辆问卷子任务)")
private String nextNode;
@ApiModelProperty("任务编号")
private String taskNo;
......
......@@ -65,4 +65,20 @@
FROM t_review_enterprise_archive
where task_id = #{taskId}
</select>
<select id="findEnterpriseArchiveByTaskId" resultType="com.ruoyi.domain.ReviewEnterpriseArchive">
SELECT id, enterprise_name, file_name, version, publish_date, status, identify_number, storage, photo, task_id, create_by, create_time
FROM t_review_enterprise_archive
<where>
task_id = #{taskId}
<if test="fileName != null and fileName != ''">
and file_name like concat('%',#{fileName},'%')
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
<if test="identifyNumber != null and identifyNumber != ''">
and identify_number = #{identifyNumber}
</if>
</where>
</select>
</mapper>
......@@ -10,7 +10,6 @@
<result property="carReviewTaskId" column="car_review_task_id" jdbcType="BIGINT"/>
<result property="taskStatus" column="task_status" jdbcType="VARCHAR"/>
<result property="runStatus" column="run_status" jdbcType="VARCHAR"/>
<result property="nextNode" column="next_node" jdbcType="VARCHAR"/>
<result property="taskNo" column="task_no" jdbcType="VARCHAR"/>
<result property="taskName" column="task_name" jdbcType="VARCHAR"/>
<result property="confidentialityLevel" column="confidentiality_level" jdbcType="VARCHAR"/>
......@@ -35,6 +34,8 @@
<result property="standardNo" column="standard_no" jdbcType="VARCHAR"/>
<result property="file" column="file" jdbcType="VARCHAR"/>
<result property="taskList" column="task_list" jdbcType="VARCHAR"/>
<result property="pointer" column="pointer" jdbcType="BIGINT"/>
<result property="maxPointer" column="max_pointer" jdbcType="BIGINT"/>
</resultMap>
<resultMap id="ResponseMap" type="com.ruoyi.web.response.TaskFindResponse">
......@@ -47,7 +48,6 @@
<result property="productModel" column="product_model" jdbcType="VARCHAR"/>
<result property="taskStatus" column="task_status" jdbcType="VARCHAR"/>
<result property="runStatus" column="run_status" jdbcType="VARCHAR"/>
<result property="nextNode" column="next_node" jdbcType="VARCHAR"/>
<result property="taskBeginTime" column="task_begin_time" jdbcType="TIMESTAMP"/>
<result property="taskEndTime" column="task_end_time" jdbcType="TIMESTAMP"/>
<result property="systemTaskBeginTime" column="system_task_begin_time" jdbcType="TIMESTAMP"/>
......@@ -62,7 +62,7 @@
<select id="findList" parameterType="com.ruoyi.web.request.TaskListRequest" resultMap="BaseResultMap">
SELECT id, system_review_task_id, car_review_task_id,
task_status,next_node,task_no,task_name,confidentiality_level,
task_status,task_no,task_name,confidentiality_level,
product_name,product_model,
entrusted_unit,entrusted_unit_address,entrusted_unit_phone,
entrusted_unit_code,vehicle_sample_information,part_sample_information,
......@@ -87,7 +87,6 @@
t.leader_id,t.leader,
t.task_begin_time,
t.product_model,
t.next_node,
srt.task_begin_time system_task_begin_time,
srt.task_end_time system_task_end_time,
srt.task_status review_status,
......@@ -168,7 +167,6 @@
t.leader_id,t.leader,
t.task_begin_time,
t.task_end_time,
t.next_node,
srt.task_begin_time system_task_begin_time,
srt.task_end_time system_task_end_time,
srt.task_status review_status,
......@@ -241,7 +239,7 @@
</select>
<select id="getByUserIdTemporary" resultType="com.ruoyi.domain.Task">
SELECT id, system_review_task_id, car_review_task_id,
task_status,run_status,next_node,task_no,task_name,confidentiality_level,
task_status,run_status,task_no,task_name,confidentiality_level,
product_name,product_model,
entrusted_unit,entrusted_unit_address,entrusted_unit_phone,
entrusted_unit_code,vehicle_sample_information,part_sample_information,
......@@ -252,6 +250,19 @@
FROM t_task
WHERE task_initiator_id = #{userId} and task_status = 'TEMPORARILY'
</select>
<select id="getBySubtaskId" resultType="com.ruoyi.domain.Task">
SELECT id, system_review_task_id, car_review_task_id,
task_status,run_status,task_no,task_name,confidentiality_level,
product_name,product_model,
entrusted_unit,entrusted_unit_address,entrusted_unit_phone,
entrusted_unit_code,vehicle_sample_information,part_sample_information,
task_initiator_id,task_initiator,task_initiator_dept,
task_begin_time,task_end_time,create_time,
leader_id,leader,standard_id,name,
standard_no,file,task_list
FROM t_task
WHERE system_review_task_id = #{subId} OR car_review_task_id = #{subId}
</select>
</mapper>
This source diff could not be displayed because it is too large. You can view the blob instead.
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