Browse Source

企业物料库上传bug修复

wangdy 8 years ago
parent
commit
b8414d49d9

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

@@ -1039,7 +1039,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		List<ReleaseProductByBatch> releaseProductByBatchList =
 				releaseProductByBatchDao.findByRelbatchid(batch);
 		if (!CollectionUtils.isEmpty(releaseProductByBatchList)) {
-			List<com.uas.ps.entity.Product> products = convertProduct(releaseProductByBatchList);
+			List<com.uas.ps.entity.Product> products = convertProduct(releaseProductByBatchList,false);
 			// TODO 什么接口
 			String result = restTemplate.postForEntity("http://192.168.253.12:24000/product/update", products, String.class).getBody();
 			List<Long> productIds = JSON.parseArray(result, Long.class);
@@ -1049,11 +1049,13 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 				ProductPrivate productPrivate = productPrivateDao.findByPrId(prId);
 				if (null == productPrivate) {
 					productPrivate = new ProductPrivate();
+					productPrivate.setPrId(prId);
 				}
 				productPrivate.setB2cEnabled(IntegerConstant.YES_SHORT);
 				// 统计现在有多少在售信息
                 int batchCount = goodsDao.findCountByProductid(prId);
                 productPrivate.setBatchCount(batchCount);
+                productPrivates.add(productPrivate);
 			}
 			productPrivateDao.save(productPrivates);
 		}
@@ -1112,7 +1114,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 	}
 
 
-	private  List<com.uas.ps.entity.Product> convertProduct (List<ReleaseProductByBatch> releaseProductByBatchList ) {
+	private  List<com.uas.ps.entity.Product> convertProduct (List<ReleaseProductByBatch> releaseProductByBatchList, boolean isAPerson ) {
 		if (CollectionUtils.isEmpty(releaseProductByBatchList)) {
 			return null;
 		}
@@ -1128,7 +1130,13 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 			product.setCmpUuid(releaseProductByBatch.getComponentUuId());
 			product.setKind(releaseProductByBatch.getKindName());
 			product.setKindId(releaseProductByBatch.getKindUuid());
-			product.setStandard(releaseProductByBatch.getReleaseCode().shortValue());
+			product.setStandard(releaseProductByBatch.getComponentUuId() == null ? (short)0 : (short)1);
+			product.setCmpUuid(releaseProductByBatch.getComponentUuId());
+			if (isAPerson) {
+				product.setSpec(releaseProductByBatch.getPackaging());
+			}
+			String batchCode = "PNUM" + createNumberService.getTimeNumber("trade$product_import_num", 8);
+			product.setCode(batchCode);
 			products.add(product);
 		}
 		return products;
@@ -1139,7 +1147,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
         List<ReleaseProductByBatch> releaseProductByBatchList =
                 releaseProductByBatchDao.findByRelbatchid(batch);
         if (!CollectionUtils.isEmpty(releaseProductByBatchList)) {
-            List<com.uas.ps.entity.Product> products = convertProduct(releaseProductByBatchList);
+            List<com.uas.ps.entity.Product> products = convertProduct(releaseProductByBatchList,true);
             // TODO 什么接口
 			String result = restTemplate.postForEntity("http://192.168.253.12:24000/product/update", products, String.class).getBody();
             List<Long> productIds = JSON.parseArray(result, Long.class);
@@ -1153,11 +1161,13 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
                 ProductPrivate productPrivate = productPrivateDao.findByPrId(prId);
                 if (null == productPrivate) {
                     productPrivate = new ProductPrivate();
+					productPrivate.setPrId(prId);
                 }
                 productPrivate.setB2cEnabled(IntegerConstant.YES_SHORT);
                 // 统计现在有多少在售信息
                 int batchCount = goodsDao.findCountByProductid(prId);
                 productPrivate.setBatchCount(batchCount);
+				productPrivates.add(productPrivate);
             }
             productPrivateDao.save(productPrivates);
         }

+ 3 - 0
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_store_info_ctrl.js

@@ -69,6 +69,9 @@ define(['app/app', 'jquery-uploadify'], function (app) {
 			if (!$scope.applySampleInfo.enterprise) {
 				$scope.applySampleInfo.enterprise = {};
 			}
+            if (field == 'STORESHORTNAME') {
+                $scope.applySampleInfo.storeShortName = value || null;
+            }
 			if (field == 'EN_URL') {
 				$scope.applySampleInfo.enterprise.enUrl = value || null;
 			}

+ 8 - 0
src/main/webapp/resources/view/vendor/forstore/vendor_store_info.html

@@ -622,6 +622,14 @@
 					<h2>请完善以下信息,便于宣传展示</h2>
 				</div>
 			</div>
+			<div class="row com_row" style="margin-top: 10px;">
+				<div class="col-md-2 custom_col">
+					<span>店铺名称</span>
+				</div>
+				<div class="col-md-10 custom_col">
+					<input type="text" ng-change="changeInfo('STORESHORTNAME', storeShortName)" class="form-control" style="border-radius: inherit;" title="storeShortName" ng-model="storeShortName" maxlength="100"/>
+				</div>
+			</div>
 			<div class="row com_row">
 				<div class="col-md-2 custom_col">
 					<span>简&nbsp;&nbsp;&nbsp;&nbsp;介<strong class="text-inverse">*</strong></span>