Commit 9c8f132d authored by wdy's avatar wdy

Merge branch 'wangdingyi' into 'dev'

自动获取第一个样品信息

See merge request !167
parents 3d40a9f4 a91f3e1c
......@@ -99,7 +99,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
List<ReviewSceneChangeTask> lastChanges = reviewSceneChangeTaskService.findLastChangeByTaskId(carReviewTask.getId());
List<TaskSampleRelation> sampleRelations = taskSampleRelationMapper.selectByTaskId(taskMapper.findByCarReviewTaskId(carReviewTask.getId()),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE);
TaskSampleRelation taskSampleRelation = sampleRelations.get(0);
TaskSampleRelation taskSampleRelation = sampleRelations.get(sampleRelations.size() -1);
Sample sample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId());
carReviewTask.setEnterpriseName(sample.getManufacturingEnterprise());
......
......@@ -143,7 +143,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
List<TaskSampleRelation> sampleRelations = taskSampleRelationMapper.selectByTaskId(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId()),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE);
TaskSampleRelation taskSampleRelation = sampleRelations.get(0);
TaskSampleRelation taskSampleRelation = sampleRelations.get(sampleRelations.size() -1);
Sample sample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId());
systemReviewTask.setEnterpriseName(sample.getManufacturingEnterprise());
......
......@@ -264,37 +264,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
}
taskUserRelationService.saveBatch(auditors);
// 保存关联的整车样品信息
List<TaskSampleRelation> partRelationList = taskSampleRelationService.selectByTaskId(request.getId(),TaskSampleRelation.COMPLETE_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.saveBatch(relations);
}
// 保存关联的零部件样品信息
List<TaskSampleRelation> relationList = taskSampleRelationService.selectByTaskId(request.getId(),TaskSampleRelation.PART_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.saveBatch(partRelations);
}
// 任务样品关系
List<TaskSampleRelation> sampleRelations = taskSampleRelationMapper.selectByTaskId(request.getId(),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE);
if (sampleRelations.size() != 0 && sampleRelations != null) {
// 获取之前的第一个企业名称
TaskSampleRelation taskSampleRelation = sampleRelations.get(0);
TaskSampleRelation taskSampleRelation = sampleRelations.get(sampleRelations.size() - 1);
Sample oldSample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId());
// 获取编辑任务后的第一个企业名称
......@@ -316,6 +294,30 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
}
}
// 保存关联的整车样品信息
List<TaskSampleRelation> partRelationList = taskSampleRelationService.selectByTaskId(request.getId(),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE);
taskSampleRelationService.removeBatchByIds(partRelationList);
if (relations.size() != 0 && relations != null) {
for (TaskSampleRelation sampleRelation : relations) {
sampleRelation.setTaskId(task.getId());
}
taskSampleRelationService.saveBatch(relations);
}
// 保存关联的零部件样品信息
List<TaskSampleRelation> relationList = taskSampleRelationService.selectByTaskId(request.getId(),TaskSampleRelation.PART_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.saveBatch(partRelations);
}
}
@Override
......
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