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

处理导入重复的显示问题

hulh 8 лет назад
Родитель
Сommit
60ce05c508

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

@@ -489,9 +489,9 @@ public class ReleaseProductByBatch implements Serializable {
 		if (!minPackageStr.equals(that.minPackageStr)) return false;
 		if (!packaging.equals(that.packaging)) return false;
 		if (!selfMaxDeliveryStr.equals(that.selfMaxDeliveryStr)) return false;
-		if (!selfMinDeliveryStr.equals(that.selfMinDeliveryStr)) return false;
-		return GoodsUtil.compareWithQtyPrice(prices, that.getPrices(), that.getCurrency());
-
+//		if (!selfMinDeliveryStr.equals(that.selfMinDeliveryStr)) return false;
+//		return GoodsUtil.compareWithQtyPrice(prices, that.getPrices(), that.getCurrency());
+		return selfMinDeliveryStr.equals(that.selfMinDeliveryStr);
 	}
 
 	public void setBrandEnByExcel(Object value) {

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

@@ -195,7 +195,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 								releaseProductByBatch.setTag(null);
 							}
 						}
-						validateRepeatInExcel(releaseProductByBatchs, releaseProductByBatch);
+						validateRepeatInExcel(releaseProductByBatchs, releaseProductByBatch, isImport);
 					}
 					// 简单验证数据,防止空行保存的情况
 					if (blankNum != 3) {
@@ -223,15 +223,31 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		return modelMap;
 	}
 
-	private void validateRepeatInExcel(List<ReleaseProductByBatch> batchList, ReleaseProductByBatch aBatch) {
+	/**
+	 * 验证Excel中数据是否重复
+	 *
+	 * @param 	batchList
+	 * @param 	aBatch
+	 * @param 	isImport
+	 */
+	private void validateRepeatInExcel(List<ReleaseProductByBatch> batchList, ReleaseProductByBatch aBatch, Boolean isImport) {
 		if (CollectionUtils.isEmpty(batchList) || !StringUtils.isEmpty(aBatch.getErrmsg()))
 			return ;
 		for (ReleaseProductByBatch each : batchList) {
-			if (StringUtils.isEmpty(each) && each.equals(aBatch)) {
-				aBatch.setErrmsg(ErrorInfoConstant.REPEAT_IN_EXCEL.getInfo());
-				aBatch.setReleaseCode(ReleaseStatus.had_exists.value());
-				aBatch.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
-				break;
+			if (StringUtils.isEmpty(each.getErrmsg()) && each.equals(aBatch)) {
+				if (!isImport) {
+					aBatch.setErrmsg(ErrorInfoConstant.REPEAT_IN_EXCEL.getInfo());
+					aBatch.setReleaseCode(ReleaseStatus.had_exists.value());
+					aBatch.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
+					break;
+				} else {
+					if (GoodsUtil.compareWithQtyPrice(each.getPrices(), aBatch.getPrices(), each.getCurrency())) {
+						aBatch.setErrmsg(ErrorInfoConstant.REPEAT_IN_EXCEL.getInfo());
+						aBatch.setReleaseCode(ReleaseStatus.had_exists.value());
+						aBatch.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
+						break;
+					}
+				}
 			}
 		}
 	}
@@ -258,13 +274,13 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 			List<Product> productList = productDao.findByEnUUAndPcmpcodeAndPbrandenAndB2cEnabled(enuu, each.getB2cCode(), each.getB2cBranden(), IntegerConstant.YES_SHORT);
 			if (!CollectionUtils.isEmpty(productList)) {
 				List<Goods> goodsList = goodsDao.findRepeatGoodsInProductId(productList.get(0).getId(), each.getProductDate(), each.getPackaging(), each.getMinPackage(), each.getMinBuyQty(), each.getSelfMaxDelivery(), each.getSelfMinDelivery(), each.getUnit());
-				if (!isImport) {
-					each.setErrmsg(ErrorInfoConstant.REPEAT_INFO.getInfo());
-					each.setReleaseCode(ReleaseStatus.had_exists.value());
-					each.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
-					continue;
-				}
 				if (!CollectionUtils.isEmpty(goodsList)) {
+					if (!isImport) {
+						each.setErrmsg(ErrorInfoConstant.REPEAT_INFO.getInfo());
+						each.setReleaseCode(ReleaseStatus.had_exists.value());
+						each.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
+						continue;
+					}
 					for (Goods goods1 : goodsList) {
 						if (GoodsUtil.compareWithQtyPrice(each.getPrices(), goods1.getPrices(), each.getCurrency())) {
 							each.setErrmsg(ErrorInfoConstant.REPEAT_INFO.getInfo());

+ 6 - 1
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_upload_ctrl.js

@@ -19,6 +19,7 @@ define([ 'app/app' ], function(app) {
 
 		$scope.deletePop = false;
         $scope.personMedol =false;
+		$scope.repeatImport = 0;
         $scope.setPersonMedol = function () {
         	$scope.personMedol =false;
         };
@@ -42,6 +43,10 @@ define([ 'app/app' ], function(app) {
 			}
 		};
 
+		$scope.switchImport = function (type) {
+			$scope.repeatImport = type;
+		};
+
 		$scope.batch = {};
 		$scope.batch.myFiles = null;
 		//批量发布的类型
@@ -208,7 +213,7 @@ define([ 'app/app' ], function(app) {
 			if ($rootScope.$$productOn.tab === 'bathOnPerson') {
 				var param = {selfSale : $scope.batch.sellType == 'self', currency : $scope.batch.currency, isPerson : 1};
 			} else {
-                var param = {selfSale : $scope.batch.sellType == 'self', currency : $scope.batch.currency};
+                var param = {selfSale : $scope.batch.sellType == 'self', currency : $scope.batch.currency, repeatImport : $scope.repeatImport};
 			}
 			$upload.upload({
 				url: 'release/product/release/excel',

+ 14 - 1
src/main/webapp/resources/view/vendor/forstore/vendor_upload.html

@@ -442,7 +442,20 @@
                                 <span ng-disabled="!batch.selfSellEabled">店铺自营</span>
                             </label>
                         </div>
-                        <div><span ng-if="$$productOn.tab == 'bathOn'">2、</span>请上传已经编辑好的库存表格,选择好上传的文件之后,点击确认上传</div>
+                        <div ng-if="$$productOn.tab == 'bathOn'">2、若存在属性完全相同但价格不一致的产品</div>
+                        <div class="sale-label" style="margin-top: -10px;" ng-if="$$productOn.tab == 'bathOn'">
+                            <label class="sellType">
+                                <input type="radio" name="import" id="forIgnore" ng-model="repeatImport" value="0" ng-click="switchImport(0)">
+                                <label for="forIgnore"></label>
+                                <span>忽略不导入</span>
+                            </label>
+                            <label class="sellType">
+                                <input type="radio" name="import" id="forImport" ng-model="repeatImport" value="1" ng-click="switchImport(1)">
+                                <label for="forImport"></label>
+                                <span>作为新产品继续导入</span>
+                            </label>
+                        </div>
+                        <div><span ng-if="$$productOn.tab == 'bathOn'">3、</span>请上传已经编辑好的库存表格,选择好上传的文件之后,点击确认上传</div>
                         <div class="upload">
                             <div class="upload-content">
                                 <input type="text" name="txt" id="upload_text" />