Commit ba67fdad authored by 王飞's avatar 王飞

Merge branch 'dev' into wangfei

parents 1b071cea b1ee58b2
......@@ -159,7 +159,7 @@ public class CarReviewTask implements Serializable {
@TableField(exist = false)
@ApiModelProperty("审查细则符合率")
private Long detailsPass;
private Double detailsPass;
@TableField(exist = false)
@ApiModelProperty("标准条款(条)")
......@@ -167,7 +167,7 @@ public class CarReviewTask implements Serializable {
@TableField(exist = false)
@ApiModelProperty("标准条款通过率")
private Long standardsPass;
private Double standardsPass;
@TableField(exist = false)
@ApiModelProperty("参与审查人数(人)")
......
......@@ -30,6 +30,12 @@ public class ReviewStandard {
public static final String TYPE_CAR = "car"; // 车型审查类型
public static final String TYPE_TEST = "test"; // 车型试验类型
// 标准通过
public static final Integer PASSED = 1;
// 标准不通过
public static final Integer NO_PASSED = 0;
/**
* 主键
*/
......
......@@ -157,4 +157,24 @@ public class SystemReviewTask {
@ApiModelProperty("签名图片地址")
private String imagesUrl;
@TableField(exist = false)
@ApiModelProperty("审查细则(条)")
private Integer details;
@TableField(exist = false)
@ApiModelProperty("审查细则符合率")
private Double detailsPass;
@TableField(exist = false)
@ApiModelProperty("标准条款(条)")
private Integer standards;
@TableField(exist = false)
@ApiModelProperty("标准条款通过率")
private Double standardsPass;
@TableField(exist = false)
@ApiModelProperty("参与审查人数(人)")
private Integer person;
}
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.baomidou.mybatisplus.annotation.*;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
......@@ -69,6 +68,25 @@ public class TestUseCase implements Serializable {
@ApiModelProperty("用例描述")
private String description;
/** 更新者 */
@ApiModelProperty("更新者")
private String updateBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("更新时间")
private Date updateTime;
/** 测试场景 */
@ApiModelProperty("测试场景")
@TableField(exist = false)
private String testScenario;
/** 测试类型*/
@ApiModelProperty("测试类型")
@TableField(exist = false)
private String testType;
/**
* 返回用例在矩阵中的坐标
* @return
......
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@ApiModel(value = "ReviewEnterpriseArchiveViewItemVO", description = "条目VO")
@Accessors(chain = true)
@Data
public class ReviewEnterpriseArchiveViewItemVO {
// 文件目录
@ApiModelProperty("文件目录")
private String catalogue;
// 标准章节
@ApiModelProperty("标准章节")
private String chapter;
// 标准要求
@ApiModelProperty("标准要求")
private String standard;
// 要点要求
@ApiModelProperty("要点要求")
private String keyPoint;
// 企业留档文件id
@ApiModelProperty("企业留档文件id")
private Long archiveId;
}
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@ApiModel(value = "ReviewEnterpriseArchiveViewVO", description = "企业留档文件VO")
@Data
public class ReviewEnterpriseArchiveViewVO {
// 企业留档文件id
@ApiModelProperty("企业留档文件id")
private Long id;
// 企业留档文件名称
@ApiModelProperty("企业留档文件名称")
private String fileName;
// 条目
@ApiModelProperty("条目")
private List<ReviewEnterpriseArchiveViewItemVO> items;
}
......@@ -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);
}
......@@ -2,6 +2,10 @@ package com.ruoyi.mapper;
import com.ruoyi.domain.TestUseCase;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.web.request.TestUserCaseRequest;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author wangfei
......@@ -9,8 +13,16 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @createDate 2024-02-18 13:41:28
* @Entity com.ruoyi.domain.TestUseCase
*/
@Repository
public interface TestUseCaseMapper extends BaseMapper<TestUseCase> {
/**
* 查询测试用例列表
*
* @param testUserCaseRequest 测试用例库
* @return 测试用例集合
*/
public List<TestUseCase> selectseCaseList(TestUserCaseRequest testUserCaseRequest);
}
......
......@@ -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);
}
......@@ -2,6 +2,9 @@ package com.ruoyi.service;
import com.ruoyi.domain.TestUseCase;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.web.request.TestUserCaseRequest;
import java.util.List;
/**
* @author wangfei
......@@ -9,5 +12,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @createDate 2024-02-18 13:41:28
*/
public interface TestUseCaseService extends IService<TestUseCase> {
/**
* 查询测试用例列表
*
* @param testUserCaseRequest 测试用例库
* @return 测试用例集合
*/
public List<TestUseCase> selectseCaseList(TestUserCaseRequest testUserCaseRequest);
}
......@@ -12,6 +12,7 @@ import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO;
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;
......@@ -88,6 +89,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();
......@@ -109,7 +115,7 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp
Long archiveId = view.getId();
for(ReviewEnterpriseArchiveViewItemVO item : viewItems) {
if(item.getArchiveId().equals(archiveId)) {
if(item.getArchiveId() != null && item.getArchiveId().equals(archiveId)) {
subList.add(item);
}
}
......
......@@ -16,10 +16,8 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -86,30 +84,6 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
// 获取最新问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR);
List<ReviewStandard> reviewStandardList = reviewStandardMapper.findListByStandardIdAndType(carReviewTask.getStandardId(), ReviewStandard.TYPE_CAR); // 查询审查标准
List<ReviewKeyPoint> reviewKeyPointList = reviewKeyPointService.findByStandardList(reviewStandardList); // 查询审查要点
List<ReviewDetails> reivewDetailsList = reviewDetailsService.findByKeyPointsList(reviewKeyPointList); // 查询审查细则
// for(ReviewStandard standard : standardTree) {
// standard.setPassed(0);
// standardsNum ++;
// List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
//
// for(ReviewKeyPoint keypoint : keyPointList) {
// List<ReviewDetails> reviewDetailsList = keypoint.getReviewDetailsList();
//
// for(ReviewDetails details : reviewDetailsList) {
// detailsNum ++;
// ReviewDetailsResult reviewDetailsResult = resultMap.get(details.getId());
// if(reviewDetailsResult != null && reviewDetailsResult.getPassed() != 0) {
// standard.setPassed(reviewDetailsResult.getPassed());
// standardsPassNum ++;
// detailsPassNum ++;
// }
// }
// }
// }
// 获取当前问卷答案
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(carReviewTask.getId());
......@@ -192,56 +166,36 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1));
// //审查细则(条)
// int detailsNum = 0;
//
// //审查细则符合数
// int detailsPassNum = 0;
//
// //标准条款(条)
// int standardsNum = 0;
//
// //标准条款通过数
// int standardsPassNum = 0;
//
// for(ReviewStandard standard : standards) {
// standard.setPassed(1);
// standardsNum ++;
// List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
//
// for(ReviewKeyPoint keypoint : keyPointList) {
// List<ReviewDetails> reviewDetailsList = keypoint.getReviewDetailsList();
//
// for(ReviewDetails details : reviewDetailsList) {
// detailsNum ++;
// ReviewDetailsResult reviewDetailsResult = resultMap.get(details.getId());
// if(reviewDetailsResult == null || reviewDetailsResult.getPassed() == 0) {
// standard.setPassed(reviewDetailsResult.getPassed());
// detailsPassNum ++;
// standardsPassNum ++;
//
// }
// 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()));
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);
}
}
}
// carReviewTask.setDetails(detailsNum);
// carReviewTask.setDetailsPass(((long)detailsPassNum/(long)detailsNum));
// carReviewTask.setStandards(standardsNum);
// carReviewTask.setStandardsPass(((long)standardsPassNum/(long)standardsNum));
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findByCarReviewTaskId(carReviewTask.getId()));
carReviewTask.setStandards(calculateStandards(standards));
carReviewTask.setStandardsPass(calculateStandardsPass(standards, resultMap) / (long) 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) / (long) 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());
}
......@@ -257,11 +211,17 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
for(ReviewStandard standard : standards) {
List<ReviewDetails> details = getDetailsByStandard(standard);
boolean isPass = true;
for(ReviewDetails reviewDetails : details) {
if(detailsIsPass(reviewDetails, resultMap)) {
standardsPass = standardsPass + 1;
if(!detailsIsPass(reviewDetails, resultMap)) {
isPass = false;
}
}
if(isPass) {
standardsPass = standardsPass + 1;
}
}
return standardsPass;
......@@ -315,7 +275,12 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
private boolean detailsIsPass(ReviewDetails reviewDetails, Map<Long, ReviewDetailsResult> resultMap) {
ReviewDetailsResult result = resultMap.get(reviewDetails.getId());
return result.getPassed() == 1;
if (result != null ) {
return Objects.equals(result.getPassed(), ReviewStandard.PASSED);
} else {
return false;
}
}
@Override
......
......@@ -14,9 +14,9 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -62,6 +62,9 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
@Autowired
private ReviewEnterpriseArchiveMapper reviewEnterpriseArchiveMapper;
@Autowired
private TaskUserRelationMapper taskUserRelationMapper;
@Override
public void doStart(SystemReviewTask systemReviewTask) {
throw new ServiceException("不能开始一个已经开始的任务", HttpStatus.ERROR);
......@@ -95,7 +98,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(systemReviewTask.getId());
// 3. 将最终问卷归档到 standard 字段
setDetailsResult(standardTree, results);
setDetailsResult(standardTree, results, systemReviewTask);
systemReviewTask.setStandard(standardTree);
......@@ -139,7 +142,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
}
// 绑定问卷与答案
setDetailsResult(standardTree, results);
setDetailsResult(standardTree, results, systemReviewTask);
// 赋值给任务
systemReviewTask.setStandard(standardTree);
......@@ -155,12 +158,12 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
return response;
}
private void setDetailsResult(List<ReviewStandard> standards, List<ReviewDetailsResult> results) {
private void setDetailsResult(List<ReviewStandard> standards, List<ReviewDetailsResult> results,SystemReviewTask systemReviewTask) {
Map<Long, ReviewDetailsResult> resultMap = results.stream().collect(Collectors.toMap(ReviewDetailsResult::getReviewDetailsId, Function.identity(), (v1, v2) -> v1));
for(ReviewStandard standard : standards) {
standard.setPassed(1);
standard.setPassed(ReviewStandard.PASSED);
List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
for(ReviewKeyPoint keypoint : keyPointList) {
......@@ -168,8 +171,8 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
for(ReviewDetails details : reviewDetailsList) {
ReviewDetailsResult reviewDetailsResult = resultMap.get(details.getId());
if(reviewDetailsResult == null || reviewDetailsResult.getPassed() == 0) {
standard.setPassed(0);
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());
......@@ -179,6 +182,99 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
}
}
}
List<TaskUserRelation> relationList = taskUserRelationMapper.selectQTeamMembers(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId()));
systemReviewTask.setStandards(calculateStandards(standards));
BigDecimal standardPass = new BigDecimal(calculateStandardsPass(standards, resultMap) / (double) systemReviewTask.getStandards());
systemReviewTask.setStandardsPass(standardPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
systemReviewTask.setDetails(calculateDetails(standards));
BigDecimal detailsPass = new BigDecimal(calculateDetailsPass(standards, resultMap) / (double) systemReviewTask.getDetails());
systemReviewTask.setDetailsPass(detailsPass.setScale(3,BigDecimal.ROUND_UP).doubleValue() * 100);
systemReviewTask.setPerson(relationList.size());
}
private int calculateStandards(List<ReviewStandard> standards) {
return standards.size();
}
private long calculateStandardsPass(List<ReviewStandard> standards, Map<Long, ReviewDetailsResult> resultMap) {
long standardsPass = 0;
for(ReviewStandard standard : standards) {
List<ReviewDetails> details = getDetailsByStandard(standard);
boolean isPass = true;
for(ReviewDetails reviewDetails : details) {
if(!detailsIsPass(reviewDetails, resultMap)) {
isPass = false;
}
}
if(isPass) {
standardsPass = standardsPass + 1;
}
}
return standardsPass;
}
private int calculateDetails(List<ReviewStandard> standards) {
//审查细则(条)
int detailsNum = 0;
for(ReviewStandard standard : standards) {
List<ReviewDetails> details = getDetailsByStandard(standard);
detailsNum = detailsNum + details.size();
}
return detailsNum;
}
private long calculateDetailsPass(List<ReviewStandard> standards, Map<Long, ReviewDetailsResult> resultMap) {
long detailsPass = 0L;
for(ReviewStandard standard : standards) {
List<ReviewDetails> details = getDetailsByStandard(standard);
for(ReviewDetails reviewDetails : details) {
if(detailsIsPass(reviewDetails, resultMap)) {
detailsPass = detailsPass + 1;
}
}
}
return detailsPass;
}
private List<ReviewDetails> getDetailsByStandard(ReviewStandard standard) {
List<ReviewDetails> details = new ArrayList();
List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
for(ReviewKeyPoint keyPoint : keyPointList) {
details.addAll(keyPoint.getReviewDetailsList());
}
return details;
}
private boolean detailsIsPass(ReviewDetails reviewDetails, Map<Long, ReviewDetailsResult> resultMap) {
ReviewDetailsResult result = resultMap.get(reviewDetails.getId());
if (result != null ) {
return Objects.equals(result.getPassed(), ReviewStandard.PASSED);
} else {
return false;
}
}
@Override
......
......@@ -209,13 +209,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
taskUserRelationService.saveBatch(auditors);
// 保存关联的整车样品信息
List<TaskSampleRelation> partRelationList = taskSampleRelationService.selectByTaskId(request.getId(),TaskSampleRelation.PART_VEHICLE_SAMPLE);
taskSampleRelationService.removeBatchByIds(partRelationList);
List<TaskSampleRelation> relations = request.getSample();
if (relations.size() != 0 && relations != null) {
for (TaskSampleRelation sampleRelation : relations) {
sampleRelation.setTaskId(task.getId());
}
taskSampleRelationService.updateBatchById(relations);
taskSampleRelationService.saveBatch(relations);
}
// 任务样品关系
......@@ -251,13 +253,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
}
// 保存关联的零部件样品信息
List<TaskSampleRelation> relationList = taskSampleRelationService.selectByTaskId(request.getId(),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE);
taskSampleRelationService.removeBatchByIds(relationList);
List<TaskSampleRelation> partRelations = request.getPartSample();
if (partRelations.size() != 0 && partRelations != null) {
for (TaskSampleRelation partSampleRelation : partRelations) {
partSampleRelation.setTaskId(task.getId());
}
taskSampleRelationService.updateBatchById(partRelations);
taskSampleRelationService.saveBatch(partRelations);
}
}
......@@ -295,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
......@@ -330,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();
......@@ -347,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());
......@@ -356,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();
......@@ -395,27 +404,65 @@ 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;
}
}
......
......@@ -4,7 +4,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.TestUseCase;
import com.ruoyi.service.TestUseCaseService;
import com.ruoyi.mapper.TestUseCaseMapper;
import com.ruoyi.web.request.TestUserCaseRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author wangfei
......@@ -12,8 +17,22 @@ import org.springframework.stereotype.Service;
* @createDate 2024-02-18 13:41:28
*/
@Service
public class TestUseCaseServiceImpl extends ServiceImpl<TestUseCaseMapper, TestUseCase>
implements TestUseCaseService{
@Transactional
public class TestUseCaseServiceImpl extends ServiceImpl<TestUseCaseMapper, TestUseCase> implements TestUseCaseService{
@Autowired
private TestUseCaseMapper testUseCaseMapper;
/**
* 查询测试用例列表
*
* @param testUserCaseRequest 测试用例库
* @return 测试用例集合
*/
@Override
public List<TestUseCase> selectseCaseList(TestUserCaseRequest testUserCaseRequest){
return testUseCaseMapper.selectseCaseList(testUserCaseRequest);
}
}
......
......@@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.ReviewEnterpriseArchive;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO;
import com.ruoyi.service.ReviewEnterpriseArchiveService;
import com.ruoyi.web.request.*;
import com.ruoyi.web.response.TaskFindResponse;
......@@ -39,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")})
......@@ -76,4 +86,13 @@ public class ReviewEnterpriseArchiveController extends BaseController {
reviewEnterpriseArchiveService.updateById(reviewEnterpriseArchive);
return R.ok();
}
@ApiOperation("预览企业留档文件")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/preview")
public TableDataInfo<ReviewEnterpriseArchiveViewVO> preview(@Validated @RequestBody ReviewEnterpriseArchivePreviewRequest request) {
return getDataTable(reviewEnterpriseArchiveService.view(request.getTaskId()));
}
}
......@@ -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;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.domain.TestUseCase;
import com.ruoyi.service.TestUseCaseService;
import com.ruoyi.web.request.TestUserCaseRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api(tags = "测试用例")
@RestController
@RequestMapping("/system/testCase")
public class TestUserCaseController extends BaseController{
@Autowired
private TestUseCaseService testUseCaseService;
@ApiOperation("查询测试用例分页查询")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getList")
public TableDataInfo<TestUseCase> listPage(@Validated @RequestBody TestUserCaseRequest testUserCaseRequest){
startPage(testUserCaseRequest);
List<TestUseCase> list = testUseCaseService.selectseCaseList(testUserCaseRequest);
return getDataTable(list);
}
}
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 = "ReviewEnterpriseArchivePreviewRequest", description = "预览企业留档文件")
@Data
public class ReviewEnterpriseArchivePreviewRequest {
@ApiModelProperty("taskId")
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;
}
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;
@Data
@ApiModel
public class TestUserCaseRequest extends PageDomain {
/**
* 测试场景id
*/
@ApiModelProperty("测试场景id")
private Long testScenarioId;
/**
* 测试类型id
*/
@ApiModelProperty("测试类型id")
private Long testTypeId;
/**
* 编号或者名称*/
@ApiModelProperty("编号或者名称")
private String searchKeywords;
}
......@@ -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>
......@@ -252,6 +252,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,next_node,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>
......@@ -13,6 +13,10 @@
<result property="tools" column="tools" jdbcType="VARCHAR"/>
<result property="input" column="input" jdbcType="VARCHAR"/>
<result property="description" column="description" jdbcType="VARCHAR"/>
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="testType" column="test_type" />
<result property="testScenario" column="test_scenario" />
</resultMap>
<sql id="Base_Column_List">
......@@ -20,4 +24,27 @@
usecase_no,name,tools,
input,description
</sql>
<select id="selectseCaseList" parameterType="com.ruoyi.web.request.TestUserCaseRequest" resultMap="BaseResultMap">
select tu.id,
tu.test_scenario_id,
tu.test_type_id,
tu.usecase_no,
tu.name,
tu.tools,
tu.input,
tu.description,
tu.update_by,
tu.update_time,
ty.test_type,
ts.test_scenario
from t_test_usecase tu
left join t_test_type ty on ty.id = tu.test_type_id
left join t_test_scenario ts on ts.id = tu.test_scenario_id
<where>
<if test="testScenarioId != null and testScenarioId != ''"> and tu.test_scenario_id = #{testScenarioId}</if>
<if test="testTypeId != null and testTypeId != ''"> and tu.test_type_id = #{testTypeId}</if>
<if test="searchKeywords != null and searchKeywords != ''"> and tu.usecase_no like concat('%', #{searchKeywords}, '%') or tu.name like concat('%', #{searchKeywords}, '%')</if>
</where>
</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