excel、xml异步导入移除解析配件入配件库操作

This commit is contained in:
gaoqr
2025-03-25 17:49:13 +08:00
parent e5e8806816
commit b0253bdc6e
2 changed files with 29 additions and 29 deletions
@@ -113,7 +113,7 @@ public class DefaultExcelOrderImportFactory {
private List<PlateGoodDO> plateGoodDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER); private List<PlateGoodDO> plateGoodDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
private List<OrderModelDO> orderModelDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER); private List<OrderModelDO> orderModelDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
private List<OrderPartsRemark> orderPartsRemarks = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER); private List<OrderPartsRemark> orderPartsRemarks = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
private List<PartsDO> partsDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER); // private List<PartsDO> partsDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
private static final String EMPTY_STRING = new String(); private static final String EMPTY_STRING = new String();
private static final BigDecimal BIG_ZERO = new BigDecimal(0); private static final BigDecimal BIG_ZERO = new BigDecimal(0);
@@ -389,7 +389,7 @@ public class DefaultExcelOrderImportFactory {
} }
// 最后批量插入orderParts一次,避免最后一页小于BATCH_THRESHOLD_NUMBER漏插入 // 最后批量插入orderParts一次,避免最后一页小于BATCH_THRESHOLD_NUMBER漏插入
orderInfoBatchInsertWithinThreshold(orderPartsMapper, orderPartsDOS, true); orderInfoBatchInsertWithinThreshold(orderPartsMapper, orderPartsDOS, true);
orderInfoBatchInsertWithinThreshold(partsMapper, partsDOS, true); // orderInfoBatchInsertWithinThreshold(partsMapper, partsDOS, true);
// 批量插入配件备注 // 批量插入配件备注
orderPartsRemarksBatchInsertWithinThreshold(true); orderPartsRemarksBatchInsertWithinThreshold(true);
} }
@@ -414,7 +414,7 @@ public class DefaultExcelOrderImportFactory {
orderParts.setGoodsId(EMPTY_STRING); orderParts.setGoodsId(EMPTY_STRING);
} }
// 解析配件商品 // 解析配件商品
analyzePartsGoods(orderParts); // analyzePartsGoods(orderParts);
// 批量插入orderParts // 批量插入orderParts
orderPartsDOS.add(orderParts); orderPartsDOS.add(orderParts);
orderInfoBatchInsertWithinThreshold(orderPartsMapper, orderPartsDOS, false); orderInfoBatchInsertWithinThreshold(orderPartsMapper, orderPartsDOS, false);
@@ -1350,16 +1350,16 @@ public class DefaultExcelOrderImportFactory {
* @param partsDO * @param partsDO
* @return * @return
*/ */
private void analyzePartsGoods(OrderPartsDO partsDO) { // private void analyzePartsGoods(OrderPartsDO partsDO) {
if (partsDO.getGoodsId() != null && !partsDO.getGoodsId().isEmpty()) { // 有goodsId // if (partsDO.getGoodsId() != null && !partsDO.getGoodsId().isEmpty()) { // 有goodsId
PartsDO parts = partsMapper.selectByGoodID(partsDO.getGoodsId(), OrganContextHolder.getOrganId()); // PartsDO parts = partsMapper.selectByGoodID(partsDO.getGoodsId(), OrganContextHolder.getOrganId());
if (ObjectUtil.isNull(parts)) { // 不存在记录,存入数据库 // if (ObjectUtil.isNull(parts)) { // 不存在记录,存入数据库
// 批量插入parts // // 批量插入parts
partsDOS.add(BeanUtils.toBean(partsDO, PartsDO.class).setOrganId(organId)); // partsDOS.add(BeanUtils.toBean(partsDO, PartsDO.class).setOrganId(organId));
orderInfoBatchInsertWithinThreshold(partsMapper, partsDOS, false); // orderInfoBatchInsertWithinThreshold(partsMapper, partsDOS, false);
} // }
} // }
} // }
/** /**
* 清空所有列表 * 清空所有列表
@@ -1375,7 +1375,7 @@ public class DefaultExcelOrderImportFactory {
plateGoodDOS.clear(); plateGoodDOS.clear();
orderModelDOS.clear(); orderModelDOS.clear();
orderPartsRemarks.clear(); orderPartsRemarks.clear();
partsDOS.clear(); // partsDOS.clear();
} }
/** /**
@@ -150,7 +150,7 @@ public class DefaultXmlOrderImportFactory {
private List<PlateGoodDO> plateGoodDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER); private List<PlateGoodDO> plateGoodDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
private List<OrderModelDO> orderModelDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER); private List<OrderModelDO> orderModelDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
private List<OrderPartsRemark> orderPartsRemarks = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER); private List<OrderPartsRemark> orderPartsRemarks = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
private List<PartsDO> partsDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER); // private List<PartsDO> partsDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
private static final String EMPTY_STRING = new String(); private static final String EMPTY_STRING = new String();
private static final BigDecimal BIG_ZERO = new BigDecimal(0); private static final BigDecimal BIG_ZERO = new BigDecimal(0);
@@ -1365,7 +1365,7 @@ public class DefaultXmlOrderImportFactory {
orderPartsDO.setRemark(partRemark); orderPartsDO.setRemark(partRemark);
// 解析配件商品 // 解析配件商品
analyzePartsGoods(orderPartsDO); // analyzePartsGoods(orderPartsDO);
// 批量插入orderParts // 批量插入orderParts
orderPartsDOS.add(orderPartsDO); orderPartsDOS.add(orderPartsDO);
// 缓存配件 // 缓存配件
@@ -1492,7 +1492,7 @@ public class DefaultXmlOrderImportFactory {
orderPartsDO.setRemark(partRemark); orderPartsDO.setRemark(partRemark);
// 解析配件商品 // 解析配件商品
analyzePartsGoods(orderPartsDO); // analyzePartsGoods(orderPartsDO);
// 批量插入orderParts // 批量插入orderParts
orderPartsDOS.add(orderPartsDO); orderPartsDOS.add(orderPartsDO);
// 缓存配件 // 缓存配件
@@ -1617,7 +1617,7 @@ public class DefaultXmlOrderImportFactory {
orderPartsDO.setRemark(partRemark); orderPartsDO.setRemark(partRemark);
// 解析配件商品 // 解析配件商品
analyzePartsGoods(orderPartsDO); // analyzePartsGoods(orderPartsDO);
// 批量插入orderParts // 批量插入orderParts
orderPartsDOS.add(orderPartsDO); orderPartsDOS.add(orderPartsDO);
// 缓存配件 // 缓存配件
@@ -1938,16 +1938,16 @@ public class DefaultXmlOrderImportFactory {
* @param partsDO * @param partsDO
* @return * @return
*/ */
private void analyzePartsGoods(OrderPartsDO partsDO) { // private void analyzePartsGoods(OrderPartsDO partsDO) {
if (partsDO.getGoodsId() != null && !partsDO.getGoodsId().isEmpty()) { // 有goodsId // if (partsDO.getGoodsId() != null && !partsDO.getGoodsId().isEmpty()) { // 有goodsId
PartsDO parts = partsMapper.selectByGoodID(partsDO.getGoodsId(), OrganContextHolder.getOrganId()); // PartsDO parts = partsMapper.selectByGoodID(partsDO.getGoodsId(), OrganContextHolder.getOrganId());
if (ObjectUtil.isNull(parts)) { // 不存在记录,存入数据库 // if (ObjectUtil.isNull(parts)) { // 不存在记录,存入数据库
// 批量插入parts // // 批量插入parts
partsDOS.add(BeanUtils.toBean(partsDO, PartsDO.class).setOrganId(organId)); // partsDOS.add(BeanUtils.toBean(partsDO, PartsDO.class).setOrganId(organId));
orderInfoBatchInsertWithinThreshold(partsMapper, partsDOS, false); // orderInfoBatchInsertWithinThreshold(partsMapper, partsDOS, false);
} // }
} // }
} // }
/** /**
* 清空所有列表 * 清空所有列表
@@ -1963,7 +1963,7 @@ public class DefaultXmlOrderImportFactory {
plateGoodDOS.clear(); plateGoodDOS.clear();
orderModelDOS.clear(); orderModelDOS.clear();
orderPartsRemarks.clear(); orderPartsRemarks.clear();
partsDOS.clear(); // partsDOS.clear();
} }
/** /**