Browse Source

Merge branch 'bug_0913' into dev

yujia 8 years ago
parent
commit
1a977b139d

+ 89 - 89
pom.xml

@@ -491,46 +491,46 @@
 					<target>1.7</target>
 				</configuration>
 			</plugin>
-			<plugin>
-				<groupId>com.samaxes.maven</groupId>
-				<artifactId>minify-maven-plugin</artifactId>
-				<version>1.7.4</version>
-				<!-- 静态文件压缩 -->
-				<executions>
-					<execution>
-						<id>default-minify</id>
-						<phase>prepare-package</phase>
-						<configuration>
-							<charset>UTF-8</charset>
-							<skipMerge>true</skipMerge>
-							<closureLanguage>ECMASCRIPT5</closureLanguage>
-							<closureAngularPass>true</closureAngularPass>
-							<nosuffix>true</nosuffix>
-							<webappTargetDir>${project.build.directory}/minify</webappTargetDir>
-							<cssSourceDir>resources</cssSourceDir>
-							<cssEngine>YUI</cssEngine>
-							<jsSourceDir>resources</jsSourceDir>
-							<jsEngine>YUI</jsEngine>
-							<cssSourceIncludes>
-								<cssSourceInclude>css/**/*.css</cssSourceInclude>
-								<cssSourceInclude>data/**/*.json</cssSourceInclude>
-							</cssSourceIncludes>
-							<cssSourceExcludes>
-								<cssSourceExclude>css/**/*.min.css</cssSourceExclude>
-							</cssSourceExcludes>
-							<jsSourceIncludes>
-								<jsSourceInclude>js/**/*.js</jsSourceInclude>
-							</jsSourceIncludes>
-							<jsSourceExcludes>
-								<jsSourceExclude>js/**/*.min.js</jsSourceExclude>
-							</jsSourceExcludes>
-						</configuration>
-						<goals>
-							<goal>minify</goal>
-						</goals>
-					</execution>
-				</executions>
-			</plugin>
+			<!--<plugin>-->
+				<!--<groupId>com.samaxes.maven</groupId>-->
+				<!--<artifactId>minify-maven-plugin</artifactId>-->
+				<!--<version>1.7.4</version>-->
+				<!--&lt;!&ndash; 静态文件压缩 &ndash;&gt;-->
+				<!--<executions>-->
+					<!--<execution>-->
+						<!--<id>default-minify</id>-->
+						<!--<phase>prepare-package</phase>-->
+						<!--<configuration>-->
+							<!--<charset>UTF-8</charset>-->
+							<!--<skipMerge>true</skipMerge>-->
+							<!--<closureLanguage>ECMASCRIPT5</closureLanguage>-->
+							<!--<closureAngularPass>true</closureAngularPass>-->
+							<!--<nosuffix>true</nosuffix>-->
+							<!--<webappTargetDir>${project.build.directory}/minify</webappTargetDir>-->
+							<!--<cssSourceDir>resources</cssSourceDir>-->
+							<!--<cssEngine>YUI</cssEngine>-->
+							<!--<jsSourceDir>resources</jsSourceDir>-->
+							<!--<jsEngine>YUI</jsEngine>-->
+							<!--<cssSourceIncludes>-->
+								<!--<cssSourceInclude>css/**/*.css</cssSourceInclude>-->
+								<!--<cssSourceInclude>data/**/*.json</cssSourceInclude>-->
+							<!--</cssSourceIncludes>-->
+							<!--<cssSourceExcludes>-->
+								<!--<cssSourceExclude>css/**/*.min.css</cssSourceExclude>-->
+							<!--</cssSourceExcludes>-->
+							<!--<jsSourceIncludes>-->
+								<!--<jsSourceInclude>js/**/*.js</jsSourceInclude>-->
+							<!--</jsSourceIncludes>-->
+							<!--<jsSourceExcludes>-->
+								<!--<jsSourceExclude>js/**/*.min.js</jsSourceExclude>-->
+							<!--</jsSourceExcludes>-->
+						<!--</configuration>-->
+						<!--<goals>-->
+							<!--<goal>minify</goal>-->
+						<!--</goals>-->
+					<!--</execution>-->
+				<!--</executions>-->
+			<!--</plugin>-->
 			<plugin>
 				<artifactId>maven-resources-plugin</artifactId>
 				<executions>
@@ -552,55 +552,55 @@
 					</execution>
 				</executions>
 			</plugin>
-			<plugin>
-				<groupId>com.uas.plugins</groupId>
-				<artifactId>static-maven-plugin</artifactId>
-				<version>0.0.2-SNAPSHOT</version>
-				<!-- 静态资源分离 -->
-				<executions>
-					<execution>
-						<id>default-static</id>
-						<phase>prepare-package</phase>
-						<configuration>
-							<pathMatcher>static</pathMatcher>
-							<staticUrl>${static-path}</staticUrl>
-							<webappDir>${project.build.directory}/minify</webappDir>
-							<sourceDir>/</sourceDir>
-							<targetDir>${project.build.directory}/statics</targetDir>
-							<staticDir>/</staticDir>
-							<sourceIncludes>
-								<sourceInclude>resources/js/**/*.js</sourceInclude>
-								<sourceInclude>resources/data/**/*.json</sourceInclude>
-								<sourceInclude>resources/view/**/*.html</sourceInclude>
-								<sourceInclude>WEB-INF/views/**/*.html</sourceInclude>
-							</sourceIncludes>
-							<!-- http://static.ubtoc.com/css/index.css?_v=1450321871828 -->
-							<versionSuffix>
-								<suffix>?_v=${timestamp}</suffix>
-								<exclude>*/require.js,*.min.js,*.min.css</exclude>
-							</versionSuffix>
-						</configuration>
-						<goals>
-							<goal>static</goal>
-						</goals>
-					</execution>
-				</executions>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-war-plugin</artifactId>
-				<version>2.4</version>
-				<configuration>
-					<webResources>
-						<resource>
-							<directory>${project.build.directory}/statics</directory>
-						</resource>
-						<resource>
-							<directory>${project.build.directory}/minify</directory>
-						</resource>
-					</webResources>
-				</configuration>
-			</plugin>
+			<!--<plugin>-->
+				<!--<groupId>com.uas.plugins</groupId>-->
+				<!--<artifactId>static-maven-plugin</artifactId>-->
+				<!--<version>0.0.2-SNAPSHOT</version>-->
+				<!--&lt;!&ndash; 静态资源分离 &ndash;&gt;-->
+				<!--<executions>-->
+					<!--<execution>-->
+						<!--<id>default-static</id>-->
+						<!--<phase>prepare-package</phase>-->
+						<!--<configuration>-->
+							<!--<pathMatcher>static</pathMatcher>-->
+							<!--<staticUrl>${static-path}</staticUrl>-->
+							<!--<webappDir>${project.build.directory}/minify</webappDir>-->
+							<!--<sourceDir>/</sourceDir>-->
+							<!--<targetDir>${project.build.directory}/statics</targetDir>-->
+							<!--<staticDir>/</staticDir>-->
+							<!--<sourceIncludes>-->
+								<!--<sourceInclude>resources/js/**/*.js</sourceInclude>-->
+								<!--<sourceInclude>resources/data/**/*.json</sourceInclude>-->
+								<!--<sourceInclude>resources/view/**/*.html</sourceInclude>-->
+								<!--<sourceInclude>WEB-INF/views/**/*.html</sourceInclude>-->
+							<!--</sourceIncludes>-->
+							<!--&lt;!&ndash; http://static.ubtoc.com/css/index.css?_v=1450321871828 &ndash;&gt;-->
+							<!--<versionSuffix>-->
+								<!--<suffix>?_v=${timestamp}</suffix>-->
+								<!--<exclude>*/require.js,*.min.js,*.min.css</exclude>-->
+							<!--</versionSuffix>-->
+						<!--</configuration>-->
+						<!--<goals>-->
+							<!--<goal>static</goal>-->
+						<!--</goals>-->
+					<!--</execution>-->
+				<!--</executions>-->
+			<!--</plugin>-->
+			<!--<plugin>-->
+				<!--<groupId>org.apache.maven.plugins</groupId>-->
+				<!--<artifactId>maven-war-plugin</artifactId>-->
+				<!--<version>2.4</version>-->
+				<!--<configuration>-->
+					<!--<webResources>-->
+						<!--<resource>-->
+							<!--<directory>${project.build.directory}/statics</directory>-->
+						<!--</resource>-->
+						<!--<resource>-->
+							<!--<directory>${project.build.directory}/minify</directory>-->
+						<!--</resource>-->
+					<!--</webResources>-->
+				<!--</configuration>-->
+			<!--</plugin>-->
 			<plugin>
 				<groupId>org.apache.tomcat.maven</groupId>
 				<artifactId>tomcat7-maven-plugin</artifactId>

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

@@ -498,24 +498,24 @@ public class GoodsServiceImpl implements GoodsService {
 			if(resultMap.getCode() != CodeType.OK.code()) {
 				return resultMap;
 			}
-		}
-		Double reserve = goods.getReserve() + number;
-		goods.setReserve(reserve);
-		// 检查是否大于最小发货量
-		if (reserve.doubleValue() >= goods.getMinBuyQty().doubleValue()) {
-			goods.setStatus(Status.AVAILABLE.value());
-		}
+			Double reserve = goods.getReserve() + number;
+			goods.setReserve(reserve);
+			// 检查是否大于最小发货量
+			if (reserve.doubleValue() >= goods.getMinBuyQty().doubleValue()) {
+				goods.setStatus(Status.AVAILABLE.value());
+			}
 
-		goodsDao.modifyReserve(goods.getBatchCode(), goods.getUuid(), goods.getReserve(), goods.getStatus().intValue());
-		// 每次批次保存同时保存一遍历史信息
-		GoodsHistory goodsHistory = new GoodsHistory(goods);
-		goodsHistory.setOperateUU(SystemSession.getUser().getUserUU());
-		goodsHistory.setOperateDate(new Date());
-		goodsHistory.setOperateType(GoodsHistory.OperateType.ReleaseReserve.getPhrase());
-		goodsHistory.setMessage(compareGoodsHistory(goodsHistory));
-		goodsHistoryService.save(goodsHistory);
-		// 更新器件属性的库存
-		updateComponentTradeInfos(goods.getUuid());
+			goodsDao.modifyReserve(goods.getBatchCode(), goods.getUuid(), goods.getReserve(), goods.getStatus().intValue());
+			// 每次批次保存同时保存一遍历史信息
+			GoodsHistory goodsHistory = new GoodsHistory(goods);
+			goodsHistory.setOperateUU(SystemSession.getUser().getUserUU());
+			goodsHistory.setOperateDate(new Date());
+			goodsHistory.setOperateType(GoodsHistory.OperateType.ReleaseReserve.getPhrase());
+			goodsHistory.setMessage(compareGoodsHistory(goodsHistory));
+			goodsHistoryService.save(goodsHistory);
+			// 更新器件属性的库存
+			updateComponentTradeInfos(goods.getUuid());
+		}
 		return ResultMap.success(goods);
 	}
 

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

@@ -327,8 +327,9 @@ public class ProductServiceImpl implements ProductService {
                 Double multiple = NumberUtil.div(productStandardPutOnInfo.getMinBuyQty(), productStandardPutOnInfo.getMinPackQty());
                 if(multiple == 0){
                     productStandardPutOnInfo.setMinBuyQty(product.getMinPackQty());
+                }else {
+                    productStandardPutOnInfo.setMinBuyQty(NumberUtil.mul(product.getMinPackQty(), Math.ceil(multiple)));
                 }
-                productStandardPutOnInfo.setMinBuyQty(NumberUtil.mul(product.getMinPackQty(), Math.ceil(multiple)));
                 productStandardPutOnInfo.setMinPackQty(product.getMinPackQty());
                 productModifyHistory.setMinPackQty(product.getMinPackQty());
                 persistProduct.setMinPackQty(product.getMinPackQty());
@@ -339,13 +340,15 @@ public class ProductServiceImpl implements ProductService {
                 persistProduct.setMinPackQty(product.getMinPackQty());
             }
             if(productStandardPutOnInfo.getStatus() == Status.AVAILABLE.value()){
-                Goods goods =goodsDao.findByBatchCode(productStandardPutOnInfo.getGoBatch());
-                if(productStandardPutOnInfo.getMinBuyQty() != null && product.getMinPackQty() != null){
-                    goods.setMinBuyQty(NumberUtil.mul(product.getMinPackQty(), NumberUtil.div(productStandardPutOnInfo.getMinBuyQty(), productStandardPutOnInfo.getMinPackQty())));
-                    goods.setMinPackQty(product.getMinPackQty());
-                }else if(product.getMinPackQty() != null){
-                    goods.setMinPackQty(product.getMinPackQty());
-                    goods.setMinBuyQty(product.getMinPackQty());
+                Goods goods = goodsDao.findByBatchCode(productStandardPutOnInfo.getGoBatch());
+                if(productStandardPutOnInfo.getMinBuyQty() != null && productStandardPutOnInfo.getMinPackQty() != null){
+                    goods.setMinBuyQty(productStandardPutOnInfo.getMinBuyQty());
+                    goods.setMinPackQty(productStandardPutOnInfo.getMinPackQty());
+                }
+                if(NumberUtil.compare(goods.getMinBuyQty(), goods.getReserve()) > 0) {
+                    goods.setStatus(Status.UNAVAILABLE.value());
+                }else {
+                    goods.setStatus(Status.AVAILABLE.value());
                 }
                 if (product.getPackaging() != null){
                     goods.setPackaging(product.getPackaging());

+ 3 - 0
src/main/java/com/uas/platform/b2c/trade/order/model/OrderDetail.java

@@ -849,6 +849,9 @@ public class OrderDetail extends Document implements Serializable{
 			this.number = goods.getMinBuyQty();
 			return ;
 		}
+		if(this.minPackQty == null) {
+			this.minPackQty = goods.getMinBuyQty();
+		}
 		double times = NumberUtil.div(this.number, this.minPackQty);
 		double qty1 = NumberUtil.mul(times, goods.getMinPackQty());
 		if(NumberUtil.compare(qty1, goods.getMinBuyQty()) <= 0) {

+ 1 - 5
src/main/webapp/resources/js/prod/controllers/ProductListByKindCtrl.js

@@ -263,14 +263,10 @@ define([ 'app/app' ], function(app) {
 					var newWidow = window.open('product#/cart');
 					// 1、生成订单
 					Order.buyNow({}, goodsList, function(data){
-						var orderids = [];
-						angular.forEach(data, function(order) {
-							orderids.push(order.orderid );
-						});
 						// 控制订单确认页,直接购买不显示进度条
 						SessionService.set("buyNow", true);
 						// 2、跳转到订单确认页面,进行付款操作
-						newWidow.location.href ='user#/order/pay/'+ enIdFilter(data.orderid);
+						newWidow.location.href ='user#/order/pay/'+ enIdFilter(data.data.orderid);
 					}, function(res){
 						newWidow.close();
 						toaster.pop('error', '警告', res.data);

+ 6 - 0
src/main/webapp/resources/js/usercenter/controllers/forstore/order_pay_ctrl.js

@@ -223,6 +223,12 @@ define(['app/app'], function(app) {
 			}else if(detail.number > detail.goodsHistory.reserve){
 				detail.number = Number(NumberService.sub(detail.goodsHistory.reserve, detail.goodsHistory.reserve %detail.goodsHistory.minPackQty));
 				toaster.pop('info', '提示','库存不足');
+			}else {
+				var remainder = detail.number % detail.goodsHistory.minPackQty;
+				if(remainder != 0) {
+					detail.number = Number(NumberService.sub(detail.number, detail.number % detail.goodsHistory.minPackQty));
+					detail.number = Number(NumberService.add(detail.number, detail.goodsHistory.minPackQty));
+				}
 			}
 			$scope.disabledAddAndSub(detail);
 			$scope.calculatePrice(detail.number, detail, detail.currencyName);

+ 6 - 0
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_repository_ctrl.js

@@ -15,6 +15,8 @@ define(['app/app'], function (app) {
 
         $scope.status = 'standard';
 
+        $scope.maxPackQty = 999999;
+
         $scope.toggleStandardStatus = function (status) {
             if($scope.status != status) {
                 $scope.status = status;
@@ -134,6 +136,10 @@ define(['app/app'], function (app) {
                 toaster.pop('warning', '提示', '包装数量必须为整数');
                 return ;
             }
+            if(Number($scope.currentPro.minPackQty) > $scope.maxPackQty) {
+                toaster.pop('warning', '提示', '包装数量必须小于' + $scope.maxPackQty);
+                return ;
+            }
             var updateProduct = { };
             updateProduct.id = product.id;
             updateProduct.standard = product.standard;

+ 3 - 1
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_standard_putOn_ctrl.js

@@ -55,7 +55,9 @@ define(['app/app'], function (app) {
                     params.total(page.totalElements);
                     angular.forEach(page.content, function (info) {
                         // TODO 设置默认商品销售方式
-                        info.selfSale = $scope.$$putOn.isSelfStore;
+                        if(typeof info.selfSale == 'undefined') {
+                            info.selfSale = $scope.$$putOn.isSelfStore;
+                        }
                         if(!info.minPackQty) {
                             info.minPackQty = 1;
                         }

+ 2 - 2
src/main/webapp/resources/view/usercenter/forstore/buyer_cart.html

@@ -582,9 +582,9 @@
 							<span>
 								<div class="btn-wrap">
 									<span class="number">
-										<a class="reduce" ng-disabled="cart.minusDisabled" ng-click="reduce(cart)">-</a>
+										<a class="reduce" ng-disabled="cart.minusDisabled || cart.status == 1" ng-click="reduce(cart)">-</a>
 										<input type="text" ng-disabled="cart.status == 1" ng-model="cart.number" ng-blur="blurNum(cart)">
-										<a class="add" ng-disabled="cart.addDisabled" ng-click="add(cart)">+</a>
+										<a class="add" ng-disabled="cart.addDisabled || cart.status == 1" ng-click="add(cart)">+</a>
 									</span>
 									<i ng-if="cart.status == 2" style="color: #f00; margin-left: 32px;">库存紧张</i>
 								</div>