|
|
|
@ -207,7 +207,7 @@ public class BuyerServiceImpl implements BuyerService { |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isNotEmpty(buyerEntity.getEntId())&&StringUtils.isNotEmpty(buyerEntity.getBuyerCode())) { |
|
|
|
|
param = new HashMap<>(5); |
|
|
|
|
param.put("ent_id", buyerEntity.getEntId()); |
|
|
|
|
param.put("entId", buyerEntity.getEntId()); |
|
|
|
|
param.put("buyerCode", buyerEntity.getBuyerCode()); |
|
|
|
|
int i = buyerMapper.selectBuyerByName(param, shList); |
|
|
|
|
if (i > 0) { |
|
|
|
@ -245,44 +245,46 @@ public class BuyerServiceImpl implements BuyerService { |
|
|
|
|
// .put(OrderManagementConstant.MESSAGE, "上传失败");
|
|
|
|
|
// } else {
|
|
|
|
|
importSuccessCount = buyerEntitys.size(); |
|
|
|
|
for (BuyerEntity buyerEntity : buyerEntitys) { |
|
|
|
|
//数据重复性校验
|
|
|
|
|
buyerEntity.setId(baseService.getGenerateShotKey()); |
|
|
|
|
if (StringUtils.isBlank(buyerEntity.getBuyerCode())) { |
|
|
|
|
buyerEntity.setBuyerCode(baseService.getGenerateShotKey()); |
|
|
|
|
} |
|
|
|
|
List<BuyerEntityDetail> buyerEntityDetail = new ArrayList<>(); |
|
|
|
|
BuyerEntityDetail buyerEntityDetail1 = new BuyerEntityDetail(); |
|
|
|
|
buyerEntityDetail1.setBuyerManageId(buyerEntity.getId()); |
|
|
|
|
buyerEntityDetail1.setBankAccount(buyerEntity.getBankNumber()); |
|
|
|
|
buyerEntityDetail1.setBankName(buyerEntity.getBankOfDeposit()); |
|
|
|
|
buyerEntityDetail1.setAddress(buyerEntity.getAddress()); |
|
|
|
|
buyerEntityDetail1.setPhone(buyerEntity.getPhone()); |
|
|
|
|
buyerEntityDetail1.setCreateTime(new Date()); |
|
|
|
|
buyerEntityDetail1.setDefaultMark("0"); |
|
|
|
|
try { |
|
|
|
|
buyerEntityDetail1.setCreateUser(userInfoService.getUser().getUserId().toString()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
buyerEntityDetail1.setCreateUser(""); |
|
|
|
|
} |
|
|
|
|
buyerEntityDetail.add(buyerEntityDetail1); |
|
|
|
|
buyerMapper.batchInsertBuyerDetail(buyerEntityDetail); |
|
|
|
|
} |
|
|
|
|
if (buyerEntitys.size() < ConfigureConstant.BATCH_INSERT) { |
|
|
|
|
buyerMapper.insertBuyerByList(buyerEntitys); |
|
|
|
|
} else { |
|
|
|
|
List<BuyerEntity> insertBuyerList = new ArrayList<>(); |
|
|
|
|
int i = 0; |
|
|
|
|
if (importSuccessCount > 0){ |
|
|
|
|
for (BuyerEntity buyerEntity : buyerEntitys) { |
|
|
|
|
if (i != 0 && i % ConfigureConstant.BATCH_INSERT == 0) { |
|
|
|
|
buyerMapper.insertBuyerByList(insertBuyerList); |
|
|
|
|
insertBuyerList = new ArrayList<>(); |
|
|
|
|
//数据重复性校验
|
|
|
|
|
buyerEntity.setId(baseService.getGenerateShotKey()); |
|
|
|
|
if (StringUtils.isBlank(buyerEntity.getBuyerCode())) { |
|
|
|
|
buyerEntity.setBuyerCode(baseService.getGenerateShotKey()); |
|
|
|
|
} |
|
|
|
|
insertBuyerList.add(buyerEntity); |
|
|
|
|
i++; |
|
|
|
|
List<BuyerEntityDetail> buyerEntityDetail = new ArrayList<>(); |
|
|
|
|
BuyerEntityDetail buyerEntityDetail1 = new BuyerEntityDetail(); |
|
|
|
|
buyerEntityDetail1.setBuyerManageId(buyerEntity.getId()); |
|
|
|
|
buyerEntityDetail1.setBankAccount(buyerEntity.getBankNumber()); |
|
|
|
|
buyerEntityDetail1.setBankName(buyerEntity.getBankOfDeposit()); |
|
|
|
|
buyerEntityDetail1.setAddress(buyerEntity.getAddress()); |
|
|
|
|
buyerEntityDetail1.setPhone(buyerEntity.getPhone()); |
|
|
|
|
buyerEntityDetail1.setCreateTime(new Date()); |
|
|
|
|
buyerEntityDetail1.setDefaultMark("0"); |
|
|
|
|
try { |
|
|
|
|
buyerEntityDetail1.setCreateUser(userInfoService.getUser().getUserId().toString()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
buyerEntityDetail1.setCreateUser(""); |
|
|
|
|
} |
|
|
|
|
buyerEntityDetail.add(buyerEntityDetail1); |
|
|
|
|
buyerMapper.batchInsertBuyerDetail(buyerEntityDetail); |
|
|
|
|
} |
|
|
|
|
if (buyerEntitys.size() > 0) { |
|
|
|
|
if (buyerEntitys.size() < ConfigureConstant.BATCH_INSERT) { |
|
|
|
|
buyerMapper.insertBuyerByList(buyerEntitys); |
|
|
|
|
} else { |
|
|
|
|
List<BuyerEntity> insertBuyerList = new ArrayList<>(); |
|
|
|
|
int i = 0; |
|
|
|
|
for (BuyerEntity buyerEntity : buyerEntitys) { |
|
|
|
|
if (i != 0 && i % ConfigureConstant.BATCH_INSERT == 0) { |
|
|
|
|
buyerMapper.insertBuyerByList(insertBuyerList); |
|
|
|
|
insertBuyerList = new ArrayList<>(); |
|
|
|
|
} |
|
|
|
|
insertBuyerList.add(buyerEntity); |
|
|
|
|
i++; |
|
|
|
|
} |
|
|
|
|
if (buyerEntitys.size() > 0) { |
|
|
|
|
buyerMapper.insertBuyerByList(buyerEntitys); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
resultMap.put("list", list); |
|
|
|
|