Browse Source

批量上架速度优化

yujia 7 years ago
parent
commit
dc5ba0ad1a

+ 10 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/dao/ReleaseProductByBatchDao.java

@@ -82,6 +82,16 @@ public interface ReleaseProductByBatchDao
     @Procedure(procedureName = "PRODUCT_RELEASE_VALID_V2")
 	public void callValidProcedure(Long publisherUu, String batchid);
 
+
+	/**
+	 * 批量上架验证数据信息是否重复
+	 * @param batch 本批次代码
+	 * @param isPersonal 是否是个人
+	 * @param enuu 公司enuu
+	 */
+	@Procedure(procedureName = "PRODUCT_RELEASE_EXIST_VALID_V1")
+	void callReleaseExistValidProcedure(String batch, Boolean isPersonal, Long enuu);
+
 	/**
 	 * 验证器件和品牌的信息pcb
 	 * @param publisherUu

+ 15 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/model/ReleaseProductByBatch.java

@@ -542,6 +542,12 @@ public class ReleaseProductByBatch implements Serializable {
 	@Column(name = "rel_spec")
 	private String spec;
 
+	/**
+	 * 物料id信息
+	 */
+	@Column(name = "rel_productid")
+	private Long productid;
+
 //	private Short repeat;
 
 	@Override
@@ -1793,4 +1799,13 @@ public class ReleaseProductByBatch implements Serializable {
 	public void setThick(String thick) {
 		this.thick = thick;
 	}
+
+	public Long getProductid() {
+		return productid;
+	}
+
+	public ReleaseProductByBatch setProductid(Long productid) {
+		this.productid = productid;
+		return this;
+	}
 }

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

@@ -207,44 +207,36 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 						releaseProductByBatch.setErrmsg(releaseProductByBatch.getErrmsg().substring(1));
 						releaseProductByBatch.setReleaseCode(ReleaseStatus.lack_info.value());
 						releaseProductByBatch.setReleaseStatus(ReleaseStatus.lack_info.getPhrase());
-					} else {
-						// 导入成功的需要判断自定义标签是否重复
-						if (!CollectionUtils.isEmpty(releaseProductByBatchs) && releaseProductByBatch.getTag() != null) {
-							if (validateTagInfo(releaseProductByBatch, releaseProductByBatchs)) {
-								releaseProductByBatch.setTag(null);
-							}
-						}
-						validateRepeatInExcel(releaseProductByBatchs, releaseProductByBatch, isImport);
 					}
-					// 简单验证数据,防止空行保存的情况
-					if (blankNum != 3) {
+					// 简单验证数据,防止空行保存的情况(品牌、类目、型号、库存量)
+					if (blankNum != 4) {
 						total++;
 						releaseProductByBatchs.add(releaseProductByBatch);
 					}
 				}
 			}
 		}
+
 		Long userUU = SystemSession.getUser().getUserUU();
 		Long enUU = SystemSession.getUser().getEnterprise().getUu();
 		List<ReleaseProductByBatch> addList = new ArrayList<>(releaseProductByBatchs.size());
 		addList.addAll(releaseProductByBatchs);
-		resetRepeatData(addList, isImport, isAPerson);
+        commonDao.save(addList, ReleaseProductByBatch.class);
+        releaseProductByBatchDao.callReleaseExistValidProcedure(batch, isAPerson, enUU);
 		if (isAPerson) {
 			for (ReleaseProductByBatch releaseProductByBatch : addList) {
-				List<Product> productList = productDao.findByEnUUAndPcmpcodeAndPbrandenAndB2cEnabled(enUU,releaseProductByBatch.getB2cCode(),
-						releaseProductByBatch.getB2cBranden(),IntegerConstant.YES_SHORT);
-				if (!CollectionUtils.isEmpty(productList)) {
-				    List<ProductPerson> productPersonList = productPersonDao.findByProductId(productList.get(0).getId());
-				    if (!CollectionUtils.isEmpty(productPersonList)) {
+                Long productid = releaseProductByBatch.getProductid();
+                if (productid != null) {
+                    List<ProductPerson> productPersonList = productPersonDao.findByProductId(productid);
+                    if (!CollectionUtils.isEmpty(productPersonList)) {
                         releaseProductByBatch.setErrmsg(ErrorInfoConstant.REPEAT_INFO.getInfo());
                         releaseProductByBatch.setReleaseCode(ReleaseStatus.had_exists.value());
                         releaseProductByBatch.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
                         total --;
                     }
-				}
+                }
 			}
 		}
-		commonDao.save(addList, ReleaseProductByBatch.class);
 
 		if (isPcb) {
 			releaseProductByBatchDao.callValidProcedurePcb(enUU, batch);