Commit 40a0e8b1 authored by wdy's avatar wdy

标准库查询参数修改&检查编辑任务时第一个样品信息对应的生成企业有无变化

parent 02ee576c
...@@ -66,6 +66,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta ...@@ -66,6 +66,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
@Autowired @Autowired
private SampleManagementMapper sampleManagementMapper; private SampleManagementMapper sampleManagementMapper;
@Autowired
private TaskSampleRelationMapper taskSampleRelationMapper;
@Autowired
private ReviewEnterpriseArchiveMapper reviewEnterpriseArchiveMapper;
@Autowired
private ReviewEnterpriseArchiveService reviewEnterpriseArchiveService;
@Override @Override
public List<Task> findList(TaskListRequest request) { public List<Task> findList(TaskListRequest request) {
...@@ -198,27 +207,55 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta ...@@ -198,27 +207,55 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
taskUserRelationService.saveBatch(auditors); taskUserRelationService.saveBatch(auditors);
// 保存关联的整车样品信息 // 保存关联的整车样品信息
List<TaskSampleRelation> relationList = taskSampleRelationService.selectByTaskId(request.getId(),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE);
taskSampleRelationService.removeBatchByIds(relationList);
List<TaskSampleRelation> relations = request.getSample(); List<TaskSampleRelation> relations = request.getSample();
if (relations.size() != 0 && relations != null) { if (relations.size() != 0 && relations != null) {
for (TaskSampleRelation sampleRelation : relations) { for (TaskSampleRelation sampleRelation : relations) {
sampleRelation.setTaskId(task.getId()); sampleRelation.setTaskId(task.getId());
} }
taskSampleRelationService.saveBatch(relations); taskSampleRelationService.updateBatchById(relations);
}
// 任务样品关系
List<TaskSampleRelation> sampleRelations = taskSampleRelationMapper.selectByTaskId(request.getId(),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE);
// 获取之前的第一个企业名称
TaskSampleRelation taskSampleRelation = sampleRelations.get(0);
Sample sample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId());
// 获取编辑任务后的第一个企业名称
TaskSampleRelation taskSampleRelation1 = relations.get(0);
Sample sample1 = sampleManagementMapper.selectSampleManagementById(taskSampleRelation1.getSampleId());
// 第一个企业名称不相同则修改
if (!Objects.equals(sample.getManufacturingEnterprise(), sample1.getManufacturingEnterprise())){
Task task1 = taskMapper.selectById(request.getId());
// 体系审查对应的留档文件
List<ReviewEnterpriseArchive> reviewEnterpriseArchiveList = reviewEnterpriseArchiveMapper.findList(task1.getSystemReviewTaskId());
for (ReviewEnterpriseArchive reviewEnterpriseArchive : reviewEnterpriseArchiveList) {
reviewEnterpriseArchive.setEnterpriseName(sample1.getManufacturingEnterprise());
}
reviewEnterpriseArchiveService.updateBatchById(reviewEnterpriseArchiveList);
// 车辆对应的留档文件
List<ReviewEnterpriseArchive> reviewEnterpriseArchiveList1 = reviewEnterpriseArchiveMapper.findList(task1.getCarReviewTaskId());
for (ReviewEnterpriseArchive reviewEnterpriseArchive1 : reviewEnterpriseArchiveList1) {
reviewEnterpriseArchive1.setEnterpriseName(sample1.getManufacturingEnterprise());
}
reviewEnterpriseArchiveService.updateBatchById(reviewEnterpriseArchiveList1);
} }
// 保存关联的零部件样品信息 // 保存关联的零部件样品信息
List<TaskSampleRelation> partRelationList = taskSampleRelationService.selectByTaskId(request.getId(),TaskSampleRelation.PART_VEHICLE_SAMPLE);
taskSampleRelationService.removeBatchByIds(partRelationList);
List<TaskSampleRelation> partRelations = request.getPartSample(); List<TaskSampleRelation> partRelations = request.getPartSample();
if (partRelations.size() != 0 && partRelations != null) { if (partRelations.size() != 0 && partRelations != null) {
for (TaskSampleRelation partSampleRelation : partRelations) { for (TaskSampleRelation partSampleRelation : partRelations) {
partSampleRelation.setTaskId(task.getId()); partSampleRelation.setTaskId(task.getId());
} }
taskSampleRelationService.saveBatch(partRelations); taskSampleRelationService.updateBatchById(partRelations);
} }
} }
......
...@@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; ...@@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ApiModel(value = "StandardListRequest", description = "查询标准详情") @ApiModel(value = "StandardGetInfoRequest", description = "查询标准详情")
@Data @Data
public class StandardGetInfoRequest { public class StandardGetInfoRequest {
@ApiModelProperty("ID") @ApiModelProperty("ID")
......
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