|
|
@ -302,41 +302,49 @@ public class ScmVehinspectItemService extends MybatisBaseService<ScmVehinspectIt |
|
|
|
public ResultBean saveItem(List<ScmVehinspectItemDto> dtos) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
List<ScmVehinspectItemsVo> voList = scmVehicleInspectitemService.selectListOne(); |
|
|
|
for(ScmVehinspectItemDto s :dtos){ |
|
|
|
String vehInspectSid=s.getVehInspectSid(); |
|
|
|
//查询配置项目表中
|
|
|
|
voList.removeAll(Collections.singleton(null)); |
|
|
|
if (!voList.isEmpty()) { |
|
|
|
voList.stream().forEach(item -> { |
|
|
|
ScmVehinspectItem scmVehinspectItem = new ScmVehinspectItem(); |
|
|
|
String sid = scmVehinspectItem.getSid(); |
|
|
|
BeanUtil.copyProperties(item, scmVehinspectItem); |
|
|
|
scmVehinspectItem.setVehInspectSid(vehInspectSid); |
|
|
|
baseMapper.insert(scmVehinspectItem); |
|
|
|
List<ScmItemDetailVo> detailsList = item.getDetails(); |
|
|
|
detailsList.removeAll(Collections.singleton(null)); |
|
|
|
if (!detailsList.isEmpty()) { |
|
|
|
detailsList.stream().forEach(details -> { |
|
|
|
ScmVehinspectItemdetail scmVehinspectItemdetail = new ScmVehinspectItemdetail(); |
|
|
|
BeanUtil.copyProperties(details, scmVehinspectItemdetail); |
|
|
|
scmVehinspectItemdetail.setMainSid(sid); |
|
|
|
scmVehinspectItemdetailService.insert(scmVehinspectItemdetail); |
|
|
|
}); |
|
|
|
} |
|
|
|
List<ScmItemImgVo> itemImgsList = item.getItemImgs(); |
|
|
|
itemImgsList.removeAll(Collections.singleton(null)); |
|
|
|
if (!itemImgsList.isEmpty()) { |
|
|
|
itemImgsList.stream().forEach(img -> { |
|
|
|
ScmVehinspectItemimg scmVehinspectItemimg = new ScmVehinspectItemimg(); |
|
|
|
BeanUtil.copyProperties(img, scmVehinspectItemimg); |
|
|
|
scmVehinspectItemimg.setMainSid(sid); |
|
|
|
scmVehinspectItemimgService.insert(scmVehinspectItemimg); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
List<ScmVehinspectItem> scmVehinspectItemList = new ArrayList<>(); |
|
|
|
List<ScmVehinspectItemdetail> scmVehinspectItemdetailList = new ArrayList<>(); |
|
|
|
List<ScmVehinspectItemimg> scmVehinspectItemimgList = new ArrayList<>(); |
|
|
|
for (ScmVehinspectItemDto s : dtos) { |
|
|
|
String vehInspectSid = s.getVehInspectSid(); |
|
|
|
//查询配置项目表中
|
|
|
|
voList.removeAll(Collections.singleton(null)); |
|
|
|
if (!voList.isEmpty()) { |
|
|
|
voList.stream().forEach(item -> { |
|
|
|
ScmVehinspectItem scmVehinspectItem = new ScmVehinspectItem(); |
|
|
|
String sid = scmVehinspectItem.getSid(); |
|
|
|
BeanUtil.copyProperties(item, scmVehinspectItem); |
|
|
|
scmVehinspectItem.setVehInspectSid(vehInspectSid); |
|
|
|
// baseMapper.insert(scmVehinspectItem);
|
|
|
|
scmVehinspectItemList.add(scmVehinspectItem); |
|
|
|
List<ScmItemDetailVo> detailsList = item.getDetails(); |
|
|
|
detailsList.removeAll(Collections.singleton(null)); |
|
|
|
if (!detailsList.isEmpty()) { |
|
|
|
detailsList.stream().forEach(details -> { |
|
|
|
ScmVehinspectItemdetail scmVehinspectItemdetail = new ScmVehinspectItemdetail(); |
|
|
|
BeanUtil.copyProperties(details, scmVehinspectItemdetail); |
|
|
|
scmVehinspectItemdetail.setMainSid(sid); |
|
|
|
// scmVehinspectItemdetailService.insert(scmVehinspectItemdetail);
|
|
|
|
scmVehinspectItemdetailList.add(scmVehinspectItemdetail); |
|
|
|
}); |
|
|
|
} |
|
|
|
List<ScmItemImgVo> itemImgsList = item.getItemImgs(); |
|
|
|
itemImgsList.removeAll(Collections.singleton(null)); |
|
|
|
if (!itemImgsList.isEmpty()) { |
|
|
|
itemImgsList.stream().forEach(img -> { |
|
|
|
ScmVehinspectItemimg scmVehinspectItemimg = new ScmVehinspectItemimg(); |
|
|
|
BeanUtil.copyProperties(img, scmVehinspectItemimg); |
|
|
|
scmVehinspectItemimg.setMainSid(sid); |
|
|
|
// scmVehinspectItemimgService.insert(scmVehinspectItemimg);
|
|
|
|
scmVehinspectItemimgList.add(scmVehinspectItemimg); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
saveBatch(scmVehinspectItemList); |
|
|
|
scmVehinspectItemdetailService.saveBatch(scmVehinspectItemdetailList); |
|
|
|
scmVehinspectItemimgService.saveBatch(scmVehinspectItemimgList); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
} |