Browse Source

Merge branch 'feature-201837-wangcz' into dev

wangcz 7 years ago
parent
commit
19aa993cae

+ 14 - 14
src/main/java/com/uas/platform/b2c/prod/commodity/model/Goods.java

@@ -1929,10 +1929,10 @@ public class Goods implements Serializable {
 	 * @return
 	 */
 	public Goods updateGoodsByReleaseProductByBatch(ReleaseProductByBatch releaseProductByBatch, TradeDeliveryDelayTime deliveryDelayTime, Integer ignoreImport) {
-		if (IntegerConstant.NO_INT == ignoreImport || org.apache.commons.lang.StringUtils.isNotEmpty(this.tag)) {
+		if (IntegerConstant.NO_INT.equals(ignoreImport) || org.apache.commons.lang.StringUtils.isNotEmpty(this.tag)) {
 			this.tag = StringUtils.isEmpty(releaseProductByBatch.getTag()) ? "类型1" : releaseProductByBatch.getTag();
 		}
-		if (IntegerConstant.NO_INT == ignoreImport || org.apache.commons.lang.StringUtils.isNotEmpty(this.unit)) {
+		if (IntegerConstant.NO_INT.equals(ignoreImport) || org.apache.commons.lang.StringUtils.isNotEmpty(this.unit)) {
 			this.unit = StringUtils.isEmpty(releaseProductByBatch.getUnit()) ? StringConstant.UNIT : releaseProductByBatch.getUnit();
 		}
 		this.brandNameCn = releaseProductByBatch.getB2cBrandcn();
@@ -1942,18 +1942,18 @@ public class Goods implements Serializable {
 		this.code = releaseProductByBatch.getB2cCode();
 		this.uuid = releaseProductByBatch.getComponentUuId();
 		this.img = releaseProductByBatch.getImg();
-		if (IntegerConstant.NO_INT == ignoreImport || org.apache.commons.lang.StringUtils.isNotEmpty(this.kindNameCn) || releaseProductByBatch.getKindUuid() != null) {
+		if (IntegerConstant.NO_INT.equals(ignoreImport) || org.apache.commons.lang.StringUtils.isNotEmpty(this.kindNameCn) || releaseProductByBatch.getKindUuid() != null) {
 			this.kindNameCn = releaseProductByBatch.getKindName();
 			this.kindUuid = releaseProductByBatch.getKindUuid();
 		}
-		if (IntegerConstant.NO_INT == ignoreImport || this.minBuyQty == null) {
+		if (IntegerConstant.NO_INT.equals(ignoreImport) || this.minBuyQty == null) {
 			this.minBuyQty = releaseProductByBatch.getMinBuyQty();
 			this.minPackQty = releaseProductByBatch.getMinPackage();
 		}
-		if (IntegerConstant.NO_INT == ignoreImport || org.apache.commons.lang.StringUtils.isEmpty(this.produceDate)) {
+		if (IntegerConstant.NO_INT.equals(ignoreImport) || org.apache.commons.lang.StringUtils.isEmpty(this.produceDate)) {
 			this.produceDate = StringUtils.isEmpty(releaseProductByBatch.getProductDate()) ? StringConstant.DEFAULT_PRODUCEDATE : releaseProductByBatch.getProductDate();
 		}
-		if (IntegerConstant.NO_INT == ignoreImport || org.apache.commons.lang.StringUtils.isEmpty(this.qtyPrice)) {
+		if (IntegerConstant.NO_INT.equals(ignoreImport) || org.apache.commons.lang.StringUtils.isEmpty(this.qtyPrice)) {
 			this.qtyPrice = releaseProductByBatch.getQtyPrice();
 			this.rmbTaxRate = releaseProductByBatch.getRmbTaxRate();
 			this.usdTaxRate = releaseProductByBatch.getUsdTaxRate();
@@ -1962,26 +1962,26 @@ public class Goods implements Serializable {
 			this.maxPriceUSD = releaseProductByBatch.getMaxPriceUSD();
 			this.minPriceUSD = releaseProductByBatch.getMinPriceUSD();
 		}
-		if (IntegerConstant.NO_INT == ignoreImport || org.apache.commons.lang.StringUtils.isEmpty(this.remark)) {
+		if (IntegerConstant.NO_INT.equals(ignoreImport) || org.apache.commons.lang.StringUtils.isEmpty(this.remark)) {
 			this.remark = releaseProductByBatch.getRemark();
 		}
-		if (IntegerConstant.NO_INT == ignoreImport || NumberUtil.compare(this.reserve, DoubleConstant.zero) < 1) {
+		if (IntegerConstant.NO_INT.equals(ignoreImport) || NumberUtil.compare(this.reserve, DoubleConstant.zero) < 1) {
 			this.reserve = releaseProductByBatch.getReserve();
 			this.lastReserve = releaseProductByBatch.getReserve();
 		}
-		if (IntegerConstant.NO_INT == ignoreImport || org.apache.commons.lang.StringUtils.isEmpty(this.packaging)) {
+		if (IntegerConstant.NO_INT.equals(ignoreImport) || org.apache.commons.lang.StringUtils.isEmpty(this.packaging)) {
 			this.packaging = releaseProductByBatch.getPackaging();
 		}
-		if (IntegerConstant.NO_INT == ignoreImport || org.apache.commons.lang.StringUtils.isEmpty(this.encapsulation)) {
+		if (IntegerConstant.NO_INT.equals(ignoreImport) || org.apache.commons.lang.StringUtils.isEmpty(this.encapsulation)) {
 			this.encapsulation = releaseProductByBatch.getEncapsulation();
 		}
-		if (IntegerConstant.NO_INT == ignoreImport || org.apache.commons.lang.StringUtils.isEmpty(this.spec)) {
+		if (IntegerConstant.NO_INT.equals(ignoreImport) || org.apache.commons.lang.StringUtils.isEmpty(this.spec)) {
 			this.spec = releaseProductByBatch.getSpec();
 		}
 		this.returnInWeek = releaseProductByBatch.getReturnInWeek();
 		this.sampleQty = releaseProductByBatch.getSampleqty();
 		this.updateDate = releaseProductByBatch.getCreateDate();
-		if (IntegerConstant.NO_INT == ignoreImport || releaseProductByBatch.getSelfMinDelivery() != null) {
+		if (IntegerConstant.NO_INT.equals(ignoreImport) || releaseProductByBatch.getSelfMinDelivery() != null) {
 			this.maxDelivery = releaseProductByBatch.getSelfMaxDelivery();
 			this.minDelivery = releaseProductByBatch.getSelfMinDelivery();
 			if (this.minDelivery == null) {
@@ -2000,11 +2000,11 @@ public class Goods implements Serializable {
 			}
 
 		}
-		if (IntegerConstant.NO_INT == ignoreImport || StringUtils.isEmpty(this.breakUp)) {
+		if (IntegerConstant.NO_INT.equals(ignoreImport) || StringUtils.isEmpty(this.breakUp)) {
 			this.breakUp = releaseProductByBatch.getBreakUp();
 			this.perQty = releaseProductByBatch.getBreakUp() ? 1 : releaseProductByBatch.getMinPackage();
 		}
-		if (IntegerConstant.NO_INT == ignoreImport || StringUtils.isEmpty(this.reserve)) {
+		if (IntegerConstant.NO_INT.equals(ignoreImport) || StringUtils.isEmpty(this.reserve)) {
 			this.reserve = releaseProductByBatch.getReserve();
 		}
 		this.batchid = releaseProductByBatch.getRelbatchid();

+ 6 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/model/GoodsHistory.java

@@ -935,6 +935,12 @@ public class GoodsHistory {
 	}
 
 	public enum OperateType {
+
+		/**
+		 * {@code 101产品上架}
+		 */
+		INIT(100, "初始化商品"),
+
 		/**
 		 * {@code 101产品上架}
 		 */

+ 9 - 2
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/GoodsServiceImpl.java

@@ -3548,8 +3548,10 @@ public class GoodsServiceImpl implements GoodsService {
      */
     @Override
     public void defineGoodsInfo(Goods goods) {
+        // 商家为寄售时;商家名称要显示终端卖家的名称
         if (sysConf.getStoreid().equals(goods.getStoreid())) {
             goods.setSelfSale(StringConstant.CONSIGNMENT);
+            goods.setStoreName(goods.getEnterpriseName());
         } else {
             goods.setSelfSale(StringConstant.SALE_SELF);
         }
@@ -3847,9 +3849,14 @@ public class GoodsServiceImpl implements GoodsService {
                 goods.setMinBuyQty();
                 goods.setPerQty();
                 goods.adjustFragmentPrice();
+                Integer status = goods.getStatus();
                 goods.setStatus();
-                GoodsHistory history = goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.Update.getPhrase(), false);
-                list.add(history);
+                if ((Status.AVAILABLE.value() == goods.getStatus()) || (Status.UNAVAILABLE.value() == goods.getStatus()) && (Status.NO_SHELVE.value() == status) || (Status.REMOVED.value() == status)) {
+                    //如果现在是已上架,原先是未上架或者已下架,则做上架处理。否则做更新处理
+                    list.add(goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.Publish.getPhrase(), false));
+                } else {
+                    list.add(goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.Update.getPhrase(), false));
+                }
             }
             if (CollectionUtils.isNotEmpty(goodses)) {
                 goodsDao.save(goodses);

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

@@ -2849,11 +2849,13 @@ public class ProductServiceImpl implements ProductService {
     private void assignmentGoods(Goods goods, Product productInfo) {
         GoodsHistory goodsHistory;
         goods = Goods.productConvertGoods(goods, productInfo);
+        Integer status = null;
         if (productInfo.getId() != null) {
             List<Goods> goodsList = goodsDao.findByProductId(productInfo.getId());
             if (CollectionUtils.isNotEmpty(goodsList)) {
                 goods.setId(goodsList.get(0).getId());
                 goods.setProductid(productInfo.getId());
+                status = goodsList.get(0).getStatus();
             }
         }
         final Double minBuyQty = goods.getMinBuyQty();
@@ -2893,10 +2895,20 @@ public class ProductServiceImpl implements ProductService {
         goodsService.setGoodsDefault(goods);
         String type;
         if (null != goods.getId()) {
-            type = GoodsHistory.OperateType.Update.getPhrase();
+            if ((Status.AVAILABLE.value() == goods.getStatus() || Status.UNAVAILABLE.value() == goods.getStatus()) && (Status.NO_SHELVE.value() == status) || (Status.REMOVED.value() == status)) {
+                //如果现在是已上架,原先是未上架或者已下架,则做上架处理。否则做更新处理
+                type = GoodsHistory.OperateType.Publish.getPhrase();
+            } else {
+                type = GoodsHistory.OperateType.Update.getPhrase();
+            }
             goodsHistory = goodsHistoryService.converTGoodsHist(goods, type, false);
         } else  {
-            type = GoodsHistory.OperateType.Publish.getPhrase();
+            if ((Status.AVAILABLE.value() == goods.getStatus()) || Status.UNAVAILABLE.value() == goods.getStatus()) {
+                //如果现在是已上架,原先是未上架或者已下架,则做上架处理。否则做更新处理
+                type = GoodsHistory.OperateType.Publish.getPhrase();
+            } else {
+                type = GoodsHistory.OperateType.INIT.getPhrase();
+            }
             goodsHistory = goodsHistoryService.converTGoodsHist(goods, type, false);
         }
         goodsHistory = goodsHistoryService.save(goodsHistory);

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

@@ -576,7 +576,6 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					newGoods = new Goods();
 					TradeDeliveryDelayTime delayTime = getDelayTime(aBatch);
 					newGoods.setGoodsByReleaseProductByBatch(aBatch, delayTime);
-					goodsHistoryList.add(goodsHistoryService.converTGoodsHist(newGoods, GoodsHistory.OperateType.Publish.getPhrase(), false));
 				}
 				ResultMap resultMap = goodsService.updateGoods(newGoods);
 				if (resultMap.isSuccess()) {
@@ -641,8 +640,13 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					goodsService.setGoodsDefault(needGoods);
 					needGoods.setStatus();
 					goodsDao.save(needGoods);
-					GoodsHistory history = goodsHistoryService.converTGoodsHist(needGoods,
-							GoodsHistory.OperateType.Update.getPhrase(), false);
+					GoodsHistory history = null;
+					if ((Status.AVAILABLE.value() == needGoods.getStatus()) || (Status.UNAVAILABLE.value() == needGoods.getStatus())) {
+						//如果现在是已上架,原先是未上架或者已下架,则做上架处理。否则做更新处理
+						history = goodsHistoryService.converTGoodsHist(needGoods, GoodsHistory.OperateType.Publish.getPhrase(), false);
+					} else {
+						history = goodsHistoryService.converTGoodsHist(needGoods, GoodsHistory.OperateType.INIT.getPhrase(), false);
+					}
 					// 修改上下架状态并产生上下架历史
 					goodsHistoryService.save(history);
 				}
@@ -1901,16 +1905,22 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 			for (ReleaseProductByBatch releaseProductByBatch : list) {
 				if (releaseProductByBatch.getReleaseCode().intValue() == ReleaseStatus.success.value() || releaseProductByBatch.getReleaseCode().intValue() == ReleaseStatus.failure.value()) {
                     Boolean isExist = false;
-					for (Goods goods1 : goodlist) {
-						if ((goods1.getProductid() != null) && (releaseProductByBatch.getProductid() != null) &&(goods1.getProductid().longValue() == releaseProductByBatch.getProductid().longValue())) {
+					for (Goods g : goodlist) {
+						if ((g.getProductid() != null) && (releaseProductByBatch.getProductid() != null) &&(g.getProductid().longValue() == releaseProductByBatch.getProductid().longValue())) {
 							//如果之前已经更新了该物料的在售产品,则不需要做调整(为了兼容一个物料包含多个在售产品的逻辑)
                             //默认更新id最大的一条信息
 							if (!prids.contains(releaseProductByBatch.getProductid().longValue())) {
                                 isExist = true;
 								prids.add(releaseProductByBatch.getProductid());
-                                goods1.updateGoodsByReleaseProductByBatch(releaseProductByBatch, delayTime, ignoreImport);
-								goodsHistoryList.add(goodsHistoryService.converTGoodsHist(goods1, GoodsHistory.OperateType.Update.getPhrase(), false));
-								updateGoods.add(goods1);
+								Integer status = g.getStatus();
+								g.updateGoodsByReleaseProductByBatch(releaseProductByBatch, delayTime, ignoreImport);
+								if ((Status.AVAILABLE.value() == g.getStatus()) || (Status.UNAVAILABLE.value() == g.getStatus()) && (Status.NO_SHELVE.value() == status) || (Status.REMOVED.value() == status)) {
+									//如果现在是已上架,原先是未上架或者已下架,则做上架处理。否则做更新处理
+									goodsHistoryList.add(goodsHistoryService.converTGoodsHist(g, GoodsHistory.OperateType.Publish.getPhrase(), false));
+								} else {
+									goodsHistoryList.add(goodsHistoryService.converTGoodsHist(g, GoodsHistory.OperateType.Update.getPhrase(), false));
+								}
+								updateGoods.add(g);
                                 break;
 							}
 						}
@@ -1924,7 +1934,11 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 				for (ReleaseProductByBatch releaseProductByBatch : insertGoods) {
 					goods = new Goods();
 					goods.setGoodsByReleaseProductByBatch(releaseProductByBatch, delayTime);
-					goodsHistoryList.add(goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.Publish.getPhrase(), false));
+					if ((Status.AVAILABLE.value() == goods.getStatus()) || (Status.UNAVAILABLE.value() == goods.getStatus())) {
+						goodsHistoryList.add(goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.Publish.getPhrase(), false));
+					} else {
+						goodsHistoryList.add(goodsHistoryService.converTGoodsHist(goods, GoodsHistory.OperateType.INIT.getPhrase(), false));
+					}
 					updateGoods.add(goods);
 				}
 			}

+ 1 - 1
src/main/webapp/resources/view/admin/product/productManage.html

@@ -1,7 +1,7 @@
 <div id="manage">
     <div class="manage-form">
         <div class="form-item">
-            <span class="item-title">上时间:</span>
+            <span class="item-title">上时间:</span>
             <div class="screen">
                 <div class="radio-block fl">
                     <label class="com-check-radio">

+ 1 - 1
src/main/webapp/resources/view/usercenter/forstore/buyer_order.html

@@ -756,7 +756,7 @@
 <div class="user_right fr">
 	<div class="com_tab">
 		<ul class="fl">
-			<li><a ui-sref="purc_usercenter_order" href="#/purc/order">B2B</a></li>
+			<li ng-if="personage"><a ui-sref="purc_usercenter_order" href="#/purc/order">B2B</a></li>
 			<li class="active"><a ui-sref="buyer_order" href="#/order">优软商城</a></li>
 		</ul>
 	</div>

+ 1 - 1
src/main/webapp/resources/view/usercenter/forstore/pay_center.html

@@ -487,7 +487,7 @@
 	<div class="pay_record oder">
 		<div class="oder01" style="margin-bottom: 16px;">
 			<ul>
-				<li ng-if="status != 'pay-info'"><a ui-sref="fa_arCheck" href="javascript:void(0)">B2B</a></li>
+				<li ng-if="status != 'pay-info' && personage"><a ui-sref="fa_arCheck" href="javascript:void(0)">B2B</a></li>
 				<li ng-if="status != 'pay-info'" ng-class="{'active' : status=='pay-history'}"><a href="javascript:void(0)">优软商城</a></li>
 				<li ng-if="status == 'pay-info'" ng-class="{'active' : status=='pay-info'}"><a href="javascript:void(0)">付款帐户</a></li>
 			</ul>

+ 4 - 2
src/main/webapp/resources/view/usercenter/left_nav.html

@@ -39,8 +39,10 @@
                 <li ng-class="{'active' : active == 'seek_purchase'}"><a ui-sref="buyerSeekPurchase">采购询价</a></li>
                 <!--<li ng-class="{'active' : active == 'purc_haseinquiry'}"><a ui-sref="purc_haseinquiry">定向询价</a></li>-->
                 <li ng-class="{'active' : active == 'buyer_cart'}"><a  ui-sref="buyer_cart">购物车<em>(<span ng-bind="countCart || 0 | number"></span>)</em></a> </li>
-                <li ng-class="{'active' : active == 'buyer_order'}"><a  ui-sref="purc_usercenter_order">采购订单</a></li>
-                <li ng-class="{'active' : active == 'buyer_pay_center'}"><a  ui-sref="fa_arCheck">应付对账</a></li>
+                <li ng-class="{'active' : active == 'buyer_order'}" ng-if="personage"><a  ui-sref="purc_usercenter_order">采购订单</a></li>
+                <li ng-class="{'active' : active == 'buyer_pay_center'}" ng-if="personage"><a  ui-sref="fa_arCheck">应付对账</a></li>
+                <li  ng-class="{'active' : active == 'buyer_order'}" ng-if="!personage"><a  ui-sref="buyer_order">采购订单</a></li>
+                <li ng-class="{'active' : active == 'buyer_pay_center'}" ng-if="!personage"><a  ui-sref="pay_center">应付对账</a></li>
                 <li ng-class="{'active' : active == 'buyer_invoice'}"><a  ui-sref="buyer_no_invoice">发票管理</a></li>
                 <li ng-class="{'active' : active == 'buyer_tender'}"><a  ui-sref="purc_tenderlist">采购招标</a></li>
                 <li ng-class="{active: active == 'purc_vendor'}"><a ui-sref="purc_vendor">供应商资料</a></li>