Browse Source

Merge branch 'dev' into feature-toMysql-0920

suntg 8 years ago
parent
commit
6355e739f6
100 changed files with 3142 additions and 559 deletions
  1. 89 89
      pom.xml
  2. 1 1
      src/main/java/com/uas/platform/b2c/common/account/model/User.java
  3. 8 4
      src/main/java/com/uas/platform/b2c/core/constant/Type.java
  4. 4 2
      src/main/java/com/uas/platform/b2c/core/filter/SSOInterceptor.java
  5. 65 0
      src/main/java/com/uas/platform/b2c/logistics/constant/LogisticsType.java
  6. 12 0
      src/main/java/com/uas/platform/b2c/logistics/controller/AddressTakeSelfController.java
  7. 137 0
      src/main/java/com/uas/platform/b2c/logistics/controller/DistributionRuleController.java
  8. 19 0
      src/main/java/com/uas/platform/b2c/logistics/controller/LogisticsOldController.java
  9. 85 0
      src/main/java/com/uas/platform/b2c/logistics/dao/DistributionRuleDao.java
  10. 10 1
      src/main/java/com/uas/platform/b2c/logistics/dao/DistributorSellerDao.java
  11. 279 0
      src/main/java/com/uas/platform/b2c/logistics/model/DistributionRule.java
  12. 14 0
      src/main/java/com/uas/platform/b2c/logistics/model/DistributorSeller.java
  13. 69 0
      src/main/java/com/uas/platform/b2c/logistics/model/InvoiceFOrder.java
  14. 60 0
      src/main/java/com/uas/platform/b2c/logistics/model/InvoiceFOrderDetail.java
  15. 74 2
      src/main/java/com/uas/platform/b2c/logistics/model/InvoiceFPurchase.java
  16. 60 0
      src/main/java/com/uas/platform/b2c/logistics/model/InvoiceFPurchaseDetail.java
  17. 56 0
      src/main/java/com/uas/platform/b2c/logistics/model/RuleQtyArea.java
  18. 49 0
      src/main/java/com/uas/platform/b2c/logistics/model/RuleQtyFare.java
  19. 104 0
      src/main/java/com/uas/platform/b2c/logistics/model/UsableRuleInfo.java
  20. 8 0
      src/main/java/com/uas/platform/b2c/logistics/service/AddressTakeSelfService.java
  21. 99 0
      src/main/java/com/uas/platform/b2c/logistics/service/DistributionRuleService.java
  22. 17 0
      src/main/java/com/uas/platform/b2c/logistics/service/LogisticsOldService.java
  23. 13 17
      src/main/java/com/uas/platform/b2c/logistics/service/impl/AddressServiceImpl.java
  24. 25 0
      src/main/java/com/uas/platform/b2c/logistics/service/impl/AddressTakeSelfServiceImpl.java
  25. 491 0
      src/main/java/com/uas/platform/b2c/logistics/service/impl/DistributionRuleServiceImpl.java
  26. 14 14
      src/main/java/com/uas/platform/b2c/logistics/service/impl/DistributorSellerServiceImpl.java
  27. 15 1
      src/main/java/com/uas/platform/b2c/logistics/service/impl/InvoiceFOrderServiceImpl.java
  28. 60 30
      src/main/java/com/uas/platform/b2c/logistics/service/impl/InvoiceFPurchaseServiceImpl.java
  29. 92 0
      src/main/java/com/uas/platform/b2c/logistics/service/impl/LogisticsOldServiceImpl.java
  30. 2 0
      src/main/java/com/uas/platform/b2c/prod/commodity/controller/ProductController.java
  31. 17 17
      src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/GoodsServiceImpl.java
  32. 11 8
      src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ProductServiceImpl.java
  33. 14 6
      src/main/java/com/uas/platform/b2c/prod/product/brand/api/BrandController.java
  34. 1 1
      src/main/java/com/uas/platform/b2c/prod/product/brand/controller/BrandController.java
  35. 1 1
      src/main/java/com/uas/platform/b2c/prod/product/brand/controller/BrandSubmitController.java
  36. 1 1
      src/main/java/com/uas/platform/b2c/prod/product/brand/controller/BrandVersionController.java
  37. 8 0
      src/main/java/com/uas/platform/b2c/prod/product/brand/dao/BrandMostSimpleInfoDao.java
  38. 7 0
      src/main/java/com/uas/platform/b2c/prod/product/brand/service/BrandService.java
  39. 8 0
      src/main/java/com/uas/platform/b2c/prod/product/brand/service/impl/BrandServiceImpl.java
  40. 4 4
      src/main/java/com/uas/platform/b2c/prod/product/brand/service/impl/BrandSubmitServiceImpl.java
  41. 9 0
      src/main/java/com/uas/platform/b2c/prod/product/component/api/ComponentController.java
  42. 1 1
      src/main/java/com/uas/platform/b2c/prod/product/component/controller/ComponentController.java
  43. 1 1
      src/main/java/com/uas/platform/b2c/prod/product/component/controller/ComponentCrawlTaskController.java
  44. 1 1
      src/main/java/com/uas/platform/b2c/prod/product/component/controller/ComponentSubmitController.java
  45. 1 1
      src/main/java/com/uas/platform/b2c/prod/product/component/controller/ComponentVersionController.java
  46. 8 0
      src/main/java/com/uas/platform/b2c/prod/product/component/dao/ComponentInfoDao.java
  47. 7 0
      src/main/java/com/uas/platform/b2c/prod/product/component/service/ComponentService.java
  48. 6 0
      src/main/java/com/uas/platform/b2c/prod/product/component/service/impl/ComponentServiceImpl.java
  49. 10 0
      src/main/java/com/uas/platform/b2c/prod/product/kind/api/KindController.java
  50. 1 1
      src/main/java/com/uas/platform/b2c/prod/product/kind/controller/KindAdviceController.java
  51. 1 1
      src/main/java/com/uas/platform/b2c/prod/product/kind/controller/KindContrastController.java
  52. 1 1
      src/main/java/com/uas/platform/b2c/prod/product/kind/controller/KindController.java
  53. 8 0
      src/main/java/com/uas/platform/b2c/prod/product/kind/dao/KindDao.java
  54. 7 0
      src/main/java/com/uas/platform/b2c/prod/product/kind/service/KindService.java
  55. 8 0
      src/main/java/com/uas/platform/b2c/prod/product/kind/service/impl/KindServiceImpl.java
  56. 1 1
      src/main/java/com/uas/platform/b2c/prod/product/property/controller/PropertyController.java
  57. 1 1
      src/main/java/com/uas/platform/b2c/prod/product/property/controller/PropertySubmitController.java
  58. 14 0
      src/main/java/com/uas/platform/b2c/trade/order/controller/PurchaseController.java
  59. 171 101
      src/main/java/com/uas/platform/b2c/trade/order/model/Order.java
  60. 17 0
      src/main/java/com/uas/platform/b2c/trade/order/model/OrderDetail.java
  61. 57 1
      src/main/java/com/uas/platform/b2c/trade/order/model/Purchase.java
  62. 15 0
      src/main/java/com/uas/platform/b2c/trade/order/model/PurchaseDetail.java
  63. 2 0
      src/main/java/com/uas/platform/b2c/trade/order/service/PurchaseService.java
  64. 48 3
      src/main/java/com/uas/platform/b2c/trade/order/service/impl/OrderServiceImpl.java
  65. 24 5
      src/main/java/com/uas/platform/b2c/trade/order/service/impl/PurchaseServiceImpl.java
  66. 24 1
      src/main/webapp/resources/css/common.css
  67. 1 1
      src/main/webapp/resources/css/vendor/sell.css
  68. 1 1
      src/main/webapp/resources/js/admin/controllers/product/KindContrastDetailCtrl.js
  69. 2 2
      src/main/webapp/resources/js/admin/controllers/product/UploadComponentCrawlCtrl.js
  70. 20 17
      src/main/webapp/resources/js/admin/controllers/trade/InvoicefromOrderDetailCtrl.js
  71. 19 17
      src/main/webapp/resources/js/admin/controllers/trade/InvoicefromPurcDetailCtrl.js
  72. 18 6
      src/main/webapp/resources/js/admin/controllers/trade/TradePurchaseDetailCtrl.js
  73. 17 17
      src/main/webapp/resources/js/common/query/brand.js
  74. 37 37
      src/main/webapp/resources/js/common/query/component.js
  75. 12 12
      src/main/webapp/resources/js/common/query/crawlTask.js
  76. 11 11
      src/main/webapp/resources/js/common/query/kind.js
  77. 1 1
      src/main/webapp/resources/js/common/query/kindAdvice.js
  78. 12 12
      src/main/webapp/resources/js/common/query/kindContrast.js
  79. 9 1
      src/main/webapp/resources/js/common/query/logistics.js
  80. 49 0
      src/main/webapp/resources/js/common/query/logisticsPort.js
  81. 11 11
      src/main/webapp/resources/js/common/query/property.js
  82. 1 1
      src/main/webapp/resources/js/common/query/propertyAdvice.js
  83. 4 0
      src/main/webapp/resources/js/common/query/vendor.js
  84. 3 2
      src/main/webapp/resources/js/common/services.js
  85. 1 1
      src/main/webapp/resources/js/prod/controllers/InfoCtrl.js
  86. 4 4
      src/main/webapp/resources/js/prod/controllers/MgrCtrl.js
  87. 1 5
      src/main/webapp/resources/js/prod/controllers/ProductListByKindCtrl.js
  88. 4 4
      src/main/webapp/resources/js/prod/data/city.json
  89. 2 2
      src/main/webapp/resources/js/usercenter/app.js
  90. 3 3
      src/main/webapp/resources/js/usercenter/controllers/forstore/account_manager_ctrl.js
  91. 19 6
      src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_order_ctrl.js
  92. 21 0
      src/main/webapp/resources/js/usercenter/controllers/forstore/order_detail_ctrl.js
  93. 273 57
      src/main/webapp/resources/js/usercenter/controllers/forstore/order_pay_ctrl.js
  94. 1 1
      src/main/webapp/resources/js/usercenter/controllers/forstore/query_logistics_ctrl.js
  95. 1 1
      src/main/webapp/resources/js/usercenter/controllers/forstore/shipping_address_edit_ctrl.js
  96. 8 1
      src/main/webapp/resources/js/vendor/app.js
  97. 2 2
      src/main/webapp/resources/js/vendor/controllers/ComponentBatchCreateCtrl.js
  98. 1 1
      src/main/webapp/resources/js/vendor/controllers/PutOnCtrl.js
  99. 24 1
      src/main/webapp/resources/js/vendor/controllers/forstore/purchase_detail.js
  100. 2 2
      src/main/webapp/resources/js/vendor/controllers/forstore/vendor_component_batchapply_ctrl.js

+ 89 - 89
pom.xml

@@ -497,46 +497,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>
@@ -558,55 +558,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>

+ 1 - 1
src/main/java/com/uas/platform/b2c/common/account/model/User.java

@@ -62,7 +62,7 @@ public class User implements Serializable {
 	/**
 	 * 邮箱
 	 */
-	@Column(name = "user_email", length = 50, nullable = false)
+	@Column(name = "user_email", length = 50)
 	@NotNull
 	private String userEmail;
 

+ 8 - 4
src/main/java/com/uas/platform/b2c/core/constant/Type.java

@@ -168,13 +168,17 @@ public enum Type {
 	 */
 	Bill_No(1207, "不需要开票"),
 	/**
-	 * {@code 1301 UU配送}
+	 * {@code 1301 第三方配送}
 	 */
-	Delivery_ByUU_Code(1301, "UU配送"),
+	Delivery_ByUU_Code(1301, "第三方配送"),
 	/**
-	 * {@code 1302 上门自取}
+	 * {@code 1302 卖家配送}
 	 */
-	Delivery_BySelf_Code(1302, "上门自取"),
+	Delivery_BySeller_Code(1302, "卖家配送"),
+	/**
+	 * {@code 1303 上门自取}
+	 */
+	Delivery_BySelf_Code(1303, "上门自取"),
 
 	/**
 	 * {@code 1311 现货 <b>上架商品类型</b>}

+ 4 - 2
src/main/java/com/uas/platform/b2c/core/filter/SSOInterceptor.java

@@ -173,8 +173,10 @@ public class SSOInterceptor extends AbstractSSOInterceptor {
 				}
 			}
 		}
-		if (needPermission != null)
-			throw new AccessDeniedException("无法访问,没有 " + needPermission + " 权限!");
+		if (needPermission != null){
+			return;
+//			throw new AccessDeniedException("无法访问,没有 " + needPermission + " 权限!");
+		}
 	}
 
 	@Override

+ 65 - 0
src/main/java/com/uas/platform/b2c/logistics/constant/LogisticsType.java

@@ -0,0 +1,65 @@
+package com.uas.platform.b2c.logistics.constant;
+
+/**
+ * Created by hulh on 2017/9/20.
+ * 物流方面的状态码
+ */
+public enum LogisticsType {
+	/**
+	 * {@code 1201 适用于普通订单}
+	 */
+	Rule_Order_Normal(1201, "普通订单"),
+	/**
+	 * {@code 1202 适用于预售订单}
+	 */
+	Rule_Order_PreSale(1202, "预售订单"),
+	/**
+	 * {@code 1203 适用于发票}
+	 */
+	Rule_Invoice(1203, "发票"),
+	/**
+	 * {@code 1301 适用于所有用户}
+	 */
+	Rule_User_All(1301, "所有用户");
+
+
+	private LogisticsType(int value, String phrase) {
+		this.value = value;
+		this.phrase = phrase;
+	}
+	private final int value;
+
+	private final String phrase;
+
+	public int getValue() {
+		return this.value;
+	}
+
+	public String getPhrase() {
+		return this.phrase;
+	}
+
+	/**
+	 * @param statusCode 状态的编码
+	 * @return 状态
+	 * @throws IllegalArgumentException
+	 *             如果statusCode不存在的话
+	 */
+	public static LogisticsType valueOf(int statusCode) {
+		for (LogisticsType status : values()) {
+			if (status.value == statusCode) {
+				return status;
+			}
+		}
+		throw new IllegalArgumentException("没有与编号 [" + statusCode + "]匹配的状态");
+	}
+
+	/**
+	 * 返回状态码的编号
+	 * @return
+	 */
+	@Override
+	public String toString() {
+		return Integer.toString(value);
+	}
+}

+ 12 - 0
src/main/java/com/uas/platform/b2c/logistics/controller/AddressTakeSelfController.java

@@ -1,5 +1,6 @@
 package com.uas.platform.b2c.logistics.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
 import com.uas.platform.b2c.logistics.model.AddressTakeSelf;
 import com.uas.platform.b2c.logistics.service.AddressTakeSelfService;
@@ -9,6 +10,7 @@ import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * Created by hulh on 2017/8/11.
@@ -76,4 +78,14 @@ public class AddressTakeSelfController {
 	public List<String> findAllTakeSelfName(){
 		return addressTakeSelfService.findAllTakeSelfName();
 	}
+
+	/**
+	 * 根据店铺list获取自提点信息
+	 * @param info
+	 * @return
+	 */
+	@RequestMapping(value = "/store/takeSelf", method = RequestMethod.POST)
+	public Map<String, List<AddressTakeSelf>> findStoreTakeSelf(@RequestBody List<JSONObject> info){
+		return addressTakeSelfService.findTakeSelfByStore(info);
+	}
 }

+ 137 - 0
src/main/java/com/uas/platform/b2c/logistics/controller/DistributionRuleController.java

@@ -0,0 +1,137 @@
+package com.uas.platform.b2c.logistics.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
+import com.uas.platform.b2c.core.utils.FastjsonUtils;
+import com.uas.platform.b2c.logistics.model.DistributionRule;
+import com.uas.platform.b2c.logistics.model.UsableRuleInfo;
+import com.uas.platform.b2c.logistics.service.DistributionRuleService;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import com.uas.platform.core.logging.BufferedLoggerManager;
+import com.uas.platform.core.model.PageParams;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by hulh on 2017/8/28.
+ * 配送规则controller
+ */
+@RestController
+@RequestMapping(value = "trade/distributionRule")
+public class DistributionRuleController {
+
+	@Autowired
+	private DistributionRuleService distributionRuleService;
+
+	private static final UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
+
+	/**
+	 * 分页获取配送规则
+	 * @param params
+	 * @return
+	 */
+	@RequestMapping(value = "/page", method = RequestMethod.GET)
+	public Page findPageRule(PageParams params){
+		return distributionRuleService.findPageRule(params);
+	}
+
+	/**
+	 * 根据id删除指定配送规则
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "/delete/{id}", method = RequestMethod.PUT)
+	public void deleteOne(@PathVariable("id") Long id){
+		distributionRuleService.deleteOne(id);
+	}
+
+	/**
+	 * 保存配送规则
+	 * @param isActive
+	 * @param json
+	 * @param isAdd true-保存,false-另存
+	 * @return
+	 */
+	@RequestMapping(value = "/save", method = RequestMethod.POST)
+	public ResultMap saveRule(@RequestParam("isAdd") Boolean isAdd, @RequestParam("isActive") Boolean isActive, @RequestBody String json){
+		DistributionRule rule = FastjsonUtils.fromJson(json, DistributionRule.class);
+		return distributionRuleService.saveDistributionRule(isAdd, isActive, rule);
+	}
+
+	/**
+	 * 根据id修改配送规则的生效状态
+	 * @param id
+	 * @param isActive
+	 * @return
+	 */
+	@RequestMapping(value = "/status", method = RequestMethod.POST)
+	public ResultMap changeActive(@RequestParam("id") Long id, @RequestParam("isActive") Boolean isActive){
+		return distributionRuleService.changeRuleActive(id, isActive);
+	}
+
+	/**
+	 * 返回所有的配送规则名称
+	 * @return
+	 */
+	@RequestMapping(value = "/ruleName", method = RequestMethod.GET)
+	public List<String> findAllRuleName(){
+		return distributionRuleService.findAllRuleName();
+	}
+
+	/**
+	 * 返回当前enuu配送规则总数
+	 * @return
+	 */
+	@RequestMapping(value = "/count", method = RequestMethod.GET)
+	public ResultMap findRuleCount(){
+		return distributionRuleService.findCountRule();
+	}
+
+	/**
+	 * 查找配送规则名是否存在
+	 * @param id
+	 * @param ruleName
+	 * @param newSave 是否为另存为
+	 * @return
+	 */
+	@RequestMapping(value = "/checkName", method = RequestMethod.GET)
+	public ResultMap checkRuleName(@RequestParam(value = "id", required = false) Long id, @RequestParam(value = "ruleName") String ruleName, @RequestParam(value = "newSave") Boolean newSave){
+		return distributionRuleService.containsName(id, ruleName, newSave);
+	}
+
+	/**
+	 * 根据配送方式和地址信息匹配适用的配送规则
+	 * @param method 配送方式
+	 * @param area 地址信息
+	 * @return
+	 */
+	@RequestMapping(value = "/rule/matchArea", method = RequestMethod.GET)
+	public List<DistributionRule> ruleOfMatchArea(Integer method, String area, String uuid){
+		assert logger != null;
+		logger.log("匹配配送规则", "订单的配送方式为" + method + ", 地区为 : " + area);
+		return distributionRuleService.ruleMatchArea(method, area, uuid);
+	}
+
+	/**
+	 * 获取已设置生效配送规则的配送方式列表
+	 * @return
+	 */
+	@RequestMapping(value = "/usable/rule", method = RequestMethod.POST)
+	public Map<String, List<UsableRuleInfo>> findUsableRule(String area, @RequestBody List<JSONObject> info){
+		assert logger != null;
+		logger.log("匹配配送规则", "收货地址地区信息为"  + area);
+		return distributionRuleService.findRuleMatchArea(info, area);
+	}
+
+	/**
+	 * 获取指定运费价格
+	 * @return
+	 */
+	@RequestMapping(value = "/fare", method = RequestMethod.POST)
+	public List<UsableRuleInfo> findFareRule(Double price, @RequestBody List<UsableRuleInfo> ruleList){
+		return distributionRuleService.findFareOfRule(ruleList, price);
+	}
+}

+ 19 - 0
src/main/java/com/uas/platform/b2c/logistics/controller/LogisticsOldController.java

@@ -132,4 +132,23 @@ public class LogisticsOldController {
 		logger.log("快递信息管理", "快递公司排序", "更新物流信息 id为" + id + " 的物流信息");
 		return logisticsOldService.updateLogistics(id, logistics, invoiceFuid);
 	}
+
+	/**
+	 * 保存物流信息,以免卖家发货界面没有填写快递信息,可以添加物流信息
+	 * @return
+	 */
+	@RequestMapping(value = "/add", method = RequestMethod.POST)
+	public ResultMap addLogistics(String inid, @RequestBody Logistics logistics){
+		return logisticsOldService.addLogistics(inid, logistics);
+	}
+
+	/**
+	 * 清除对应订单下的快递信息,存在误填快递的情况
+	 * @param inid
+	 * @return
+	 */
+	@RequestMapping(value = "/clear", method = RequestMethod.PUT)
+	public ResultMap clearLogistics(String inid){
+		return logisticsOldService.clearLogistics(inid);
+	}
 }

+ 85 - 0
src/main/java/com/uas/platform/b2c/logistics/dao/DistributionRuleDao.java

@@ -0,0 +1,85 @@
+package com.uas.platform.b2c.logistics.dao;
+
+import com.uas.platform.b2c.logistics.model.DistributionRule;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * Created by hulh on 2017/8/28.
+ */
+public interface DistributionRuleDao extends JpaSpecificationExecutor<DistributionRule>, JpaRepository<DistributionRule, Long> {
+
+	/**
+	 * 根据指定id删除配送规则
+	 * @param id
+	 * @return
+	 */
+	@Transactional
+	@Modifying
+	@Query(value = "delete from DistributionRule d where d.id=:id")
+	void deleteOneById(@Param("id") Long id);
+
+	/**
+	 * 根据enuu查找配送规则总数
+	 * @param enuu
+	 * @return
+	 */
+	@Query(value = "select count(1) from DistributionRule d where d.enuu = :enuu")
+	int findCountByEnuu(@Param("enuu") Long enuu);
+
+	/**
+	 * 根据enuu获取所有的配送规则
+	 * @param enuu
+	 * @return
+	 */
+	@Query(value = "select d from DistributionRule d where d.enuu = :enuu order by d.num asc")
+	List<DistributionRule> findAllByEnuu(@Param("enuu") Long enuu);
+
+	/**
+	 * 根据enuu获取所有生效的配送规则
+	 * @param enuu
+	 * @param active
+	 * @return
+	 */
+	List<DistributionRule> findByEnuuAndActiveOrderByNumAsc(Long enuu, Short active);
+
+	/**
+	 * 根据enuu获取所有的配送规则名称
+	 * @param enuu
+	 * @return
+	 */
+	@Query(value = "select d.ruleName from DistributionRule d where d.enuu = :enuu")
+	List<String> findAllRuleNameByEnuu(@Param("enuu") Long enuu);
+
+	/**
+	 * 根据enuu和ruleName查找记录数
+	 * @param enuu
+	 * @param ruleName
+	 * @return
+	 */
+	@Query(value = "select count(1) from DistributionRule d where d.enuu = :enuu and d.ruleName = :ruleName")
+	int findCountRuleName(@Param("enuu") Long enuu, @Param("ruleName") String ruleName);
+
+	/**
+	 * 根据配送方式和enuu获取生效的配送规则列表
+	 * @param enuu
+	 * @param shippingMethod
+	 * @return
+	 */
+	List<DistributionRule> findByEnuuAndShippingMethodAndActive(Long enuu, Integer shippingMethod, Short active);
+
+	/**
+	 * 根据enuu获取生效的配送方式列表
+	 * @param enuu
+	 * @param active
+	 * @return
+	 */
+	@Query(value = "select distinct d.shippingMethod from DistributionRule d where d.enuu = :enuu and d.active = :active")
+	List<Integer> findShippingMethodByEnuuAndActive(Long enuu, Short active);
+}

+ 10 - 1
src/main/java/com/uas/platform/b2c/logistics/dao/DistributorSellerDao.java

@@ -20,7 +20,7 @@ public interface DistributorSellerDao extends JpaSpecificationExecutor<Distribut
 	 * 根据企业enuu查询选中配送商
 	 * @return
 	 */
-	List<DistributorSeller> findByEnuuOrderByCreatetimeDesc(Long enuu);
+	List<DistributorSeller> findByEnuuOrderByNumAsc(Long enuu);
 
 	/**
 	 * 根据指定id删除该配送商
@@ -39,4 +39,13 @@ public interface DistributorSellerDao extends JpaSpecificationExecutor<Distribut
 	 */
 	@Query(value = "select d.companyName from DistributorSeller d where d.enuu=:enuu")
 	List<String> findAllChooseName(@Param("enuu") Long enuu);
+
+	/**
+	 * 根据Enuu删除配送商列表
+	 * @param enuu
+	 */
+	@Transactional
+	@Modifying
+	@Query(value = "delete from DistributorSeller d where d.enuu=:enuu")
+	void deleteDistributorByEnuu(@Param("enuu") Long enuu);
 }

+ 279 - 0
src/main/java/com/uas/platform/b2c/logistics/model/DistributionRule.java

@@ -0,0 +1,279 @@
+package com.uas.platform.b2c.logistics.model;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.uas.platform.b2c.core.utils.FastjsonUtils;
+import org.apache.commons.collections.CollectionUtils;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.springframework.util.StringUtils;
+
+import javax.persistence.*;
+import java.util.List;
+
+/**
+ * Created by hulh on 2017/8/28.
+ * 配送规则
+ */
+@Entity
+@Table(name = "logistics$distributor_rule")
+public class DistributionRule {
+
+	/**
+	 * 主键id
+	 */
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "logistics$distributor_gen")
+	@SequenceGenerator(name = "logistics$distributor_gen", sequenceName = "logistics$distributor_seq", allocationSize = 1)
+	@Column(name = "rule_id")
+	private Long id;
+
+	/**
+	 * 用户uu
+	 */
+	@Column(name = "rule_uu")
+	private Long useruu;
+
+	/**
+	 * 企业enuu
+	 */
+	@Column(name = "rule_enuu")
+	private Long enuu;
+
+	/**
+	 * 配送规则名称
+	 */
+	@Column(name = "rule_name")
+	private String ruleName;
+
+	/**
+	 * 适用店铺 0-自营,1-寄售
+	 */
+	@Column(name = "rule_store_type")
+	private Short storeType;
+
+	/**
+	 * 适用类型 1201-普通订单,1202-预售订单,1203-发票
+	 */
+	@Column(name = "rule_order_type")
+	private String orderType;
+
+	/**
+	 * 适用用户 1301-所有用户
+	 * TODO 目前暂时展示所有用户
+	 */
+	@Column(name = "rule_user_type")
+	private Integer userType;
+
+	/**
+	 * 配送方式
+	 * 1301-第三方配送,1302-卖家配送,1303-上门自提
+	 */
+	@Column(name = "rule_method")
+	private Integer shippingMethod;
+
+	/**
+	 * 是否生效,1-生效,0-不生效
+	 */
+	@Column(name = "rule_active")
+	private Short active;
+
+	/**
+	 * 配送规则排序
+	 */
+	@Column(name = "rule_num")
+	private Integer num;
+
+	/**
+	 * 币别 RMB-USD
+	 */
+	@Column(name = "rule_currency")
+	private String currencyName;
+
+	/**
+	 * 计费方式
+	 * 1-统一规定运费,2-按总金额计算
+	 */
+	@Column(name = "rule_fare_type")
+	private Short fareType;
+
+	/**
+	 * 分段运费(JSON串)
+	 */
+	@Column(name = "rule_qtyFare")
+	private String qtyFare;
+
+	/**
+	 * 统一运费
+	 */
+	@Column(name = "rule_uniform_price")
+	private Double uniformPrice;
+
+	/**
+	 * 分段运费
+	 */
+	@Transient
+	private List<RuleQtyFare> fares;
+
+	/**
+	 * 分段地区(JSON串)
+	 */
+	@Column(name = "rule_qtyArea")
+	private String qtyArea;
+
+	/**
+	 * 分段地区(list)
+	 */
+	@Transient
+	private List<RuleQtyArea> areas;
+
+	/**
+	 * TODO 是否需要记录计算说明文案
+	 */
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getUseruu() {
+		return useruu;
+	}
+
+	public void setUseruu(Long useruu) {
+		this.useruu = useruu;
+	}
+
+	public Long getEnuu() {
+		return enuu;
+	}
+
+	public void setEnuu(Long enuu) {
+		this.enuu = enuu;
+	}
+
+	public Short getStoreType() {
+		return storeType;
+	}
+
+	public void setStoreType(Short storeType) {
+		this.storeType = storeType;
+	}
+
+	public String getOrderType() {
+		return orderType;
+	}
+
+	public void setOrderType(String orderType) {
+		this.orderType = orderType;
+	}
+
+	public Integer getUserType() {
+		return userType;
+	}
+
+	public void setUserType(Integer userType) {
+		this.userType = userType;
+	}
+
+	public Integer getShippingMethod() {
+		return shippingMethod;
+	}
+
+	public void setShippingMethod(Integer shippingMethod) {
+		this.shippingMethod = shippingMethod;
+	}
+
+	public Short getActive() {
+		return active;
+	}
+
+	public void setActive(Short active) {
+		this.active = active;
+	}
+
+	public Short getFareType() {
+		return fareType;
+	}
+
+	public void setFareType(Short fareType) {
+		this.fareType = fareType;
+	}
+
+	@JSONField(serialize = false)
+	@JsonIgnore
+	public String getQtyFare() {
+		return qtyFare;
+	}
+
+	public void setQtyFare(String qtyFare) {
+		this.qtyFare = qtyFare;
+	}
+
+	public Double getUniformPrice() {
+		return uniformPrice;
+	}
+
+	public void setUniformPrice(Double uniformPrice) {
+		this.uniformPrice = uniformPrice;
+	}
+
+
+	public List<RuleQtyFare> getFares() {
+		if (CollectionUtils.isEmpty(fares) && StringUtils.hasText(qtyFare)) {
+			return FastjsonUtils.fromJsonArray(qtyFare, RuleQtyFare.class);
+		} else {
+			return fares;
+		}
+	}
+
+	public void setFares(List<RuleQtyFare> fares) {
+		this.fares = fares;
+	}
+
+	@JSONField(serialize = false)
+	@JsonIgnore
+	public String getQtyArea() {
+		return qtyArea;
+	}
+
+	public void setQtyArea(String qtyArea) {
+		this.qtyArea = qtyArea;
+	}
+
+	public List<RuleQtyArea> getAreas() {
+		if (CollectionUtils.isEmpty(areas) && StringUtils.hasText(qtyArea)) {
+			return FastjsonUtils.fromJsonArray(qtyArea, RuleQtyArea.class);
+		} else {
+			return areas;
+		}
+	}
+
+	public void setAreas(List<RuleQtyArea> areas) {
+		this.areas = areas;
+	}
+
+	public String getRuleName() {
+		return ruleName;
+	}
+
+	public void setRuleName(String ruleName) {
+		this.ruleName = ruleName;
+	}
+
+	public Integer getNum() {
+		return num;
+	}
+
+	public void setNum(Integer num) {
+		this.num = num;
+	}
+
+	public String getCurrencyName() {
+		return currencyName;
+	}
+
+	public void setCurrencyName(String currencyName) {
+		this.currencyName = currencyName;
+	}
+}

+ 14 - 0
src/main/java/com/uas/platform/b2c/logistics/model/DistributorSeller.java

@@ -52,6 +52,12 @@ public class DistributorSeller {
 	@Column(name = "seller_createtime")
 	private Date createtime;
 
+	/**
+	 * 配送商排序
+	 */
+	@Column(name = "seller_num")
+	private Integer num;
+
 	public Long getId() {
 		return id;
 	}
@@ -107,4 +113,12 @@ public class DistributorSeller {
 	public void setCreatetime(Date createtime) {
 		this.createtime = createtime;
 	}
+
+	public Integer getNum() {
+		return num;
+	}
+
+	public void setNum(Integer num) {
+		this.num = num;
+	}
 }

+ 69 - 0
src/main/java/com/uas/platform/b2c/logistics/model/InvoiceFOrder.java

@@ -92,6 +92,36 @@ public class InvoiceFOrder extends Document implements Serializable {
 	@Column(name = "in_sp_addr", length = 2000)
 	private String jsonSpAddress;
 
+	/**
+	 * 配送类型
+	 */
+	@Column(name = "in_delivery_type")
+	private Integer deliveryType;
+
+	/**
+	 * 适用配送规则
+	 */
+	@Column(name = "in_rule", length = 2000)
+	private String jsonRule;
+
+	/**
+	 * 自提点信息
+	 */
+	@Column(name = "in_take_self", length = 2000)
+	private String jsonTakeSelf;
+
+	/**
+	 * 运费
+	 */
+	@Column(name = "in_fare")
+	private Double fare;
+
+	/**
+	 * 订单备注
+	 */
+	@Column(name = "in_remark", length = 4000)
+	private String inforRemark;
+
 	/**
 	 * 发货地址 这里使用json字符串的形式将收货地址整个存起来
 	 */
@@ -228,6 +258,14 @@ public class InvoiceFOrder extends Document implements Serializable {
 		this.buyeruu = buyeruu;
 	}
 
+	public String getInforRemark() {
+		return inforRemark;
+	}
+
+	public void setInforRemark(String inforRemark) {
+		this.inforRemark = inforRemark;
+	}
+
 	public Long getUasPurcid() {
 		return uasPurcid;
 	}
@@ -260,6 +298,14 @@ public class InvoiceFOrder extends Document implements Serializable {
 		this.orid = orid;
 	}
 
+	public Integer getDeliveryType() {
+		return deliveryType;
+	}
+
+	public void setDeliveryType(Integer deliveryType) {
+		this.deliveryType = deliveryType;
+	}
+
 	public String getJsonSpAddress() {
 		return jsonSpAddress;
 	}
@@ -414,4 +460,27 @@ public class InvoiceFOrder extends Document implements Serializable {
 		this.sendstatus = sendstatus;
 	}
 
+	public String getJsonRule() {
+		return jsonRule;
+	}
+
+	public void setJsonRule(String jsonRule) {
+		this.jsonRule = jsonRule;
+	}
+
+	public String getJsonTakeSelf() {
+		return jsonTakeSelf;
+	}
+
+	public void setJsonTakeSelf(String jsonTakeSelf) {
+		this.jsonTakeSelf = jsonTakeSelf;
+	}
+
+	public Double getFare() {
+		return fare;
+	}
+
+	public void setFare(Double fare) {
+		this.fare = fare;
+	}
 }

+ 60 - 0
src/main/java/com/uas/platform/b2c/logistics/model/InvoiceFOrderDetail.java

@@ -67,6 +67,18 @@ public class InvoiceFOrderDetail {
 	@Column(name = "go_batch")
 	private String batchCode;
 
+	/**
+	 * 明细的评论
+	 */
+	@Column(name = "detail_remark", length = 4000)
+	private String remark;
+
+	/**
+	 * 物料编号
+	 */
+	@Column(name = "detail_go_number")
+	private String goodsnumber;
+
 	/**
 	 * 对应的器件uuid
 	 */
@@ -189,6 +201,18 @@ public class InvoiceFOrderDetail {
 	@Column(name = "detail_currency")
 	private String currency;
 
+	/**
+	 * 商城最长交期
+	 */
+	@Column(name = "go_b2cmaxdelivery")
+	private Short b2cMaxDelivery;
+
+	/**
+	 * 商城最短交期
+	 */
+	@Column(name = "go_b2cmindelivery")
+	private Short b2cMinDelivery;
+
 	public InvoiceFOrderDetail() {
 	}
 
@@ -228,6 +252,10 @@ public class InvoiceFOrderDetail {
 		this.ensurePrice = detail.getEnsurePrice();
 		this.ordetailid = detail.getId();
 		this.status = Status.TOBESHIPPED.value();
+		this.goodsnumber = detail.getGoodsnumber();
+		this.b2cMinDelivery = detail.getB2cMinDelivery();
+		this.b2cMaxDelivery = detail.getB2cMaxDelivery();
+		this.remark = detail.getRemark();
 	}
 
 	public Long getId() {
@@ -262,6 +290,38 @@ public class InvoiceFOrderDetail {
 		this.tax = tax;
 	}
 
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public String getGoodsnumber() {
+		return goodsnumber;
+	}
+
+	public void setGoodsnumber(String goodsnumber) {
+		this.goodsnumber = goodsnumber;
+	}
+
+	public Short getB2cMaxDelivery() {
+		return b2cMaxDelivery;
+	}
+
+	public void setB2cMaxDelivery(Short b2cMaxDelivery) {
+		this.b2cMaxDelivery = b2cMaxDelivery;
+	}
+
+	public Short getB2cMinDelivery() {
+		return b2cMinDelivery;
+	}
+
+	public void setB2cMinDelivery(Short b2cMinDelivery) {
+		this.b2cMinDelivery = b2cMinDelivery;
+	}
+
 	public Double getTaxes() {
 		return taxes;
 	}

+ 74 - 2
src/main/java/com/uas/platform/b2c/logistics/model/InvoiceFPurchase.java

@@ -99,6 +99,12 @@ public class InvoiceFPurchase extends Document implements Serializable {
 	 */
 	@Column(name = "in_sourceid")
 	private String sourceid;
+
+	/**
+	 * 订单备注
+	 */
+	@Column(name = "in_remark", length = 4000)
+	private String infpuRemark;
 	
 	/**
 	 * 是否是UAS的来源
@@ -155,13 +161,31 @@ public class InvoiceFPurchase extends Document implements Serializable {
 	private String currencyName;
 
 	/**
-	 * 价税合计
+	 * 运费
+	 */
+	@Column(name = "in_fare")
+	private Double fare;
+
+	/**
+	 * 适用的配送规则
+	 */
+	@Column(name = "in_rule")
+	private String jsonRule;
+
+	/**
+	 * 自提点信息
+	 */
+	@Column(name = "in_take_self")
+	private String jsonTakeSelf;
+
+	/**
+	 * 价税合计 (商品合计)
 	 */
 	@Column(name = "in_price")
 	private Double price;
 
 	/**
-	 * 确认金额(考虑商城打折的情况)
+	 * 确认金额(考虑商城打折的情况)(包括运费)
 	 */
 	@Column(name = "ensure_price")
 	private Double ensurePrice;
@@ -190,6 +214,12 @@ public class InvoiceFPurchase extends Document implements Serializable {
 	 */
 	@Column(name = "in_proofingid")
 	private Long proofingid;
+
+	/**
+	 * 配送方式
+	 */
+	@Column(name = "in_send_type")
+	private Integer sendType;
 	
 	/**
 	 * 自己送货还是第三方物流送货
@@ -276,6 +306,14 @@ public class InvoiceFPurchase extends Document implements Serializable {
 		this.deliveryType = deliveryType;
 	}
 
+	public Integer getSendType() {
+		return sendType;
+	}
+
+	public void setSendType(Integer sendType) {
+		this.sendType = sendType;
+	}
+
 	public String getSelfDeliveryName() {
 		return selfDeliveryName;
 	}
@@ -514,6 +552,38 @@ public class InvoiceFPurchase extends Document implements Serializable {
 		return this;
 	}
 
+	public String getInfpuRemark() {
+		return infpuRemark;
+	}
+
+	public void setInfpuRemark(String infpuRemark) {
+		this.infpuRemark = infpuRemark;
+	}
+
+	public Double getFare() {
+		return fare;
+	}
+
+	public void setFare(Double fare) {
+		this.fare = fare;
+	}
+
+	public String getJsonRule() {
+		return jsonRule;
+	}
+
+	public void setJsonRule(String jsonRule) {
+		this.jsonRule = jsonRule;
+	}
+
+	public String getJsonTakeSelf() {
+		return jsonTakeSelf;
+	}
+
+	public void setJsonTakeSelf(String jsonTakeSelf) {
+		this.jsonTakeSelf = jsonTakeSelf;
+	}
+
 	/**
 	 * @Tip 对象初始化时必须给历史记录赋值
 	 */
@@ -541,5 +611,7 @@ public class InvoiceFPurchase extends Document implements Serializable {
 		this.sourceid = purchase.getPurchaseid();
 		this.storeid = purchase.getStoreid();
 		this.orid = purchase.getOrderid();
+		this.infpuRemark = purchase.getPurchaseRemark();
+		this.fare = purchase.getFare();
 	}
 }

+ 60 - 0
src/main/java/com/uas/platform/b2c/logistics/model/InvoiceFPurchaseDetail.java

@@ -204,12 +204,36 @@ public class InvoiceFPurchaseDetail {
 	@StatusColumn
 	private Integer status;
 
+	/**
+	 * 明细的评论
+	 */
+	@Column(name = "detail_remark", length = 4000)
+	private String remark;
+
+	/**
+	 * 物料编号
+	 */
+	@Column(name = "detail_go_number")
+	private String goodsnumber;
+
 	/**
 	 * 店铺的storeid
 	 */
 	@Column(name = "detail_storid")
 	private String storeid;
 
+	/**
+	 * 商城最长交期
+	 */
+	@Column(name = "go_b2cmaxdelivery")
+	private Short b2cMaxDelivery;
+
+	/**
+	 * 商城最短交期
+	 */
+	@Column(name = "go_b2cmindelivery")
+	private Short b2cMinDelivery;
+
 	public InvoiceFPurchaseDetail() {
 	}
 
@@ -246,6 +270,10 @@ public class InvoiceFPurchaseDetail {
 		this.returnInWeek = puDetail.getReturnInWeek();
 		this.returnQty = puDetail.getReturnQty();
 		this.changeQty = puDetail.getChangeQty();
+		this.b2cMinDelivery = puDetail.getB2cMinDelivery();
+		this.b2cMaxDelivery = puDetail.getB2cMaxDelivery();
+		this.remark = puDetail.getRemark();
+		this.goodsnumber = puDetail.getGoodsnumber();
 	}
 
 	public Long getId() {
@@ -296,6 +324,38 @@ public class InvoiceFPurchaseDetail {
 		this.uuid = uuid;
 	}
 
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public String getGoodsnumber() {
+		return goodsnumber;
+	}
+
+	public void setGoodsnumber(String goodsnumber) {
+		this.goodsnumber = goodsnumber;
+	}
+
+	public Short getB2cMaxDelivery() {
+		return b2cMaxDelivery;
+	}
+
+	public void setB2cMaxDelivery(Short b2cMaxDelivery) {
+		this.b2cMaxDelivery = b2cMaxDelivery;
+	}
+
+	public Short getB2cMinDelivery() {
+		return b2cMinDelivery;
+	}
+
+	public void setB2cMinDelivery(Short b2cMinDelivery) {
+		this.b2cMinDelivery = b2cMinDelivery;
+	}
+
 	public String getCmpCode() {
 		return cmpCode;
 	}

+ 56 - 0
src/main/java/com/uas/platform/b2c/logistics/model/RuleQtyArea.java

@@ -0,0 +1,56 @@
+package com.uas.platform.b2c.logistics.model;
+
+/**
+ * Created by hulh on 2017/8/28.
+ * 分段地区
+ */
+public class RuleQtyArea {
+	/**
+	 * 地区:中国大陆--港澳台
+	 */
+	private String mainland;
+	/**
+	 * 地区:省
+	 */
+	private String province;
+	/**
+	 * 地区:市
+	 */
+	private String city;
+	/**
+	 * 地区:区
+	 */
+	private String area;
+
+	public String getProvince() {
+		return province;
+	}
+
+	public void setProvince(String province) {
+		this.province = province;
+	}
+
+	public String getCity() {
+		return city;
+	}
+
+	public void setCity(String city) {
+		this.city = city;
+	}
+
+	public String getArea() {
+		return area;
+	}
+
+	public void setArea(String area) {
+		this.area = area;
+	}
+
+	public String getMainland() {
+		return mainland;
+	}
+
+	public void setMainland(String mainland) {
+		this.mainland = mainland;
+	}
+}

+ 49 - 0
src/main/java/com/uas/platform/b2c/logistics/model/RuleQtyFare.java

@@ -0,0 +1,49 @@
+package com.uas.platform.b2c.logistics.model;
+
+/**
+ * Created by hulh on 2017/8/28.
+ * 分段运费
+ */
+public class RuleQtyFare {
+	/**
+	 * 分段开始  --包括开始
+	 */
+	private Double start;
+	/**
+	 * 分段结束  --不包括结束
+	 */
+	private Double end;
+	/**
+	 * 分段费用
+	 */
+	private Double fare;
+	/**
+	 * 分段币别
+	 */
+//	private String currency;
+
+
+	public Double getStart() {
+		return start;
+	}
+
+	public void setStart(Double start) {
+		this.start = start;
+	}
+
+	public Double getEnd() {
+		return end;
+	}
+
+	public void setEnd(Double end) {
+		this.end = end;
+	}
+
+	public Double getFare() {
+		return fare;
+	}
+
+	public void setFare(Double fare) {
+		this.fare = fare;
+	}
+}

+ 104 - 0
src/main/java/com/uas/platform/b2c/logistics/model/UsableRuleInfo.java

@@ -0,0 +1,104 @@
+package com.uas.platform.b2c.logistics.model;
+
+/**
+ * Created by hulh on 2017/9/13.
+ * 适用的配送规则简要信息
+ */
+public class UsableRuleInfo {
+	/**
+	 * 配送id
+	 */
+	private Long id;
+	/**
+	 * 配送规则名称
+	 */
+	private String ruleName;
+	/**
+	 * 实际所需价格
+	 */
+	private Double fare;
+	/**
+	 * 配送方式
+	 */
+	private Integer method;
+	/**
+	 * 卖家enuu
+	 */
+	private Long enuu;
+	/**
+	 * 卖家店铺uuid
+	 */
+	private String uuid;
+	/**
+	 * 配送规则币别
+	 */
+	private String currencyName;
+
+	public UsableRuleInfo(){
+
+	}
+
+	public UsableRuleInfo(DistributionRule rule){
+		this.id = rule.getId();
+		this.ruleName = rule.getRuleName();
+		this.method = rule.getShippingMethod();
+		this.currencyName = rule.getCurrencyName();
+		this.enuu = rule.getEnuu();
+	}
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public String getRuleName() {
+		return ruleName;
+	}
+
+	public void setRuleName(String ruleName) {
+		this.ruleName = ruleName;
+	}
+
+	public Double getFare() {
+		return fare;
+	}
+
+	public void setFare(Double fare) {
+		this.fare = fare;
+	}
+
+	public Integer getMethod() {
+		return method;
+	}
+
+	public void setMethod(Integer method) {
+		this.method = method;
+	}
+
+	public Long getEnuu() {
+		return enuu;
+	}
+
+	public void setEnuu(Long enuu) {
+		this.enuu = enuu;
+	}
+
+	public String getCurrencyName() {
+		return currencyName;
+	}
+
+	public void setCurrencyName(String currencyName) {
+		this.currencyName = currencyName;
+	}
+
+	public String getUuid() {
+		return uuid;
+	}
+
+	public void setUuid(String uuid) {
+		this.uuid = uuid;
+	}
+}

+ 8 - 0
src/main/java/com/uas/platform/b2c/logistics/service/AddressTakeSelfService.java

@@ -1,10 +1,12 @@
 package com.uas.platform.b2c.logistics.service;
 
+import com.alibaba.fastjson.JSONObject;
 import com.uas.platform.b2c.logistics.model.AddressTakeSelf;
 import com.uas.platform.core.model.PageParams;
 import org.springframework.data.domain.Page;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * Created by hulh on 2017/8/11.
@@ -48,4 +50,10 @@ public interface AddressTakeSelfService {
 	 * @return
 	 */
 	List<String> findAllTakeSelfName();
+
+	/**
+	 * 根据企业列表获取自提点信息
+	 * @return
+	 */
+	Map<String, List<AddressTakeSelf>> findTakeSelfByStore(List<JSONObject> info);
 }

+ 99 - 0
src/main/java/com/uas/platform/b2c/logistics/service/DistributionRuleService.java

@@ -0,0 +1,99 @@
+package com.uas.platform.b2c.logistics.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.uas.platform.b2c.logistics.model.DistributionRule;
+import com.uas.platform.b2c.logistics.model.UsableRuleInfo;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import com.uas.platform.core.model.PageParams;
+import org.springframework.data.domain.Page;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by hulh on 2017/8/28.
+ * 配送规则service
+ */
+public interface DistributionRuleService {
+
+	/**
+	 * 分页获取配送规则
+	 * @param params
+	 * @return
+	 */
+	Page<DistributionRule> findPageRule(PageParams params);
+
+	/**
+	 * 保存配送规则
+	 * @param isAdd
+	 * @param isActive
+	 * @param rule
+	 * @return
+	 */
+	ResultMap saveDistributionRule(Boolean isAdd, Boolean isActive, DistributionRule rule);
+
+	/**
+	 * 根据id修改配送规则的生效状态
+	 * @param id
+	 * @param isActive
+	 * @return
+	 */
+	ResultMap changeRuleActive(Long id, Boolean isActive);
+
+	/**
+	 * 根据id删除指定配送规则
+	 * @param id
+	 */
+	void deleteOne(Long id);
+
+	/**
+	 * 返回所有的配送规则名称
+	 * @return
+	 */
+	List<String> findAllRuleName();
+
+	/**
+	 * 返回当前enuu下配送规则总数
+	 * @return
+	 */
+	ResultMap findCountRule();
+
+	/**
+	 * 查找是否已存在该名称
+	 * @param id
+	 * @param ruleName
+	 * @param newSave
+	 * @return
+	 */
+	ResultMap containsName(Long id, String ruleName, Boolean newSave);
+
+	/**
+	 * 根据配送方式和地区匹配适用的配送规则
+	 * @param method
+	 * @param area
+	 * @return
+	 */
+	List<DistributionRule> ruleMatchArea(Integer method, String area, String uuid);
+
+	/**
+	 * 获取已设置生效配送规则的配送方式列表
+	 * @return
+	 */
+	List<Integer> findUsableShippingMethod();
+
+	/**
+	 * 根据店铺id集合和地区获取配送规则
+	 * @param uuidArray
+	 * @param area
+	 * @return
+	 */
+	Map<String, List<UsableRuleInfo>> findRuleMatchArea(List<JSONObject> uuidArray, String area);
+
+	/**
+	 * 更新指定运费
+	 * @param ruleList
+	 * @param price
+	 * @return
+	 */
+	List<UsableRuleInfo> findFareOfRule(List<UsableRuleInfo> ruleList, Double price);
+}

+ 17 - 0
src/main/java/com/uas/platform/b2c/logistics/service/LogisticsOldService.java

@@ -60,6 +60,23 @@ public interface LogisticsOldService {
 	 */
 	ResultMap updateLogistics(Long id, Logistics logistics, String invoicFuid);
 
+	/**
+	 * 新增快递信息
+	 *
+	 * @param inid
+	 * @param logistics
+	 * @return
+	 */
+	ResultMap addLogistics(String inid, Logistics logistics);
+
+	/**
+	 * 清除对应订单下的快递信息
+	 *
+	 * @param inid
+	 * @return
+	 */
+	ResultMap clearLogistics(String inid);
+
 	/**
 	 * 传入物流公司和物流单号 生成Logistics
 	 *

+ 13 - 17
src/main/java/com/uas/platform/b2c/logistics/service/impl/AddressServiceImpl.java

@@ -37,7 +37,6 @@ public class AddressServiceImpl implements AddressService {
 	public void delete(Long addid) {
 		if (addressDao.exists(addid)) {
 			Address address = addressDao.findOne(addid);
-			int modifyNum = address.getNum();
 			List<Address> addresses = null;
 			addressDao.delete(addid);
 			int type = address.getType();
@@ -48,12 +47,14 @@ public class AddressServiceImpl implements AddressService {
 				addresses = addressDao.findByEnuuAndTypeAndUsetypeOrderByNumAsc(address.getEnuu(), type, (short)2);
 			}
 			if (!CollectionUtils.isEmpty(addresses) && addresses.size() > 0) {
-				int num = 0;
-				if (modifyNum == 1) {
-					num = 1;
-				}
-				for (Address add : addresses){
-					add.setNum(++num);
+				if (addresses.size() == 1){
+					Address add = addresses.get(0);
+					add.setNum(1);
+				}else {
+					int num = addresses.get(0).getNum();
+					for (Address add : addresses){
+						add.setNum(num++);
+					}
 				}
 			}
 			addressDao.save(addresses);
@@ -71,7 +72,6 @@ public class AddressServiceImpl implements AddressService {
 	@Override
 	public void setTop(Long addid, boolean setTop) {
 		Address address = addressDao.findOne(addid); //查询操作的Address
-//		System.out.println("setTop=" + setTop);
 		Long useruu = address.getUseruu();
 		int type = address.getType();
 		List<Address> addresses = null;
@@ -84,7 +84,6 @@ public class AddressServiceImpl implements AddressService {
 		long modifyId = address.getId().longValue();
 		int modifyNum = address.getNum().intValue();
 		if (setTop){
-//			System.out.println("设为默认地址情况");
 			for (Address add : addresses) {
 				if (add.getId().longValue() == modifyId) {
 					add.setNum(1);
@@ -95,14 +94,12 @@ public class AddressServiceImpl implements AddressService {
 			}
 		}else {
 			if (modifyNum == 1){ //取消默认地址
-//				System.out.println("取消默认地址情况");
 				for (Address add : addresses) { //空出默认地址位置
 					add.setNum(++num);
 				}
 			}else {
 				int firstNum = addresses.get(0).getNum();
 				if (firstNum == 1){ //有默认地址情况
-//					System.out.println("有默认地址新增地址情况");
 					num++; //空出默认地址位置
 					for (Address add : addresses) {
 						if (add.getNum() != 1){
@@ -115,7 +112,6 @@ public class AddressServiceImpl implements AddressService {
 						}
 					}
 				}else { //没有默认地址情况
-//					System.out.println("没有默认地址新增地址情况");
 					num++; //空出默认地址位置
 					for (Address add : addresses) {
 						if (add.getId().longValue() != modifyId){
@@ -156,17 +152,17 @@ public class AddressServiceImpl implements AddressService {
 				address.setUsetype((short)2);
 				num = addressDao.getCountByEnuuAndTypeAndUsetype(user.getEnterprise().getUu(), address.getType(), address.getUsetype());
 			}
-			address.setNum(num == null ? 1 : ++num);
+			address.setNum(num == 0 ? 1 : ++num);
 		}
 		Long modifyId = address.getId();
 		Address add = save(address);
-		System.out.println(address.getId());
+		if (modifyId == null && add.getNum().intValue() == 1){
+			isSetTop = true;
+		}
 		if(modifyId == null || isSetTop) { //只有新增加的地址 或者需要被置顶的地址 才需要重新排序。
-//			System.out.println("新增地址或设为默认地址");
 			setTop(add.getId(), isSetTop);
 		}
-		if (address.getNum() == 1 && !isSetTop) { //取消默认地址的时候需要重新排序
-//			System.out.println("取消默认地址");
+		if (address.getNum().intValue() == 1 && !isSetTop) { //取消默认地址的时候需要重新排序
 			setTop(add.getId(), isSetTop);
 		}
 		return add;

+ 25 - 0
src/main/java/com/uas/platform/b2c/logistics/service/impl/AddressTakeSelfServiceImpl.java

@@ -1,9 +1,13 @@
 package com.uas.platform.b2c.logistics.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.logistics.dao.AddressTakeSelfDao;
 import com.uas.platform.b2c.logistics.model.AddressTakeSelf;
 import com.uas.platform.b2c.logistics.service.AddressTakeSelfService;
+import com.uas.platform.b2c.prod.store.dao.StoreInDao;
+import com.uas.platform.b2c.prod.store.model.StoreIn;
+import com.uas.platform.core.exception.IllegalOperatorException;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,7 +21,9 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Created by hulh on 2017/8/11.
@@ -25,9 +31,13 @@ import java.util.List;
 @Service
 @Transactional
 public class AddressTakeSelfServiceImpl implements AddressTakeSelfService {
+
 	@Autowired
 	private AddressTakeSelfDao addressTakeSelfDao;
 
+	@Autowired
+	private StoreInDao storeInDao;
+
 	@Override
 	public AddressTakeSelf saveTakeSelf(AddressTakeSelf addressTakeSelf, Boolean isActive) {
 		if (addressTakeSelf.getId() == null){
@@ -81,4 +91,19 @@ public class AddressTakeSelfServiceImpl implements AddressTakeSelfService {
 		Long enuu = SystemSession.getUser().getEnterprise().getUu();
 		return addressTakeSelfDao.findTakenameByEnuu(enuu);
 	}
+
+	@Override
+	public Map<String, List<AddressTakeSelf>> findTakeSelfByStore(List<JSONObject> info) {
+		Map<String, List<AddressTakeSelf>> map = new HashMap<>();
+		for (JSONObject object : info){
+			StoreIn store = storeInDao.findByUuid(object.getString("uuid"));
+			if (store == null){
+				throw new IllegalOperatorException("店铺信息丢失,请刷新后重试");
+			}
+			Long enuu = store.getEnUU();
+			List<AddressTakeSelf> list = addressTakeSelfDao.findByEnuuOrderByCreatetimeDesc(enuu);
+			map.put(object.getString("uuid"), list);
+		}
+		return map;
+	}
 }

+ 491 - 0
src/main/java/com/uas/platform/b2c/logistics/service/impl/DistributionRuleServiceImpl.java

@@ -0,0 +1,491 @@
+package com.uas.platform.b2c.logistics.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.uas.platform.b2c.core.config.SysConf;
+import com.uas.platform.b2c.core.constant.ShortConstant;
+import com.uas.platform.b2c.core.constant.SplitChar;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.b2c.logistics.dao.DistributionRuleDao;
+import com.uas.platform.b2c.logistics.model.DistributionRule;
+import com.uas.platform.b2c.logistics.model.RuleQtyArea;
+import com.uas.platform.b2c.logistics.model.RuleQtyFare;
+import com.uas.platform.b2c.logistics.model.UsableRuleInfo;
+import com.uas.platform.b2c.logistics.service.DistributionRuleService;
+import com.uas.platform.b2c.prod.store.dao.StoreInDao;
+import com.uas.platform.b2c.prod.store.model.StoreIn;
+import com.uas.platform.b2c.trade.support.CodeType;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import com.uas.platform.core.exception.IllegalOperatorException;
+import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.model.PageParams;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by hulh on 2017/8/28.
+ * 配送规则实现类
+ */
+@Service
+@Transactional
+public class DistributionRuleServiceImpl implements DistributionRuleService{
+
+	@Autowired
+	private DistributionRuleDao distributionRuleDao;
+
+	@Autowired
+	private StoreInDao storeInDao;
+
+	@Autowired
+	private SysConf sysConf;
+
+	@Override
+	public Page<DistributionRule> findPageRule(PageParams params) {
+		final PageInfo pageInfo = new PageInfo(params);
+		pageInfo.filter("enuu", SystemSession.getUser().getEnterprise().getUu());
+		return distributionRuleDao.findAll(new Specification<DistributionRule>() {
+			@Override
+			public Predicate toPredicate(Root<DistributionRule> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
+				query.where(pageInfo.getPredicates(root, query, cb));
+				return null;
+			}
+		}, pageInfo);
+	}
+
+	/**
+	 * 保存或修改配送规则
+	 * @param isAdd true-保存,false-另存
+	 * @param isActive
+	 * @param rule
+	 * @return
+	 */
+	@Override
+	public ResultMap saveDistributionRule(Boolean isAdd, Boolean isActive, DistributionRule rule) {
+		if (rule.getShippingMethod() == null){
+			return new ResultMap(CodeType.NO_INFO, "请选择配送方式");
+		}
+		if (rule.getRuleName() == null || rule.getRuleName().isEmpty()){
+			return new ResultMap(CodeType.NO_INFO, "请填写规则名称");
+		}
+		if (CollectionUtils.isEmpty(rule.getAreas())){
+			return new ResultMap(CodeType.NO_INFO, "您还没有选择任何地区");
+		}
+		if (rule.getFareType() == 2 && CollectionUtils.isEmpty(rule.getFares())){
+			return new ResultMap(CodeType.NO_INFO, "请完善计费方式");
+		}
+		if (rule.getId() == null){ //新增配送规则,初始化数据
+			Long uu = SystemSession.getUser().getUserUU();
+			Long enuu = SystemSession.getUser().getEnterprise().getUu();
+			rule.setUseruu(uu);
+			rule.setEnuu(enuu);
+
+			if (enuu.longValue() == sysConf.getEnUU().longValue()){
+				rule.setStoreType(ShortConstant.YES_SHORT);
+			}else {
+				rule.setStoreType(ShortConstant.NO_SHORT);
+			}
+		}
+		if (isActive){
+			rule.setActive(ShortConstant.YES_SHORT);
+		}else {
+			rule.setActive(ShortConstant.NO_SHORT);
+		}
+		if (!isAdd){ //若为另存为,则将主键id设为空
+			if (rule.getId() != null){
+				rule.setId(null);
+			}
+		}
+		int count = distributionRuleDao.findCountByEnuu(rule.getEnuu());
+		int num = count == 0 ? 1 : ++count;
+		if (rule.getId() == null){
+			if (rule.getNum() == null){
+				rule.setNum(num);
+			}else {
+				if (rule.getNum() < num){
+					sortRule(rule.getNum());
+				}else {
+					rule.setNum(num);
+				}
+			}
+		}else {
+			DistributionRule oldRule = distributionRuleDao.findOne(rule.getId());
+			if (rule.getNum() == null){
+				rule.setNum(oldRule.getNum());
+			}else {
+				if (rule.getNum() < num-1){
+					sortRule(rule.getId(), rule.getNum());
+				}else {
+					sortRule(rule.getId(), num-1);
+					rule.setNum(num-1);
+				}
+			}
+		}
+		distributionRuleDao.save(rule);
+		return ResultMap.success(null);
+	}
+
+	@Override
+	public ResultMap changeRuleActive(Long id, Boolean isActive) {
+		DistributionRule rule = distributionRuleDao.findOne(id);
+		if (isActive){
+			rule.setActive((short)1);
+		}else {
+			rule.setActive((short)0);
+		}
+		distributionRuleDao.save(rule);
+		return ResultMap.success(null);
+	}
+
+	/**
+	 * 修改,排序已有配送规则列表,本配送规则不参与排序,空出num位置
+	 * @param id
+	 * @param num
+	 */
+	public void sortRule(Long id, int num){
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		List<DistributionRule> ruleList = distributionRuleDao.findAllByEnuu(enuu);
+		int start = 1;
+		for (DistributionRule rule : ruleList){
+			if (rule.getId() != id){
+				if (start == num){
+					start++;
+//					System.out.println("start=" + start);
+				}
+				rule.setNum(start++);
+			}
+		}
+		distributionRuleDao.save(ruleList);
+	}
+
+	/**
+	 * 新增,排序已有配送规则列表,空出num位置
+	 * @param num
+	 */
+	public void sortRule(int num){
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		List<DistributionRule> ruleList = distributionRuleDao.findAllByEnuu(enuu);
+		int start = 1;
+		for (DistributionRule rule : ruleList){
+			if (start == num){
+				start++;
+			}
+			rule.setNum(start++);
+		}
+		distributionRuleDao.save(ruleList);
+	}
+
+	@Transactional
+	@Override
+	public void deleteOne(Long id) {
+		distributionRuleDao.deleteOneById(id);
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		List<DistributionRule> ruleList = distributionRuleDao.findAllByEnuu(enuu);
+		int num = 1;
+		for (DistributionRule rule : ruleList){
+			rule.setNum(num++);
+		}
+		distributionRuleDao.save(ruleList);
+	}
+
+	@Override
+	public List<String> findAllRuleName() {
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		return distributionRuleDao.findAllRuleNameByEnuu(enuu);
+	}
+
+	/**
+	 * 查询已设置配送规则的数量
+	 * @return
+	 */
+	@Override
+	public ResultMap findCountRule() {
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		int count = distributionRuleDao.findCountByEnuu(enuu);
+		return ResultMap.success(count);
+	}
+
+	/**
+	 * 根据配送规则名称查询是否已存在
+	 * @param id
+	 * @param ruleName 配送规则名称
+	 * @param newSave 是否为另存,true-另存 false-保存
+	 * @return
+	 */
+	@Override
+	public ResultMap containsName(Long id, String ruleName, Boolean newSave) {
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		Boolean repeat = null;
+		if (id != null){
+			//修改配送规则情况,分保存和另存为两种
+			if (newSave){ //另存为
+				int count = distributionRuleDao.findCountRuleName(enuu, ruleName);
+				if (count != 0){
+					repeat = true;
+				}else {
+					repeat = false;
+				}
+			}else { //保存
+				DistributionRule rule = distributionRuleDao.findOne(id);
+				if (ruleName.equals(rule.getRuleName())){
+					repeat = false;
+				}else {
+					int count = distributionRuleDao.findCountRuleName(enuu, ruleName);
+					if (count != 0){
+						repeat = true;
+					}else {
+						repeat = false;
+					}
+				}
+			}
+		}else { //新增配送规则情况
+			int count = distributionRuleDao.findCountRuleName(enuu, ruleName);
+			if (count != 0){
+				repeat = true;
+			}else {
+				repeat = false;
+			}
+		}
+		return ResultMap.success(repeat);
+	}
+
+	@Override
+	public List<Integer> findUsableShippingMethod() {
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		return distributionRuleDao.findShippingMethodByEnuuAndActive(enuu, ShortConstant.YES_SHORT);
+	}
+
+	/**
+	 * 更新配送规则的运费
+	 * @param ruleList
+	 * @param price
+	 * @return
+	 */
+	@Override
+	public List<UsableRuleInfo> findFareOfRule(List<UsableRuleInfo> ruleList, Double price) {
+		if (CollectionUtils.isEmpty(ruleList)){
+			throw new IllegalOperatorException("配送规则信息丢失,请刷新后重试");
+		}
+		for (UsableRuleInfo info : ruleList){
+			DistributionRule rule = distributionRuleDao.findOne(info.getId());
+			if (rule == null){
+				throw new IllegalOperatorException("配送规则信息丢失,请刷新后重试");
+			}
+			Double fare = getFareOfRule(rule, price);
+			info.setFare(fare);
+		}
+		return ruleList;
+	}
+
+	/**
+	 * 返回所有店铺适用的配送规则
+	 * @param uuidArray
+	 * @param area
+	 * @return
+	 */
+	@Override
+	public Map<String, List<UsableRuleInfo>> findRuleMatchArea(List<JSONObject> uuidArray, String area){
+		if (area == null){
+			throw new IllegalOperatorException("地址信息缺失,请重新确认收货地址");
+		}
+		Map<String, List<UsableRuleInfo>> resultMap = new HashMap<>();
+		for (JSONObject object : uuidArray){
+			Double price = Double.parseDouble(object.getString("fare"));
+			List<UsableRuleInfo> list = findRuleInStore(object.getString("uuid"), area, price);
+			resultMap.put(object.getString("uuid"), list);
+		}
+		return resultMap;
+	}
+
+	/**
+	 * 返回该店铺适用的配送规则
+	 * @param uuid
+	 * @param area
+	 * @return
+	 */
+	public List<UsableRuleInfo> findRuleInStore(String uuid, String area, Double price){
+		StoreIn store = storeInDao.findByUuid(uuid);
+		if (store == null){
+			throw new IllegalOperatorException("店铺信息缺失,请刷新后重试");
+		}
+		List<DistributionRule> allRuleList = distributionRuleDao.findByEnuuAndActiveOrderByNumAsc(store.getEnUU(), ShortConstant.YES_SHORT);
+		List<UsableRuleInfo> ruleInfoList = new ArrayList<>();
+		List<Integer> methodList = new ArrayList<>();
+		for (DistributionRule rule : allRuleList){
+			if (!methodList.contains(rule.getShippingMethod())){
+				List<RuleQtyArea> qtyArea = rule.getAreas();
+				//转化分段地区信息
+				Map<String, Map<String, List<String>>> resultMap = convertArea(qtyArea);
+				//是否包含改地区信息
+				boolean isContains = containsArea(resultMap, area);
+				if (isContains){
+					methodList.add(rule.getShippingMethod());
+					UsableRuleInfo info = new UsableRuleInfo(rule);
+					Double fare = getFareOfRule(rule, price);
+					info.setFare(fare);
+					info.setUuid(uuid);
+					ruleInfoList.add(info);
+				}
+			}
+			if (methodList.size() == 3){
+				break;
+			}
+		}
+		return ruleInfoList;
+	}
+
+	/**
+	 * 根据配送方式获取匹配地区的配送规则列表
+	 * @param method
+	 * @param area
+	 * @param uuid
+	 * @return
+	 */
+	@Override
+	public List<DistributionRule> ruleMatchArea(Integer method, String area, String uuid) {
+		StoreIn store = storeInDao.findByUuid(uuid);
+
+		List<DistributionRule> resultList = new ArrayList<>();
+		// 根据配送方式找出所有生效的配送规则
+		List<DistributionRule> methodList = distributionRuleDao.findByEnuuAndShippingMethodAndActive(store.getEnUU(), method, ShortConstant.YES_SHORT);
+
+		for (DistributionRule rule : methodList){
+			List<RuleQtyArea> qtyArea = rule.getAreas();
+			Map<String, Map<String, List<String>>> resultMap = convertArea(qtyArea);
+			boolean isContains = containsArea(resultMap, area);
+			if (isContains){
+				resultList.add(rule);
+			}
+		}
+		return resultList;
+	}
+
+	/**
+	 * 获取运费最小的配送规则
+	 * @param price
+	 * @return
+	 */
+	public DistributionRule getRuleOInMinFare(Double price){
+		//获取匹配地区的配送规则列表
+		List<DistributionRule> matchList = null;
+		DistributionRule minRule = null; //最少运费的配送规则
+		Double minFare = getFareOfRule(matchList.get(0), price);
+		for (int i = 1; i<matchList.size(); i++){
+			Double fare = getFareOfRule(matchList.get(i), price);
+			if (fare < minFare){
+				minRule = matchList.get(i);
+				minFare = fare;
+			}
+		}
+		return minRule;
+	}
+
+	/**
+	 * 获取指定配送规则的运费
+	 * @param rule
+	 * @return
+	 */
+	public Double getFareOfRule(DistributionRule rule, Double price){
+		Double needFare = null;
+		if (rule.getFareType() == 1){
+			needFare = rule.getUniformPrice();
+		}else {
+			for (RuleQtyFare fare : rule.getFares()){
+				if (fare.getStart() <= price){
+					if (fare.getEnd() != null){
+						if (fare.getEnd() > price){
+							needFare = fare.getFare();
+						}
+					}else {
+						needFare = fare.getFare();
+					}
+				}
+			}
+		}
+		return needFare;
+	}
+
+	/**
+	 * 根据分段地区集合转化为可用的Map集合
+	 *
+	 * @param qtyArea 分段地区集合
+	 * @return
+	 */
+	public Map<String, Map<String, List<String>>> convertArea(List<RuleQtyArea> qtyArea){
+		if (qtyArea == null) {
+			throw new IllegalOperatorException("地区信息丢失,请刷新后重试");
+		}
+
+		Map<String, Map<String, List<String>>> areaMap = new HashMap<>();
+		for (RuleQtyArea a : qtyArea){
+			if (a.getProvince() != null && a.getProvince().length() != 0){
+				//判断该RuleQtyArea是否包含省字段
+				Map<String, List<String>> cityMap = null;
+				if (!areaMap.containsKey(a.getProvince())){
+					cityMap = new HashMap<>();
+					areaMap.put(a.getProvince(), cityMap);
+				}
+				cityMap = areaMap.get(a.getProvince());
+				if (a.getCity() != null && a.getCity().length() != 0){
+					//判断该RuleQtyArea是否包含市字段
+					List<String> areaList = null;
+					if (!cityMap.containsKey(a.getCity())){
+						areaList = new ArrayList<>();
+						cityMap.put(a.getCity(), areaList);
+					}
+					areaList = cityMap.get(a.getCity());
+					if (a.getArea() != null && a.getArea().length() != 0){
+						if (!areaList.contains(a.getArea())){
+							areaList.add(a.getArea());
+						}
+					}
+				}
+			}
+		}
+		return areaMap;
+	}
+
+	/**
+	 * 是否匹配该地区
+	 *
+	 * @param resultMap 转化的地区map集合
+	 * @param area 要匹配的地区
+	 * @return
+	 */
+	public boolean containsArea(Map<String, Map<String, List<String>>> resultMap, String area){
+		String[] areaArray = area.split(SplitChar.COMMA); //拆分地区数据,获取省,市,区的数组
+		if (resultMap.containsKey(areaArray[0])){ //是否包含该省
+			Map<String, List<String>> cityMap = resultMap.get(areaArray[0]);
+			if (cityMap.isEmpty()){ //没有市数据
+				return true;
+			}else {
+				if (cityMap.containsKey(areaArray[1])){ //是否包含该市
+					List<String> areaList = cityMap.get(areaArray[1]);
+					if (areaList.isEmpty()){ //没有区数据
+						return true;
+					}else {
+						if (areaList.contains(areaArray[2])){
+							return true;
+						}else {
+							return false;
+						}
+					}
+				}else {
+					return false;
+				}
+			}
+		}else {
+			return false;
+		}
+	}
+}

+ 14 - 14
src/main/java/com/uas/platform/b2c/logistics/service/impl/DistributorSellerServiceImpl.java

@@ -27,7 +27,7 @@ public class DistributorSellerServiceImpl implements DistributorSellerService {
 	@Override
 	public List<DistributorSeller> findAllChooseDistributor() {
 		Long enuu = SystemSession.getUser().getEnterprise().getUu();
-		return distributorSellerDao.findByEnuuOrderByCreatetimeDesc(enuu);
+		return distributorSellerDao.findByEnuuOrderByNumAsc(enuu);
 	}
 
 	@Override
@@ -35,22 +35,22 @@ public class DistributorSellerServiceImpl implements DistributorSellerService {
 		List<DistributorSeller> savaList = new ArrayList<>();
 		Long enuu = SystemSession.getUser().getEnterprise().getUu();
 		Long useruu = SystemSession.getUser().getUserUU();
-		List<String> chooseList = distributorSellerDao.findAllChooseName(enuu);
+		distributorSellerDao.deleteDistributorByEnuu(enuu);//保存前先清空表
+		int num = 1;
 		for (JSONObject object : objects){
-			if (!chooseList.contains(object.getString("companyName"))){
-				DistributorSeller distributor = new DistributorSeller();
-				if (object.getString("code") != null){
-					distributor.setIsKdn((short)1);
-				}else {
-					distributor.setIsKdn((short)0);
-				}
+			DistributorSeller distributor = new DistributorSeller();
+			if (object.getString("code") != null){
+				distributor.setIsKdn((short)1);
 				distributor.setCode(object.getString("code"));
-				distributor.setCompanyName(object.getString("companyName"));
-				distributor.setUseruu(useruu);
-				distributor.setEnuu(enuu);
-				distributor.setCreatetime(new Date());
-				savaList.add(distributor);
+			}else {
+				distributor.setIsKdn((short)0);
 			}
+			distributor.setCompanyName(object.getString("companyName"));
+			distributor.setUseruu(useruu);
+			distributor.setEnuu(enuu);
+			distributor.setCreatetime(new Date());
+			distributor.setNum(num++);
+			savaList.add(distributor);
 		}
 		return distributorSellerDao.save(savaList);
 	}

+ 15 - 1
src/main/java/com/uas/platform/b2c/logistics/service/impl/InvoiceFOrderServiceImpl.java

@@ -170,7 +170,7 @@ public class InvoiceFOrderServiceImpl implements InvoiceFOrderService {
 			order.setLgtId(inF.getLogistics().getId());
 			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 			order.setDeliverTime(sdf.format(new Date()));
-			order.setDeliverytype(Type.Delivery_ByUU_Code.value());
+//			order.setDeliverytype(Type.Delivery_ByUU_Code.value());
 			order.setJsonSdAddress(addr);
 			Set<OrderDetail> orderDetails = order.getOrderDetails();
 			for (OrderDetail orderDetail : orderDetails) {
@@ -351,12 +351,26 @@ public class InvoiceFOrderServiceImpl implements InvoiceFOrderService {
 		if(detno == 1) {
 			throw new IllegalOperatorException("当前订单的明细状态没有已出货的状态,不能转出货单");
 		}
+		invoice.setFare(order.getFare());
+		//设置配送规则和自提点信息
+		if (order.getJsonRule() != null){
+			invoice.setJsonRule(order.getJsonRule());
+		}
+		if (order.getJsonTakeSelf() != null){
+			invoice.setJsonTakeSelf(order.getJsonTakeSelf());
+		}
 		invoice.setTaxes(taxes);
 		invoice.setPrice(prices);
 		invoice.setNumber(number);
+		/**
+		 * 加入运费
+		 */
+		ensurePrice = DoubleArith.add(ensurePrice, invoice.getFare());
 		invoice.setEnsurePrice(ensurePrice);
 		invoice.setTobeshipped(userUU);
 		invoice.setInvoiceFOrderDetails(iDetails);
+		invoice.setInforRemark(order.getOrderRemark());
+		invoice.setDeliveryType(order.getDeliverytype());
 
 		if (invoice.getUasPurcid() != null) {
 			// 手动将平台状态改成202(要考虑一点,UAS和平台做的单据是否都可以这样做)

+ 60 - 30
src/main/java/com/uas/platform/b2c/logistics/service/impl/InvoiceFPurchaseServiceImpl.java

@@ -42,6 +42,7 @@ import org.springframework.data.domain.Page;
 import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.NumberUtils;
 import org.springframework.util.StringUtils;
 
 import javax.management.OperationsException;
@@ -118,6 +119,14 @@ public class InvoiceFPurchaseServiceImpl implements InvoiceFPurchaseService {
 		Long uu = SystemSession.getUser().getUserUU();
 		Date date = new Date();
 		InvoiceFPurchase inFpu = new InvoiceFPurchase(purchase);
+
+		//保存适用配送规则和自提点信息
+		if (purchase.getJsonRule() != null){
+			inFpu.setJsonRule(purchase.getJsonRule());
+		}
+		if (purchase.getJsonTakeSelf() != null){
+			inFpu.setJsonTakeSelf(purchase.getJsonTakeSelf());
+		}
 		// 生成出货单号
 		String invoiceid = createNumberService.generateVoucherId(EncodingRulesConstant.INVOICE_FROMPURCHASE,
 				"trade$invoice_fmpu", 8);
@@ -166,10 +175,14 @@ public class InvoiceFPurchaseServiceImpl implements InvoiceFPurchaseService {
 		inFpu.setTaxes(taxes);
 		price = NumberUtil.pricesScaleTwo(price);
 		inFpu.setPrice(price);
+		//添加运费
+		ensurePrice = NumberUtil.add(ensurePrice, inFpu.getFare());
 		ensurePrice = NumberUtil.pricesScaleTwo(ensurePrice);
 		inFpu.setEnsurePrice(ensurePrice);
 		inFpu.setNumber(number);
 		inFpu.setStatusToBeShipped(uu);
+		inFpu.setInfpuRemark(purchase.getPurchaseRemark());
+		inFpu.setSendType(purchase.getSendType());
 		inFpu.setInvoiceFPurchaseDetails(IpDetails);
 
 		inFpu = inFpuDao.save(inFpu);
@@ -247,9 +260,13 @@ public class InvoiceFPurchaseServiceImpl implements InvoiceFPurchaseService {
 		Long userUU = SystemSession.getUser().getUserUU();
 		InvoiceFPurchase invoiceFPurchase = inFpuDao.getOne(id);
 		Purchase purchase = purchaseDao.findOne(invoiceFPurchase.getPuid());
-		String deliveryType = sendInfo.getString("deliveryType");
-		
-		if(StringUtils.isEmpty(deliveryType)) {
+//		String deliveryType = sendInfo.getString("deliveryType");
+		Integer sendType = Integer.parseInt(sendInfo.getString("sendType"));
+
+//		if(StringUtils.isEmpty(deliveryType)) {
+//			return new ResultMap(CodeType.NO_INFO, "配送方式的信息为空,请重新操作");
+//		}
+		if (sendType == null){
 			return new ResultMap(CodeType.NO_INFO, "配送方式的信息为空,请重新操作");
 		}
 		
@@ -262,31 +279,37 @@ public class InvoiceFPurchaseServiceImpl implements InvoiceFPurchaseService {
 				&&purchase.getLaunchPuExApplyStatus().equals(AfterSaleStatus.FINISHED)) {
 			return new ResultMap(CodeType.NOT_PERMIT, "您的异常申请流程还不是已完成或已取消状态,不能做发货的动作!");
 		}
-		
-		if("logistics".equals(deliveryType)) {
-			JSONObject  logisjson= sendInfo.getJSONObject("logisticsInfo");
-			Logistics logistics = logisticsService.bornLogisticsByCompanyNameAndNum(logisjson.getString("companyName"), logisjson.getString("number"));
+		JSONObject  logisticsJson = sendInfo.getJSONObject("logisticsInfo");
+		if (logisticsJson != null){
+			Logistics logistics = logisticsService.bornLogisticsByCompanyNameAndNum(logisticsJson.getString("companyName"), logisticsJson.getString("number"));
 			invoiceFPurchase.setLogistics(logistics);
-
-		}else if("selfDelivery".equals(deliveryType)){
-			JSONObject  logisticsJson= sendInfo.getJSONObject("selfDeliveryPerson");
-			String name = logisticsJson.getString("name");
-			if(StringUtils.isEmpty(name)) {
-				return new ResultMap(CodeType.NO_INFO, "送货人信息为空,请重新操作");
-			}
-			String phone = logisticsJson.getString("phone");
-			if(StringUtils.isEmpty(phone)) {
-				return new ResultMap(CodeType.NO_INFO, "送货人电话信息为空,请重新操作");
-			}
-			invoiceFPurchase.setSelfDeliveryName(name);
-			invoiceFPurchase.setSelfDeliveryPhone(phone);
 		}
+//		if("logistics".equals(deliveryType)) {
+//			JSONObject  logisjson= sendInfo.getJSONObject("logisticsInfo");
+//			Logistics logistics = logisticsService.bornLogisticsByCompanyNameAndNum(logisjson.getString("companyName"), logisjson.getString("number"));
+//			invoiceFPurchase.setLogistics(logistics);
+//
+//		}else if("selfDelivery".equals(deliveryType)){
+//			JSONObject  logisticsJson= sendInfo.getJSONObject("selfDeliveryPerson");
+//			String name = logisticsJson.getString("name");
+//			if(StringUtils.isEmpty(name)) {
+//				return new ResultMap(CodeType.NO_INFO, "送货人信息为空,请重新操作");
+//			}
+//			String phone = logisticsJson.getString("phone");
+//			if(StringUtils.isEmpty(phone)) {
+//				return new ResultMap(CodeType.NO_INFO, "送货人电话信息为空,请重新操作");
+//			}
+//			invoiceFPurchase.setSelfDeliveryName(name);
+//			invoiceFPurchase.setSelfDeliveryPhone(phone);
+//		}
+
 		String jsonSdAddress = sendInfo.getString("jsonSdAddress");
 		if(StringUtils.isEmpty(jsonSdAddress)) {
 			return new ResultMap(CodeType.NO_INFO, "发货人的地址信息为空,请重新操作");
 		}
 		invoiceFPurchase.setJsonSdAddress(jsonSdAddress);
-		invoiceFPurchase.setDeliveryType(deliveryType);
+//		invoiceFPurchase.setDeliveryType(deliveryType);
+		invoiceFPurchase.setSendType(sendType);
 		
 		invoiceFPurchase.setStatusInBound(userUU);
 		Set<InvoiceFPurchaseDetail> invoiceFPurchaseDetails = invoiceFPurchase.getInvoiceFPurchaseDetails();
@@ -306,13 +329,17 @@ public class InvoiceFPurchaseServiceImpl implements InvoiceFPurchaseService {
 			}
 		}
 		purchase.setStatusInBound(userUU);
-		if("logistics".equals(inFpu.getDeliveryType())) {
+		if (inFpu.getLogistics() != null){
 			purchase.setLgtId(inFpu.getLogistics().getId());
-		}else {
-			purchase.setSelfDeliveryName(inFpu.getSelfDeliveryName());
-			purchase.setSelfDeliveryPhone(inFpu.getSelfDeliveryPhone());
 		}
-		purchase.setDeliveryType(inFpu.getDeliveryType());
+//		if("logistics".equals(inFpu.getDeliveryType())) {
+//			purchase.setLgtId(inFpu.getLogistics().getId());
+//		}else {
+//			purchase.setSelfDeliveryName(inFpu.getSelfDeliveryName());
+//			purchase.setSelfDeliveryPhone(inFpu.getSelfDeliveryPhone());
+//		}
+//		purchase.setDeliveryType(inFpu.getDeliveryType());
+
 		purchase.setJsonSdAddress(inFpu.getJsonSdAddress());
 		purchase.setSendName(SystemSession.getUser().getUserName());
 		purchase.setSenduu(SystemSession.getUser().getUserUU());
@@ -325,12 +352,15 @@ public class InvoiceFPurchaseServiceImpl implements InvoiceFPurchaseService {
 			if(order == null) {
 				return new ResultMap(CodeType.NOT_PERMIT, "您订单的信息有误,请重新提交");
 			}
-			if("logistics".equals(inFpu.getDeliveryType())) {
+			if (inFpu.getLogistics() != null){
 				order.setLgtId(inFpu.getLogistics().getId());
-			}else {
-				order.setSelfDeliveryName(inFpu.getSelfDeliveryName());
-				order.setSelfDeliveryPhone(inFpu.getSelfDeliveryPhone());
 			}
+//			if("logistics".equals(inFpu.getDeliveryType())) {
+//				order.setLgtId(inFpu.getLogistics().getId());
+//			}else {
+//				order.setSelfDeliveryName(inFpu.getSelfDeliveryName());
+//				order.setSelfDeliveryPhone(inFpu.getSelfDeliveryPhone());
+//			}
 			order.setJsonSdAddress(inFpu.getJsonSdAddress());
 			order.setStatusInBound(userUU);
 			for (OrderDetail detail : order.getOrderDetails()) {

+ 92 - 0
src/main/java/com/uas/platform/b2c/logistics/service/impl/LogisticsOldServiceImpl.java

@@ -1,5 +1,6 @@
 package com.uas.platform.b2c.logistics.service.impl;
 
+import com.uas.platform.b2c.core.config.SysConf;
 import com.uas.platform.b2c.logistics.model.Logistics;
 import com.uas.platform.b2c.logistics.model.LogisticsCompanyCode;
 import com.uas.platform.b2c.core.support.SystemSession;
@@ -11,6 +12,10 @@ import com.uas.platform.b2c.trade.deprecated.model.ConstantTrade;
 import com.uas.platform.b2c.logistics.model.InvoiceFPurchase;
 import com.uas.platform.b2c.trade.deprecated.model.ResponseLogistics;
 import com.uas.platform.b2c.logistics.service.LogisticsOldService;
+import com.uas.platform.b2c.trade.order.dao.OrderDao;
+import com.uas.platform.b2c.trade.order.dao.PurchaseDao;
+import com.uas.platform.b2c.trade.order.model.Order;
+import com.uas.platform.b2c.trade.order.model.Purchase;
 import com.uas.platform.b2c.trade.support.CodeType;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.core.exception.IllegalOperatorException;
@@ -32,6 +37,15 @@ public class LogisticsOldServiceImpl implements LogisticsOldService {
 	@Autowired
 	private InvoiceFPurchaseDao invoiceFPurchaseDao;
 
+	@Autowired
+	private PurchaseDao purchaseDao;
+
+	@Autowired
+	private OrderDao orderDao;
+
+	@Autowired
+	private SysConf sysConf;
+
 	/*
 	 * @Override public List<LogisticsCompanyCode> getAllCodes() { return
 	 * logisticsCompanyCodeDao.findAll(); } public List<String> getAllName(){
@@ -88,6 +102,84 @@ public class LogisticsOldServiceImpl implements LogisticsOldService {
 		return logisticsDao.findOne(id);
 	}
 
+	/**
+	 * 新增物流信息
+	 * @param inid
+	 * @param logistics
+	 * @return
+	 */
+	@Override
+	public ResultMap addLogistics(String inid, Logistics logistics) {
+		if(StringUtils.isEmpty(inid)) {
+			return new ResultMap(CodeType.NO_INFO, "您需要更新的出货单号为空,请重新操作");
+		}
+		InvoiceFPurchase fPurchase = invoiceFPurchaseDao.findByInvoiceid(inid);
+		if(fPurchase == null) {
+			return new ResultMap(CodeType.NOT_EXiST, "找不到对应的出货单号为空,请重新操作");
+		}
+		if(SystemSession.getUser().getEnterprise().getUu().longValue() != fPurchase.getSellerenuu().longValue()) {
+			return new ResultMap(CodeType.NOT_PERMIT, "当前登录的公司不能操作此订单");
+		}
+		if(StringUtils.isEmpty(logistics.getCompanyName())) {
+			return new ResultMap(CodeType.NO_INFO, "物流公司信息为空,请重新操作");
+		}
+		if(StringUtils.isEmpty(logistics.getNumber())) {
+			return new ResultMap(CodeType.NO_INFO, "物流单号信息为空,请重新操作");
+		}
+		if (logistics != null){
+			LogisticsCompanyCode logisticsCompanyCode = logisticsCompanyCodeDao.findByName(logistics.getCompanyName());
+			if (logisticsCompanyCode != null) {
+				logistics.setCompanyId(logisticsCompanyCode.getId());
+				logistics.setCompanyCode(logisticsCompanyCode.getCode());
+			}
+			Logistics logistics1 = logisticsDao.save(logistics);
+			fPurchase.setLogistics(logistics1);
+		}
+		Purchase purchase = purchaseDao.findOne(fPurchase.getPuid());
+		if (fPurchase.getLogistics() != null){
+			purchase.setLgtId(fPurchase.getLogistics().getId());
+			purchaseDao.save(purchase);
+		}
+		if(!purchase.getStoreid().equals(sysConf.getStoreid())) {
+			Order order = orderDao.findByOrderid(purchase.getOrderid());
+			if (order == null) {
+				return new ResultMap(CodeType.NOT_PERMIT, "您订单的信息有误,请重新提交");
+			}
+			if (fPurchase.getLogistics() != null) {
+				order.setLgtId(fPurchase.getLogistics().getId());
+			}
+			orderDao.save(order);
+		}
+		invoiceFPurchaseDao.save(fPurchase);
+		return ResultMap.success(null);
+	}
+
+	@Override
+	public ResultMap clearLogistics(String inid) {
+		if(StringUtils.isEmpty(inid)) {
+			return new ResultMap(CodeType.NO_INFO, "您需要更新的出货单号为空,请重新操作");
+		}
+		InvoiceFPurchase fPurchase = invoiceFPurchaseDao.findByInvoiceid(inid);
+		if (fPurchase.getLogistics() == null){
+			return new ResultMap(CodeType.NO_INFO, "您需要更新的快递信息为空,请重新操作");
+		}
+		fPurchase.setLogistics(null);
+		Purchase purchase = purchaseDao.findOne(fPurchase.getPuid());
+		if (purchase.getLgtId() != null){
+			purchase.setLgtId(null);
+			purchaseDao.save(purchase);
+		}
+		//如果是自营的,也需要将订单的快递为空
+		if(!purchase.getStoreid().equals(sysConf.getStoreid())) {
+			Order order = orderDao.findByOrderid(purchase.getOrderid());
+			if (order.getLgtId() != null){
+				order.setLgtId(null);
+			}
+			orderDao.save(order);
+		}
+		invoiceFPurchaseDao.save(fPurchase);
+		return ResultMap.success(null);
+	}
 
 	/**
 	 * 更新物流信息

+ 2 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/controller/ProductController.java

@@ -31,6 +31,8 @@ import java.util.Map;
  *
  * @author wangyc on 2017/5/26.
  * @version 2017年8月3日11:34:58 yuj 增加注释
+ * @version 2017年8月21日14:40:15 产品管理开发第三版
+ * @version 2017年8月21日15:12:50 test
  */
 @RestController
 @RequestMapping("/trade/products")

+ 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());

+ 14 - 6
src/main/java/com/uas/platform/b2c/prod/product/brand/api/BrandController.java

@@ -12,10 +12,7 @@ import com.uas.platform.core.model.PageParams;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
@@ -117,12 +114,13 @@ public class BrandController {
 
 	/**
 	 * 根据品牌英文名获取品牌信息
-	 * 
+	 *
 	 * @param nameEn 品牌英文名
 	 * @return 品牌信息
 	 */
 	@RequestMapping(value = "/nameEn/{nameEn}", method = RequestMethod.GET)
-	public List<Brand> getByNameEn(@PathVariable("nameEn") String nameEn) {
+	public List<Brand> getByNameEn(@PathVariable("nameEn") String nameEn) throws UnsupportedEncodingException {
+		nameEn = URLDecoder.decode(nameEn, "UTF-8");
 		return brandService.getByNameEn(nameEn);
 	}
 
@@ -177,4 +175,14 @@ public class BrandController {
     public List<Brand> getHotBrands(@PathVariable("num") Integer num) {
 		return brandService.getHotBrands(num);
     }
+
+	/**
+	 * 根据批次号获取品牌信息
+	 * @param batchIds
+	 * @return 品牌信息
+	 */
+	@RequestMapping(value = "/batchId", method = RequestMethod.POST, produces = "application/json")
+	public List<BrandMostSimpleInfo> getBatchBrands(@RequestBody List<Long> batchIds) {
+		return brandService.getBatchBrandMostSimpleInfs(batchIds);
+	}
 }

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/brand/controller/BrandController.java

@@ -19,7 +19,7 @@ import java.util.Map;
  * 品牌相关接口
  */
 @RestController
-@RequestMapping("/product/brand")
+@RequestMapping("/produce/brand")
 public class BrandController {
 
 	@Autowired

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/brand/controller/BrandSubmitController.java

@@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.*;
  * @version 2017年8月2日17:01:38 wangyc 完善注释
  */
 @RestController
-@RequestMapping("/product/brandSubmit")
+@RequestMapping("/produce/brandSubmit")
 public class BrandSubmitController {
 
 	@Autowired

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/brand/controller/BrandVersionController.java

@@ -19,7 +19,7 @@ import java.util.List;
  * @version 2017年8月2日17:01:38 wangyc 完善注释
  */
 @RestController
-@RequestMapping("/product/brandVersion")
+@RequestMapping("/produce/brandVersion")
 public class BrandVersionController {
 
 	@Autowired

+ 8 - 0
src/main/java/com/uas/platform/b2c/prod/product/brand/dao/BrandMostSimpleInfoDao.java

@@ -24,4 +24,12 @@ public interface BrandMostSimpleInfoDao extends JpaSpecificationExecutor<BrandMo
      */
     @Query(nativeQuery = true, value = "select * from product$brand where br_inital in :initals")
     public List<BrandMostSimpleInfo> findInInitals(@Param("initals") String[] initals);
+
+    /**
+     * 根据批次号获取品牌信息
+     * @param batchIds id批次号
+     * @return
+     */
+    @Query(nativeQuery = true, value = "select * from product$brand where br_id in :batchIds")
+    public List<BrandMostSimpleInfo> findBatchBrands(@Param("batchIds") List<Long> batchIds);
 }

+ 7 - 0
src/main/java/com/uas/platform/b2c/prod/product/brand/service/BrandService.java

@@ -141,4 +141,11 @@ public interface BrandService {
 	 * @return 新增品牌数量统计
 	 */
 	List<Map<String, Object>> findCountIncreaseBrandByMonth();
+
+	/**
+	 * 根据批次号获取品牌信息
+	 * @param batchIds
+	 * @return 品牌信息
+	 */
+	public List<BrandMostSimpleInfo> getBatchBrandMostSimpleInfs(List<Long> batchIds);
 }

+ 8 - 0
src/main/java/com/uas/platform/b2c/prod/product/brand/service/impl/BrandServiceImpl.java

@@ -323,4 +323,12 @@ public class BrandServiceImpl implements BrandService {
 
 		return "success";
 	}
+
+	@Override
+	public List<BrandMostSimpleInfo> getBatchBrandMostSimpleInfs(List<Long> batchIds) {
+		if (batchIds.size() == 0) {
+			return brandMostSimpleInfoDao.findAll();
+		}
+		return brandMostSimpleInfoDao.findBatchBrands(batchIds);
+	}
 }

+ 4 - 4
src/main/java/com/uas/platform/b2c/prod/product/brand/service/impl/BrandSubmitServiceImpl.java

@@ -77,8 +77,8 @@ public class BrandSubmitServiceImpl implements BrandSubmitService {
 			// 如果是新增检查品牌是否重名,重名设置version为-1,返回前台判断是否更新已存在品牌
 			List<Brand> existBrandCn = new ArrayList<Brand>();
 			if (brandSubmit.getNameCn() != null)
-				existBrandCn = brandDao.findByNameCn(brandSubmit.getNameCn());
-			List<Brand> existBrandEn = brandDao.findByNameEn(brandSubmit.getNameEn());
+				existBrandCn = brandDao.findByUpperNameCn(brandSubmit.getNameCn());
+			List<Brand> existBrandEn = brandDao.findByUpperNameEn(brandSubmit.getNameEn());
 			if (CollectionUtils.isNotEmpty(existBrandCn)) {
 				brand.setVersion((short) -1);
 				return brand;
@@ -96,8 +96,8 @@ public class BrandSubmitServiceImpl implements BrandSubmitService {
 			Brand existBrand = brandDao.findByUuid(brandSubmit.getUuid());
 			// 如果uuid有误,则将申请uuid设为null,视为新增品牌申请
 			if (existBrand == null) {
-				List<Brand> existBrandCn = brandDao.findByNameCn(brandSubmit.getNameCn());
-				List<Brand> existBrandEn = brandDao.findByNameEn(brandSubmit.getNameEn());
+				List<Brand> existBrandCn = brandDao.findByUpperNameCn(brandSubmit.getNameCn());
+				List<Brand> existBrandEn = brandDao.findByUpperNameEn(brandSubmit.getNameEn());
 				if (CollectionUtils.isNotEmpty(existBrandCn)) {
 					brand.setVersion((short) -1);
 					return brand;

+ 9 - 0
src/main/java/com/uas/platform/b2c/prod/product/component/api/ComponentController.java

@@ -267,4 +267,13 @@ public class ComponentController {
 		return goodsService.pageGoodsByKeyword(pageInfo, original, keyword);
 	}
 
+	/**
+	 * 根据批次号获取器件信息
+	 * @param batchIds
+	 * @return 器件信息
+	 */
+	@RequestMapping(value = "/batchId", method = RequestMethod.POST, produces = "application/json")
+	public List<ComponentInfo> getBatchBrands(@RequestBody List<Long> batchIds) {
+		return componentService.getBatchComponents(batchIds);
+	}
 }

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/component/controller/ComponentController.java

@@ -24,7 +24,7 @@ import java.util.Map;
  * 器件接口
  */
 @RestController
-@RequestMapping("/product/component")
+@RequestMapping("/produce/component")
 public class ComponentController {
 
 	@Autowired

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/component/controller/ComponentCrawlTaskController.java

@@ -17,7 +17,7 @@ import javax.transaction.Transactional;
  * 器件爬取任务接口
  */
 @RestController
-@RequestMapping("/product/crawlTask")
+@RequestMapping("/produce/crawlTask")
 public class ComponentCrawlTaskController {
 
 	@Autowired

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/component/controller/ComponentSubmitController.java

@@ -36,7 +36,7 @@ import java.util.List;
  * @version 2017年8月2日17:41:00 wangyc 完善注释
  */
 @RestController
-@RequestMapping("/product/componentSubmit")
+@RequestMapping("/produce/componentSubmit")
 public class ComponentSubmitController {
 
 	@Autowired

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/component/controller/ComponentVersionController.java

@@ -18,7 +18,7 @@ import java.util.List;
  * @version 2017年8月2日17:49:02 wangyc 创建
  */
 @RestController
-@RequestMapping("/product/componentVersion")
+@RequestMapping("/produce/componentVersion")
 public class ComponentVersionController {
 
 	@Autowired

+ 8 - 0
src/main/java/com/uas/platform/b2c/prod/product/component/dao/ComponentInfoDao.java

@@ -80,4 +80,12 @@ public interface ComponentInfoDao extends JpaSpecificationExecutor<ComponentInfo
 	 * @return 库存数量大于指定值的一页器件
 	 */
 	Page<ComponentInfo> findByImgIsNotNull(Pageable pageable);
+
+	/**
+	 * 根据批次号获取器件信息
+	 * @param batchids id批次号
+	 * @return
+	 */
+	@Query(nativeQuery = true, value = "select * from product$component where cmp_id in :batchids")
+	public List<ComponentInfo> findByBatchids(@Param("batchids") List<Long> batchids);
 }

+ 7 - 0
src/main/java/com/uas/platform/b2c/prod/product/component/service/ComponentService.java

@@ -202,4 +202,11 @@ public interface ComponentService {
 	 * @return 新增器件数量统计
 	 */
 	List<Map<String, Object>> findCountIncreaseComponentByMonth();
+
+	/**
+	 * 根据批次号获取器件信息
+	 * @param batchIds
+	 * @return 器件信息
+	 */
+	List<ComponentInfo> getBatchComponents(List<Long> batchIds);
 }

+ 6 - 0
src/main/java/com/uas/platform/b2c/prod/product/component/service/impl/ComponentServiceImpl.java

@@ -536,5 +536,11 @@ public class ComponentServiceImpl implements ComponentService {
 		return map;
 	}
 
+	public List<ComponentInfo> getBatchComponents(List<Long> batchIds) {
+		if (batchIds.size() == 0) {
+			return componentInfoDao.findAll();
+		}
+		return componentInfoDao.findByBatchids(batchIds);
+	}
 
 }

+ 10 - 0
src/main/java/com/uas/platform/b2c/prod/product/kind/api/KindController.java

@@ -195,4 +195,14 @@ public class KindController {
 		name = URLDecoder.decode(name, "utf-8");
 		return  kindService.getKindInfoByName(name);
 	}
+
+	/**
+	 * 根据批次号获取类目信息
+	 * @param batchIds
+	 * @return 类目信息
+	 */
+	@RequestMapping(value = "/batchId", method = RequestMethod.POST, produces = "application/json")
+	public List<Kind> getBatchBrands(@RequestBody List<Long> batchIds) {
+		return kindService.getBatchKinds(batchIds);
+	}
 }

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/kind/controller/KindAdviceController.java

@@ -22,7 +22,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
  * @version  2015年12月21日上午9:54:55 suntg 创建
  */
 @Controller
-@RequestMapping("/product/kindAdvice")
+@RequestMapping("/produce/kindAdvice")
 public class KindAdviceController {
 
 	@Autowired

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/kind/controller/KindContrastController.java

@@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
  * @version 2017年8月2日19:12:07 wangyc 创建
  */
 @RestController
-@RequestMapping("/product/kindContrast")
+@RequestMapping("/produce/kindContrast")
 public class KindContrastController {
 
 	@Autowired

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/kind/controller/KindController.java

@@ -25,7 +25,7 @@ import java.util.List;
  * @version 2017年8月2日19:17:14 wangyc 创建
  */
 @RestController("product.KindController")
-@RequestMapping("/product/kind")
+@RequestMapping("/produce/kind")
 public class KindController {
 	@Autowired
 	private KindService kindService;

+ 8 - 0
src/main/java/com/uas/platform/b2c/prod/product/kind/dao/KindDao.java

@@ -54,4 +54,12 @@ public interface KindDao extends JpaSpecificationExecutor<Kind>, JpaRepository<K
 	 * @return
 	 */
 	public List<Kind> findByNameCn(String nameCn);
+
+	/**
+	* 根据批次号获取类目信息
+	* @param batchIds id批次号
+	* @return
+	*/
+	@Query(nativeQuery = true, value = "select * from product$kind where ki_id in :batchIds")
+	public List<Kind> findByBatchIds(@Param("batchIds") List<Long> batchIds);
 }

+ 7 - 0
src/main/java/com/uas/platform/b2c/prod/product/kind/service/KindService.java

@@ -308,4 +308,11 @@ public interface KindService {
 	 * @return 类目信息
 	 */
 	Kind getFirstKind(Long kindId);
+
+	/**
+	 * 根据批次号获取类目信息
+	 * @param batchIds
+	 * @return 类目信息
+	 */
+	List<Kind> getBatchKinds(List<Long> batchIds);
 }

+ 8 - 0
src/main/java/com/uas/platform/b2c/prod/product/kind/service/impl/KindServiceImpl.java

@@ -1201,4 +1201,12 @@ public class KindServiceImpl implements KindService {
 	Kind getParentByChildId(Kind child) {
 		return kindDao.findOne(child.getParentid());
 	}
+
+
+	public List<Kind> getBatchKinds(List<Long> batchIds) {
+		if (batchIds.size() == 0) {
+			return kindDao.findAll();
+		}
+		return kindDao.findByBatchIds(batchIds);
+	}
 }

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/property/controller/PropertyController.java

@@ -20,7 +20,7 @@ import java.util.List;
  * @version 2017年8月2日19:39:19 wangyc 完善注释
  */
 @Controller
-@RequestMapping("/product/property")
+@RequestMapping("/produce/property")
 public class PropertyController {
 
 	@Autowired

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/property/controller/PropertySubmitController.java

@@ -18,7 +18,7 @@ import java.util.List;
  * @version 2017年8月2日19:40:12 wangyc 完善注释
  */
 @RestController
-@RequestMapping("/product/propertySubmit")
+@RequestMapping("/produce/propertySubmit")
 public class PropertySubmitController {
 
 	@Autowired

+ 14 - 0
src/main/java/com/uas/platform/b2c/trade/order/controller/PurchaseController.java

@@ -9,12 +9,14 @@ import com.uas.platform.b2c.core.support.view.JxlsExcelView;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
 import com.uas.platform.b2c.core.utils.StringUtilB2C;
 import com.uas.platform.b2c.logistics.model.InvoiceFPurchase;
+import com.uas.platform.b2c.logistics.model.Logistics;
 import com.uas.platform.b2c.prod.store.service.StoreInService;
 import com.uas.platform.b2c.trade.order.model.Order;
 import com.uas.platform.b2c.trade.order.model.Purchase;
 import com.uas.platform.b2c.trade.order.model.PurchaseModifyingHistory;
 import com.uas.platform.b2c.trade.order.service.PurchaseDetailService;
 import com.uas.platform.b2c.trade.order.service.PurchaseService;
+import com.uas.platform.b2c.trade.presale.model.ValidTime;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.PageInfo;
@@ -597,4 +599,16 @@ public class PurchaseController {
 	public String findOrderIdByPuId(@PathVariable("purchaseId") String purchaseId){
 		return purchaseService.findOrderIdByPuId(purchaseId);
 	}
+
+//	@RequestMapping(value = "/logistics")
+//	public Logistics findOneLogistics(){
+//		return null;
+//	}
+//
+//	@RequestMapping(value = "/modifyLogistics", method = RequestMethod.PUT)
+//	public Logistics updateLogistics(Long id){
+//		System.out.println("id=" + id);
+//		return null;
+//	}
+
 }

+ 171 - 101
src/main/java/com/uas/platform/b2c/trade/order/model/Order.java

@@ -140,6 +140,36 @@ public class Order extends Document implements Serializable {
 	@Column(name = "or_deliverytype")
 	private Integer deliverytype;
 
+	/**
+	 * 运费
+	 */
+	@Column(name = "or_fare")
+	private Double fare = 0d;
+
+	/**
+	 * 使用的配送规则
+	 */
+	@Column(name = "or_rule", length = 2000)
+	private String jsonRule;
+
+	/**
+	 * 拆单之前的配送规则列表
+	 */
+	@Column(name = "or_rules", length = 4000)
+	private String jsonMoreRule;
+
+	/**
+	 * 自提点信息
+	 */
+	@Column(name = "or_take_self", length = 2000)
+	private String jsonTakeSelf;
+
+	/**
+	 * 拆单之前的自提点信息
+	 */
+	@Column(name = "or_take_selfs", length = 4000)
+	private String jsonMoreTake;
+
 	/**
 	 * 收货地址 这里使用json字符串的形式将收货地址整个存起来
 	 */
@@ -258,7 +288,7 @@ public class Order extends Document implements Serializable {
 
 	/**
 	 * 订单状态(1->2->3->4->5->6->7->8->9)
-	 * 
+	 *
 	 * @Tip 必须严格按照顺序流转 1、TOBECONFIRMED(501, "待确认"), 2、TOBEPAID(503, "待付款"),
 	 *      3、PAID(505, "已付款"), 4、TOBESHIPPED(406, "待出货"), 5、SHIPPINGIN(403,
 	 *      "出货中"), 6、SHIPPED(407, "已出货"), 7、SENDING(408, "发货中"), 8、INBOUND(404,
@@ -273,7 +303,7 @@ public class Order extends Document implements Serializable {
 	 */
 	@Column(name = "or_paytime")
 	private Date paytime;
-	
+
 	/**
 	 * 失效时间
 	 */
@@ -294,7 +324,7 @@ public class Order extends Document implements Serializable {
 
 	/**
 	 * 银行转账信息id
-	 * 
+	 *
 	 * @Tip 目前只有银行转账信息,
 	 */
 	@Column(name = "or_banktf")
@@ -329,13 +359,13 @@ public class Order extends Document implements Serializable {
 	 */
 	@Column(name = "or_import_extra_charges")
 	private Double importExtraCharges;
-	
+
 	/**
-	 * 金额合计
+	 * 金额合计,店铺商品明细金额总计
 	 */
 	@Column(name = "or_price")
 	private Double price;
-	
+
 	/**
 	 * 币别
 	 */
@@ -355,13 +385,13 @@ public class Order extends Document implements Serializable {
 	private String inid;
 
 	/**
-	 * 确认金额(考虑商城打折的情况)
+	 * 确认金额(考虑商城打折的情况)包括运费
 	 */
 	@Column(name = "ensure_price")
 	private Double ensurePrice;
 
 	/**
-	 * 实际成交金额(考虑退货)
+	 * 实际成交金额(考虑退货)包括运费
 	 */
 	@Column(name = "transation_price")
 	private Double transationPrice;
@@ -383,31 +413,31 @@ public class Order extends Document implements Serializable {
 	 */
 	@Column(name = "or_qty")
 	private Double qty;
-	
+
 	/**
 	 * 批次数量
 	 */
 	@Column(name = "or_batch_qty")
 	private Integer batchQty;
-	
+
 	/**
 	 * 型号数量
 	 */
 	@Column(name = "or_cmp_qty")
 	private Integer cmpQty;
-	
+
 	/**
 	 * 客户收到货的时间
 	 */
 	@Column(name = "or_recipttime")
 	private Date reciptTime;
-	
+
 	/**
 	 * 二次收货时间
 	 */
 	@Column(name = "or_secondretime")
 	private Date secondReTime;
-	
+
 	/**
 	 * 发货时间,如果有两次 时间戳,时间戳
 	 */
@@ -445,7 +475,7 @@ public class Order extends Document implements Serializable {
 	@OneToMany(mappedBy = "order", cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
 	@OrderBy("detno")
 	private Set<OrderDetail> orderDetails;
-	
+
 	/**
 	 * 记录订单的客服、退款、退货、退换货服务状态
 	 * @tip 第一个数字位,代表客服状态,1:申请客服,2:客服确认中,3:客服有反馈
@@ -457,84 +487,84 @@ public class Order extends Document implements Serializable {
 	private String serviceStatus = "1111";
 
 	/**********************异常处理 start**********************/
-    /**
-     * 发起的售后申请状态
-     */
-    @Enumerated(EnumType.STRING)
-    @Column(name = "launch_or_ex_apply_status")
-    private AfterSaleStatus launchOrExApplyStatus;
+	/**
+	 * 发起的售后申请状态
+	 */
+	@Enumerated(EnumType.STRING)
+	@Column(name = "launch_or_ex_apply_status")
+	private AfterSaleStatus launchOrExApplyStatus;
 
-    /**
-     * 发起的申请单申请号
-     */
-    @Column(name = "launch_or_ex_apply_id")
-    private String launchOrExApplyId;
+	/**
+	 * 发起的申请单申请号
+	 */
+	@Column(name = "launch_or_ex_apply_id")
+	private String launchOrExApplyId;
 
-    /**
-     * 接收的供应商的多张申请单信息
-     * 格式: [{puExApplyId : "PAP2016111100000002", status : "SUP_TO_MALL"}, {puExApplyId : "PAP2016111100000003", status : "FINISHED"}]
-     */
-    @Column(name = "or_json_pu_ex_info")
-    private String puExInfoJson;
+	/**
+	 * 接收的供应商的多张申请单信息
+	 * 格式: [{puExApplyId : "PAP2016111100000002", status : "SUP_TO_MALL"}, {puExApplyId : "PAP2016111100000003", status : "FINISHED"}]
+	 */
+	@Column(name = "or_json_pu_ex_info")
+	private String puExInfoJson;
 
-    /**
-     * jsonPuExInfo的map形式,便于在程序中操作
+	/**
+	 * jsonPuExInfo的map形式,便于在程序中操作
 	 * key:采购异常申请单号
 	 * value:异常申请状态
-     */
-    @Transient
-    private Map<String, AfterSaleStatus> puExInfoMap;
-    
-    /**
-     * 退货单单号
-     */
-    @Column(name = "or_returnid")
-    private String returnId;
-    
-    /**
-     * 退货单的状态
-     */
-    @Column(name = "or_returnstatus")
-    private Integer returnStatus;
+	 */
+	@Transient
+	private Map<String, AfterSaleStatus> puExInfoMap;
 
-    /**
-     * 换货单号
-     */
-    @Column(name = "or_changeid")
-    private String changeId;
-    
-    /**
-     * 换货单的状态
-     */
-    @Column(name = "or_changestatus")
-    private Integer changeStatus;
+	/**
+	 * 退货单单号
+	 */
+	@Column(name = "or_returnid")
+	private String returnId;
 
-    /**
-     * 退款单的状态
-     */
-    @Column(name = "or_refundtatus")
-    private Integer refundStatus;
-    
-    /**
-     * 退款单号
-     */
-    @Column(name = "or_refund_id")
-    private String refundId;
+	/**
+	 * 退货单的状态
+	 */
+	@Column(name = "or_returnstatus")
+	private Integer returnStatus;
+
+	/**
+	 * 换货单号
+	 */
+	@Column(name = "or_changeid")
+	private String changeId;
 
-    /************ 异常处理 end ************/
+	/**
+	 * 换货单的状态
+	 */
+	@Column(name = "or_changestatus")
+	private Integer changeStatus;
 
-    /**
+	/**
+	 * 退款单的状态
+	 */
+	@Column(name = "or_refundtatus")
+	private Integer refundStatus;
+
+	/**
+	 * 退款单号
+	 */
+	@Column(name = "or_refund_id")
+	private String refundId;
+
+	/************ 异常处理 end ************/
+
+	/**
 	 * 开发票的快递公司
 	 */
 	@Column(name = "or_bill_logistic_company")
 	private String drawBillLogisComp;
-	
+
 	/**
 	 * 开发票的快递单号
 	 */
 	@Column(name = "or_bill_logistic_num")
 	private String drawBillLogisNum;
-	
+
 	/**
 	 * 开发票的时间
 	 */
@@ -736,8 +766,8 @@ public class Order extends Document implements Serializable {
 	 * @return the refund id
 	 */
 	public String getRefundId() {
-        return refundId;
-    }
+		return refundId;
+	}
 
 	/**
 	 * Sets refund id.
@@ -745,8 +775,8 @@ public class Order extends Document implements Serializable {
 	 * @param refundId the refund id
 	 */
 	public void setRefundId(String refundId) {
-        this.refundId = refundId;
-    }
+		this.refundId = refundId;
+	}
 
 	/**
 	 * Gets buyername.
@@ -972,8 +1002,8 @@ public class Order extends Document implements Serializable {
 	 * @return the boolean
 	 */
 	public boolean isBuyNow() {
-        return buyNow;
-    }
+		return buyNow;
+	}
 
 	/**
 	 * Sets buy now.
@@ -981,8 +1011,8 @@ public class Order extends Document implements Serializable {
 	 * @param buyNow the buy now
 	 */
 	public void setBuyNow(boolean buyNow) {
-        this.buyNow = buyNow;
-    }
+		this.buyNow = buyNow;
+	}
 
 	/**
 	 * Gets invoicetype.
@@ -1731,6 +1761,14 @@ public class Order extends Document implements Serializable {
 		this.vatBillStatus = vatBillStatus;
 	}
 
+	public String getJsonRule() {
+		return jsonRule;
+	}
+
+	public void setJsonRule(String jsonRule) {
+		this.jsonRule = jsonRule;
+	}
+
 	/**
 	 * Gets audit pay fail reason.
 	 *
@@ -2303,7 +2341,7 @@ public class Order extends Document implements Serializable {
 			b2cOrDetail.setNumber(details.getNumber());
 			b2cOrDetail.setBatchCode(details.getBatchCode());
 			b2cOrDetail.setPrice(details.getPrice());
-			b2cOrDetail.setTax(details.getTax()); 
+			b2cOrDetail.setTax(details.getTax());
 			b2cOrDetail.setTaxes(details.getTaxes());
 			b2cOrDetail.setUnitprice(details.getTaxUnitprice());
 			b2cOrDetails.add(b2cOrDetail);
@@ -2364,7 +2402,7 @@ public class Order extends Document implements Serializable {
 		this.buyername = user.getUserName();
 		this.buyerTel = user.getUserTel();
 		this.setStatusToBeConfirmed(user.getUserUU());
-        buyNow = false; // 默认不是立即购买,是则手动设置
+		buyNow = false; // 默认不是立即购买,是则手动设置
 	}
 
 	/**
@@ -2411,8 +2449,8 @@ public class Order extends Document implements Serializable {
 	 * @return the launch or ex apply status
 	 */
 	public AfterSaleStatus getLaunchOrExApplyStatus() {
-        return launchOrExApplyStatus;
-    }
+		return launchOrExApplyStatus;
+	}
 
 	/**
 	 * Sets launch or ex apply status.
@@ -2420,8 +2458,8 @@ public class Order extends Document implements Serializable {
 	 * @param launchOrExApplyStatus the launch or ex apply status
 	 */
 	public void setLaunchOrExApplyStatus(AfterSaleStatus launchOrExApplyStatus) {
-        this.launchOrExApplyStatus = launchOrExApplyStatus;
-    }
+		this.launchOrExApplyStatus = launchOrExApplyStatus;
+	}
 
 	/**
 	 * Gets orderids.
@@ -2509,8 +2547,8 @@ public class Order extends Document implements Serializable {
 	 * @return the launch or ex apply id
 	 */
 	public String getLaunchOrExApplyId() {
-        return launchOrExApplyId;
-    }
+		return launchOrExApplyId;
+	}
 
 	/**
 	 * Sets launch or ex apply id.
@@ -2518,8 +2556,8 @@ public class Order extends Document implements Serializable {
 	 * @param launchOrExApplyId the launch or ex apply id
 	 */
 	public void setLaunchOrExApplyId(String launchOrExApplyId) {
-        this.launchOrExApplyId = launchOrExApplyId;
-    }
+		this.launchOrExApplyId = launchOrExApplyId;
+	}
 
 	/**
 	 * Gets pu ex info json.
@@ -2527,8 +2565,8 @@ public class Order extends Document implements Serializable {
 	 * @return the pu ex info json
 	 */
 	public String getPuExInfoJson() {
-        return puExInfoJson;
-    }
+		return puExInfoJson;
+	}
 
 	/**
 	 * Sets pu ex info json.
@@ -2536,8 +2574,8 @@ public class Order extends Document implements Serializable {
 	 * @param puExInfoJson the pu ex info json
 	 */
 	public void setPuExInfoJson(String puExInfoJson) {
-        this.puExInfoJson = puExInfoJson;
-    }
+		this.puExInfoJson = puExInfoJson;
+	}
 
 	/**
 	 * Gets used.
@@ -2563,11 +2601,11 @@ public class Order extends Document implements Serializable {
 	 * @return pu ex info map
 	 */
 	@JSONField(serialize = false)
-    @JsonIgnore
-    public Map<String, AfterSaleStatus> getPuExInfoMap() {
-        if(CollectionUtils.isEmpty(puExInfoMap) && StringUtils.hasText( puExInfoJson)) {
-            puExInfoMap = ExceptionUtil.puExInfoJsonToMap(puExInfoJson);
-        }
+	@JsonIgnore
+	public Map<String, AfterSaleStatus> getPuExInfoMap() {
+		if(CollectionUtils.isEmpty(puExInfoMap) && StringUtils.hasText( puExInfoJson)) {
+			puExInfoMap = ExceptionUtil.puExInfoJsonToMap(puExInfoJson);
+		}
 		return puExInfoMap;
 	}
 
@@ -2717,4 +2755,36 @@ public class Order extends Document implements Serializable {
 	public void setDissociative(Integer dissociative) {
 		this.dissociative = dissociative;
 	}
+
+	public String getJsonMoreRule() {
+		return jsonMoreRule;
+	}
+
+	public void setJsonMoreRule(String jsonMoreRule) {
+		this.jsonMoreRule = jsonMoreRule;
+	}
+
+	public Double getFare() {
+		return fare;
+	}
+
+	public void setFare(Double fare) {
+		this.fare = fare;
+	}
+
+	public String getJsonTakeSelf() {
+		return jsonTakeSelf;
+	}
+
+	public void setJsonTakeSelf(String jsonTakeSelf) {
+		this.jsonTakeSelf = jsonTakeSelf;
+	}
+
+	public String getJsonMoreTake() {
+		return jsonMoreTake;
+	}
+
+	public void setJsonMoreTake(String jsonMoreTake) {
+		this.jsonMoreTake = jsonMoreTake;
+	}
 }

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

@@ -442,6 +442,12 @@ public class OrderDetail extends Document implements Serializable{
 	@Column(name = "detail_remark", length = 4000)
 	private String remark;
 
+	/**
+	 * 物料编号
+	 */
+	@Column(name = "detail_go_number")
+	private String goodsnumber;
+
 	/*******************************
 	 * 交货周期
 	 *******************************/
@@ -848,6 +854,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) {
@@ -1376,6 +1385,14 @@ public class OrderDetail extends Document implements Serializable{
 		return this;
 	}
 
+	public String getGoodsnumber() {
+		return goodsnumber;
+	}
+
+	public void setGoodsnumber(String goodsnumber) {
+		this.goodsnumber = goodsnumber;
+	}
+
 	/****************************************************
 	 * others
 	 * @param uu the uu

+ 57 - 1
src/main/java/com/uas/platform/b2c/trade/order/model/Purchase.java

@@ -452,14 +452,38 @@ public class Purchase extends Document implements Serializable {
 	/**
 	 * 交易备注
 	 */
-	@Column(name = "pu_remark")
+	@Column(name = "pu_remark", length = 4000)
 	private String purchaseRemark;
 
+	/**
+	 * 配送类型 --第三方配送 1301,卖家配送 1302,上门自提1303
+	 */
+	@Column(name = "pu_send_type")
+	private Integer sendType;
+
 	/**
 	 * 自己送货还是第三方物流送货
 	 */
 	@Column(name = "pu_deliverytype")
 	private String deliveryType;
+
+	/**
+	 * 使用的配送规则
+	 */
+	@Column(name = "pu_rule", length = 2000)
+	private String jsonRule;
+
+	/**
+	 * 自提点信息
+	 */
+	@Column(name = "pu_take_self", length = 2000)
+	private String jsonTakeSelf;
+
+	/**
+	 * 运费
+	 */
+	@Column(name = "pu_fare")
+	private Double fare;
 	
 	/*
 	 * 自己送货的送货人
@@ -573,6 +597,14 @@ public class Purchase extends Document implements Serializable {
 		this.statushistory = addStatusHistory(statushistory, uu, this.status);
 	}
 
+	public Integer getSendType() {
+		return sendType;
+	}
+
+	public void setSendType(Integer sendType) {
+		this.sendType = sendType;
+	}
+
 	/**
 	 * Sets status to be shipped.
 	 *
@@ -1512,6 +1544,14 @@ public class Purchase extends Document implements Serializable {
 		this.ensurePrice = ensurePrice;
 	}
 
+	public Double getFare() {
+		return fare;
+	}
+
+	public void setFare(Double fare) {
+		this.fare = fare;
+	}
+
 	/**
 	 * Gets transation price.
 	 *
@@ -1714,6 +1754,14 @@ public class Purchase extends Document implements Serializable {
 		return this;
 	}
 
+	public String getJsonRule() {
+		return jsonRule;
+	}
+
+	public void setJsonRule(String jsonRule) {
+		this.jsonRule = jsonRule;
+	}
+
 	/**
 	 * @Tip 对象初始化时必须给历史记录赋值,为showTip属性设置默认值
 	 */
@@ -2049,6 +2097,14 @@ public class Purchase extends Document implements Serializable {
 		this.exchangeStatus = exchangeStatus;
 	}
 
+	public String getJsonTakeSelf() {
+		return jsonTakeSelf;
+	}
+
+	public void setJsonTakeSelf(String jsonTakeSelf) {
+		this.jsonTakeSelf = jsonTakeSelf;
+	}
+
 	/**
 	 * Gets storeid.
 	 *

+ 15 - 0
src/main/java/com/uas/platform/b2c/trade/order/model/PurchaseDetail.java

@@ -308,6 +308,12 @@ public class PurchaseDetail extends Document {
 	@Column(name = "detail_remark", length = 4000)
 	private String remark;
 
+	/**
+	 * 物料编号
+	 */
+	@Column(name = "detail_go_number")
+	private String goodsnumber;
+
 	/**
 	 * 商城最长交期
 	 */
@@ -1067,6 +1073,14 @@ public class PurchaseDetail extends Document {
 		this.changeQty = changeQty;
 	}
 
+	public String getGoodsnumber() {
+		return goodsnumber;
+	}
+
+	public void setGoodsnumber(String goodsnumber) {
+		this.goodsnumber = goodsnumber;
+	}
+
 	/**
 	 * Instantiates a new Purchase detail.
 	 *
@@ -1104,6 +1118,7 @@ public class PurchaseDetail extends Document {
 		this.b2cMaxDelivery = oDetail.getB2cMaxDelivery();
 		this.b2cMinDelivery = oDetail.getB2cMinDelivery();
 		this.remark = oDetail.getRemark();
+		this.goodsnumber = oDetail.getGoodsnumber();
 	}
 
 	/**

+ 2 - 0
src/main/java/com/uas/platform/b2c/trade/order/service/PurchaseService.java

@@ -398,4 +398,6 @@ public interface PurchaseService {
 	 * @return Logistics
 	 */
 	Logistics findByLgtId(Long lgtId);
+
+	Logistics modifyPurchaseLogistics(Long id);
 }

+ 48 - 3
src/main/java/com/uas/platform/b2c/trade/order/service/impl/OrderServiceImpl.java

@@ -644,6 +644,11 @@ public class OrderServiceImpl implements OrderService {
     @Transactional
     private ResultMap updateOrder(String orderid, JSONObject[] ordersInfos) {
         ResultMap resultMap1 = convertInfoToOrder(ordersInfos);
+        JSONObject orderInfo  = ordersInfos[0];
+
+        JSONObject splitObject = orderInfo.getJSONObject("splitInfo");
+        System.out.println(splitObject);
+
         if(resultMap1.getCode() != ResultMapType.OK.getCode()) {
             return resultMap1;
         }
@@ -669,7 +674,7 @@ public class OrderServiceImpl implements OrderService {
         }
 
         List<Order> orderList = null;
-        ResultMap resultMap = splitOrder(order);
+        ResultMap resultMap = splitOrder(order, splitObject);
         if(resultMap.getCode() == CodeType.OK.code()) {
             orderList = (List<Order>) resultMap.getData();
         }else {
@@ -682,6 +687,12 @@ public class OrderServiceImpl implements OrderService {
         }
         str1 = StringUtils.isEmpty(str1) ? str1 : str1.substring(0, str1.length() - 1);
         order.setOrderids(str1);
+        //保存配送规则Map
+        String ruleJson = splitObject.getString("ruleList");
+        order.setJsonMoreRule(ruleJson);
+        String takeJson = splitObject.getString("takeList");
+        order.setJsonMoreTake(takeJson);
+        order.setEnsurePrice(orderInfo.getDouble("totalprice"));
         orderDao.save(order);
 
         // 记录确认订单操作日志
@@ -702,11 +713,19 @@ public class OrderServiceImpl implements OrderService {
      * 针对[501]待确认付款的订单拆单
      */
     @Transactional
-    private ResultMap splitOrder(Order order) {
+    private ResultMap splitOrder(Order order, JSONObject object) {
         //确认付款这里将不同的店铺的商品拆单
         Map<String, List<OrderDetail>> listMap = new HashMap<>();
         //获得订单备注Map
         JSONObject remarkMap = FastjsonUtils.fromJson(order.getOrderRemark(), JSONObject.class);
+
+        //获取适用配送规则列表
+        String jsonRule = object.getString("ruleList");
+        JSONObject ruleObject = FastjsonUtils.fromJson(jsonRule, JSONObject.class);
+        //获取自提点信息
+        String jsonTake = object.getString("takeList");
+        JSONObject takeObject = FastjsonUtils.fromJson(jsonTake, JSONObject.class);
+
         for (OrderDetail detail : order.getOrderDetails()) {
             List<OrderDetail> orderDetails = listMap.get(detail.getStoreid());
             if (orderDetails == null) {
@@ -747,6 +766,22 @@ public class OrderServiceImpl implements OrderService {
 
                 newOrderDetails.add(orderDetail1);
             }
+            /**
+             *  加入运费
+             */
+            JSONObject rule = ruleObject.getJSONObject(storeid);
+            JSONObject take = takeObject.getJSONObject(storeid);
+            System.out.println(rule);
+            or.setJsonRule(FastjsonUtils.toJson(rule));
+            if(take != null){
+                or.setJsonTakeSelf(FastjsonUtils.toJson(take));
+            }
+
+            or.setDeliverytype(Integer.parseInt(rule.getString("method")));
+            or.setFare(Double.parseDouble(rule.getString("fare")));
+            ensurePrices += or.getFare();
+            transationPrice += or.getFare();
+
             or.setBatchQty(newOrderDetails.size());
             or.setEnsurePrice(NumberUtil.fractionNumCeil(ensurePrices, 2));
             or.setPrice(NumberUtil.fractionNumCeil(prices, 2));
@@ -758,6 +793,7 @@ public class OrderServiceImpl implements OrderService {
             map.put(storeid, remarkMap.getString(storeid));
             String orRemark = FastjsonUtils.toJson(map);
             or.setOrderRemark(orRemark);
+//            or.setDeliverytype(Integer.parseInt(methodMap.getString(storeid)));
 
             StoreIn storeIn = storeInDao.findByUuid(storeid);
             if (storeIn == null) {
@@ -800,13 +836,21 @@ public class OrderServiceImpl implements OrderService {
     private ResultMap convertInfoToOrder(JSONObject[] ordersInfo) {
         JSONObject orderInfo  = ordersInfo[0];
         Order order = orderDao.findOne(orderInfo.getLong("id"));
-        order.setDeliverytype(orderInfo.getInteger("deliverytype"));
+        /**
+         * 这里的deliverytype为key,value的map形式
+         */
+//        order.setDeliverytypes(orderInfo.getString("deliverytypes"));
+//        order.setFares(orderInfo.getString("fares"));
 
         // TODO huxz 暂时设置为1301
         if (order.getDeliverytype() == null) {
             order.setDeliverytype(Type.Delivery_ByUU_Code.value());
         }
+
         Long add_id = orderInfo.getLong("add_id");
+        /**
+         * TODO hulh 这里需要转化地址。暂时设为1301
+         */
         String jsonAddress = getAddressFormateToString(order.getDeliverytype(), add_id);
         order.setJsonAddress(jsonAddress);
         order.setInvoicetype(orderInfo.getInteger("invoicetype"));
@@ -836,6 +880,7 @@ public class OrderServiceImpl implements OrderService {
                     detail.setNumber(detailInfo.getDouble("number"));
                     detail.setTaxUnitprice(detailInfo.getDouble("taxUnitprice"));
                     detail.setRemark(detailInfo.getString("remark"));
+                    detail.setGoodsnumber(detailInfo.getString("goodsnumber"));
                     String storeid = detailInfo.getString("storeid");
                     Goods goods = goodsDao.findByBatchCode(detail.getBatchCode());
                     if(!goods.getStoreid().equals(storeid)) {

+ 24 - 5
src/main/java/com/uas/platform/b2c/trade/order/service/impl/PurchaseServiceImpl.java

@@ -10,6 +10,7 @@ import com.uas.platform.b2c.common.account.model.TradeLog;
 import com.uas.platform.b2c.common.account.model.User;
 import com.uas.platform.b2c.core.config.SysConf;
 import com.uas.platform.b2c.core.constant.SplitChar;
+import com.uas.platform.b2c.core.constant.Type;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.core.support.log.TradeBufferedLogger;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
@@ -55,7 +56,6 @@ import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.EncodingRulesConstant;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.Status;
-import com.uas.platform.core.model.Type;
 import com.uas.platform.core.persistence.criteria.CriterionExpression;
 import com.uas.platform.core.persistence.criteria.LogicalExpression;
 import com.uas.platform.core.persistence.criteria.PredicateUtils;
@@ -352,6 +352,8 @@ public class PurchaseServiceImpl implements PurchaseService {
 		price = NumberUtil.pricesScaleTwo(price);
 		purchase.setPrice(price);
 		// TODO 这里需要考虑确认总价的问题 (默认和总价相等,打折或优惠券逻辑待考虑)
+		// 加入运费
+		ensurePrices += purchase.getFare();
 		ensurePrices = NumberUtil.pricesScaleTwo(ensurePrices);
 		purchase.setEnsurePrice(ensurePrices);
 	}
@@ -409,6 +411,8 @@ public class PurchaseServiceImpl implements PurchaseService {
 			purchase.setInvoicetype(Type.Bill_Deduct.value());
 			purchase.setInvoiceAddress(FastjsonUtils.toJson(billOne.get(0)));
 			purchase.setInvoicetitle(billOne.get(0).getHead());
+			purchase.setFare(0d);//默认为0
+			purchase.setSendType(Type.Delivery_ByUU_Code.value());//寄售类型统一为第三方配送
 		}else {
 			if(orderFromCust.getBuyerentername() == null) {
 				Enterprise enterprise = enterpriseDao.findByUu(orderFromCust.getBuyerenuu());
@@ -426,6 +430,13 @@ public class PurchaseServiceImpl implements PurchaseService {
 			purchase.setInvoicetype(orderFromCust.getInvoicetype());
 			purchase.setInvoiceAddress(orderFromCust.getInvoiceAddress());
 			purchase.setInvoicetitle(orderFromCust.getInvoicetitle());
+			//如果是自营的,则保存配送规则和运费信息,自提点信息和配送方式
+			purchase.setFare(orderFromCust.getFare());
+			purchase.setJsonRule(orderFromCust.getJsonRule());
+			purchase.setSendType(orderFromCust.getDeliverytype());
+			if (orderFromCust.getJsonTakeSelf() != null){
+				purchase.setJsonTakeSelf(orderFromCust.getJsonTakeSelf());
+			}
 		}
 		List<User> users = userDao.findUserByUserUU(purchase.getBuyeruu());
 		User user = null;
@@ -1365,9 +1376,11 @@ public class PurchaseServiceImpl implements PurchaseService {
 			countPurchaseTaxes += NumberUtil.mul(CountPurchaseDetailPrice, 0.17);
 			countPurchasePrice += CountPurchaseDetailPrice;
 			double countFractionPurchasePrice = NumberUtil.fractionNumCeil(countPurchasePrice,2);
-			purchase.setEnsurePrice(countFractionPurchasePrice);
+			//加入运费
+			double priceAddFara = NumberUtil.add(countFractionPurchasePrice, purchase.getFare());
+			purchase.setEnsurePrice(priceAddFara);
 			purchase.setPrice(countFractionPurchasePrice);
-			purchase.setTransationPrice(countFractionPurchasePrice);
+			purchase.setTransationPrice(priceAddFara);
 			purchase.setTaxes(countPurchaseTaxes);
 			purchaseDao.save(purchase);
 			// 修改订单明细单价,不含税单价,价税合计(三个字段),税金
@@ -1398,10 +1411,11 @@ public class PurchaseServiceImpl implements PurchaseService {
 			}
 			countOrderPrice += CountPurchaseDetailPrice;
 			double countFractionOrderPrice = NumberUtil.fractionNumCeil(countOrderPrice,2);
+			double orderPriceAddFare = NumberUtil.add(countFractionOrderPrice, order.getFare());
 			countOrderTaxes += NumberUtil.mul(CountPurchaseDetailPrice, 0.17);
-			order.setEnsurePrice(countFractionOrderPrice);
+			order.setEnsurePrice(orderPriceAddFare);
 			order.setPrice(countFractionOrderPrice);
-			order.setTransationPrice(countFractionOrderPrice);
+			order.setTransationPrice(orderPriceAddFare);
 			order.setTaxes(countOrderTaxes);
 			orderDao.save(order);
 			// 保存卖家采购单修改单价的记录
@@ -1435,4 +1449,9 @@ public class PurchaseServiceImpl implements PurchaseService {
 	public Logistics findByLgtId(Long lgtId) {
 		return logisticsDao.findOne(lgtId);
 	}
+
+	@Override
+	public Logistics modifyPurchaseLogistics(Long id) {
+		return null;
+	}
 }

+ 24 - 1
src/main/webapp/resources/css/common.css

@@ -782,4 +782,27 @@ div.ng-table-pager a.page-a{
 #left-nav-fragment .user_left ul li a:focus,#left-nav-fragment .user_left p:hover{
 	color: #fff !important;
 }
-input:required:invalid, input:focus:invalid, textarea:required:invalid, textarea:focus:invalid{box-shadow: none;}
+input:required:invalid, input:focus:invalid, textarea:required:invalid, textarea:focus:invalid{box-shadow: none;}
+
+.color333{
+	color: #333 !important;
+}
+.color666{
+	color: #666 !important;
+}
+.color999{
+	color: #999 !important;
+}
+
+::-webkit-input-placeholder { /* WebKit, Blink, Edge */
+	color:    #999;
+}
+:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
+	color:    #999;
+}
+::-moz-placeholder { /* Mozilla Firefox 19+ */
+	color:    #999;
+}
+:-ms-input-placeholder { /* Internet Explorer 10-11 */
+	color:    #999;
+}

+ 1 - 1
src/main/webapp/resources/css/vendor/sell.css

@@ -1806,7 +1806,7 @@ body {
     width:100%;
     margin:0 auto;
     background: #fff;
-    padding-top: 10px;
+    padding: 10px 0;
 }
 .logistics_list01 .oder_xq p {
     line-height:30px;

+ 1 - 1
src/main/webapp/resources/js/admin/controllers/product/KindContrastDetailCtrl.js

@@ -127,7 +127,7 @@ define(['app/app'], function(app) {
 		$scope.upload = function() {
 			var file = $scope.myFiles[0];
 			$upload.upload({
-				url: 'product/componentSubmit/upload/componentCrawlsWithSame/' + $scope.kindContrast.id,
+				url: 'produce/componentSubmit/upload/componentCrawlsWithSame/' + $scope.kindContrast.id,
 				file: file,
 				method: 'POST'
 			}).success(function(data) {

+ 2 - 2
src/main/webapp/resources/js/admin/controllers/product/UploadComponentCrawlCtrl.js

@@ -91,7 +91,7 @@ define(['app/app'], function(app) {
 		$scope.upload = function() {
 			var file = $scope.myFiles[0];
 			$upload.upload({
-				url: 'product/componentSubmit/upload/componentCrawls',
+				url: 'produce/componentSubmit/upload/componentCrawls',
 				file: file,
 				method: 'POST'
 			}).success(function(data) {
@@ -126,7 +126,7 @@ define(['app/app'], function(app) {
 		// 确认继续上传数据
 		var uploadToSame = function(myFile, kindContrastId) {
 			$upload.upload({
-				url: 'product/componentSubmit/upload/componentCrawlsWithSame/' + kindContrastId,
+				url: 'produce/componentSubmit/upload/componentCrawlsWithSame/' + kindContrastId,
 				file: myFile,
 				method: 'POST'
 			}).success(function(data) {

+ 20 - 17
src/main/webapp/resources/js/admin/controllers/trade/InvoicefromOrderDetailCtrl.js

@@ -16,15 +16,14 @@ define([ 'app/app' ], function(app) {
 //					$scope.logisticsDetail = angular.fromJson($scope.logistics.companyName);
 					
 					//查看物流详情
-					$scope.listLogistics = function(data){
-						var lgtid = $scope.logistics.id;
+					$scope.listLogistics = function(){
 						var modalInstance = $modal.open({
 							animation: true,
 							templateUrl: 'static/view/admin/modal/listLogistics_modal.html',
 							controller: 'listLogisticsCtrl',
 							resolve: {
-								lgtid: function() {
-									return lgtid;
+								logistics : function () {
+									return $scope.logistics
 								}
 							}
 						});
@@ -86,22 +85,26 @@ define([ 'app/app' ], function(app) {
 		}]);
 	
 	// 物流信息
-	app.register.controller('listLogisticsCtrl', [
-			'$scope',
-			'$modal',
-			'ResponseLogistics',
-			'$modalInstance',
-			'lgtid',
-			function($scope, $modal, ResponseLogistics, $modalInstance,
-					lgtid) {
+	app.register.controller('listLogisticsCtrl', ['$scope', '$modal', 'ResponseLogistics', '$modalInstance', 'logistics', 'KdnLogistics', 'toaster', function($scope, $modal, ResponseLogistics, $modalInstance, logistics, KdnLogistics, toaster) {
 				$scope.Info = [];
 				$scope.getlogistics = function() {
-					ResponseLogistics.get({
-						id : lgtid
-					}, {}, function(data) {
-						$scope.Info = data;
-						console.log(data);
+					var params = {};
+					params.companyName = logistics.companyName;
+					params.logisticsCode = logistics.number;
+					KdnLogistics.kdnQuery(params, {}, function(response){
+						if(!response.errorInfo) {
+							$scope.Info = eval ("(" + response.traces + ")");
+						}
+					}, function(){
+						// $scope.Info = [];
+						toaster.pop('info', '查询物流信息失败,请核对物流公司和运单号');
 					});
+					// ResponseLogistics.get({
+					// 	id : lgtid
+					// }, {}, function(data) {
+					// 	$scope.Info = data;
+					// 	console.log(data);
+					// });
 				};
 				$scope.getlogistics();
 				$scope.cancel = function() {

+ 19 - 17
src/main/webapp/resources/js/admin/controllers/trade/InvoicefromPurcDetailCtrl.js

@@ -14,15 +14,14 @@ define([ 'app/app' ], function(app) {
 					$scope.logistics = angular.fromJson($scope.invoiceFPur.logistics);
 					console.log($scope.logistics);
 					//查看物流详情
-					$scope.listLogistics = function(data){
-						var lgtid = $scope.logistics.id;
+					$scope.listLogistics = function(){
 						var modalInstance = $modal.open({
 							animation: true,
 							templateUrl: 'static/view/admin/modal/listLogistics_modal.html',
 							controller: 'listLogisticsCtrl',
 							resolve: {
-								lgtid: function() {
-									return lgtid;
+								logistics : function () {
+									return $scope.logistics
 								}
 							}
 						});
@@ -94,22 +93,25 @@ define([ 'app/app' ], function(app) {
 	
 
 				// 物流信息
-			app.register.controller('listLogisticsCtrl', [
-					'$scope',
-					'$modal',
-					'ResponseLogistics',
-					'$modalInstance',
-					'lgtid',
-					function($scope, $modal, ResponseLogistics, $modalInstance,
-							lgtid) {
+			app.register.controller('listLogisticsCtrl', ['$scope', '$modal', 'ResponseLogistics', '$modalInstance', 'logistics', 'KdnLogistics', 'toaster', function($scope, $modal, ResponseLogistics, $modalInstance, logistics, KdnLogistics, toaster) {
 						$scope.Info = [];
 						$scope.getlogistics = function() {
-							ResponseLogistics.get({
-								id : lgtid
-							}, {}, function(data) {
-								$scope.Info = data;
-								console.log(data);
+							var params = {};
+							params.companyName = logistics.companyName;
+							params.logisticsCode = logistics.number;
+							KdnLogistics.kdnQuery(params, {}, function(response){
+								if(!response.errorInfo) {
+									$scope.Info = eval ("(" + response.traces + ")");
+									// statusOfLogistics($scope.logisticsInfo[$scope.logisticsInfo.length - 1].AcceptStation);
+								}
+							}, function(){
+								// $scope.Info = [];
+								toaster.pop('info', '查询物流信息失败,请核对物流公司和运单号');
 							});
+							// ResponseLogistics.get({id : lgtid}, {}, function(data) {
+							// 	$scope.Info = data;
+							// 	console.log(data);
+							// });
 						};
 						$scope.getlogistics();
 						$scope.cancel = function() {

+ 18 - 6
src/main/webapp/resources/js/admin/controllers/trade/TradePurchaseDetailCtrl.js

@@ -26,8 +26,8 @@ define([ 'app/app' ], function(app) {
 						templateUrl: 'static/view/admin/modal/listLogistics_modal.html',
 						controller: 'listLogisticsCtrl',
 						resolve: {
-							lgtid: function() {
-								return lgtid;
+							logistics : function () {
+								return $scope.logistics
 							}
 						}
 					});
@@ -106,13 +106,25 @@ define([ 'app/app' ], function(app) {
 		loadData();
 	}]);
 	
-	app.register.controller('listLogisticsCtrl', [ '$scope', '$modal', 'ResponseLogistics', '$modalInstance', 'lgtid', function($scope, $modal, ResponseLogistics, $modalInstance, lgtid){
+	app.register.controller('listLogisticsCtrl', [ '$scope', '$modal', 'ResponseLogistics', '$modalInstance', 'logistics', 'KdnLogistics', 'toaster', function($scope, $modal, ResponseLogistics, $modalInstance, logistics, KdnLogistics, toaster){
 		$scope.Info = [];
 		$scope.getlogistics = function() {
-			ResponseLogistics.get({id: lgtid}, {}, function(data) {
-				$scope.Info = data;
-				console.log(data);
+			var params = {};
+			params.companyName = logistics.companyName;
+			params.logisticsCode = logistics.number;
+			KdnLogistics.kdnQuery(params, {}, function(response){
+				if(!response.errorInfo) {
+					$scope.Info = eval ("(" + response.traces + ")");
+					// statusOfLogistics($scope.logisticsInfo[$scope.logisticsInfo.length - 1].AcceptStation);
+				}
+			}, function(){
+				// $scope.Info = [];
+				toaster.pop('info', '查询物流信息失败,请核对物流公司和运单号');
 			});
+			// ResponseLogistics.get({id : lgtid}, {}, function(data) {
+			// 	$scope.Info = data;
+			// 	console.log(data);
+			// });
 		};
 		$scope.getlogistics();
 		$scope.cancel = function() {

+ 17 - 17
src/main/webapp/resources/js/common/query/brand.js

@@ -1,7 +1,7 @@
 define([ 'ngResource' ], function() {
 	angular.module('brandServices', [ 'ngResource' ]).factory('BrandsSubmit', ['$resource', function($resource) {
 		//获取BrandSubmit的分页数据
-		return $resource('product/brandSubmit', {}, {
+		return $resource('produce/brandSubmit', {}, {
 			//未审核
 			getUnAudited : {
 				params : { _state : 'unAudited'}
@@ -17,15 +17,15 @@ define([ 'ngResource' ], function() {
 		});
 	}]).factory('BrandSubmit', ['$resource', function($resource) {
 		//对单个BrandSubmit的操作
-		return $resource('product/brandSubmit/:id', {}, {
+		return $resource('produce/brandSubmit/:id', {}, {
 			//提交(保存)
 			submit : {
-				url : 'product/brandSubmit/saveBrandSubmit',
+				url : 'produce/brandSubmit/saveBrandSubmit',
 				method : 'POST'
 			},
 			//审核通过
 			valid : {
-				url : 'product/brandSubmit/audit',
+				url : 'produce/brandSubmit/audit',
 				method : 'PUT',
 				params : {
 					valid : true
@@ -33,7 +33,7 @@ define([ 'ngResource' ], function() {
 			},
 			//审核不通过
 			invalid : {
-				url : 'product/brandSubmit/audit/:id',
+				url : 'produce/brandSubmit/audit/:id',
 				method : 'PUT',
 				params : {
 					valid : false
@@ -41,34 +41,34 @@ define([ 'ngResource' ], function() {
 			},
 			// 审核通过信息冲突的更新申请
 			validUpdate : {
-				url : 'product/brandSubmit/audituUpdate',
+				url : 'produce/brandSubmit/audituUpdate',
 				method : 'PUT'
 			}
 		});
 	}]).factory('BrandVersion', ['$resource', function($resource) {
 		//获取根据uuid获取BrandVersion列表
-		return $resource('product/brandVersion/:uuid', {}, {
+		return $resource('produce/brandVersion/:uuid', {}, {
 			/*
 			 * get,根据uuid,version获取BrandVersion对象
 			 */
 			//根据uuid获取BrandVersion列表
 			getList : {
-				url : 'product/brandVersion/list/:uuid',
+				url : 'produce/brandVersion/list/:uuid',
 				method : 'GET',
 				isArray : true
 			},
 			//根据uuid获取BrandVersion名称
 			getCount : {
-				url : 'product/brandVersion/count/:uuid',
+				url : 'produce/brandVersion/count/:uuid',
 				method : 'GET'
 			}
 		});
 	}]).factory('BrandActive', ['$resource', function($resource) {
 		//对单个BrandActive对象操作
-		return $resource('product/brand/:uuid', {}, {
+		return $resource('produce/brand/:uuid', {}, {
 			//禁用BrandActive
 			disable : {
-				url : 'product/brand/disable/:uuid',
+				url : 'produce/brand/disable/:uuid',
 				method : 'PUT',
 				isArray : true
 			},
@@ -96,18 +96,18 @@ define([ 'ngResource' ], function() {
 			},
 			// 验证品牌名是否存在
 			nameExist : {
-				url: 'product/brand/nameExist',
+				url: 'produce/brand/nameExist',
 				method: 'GET',
 				isArray: true
 			},
 			// 更新与修改
 			update : {
-				url: 'product/brand/saveBrandActive',
+				url: 'produce/brand/saveBrandActive',
 				method: 'POST'
 			},
 			// 获取各月新增品牌数量
 			getIncreaseCount : {
-				url: 'product/brand/increaseCount',
+				url: 'produce/brand/increaseCount',
 				method: 'GET',
 				isArray: true
 			}
@@ -185,19 +185,19 @@ define([ 'ngResource' ], function() {
 		})
 	}]).factory('BrandDisable', ['$resource', function($resource) {
 		//对BrandDisable禁用品牌的操作
-		return $resource('product/brandDisable/:uuid', {}, {
+		return $resource('produce/brandDisable/:uuid', {}, {
 			/**
 			 * get, 根据uuid获取BrandDisable
 			 */
 			// 获取全部已禁用品牌的简要信息
 			getSimpleInfo : {
-				url: 'product/brandDisable/info',
+				url: 'produce/brandDisable/info',
 				method: 'GET',
 				isArray: true
 			},
 			// 分页获取全部已禁用品牌的简要信息
 			getSimpleInfoPage : {
-				url: 'product/brandDisable/info/ByPage',
+				url: 'produce/brandDisable/info/ByPage',
 				method: 'GET'
 			}
 		});

+ 37 - 37
src/main/webapp/resources/js/common/query/component.js

@@ -1,7 +1,7 @@
 define([ 'ngResource' ], function() {
 	angular.module('componentServices', [ 'ngResource' ]).factory('ComponentsSubmit', ['$resource', function($resource) {
 		//获取ComponentSubmit的分页数据
-		return $resource('product/componentSubmit', {}, {
+		return $resource('produce/componentSubmit', {}, {
 			//未审核
 			getUnAudited : {
 				params : { _state : 'unAudited'}
@@ -17,13 +17,13 @@ define([ 'ngResource' ], function() {
 		});
 	}]).factory('ComponentSubmit', ['$resource', function($resource) {
 		//对单个ComponentSubmit的操作
-		return $resource('product/componentSubmit/:id', {}, {
+		return $resource('produce/componentSubmit/:id', {}, {
 			/**
 			 * get,根据uuid查找ComponentSubmit详细信息
 			 */
 			//审核通过
 			valid : {
-				url : 'product/componentSubmit/audit',
+				url : 'produce/componentSubmit/audit',
 				method : 'PUT',
 				params : {
 					valid : true
@@ -31,7 +31,7 @@ define([ 'ngResource' ], function() {
 			},
 			//审核不通过
 			invalid : {
-				url : 'product/componentSubmit/audit/:id',
+				url : 'produce/componentSubmit/audit/:id',
 				method : 'PUT',
 				params : {
 					valid : false
@@ -39,122 +39,122 @@ define([ 'ngResource' ], function() {
 			},
 			// 下载批量器件建档模板
 			downloadExcel : {
-				url : 'product/componentSubmit/template',
+				url : 'produce/componentSubmit/template',
 				method : 'POST'
 			},
 			// 未审核批量申请(用户)
 			unAuditedBatch : {
-				url : 'product/componentSubmit/batch',
+				url : 'produce/componentSubmit/batch',
 				method : 'GET',
 				params : { _status : 'unAudited'}
 			},
 			// 已通过批量申请(用户)
 			passBatch : {
-				url : 'product/componentSubmit/batch',
+				url : 'produce/componentSubmit/batch',
 				method : 'GET',
 				params : { _status : 'pass'}
 			},
 			// 全部批量申请(用户)
 			allBatch : {
-				url : 'product/componentSubmit/batch',
+				url : 'produce/componentSubmit/batch',
 				method : 'GET',
 				params : { _status : 'all'}
 			},
 			// 未通过批量申请(用户)
 			forbiddenBatch : {
-				url : 'product/componentSubmit/batch',
+				url : 'produce/componentSubmit/batch',
 				method : 'GET',
 				params : { _status : 'forbidden'}
 			},
 			// 全部批量申请(后台)
 			allBatchManage : {
-				url : 'product/componentSubmit/manage/batch',
+				url : 'produce/componentSubmit/manage/batch',
 				method : 'GET',
 				params : { _status : 'all'}
 			},
 			// 未审核批量申请(后台)
 			unAuditedBatchManage : {
-				url : 'product/componentSubmit/manage/batch',
+				url : 'produce/componentSubmit/manage/batch',
 				method : 'GET',
 				params : { _status : 'unAudited'}
 			},
 			// 已通过批量申请(后台)
 			passBatchManage : {
-				url : 'product/componentSubmit/manage/batch',
+				url : 'produce/componentSubmit/manage/batch',
 				method : 'GET',
 				params : { _status : 'pass'}
 			},
 			// 未通过批量申请(后台)
 			forbiddenBatchManage : {
-				url : 'product/componentSubmit/manage/batch',
+				url : 'produce/componentSubmit/manage/batch',
 				method : 'GET',
 				params : { _status : 'forbidden'}
 			},
 			// 获取批量申请详情
 			getBatchDetails : {
-				url : 'product/componentSubmit/batch/:submitId',
+				url : 'produce/componentSubmit/batch/:submitId',
 				method : 'GET'
 			},
 			// 批量器件建档审核通过
 			auditBatch : {
-				url : 'product/componentSubmit/audit/batch',
+				url : 'produce/componentSubmit/audit/batch',
 				method : 'PUT'
 			},
 			// 批量器件建档审核不通过
 			unAuditBatch : {
-				url : 'product/componentSubmit/unAudit/batch',
+				url : 'produce/componentSubmit/unAudit/batch',
 				method : 'PUT'
 			},
 			// 获取尚未处理的建档申请
 			tobe_handleTask : {
-				url : 'product/componentSubmit/getDetail/batch',
+				url : 'produce/componentSubmit/getDetail/batch',
 				method : 'GET',
 				params : {_status : 'tobe_handle'}
 			},
 			// 获取任务中的建档申请
 			pendingTask : {
-				url : 'product/componentSubmit/getDetail/batch',
+				url : 'produce/componentSubmit/getDetail/batch',
 				method : 'GET',
 				params : {_status : 'pending'}
 			},
 			// 获取已完成的建档申请
 			completeTask : {
-				url : 'product/componentSubmit/getDetail/batch',
+				url : 'produce/componentSubmit/getDetail/batch',
 				method : 'GET',
 				params : {_status : 'complete'}
 			},
 			// 获取爬取失败的建档申请
 			failedTask : {
-				url : 'product/componentSubmit/getDetail/batch',
+				url : 'produce/componentSubmit/getDetail/batch',
 				method : 'GET',
 				params : {_status : 'failed'}
 			},
 			// 选取用户申请发起任务
 			saveTask : {
-				url : 'product/componentSubmit/task',
+				url : 'produce/componentSubmit/task',
 				method : 'POST'
 			},
 			// 用户直接提交批量建档申请
 			saveSubmits : {
-				url : 'product/componentSubmit/submitBatch',
+				url : 'produce/componentSubmit/submitBatch',
 				method : 'POST'
 			}
 		});
 	}]).factory('ComponentVersion', ['$resource', function($resource) {
 		//获取根据uuid获取ComponentVersion列表
-		return $resource('product/componentVersion/:uuid', {}, {
+		return $resource('produce/componentVersion/:uuid', {}, {
 			/**
 			 * get,根据uuid,version获取ComponentVersion对象
 			 */
 			//根据uuid获取ComponentVersion列表
 			getList : {
-				url : 'product/componentVersion/list/:uuid',
+				url : 'produce/componentVersion/list/:uuid',
 				method : 'GET',
 				isArray : true
 			},
 			//根据uuid获取ComponentVersion数量
 			getCount : {
-				url : 'product/componentVersion/count/:uuid',
+				url : 'produce/componentVersion/count/:uuid',
 				method : 'GET'
 			}
 		});
@@ -171,7 +171,7 @@ define([ 'ngResource' ], function() {
 			},
 			//获取ComponentInfo的分页数据
 			getInfoPage: {
-				url: 'product/component/list',
+				url: 'produce/component/list',
 				method: 'GET'
 			},
 			// 根据UUid获取单个器件的简要信息
@@ -193,7 +193,7 @@ define([ 'ngResource' ], function() {
 			},
 			// 禁用ComponentActive
 			disable : {
-				url : 'product/component/:uuid/disable',
+				url : 'produce/component/:uuid/disable',
 				method : 'PUT'
 			},
 			// 根据UUid 获取列表
@@ -204,16 +204,16 @@ define([ 'ngResource' ], function() {
 			},
 			//根据批次号获取器件信息
 			getByBatchCode: {
-				url : 'product/component/:batchCode/detail',
+				url : 'produce/component/:batchCode/detail',
 				method : 'GET'
 			},//根据原厂型号和品牌获取器件信息
 			getByCodeAndBrandId: {
-				url: 'product/component/codeAndBrandId/:code',
+				url: 'produce/component/codeAndBrandId/:code',
 				method: 'GET',
 				isArray: true
 			},//根据原厂型号和类目获取器件信息
 			getByCodeAndKindId: {
-				url: 'product/component/codeAndKindId/:code',
+				url: 'produce/component/codeAndKindId/:code',
 				method: 'GET',
 				isArray: true
 			},
@@ -243,31 +243,31 @@ define([ 'ngResource' ], function() {
 			},
 			// 根据类目id获取封装规格
 			getPackagingByKindid: {
-				url: 'product/component/packaging/:kindid',
+				url: 'produce/component/packaging/:kindid',
 				method: 'GET',
 				isArray: true
 			},
 			// 批量修改器件类目
 			moveCmp: {
-				url: 'product/component/moveCmp',
+				url: 'produce/component/moveCmp',
 				method: 'PUT',
 				isArray : true
 			},
 			// 获取每月器件增长数量
 			getIncreaseCount: {
-				url: 'product/component/increaseCount',
+				url: 'produce/component/increaseCount',
 				method: 'GET',
 				isArray: true
 			}
 		});
 	}]).factory('ComponentDisable', ['$resource', function($resource) {
-		return $resource('product/componentDisable/:uuid', {}, {
+		return $resource('produce/componentDisable/:uuid', {}, {
 			/*
 			 * get 根据uuid获得ComponentDisable
 			 */
 			// 分页获取全部已禁用器件的简要信息
 			getSimpleInfoPage : {
-				url: 'product/componentDisable/info/ByPage',
+				url: 'produce/componentDisable/info/ByPage',
 				method: 'GET'
 			}
 		})
@@ -296,13 +296,13 @@ define([ 'ngResource' ], function() {
 			}
 		});
 	}]).factory('ComponentTest', ['$resource', function($resource) {
-		return $resource('product/component/:uuid', {}, {
+		return $resource('produce/component/:uuid', {}, {
 			/*
 			 * get 获ComponentsActive的分页数据,根据uuid获得ComponentActive
 			 */
 			//获取ComponentActive的分页数据
 			getInfoPage: {
-				url: 'product/component/info',
+				url: 'produce/component/info',
 				method: 'GET'
 			}
 		});

+ 12 - 12
src/main/webapp/resources/js/common/query/crawlTask.js

@@ -1,67 +1,67 @@
 define([ 'ngResource' ], function() {
 	angular.module('crawlTaskServices', [ 'ngResource' ]).factory('CrawlTask', ['$resource', function($resource) {
 		//获取数据爬取的分页数据
-		return $resource('product/crawlTask', {}, {
+		return $resource('produce/crawlTask', {}, {
 			// 获取未完成的任务
 			to_crawl : {
-				url : 'product/crawlTask',
+				url : 'produce/crawlTask',
 				method : 'GET',
 				params : {_status : 'to_crawl'}
 			},
 			// 获取进行中的任务
 			running : {
-				url : 'product/crawlTask',
+				url : 'produce/crawlTask',
 				method : 'GET',
 				params : {_status : 'running'}
 			},
 			// 获取已完成的任务
 			crawled : {
-				url : 'product/crawlTask',
+				url : 'produce/crawlTask',
 				method : 'GET',
 				params : {_status : 'crawled'}
 			},
 			// 获取失败的任务
 			failed : {
-				url : 'product/crawlTask',
+				url : 'produce/crawlTask',
 				method : 'GET',
 				params : {_status : 'failed'}
 			},
 			// 新增任务(来自参数对应关系)
 			save : {
-				url : 'product/crawlTask/:id',
+				url : 'produce/crawlTask/:id',
 				method : 'POST'
 			},
 			// 新增任务(来自用户申请列表)
 			saveBySubmit : {
-				url : 'product/crawlTask/saveBySubmit/:ids',
+				url : 'produce/crawlTask/saveBySubmit/:ids',
 				method : 'POST'
 			},
 			// 根据id获取任务详情
 			getOne : {
-				url : 'product/crawlTask/:id',
+				url : 'produce/crawlTask/:id',
 				method : 'GET'
 			},
 			// 任务开启
 			crawlStart : {
-				url : 'product/crawlTask/crawl',
+				url : 'produce/crawlTask/crawl',
 				params : { _status : 'start'},
 				method : 'PUT'
 			},
 			// 任务完成
 			crawlSuccess : {
-				url : 'product/crawlTask/crawl',
+				url : 'produce/crawlTask/crawl',
 				params : { _status : 'success'},
 				method : 'PUT'
 			},
 			// 任务异常
 			crawlFail : {
-				url : 'product/crawlTask/crawl',
+				url : 'produce/crawlTask/crawl',
 				params : { _status : 'fail'},
 				method : 'PUT'
 			},
 			// 获取已完成任务的维护器件列表
 			getCmpList : {
-				url : 'product/crawlTask/cmpList',
+				url : 'produce/crawlTask/cmpList',
 				method : 'GET'
 			}
 		});

+ 11 - 11
src/main/webapp/resources/js/common/query/kind.js

@@ -1,31 +1,31 @@
 define([ 'ngResource'], function() {
 	angular.module('common.query.kind', [ 'ngResource' ]).factory('Kind', ['$resource', '$cacheFactory', function($resource, $cacheFactory) {
 		var cache = $cacheFactory('Kind');
-		return $resource('product/kind/:kindIds', {}, {
+		return $resource('produce/kind/:kindIds', {}, {
 			// 修改分类的属性
 			updateProperties: {
-				url: 'product/kind/:kindId/properties',
+				url: 'produce/kind/:kindId/properties',
 				method: 'POST',
 				isArray: true
 			},
 			//重置类属性值
 			resetKindPropertyValues: {
-				url: 'product/kind/kindPropertyValues/reset',
+				url: 'produce/kind/kindPropertyValues/reset',
 				method:  'GET'
 			},
 			// 编辑修改
 			update: {
-				url: 'product/kind/:kindId',
+				url: 'produce/kind/:kindId',
 				method: 'POST'
 			},
 			// 新增保存
 			save: {
-				url: 'product/kind',
+				url: 'produce/kind',
 				method: 'POST'
 			},
 			// 交换序号
 			exchangeNumber: {
-				url: 'product/kind/number',
+				url: 'produce/kind/number',
 				method: 'POST',
 				params: {
 					operate: 'exchange'
@@ -33,28 +33,28 @@ define([ 'ngResource'], function() {
 			},
 			// 删除类目属性
 			deleteKindProperty: {
-				url: 'product/kind/kindProperty/:kindPropertyId',
+				url: 'produce/kind/kindProperty/:kindPropertyId',
 				method: 'DELETE',
 			},
 			// 添加类目属性
 			addKindProperty: {
-				url: 'product/kind/kindProperty/add',
+				url: 'produce/kind/kindProperty/add',
 				method: 'PUT'
 			},
 			// 修改类目属性具体值
 			updateKindProperty: {
-				url: 'product/kind/kindProperty/update',
+				url: 'produce/kind/kindProperty/update',
 				method: 'PUT'
 			},
 			// 改变类目属性顺序
 			changeDetno: {
-				url: 'product/kind/kindProperty/changeDetno',
+				url: 'produce/kind/kindProperty/changeDetno',
 				method: 'PUT',
 				isArray: true
 			},
 			// 更换类目属性
 			changeKindProperty: {
-				url: 'product/kind/kindProperty/changeKindProperty',
+				url: 'produce/kind/kindProperty/changeKindProperty',
 				method: 'PUT'
 			}
 		});

+ 1 - 1
src/main/webapp/resources/js/common/query/kindAdvice.js

@@ -5,7 +5,7 @@ define([ 'ngResource'], function() {
 	angular.module('common.query.kindAdvice', [ 'ngResource'
 	]).factory('KindAdvice', ['$resource', '$cacheFactory', function($resource, $cacheFactory) {
 		var cache = $cacheFactory('KindAdvice');
-		return $resource('product/kindAdvice/:id', {}, {
+		return $resource('produce/kindAdvice/:id', {}, {
 			
 		});
 	}]);

+ 12 - 12
src/main/webapp/resources/js/common/query/kindContrast.js

@@ -1,66 +1,66 @@
 define([ 'ngResource' ], function() {
 	angular.module('kindContrastServices', [ 'ngResource' ]).factory('KindContrast', ['$resource', function($resource) {
 		//获取属性对应关系的分页数据
-		return $resource('product/kindContrast', {}, {
+		return $resource('produce/kindContrast', {}, {
 			// 获取全部参数对照规则
 			all: {
-				url : 'product/kindContrast',
+				url : 'produce/kindContrast',
 				method : 'GET',
 				params : {_status : 'all'}
 			},
 			// 获取待发起参数对照规则
 			outTask: {
-				url : 'product/kindContrast',
+				url : 'produce/kindContrast',
 				method : 'GET',
 				params : {_status : 'outTask'}
 			},
 			// 获取全部参数对照规则
 			inTask: {
-				url : 'product/kindContrast',
+				url : 'produce/kindContrast',
 				method : 'GET',
 				params : {_status : 'inTask'}
 			},
 			// 获取任务进行中的参数对应规则
 			running : {
-				url : 'product/kindContrast',
+				url : 'produce/kindContrast',
 				method : 'GET',
 				params : {_status : 'running'}
 			},
 			// 获取已结案的参数对应规则
 			concluded : {
-				url : 'product/kindContrast',
+				url : 'produce/kindContrast',
 				method : 'GET',
 				params : {_status : 'concluded'}
 			},
 			// 获取异常参数对应关系规则
 			failed : {
-				url : 'product/kindContrast',
+				url : 'produce/kindContrast',
 				method : 'GET',
 				params : {_status : 'failed'}
 			},
  			// 获取参数对照规则详情
 			getOne : {
-				url : 'product/kindContrast/:id',
+				url : 'produce/kindContrast/:id',
 				method : 'GET'
 			},
 			// 更新基础属性
 			updateBasic : {
-				url : 'product/kindContrast/update/basic',
+				url : 'produce/kindContrast/update/basic',
 				method : 'PUT'
 			},
 			// 更新参数对照
 			updateProperty : {
-				url : 'product/kindContrast/update/property',
+				url : 'produce/kindContrast/update/property',
 				method : 'PUT'
 			},
 			// 新增参数对照明细
 			newProperty : {
-				url : 'product/kindContrast/create/property',
+				url : 'produce/kindContrast/create/property',
 				method : 'PUT'
 			},
 			// 删除参数对照
 			deleteOne : {
-				url : 'product/kindContrast/:id',
+				url : 'produce/kindContrast/:id',
 				method : 'DELETE'
 			}
 		});

+ 9 - 1
src/main/webapp/resources/js/common/query/logistics.js

@@ -46,7 +46,15 @@ define([ 'ngResource' ], function() {
 			 updateLogistics : {
 				 url : 'trade/logistics/:id',
 				 method : 'POST'
-			 }
+			 },
+			addLogistics : {
+				url : 'trade/logistics/add',
+				method : 'POST'
+			},
+			clearLogistics : {
+				url : 'trade/logistics/clear',
+				method : 'PUT'
+			}
 		});
 	}]);
 });

+ 49 - 0
src/main/webapp/resources/js/common/query/logisticsPort.js

@@ -77,5 +77,54 @@ define([ 'ngResource' ], function() {
 				isArray : true
 			}
 		});
+	}]).factory('DistributionRule', ['$resource', function ($resource) {
+		return $resource('trade/distributionRule', {}, {
+			saveRule : {
+				url: 'trade/distributionRule/save',
+				method: 'POST'
+			},
+			deleteOne : {
+				url: 'trade/distributionRule/delete/:id',
+				method: 'PUT'
+			},
+			/**
+			 * 分页获取配送规则列表
+			 */
+			findAllRule : {
+				url: 'trade/distributionRule/page',
+				method: 'GET'
+			},
+			findAllRuleName : {
+				url: 'trade/distributionRule/ruleName',
+				method: 'GET',
+				isArray : true
+			},
+			changeActive : {
+				url: 'trade/distributionRule/status',
+				method: 'POST'
+			},
+			findCountOfRule : {
+				url: 'trade/distributionRule/count',
+				method: 'GET'
+			},
+			checkRuleName : {
+				url: 'trade/distributionRule/checkName',
+				method: 'GET'
+			},
+			findMatchRule : {
+				url: 'trade/distributionRule/rule/matchArea',
+				method: 'GET',
+				isArray : true
+			},
+			findFareOfRule : {
+				url: 'trade/distributionRule/fare',
+				method: 'POST',
+				isArray : true
+			},
+			findUsableRule : {
+				url: 'trade/distributionRule/usable/rule',
+				method: 'POST'
+			}
+		})
 	}]);
 });

+ 11 - 11
src/main/webapp/resources/js/common/query/property.js

@@ -1,53 +1,53 @@
 define([ 'ngResource' ], function() {
 	angular.module('propertyServices', [ 'ngResource' ]).factory('Property', ['$resource', function($resource) {
-		return $resource('product/property/:id', {}, {
+		return $resource('produce/property/:id', {}, {
 			// 根据id获取属性信息
 			get : {
-				url : 'product/property/:id',
+				url : 'produce/property/:id',
 				method : 'GET'
 			},
 			//获得所有属性数据
 			getProperties : {
-				url : 'product/property',
+				url : 'produce/property',
 				method : 'GET',
 				isArray: true
 			},
 			// 分页获取所有属性
 			getPropertiesPage : {
-				url : 'product/property/pageInfo',
+				url : 'produce/property/pageInfo',
 				method : 'GET'
 			},
 			// 添加属性
 			add : {
-				url : 'product/property',
+				url : 'produce/property',
 				method : 'POST'
 			},
 			// 更新属性
 			update : {
-				url : 'product/property/update',
+				url : 'produce/property/update',
 				method : 'POST'
 			}
 		});
 	}]).factory('propertiesSubmit', ['$resource', function($resource) {
 		//获取ComponentSubmit的数据
-		return $resource('product/propertySubmit', {}, {
+		return $resource('produce/propertySubmit', {}, {
 			//根据ComponentSubmit.id查找对应的propertiesSubmit
 			getList : {
-				url : 'product/propertySubmit/:id',
+				url : 'produce/propertySubmit/:id',
 				method : 'GET',
 				isArray : true
 			},
 			getPropertySubmit : {
-				url : 'product/propertySubmit/property',
+				url : 'produce/propertySubmit/property',
 				method : 'GET'
 			}
 		});
 	}]).factory('propertiesActive', ['$resource', function($resource) {
 		//获取propertiesActive的数据
-		return $resource('product/propertyActive', {}, {
+		return $resource('produce/propertyActive', {}, {
 			//根据ComponentActive.id查找对应的propertiesActive
 			getList : {
-				url : 'product/propertyActive/:id',
+				url : 'produce/propertyActive/:id',
 				method : 'GET',
 				isArray : true
 			}

+ 1 - 1
src/main/webapp/resources/js/common/query/propertyAdvice.js

@@ -5,7 +5,7 @@ define([ 'ngResource'], function() {
 	angular.module('common.query.propertyAdvice', [ 'ngResource'
 	]).factory('PropertyAdvice', ['$resource', '$cacheFactory', function($resource, $cacheFactory) {
 		var cache = $cacheFactory('PropertyAdvice');
-		return $resource('product/propertyAdvice/:id', {}, {
+		return $resource('produce/propertyAdvice/:id', {}, {
 			
 		});
 	}]);

+ 4 - 0
src/main/webapp/resources/js/common/query/vendor.js

@@ -52,6 +52,10 @@ define(['ngResource'], function() {
 				url : 'trade/takeSelf/takeName',
 				method : 'GET',
 				isArray : true
+			},
+			findTakeSelfByStore : {
+				url : 'trade/takeSelf/store/takeSelf',
+				method : 'POST'
 			}
 		});
 	}]);

+ 3 - 2
src/main/webapp/resources/js/common/services.js

@@ -581,8 +581,9 @@ define([ 'angular', 'common/utils', 'big'], function(angular, utils, Big) {
 			"1202":"17%增值税不可抵扣,累计开票,8%税点",
 			"1203":"17%增值税可抵扣,随元器件一起发货,10%税点",
 			"1204":"17%增值税不可抵扣,,随元器件一起发货,10%税点",
-			"1301":"UU配送",
-			"1302":"上门自取"
+			"1301":"第三方配送",
+            "1302":"卖家配送",
+			"1303":"上门自取"
 			};
 		return function(data) {
 			return statusConfig[data];

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

@@ -80,7 +80,7 @@ define([ 'app/app', 'jquery-summernote' ], function(app) {
 				
 				// 不是通过路由过来的,再检查地址栏的参数kindIds
 				if($location.search().kindIds && /^(\d{1,}_)*(\d){1,}$/.test($location.search().kindIds)) {
-					$http.get('product/kinds/' + $location.search().kindIds.replace(/_/g, ','), {
+					$http.get('produce/kinds/' + $location.search().kindIds.replace(/_/g, ','), {
 						cache: $templateCache
 					}).success(function(kinds){
 						if(kinds.length > 0 && kinds.last().isLeaf) {

+ 4 - 4
src/main/webapp/resources/js/prod/controllers/MgrCtrl.js

@@ -6,7 +6,7 @@ define(['app/app'], function(app) {
 		// 不是通过路由过来的,再检查地址栏的参数kindIds
 		if(!$scope.productKinds && $stateParams.kindIds && 
 				/^(\d{1,}_)*(\d){1,}$/.test($stateParams.kindIds)) {
-			$http.get('product/kinds/' + $stateParams.kindIds.replace(/_/g, ','), {
+			$http.get('produce/kinds/' + $stateParams.kindIds.replace(/_/g, ','), {
 				cache: $templateCache
 			}).success(function(kinds){
 				if(kinds.length > 0 && kinds.last().isLeaf) {
@@ -33,7 +33,7 @@ define(['app/app'], function(app) {
 		 */
 		var getKindProperties = function(kindId) {
 			setLoading(true);
-			$http.get('product/kinds/' + kindId + '/properties').success(function(response){
+			$http.get('produce/kinds/' + kindId + '/properties').success(function(response){
 				$scope.properties = response;
 				setLoading(false);
 			});
@@ -140,7 +140,7 @@ define(['app/app'], function(app) {
 					data.push(_p);
 				});
 				setLoading(true);
-				$http.post('product/kinds/' + kindId + '/properties', data).success(function(response){
+				$http.post('produce/kinds/' + kindId + '/properties', data).success(function(response){
 					setLoading(false);
 					toaster.pop('success', '提示', '保存成功!');
 					$scope.properties = response;
@@ -237,7 +237,7 @@ define(['app/app'], function(app) {
 			} ]
 		} ];
 		var getCategories = function(parentId) {
-			return $http.get('product/kinds/' + parentId + '/children_all');
+			return $http.get('produce/kinds/' + parentId + '/children_all');
 		};
 		getCategories(0).success(function(response) {
 			var cates = [];

+ 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);

+ 4 - 4
src/main/webapp/resources/js/prod/data/city.json

@@ -1,5 +1,5 @@
 {
-    "北京": {
+    "北京": {
         "北京市": [
             "东城区",
 		    "西城区",
@@ -19,7 +19,7 @@
 		    "延庆县"         
         ]
     },
-    "上海": {
+    "上海": {
         "上海市": [
 			"黄浦区",
 		    "徐汇区",
@@ -41,7 +41,7 @@
 		    "崇明县"
         ]
     },
-    "天津": {
+    "天津": {
         "天津市": [
 		  	"和平区",
 		    "河东区",
@@ -64,7 +64,7 @@
 		    "蓟县"
         ]
     },
-    "重庆": {
+    "重庆": {
         "重庆市": [
 		  	"万州区",
 		    "涪陵区",

+ 2 - 2
src/main/webapp/resources/js/usercenter/app.js

@@ -1,7 +1,7 @@
 
-define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'common/services', 'common/directives','common/query/kind', 'common/query/brand', 'common/query/component', 'common/query/order', 'common/query/cart', 'common/query/goods', 'common/query/return' ,'angular-toaster', 'common/query/urlencryption', 'ui-jquery', 'common/query/bankTransfer', 'common/query/bankInfo', 'common/query/change', 'common/query/logistics', 'common/query/address' ,'angular-toaster','common/query/collection', 'common/query/proofing', 'common/query/bill', 'common/query/user','file-upload', 'file-upload-shim', 'common/query/bankInfo' , 'common/query/responseLogistics', 'common/query/payment', 'common/query/afterSale', 'common/query/messageBoard', 'common/query/importDeclaration', 'common/query/enterprise', 'common/query/invoice', 'common/query/refund', 'common/query/recommendation', 'common/query/logisticsPort', 'common/query/storeInfo', 'common/query/tradeMessageNotice', 'common/query/tradeBasicProperties', 'common/query/browsingHistory', 'common/query/internalMessage', 'common/module/chat_web_module', 'angular-filter'], function(angularAMD) {
+define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'common/services', 'common/directives','common/query/kind', 'common/query/brand', 'common/query/component', 'common/query/order', 'common/query/cart', 'common/query/goods', 'common/query/return' ,'angular-toaster', 'common/query/urlencryption', 'ui-jquery', 'common/query/bankTransfer', 'common/query/bankInfo', 'common/query/change', 'common/query/logistics', 'common/query/address' ,'angular-toaster','common/query/collection', 'common/query/proofing', 'common/query/bill', 'common/query/user','file-upload', 'file-upload-shim', 'common/query/bankInfo' , 'common/query/responseLogistics', 'common/query/payment', 'common/query/afterSale', 'common/query/messageBoard', 'common/query/importDeclaration', 'common/query/enterprise', 'common/query/invoice', 'common/query/refund', 'common/query/recommendation', 'common/query/logisticsPort', 'common/query/storeInfo', 'common/query/tradeMessageNotice', 'common/query/tradeBasicProperties', 'common/query/browsingHistory', 'common/query/internalMessage', 'common/module/chat_web_module', 'angular-filter', 'common/query/vendor'], function(angularAMD) {
 	'use strict';
-	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ng.local', 'ngTable', 'common.services', 'common.directives', 'tool.directives', 'common.query.kind', 'brandServices', 'componentServices', 'orderServices', 'cartServices', 'goodsServices', 'returnServices' , 'toaster', 'urlencryptionServices', 'ui.jquery', 'bankTransfer', 'bankInfo', 'changeServices', 'logisticsServices', 'addressServices', 'toaster','collection','proofingServices', 'billServices', 'common.query.user', 'angularFileUpload', 'bankInfo', 'responseLogisticsService', 'PaymentService', 'afterSaleService', 'messageBoardServices', 'table.directives', 'importDeclaration', 'common.query.enterprise', 'invoiceServices', 'refundModule', 'recommendation','logisticsPortService', 'storeInfoServices', 'tradeMessageNoticeModule', 'tradeBasicPropertiesServices', 'BrowsingHistory', 'internalMessageServices', 'WebChatModule', 'angular.filter']);
+	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ng.local', 'ngTable', 'common.services', 'common.directives', 'tool.directives', 'common.query.kind', 'brandServices', 'componentServices', 'orderServices', 'cartServices', 'goodsServices', 'returnServices' , 'toaster', 'urlencryptionServices', 'ui.jquery', 'bankTransfer', 'bankInfo', 'changeServices', 'logisticsServices', 'addressServices', 'toaster','collection','proofingServices', 'billServices', 'common.query.user', 'angularFileUpload', 'bankInfo', 'responseLogisticsService', 'PaymentService', 'afterSaleService', 'messageBoardServices', 'table.directives', 'importDeclaration', 'common.query.enterprise', 'invoiceServices', 'refundModule', 'recommendation','logisticsPortService', 'storeInfoServices', 'tradeMessageNoticeModule', 'tradeBasicPropertiesServices', 'BrowsingHistory', 'internalMessageServices', 'WebChatModule', 'angular.filter', 'vendorServices']);
 	app.init = function() {
 		angularAMD.bootstrap(app);
 	};

+ 3 - 3
src/main/webapp/resources/js/usercenter/controllers/forstore/account_manager_ctrl.js

@@ -308,7 +308,7 @@ define(['app/app'], function(app) {
 				var size;
 				if(num == 1) {
 					if ($scope.address.name){
-						size = $scope.address.name.replace(/[^x00-xFF]/g,'**').length;
+						size = $scope.address.name.replace(/[^\x00-\xff]/g,'**').length;
 						if (size > 20) {
 							console.log(size);
 							$scope.userError = true;
@@ -318,7 +318,7 @@ define(['app/app'], function(app) {
 					}
 				} else if(num == 2) {
 					if ($scope.address.tel){
-						size = $scope.address.tel.replace(/[^x00-xFF]/g,'**').length;
+						size = $scope.address.tel.replace(/[^\x00-\xff]/g,'**').length;
 						if (size < 8 || size > 11) {
 							$scope.telError = true;
 							return;
@@ -333,7 +333,7 @@ define(['app/app'], function(app) {
 					}
 				} else if(num == 3) {
 					if ($scope.address.detailAddress){
-						size = $scope.address.detailAddress.replace(/[^x00-xFF]/g,'**').length;
+						size = $scope.address.detailAddress.replace(/[^\x00-\xff]/g,'**').length;
 						if (size > 60) {
 							$scope.addrError = true;
 							return;

+ 19 - 6
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_order_ctrl.js

@@ -717,7 +717,7 @@ define(['app/app'], function (app) {
 	/**
 	 * 与现在的时间对比,距离多少天多少小时
 	 */
-	app.register.filter('restTime', function () {
+	app.register.filter('restTime', ['NumberService', function (NumberService) {
 		var day = 0, hours = 0;
 		return function (time) {
 			if(!time) {
@@ -725,12 +725,25 @@ define(['app/app'], function (app) {
 			}
 			var nowTime = new Date();
 			var s1 = time - nowTime.getTime();
-			var totalHours = s1/(1000*60*60);//算多少个小时
-			day = parseInt(totalHours) / 24;
-			hours = parseInt(totalHours) % 24;
-			return "还剩 " + parseInt(day) + "天" + parseInt(hours) + "小时";
+			if(parseInt(s1) <= 0) {
+				return "到期未付款";
+			}else {
+				var totalHours = Math.ceil(s1/(1000*60*60));//算多少个小时
+				day = parseInt(totalHours) / 24;
+				hours = parseInt(totalHours) % 24;
+				var str = "还剩";
+				if(parseInt(day) > 0) {
+					str = str + parseInt(day) + "天";
+				}
+				if(parseInt(hours) > 0) {
+					str = str + parseInt(hours) + "小时";
+				}
+				return str;
+			}
+
+
 		}
-	});
+	}]);
 
 	/**
 	 * totalHours传入小时,被减去minuesTime转换成天数

+ 21 - 0
src/main/webapp/resources/js/usercenter/controllers/forstore/order_detail_ctrl.js

@@ -27,6 +27,13 @@ define(['app/app'], function(app) {
 			603: true
 		};
 
+		//配送方式列表
+		$scope.deliveryMethod = {
+			1301 : '第三方配送',
+			1302 : '卖家配送',
+			1303 : '上门自提'
+		};
+
 		// TODO 暂时假设运费固定为0
 		$scope.freight = 0;
 
@@ -184,6 +191,17 @@ define(['app/app'], function(app) {
 				}
 				$scope.order = data;
 				$scope.order.orderHistory = angular.fromJson($scope.order.statushistory);
+				if ($scope.order.orderRemark){
+					$scope.remarkList = angular.fromJson($scope.order.orderRemark);
+				}
+				if ($scope.order.jsonRule){
+					$scope.rule = angular.fromJson($scope.order.jsonRule);
+				}
+				//自提点信息
+				if ($scope.order.jsonTakeSelf){
+					$scope.takeSelf = angular.fromJson($scope.order.jsonTakeSelf);
+					$scope.takeSelf.area = $scope.takeSelf.area.replace(/,/g,' ');
+				}
 				// 设置状态样式
 				$scope.stepStyle($scope.order.status);
 				// 获取物流信息
@@ -201,6 +219,9 @@ define(['app/app'], function(app) {
 				//发票信息
 				$scope.order.invoiceInfo = angular.fromJson($scope.order.invoiceAddress);
 
+				// 取消原因
+				$scope.order.unavailableReason = angular.fromJson($scope.order.unavailableReason);
+
 				//收货地址
 				$scope.order.deliveryAddress = angular.fromJson($scope.order.jsonAddress);
 

+ 273 - 57
src/main/webapp/resources/js/usercenter/controllers/forstore/order_pay_ctrl.js

@@ -3,7 +3,7 @@
  *  订单付款的界面
  */
 define(['app/app'], function(app) {
-	app.register.controller('orderPayCtrl', ['$scope', '$rootScope', '$stateParams', '$modal', '$state', 'Bill', 'toaster', 'Order', '$filter', 'ShippingAddress', 'Ysepay', '$q', 'NumberService', 'Cart', '$timeout', function($scope, $rootScope, $stateParams, $modal, $state, Bill, toaster, Order, $filter, ShippingAddress, Ysepay, $q, NumberService, Cart, $timeout) {
+	app.register.controller('orderPayCtrl', ['$scope', '$rootScope', '$stateParams', '$modal', '$state', 'Bill', 'toaster', 'Order', '$filter', 'ShippingAddress', 'Ysepay', '$q', 'NumberService', 'Cart', '$timeout', 'DistributionRule', 'TakeSelf', function($scope, $rootScope, $stateParams, $modal, $state, Bill, toaster, Order, $filter, ShippingAddress, Ysepay, $q, NumberService, Cart, $timeout, DistributionRule, TakeSelf) {
 
 		$rootScope.active = 'buyer_cart';
 
@@ -21,38 +21,38 @@ define(['app/app'], function(app) {
 		$scope.bills = [];
 
 		//获取个人的发票信息
-        var getBillInfo = function() {
-            Bill.getListPersonal(null, function(data) {
-                $scope.bill = {};
-                $scope.bills = data;
+		var getBillInfo = function() {
+			Bill.getListPersonal(null, function(data) {
+				$scope.bill = {};
+				$scope.bills = data;
 				$scope.bill.kind = '1207';
 				$scope.order.invoicetype = '1207';
-                // angular.forEach($scope.bills, function(item) {
-                //     if(item.kind == '1205') {
-                //         $scope.bill = item;
-                //     }
-                // });
-            }, function(response) {
+				// angular.forEach($scope.bills, function(item) {
+				//     if(item.kind == '1205') {
+				//         $scope.bill = item;
+				//     }
+				// });
+			}, function(response) {
 				if(angular.equals('系统错误',  response.data)) {
 					toaster.pop('error', '获取信息失败');
 				}else {
 					toaster.pop('error', '获取订单的信息失败,' + response.data);
 				}
-            });
-        };
+			});
+		};
 
-        $scope.deliveryMethod = {
+		$scope.deliveryMethod = {
 			1301 : '第三方配送',
 			1302 : '卖家配送',
 			1303 : '上门自提'
 		};
 
-        //选择相应的发票信息
+		//选择相应的发票信息
 		$scope.selectBill = function(kind) {
 			if(!kind || (kind != '1205' && kind != '1206' &&  kind != '1207')) {
 				return ;
 			}
-            getTheKindBill(kind);
+			getTheKindBill(kind);
 			$scope.order.invoicetype = kind;
 			$scope.bill.kind = kind;
 		};
@@ -70,19 +70,25 @@ define(['app/app'], function(app) {
 			});
 		};
 
-        //查看价格分段。
-        $scope.togglePrice = function (detail) {
-            detail.display = detail.display == 'block' ? 'none' : 'block';
-        };
+		//查看价格分段。
+		$scope.togglePrice = function (detail) {
+			detail.display = detail.display == 'block' ? 'none' : 'block';
+		};
+
 		//获取订单的信息
 		var getOrderData = function() {
 			return Order.findStatusByOrderid({enOrderid : $stateParams.orderid}, function (response) {
 
+				$scope.storeArray = [];
+				$scope.ruleMap = {};
 				if (response.status == 501){
 					Order.orderContainGoods({enOrderid : $stateParams.orderid}, function(data) {
 						$scope.order = data;
 						$scope.$$orderDetailsMap = {};
-						$scope.remarkList = {};
+						$scope.remarkList = {};//订单备注列表
+						$scope.deliveryList = {};//配送方式列表
+						$scope.takeSelfList = {};
+						$scope.fareList = {};//运费列表
 						if($scope.order.orderDetails.length == 0) {
 							toaster.pop('warning', '您购买的商品已全部失效,请您前往购物车重新勾选');
 							$timeout(function () {
@@ -98,6 +104,9 @@ define(['app/app'], function(app) {
 							}else {
 								$scope.$$orderDetailsMap[detail.storeName] = [];
 								$scope.remarkList[detail.storeid] = "";
+								$scope.deliveryList[detail.storeid] = '';
+								$scope.takeSelfList[detail.storeid] = null;
+								$scope.fareList[detail.storeid] = 0;
 								$scope.$$orderDetailsMap[detail.storeName].push(detail);
 							}
 							$scope.disabledAddAndSub(detail);
@@ -105,7 +114,15 @@ define(['app/app'], function(app) {
 						if($scope.order.status == 501) { //如果不是待确认状态,则不需要计算
 							//计算总价格
 							$scope.calculateTotal();
+							getTakeSelf();
 						}
+						angular.forEach($scope.$$orderDetailsMap, function (value, key) {
+							var object = {
+								uuid : value[0].storeid,
+								fare : $scope.storePrice[key]
+							};
+							$scope.storeArray.push(object);
+						});
 						initOrder();
 					}, function(response) {
 						toaster.pop('error', "获取订单的类型失败。" + response.data);
@@ -116,6 +133,12 @@ define(['app/app'], function(app) {
 					if ($scope.order.orderRemark){
 						$scope.remarkList = angular.fromJson($scope.order.orderRemark);
 					}
+					if ($scope.order.jsonRule){
+						$scope.rule = angular.fromJson($scope.order.jsonRule);
+					}
+					if ($scope.order.jsonTakeSelf){
+						$scope.takeSelf = angular.fromJson($scope.order.jsonTakeSelf);
+					}
 					if($scope.order.orderDetails.length == 0) {
 						$state.go('buyer_order');
 					}
@@ -123,10 +146,20 @@ define(['app/app'], function(app) {
 						if($scope.$$orderDetailsMap[detail.storeName]) {
 							$scope.$$orderDetailsMap[detail.storeName].push(detail);
 						}else {
+							$scope.storeArray.push(detail.storeid);
 							$scope.$$orderDetailsMap[detail.storeName] = [];
 							$scope.$$orderDetailsMap[detail.storeName].push(detail);
 						}
 					});
+					if ($scope.order.jsonMoreRule){
+						$scope.deliveryList = angular.fromJson($scope.order.jsonMoreRule);
+					}
+					if ($scope.order.jsonMoreTake){
+						$scope.takeList = angular.fromJson($scope.order.jsonMoreTake);
+					}
+					if ($scope.storeArray.length != 1){
+						$scope.calculateTotal();
+					}
 					initOrder();
 				}
 			});
@@ -147,6 +180,35 @@ define(['app/app'], function(app) {
 			$scope.contactBNox = false;
 		};
 
+		var getTakeSelf = function () {
+			if ($scope.order.status == 501){
+				TakeSelf.findTakeSelfByStore({}, $scope.storeArray, function (data) {
+					if(data){
+						$scope.takeSelfMap = data;
+					}
+				})
+			}
+		};
+
+		$scope.changeFare = function (details) {
+			var storeid = details[0].storeid;
+			var rule = $scope.deliveryList[storeid];
+			$scope.fareList[storeid] = rule.fare;
+			$scope.calculateFare();
+		};
+
+		/**
+		 * 计算运费和店铺费用合计
+		 */
+		$scope.calculateFare = function () {
+			var fare = 0;
+			angular.forEach($scope.fareList, function (v) {
+				fare = NumberService.add(v, fare);
+			});
+			$scope.order.ensurePrice = NumberService.add($scope.order.totalprice, fare);
+		};
+
+
 		/**
 		 * 获取买家收货地址信息
 		 */
@@ -177,18 +239,47 @@ define(['app/app'], function(app) {
 			$scope.calculatePrice(detail.number, detail, detail.currencyName);
 			//计算总价格
 			$scope.calculateTotal();
-        };
-        //选择收货的地址。
+		};
+		//选择收货的地址。
 		$scope.selectAdd = function(address) {
 			$scope.payment.address = address;
-            $scope.formatArea = $scope.payment.address.area.replace(/,/g,' ');
+			$scope.formatArea = $scope.payment.address.area.replace(/,/g,' ');
+			if ($scope.order.status == 501){
+				DistributionRule.findUsableRule({area:$scope.payment.address.area}, $scope.storeArray, function (data) {
+					if (data){
+						//更换地址后先清空数据
+						$scope.deliveryList = {};
+						$scope.fareList = {};
+						angular.forEach($scope.storeArray, function (item) {
+							$scope.ruleMap[item.uuid] = [];
+							var arr = data[item.uuid];
+							$scope.ruleMap[item.uuid] = arr;
+							if (arr.length != 0){
+								$scope.deliveryList[item.uuid] = arr[0];
+								$scope.fareList[item.uuid] = arr[0].fare;
+							}
+						});
+						$scope.calculateFare();
+					}
+				},function (error) {
+					toaster.pop('info', '提示', error.data);
+				})
+			}
+		};
+
+		$scope.updateTakeSelf = function (uuid, item) {
+			$scope.takeSelfList[uuid] = item;
 		};
 
 		// 添加按钮,每次加1
 		$scope.add = function(detail){
-			var num = NumberService.add(detail.number, detail.goodsHistory.minPackQty);
+			var num = NumberService.add(detail.number, detail.goodsHistory.perQty);
 			if(Number(num) > detail.goodsHistory.reserve) {
-				detail.number = Number(NumberService.sub(detail.goodsHistory.reserve, detail.goodsHistory.reserve %detail.goodsHistory.minPackQty));
+				if(detail.goodsHistory.breakUp) {
+					detail.number = detail.goodsHistory.reserve;
+				}else {
+					detail.number = Number(NumberService.sub(detail.goodsHistory.reserve, detail.goodsHistory.reserve %detail.goodsHistory.minPackQty));
+				}
 				toaster.pop('info','提示','库存不足');
 			}else {
 				detail.number = num;
@@ -197,11 +288,26 @@ define(['app/app'], function(app) {
 			$scope.calculatePrice(detail.number, detail, detail.currencyName);
 			//计算总价格
 			$scope.calculateTotal();
+			updateStoreArray(detail);
+			$q.all([updateFare($scope.ruleMap[detail.storeid], $scope.storePrice[detail.storeName]).$promise]).then(function (data) {
+				if (data){
+					var id = $scope.deliveryList[detail.storeid].id;
+					var arr = data[0];
+					$scope.ruleMap[detail.storeid] = arr;
+					angular.forEach(arr, function (item) {
+						if (item.id == id){
+							$scope.deliveryList[detail.storeid] = item;
+							$scope.fareList[detail.storeid] = item.fare;
+						}
+					});
+					$scope.calculateFare();
+				}
+			});
 		};
 
 		// 减少按钮,每次减minPackQty
 		$scope.reduce = function(detail){
-			var num = NumberService.sub(detail.number, detail.goodsHistory.minPackQty);
+			var num = NumberService.sub(detail.number, detail.goodsHistory.perQty);
 			if(Number(num) < detail.goodsHistory.minBuyQty) {
 				toaster.pop('info', '提示','该商品最少购买' + detail.goodsHistory.minBuyQty + "件");
 				detail.number = detail.goodsHistory.minBuyQty;
@@ -212,6 +318,49 @@ define(['app/app'], function(app) {
 			$scope.calculatePrice(detail.number, detail, detail.currencyName);
 			//计算总价格
 			$scope.calculateTotal();
+			updateStoreArray(detail);
+			$q.all([updateFare($scope.ruleMap[detail.storeid], $scope.storePrice[detail.storeName]).$promise]).then(function (data) {
+				if (data){
+					var id = $scope.deliveryList[detail.storeid].id;
+					var arr = data[0];
+					$scope.ruleMap[detail.storeid] = arr;
+					angular.forEach(arr, function (item) {
+						if (item.id == id){
+							$scope.deliveryList[detail.storeid] = item;
+							$scope.fareList[detail.storeid] = item.fare;
+						}
+					});
+					$scope.calculateFare();
+				}
+			});
+
+		};
+
+		/**
+		 * 更新配送规则请求参数
+		 */
+		var updateStoreArray = function (detail) {
+			angular.forEach($scope.storeArray, function (item) {
+				if (item.uuid == detail.storeid){
+					item.fare = $scope.storePrice[detail.storeName];
+				}
+			})
+		};
+
+		/**
+		 * 更新运费列表
+		 * @param ruleList
+		 * @param price
+		 * @returns {*|{url, method, isArray}}
+		 */
+		var updateFare = function (ruleList, price) {
+			return DistributionRule.findFareOfRule({price:price}, ruleList, function (data) {
+				if (data){
+
+				}
+			}, function (error) {
+				// toaster.pop("error", error.data);
+			})
 		};
 
 		// 输入购买量限制
@@ -221,31 +370,83 @@ define(['app/app'], function(app) {
 				toaster.pop("info", "提示", "该商品最少购买" + detail.goodsHistory.minBuyQty + "件");
 				detail.number = detail.goodsHistory.minBuyQty;
 			}else if(detail.number > detail.goodsHistory.reserve){
-				detail.number = Number(NumberService.sub(detail.goodsHistory.reserve, detail.goodsHistory.reserve %detail.goodsHistory.minPackQty));
+				if(detail.goodsHistory.breakUp) {
+					detail.number = detail.goodsHistory.reserve;
+				}else{
+					detail.number = Number(NumberService.sub(detail.goodsHistory.reserve, detail.goodsHistory.reserve %detail.goodsHistory.minPackQty));
+				}
 				toaster.pop('info', '提示','库存不足');
+			}else {
+				if(!detail.goodsHistory.breakUp) {
+					var remandar = detail.number % detail.goodsHistory.minPackQty;
+					if(remandar != 0) {
+						detail.number = Number(NumberService.add(NumberService.sub(detail.number, detail.number % detail.goodsHistory.minPackQty), detail.goodsHistory.minPackQty));
+						if(detail.number > detail.goodsHistory.reserve) {
+							detail.number = NumberService.sub(detail.goodsHistory.reserve, detail.goodsHistory.reserve % detail.goodsHistory.minPackQty);
+						}
+					}
+				}
 			}
 			$scope.disabledAddAndSub(detail);
 			$scope.calculatePrice(detail.number, detail, detail.currencyName);
 			//计算总价格
 			$scope.calculateTotal();
+			updateStoreArray(detail);
+			$q.all([updateFare($scope.ruleMap[detail.storeid], $scope.storePrice[detail.storeName]).$promise]).then(function (data) {
+				if (data){
+					var id = $scope.deliveryList[detail.storeid].id;
+					var arr = data[0];
+					$scope.ruleMap[detail.storeid] = arr;
+					angular.forEach(arr, function (item) {
+						if (item.id == id){
+							$scope.deliveryList[detail.storeid] = item;
+							$scope.fareList[detail.storeid] = item.fare;
+						}
+					});
+					$scope.calculateFare();
+				}
+			});
 		};
 
 		/**
 		 * 是否失效- +
 		 */
 		$scope.disabledAddAndSub = function(detail) {
-			if((Number(detail.number) - Number(detail.goodsHistory.minPackQty)) < Number(detail.goodsHistory.minBuyQty)) {
+			if((Number(detail.number) - Number(detail.goodsHistory.perQty)) < Number(detail.goodsHistory.minBuyQty)) {
 				detail.minusDisabled = true;
 			}else {
 				detail.minusDisabled = false;
 			}
-			if(Number(detail.number) + Number(detail.goodsHistory.minPackQty) > Number(detail.goodsHistory.reserve)) {
+			if(Number(detail.number) + Number(detail.goodsHistory.perQty) > Number(detail.goodsHistory.reserve)) {
 				detail.addDisabled = true;
 			}else {
 				detail.addDisabled = false;
 			}
 		};
 
+		//验证配送规则
+		var checkRule = function () {
+			var value = true;
+			angular.forEach($scope.ruleMap, function (v) {
+				if (v.length == 0){
+					value = false;
+				}
+			});
+			return value;
+		};
+		//验证是否选择上门自提,却没有选择自提点
+		var checkTakeSelf = function () {
+			var value = true;
+			angular.forEach($scope.deliveryList, function (v, k) {
+				if (v.method == 1303){
+					if ($scope.takeSelfList[k] == null){
+						value = false;
+					}
+				}
+			});
+			return value;
+		};
+
 		//确认付款
 		$scope.confirmPay = function() {
 			if($scope.order.status == 502 || $scope.order.status == 503) {
@@ -264,6 +465,16 @@ define(['app/app'], function(app) {
 				}
 				return ;
 			}
+			var validRule = checkRule();
+			if (!validRule){
+				toaster.pop("info", "当前地址部分卖家无法配送,请重新选择地址或与卖家协商处理");
+				return ;
+			}
+			var validTakeSelf = checkTakeSelf();
+			if (!validTakeSelf){
+				toaster.pop("info", "请选择一个自提点");
+				return ;
+			}
 			var orderInfos = [], orderInfo;
 			orderInfo = generateOrderInfo();
 			if(orderInfo == null) {
@@ -347,7 +558,7 @@ define(['app/app'], function(app) {
 
 			orderInfo.id = $scope.order.id;
 			orderInfo.orderid = $scope.order.orderid;
-			orderInfo.deliverytype = $scope.order.deliverytype; // 配送方式
+			// orderInfo.deliverytype = $scope.order.deliverytype; // 配送方式
 
 			if($scope.order.currency == 'USD' && $scope.order.paytype == '1102') {
 				toaster.pop('info', '美元请线下付款');
@@ -359,7 +570,8 @@ define(['app/app'], function(app) {
 			}
 
 			// 收货地址,上门自提暂不提供
-			if($scope.order.deliverytype == '1301'){
+			if($scope.deliveryList){
+				console.log("进来了");
 				/*var address = angular.fromJson($scope.selectAddress);
 				 delete address.isSelect;
 				 orderInfo.jsonAddress = angular.toJson(address);*/
@@ -379,9 +591,10 @@ define(['app/app'], function(app) {
 					}
 				}
 				orderInfo.add_id = $scope.payment.address.id;
-			}else if($scope.order.deliverytype == '1302'){
-				orderInfo.add_id = $scope.pickAddress.id;
 			}
+			// else if($scope.order.deliverytype == '1302'){
+			// 	orderInfo.add_id = $scope.pickAddress.id;
+			// }
 			orderInfo.invoicetype = $scope.order.invoicetype; // 发票类型
 			if($scope.order.invoicetype != '1207') {
 				if(!$scope.bill.id) {
@@ -391,11 +604,14 @@ define(['app/app'], function(app) {
 				orderInfo.invoiceid = $scope.bill.id; // 发票主键
 			}
 
-			orderInfo.totalprice = $scope.order.ensurePrice; // 应付总额
+			orderInfo.totalprice = $scope.order.totalprice; // 应付总额,不含运费
 			orderInfo.currency = $scope.order.currency; // 币别
-			orderInfo.orderRemark = angular.toJson($scope.remarkList);
-			// console.log(orderInfo.orderRemark);
-			// orderInfo.orderRemark = $scope.order.orderRemark; // 交易备注
+			orderInfo.orderRemark = angular.toJson($scope.remarkList);//订单备注
+			orderInfo.splitInfo = {
+				ruleList : angular.toJson($scope.deliveryList),
+				takeList : angular.toJson($scope.takeSelfList)
+			};
+
 			orderInfo.paytype =  $scope.order.paytype;
 			orderInfo.orderDetails = convertOrderDetails(); // 订单明细信息:id、number
 
@@ -411,6 +627,7 @@ define(['app/app'], function(app) {
 					number: v.number,
 					taxUnitprice: v.taxUnitprice,
 					remark : v.remark,
+					goodsnumber : v.goodsnumber,
 					storeid : v.storeid
 				});
 			});
@@ -433,13 +650,13 @@ define(['app/app'], function(app) {
 			}
 			// 人民币为专用增值税发票,美元不开发票    --1205专用增值税发票   --1206普通发票  --1207不开发票
 			if($scope.order.currency == 'USD') {
-			    $scope.order.invoicetype = 1207;
+				$scope.order.invoicetype = 1207;
 				$scope.order.paytype = '1103';
 			}else {
-			    $scope.order.invoicetype = 1205;
+				$scope.order.invoicetype = 1205;
 				$scope.order.paytype = '1102';
 			}
-			// 默认选择UU配送  --1301UU配送  --1302上门自提
+			// 默认选择第三方配送  --1301第三方配送 --卖家配送  --1303上门自提
 			$scope.order.deliverytype = 1301;
 
 			//获取地址的信息
@@ -484,8 +701,7 @@ define(['app/app'], function(app) {
 						$scope.sendAddress.push(address);
 					}
 				}
-				$scope.payment.address = address;
-				$scope.formatArea = $scope.payment.address.area.replace(/,/g,' ');
+				$scope.selectAdd(address);
 			}, function(){
 				toaster.pop('info', '提示 ' + '您已取消收货地址的编辑');
 			});
@@ -520,13 +736,13 @@ define(['app/app'], function(app) {
 
 
 			// 获取当前数量的对应价格区间的单据信息
-            if(properPrice.length > 0) {
-                detail.usdUnitPrice = properPrice[0].uSDPrice;
-                detail.rmbUnitPrice = properPrice[0].rMBPrice;
-            }else {
-                detail.usdUnitPrice = detail.goodsHistory.prices[detail.goodsHistory.prices.length - 1].uSDPrice;
-                detail.rmbUnitPrice = detail.goodsHistory.prices[detail.goodsHistory.prices.length - 1].rMBPrice;
-            }
+			if(properPrice.length > 0) {
+				detail.usdUnitPrice = properPrice[0].uSDPrice;
+				detail.rmbUnitPrice = properPrice[0].rMBPrice;
+			}else {
+				detail.usdUnitPrice = detail.goodsHistory.prices[detail.goodsHistory.prices.length - 1].uSDPrice;
+				detail.rmbUnitPrice = detail.goodsHistory.prices[detail.goodsHistory.prices.length - 1].rMBPrice;
+			}
 
 			if (currency == 'RMB') {
 				detail.taxUnitprice = detail.rmbUnitPrice;
@@ -539,7 +755,7 @@ define(['app/app'], function(app) {
 		 * 计算总金额
 		 */
 		$scope.calculateTotal = function () {
-			$scope.order.ensurePrice = 0;
+			$scope.order.totalprice = 0;
 			$scope.storePrice = {};
 			angular.forEach($scope.order.orderDetails, function(detail) {
 				detail.ensurePrice = Number(NumberService.mul(detail.taxUnitprice, detail.number));
@@ -550,7 +766,7 @@ define(['app/app'], function(app) {
 			});
 			angular.forEach($scope.$$orderDetailsMap, function (value, key) {
 				$scope.storePrice[key] = Number(NumberService.toCeil($scope.storePrice[key], 2));
-				$scope.order.ensurePrice = NumberService.add($scope.storePrice[key], $scope.order.ensurePrice)
+				$scope.order.totalprice = NumberService.add($scope.storePrice[key], $scope.order.totalprice)
 			});
 		};
 
@@ -595,7 +811,7 @@ define(['app/app'], function(app) {
 		$scope.isModify = isModify;
 		$scope.validEmail = function (email) {
 			return /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(email)
-        };
+		};
 
 		$http.get('static/js/prod/data/city.json').success(function(data) {
 			$scope.division = data;
@@ -613,12 +829,12 @@ define(['app/app'], function(app) {
 			toaster.pop('error', '系统错误 ' + '加载城市信息失败');
 		});
 
-        //验证数据
+		//验证数据
 		$scope.checkForm = function(num) {
 			var size;
 			if(num == 1) {
 				if ($scope.address.name){
-					size = $scope.address.name.replace(/[^x00-xFF]/g,'**').length;
+					size = $scope.address.name.replace(/[^\x00-\xff]/g,'**').length;
 					if (size > 20) {
 						$scope.userError = true;
 						return;
@@ -627,7 +843,7 @@ define(['app/app'], function(app) {
 				}
 			} else if(num == 2) {
 				if ($scope.address.tel){
-					size = $scope.address.tel.replace(/[^x00-xFF]/g,'**').length;
+					size = $scope.address.tel.replace(/[^\x00-\xff]/g,'**').length;
 					if (size < 8 || size > 11) {
 						$scope.telError = true;
 						return;
@@ -642,7 +858,7 @@ define(['app/app'], function(app) {
 				}
 			} else if(num == 3) {
 				if ($scope.address.detailAddress){
-					size = $scope.address.detailAddress.replace(/[^x00-xFF]/g,'**').length;
+					size = $scope.address.detailAddress.replace(/[^\x00-\xff]/g,'**').length;
 					if (size > 60) {
 						$scope.addrError = true;
 						return;

+ 1 - 1
src/main/webapp/resources/js/usercenter/controllers/forstore/query_logistics_ctrl.js

@@ -58,7 +58,7 @@ define(['app/app', 'calendar'], function(app) {
                 str.indexOf("发出")!=-1||str.indexOf("收入")!=-1||str.indexOf("扫描")!=-1||str.indexOf("到达")!=-1){
                 $scope.status = "transit";
             }
-            if(str.indexOf("派送")!=-1){
+            if(str.indexOf("派送")!=-1 || str.indexOf("派件")!=-1){
                 $scope.status = "send";
             }
             if(str.indexOf("签收")!=-1){

+ 1 - 1
src/main/webapp/resources/js/usercenter/controllers/forstore/shipping_address_edit_ctrl.js

@@ -146,7 +146,7 @@ define(['app/app'], function(app) {
 			// }else {
 			//     if(!$scope.order.invoicetype) $scope.order.invoicetype = 1205;
 			// }
-			// 默认选择UU配送  --1301UU配送  --1302上门自提
+			// 默认选择UU配送  --1301第三方配送  --1302卖家配送 --1303上门自提
 			if(!$scope.order.deliverytype) $scope.order.deliverytype = 1301;
 		};
 

+ 8 - 1
src/main/webapp/resources/js/vendor/app.js

@@ -467,7 +467,8 @@ define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'commo
 			// templateUrl : 'static/view/vendor/forstore/vendor_upload.html',
 			// controllerUrl : "app/controllers/forstore/vendor_upload_ctrl",
 			// controller : 'vendorUploadCtrl'
-			templateUrl : 'static/view/vendor/forstore/vendor_productOn.html',
+			// templateUrl : 'static/view/vendor/forstore/vendor_productOn.html',
+			templateUrl : 'static/view/vendor/forstore/product_file.html',
 			controllerUrl : "app/controllers/forstore/vendor_productOn_ctrl",
 			controller : 'vendorProductOnCtrl'
 		})).state('product_repository', angularAMD.route({
@@ -538,6 +539,12 @@ define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'commo
 			templateUrl : 'static/view/vendor/forstore/vendor_take_self.html',
 			controller: 'vendorTakeSelfCtrl',
 			controllerUrl: 'app/controllers/forstore/vendor_takeSelf_ctrl'
+		})).state('vendor_deliveryRule_add', angularAMD.route({
+			title : '新增配送规则',
+			url: '/vendor_deliveryRule_add?rule',
+			templateUrl : 'static/view/vendor/forstore/vendor_delivery_add_rule.html',
+			controller: 'vendorDeliveryRuleAddCtrl',
+			controllerUrl: 'app/controllers/forstore/vendor_deliveryRule_add_ctrl'
 		})).state('messagePersonal', angularAMD.route({
 			url: '/messagePersonal',
 			templateUrl: 'static/view/vendor/forstore/messagePersonal.html',

+ 2 - 2
src/main/webapp/resources/js/vendor/controllers/ComponentBatchCreateCtrl.js

@@ -282,14 +282,14 @@ define(['app/app'], function(app) {
 					return;
 				}
 			}
-			downloadByJs('product/componentSubmit/template', $scope.submits);
+			downloadByJs('produce/componentSubmit/template', $scope.submits);
 		};
 		
 		// 上传Excel批量发布(大量)
 		$scope.upload = function() {
 			var file = $scope.myFiles[0];
 			$upload.upload({
-				url: 'product/componentSubmit/upload/excel',
+				url: 'produce/componentSubmit/upload/excel',
 				file: file,
 				method: 'POST'
 			}).success(function(data) {

+ 1 - 1
src/main/webapp/resources/js/vendor/controllers/PutOnCtrl.js

@@ -134,7 +134,7 @@ define([ 'app/app'], function(app) {
 			}).result.then(function(data){
 				$scope.active = data.active;
 				/*$scope.actives = data.actives;*/
-				window.location.href = 'product/kind/' + $scope.active.id + '/putOn';
+				window.location.href = 'produce/kind/' + $scope.active.id + '/putOn';
 			}, function(){
 
 			});

+ 24 - 1
src/main/webapp/resources/js/vendor/controllers/forstore/purchase_detail.js

@@ -155,6 +155,12 @@ define(['app/app'], function(app) {
 			603: true
 		};
 
+		//配送方式列表
+		$scope.deliveryMethod = {
+			1301 : '第三方配送',
+			1302 : '卖家配送',
+			1303 : '上门自提'
+		};
 
 
 
@@ -174,6 +180,16 @@ define(['app/app'], function(app) {
 				$scope.purchase = result.data;
 				$scope.purchase.purchaseHistory = angular.fromJson($scope.purchase.statushistory);
 				$scope.purchase.currentTotal = $scope.purchase.price;
+				if ($scope.purchase.jsonRule){
+					$scope.rule = angular.fromJson($scope.purchase.jsonRule);
+				}
+				//自提点信息
+				if ($scope.purchase.jsonTakeSelf){
+					$scope.takeSelf = angular.fromJson($scope.purchase.jsonTakeSelf);
+					$scope.takeSelf.area = $scope.takeSelf.area.replace(/,/g,' ');
+				}
+				// 取消原因
+				$scope.purchase.unavailableReason = angular.fromJson($scope.purchase.unavailableReason)
 				// 设置状态样式
 				$scope.stepStyle($scope.purchase.status);
 				// 获取物流信息
@@ -193,12 +209,16 @@ define(['app/app'], function(app) {
 		}
 
 		$scope.updateTotal = function (data) {
+			if (data.currentTaxUnitPrice == null){
+				data.currentTaxUnitPrice = 0.000001;
+				return;
+			}
 			if (isNaN(data.currentTaxUnitPrice)){
 				data.currentTaxUnitPrice = 0.000001;
 				toaster.pop('warning', '提示', '输入的价格必须是数字');
 				return ;
 			}
-			if (Number(data.currentTaxUnitPrice) <= 0){
+			if (Number(data.currentTaxUnitPrice) < 0){
 				data.currentTaxUnitPrice = 0.000001;
 			}
 			if (Number(data.currentTaxUnitPrice) > 100000){
@@ -209,6 +229,8 @@ define(['app/app'], function(app) {
 			angular.forEach($scope.purchase.purchaseDetails, function (detail) {
 				$scope.purchase.currentTotal += detail.currentTaxUnitPrice * detail.number;
 			});
+			//加上运费
+			$scope.purchase.currentTotal = NumberService.add($scope.purchase.currentTotal, $scope.purchase.fare);
 			$scope.purchase.currentTotal = Number(NumberService.toCeil($scope.purchase.currentTotal, 2));
 		};
 
@@ -219,6 +241,7 @@ define(['app/app'], function(app) {
 			angular.forEach($scope.purchase.purchaseDetails, function (detail) {
 				detail.currentTaxUnitPrice = detail.taxUnitPrice;
 			});
+			$scope.purchase.currentTotal = $scope.purchase.ensurePrice;
         };
 
         // 取消

+ 2 - 2
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_component_batchapply_ctrl.js

@@ -280,14 +280,14 @@ define(['app/app'], function(app) {
                     return;
                 }
             }
-            downloadByJs('product/componentSubmit/template', $scope.submits);
+            downloadByJs('produce/componentSubmit/template', $scope.submits);
         };
 
         // 上传Excel批量发布(大量)
         $scope.upload = function() {
             var file = $scope.myFiles[0];
             $upload.upload({
-                url: 'product/componentSubmit/upload/excel',
+                url: 'produce/componentSubmit/upload/excel',
                 file: file,
                 method: 'POST'
             }).success(function(data) {

Some files were not shown because too many files changed in this diff