Browse Source

通过存储过程返回结果集

yujia 7 years ago
parent
commit
9a51f3162b

+ 3 - 3
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_V3")
-	public void callValidProcedure(Long publisherUu, String batchid);
+    @Procedure(procedureName = "PRODUCT_RELEASE_VALID_V4")
+	String callValidProcedure(Long publisherUu, String batchid);
 
 
 	/**
@@ -98,7 +98,7 @@ public interface ReleaseProductByBatchDao
 	 * @param batchid
 	 */
 	@Procedure(procedureName = "PRODUCT_RELEASE_VALID_V2_PCB")
-	public void callValidProcedurePcb(Long publisherUu, String batchid);
+	String callValidProcedurePcb(Long publisherUu, String batchid);
 
     /**
      * 创建时间 :2017年1月6日 下午8:25:57

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

@@ -7,6 +7,7 @@ import com.uas.platform.b2c.common.base.dao.CommonDao;
 import com.uas.platform.b2c.core.config.SysConf;
 import com.uas.platform.b2c.core.constant.IntegerConstant;
 import com.uas.platform.b2c.core.constant.ReleaseStatus;
+import com.uas.platform.b2c.core.constant.SplitChar;
 import com.uas.platform.b2c.core.constant.Status;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.core.utils.NumberUtil;
@@ -266,23 +267,21 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 			}
 		}
 		Long l4 = 0l;
+		String strCount = "";
 		if (isPcb) {
-			releaseProductByBatchDao.callValidProcedurePcb(enUU, batch);
+			strCount = releaseProductByBatchDao.callValidProcedurePcb(enUU, batch);
 		} else {
-			releaseProductByBatchDao.callValidProcedure(enUU, batch);
+			strCount = releaseProductByBatchDao.callValidProcedure(enUU, batch);
 			l4 = System.currentTimeMillis();
 			System.err.println("l4--------------l3" + (l4 - l3));
 		}
-
-		Integer filter = releaseProductByBatchDao.getCountOfImportFail(userUU, batch, failCode);
-		long l5 = System.currentTimeMillis();
-		System.err.println("l5--------------l4" + (l5 - l4));
-		Integer failure = releaseProductByBatchDao.getCountPublisherUuAndBatchAndReleaseCode(userUU, batch, ReleaseStatus.failure.value());
-		long l6 = System.currentTimeMillis();
-		System.err.println("l6--------------l5" + (l6 - l5));
-		Integer success = releaseProductByBatchDao.getCountPublisherUuAndBatchAndReleaseCode(userUU, batch, ReleaseStatus.success.value());
-		long l7 = System.currentTimeMillis();
-		System.err.println("l7---------------------------l6" +  (l7 - l6));
+		Integer filter = 0, failure = 0, success = 0;
+		if (!StringUtilB2C.isEmpty(strCount)) {
+			String[] split = strCount.split(SplitChar.HYPHEN);
+			filter = Integer.valueOf(split[0]);
+			failure = Integer.valueOf(split[1]);
+			success = Integer.valueOf(split[2]);
+		}
 		modelMap.put("total", total);
 		modelMap.put("success", success);
 		modelMap.put("failure", failure);