Просмотр исходного кода

处理更具临时表更新物料的问题

yujia 7 лет назад
Родитель
Сommit
f5a11c70e7

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/service/ProductService.java

@@ -351,5 +351,5 @@ public interface ProductService {
      * @param reList 临时表的id
      * @param ignoreImport 1表示忽略导入,0代表覆盖导入
      */
-    void updateProductsByReleaseProductByBatch(Set<Long> reList, Integer ignoreImport);
+    void updateProductsByReleaseProductByBatch(Set<ReleaseProductByBatch> reList, Integer ignoreImport);
 }

+ 17 - 6
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ProductServiceImpl.java

@@ -2346,19 +2346,30 @@ public class ProductServiceImpl implements ProductService {
 
 
     /**
-     * 根据临时表的数据,更新物料的信息(包装数,包装方式、成本单价)
+     * 根据临时表的数据,更新物料的信息(包装数,包装方式、成本单价,库存
      *
      * @param reList       临时表的id
      * @param ignoreImport 1表示忽略导入,0代表覆盖导入
      */
     @Override
-    public void updateProductsByReleaseProductByBatch(Set<Long> reList, Integer ignoreImport) {
+    public void updateProductsByReleaseProductByBatch(Set<ReleaseProductByBatch> reList, Integer ignoreImport) {
         if (CollectionUtils.isNotEmpty(reList)) {
             //忽略导入
-            if (ignoreImport == IntegerConstant.YES_SHORT) {
-                jdbcTemplate.execute("update products ");
-            } else {
-                //覆盖导入
+            Set<Long> prIds = new HashSet<>();
+            for (ReleaseProductByBatch productByBatch : reList) {
+                if (productByBatch.getProductid() != null) {
+                    prIds.add(productByBatch.getProductid());
+                }
+            }
+            if (CollectionUtils.isNotEmpty(prIds)) {
+                List<Product> products = productDao.findAll(prIds);
+                if (ignoreImport == IntegerConstant.YES_SHORT) {
+                    for (Product product : products) {
+
+                    }
+                } else {
+                    //覆盖导入
+                }
             }
         }
     }

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

@@ -1861,6 +1861,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		List<ProductPrivate> productPrivates = new ArrayList<>();
 		Set<Long> prIds = new HashSet<>();
 		Set<Long> reIds = new HashSet<>();
+		Set<ReleaseProductByBatch> updateProducts = new HashSet<>();
 		Map<String, List<PCBPropertyValue>> propertyMap = new HashedMap();
 
 		Long sizeProId = null;
@@ -1895,11 +1896,13 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					prIds.add(releaseProductByBatch.getProductid());
                     if (org.apache.commons.lang.StringUtils.isNotEmpty(releaseProductByBatch.getSpec()) || (releaseProductByBatch.getMinPackage() != null) || org.apache.commons.lang.StringUtils.isNotEmpty(releaseProductByBatch.getPackaging()) || (releaseProductByBatch.getCostPrice() != null)) {
 						reIds.add(releaseProductByBatch.getId());
+						updateProducts.add(releaseProductByBatch);
 					} else {
                         if (org.apache.commons.lang.StringUtils.isNotEmpty(releaseProductByBatch.getKindName())) {
                             //如果是非标,则可以填充,或者覆盖
                             if (org.apache.commons.lang.StringUtils.isNotEmpty(releaseProductByBatch.getComponentUuId())) {
                                 reIds.add(releaseProductByBatch.getId());
+								updateProducts.add(releaseProductByBatch);
                             }
                         }
                     }