Browse Source

处理个人物料上传时,没有对release对象的状态设置初始值的问题。

yujia 7 years ago
parent
commit
f93bfe48e8

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

@@ -239,6 +239,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 						releaseProductByBatch.setErrmsg(releaseProductByBatch.getErrmsg().substring(1));
 						releaseProductByBatch.setReleaseCode(ReleaseStatus.lack_info.value());
 						releaseProductByBatch.setReleaseStatus(ReleaseStatus.lack_info.getPhrase());
+					} else {
+						releaseProductByBatch.setReleaseCode(ReleaseStatus.success.value());
+						releaseProductByBatch.setReleaseStatus(ReleaseStatus.success.getPhrase());
 					}
 					// 简单验证数据,防止空行保存的情况(品牌、类目、型号、库存量)
 					if (blankNum != 4) {
@@ -330,7 +333,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
                 failure = Integer.valueOf(split[1]);
                 success = Integer.valueOf(split[2]);
             } else {
-                //便于测试上执行
+                //上面的代码只能在正式上获取到返回值,为了在测试上执行,增加获取结果的代码
                 Long userUU = SystemSession.getUser().getUserUU();
                 filter = releaseProductByBatchDao.getCountOfImportFail(userUU, batch, failCode);
                 failure = releaseProductByBatchDao.getCountPublisherUuAndBatchAndReleaseCode(userUU, batch, ReleaseStatus.failure.value());
@@ -1712,6 +1715,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 			return String.valueOf(IntegerConstant.NO_SHORT);
 		}
 		Map<String, Object> map = convertProduct(releaseProductByBatchList, false, isPcb);
+		if (map == null || map.size() == 0) {
+			return "fail";
+		}
 		long l2 = System.currentTimeMillis();
 		System.err.println("l2 -------------------l1 " + (l2 - l1));
 		Set<Long> idSet = (Set<Long>) map.get("prIds");
@@ -1886,6 +1892,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
                 releaseProductByBatchDao.findByRelbatchid(batch);
         if (!CollectionUtils.isEmpty(releaseProductByBatchList)) {
 			Map<String, Object> map = convertProduct(releaseProductByBatchList,false, false);
+			if (map == null || map.size() == 0) {
+				return "fail";
+			}
 			Set<Long> prIds = (Set<Long>) map.get("prIds");
             List<Long> productIds = new ArrayList<>();
 			productIds.addAll(prIds);