Commit 5de4250c authored by wdy's avatar wdy

方法复用

parent baf324b3
......@@ -302,25 +302,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
......@@ -408,22 +407,16 @@ 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;
......@@ -436,25 +429,44 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
public TaskGetInfoResponse getBySubtaskId(TaskSubGetInfoRequest request) {
TaskGetInfoResponse response = new TaskGetInfoResponse();
Task task = taskMapper.getBySubtaskId(request.getId());
BeanUtils.copyBeanProp(response, task);
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(task.getId());
response.setAuditors(relation);
// 整车样品信息
List<TaskSampleRelation> relationList = taskSampleRelationService.selectByTaskId(task.getId(),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE);
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> completeVehicleSampleList = sampleManagementMapper.findByIdList(relationList);
response.setCompleteVehicleSample(completeVehicleSampleList);
List<Sample> SampleList = sampleManagementMapper.findByIdList(relationList);
return SampleList;
} else {
return null;
}
// 零部件样品信息
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);
}
return response;
}
public Long saveSystemReview(TaskCreateRequest request,SysUser initiator,Standard standard,TaskUserRelation leader) {
......
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