Browse Source

Merge remote-tracking branch 'origin/release-201819-wangcz' into release-201819-wangcz

wangdy 7 years ago
parent
commit
3c4baf7ded

+ 3 - 3
src/main/java/com/uas/platform/b2c/prod/commodity/controller/ReleaseProductByBatchController.java

@@ -414,13 +414,13 @@ public class ReleaseProductByBatchController {
         ModelAndView modelAndView = new ModelAndView();
         logger.log("商品批次", "下载批量上架商品的Excel模板");
         if (null != isPerson && isPerson.intValue() == IntegerConstant.YES_SHORT.intValue()) {
-            modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/trade/releaseByBatch-person", "个人产品导入模板-优软商城"));
+            modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/trade/releaseByBatch-person", "导入产品-优软商城"));
             return modelAndView;
         }
         if (Currency.USD.equals(currency)) {
-            modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/trade/releasebyBatch-usd", "产品导入模板-优软商城"));
+            modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/trade/releasebyBatch-usd", "导入产品并上架-优软商城"));
         } else {
-            modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/trade/releaseByBatch-rmb", "产品导入模板-优软商城"));
+            modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/trade/releaseByBatch-rmb", "导入产品并上架-优软商城"));
         }
         return modelAndView;
     }

+ 9 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/dao/ProductDao.java

@@ -29,6 +29,15 @@ public interface ProductDao extends JpaSpecificationExecutor<Product>, JpaReposi
     @Query(value = "select p from Product p where p.enUU =:enuu and p.prodNum =:prodNum")
     List<Product> getProductByEnUUAndProdNum(@Param("enuu") Long enUU, @Param("prodNum") String prodNum);
 
+
+    /**
+     * 根据编号获取物料信息。
+     * @param prodNums  物料编号list
+     * @return 返回物料信息。
+     */
+    @Query(value = "select p from Product p where p.prodNum in (:prodNums)")
+    List<Product> findProductsByProdNums(@Param("prodNum") List<String> prodNums);
+
     /**
      * 通过uu查询非标准器件进行存储
      *

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

@@ -566,6 +566,12 @@ public class ReleaseProductByBatch implements Serializable {
 	@Column(name = "rel_goods_count")
 	private Integer goodsCount = 0;
 
+	/**
+	 *  第几条
+	 */
+	@Column(name = "rel_num")
+	private Integer num;
+
 //	private Short repeat;
 
 	@Override
@@ -1855,6 +1861,15 @@ public class ReleaseProductByBatch implements Serializable {
 		return this;
 	}
 
+	public Integer getNum() {
+		return num;
+	}
+
+	public ReleaseProductByBatch setNum(Integer num) {
+		this.num = num;
+		return this;
+	}
+
 	@Override
 	public String toString() {
 		return "ReleaseProductByBatch{" +

+ 7 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/service/ProductService.java

@@ -322,4 +322,11 @@ public interface ProductService {
      * @return
      */
     Page<V_ProductPrivate> getPageProducts(PageParams params, String keyword);
+
+    /**
+     * 根据编号获取物料信息。
+     * @param prodNums  物料编号list
+     * @return 返回物料信息。
+     */
+    List<Product> findProductsByProdNums(List<String> prodNums);
 }

+ 15 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ProductServiceImpl.java

@@ -2212,5 +2212,20 @@ public class ProductServiceImpl implements ProductService {
         List<V_ProductPrivate> productList = v_productPrivateDao.findAll(idList);
         return new PageImpl<V_ProductPrivate>(productList, info, ids.getTotalElement());
     }
+
+    /**
+     * 根据编号获取物料信息。
+     *
+     * @param prodNums 物料编号list
+     * @return 返回物料信息。
+     */
+    @Override
+    public List<Product> findProductsByProdNums(List<String> prodNums) {
+        if (CollectionUtils.isNotEmpty(prodNums)) {
+            return productDao.findProductsByProdNums(prodNums);
+        } else {
+            return new ArrayList<>();
+        }
+    }
 }
 

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

@@ -1054,7 +1054,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 	private int convertValueToProduct(Row row, ReleaseProductByBatch aProduct, int rowNum, boolean isAPerson, boolean isPcb) {
 		// 统计为空的个数
 		int result = 0;
-
+		aProduct.setNum(rowNum - 2);
 		Object brandValue = readWorkBookCell(row.getCell(UploadConstant.BRAND_ENGLISH), Cell.CELL_TYPE_STRING,
 				rowNum, UploadConstant.BRAND_ENGLISH);
 		if (StringUtils.isEmpty(brandValue)) {
@@ -1813,14 +1813,18 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 			thickCopperProId = propertyDao.findIdByLabelCn(THICKCOPPER);
 			thickProId = propertyDao.findIdByLabelCn(THICK);
 		}
-		String importNum = createNumberService.getTimeNumber("trade$product_import_num", 8, releaseProductByBatchList.size());
+        long l = System.currentTimeMillis();
+        String importNum = createNumberService.getTimeNumber("trade$product_import_num", 8, releaseProductByBatchList.size());
 		if (StringUtils.isEmpty(importNum)) {
 			throw new IllegalOperatorException("生成批次号失败");
 		}
 		String time = importNum.substring(IntegerConstant.NO_SHORT, (IntegerConstant.TIME_LENGTH));
 		Integer num = Integer.valueOf(importNum.substring(IntegerConstant.TIME_LENGTH));
 		String prodNum = null;
-		for (ReleaseProductByBatch releaseProductByBatch : releaseProductByBatchList) {
+        long l1 = System.currentTimeMillis();
+        System.err.println("打印l1-----------l" + (l1 - l));
+        List<String> proNums = new ArrayList<>();
+        for (ReleaseProductByBatch releaseProductByBatch : releaseProductByBatchList) {
 		    if (releaseProductByBatch.getReleaseCode().equals(ReleaseStatus.failure.value()) ||
                     releaseProductByBatch.getReleaseCode().equals(ReleaseStatus.success.value())) {
 				if (releaseProductByBatch.getProductid() == null) {
@@ -1829,6 +1833,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					// releaseProductByBatch.getCode(); 在公有库生成
 					prodNum = "PNUM" + time + CreateNumberServiceImpl.formatIntToStr(++num, 8);
 					product.setProdNum(prodNum);
+					releaseProductByBatch.setProductNum(prodNum);
+                    proNums.add(prodNum);
 					products.add(product);
 				} else {
 					//对于已经存在于物料库的信息,如果规格信息已存在,则做更新,如果是
@@ -1863,8 +1869,12 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 
             }
 		}
+        long l2 = System.currentTimeMillis();
+        System.err.println("打印l2 ----------- l1" + (l2 - l1));
+		List<ReleaseProductByBatch> reList = new ArrayList<>();
 		if (products.size() != 0) {
-			List<Product> productes = productDao.save(products);
+            List<Product> productes = productDao.save(products);
+			//List<Product> productes = productService.findProductsByProdNums(proNums);
 			for (Product producte : productes) {
 				ProductPrivate productPrivate = new ProductPrivate();
 				productPrivate.setB2cEnabled(IntegerConstant.YES_SHORT);
@@ -1873,11 +1883,28 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 				productPrivates.add(productPrivate);
 
 				prIds.add(producte.getId());
+
+				for (ReleaseProductByBatch releaseProductByBatch : releaseProductByBatchList) {
+					if (StringUtilB2C.equals(releaseProductByBatch.getProductNum(), producte.getProdNum())) {
+						releaseProductByBatch.setProductid(producte.getId());
+						reList.add(releaseProductByBatch);
+					}
+				}
 			}
 		}
+
+        long l3 = System.currentTimeMillis();
+        System.err.println("打印l3 ----------- l2" + (l3 - l2));
+		if (CollectionUtils.isNotEmpty(reList)) {
+			releaseProductByBatchDao.save(reList);
+		}
+        long l4 = System.currentTimeMillis();
+        System.err.println("打印l4 ----------- l3" + (l4 - l3));
 		if (CollectionUtils.isNotEmpty(productPrivates)) {
-			productPrivateService.saveProductPrivate(productPrivates);
+            commonDao.save(productPrivates, ProductPrivate.class);
 		}
+        long l5 = System.currentTimeMillis();
+        System.err.println("打印l5 ----------- l4" + (l5 - l4));
 		if (reIds.size() > 0) {
 			map.put("reIds", reIds);
 		}

+ 3 - 0
src/main/webapp/resources/view/sso/header.html

@@ -181,6 +181,9 @@
         padding: 0 15px;
         line-height: 30px;
         text-align: left;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: nowrap;
     }
 
     #mall-search .association li.active, #mall-search .association li.active:hover {

+ 3 - 0
src/main/webapp/resources/view/usercenter/header.html

@@ -181,6 +181,9 @@
         padding: 0 15px;
         line-height: 30px;
         text-align: left;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: nowrap;
     }
 
     #mall-search .association li.active, #mall-search .association li.active:hover {

+ 3 - 0
src/main/webapp/resources/view/vendor/header.html

@@ -181,6 +181,9 @@
         padding: 0 15px;
         line-height: 30px;
         text-align: left;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: nowrap;
     }
     #mall-search .association li.active, #mall-search .association li.active:hover {
         background: #dddddd;