Browse Source

1.皮阿诺数据处理逻辑优化

test
zhenghaoyu 2 years ago
parent
commit
eb772a6de9
  1. 1
      blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/controller/PanFactoryDataController.java
  2. 42
      blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java

1
blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/controller/PanFactoryDataController.java

@ -125,6 +125,7 @@ public class PanFactoryDataController extends BladeController {
panOrderStatusLog.setStatus(0);
}catch (Exception e){
log.warn("############data: 保存数据失败 orderNo={}",orderNo);
log.error("############data: 保存数据失败",e);
//修改保存数据的状态
panOrderStatusLog.setStatus(2);
}

42
blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java

@ -376,25 +376,45 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
factoryOrderService.save(factoryOrder);
List<PanPackageInfoDTO> packageInfos = factoryOrderDTO.getORDER_ATTRIBUTES();
List<PanPackageInfo> panPackageInfos = new ArrayList<>();
List<PanPackageListDTO> order_attributes_line = new ArrayList<>();
for (PanPackageInfoDTO dto:packageInfos){
PanPackageInfo packageInfo = new PanPackageInfo();
BeanUtil.copyProperties(dto,packageInfo);
packageInfo.setOrderId(factoryOrder.getId());
panPackageInfos.add(packageInfo);
//保存包件信息数据
//因为需要先保存包件明细需要包件的id
packageInfoService.save(packageInfo);
//再存入包件明细
List<PanPackageList> PanPackagelist = new ArrayList<>();
List<PanPackageListDTO> order_attributes_line = dto.getORDER_ATTRIBUTES_LINE();
for (PanPackageListDTO panPackageListDTO:order_attributes_line){
PanPackageList panPackageList = new PanPackageList();
BeanUtil.copyProperties(panPackageListDTO,panPackageList);
panPackageList.setPackageId(packageInfo.getId());
PanPackagelist.add(panPackageList);
// packageInfoService.save(packageInfo);
order_attributes_line.addAll(dto.getORDER_ATTRIBUTES_LINE());
}
packageInfoService.saveBatch(panPackageInfos);
//再存入包件明细
List<PanPackageList> panPackagelist = new ArrayList<>();
for (PanPackageListDTO panPackageListDTO:order_attributes_line){
PanPackageList panPackageList = new PanPackageList();
BeanUtil.copyProperties(panPackageListDTO,panPackageList);
checkListunitNo(panPackageList,panPackageInfos);
panPackagelist.add(panPackageList);
}
// int size = panPackagelist.size();
// int i = size % 500;
// panPackagelist=panPackagelist.subList(0,500);
packageListService.saveBatch(panPackagelist);
}
private void checkListunitNo(PanPackageList packages, List<PanPackageInfo> panPackageInfos) {
for (PanPackageInfo panPackageInfo:panPackageInfos){
if(packages.getUnitNo().equals(panPackageInfo.getUnitNo())){
packages.setPackageId(panPackageInfo.getId());
return;
}
packageListService.saveBatch(PanPackagelist);
}
}

Loading…
Cancel
Save