|
|
|
@ -137,6 +137,7 @@ public class BuyerServiceImpl implements BuyerService { |
|
|
|
|
List<Map<String, String>> checkResultMapList = new ArrayList<>(); |
|
|
|
|
int k = 1; |
|
|
|
|
Map<String, Object> repeatMap = new HashMap<>(10); |
|
|
|
|
List<BuyerEntity> buyerEntitys = new ArrayList<>(); |
|
|
|
|
for (BuyerEntity buyerEntity : buyerEntityList) { |
|
|
|
|
k++; |
|
|
|
|
String preStr = "第" + k + "行,"; |
|
|
|
@ -168,6 +169,7 @@ public class BuyerServiceImpl implements BuyerService { |
|
|
|
|
List<Map<String, String>> checkResultMap = verifyBuyerManageInfoService.checkSyncBuyerRequestParam(gmfxxtbReqBo, preStr); |
|
|
|
|
if (ObjectUtil.isNotEmpty(checkResultMap)) { |
|
|
|
|
checkResultMapList.addAll(checkResultMap); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(buyerEntity.getTaxpayerCode())) { |
|
|
|
@ -178,6 +180,7 @@ public class BuyerServiceImpl implements BuyerService { |
|
|
|
|
checkResultMap1.put(OrderManagementConstant.ERRORCODE, ConfigureConstant.STRING_9999); |
|
|
|
|
checkResultMap1.put(OrderManagementConstant.ERRORMESSAGE, preStr + "税号:" + buyerEntity.getTaxpayerCode() + ",已经存在"); |
|
|
|
|
checkResultMapList.add(checkResultMap1); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//查找根据销方税号 deptid
|
|
|
|
@ -190,12 +193,14 @@ public class BuyerServiceImpl implements BuyerService { |
|
|
|
|
checkResultMap1.put(OrderManagementConstant.ERRORCODE, ConfigureConstant.STRING_9999); |
|
|
|
|
checkResultMap1.put(OrderManagementConstant.ERRORMESSAGE, preStr + "购方名称:" + buyerEntity.getPurchaseName() + ",已经存在"); |
|
|
|
|
checkResultMapList.add(checkResultMap1); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
Map<String, String> checkResultMap1 = new HashMap<>(2); |
|
|
|
|
checkResultMap1.put(OrderManagementConstant.ERRORCODE, ConfigureConstant.STRING_9999); |
|
|
|
|
checkResultMap1.put(OrderManagementConstant.ERRORMESSAGE, preStr + "购方名称不允许为空"); |
|
|
|
|
checkResultMapList.add(checkResultMap1); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isNotEmpty(buyerEntity.getEntId())&&StringUtils.isNotEmpty(buyerEntity.getBuyerCode())) { |
|
|
|
|
param = new HashMap<>(5); |
|
|
|
@ -207,13 +212,16 @@ public class BuyerServiceImpl implements BuyerService { |
|
|
|
|
checkResultMap1.put(OrderManagementConstant.ERRORCODE, ConfigureConstant.STRING_9999); |
|
|
|
|
checkResultMap1.put(OrderManagementConstant.ERRORMESSAGE, preStr + "销方组织:" + buyerEntity.getXhfMc() + ",购方编码:" + buyerEntity.getBuyerCode() + ",已经存在"); |
|
|
|
|
checkResultMapList.add(checkResultMap1); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
Map<String, String> checkResultMap1 = new HashMap<>(2); |
|
|
|
|
checkResultMap1.put(OrderManagementConstant.ERRORCODE, ConfigureConstant.STRING_9999); |
|
|
|
|
checkResultMap1.put(OrderManagementConstant.ERRORMESSAGE, preStr + "销方组织或购方编码不允许为空"); |
|
|
|
|
checkResultMapList.add(checkResultMap1); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
buyerEntitys.add(buyerEntity); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if (ObjectUtil.isNotEmpty(checkResultMapList)) { |
|
|
|
@ -228,13 +236,13 @@ public class BuyerServiceImpl implements BuyerService { |
|
|
|
|
int importSuccessCount = 0; |
|
|
|
|
Map<String, Object> resultMap = new HashMap<>(10); |
|
|
|
|
R result = R.ok(); |
|
|
|
|
if (ObjectUtil.isNotEmpty(list)) { |
|
|
|
|
resultMap.put("list", list); |
|
|
|
|
result.put(OrderManagementConstant.CODE, ConfigureConstant.STRING_9999) |
|
|
|
|
.put(OrderManagementConstant.MESSAGE, "上传失败"); |
|
|
|
|
} else { |
|
|
|
|
importSuccessCount = buyerEntityList.size(); |
|
|
|
|
for (BuyerEntity buyerEntity : buyerEntityList) { |
|
|
|
|
// if (ObjectUtil.isNotEmpty(list)) {
|
|
|
|
|
// resultMap.put("list", list);
|
|
|
|
|
// result.put(OrderManagementConstant.CODE, ConfigureConstant.STRING_9999)
|
|
|
|
|
// .put(OrderManagementConstant.MESSAGE, "上传失败");
|
|
|
|
|
// } else {
|
|
|
|
|
importSuccessCount = buyerEntitys.size(); |
|
|
|
|
for (BuyerEntity buyerEntity : buyerEntitys) { |
|
|
|
|
//数据重复性校验
|
|
|
|
|
buyerEntity.setId(baseService.getGenerateShotKey()); |
|
|
|
|
if (StringUtils.isBlank(buyerEntity.getBuyerCode())) { |
|
|
|
@ -257,12 +265,12 @@ public class BuyerServiceImpl implements BuyerService { |
|
|
|
|
buyerEntityDetail.add(buyerEntityDetail1); |
|
|
|
|
buyerMapper.batchInsertBuyerDetail(buyerEntityDetail); |
|
|
|
|
} |
|
|
|
|
if (buyerEntityList.size() < ConfigureConstant.BATCH_INSERT) { |
|
|
|
|
buyerMapper.insertBuyerByList(buyerEntityList); |
|
|
|
|
if (buyerEntitys.size() < ConfigureConstant.BATCH_INSERT) { |
|
|
|
|
buyerMapper.insertBuyerByList(buyerEntitys); |
|
|
|
|
} else { |
|
|
|
|
List<BuyerEntity> insertBuyerList = new ArrayList<>(); |
|
|
|
|
int i = 0; |
|
|
|
|
for (BuyerEntity buyerEntity : buyerEntityList) { |
|
|
|
|
for (BuyerEntity buyerEntity : buyerEntitys) { |
|
|
|
|
if (i != 0 && i % ConfigureConstant.BATCH_INSERT == 0) { |
|
|
|
|
buyerMapper.insertBuyerByList(insertBuyerList); |
|
|
|
|
insertBuyerList = new ArrayList<>(); |
|
|
|
@ -270,16 +278,16 @@ public class BuyerServiceImpl implements BuyerService { |
|
|
|
|
insertBuyerList.add(buyerEntity); |
|
|
|
|
i++; |
|
|
|
|
} |
|
|
|
|
if (insertBuyerList.size() > 0) { |
|
|
|
|
buyerMapper.insertBuyerByList(insertBuyerList); |
|
|
|
|
if (buyerEntitys.size() > 0) { |
|
|
|
|
buyerMapper.insertBuyerByList(buyerEntitys); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
resultMap.put("list", list); |
|
|
|
|
} |
|
|
|
|
// }
|
|
|
|
|
log.info("{}数据库插入耗时:{}", LOGGER_MSG, (System.currentTimeMillis() - t3)); |
|
|
|
|
|
|
|
|
|
return result.put(OrderManagementConstant.DATA, resultMap).put("count", importSuccessCount) |
|
|
|
|
.put("importResult", "导入数据共" + buyerEntityList.size() + "条,成功" + importSuccessCount + "条"); |
|
|
|
|
.put("importResult", "导入数据共" + buyerEntitys.size() + "条,成功" + importSuccessCount + "条"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|