Sfoglia il codice sorgente

feat: 增加插入商城私有库插入语句记录

hejq 7 anni fa
parent
commit
455ef0deff

+ 3 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ProductPrivateServiceImpl.java

@@ -182,9 +182,11 @@ public class ProductPrivateServiceImpl implements ProductPrivateService {
      */
     @Override
     public Integer saveByJdbcTemplate(List<ProductPrivate> privateList) {
+        String insertSql = "insert IGNORE product$private(pr_b2cenabled, pr_batchcount, pr_id, pr_attach) values (?,?,?,?)";
+        System.out.println("私有库批量保存语句: " + insertSql);
         int[][] size = new int[0][];
         if (CollectionUtils.isNotEmpty(privateList)) {
-            size = jdbcTemplate.batchUpdate("insert IGNORE product$private(pr_b2cenabled, pr_batchcount, pr_id, pr_attach) values (?,?,?,?)",
+            size = jdbcTemplate.batchUpdate(insertSql,
                     privateList, privateList.size(), (ps, t) -> {
                         ps.setObject(1, t.getB2cEnabled());
                         ps.setObject(2, t.getBatchCount());

+ 5 - 3
src/main/java/com/uas/platform/b2c/trade/order/service/impl/PurchaseProductServiceImpl.java

@@ -179,6 +179,7 @@ public class PurchaseProductServiceImpl implements PurchaseProductService {
             Integer assignNumber = 0;
             // 去重后的数据
             List<ReleaseProductByBatch> uniqueBatchList = releaseProductByBatchDao.findByRelbatchidAndReleaseCodeNot(userUU, batch, failCode);
+            System.out.println("处理后数据大小: " + uniqueBatchList.size());
             if (!CollectionUtils.isEmpty(uniqueBatchList)) {
                 assignNumber = assignBatch(uniqueBatchList);
             }
@@ -338,6 +339,7 @@ public class PurchaseProductServiceImpl implements PurchaseProductService {
      */
     private Integer assignBatch(List<ReleaseProductByBatch> uniqueBatchList) {
         Set<Long> idSet = getProductIdSet(uniqueBatchList);
+        System.out.println("获取的物料id数量: " + idSet.size());
         if (CollectionUtils.isNotEmpty(idSet)) {
             HashMap<String, Object> params = new HashMap<>(5);
             ModelMap data = new ModelMap();
@@ -367,8 +369,7 @@ public class PurchaseProductServiceImpl implements PurchaseProductService {
         List<String> productCodeList = new ArrayList<>();
         Set<Long> idSet = new HashSet<>();
         List<ReleaseProductByBatch> batchList = new ArrayList<>();
-        System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "100");
-        uniqueBatchList.parallelStream().forEach(batch -> {
+        uniqueBatchList.forEach(batch -> {
             if (null != batch.getProductid()) {
                 idSet.add(batch.getProductid());
             } else {
@@ -383,8 +384,9 @@ public class PurchaseProductServiceImpl implements PurchaseProductService {
         // 新增到物料库
         productService.saveByJdbcTemplate(batchList);
         List<com.uas.platform.b2c.prod.commodity.model.Product> productList = productService.findProductIdAndProdnumsByProdNums(productCodeList);
+        System.out.println("根据编号查询物料: " + productList.size());
         List<ProductPrivate> privateList = new ArrayList<>();
-        productList.parallelStream().forEach(product -> {
+        productList.forEach(product -> {
             ProductPrivate productPrivate = new ProductPrivate(product.getId());
             productPrivate.setAttach(product.getAttachment());
             privateList.add(productPrivate);