Browse Source

增加测试代码,在预部署上测试

yujia 7 years ago
parent
commit
d664a7d820

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

@@ -79,8 +79,8 @@ public interface ReleaseProductByBatchDao
      * @param publisherUu the publisher uu 发布人
      * @param batchid     the batchid 批次号
      */
-    @Procedure(procedureName = "PRODUCT_RELEASE_VALID_V4")
-	void callValidProcedure(Long publisherUu, String batchid);
+    @Procedure(procedureName = "PRODUCT_RELEASE_VALID_V4", outputParameterName = "rCount")
+	String callValidProcedure(Long publisherUu, String batchid);
 
 
 	/**

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

@@ -316,7 +316,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 //							return "";
 //						}
 //					});
-			releaseProductByBatchDao.callValidProcedure(enUU, batch);
+			String result = releaseProductByBatchDao.callValidProcedure(enUU, batch);
 			l4 = System.currentTimeMillis();
 			System.err.println("l4--------------l3 testyuj" + (l4 - l3));
 		}
@@ -1703,15 +1703,22 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 
 	@Override
 	public String publishByBatch(String batch, boolean isPcb) {
+		long l = System.currentTimeMillis();
 		List<ReleaseProductByBatch> releaseProductByBatchList =
 				releaseProductByBatchDao.findByRelbatchid(batch);
+		long l1 = System.currentTimeMillis();
+		System.err.println("l1 -------------------l " + (l1 - l));
 		List<Long> productIds = null;
 		List<ProductPrivate> productPrivateList = null;
 		if (!CollectionUtils.isEmpty(releaseProductByBatchList)) {
 			Map<String, Object> map = convertProduct(releaseProductByBatchList, false, isPcb);
+			long l2 = System.currentTimeMillis();
+			System.err.println("l2 -------------------l1 " + (l2 - l1));
 			List<com.uas.ps.entity.Product> products = (List<com.uas.ps.entity.Product>) map.get("products");
 			// TODO 什么接口
 			String result = restTemplate.postForEntity(productServiceIp + "/product/update", products, String.class).getBody();
+			long l3 = System.currentTimeMillis();
+			System.err.println("l3 -------------------l2 " + (l3 - l2));
 			productIds = JSON.parseArray(result, Long.class);
 			Set<Long> idSet = new HashSet<>(productIds);
 			List<ProductPrivate> productPrivates = new ArrayList<>();
@@ -1725,12 +1732,18 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 				productPrivates.add(productPrivate);
 			}
 			productPrivateList = productPrivateDao.save(productPrivates);
-
+			long l4 = System.currentTimeMillis();
+			System.err.println("l4 -------------------l3 " + (l4 - l3));
 			//根据更新的规格信息,更新在售产品的信息
 			List<V_ProductPrivate> v_productPrivates = v_productPrivateDao.findProductInIdAndSpecIsNotNull(productIds);
+			long l5 = System.currentTimeMillis();
+			System.err.println("l5 -------------------l4 " + (l5 - l4));
 			List<Goods> goodses = goodsDao.findByProductIds(productIds);
+			long l6 = System.currentTimeMillis();
+			System.err.println("l6 -------------------l5 " + (l6 - l5));
 			goodsService.updateSpecByProducts(v_productPrivates, goodses);
-
+			long l7 = System.currentTimeMillis();
+			System.err.println("l7 -------------------l6 " + (l7 - l6));
 			if (isPcb) {
 				List<PCB> pcbList = new ArrayList<>();
 				List<PCBPropertyValue> propertyValueList = new ArrayList<>();
@@ -1766,6 +1779,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 				}
 			}
 		}
+		long l8 = System.currentTimeMillis();
 		Enterprise enterprise = SystemSession.getUser().getEnterprise();
 		final Object[] obj = new Object[]{enterprise.getUu(), enterprise.getEnName(), batch};
 		String sql = "/*#mycat:db_type=master*/ set @enuu = %s; set @enName = '%s'; set @batch = '%s'; call RELEASE_TO_GOODS_V3(@enuu, @enName, @batch, @out); select @out";
@@ -1783,7 +1797,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 				return "0";
 			}
 		});
-
+		long l9 = System.currentTimeMillis();
+		System.err.println("l9 -------------------l8 " + (l9 - l8));
 		if (null != productIds) {
 			for (ProductPrivate productPrivate : productPrivateList) {
 				// 统计现在有多少在售信息
@@ -1792,7 +1807,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 			}
 			productPrivateDao.save(productPrivateList);
 		}
-
+		long l10 = System.currentTimeMillis();
+		System.err.println("l10 -------------------l9 " + (l10 - l9));
 //		Enterprise enterprise = SystemSession.getUser().getEnterprise();
 //		final Object[] obj = new Object[]{enterprise.getUu(), enterprise.getEnName(), batch};
 //		String sql = "/*#mycat:db_type=master*/ set @enuu = %s; set @enName = '%s'; set @batch = '%s'; call RELEASE_TO_PRODUCT_V1(@enuu, @enName, @batch, @out); select @out";