Browse Source

初始化git

suntg 8 years ago
commit
ffefc5d8f1
100 changed files with 8888 additions and 0 deletions
  1. 58 0
      .gitignore
  2. 2 0
      Readme.md
  3. 667 0
      pom.xml
  4. 120 0
      src/main/java/Readme.md
  5. 23 0
      src/main/java/com/uas/platform/b2c/advertise/ad/Readme.md
  6. 36 0
      src/main/java/com/uas/platform/b2c/advertise/ad/api/CarouselsController.java
  7. 59 0
      src/main/java/com/uas/platform/b2c/advertise/ad/api/CommodityController.java
  8. 39 0
      src/main/java/com/uas/platform/b2c/advertise/ad/api/FloorsController.java
  9. 49 0
      src/main/java/com/uas/platform/b2c/advertise/ad/api/HotComponentController.java
  10. 73 0
      src/main/java/com/uas/platform/b2c/advertise/ad/api/StoreCmsController.java
  11. 44 0
      src/main/java/com/uas/platform/b2c/advertise/ad/api/StoreContentController.java
  12. 58 0
      src/main/java/com/uas/platform/b2c/advertise/ad/api/StoreRecommendController.java
  13. 42 0
      src/main/java/com/uas/platform/b2c/advertise/ad/controller/AuthStoreCmsController.java
  14. 17 0
      src/main/java/com/uas/platform/b2c/advertise/ad/dao/StoreContentDao.java
  15. 371 0
      src/main/java/com/uas/platform/b2c/advertise/ad/model/AdvantageCommodity.java
  16. 11 0
      src/main/java/com/uas/platform/b2c/advertise/ad/model/ContentType.java
  17. 170 0
      src/main/java/com/uas/platform/b2c/advertise/ad/model/HotComponent.java
  18. 76 0
      src/main/java/com/uas/platform/b2c/advertise/ad/model/Message.java
  19. 274 0
      src/main/java/com/uas/platform/b2c/advertise/ad/model/RecommendProduct.java
  20. 354 0
      src/main/java/com/uas/platform/b2c/advertise/ad/model/StoreCms.java
  21. 178 0
      src/main/java/com/uas/platform/b2c/advertise/ad/model/StoreContent.java
  22. 33 0
      src/main/java/com/uas/platform/b2c/advertise/ad/service/AdvantageCommodityService.java
  23. 23 0
      src/main/java/com/uas/platform/b2c/advertise/ad/service/AuthStoreCmsService.java
  24. 22 0
      src/main/java/com/uas/platform/b2c/advertise/ad/service/CarouselService.java
  25. 22 0
      src/main/java/com/uas/platform/b2c/advertise/ad/service/FloorsService.java
  26. 23 0
      src/main/java/com/uas/platform/b2c/advertise/ad/service/HotComponentService.java
  27. 32 0
      src/main/java/com/uas/platform/b2c/advertise/ad/service/RecommendProductService.java
  28. 43 0
      src/main/java/com/uas/platform/b2c/advertise/ad/service/StoreCmsService.java
  29. 25 0
      src/main/java/com/uas/platform/b2c/advertise/ad/service/StoreContentService.java
  30. 74 0
      src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/AdvantageCommodityServiceImpl.java
  31. 57 0
      src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/AuthStoreCmsServiceImpl.java
  32. 39 0
      src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/CarouselsServiceImpl.java
  33. 38 0
      src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/FloorsServiceImpl.java
  34. 43 0
      src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/HotComponentServiceImpl.java
  35. 83 0
      src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/RecommendProductServiceImpl.java
  36. 97 0
      src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/StoreCmsServiceImpl.java
  37. 51 0
      src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/StoreContentServiceImpl.java
  38. 42 0
      src/main/java/com/uas/platform/b2c/advertise/ad/utils/RecommendProductsUtils.java
  39. 19 0
      src/main/java/com/uas/platform/b2c/advertise/news/Readme.md
  40. 61 0
      src/main/java/com/uas/platform/b2c/advertise/news/api/NewsController.java
  41. 35 0
      src/main/java/com/uas/platform/b2c/advertise/news/service/NewsService.java
  42. 53 0
      src/main/java/com/uas/platform/b2c/advertise/news/service/impl/NewsServiceImpl.java
  43. 19 0
      src/main/java/com/uas/platform/b2c/analysis/bi/Readme.md
  44. 19 0
      src/main/java/com/uas/platform/b2c/analysis/stat/Readme.md
  45. 55 0
      src/main/java/com/uas/platform/b2c/analysis/stat/controller/VendorSaleStatController.java
  46. 28 0
      src/main/java/com/uas/platform/b2c/analysis/stat/dao/VendorSaleStatDayDao.java
  47. 27 0
      src/main/java/com/uas/platform/b2c/analysis/stat/dao/VendorSaleStatMonthDao.java
  48. 27 0
      src/main/java/com/uas/platform/b2c/analysis/stat/dao/VendorSaleStatYearDao.java
  49. 147 0
      src/main/java/com/uas/platform/b2c/analysis/stat/model/VendorSaleStatDay.java
  50. 140 0
      src/main/java/com/uas/platform/b2c/analysis/stat/model/VendorSaleStatMonth.java
  51. 116 0
      src/main/java/com/uas/platform/b2c/analysis/stat/model/VendorSaleStatYear.java
  52. 38 0
      src/main/java/com/uas/platform/b2c/analysis/stat/service/VendorSaleStatService.java
  53. 72 0
      src/main/java/com/uas/platform/b2c/analysis/stat/service/impl/VendorSaleStatServiceImpl.java
  54. 19 0
      src/main/java/com/uas/platform/b2c/common/account/Readme.md
  55. 120 0
      src/main/java/com/uas/platform/b2c/common/account/api/AuthedWebPageController.java
  56. 109 0
      src/main/java/com/uas/platform/b2c/common/account/api/TokenController.java
  57. 42 0
      src/main/java/com/uas/platform/b2c/common/account/controller/AuthenticationController.java
  58. 93 0
      src/main/java/com/uas/platform/b2c/common/account/controller/EnterpriseController.java
  59. 270 0
      src/main/java/com/uas/platform/b2c/common/account/controller/SecurityController.java
  60. 242 0
      src/main/java/com/uas/platform/b2c/common/account/controller/UserController.java
  61. 73 0
      src/main/java/com/uas/platform/b2c/common/account/controller/VendorController.java
  62. 22 0
      src/main/java/com/uas/platform/b2c/common/account/dao/EnterpriseDao.java
  63. 11 0
      src/main/java/com/uas/platform/b2c/common/account/dao/ErpB2cLogDao.java
  64. 10 0
      src/main/java/com/uas/platform/b2c/common/account/dao/ResourceItemDao.java
  65. 15 0
      src/main/java/com/uas/platform/b2c/common/account/dao/SigninLogDao.java
  66. 11 0
      src/main/java/com/uas/platform/b2c/common/account/dao/TradeLogDao.java
  67. 11 0
      src/main/java/com/uas/platform/b2c/common/account/dao/UsageLogDao.java
  68. 31 0
      src/main/java/com/uas/platform/b2c/common/account/dao/UserBaseInfoDao.java
  69. 113 0
      src/main/java/com/uas/platform/b2c/common/account/dao/UserDao.java
  70. 381 0
      src/main/java/com/uas/platform/b2c/common/account/model/Enterprise.java
  71. 218 0
      src/main/java/com/uas/platform/b2c/common/account/model/ErpB2cLog.java
  72. 86 0
      src/main/java/com/uas/platform/b2c/common/account/model/Resource.java
  73. 93 0
      src/main/java/com/uas/platform/b2c/common/account/model/ResourceItem.java
  74. 171 0
      src/main/java/com/uas/platform/b2c/common/account/model/Role.java
  75. 147 0
      src/main/java/com/uas/platform/b2c/common/account/model/SigninLog.java
  76. 203 0
      src/main/java/com/uas/platform/b2c/common/account/model/TradeLog.java
  77. 236 0
      src/main/java/com/uas/platform/b2c/common/account/model/UsageLog.java
  78. 369 0
      src/main/java/com/uas/platform/b2c/common/account/model/User.java
  79. 96 0
      src/main/java/com/uas/platform/b2c/common/account/model/UserBaseInfo.java
  80. 145 0
      src/main/java/com/uas/platform/b2c/common/account/model/UserInfo.java
  81. 45 0
      src/main/java/com/uas/platform/b2c/common/account/service/EnterpriseService.java
  82. 18 0
      src/main/java/com/uas/platform/b2c/common/account/service/ErpB2cLogService.java
  83. 13 0
      src/main/java/com/uas/platform/b2c/common/account/service/LogService.java
  84. 23 0
      src/main/java/com/uas/platform/b2c/common/account/service/SigninLogService.java
  85. 8 0
      src/main/java/com/uas/platform/b2c/common/account/service/TradeLogService.java
  86. 21 0
      src/main/java/com/uas/platform/b2c/common/account/service/UsageAopLogService.java
  87. 18 0
      src/main/java/com/uas/platform/b2c/common/account/service/UsageLogService.java
  88. 106 0
      src/main/java/com/uas/platform/b2c/common/account/service/UserService.java
  89. 40 0
      src/main/java/com/uas/platform/b2c/common/account/service/VendorService.java
  90. 171 0
      src/main/java/com/uas/platform/b2c/common/account/service/impl/EnterpriseServiceImpl.java
  91. 45 0
      src/main/java/com/uas/platform/b2c/common/account/service/impl/ErpB2cLogServiceImpl.java
  92. 38 0
      src/main/java/com/uas/platform/b2c/common/account/service/impl/LogServiceImpl.java
  93. 25 0
      src/main/java/com/uas/platform/b2c/common/account/service/impl/SigninLogServiceImpl.java
  94. 29 0
      src/main/java/com/uas/platform/b2c/common/account/service/impl/TradeLogServiceImpl.java
  95. 50 0
      src/main/java/com/uas/platform/b2c/common/account/service/impl/UsageAopLogServiceImpl.java
  96. 44 0
      src/main/java/com/uas/platform/b2c/common/account/service/impl/UsageLogServiceImpl.java
  97. 376 0
      src/main/java/com/uas/platform/b2c/common/account/service/impl/UserServiceImpl.java
  98. 112 0
      src/main/java/com/uas/platform/b2c/common/account/service/impl/VendorServiceImpl.java
  99. 26 0
      src/main/java/com/uas/platform/b2c/common/account/support/AuthenErrors.java
  100. 19 0
      src/main/java/com/uas/platform/b2c/common/base/Readme.md

+ 58 - 0
.gitignore

@@ -0,0 +1,58 @@
+# Eclipse
+.metadata/
+.settings/
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+*~.nib
+.project
+.classpath
+.loadpath
+
+## External tool builders
+.externalToolBuilders/
+
+## Locally stored "Eclipse launch configurations"
+*.launch
+
+## Java annotation processor (APT)
+.factorypath
+
+## STS (Spring Tool Suite)
+.springBeans
+
+# IntelliJ
+.idea/
+*.iml
+
+## File-based project format
+*.iws
+
+# Java
+## Compiled class file
+*.class
+
+## Log file
+*.log
+*.log.*
+
+## Package files
+*.jar
+
+## Virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+# Maven
+target/
+log/
+
+## Maven release plugin
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties

+ 2 - 0
Readme.md

@@ -0,0 +1,2 @@
+# Platform B2C
+This is the Platform B2C project, alias UsotfMall.

+ 667 - 0
pom.xml

@@ -0,0 +1,667 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<artifactId>platform-b2c</artifactId>
+	<packaging>war</packaging>
+	<name>platform-b2c Maven Webapp</name>
+	<url>http://maven.apache.org</url>
+	<parent>
+		<groupId>com.uas.platform</groupId>
+		<artifactId>platform</artifactId>
+		<version>0.0.1-SNAPSHOT</version>
+		<relativePath>../platform</relativePath>
+	</parent>
+	<profiles>
+		<profile>
+			<!-- 开发环境 -->
+			<id>dev</id>
+			<properties>
+				<profile>dev</profile>
+				<!-- static plugin -->
+				<static-path>static</static-path>
+			</properties>
+			<!-- 默认 -->
+			<activation>
+				<activeByDefault>true</activeByDefault>
+			</activation>
+		</profile>
+		<profile>
+			<!-- 测试环境 -->
+			<id>test</id>
+			<properties>
+				<profile>test</profile>
+				<!-- static plugin -->
+				<static-path>static</static-path>
+			</properties>
+		</profile>
+		<profile>
+			<!-- 生产环境 -->
+			<id>prod</id>
+			<properties>
+				<profile>prod</profile>
+				<!-- static plugin -->
+				<static-path>http://static.usoftmall.com</static-path>
+			</properties>
+		</profile>
+	</profiles>
+	<dependencies>
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>servlet-api</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>log4j</groupId>
+			<artifactId>log4j</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.uas.platform</groupId>
+			<artifactId>platform-core</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.uas.api</groupId>
+			<artifactId>b2c-erp-api</artifactId>
+			<version>0.0.2</version>
+		</dependency>
+		<dependency>
+			<groupId>com.uas.api</groupId>
+			<artifactId>b2c-manage-api</artifactId>
+			<version>0.0.1</version>
+		</dependency>
+		<dependency>
+			<groupId>com.caucho</groupId>
+			<artifactId>hessian</artifactId>
+		</dependency>
+		<!-- spring -->
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-core</artifactId>
+			<exclusions>
+				<exclusion>
+					<groupId>commons-logging</groupId>
+					<artifactId>commons-logging</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-context</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-context-support</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-webmvc</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-jdbc</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-tx</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-aop</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-aspects</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-test</artifactId>
+			<version>4.1.6.RELEASE</version>
+		</dependency>
+		<!-- jpa -->
+		<dependency>
+			<groupId>org.springframework.data</groupId>
+			<artifactId>spring-data-jpa</artifactId>
+		</dependency>
+		<!-- mongodb spring -->
+		<dependency>
+			<groupId>org.springframework.data</groupId>
+			<artifactId>spring-data-mongodb</artifactId>
+			<version>1.5.2.RELEASE</version>
+		</dependency>
+		<!-- xstream -->
+		<dependency>
+			<groupId>com.thoughtworks.xstream</groupId>
+			<artifactId>xstream</artifactId>
+			<version>1.3.1</version>
+		</dependency>
+		<!-- fileupload -->
+		<dependency>
+			<groupId>commons-fileupload</groupId>
+			<artifactId>commons-fileupload</artifactId>
+			<version>1.3.1</version>
+		</dependency>
+		<!-- hibernate -->
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-core</artifactId>
+			<exclusions>
+				<exclusion>
+					<groupId>xml-apis</groupId>
+					<artifactId>xml-apis</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-entitymanager</artifactId>
+			<exclusions>
+				<exclusion>
+					<groupId>cglib</groupId>
+					<artifactId>cglib</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>dom4j</groupId>
+					<artifactId>dom4j</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency>
+			<groupId>org.hibernate.javax.persistence</groupId>
+			<artifactId>hibernate-jpa-2.1-api</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>commons-collections</groupId>
+			<artifactId>commons-collections</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-validator</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>jcl-over-slf4j</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-log4j12</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.aspectj</groupId>
+			<artifactId>aspectjrt</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.aspectj</groupId>
+			<artifactId>aspectjweaver</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.commons</groupId>
+			<artifactId>commons-lang3</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>javax.validation</groupId>
+			<artifactId>validation-api</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>javax.transaction</groupId>
+			<artifactId>jta</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-ehcache</artifactId>
+		</dependency>
+		<!-- jdbc -->
+		<dependency>
+			<groupId>com.oracle</groupId>
+			<artifactId>ojdbc6</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-orm</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>commons-pool</groupId>
+			<artifactId>commons-pool</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>commons-dbcp</groupId>
+			<artifactId>commons-dbcp</artifactId>
+		</dependency>
+		<!-- redis -->
+		<dependency>
+			<groupId>redis.clients</groupId>
+			<artifactId>jedis</artifactId>
+			<version>2.7.3</version>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.data</groupId>
+			<artifactId>spring-data-redis</artifactId>
+			<version>1.6.0.RELEASE</version>
+		</dependency>
+		<!-- spring mobile -->
+		<dependency>
+			<groupId>org.springframework.mobile</groupId>
+			<artifactId>spring-mobile-device</artifactId>
+		</dependency>
+		<!--json-lib -->
+		<dependency>
+			<groupId>net.sf.json-lib</groupId>
+			<artifactId>json-lib</artifactId>
+			<classifier>jdk15</classifier>
+		</dependency>
+		<dependency>
+			<groupId>org.codehaus.jackson</groupId>
+			<artifactId>jackson-core-asl</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.codehaus.jackson</groupId>
+			<artifactId>jackson-mapper-asl</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-core</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-databind</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-annotations</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.alibaba</groupId>
+			<artifactId>fastjson</artifactId>
+		</dependency>
+		<!-- velocity -->
+		<dependency>
+			<groupId>org.apache.velocity</groupId>
+			<artifactId>velocity</artifactId>
+		</dependency>
+		<!-- mail -->
+		<dependency>
+			<groupId>javax.mail</groupId>
+			<artifactId>mail</artifactId>
+		</dependency>
+		<!-- jxls -->
+		<dependency>
+			<groupId>net.sf.jxls</groupId>
+			<artifactId>jxls-core</artifactId>
+			<version>1.0.4</version>
+		</dependency>
+		<dependency>
+			<groupId>net.sf.jxls</groupId>
+			<artifactId>jxls-reader</artifactId>
+			<version>1.0.4</version>
+		</dependency>
+		<!-- poi -->
+		<dependency>
+			<groupId>org.apache.poi</groupId>
+			<artifactId>poi</artifactId>
+			<version>3.9</version>
+		</dependency>
+		<!-- BeeCloud支付集成SDK -->
+		<dependency>
+			<groupId>cn.beecloud</groupId>
+			<artifactId>beecloud-java-sdk</artifactId>
+			<version>3.1.0</version>
+		</dependency>
+		<dependency>
+			<groupId>jaxen</groupId>
+			<artifactId>jaxen</artifactId>
+			<version>1.1.6</version>
+			<exclusions>
+				<exclusion>
+					<groupId>dom4j</groupId>
+					<artifactId>dom4j</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>xml-apis</groupId>
+					<artifactId>xml-apis</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>xerces</groupId>
+					<artifactId>xmlParserAPIs</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>xerces</groupId>
+					<artifactId>xercesImpl</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>xerces</groupId>
+					<artifactId>xercesImpl</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>com.ibm.icu</groupId>
+					<artifactId>icu4j</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<!-- kafka消息中间件 -->
+		 <dependency>
+			 <groupId>org.springframework.kafka</groupId>
+			 <artifactId>spring-kafka</artifactId>
+			<version>1.2.2.RELEASE</version>
+		 </dependency>
+		<!-- dubbo -->
+		<dependency>
+			<groupId>com.alibaba</groupId>
+			<artifactId>dubbo</artifactId>
+			<exclusions>
+				<exclusion>
+					<groupId>javax.servlet</groupId>
+					<artifactId>javax.servlet-api</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>org.apache.httpcomponents</groupId>
+					<artifactId>httpcore</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.zookeeper</groupId>
+			<artifactId>zookeeper</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.github.sgroschupf</groupId>
+			<artifactId>zkclient</artifactId>
+		</dependency>
+		<!-- service on dubbo -->
+		<dependency>
+			<groupId>com.uas.dfs</groupId>
+			<artifactId>dfs-api</artifactId>
+		</dependency>
+		<!-- search -->
+		<dependency>
+			<groupId>com.uas.search</groupId>
+			<artifactId>search-api</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.uas.message</groupId>
+			<artifactId>message-mail-api</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.uas.message</groupId>
+			<artifactId>message-sms-api</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>com.uas.account</groupId>
+			<artifactId>account-common</artifactId>
+		</dependency>
+
+        <dependency>
+            <groupId>net.sourceforge.pinyin4j</groupId>
+            <artifactId>pinyin4j</artifactId>
+			<version>1.1.0</version>
+        </dependency>
+        <!-- security -->
+		<dependency>
+			<groupId>org.springframework.security</groupId>
+			<artifactId>spring-security-core</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.security</groupId>
+			<artifactId>spring-security-config</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.security</groupId>
+			<artifactId>spring-security-web</artifactId>
+		</dependency>
+
+		<!-- swagger-springmvc -->
+		<dependency>
+			<groupId>com.mangofactory</groupId>
+			<artifactId>swagger-springmvc</artifactId>
+			<version>1.0.2</version>
+		</dependency>
+		<dependency>
+			<groupId>com.mangofactory</groupId>
+			<artifactId>swagger-models</artifactId>
+			<version>1.0.2</version>
+		</dependency>
+		<dependency>
+			<groupId>com.wordnik</groupId>
+			<artifactId>swagger-annotations</artifactId>
+			<version>1.3.11</version>
+		</dependency>
+		<!-- swagger-springmvc dependencies -->
+		<dependency>
+			<groupId>com.google.guava</groupId>
+			<artifactId>guava</artifactId>
+			<version>15.0</version>
+		</dependency>
+		<dependency>
+			<groupId>com.fasterxml</groupId>
+			<artifactId>classmate</artifactId>
+			<version>1.1.0</version>
+		</dependency>
+	</dependencies>
+	<build>
+		<finalName>platform-b2c</finalName>
+		<!-- 受profile影响的目录 -->
+		<resources>
+			<resource>
+				<directory>${basedir}/src/main/resources</directory>
+				<filtering>true</filtering>
+				<excludes>
+					<exclude>**/*.xls</exclude>
+				</excludes>
+			</resource>
+			<!-- xls文件不能filter处理,需区分出来 -->
+			<resource>
+				<directory>${basedir}/src/main/resources</directory>
+				<filtering>false</filtering>
+				<includes>
+					<include>**/*.xls</include>
+				</includes>
+			</resource>
+		</resources>
+		<!-- 在maven生命周期validate阶段生成timestamp -->
+		<plugins>
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>buildnumber-maven-plugin</artifactId>
+				<version>1.3</version>
+				<executions>
+					<execution>
+						<phase>validate</phase>
+						<goals>
+							<goal>create-timestamp</goal>
+						</goals>
+					</execution>
+				</executions>
+				<configuration>
+					<format>{0,date,yyyy-MM-dd HH:mm:ss}</format>
+					<items>
+						<item>timestamp</item>
+					</items>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.7</source>
+					<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>
+				<artifactId>maven-resources-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>copy-resources</id>
+						<phase>prepare-package</phase>
+						<goals>
+							<goal>copy-resources</goal>
+						</goals>
+						<configuration>
+							<outputDirectory>${project.build.directory}/minify</outputDirectory>
+							<overwrite>false</overwrite>
+							<resources>
+								<resource>
+									<directory>${basedir}/src/main/webapp</directory>
+								</resource>
+							</resources>
+						</configuration>
+					</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>org.apache.tomcat.maven</groupId>
+				<artifactId>tomcat7-maven-plugin</artifactId>
+				<version>2.2</version>
+				<configuration>
+					<port>8080</port>
+					<path>/platform-b2c</path>
+					<uriEncoding>utf-8</uriEncoding>
+				</configuration>
+			</plugin>
+		</plugins>
+		<pluginManagement>
+			<plugins>
+				<plugin>
+					<groupId>org.eclipse.m2e</groupId>
+					<artifactId>lifecycle-mapping</artifactId>
+					<version>1.0.0</version>
+					<configuration>
+						<lifecycleMappingMetadata>
+							<pluginExecutions>
+								<pluginExecution>
+									<pluginExecutionFilter>
+										<groupId>
+											org.codehaus.mojo
+										</groupId>
+										<artifactId>
+											buildnumber-maven-plugin
+										</artifactId>
+										<versionRange>
+											[1.3,)
+										</versionRange>
+										<goals>
+											<goal>
+												create-timestamp
+											</goal>
+										</goals>
+									</pluginExecutionFilter>
+									<action>
+										<ignore></ignore>
+									</action>
+								</pluginExecution>
+							</pluginExecutions>
+						</lifecycleMappingMetadata>
+					</configuration>
+				</plugin>
+			</plugins>
+		</pluginManagement>
+	</build>
+	<distributionManagement>
+		<!-- 发布release仓库 -->
+		<repository>
+			<id>platform-release</id>
+			<name>platform-release</name>
+			<url>http://113.105.74.141:8081/artifactory/libs-release-local</url>
+		</repository>
+		<!-- 发布快照版本 -->
+		<snapshotRepository>
+			<id>platform-snapshots</id>
+			<name>platform-snapshots</name>
+			<url>http://113.105.74.141:8081/artifactory/libs-snapshot-local</url>
+		</snapshotRepository>
+	</distributionManagement>
+</project>

+ 120 - 0
src/main/java/Readme.md

@@ -0,0 +1,120 @@
+# 模块说明
+
+1. 除support\config\filter,其余各包为各具体业务模块包
+
+# 结构规则
+
+1. 新增功能规则:如果与现有模块不存在关联,则直接扩充新模块;否则,结合具体业务情形,选择新增模块或者扩充某模块
+2. 模块扩充规则:尽量保持当前模块的领域活动单一,否则,拆分模块
+3. 接口类设计规则:根据接口的权限分为api 和 controller,接口类尽量依据业务进行命名创建,保持接口类功能职责单一,业务耦合度低
+4. 业务设计规则:业务service类如果只关注与简单的CRUD或业务逻辑简单,不需要牵涉过多其他实体业务逻辑,采用service即可;如果需要多个业务类的协作,才完成复杂的业务,考虑添加facade类使业务逻辑清晰;保持业务类的职责单一
+
+# 命名规则
+
+1. 所有命名采用英文 + 驼峰
+2. 所有包名全部用小写,所有类名首字母大写
+
+# 注释规则
+
+### 类
+* 文件名称与描述必须填写
+* 文件作者必须填写
+* 每次修改记录版本信息,版本信息记录:修改时间、
+
+```java
+/**
+ * 用户信息的请求
+ * 
+ * @author yujia
+ * @version 2016年7月1日 上午11:35:16 yujia 获取个人用户资料的数据 
+ * @version 2017年8月1日15:17:38 suntg 完善类的注释
+ */
+@RestController
+@RequestMapping(value = "/basic/user")
+public class UserController {
+    // TODO
+}
+
+```
+
+### 方法
+* 所有public的方法(简单的getter\setter除外)都要注释
+* 方法注释必须要写方法说明、参数说明
+* 参数具体到每一个参数
+
+```java
+/**
+ * 类的注释
+ */
+public class KindController {
+    
+    //...
+    
+    /**
+     * 根据类目ID获取类目的子类目
+     * 
+     * @param parentId 类目ID
+     * @return
+     */
+    @RequestMapping(value = "/{parentId}/children", method = RequestMethod.GET)
+    @ResponseBody
+    public List<Kind> getProductKinds(@PathVariable("parentId") Long parentId) {
+        return kindService.getChildProductKinds(parentId);
+    }
+    
+    //...
+    
+}
+```
+
+### 属性
+* model实体对象的属性,枚举类内容,或者其他一些关键属性都必须写注释
+* 注释内容说明该属性表示的含义
+
+```java
+public class Kind {
+    
+    /**
+     * 在父级类目中的排序序号
+     */
+    @Column(name = "ki_detno")
+    private Short detno;
+	
+
+}
+```
+
+# 用户操作日志
+
+* 采用AOP方式对所有的@RequestMapping请求自动添加调用记录
+* 主要利用swagger的两个注解,@ApiOperation 和 @ApiParam
+* @ApiOperation 用于API描述说明
+* @ApiParam 用于每个参数的描述说明
+* 调用日志记录时会自动获取@ApiOperation的value字段信息,自动为请求添加请求说明
+
+```java
+public class Kind {
+    
+    /**
+     * 商品类目
+     * 
+     * @param kindIds
+     *            要获取的明细Id,多个用逗号(,)隔开
+     * @return
+     */
+    @RequestMapping("/{kindIds}")
+    @ResponseBody
+    @ApiOperation(value = "根据多个ID获取多个类目信息", httpMethod = "GET", notes = "允许获取多个分类,用逗号,分开")
+    public Iterable<Kind> getProductKind(@ApiParam(required = true, value = "id数组") @PathVariable("kindIds") String kindIds) {
+        return kindService.getProductKinds(kindIds);
+    }
+	
+
+}
+```
+
+# API接口说明文档
+
+* 利用swagger 自动生成API说明接口
+
+

+ 23 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/Readme.md

@@ -0,0 +1,23 @@
+## name
+
+ad
+
+## 名称
+
+广告推广
+
+## 创建人
+
+huxz
+
+## 创建时间
+
+2017年7月31日19:25:25
+
+## 说明
+
+轮播、楼层、广告、器件、库存、店铺推广信息以及维护功能
+
+## 修订历史
+
+2017-08-01 16:04:17 根据推荐内容划分controller

+ 36 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/api/CarouselsController.java

@@ -0,0 +1,36 @@
+package com.uas.platform.b2c.advertise.ad.api;
+
+import com.uas.platform.b2c.advertise.ad.service.CarouselService;
+import net.sf.json.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+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 java.util.List;
+
+/**
+ * 轮播控制器
+ *
+ * @author huxz
+ * @version 2017-08-02 15:52:03 创建文件
+ */
+@RestController
+@RequestMapping("/api/carousel")
+public class CarouselsController {
+
+    @Autowired
+    private CarouselService carouselService;
+
+    /**
+     * Gets carousels.
+     *
+     * @param module the module
+     * @return the carousels
+     */
+    @RequestMapping(value = "/{module}", method = RequestMethod.GET)
+    public List<JSONObject> getCarousels(@PathVariable("module") String module) {
+        return carouselService.getCarousels(module);
+    }
+}

+ 59 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/api/CommodityController.java

@@ -0,0 +1,59 @@
+package com.uas.platform.b2c.advertise.ad.api;
+
+import com.uas.platform.b2c.advertise.ad.model.AdvantageCommodity;
+import com.uas.platform.b2c.advertise.ad.service.AdvantageCommodityService;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 库存推荐接口类
+ *
+ * @author huxz
+ * @version 2017-08-02 15:54:25 创建文件
+ */
+@Deprecated
+@RestController("api.CommodityController")
+@RequestMapping(value = "/api/store-cms")
+public class CommodityController {
+
+	private static final Logger logger = LoggerFactory.getLogger(CommodityController.class);
+
+	private final AdvantageCommodityService advantageCommodityService;
+
+	@Autowired
+	public CommodityController(AdvantageCommodityService advantageCommodityService) {
+		this.advantageCommodityService = advantageCommodityService;
+	}
+
+	/**
+	 * 根据店铺UUID获取优势库存信息
+	 *
+	 * @param storeUuid 店铺UUID
+	 * @return the list
+	 */
+	@RequestMapping(value = "/advantages", method = RequestMethod.GET, produces = "application/json")
+	public List<AdvantageCommodity> findByStoreUuid(@RequestParam String storeUuid) {
+		logger.info(String.format("Find advantage commodity information by store uuid %s", storeUuid));
+		return advantageCommodityService.findByStoreUuid(storeUuid);
+	}
+
+	/**
+	 * Valid commodity is advantage commodity.
+	 *
+	 * @param storeUuid the store uuid
+	 * @param batchcode the batchcode
+	 * @return result map
+	 */
+	@RequestMapping(value = "/isAdvantageCommodity", method = RequestMethod.GET)
+	public ResultMap validCommodityIsAdvantageCommodity(@RequestParam(required = false) String storeUuid, @RequestParam String batchcode) {
+ 		return advantageCommodityService.validCommodityIsAdvantageCommodity(storeUuid, batchcode);
+	}
+}

+ 39 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/api/FloorsController.java

@@ -0,0 +1,39 @@
+package com.uas.platform.b2c.advertise.ad.api;
+
+import com.alibaba.fastjson.JSONObject;
+import com.uas.platform.b2c.advertise.ad.service.FloorsService;
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+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 java.util.List;
+
+/**
+ * 楼层接口类
+ *
+ * @author suntg
+ * @version 2017-08-02 15:55:44 创建文件
+ */
+@RestController
+@RequestMapping("/api/floors")
+public class FloorsController {
+
+    private final Logger logger = Logger.getLogger(getClass());
+
+    @Autowired
+    private FloorsService floorsService;
+
+    /**
+     * 获取楼层内容
+     *
+     * @param module the module
+     * @return floors by module
+     */
+    @RequestMapping(value = "/{module}", method = RequestMethod.GET)
+    public List<JSONObject> getFloorsByModule(@PathVariable("module") String module) {
+        return floorsService.getFloorsByModule(module);
+    }
+}

+ 49 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/api/HotComponentController.java

@@ -0,0 +1,49 @@
+package com.uas.platform.b2c.advertise.ad.api;
+
+import com.uas.platform.b2c.advertise.ad.model.HotComponent;
+import com.uas.platform.b2c.advertise.ad.service.HotComponentService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 器件推荐
+ * <p>
+ * 主要推荐热销器件
+ *
+ * @author wangyc
+ * @version 2017-08-01 16:06:20 创建文件
+ */
+@RestController
+@RequestMapping(value = "/api/cms-service")
+public class HotComponentController {
+
+	private final HotComponentService hotComponentService;
+
+	private static final Logger logger = LoggerFactory.getLogger(HotComponentController.class);
+
+	@Autowired
+	public HotComponentController(HotComponentService hotComponentService) {
+		this.hotComponentService = hotComponentService;
+	}
+
+	/**
+	 * Gets hot component by use for and page for.
+	 *
+	 * @param useFor  the use for
+	 * @param pageFor the page for
+	 * @return the hot component by use for and page for
+	 */
+	@RequestMapping(value = "/hotComponents/useFor/pageFor", method = RequestMethod.GET, produces = "application/json")
+	public List<HotComponent> getHotComponentByUseForAndPageFor(@RequestParam(value = "useFor", defaultValue = "HOT_COMPONENT") String useFor,
+			@RequestParam(value = "pageFor", defaultValue = "STORE_LIST")String pageFor) {
+		logger.info(String.format("Get hot component by userFor %s and pageFor %s", useFor, pageFor));
+		return hotComponentService.getHotComponentByUseForAndPageFor(useFor, pageFor);
+	}
+}

+ 73 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/api/StoreCmsController.java

@@ -0,0 +1,73 @@
+package com.uas.platform.b2c.advertise.ad.api;
+
+import com.uas.platform.b2c.advertise.ad.model.StoreCms;
+import com.uas.platform.b2c.advertise.ad.service.StoreCmsService;
+import com.uas.platform.b2c.prod.commodity.model.Goods;
+import com.uas.platform.b2c.prod.store.model.StoreIn;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.web.PageableDefault;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 店铺推荐接口类
+ *
+ * @author huxz
+ * @version 2017-08-02 15:57:49 创建文件
+ */
+@RestController("api.cms.storeCmsController")
+@RequestMapping(value = "/api/cms-service")
+public class StoreCmsController {
+
+	private final StoreCmsService storeCmsService;
+
+	private static final Logger logger = LoggerFactory.getLogger(StoreCmsController.class);
+
+	@Autowired
+	public StoreCmsController(StoreCmsService storeCmsService) {
+		this.storeCmsService = storeCmsService;
+	}
+
+	/**
+	 * 根据以下两个属性,获取店铺的信息
+	 *
+	 * @param useFor  用途
+	 * @param cmsType 内容类型
+	 * @return List<StoreCms> store cms by use for and cms type
+	 */
+	@RequestMapping(value = "/storeCms", method = RequestMethod.GET, produces = "application/json")
+	public List<StoreCms> getStoreCmsByUseForAndCmsType(@RequestParam("useFor") String useFor, @RequestParam("cmsType") String cmsType) {
+		logger.info(String.format("Get content about store by userFor %s and cmsType %s", useFor, cmsType));
+		return storeCmsService.getStoreCmsByUseForAndCmsType(useFor, cmsType);
+	}
+
+	/**
+	 * 获取代理和经销店铺的信息 优秀商家
+	 *
+	 * @param num   the num
+	 * @param types the types
+	 * @return List<StoreIn> excellent store in
+	 */
+	@RequestMapping(value = "/storeIn", method = RequestMethod.GET, produces = "application/json")
+	public List<StoreIn> getExcellentStoreIn(@RequestParam("num") Integer num, @RequestParam("types") String types){
+		return storeCmsService.findExcellentProvider(num, types);
+	}
+
+	/**
+	 * Find good inventory list.
+	 *
+	 * @param pageable the pageable
+	 * @return the list
+	 */
+	@RequestMapping(value = "/storeCms/inventory", method = RequestMethod.GET, produces = "application/json")
+	public List<Goods> findGoodInventory(@PageableDefault Pageable pageable) {
+		return storeCmsService.findGoodInventory(pageable);
+	}
+}

+ 44 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/api/StoreContentController.java

@@ -0,0 +1,44 @@
+package com.uas.platform.b2c.advertise.ad.api;
+
+import com.uas.platform.b2c.advertise.ad.model.ContentType;
+import com.uas.platform.b2c.advertise.ad.model.StoreContent;
+import com.uas.platform.b2c.advertise.ad.service.StoreContentService;
+import com.uas.platform.core.model.PageInfo;
+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.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 店铺推广接口类
+ *
+ * @author huxz
+ * @version 2017-08-02 15:58:37 创建文件
+ */
+@RestController
+@RequestMapping(value = "/api/store-cms")
+public class StoreContentController {
+
+	private final StoreContentService storeContentService;
+
+	@Autowired
+	public StoreContentController(StoreContentService storeContentService) {
+		this.storeContentService = storeContentService;
+	}
+
+	/**
+	 * 分页获取某种类型的店铺内容信息
+	 *
+	 * @param params 分页参数
+	 * @param type   店铺内容类型
+	 * @return the content by type
+	 */
+	@RequestMapping(value = "/contents/store", method = RequestMethod.GET, params = "op=page")
+	public Page<StoreContent> getContentByType(PageParams params, ContentType type) {
+		PageInfo pageInfo = new PageInfo(params);
+		return storeContentService.getContentByType(pageInfo, type);
+	}
+
+}

+ 58 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/api/StoreRecommendController.java

@@ -0,0 +1,58 @@
+package com.uas.platform.b2c.advertise.ad.api;
+
+import com.uas.platform.b2c.advertise.ad.model.RecommendProduct;
+import com.uas.platform.b2c.advertise.ad.service.RecommendProductService;
+import com.uas.platform.b2c.core.utils.JacksonUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+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 java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 店铺产品推荐接口类
+ *
+ * @author huxz
+ * @version 2017-08-02 15:59:23 创建文件
+ */
+@RestController
+@RequestMapping(value = "/api/store/recommend")
+public class StoreRecommendController {
+
+	private final RecommendProductService recommendProductService;
+
+	@Autowired
+	public StoreRecommendController(RecommendProductService recommendProductService) {
+		this.recommendProductService = recommendProductService;
+	}
+
+	/**
+	 * 当用户访问店铺首页时,根据店铺的UUID获取产品推荐信息
+	 *
+	 * @param uuid 店铺UUID
+	 * @return the string
+	 */
+	@RequestMapping(value = "/products", method = RequestMethod.GET, params = "condition=store_uuid")
+	public List<RecommendProduct> findProductsWhenUserVisitStore(String uuid) {
+		return recommendProductService.findProductsWhenUserVisitStore(uuid);
+	}
+
+	@RequestMapping(value = "/products/{uuid}", method = RequestMethod.DELETE)
+	public String deleteProductsWhenUserVisitStore(@PathVariable("uuid") String uuid, String batchCode) {
+		Map<String, String> map = new HashMap<>();
+		map.put("uuid", uuid);
+
+		Set<String> batchCodes = new HashSet<>();
+		batchCodes.add(batchCode);
+
+		recommendProductService.deleteProductsWhenSellerUpdateReserve(uuid, batchCodes);
+		return JacksonUtils.toJson(map);
+	}
+
+}

+ 42 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/controller/AuthStoreCmsController.java

@@ -0,0 +1,42 @@
+package com.uas.platform.b2c.advertise.ad.controller;
+
+import com.uas.platform.b2c.advertise.ad.service.AuthStoreCmsService;
+import com.uas.platform.b2c.prod.store.model.StoreIn;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 店铺推荐编辑接口类
+ *
+ * @author huxz
+ * @version 2017-08-02 16:00:08 创建文件
+ */
+@RestController
+@RequestMapping(value = "/storecms-service")
+public class AuthStoreCmsController {
+
+	private final AuthStoreCmsService storeCmsService;
+
+	@Autowired
+	public AuthStoreCmsController(AuthStoreCmsService storeCmsService) {
+		this.storeCmsService = storeCmsService;
+	}
+
+	/**
+	 * 添加一条某一页面的某种内容
+	 *
+	 * @param store   商城店铺相关内容
+	 * @param useFor  内容呈现页面
+	 * @param cmsType 内容类型
+	 * @return the result map
+	 */
+	@RequestMapping(value = "/storeCms", method = RequestMethod.POST)
+	public ResultMap addOneTypeStoreCms(@RequestBody StoreIn store, @RequestParam String useFor, @RequestParam String cmsType) {
+		return storeCmsService.addOneTypeStoreCms(store, useFor, cmsType);
+	}
+}

+ 17 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/dao/StoreContentDao.java

@@ -0,0 +1,17 @@
+package com.uas.platform.b2c.advertise.ad.dao;
+
+import com.uas.platform.b2c.advertise.ad.model.StoreContent;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 店铺推广内容DAO
+ *
+ * @author huxz
+ * @version 2017-08-02 16:00:48 创建文件
+ */
+@Repository
+public interface StoreContentDao extends JpaSpecificationExecutor<StoreContent>, JpaRepository<StoreContent, Long> {
+
+}

+ 371 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/model/AdvantageCommodity.java

@@ -0,0 +1,371 @@
+package com.uas.platform.b2c.advertise.ad.model;
+
+import java.util.Date;
+
+/**
+ * 优势库存信息
+ *
+ * @author huxz
+ * @version 2017-03-03 10:44:16 创建文件
+ */
+public class AdvantageCommodity {
+
+	/**
+	 * 主键UUID
+	 */
+	private String id;
+
+	/*=========================================================================
+	 * 基础信息
+	 *=========================================================================*/
+
+	/**
+	 * 创建时间
+	 */
+	private Date createTime;
+
+	/**
+	 * 修改时间
+	 */
+	private Date updateTime;
+
+	/**
+	 * 排序
+	 */
+	private int order;
+
+	/*=========================================================================
+	 * 商品基础信息
+	 *=========================================================================*/
+	/**
+	 * 商品批次号
+	 */
+	private String batchCode;
+
+	/**
+	 * 对应的器件uuid
+	 */
+	private String comUuid;
+
+	/**
+	 * 原厂型号
+	 */
+	private String comCode;
+
+	/**
+	 * 图片path
+	 */
+	private String comImg;
+
+	/**
+	 * 类名UUID
+	 */
+	private String kindUuid;
+
+	/**
+	 * 类目的名称
+	 */
+	private String kindNameCn;
+
+	/**
+	 * 品牌中文名称
+	 */
+	private String brandNameCn;
+
+	/**
+	 * 本批次的最低人民币价格
+	 */
+	private Double minPriceRMB;
+
+	/**
+	 * 本批次的最低美元价格
+	 */
+	private Double minPriceUSD;
+
+	/*=========================================================================
+	 * 店铺信息
+	 *=========================================================================*/
+
+	/**
+	 * 店铺所属公司
+	 */
+	private Long storeEnUU;
+
+	/**
+	 * 店铺UUID
+	 */
+	private String storeUuid;
+
+	public AdvantageCommodity() {
+	}
+
+	/**
+	 * Gets id.
+	 *
+	 * @return the id
+	 */
+	public String getId() {
+		return id;
+	}
+
+	/**
+	 * Sets id.
+	 *
+	 * @param id the id
+	 */
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	/**
+	 * Gets create time.
+	 *
+	 * @return the create time
+	 */
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	/**
+	 * Sets create time.
+	 *
+	 * @param createTime the create time
+	 */
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	/**
+	 * Gets update time.
+	 *
+	 * @return the update time
+	 */
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	/**
+	 * Sets update time.
+	 *
+	 * @param updateTime the update time
+	 */
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
+	/**
+	 * Gets order.
+	 *
+	 * @return the order
+	 */
+	public int getOrder() {
+		return order;
+	}
+
+	/**
+	 * Sets order.
+	 *
+	 * @param order the order
+	 */
+	public void setOrder(int order) {
+		this.order = order;
+	}
+
+	/**
+	 * Gets batch code.
+	 *
+	 * @return the batch code
+	 */
+	public String getBatchCode() {
+		return batchCode;
+	}
+
+	/**
+	 * Sets batch code.
+	 *
+	 * @param batchCode the batch code
+	 */
+	public void setBatchCode(String batchCode) {
+		this.batchCode = batchCode;
+	}
+
+	/**
+	 * Gets com uuid.
+	 *
+	 * @return the com uuid
+	 */
+	public String getComUuid() {
+		return comUuid;
+	}
+
+	/**
+	 * Sets com uuid.
+	 *
+	 * @param comUuid the com uuid
+	 */
+	public void setComUuid(String comUuid) {
+		this.comUuid = comUuid;
+	}
+
+	/**
+	 * Gets com code.
+	 *
+	 * @return the com code
+	 */
+	public String getComCode() {
+		return comCode;
+	}
+
+	/**
+	 * Sets com code.
+	 *
+	 * @param comCode the com code
+	 */
+	public void setComCode(String comCode) {
+		this.comCode = comCode;
+	}
+
+	/**
+	 * Gets com img.
+	 *
+	 * @return the com img
+	 */
+	public String getComImg() {
+		return comImg;
+	}
+
+	/**
+	 * Sets com img.
+	 *
+	 * @param comImg the com img
+	 */
+	public void setComImg(String comImg) {
+		this.comImg = comImg;
+	}
+
+	/**
+	 * Gets kind uuid.
+	 *
+	 * @return the kind uuid
+	 */
+	public String getKindUuid() {
+		return kindUuid;
+	}
+
+	/**
+	 * Sets kind uuid.
+	 *
+	 * @param kindUuid the kind uuid
+	 */
+	public void setKindUuid(String kindUuid) {
+		this.kindUuid = kindUuid;
+	}
+
+	/**
+	 * Gets kind name cn.
+	 *
+	 * @return the kind name cn
+	 */
+	public String getKindNameCn() {
+		return kindNameCn;
+	}
+
+	/**
+	 * Sets kind name cn.
+	 *
+	 * @param kindNameCn the kind name cn
+	 */
+	public void setKindNameCn(String kindNameCn) {
+		this.kindNameCn = kindNameCn;
+	}
+
+	/**
+	 * Gets brand name cn.
+	 *
+	 * @return the brand name cn
+	 */
+	public String getBrandNameCn() {
+		return brandNameCn;
+	}
+
+	/**
+	 * Sets brand name cn.
+	 *
+	 * @param brandNameCn the brand name cn
+	 */
+	public void setBrandNameCn(String brandNameCn) {
+		this.brandNameCn = brandNameCn;
+	}
+
+	/**
+	 * Gets min price rmb.
+	 *
+	 * @return the min price rmb
+	 */
+	public Double getMinPriceRMB() {
+		return minPriceRMB;
+	}
+
+	/**
+	 * Sets min price rmb.
+	 *
+	 * @param minPriceRMB the min price rmb
+	 */
+	public void setMinPriceRMB(Double minPriceRMB) {
+		this.minPriceRMB = minPriceRMB;
+	}
+
+	/**
+	 * Gets min price usd.
+	 *
+	 * @return the min price usd
+	 */
+	public Double getMinPriceUSD() {
+		return minPriceUSD;
+	}
+
+	/**
+	 * Sets min price usd.
+	 *
+	 * @param minPriceUSD the min price usd
+	 */
+	public void setMinPriceUSD(Double minPriceUSD) {
+		this.minPriceUSD = minPriceUSD;
+	}
+
+	/**
+	 * Gets store en uu.
+	 *
+	 * @return the store en uu
+	 */
+	public Long getStoreEnUU() {
+		return storeEnUU;
+	}
+
+	/**
+	 * Sets store en uu.
+	 *
+	 * @param storeEnUU the store en uu
+	 */
+	public void setStoreEnUU(Long storeEnUU) {
+		this.storeEnUU = storeEnUU;
+	}
+
+	/**
+	 * Gets store uuid.
+	 *
+	 * @return the store uuid
+	 */
+	public String getStoreUuid() {
+		return storeUuid;
+	}
+
+	/**
+	 * Sets store uuid.
+	 *
+	 * @param storeUuid the store uuid
+	 */
+	public void setStoreUuid(String storeUuid) {
+		this.storeUuid = storeUuid;
+	}
+}

+ 11 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/model/ContentType.java

@@ -0,0 +1,11 @@
+package com.uas.platform.b2c.advertise.ad.model;
+
+/**
+ * 店铺推荐类型
+ *
+ * @author huxz
+ * @version 2017-08-01 15:48:12 创建文件
+ */
+public enum ContentType {
+	ORIGINAL_RECOMMEND			// 原厂推荐
+}

+ 170 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/model/HotComponent.java

@@ -0,0 +1,170 @@
+package com.uas.platform.b2c.advertise.ad.model;
+
+/**
+ * 热销器件
+ *
+ * @author wangyc
+ * @version 2017-08-02 16:03:20 创建文件
+ */
+public class HotComponent {
+
+	/**
+	 * ID
+	 */
+	private String id;
+
+	/**
+	 * 热销的器件名称
+	 */
+	private String code;
+
+	/**
+	 * 器件的图片
+	 */
+	private String img;
+
+	/**
+	 * 序号
+	 */
+	private int detno;
+
+	/**
+	 * 使用的页面
+	 */
+	private String pageFor;
+
+	/**
+	 * 用途
+	 */
+	private String useFor;
+
+	/**
+	 * Gets id.
+	 *
+	 * @return the id
+	 */
+	public String getId() {
+		return id;
+	}
+
+	/**
+	 * Sets id.
+	 *
+	 * @param id the id
+	 * @return the id
+	 */
+	public HotComponent setId(String id) {
+		this.id = id;
+		return this;
+	}
+
+	/**
+	 * Gets code.
+	 *
+	 * @return the code
+	 */
+	public String getCode() {
+		return code;
+	}
+
+	/**
+	 * Sets code.
+	 *
+	 * @param code the code
+	 * @return the code
+	 */
+	public HotComponent setCode(String code) {
+		this.code = code;
+		return this;
+	}
+
+	/**
+	 * Gets img.
+	 *
+	 * @return the img
+	 */
+	public String getImg() {
+		return img;
+	}
+
+	/**
+	 * Sets img.
+	 *
+	 * @param img the img
+	 * @return the img
+	 */
+	public HotComponent setImg(String img) {
+		this.img = img;
+		return this;
+	}
+
+	/**
+	 * Gets detno.
+	 *
+	 * @return the detno
+	 */
+	public int getDetno() {
+		return detno;
+	}
+
+	/**
+	 * Sets detno.
+	 *
+	 * @param detno the detno
+	 * @return the detno
+	 */
+	public HotComponent setDetno(int detno) {
+		this.detno = detno;
+		return this;
+	}
+
+	/**
+	 * Gets page for.
+	 *
+	 * @return the page for
+	 */
+	public String getPageFor() {
+		return pageFor;
+	}
+
+	/**
+	 * Sets page for.
+	 *
+	 * @param pageFor the page for
+	 * @return the page for
+	 */
+	public HotComponent setPageFor(String pageFor) {
+		this.pageFor = pageFor;
+		return this;
+	}
+
+	/**
+	 * Gets use for.
+	 *
+	 * @return the use for
+	 */
+	public String getUseFor() {
+		return useFor;
+	}
+
+	/**
+	 * Sets use for.
+	 *
+	 * @param useFor the use for
+	 * @return the use for
+	 */
+	public HotComponent setUseFor(String useFor) {
+		this.useFor = useFor;
+		return this;
+	}
+
+	/**
+	 * The enum Use for type.
+	 */
+	public enum  UseForType {
+		/**
+		 * Hot component use for type.
+		 */
+		HOT_COMPONENT;
+	}
+}

+ 76 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/model/Message.java

@@ -0,0 +1,76 @@
+package com.uas.platform.b2c.advertise.ad.model;
+
+
+import com.uas.platform.b2c.core.utils.JacksonUtils;
+
+import java.util.Date;
+import java.util.Set;
+
+/**
+ * Kafka 消息实体类
+ *
+ * @author huxz
+ * @version 2017-08-03 14:28:01 创建消息实体类
+ */
+public class Message {
+
+	/**
+	 * ID
+	 */
+	private long id;
+
+	/**
+	 * 发送时间
+	 */
+	private Date sendTime;
+
+	/**
+	 * 店铺UUID
+	 */
+	private String uuid;
+
+	/**
+	 * 批次信息
+	 */
+	private Set<String> batchCodes;
+
+	public Message() {
+	}
+
+	public long getId() {
+		return id;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public Date getSendTime() {
+		return sendTime;
+	}
+
+	public void setSendTime(Date sendTime) {
+		this.sendTime = sendTime;
+	}
+
+	public String getUuid() {
+		return uuid;
+	}
+
+	public void setUuid(String uuid) {
+		this.uuid = uuid;
+	}
+
+	public Set<String> getBatchCodes() {
+		return batchCodes;
+	}
+
+	public void setBatchCodes(Set<String> batchCodes) {
+		this.batchCodes = batchCodes;
+	}
+
+	@Override
+	public String toString() {
+		return JacksonUtils.toJson(this);
+	}
+}

+ 274 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/model/RecommendProduct.java

@@ -0,0 +1,274 @@
+package com.uas.platform.b2c.advertise.ad.model;
+
+import java.util.Date;
+
+/**
+ * 优势库存信息
+ *
+ * history:
+ * Created by huxz on 2017-3-3 10:44:16
+ */
+public class RecommendProduct {
+
+	/**
+	 * 主键UUID
+	 */
+	private String id;
+
+	/*=========================================================================
+	 * 基础信息
+	 *=========================================================================*/
+
+	/**
+	 * 创建时间
+	 */
+	private Date createTime;
+
+	/**
+	 * 修改时间
+	 */
+	private Date updateTime;
+
+	/**
+	 * 排序
+	 */
+	private int order;
+
+	/*=========================================================================
+	 * 商品基础信息
+	 *=========================================================================*/
+
+	/**
+	 * 商品批次号
+	 */
+	private String batchCode;
+
+	/**
+	 * 对应的器件uuid
+	 */
+	private String comUuid;
+
+	/**
+	 * 原厂型号
+	 */
+	private String comCode;
+
+	/**
+	 * 图片path
+	 */
+	private String comImg;
+
+	/**
+	 * 类名UUID
+	 */
+	private String kindUuid;
+
+	/**
+	 * 类目的名称
+	 */
+	private String kindNameCn;
+
+	/**
+	 * 品牌中文名称
+	 */
+	private String brandNameCn;
+
+	/**
+	 * 本批次的最低人民币价格
+	 */
+	private Double minPriceRMB;
+
+	/**
+	 * 本批次的最低美元价格
+	 */
+	private Double minPriceUSD;
+
+	/**
+	 * 商品库存量
+	 */
+	private Double reserve;
+
+	/**
+	 * 最小起订量
+	 */
+	private Double minBuyQty;
+
+	/**
+	 * 币别
+	 */
+	private String currency;
+
+	/**
+	 * 产品上架的店铺的UUID
+	 */
+	private String storeId;
+
+	/*=========================================================================
+	 * 店铺信息
+	 *=========================================================================*/
+
+	/**
+	 * 产品推荐拥有者所属公司UU
+	 */
+	private Long storeEnUU;
+
+	/**
+	 * 产品推荐拥有者的店铺UUID
+	 */
+	private String storeUuid;
+
+	public RecommendProduct() {
+	}
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
+	public int getOrder() {
+		return order;
+	}
+
+	public void setOrder(int order) {
+		this.order = order;
+	}
+
+	public String getBatchCode() {
+		return batchCode;
+	}
+
+	public void setBatchCode(String batchCode) {
+		this.batchCode = batchCode;
+	}
+
+	public String getComUuid() {
+		return comUuid;
+	}
+
+	public void setComUuid(String comUuid) {
+		this.comUuid = comUuid;
+	}
+
+	public String getComCode() {
+		return comCode;
+	}
+
+	public void setComCode(String comCode) {
+		this.comCode = comCode;
+	}
+
+	public String getComImg() {
+		return comImg;
+	}
+
+	public void setComImg(String comImg) {
+		this.comImg = comImg;
+	}
+
+	public String getKindUuid() {
+		return kindUuid;
+	}
+
+	public void setKindUuid(String kindUuid) {
+		this.kindUuid = kindUuid;
+	}
+
+	public String getKindNameCn() {
+		return kindNameCn;
+	}
+
+	public void setKindNameCn(String kindNameCn) {
+		this.kindNameCn = kindNameCn;
+	}
+
+	public String getBrandNameCn() {
+		return brandNameCn;
+	}
+
+	public void setBrandNameCn(String brandNameCn) {
+		this.brandNameCn = brandNameCn;
+	}
+
+	public Double getMinPriceRMB() {
+		return minPriceRMB;
+	}
+
+	public void setMinPriceRMB(Double minPriceRMB) {
+		this.minPriceRMB = minPriceRMB;
+	}
+
+	public Double getMinPriceUSD() {
+		return minPriceUSD;
+	}
+
+	public void setMinPriceUSD(Double minPriceUSD) {
+		this.minPriceUSD = minPriceUSD;
+	}
+
+	public Double getReserve() {
+		return reserve;
+	}
+
+	public void setReserve(Double reserve) {
+		this.reserve = reserve;
+	}
+
+	public Double getMinBuyQty() {
+		return minBuyQty;
+	}
+
+	public void setMinBuyQty(Double minBuyQty) {
+		this.minBuyQty = minBuyQty;
+	}
+
+	public String getCurrency() {
+		return currency;
+	}
+
+	public void setCurrency(String currency) {
+		this.currency = currency;
+	}
+
+	public String getStoreId() {
+		return storeId;
+	}
+
+	public void setStoreId(String storeId) {
+		this.storeId = storeId;
+	}
+
+	public Long getStoreEnUU() {
+		return storeEnUU;
+	}
+
+	public void setStoreEnUU(Long storeEnUU) {
+		this.storeEnUU = storeEnUU;
+	}
+
+	public String getStoreUuid() {
+		return storeUuid;
+	}
+
+	public void setStoreUuid(String storeUuid) {
+		this.storeUuid = storeUuid;
+	}
+}

+ 354 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/model/StoreCms.java

@@ -0,0 +1,354 @@
+package com.uas.platform.b2c.advertise.ad.model;
+
+import com.uas.platform.b2c.prod.store.model.StoreIn;
+
+import java.util.Date;
+
+/**
+ * 在供应商列表中 销售排行榜,新入住的商家,
+ * 优秀供应商类表,这些涉及到供应商信息供应一张表
+ *
+ * @author huxz
+ * @version 2017-08-02 16:04:44 创建文件
+ */
+public class StoreCms {
+
+    /**
+     * ID
+     */
+    private String id;
+
+    /**
+     * 店铺enuu
+     */
+    private Long enuu;
+
+    /**
+     * 店铺名称
+     */
+    private String enterName;
+
+    /**
+     * 主营分类
+     */
+    private String subjectCategory;
+
+    /**
+     * 主营品牌
+     */
+    private String subjectBrand;
+
+    /**
+     * 公司简介
+     */
+    private String description;
+
+    /**
+     * 公司图片
+     */
+    private String img;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 用途,现在是店铺列表的首页
+     */
+    private String useFor;
+
+    /**
+     * 管理店铺的类型,例如是用于优秀供应商,
+     * 销售列表供应商,新入住供应商。
+     */
+    private String cmsType;
+
+    /**
+     * 店铺的UUID
+     */
+    private String storeid;
+
+    /**
+     * 相应店铺的排序号
+     */
+    private int num;
+
+    public StoreCms() {
+    }
+
+    /**
+     * Gets enuu.
+     *
+     * @return the enuu
+     */
+    public Long getEnuu() {
+        return enuu;
+    }
+
+    /**
+     * Sets enuu.
+     *
+     * @param enuu the enuu
+     * @return the enuu
+     */
+    public StoreCms setEnuu(Long enuu) {
+        this.enuu = enuu;
+        return this;
+    }
+
+    /**
+     * Gets enter name.
+     *
+     * @return the enter name
+     */
+    public String getEnterName() {
+        return enterName;
+    }
+
+    /**
+     * Sets enter name.
+     *
+     * @param enterName the enter name
+     * @return the enter name
+     */
+    public StoreCms setEnterName(String enterName) {
+        this.enterName = enterName;
+        return this;
+    }
+
+    /**
+     * Gets description.
+     *
+     * @return the description
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets description.
+     *
+     * @param description the description
+     * @return the description
+     */
+    public StoreCms setDescription(String description) {
+        this.description = description;
+        return this;
+    }
+
+    /**
+     * Gets img.
+     *
+     * @return the img
+     */
+    public String getImg() {
+        return img;
+    }
+
+    /**
+     * Sets img.
+     *
+     * @param img the img
+     * @return the img
+     */
+    public StoreCms setImg(String img) {
+        this.img = img;
+        return this;
+    }
+
+    /**
+     * Gets create time.
+     *
+     * @return the create time
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    /**
+     * Sets create time.
+     *
+     * @param createTime the create time
+     * @return the create time
+     */
+    public StoreCms setCreateTime(Date createTime) {
+        this.createTime = createTime;
+        return this;
+    }
+
+    /**
+     * Gets user for.
+     *
+     * @return the user for
+     */
+    public String getUserFor() {
+        return useFor;
+    }
+
+    /**
+     * Sets user for.
+     *
+     * @param userFor the user for
+     * @return the user for
+     */
+    public StoreCms setUserFor(String userFor) {
+        this.useFor = userFor;
+        return this;
+    }
+
+    /**
+     * Gets cms type.
+     *
+     * @return the cms type
+     */
+    public String getCmsType() {
+        return cmsType;
+    }
+
+    /**
+     * Sets cms type.
+     *
+     * @param cmsType the cms type
+     * @return the cms type
+     */
+    public StoreCms setCmsType(String cmsType) {
+        this.cmsType = cmsType;
+        return this;
+    }
+
+    /**
+     * Gets storeid.
+     *
+     * @return the storeid
+     */
+    public String getStoreid() {
+        return storeid;
+    }
+
+    /**
+     * Sets storeid.
+     *
+     * @param storeid the storeid
+     */
+    public void setStoreid(String storeid) {
+        this.storeid = storeid;
+    }
+
+    /**
+     * Gets num.
+     *
+     * @return the num
+     */
+    public int getNum() {
+        return num;
+    }
+
+    /**
+     * Sets num.
+     *
+     * @param num the num
+     * @return the num
+     */
+    public StoreCms setNum(int num) {
+        this.num = num;
+        return this;
+    }
+
+    /**
+     * Gets id.
+     *
+     * @return the id
+     */
+    public String getId() {
+        return id;
+    }
+
+    /**
+     * Sets id.
+     *
+     * @param id the id
+     * @return the id
+     */
+    public StoreCms setId(String id) {
+        this.id = id;
+        return this;
+    }
+
+    /**
+     * Gets subject category.
+     *
+     * @return the subject category
+     */
+    public String getSubjectCategory() {
+        return subjectCategory;
+    }
+
+    /**
+     * Sets subject category.
+     *
+     * @param subjectCategory the subject category
+     * @return the subject category
+     */
+    public StoreCms setSubjectCategory(String subjectCategory) {
+        this.subjectCategory = subjectCategory;
+        return this;
+    }
+
+    /**
+     * Gets subject brand.
+     *
+     * @return the subject brand
+     */
+    public String getSubjectBrand() {
+        return subjectBrand;
+    }
+
+    /**
+     * Sets subject brand.
+     *
+     * @param subjectBrand the subject brand
+     * @return the subject brand
+     */
+    public StoreCms setSubjectBrand(String subjectBrand) {
+        this.subjectBrand = subjectBrand;
+        return this;
+    }
+
+    /**
+     * Gets use for.
+     *
+     * @return the use for
+     */
+    public String getUseFor() {
+        return useFor;
+    }
+
+    /**
+     * Sets use for.
+     *
+     * @param useFor the use for
+     * @return the use for
+     */
+    public StoreCms setUseFor(String useFor) {
+        this.useFor = useFor;
+        return this;
+    }
+
+    /**
+     * New store cms store cms.
+     *
+     * @param store the store
+     * @return the store cms
+     */
+    public static StoreCms newStoreCms(StoreIn store) {
+        StoreCms cms = new StoreCms();
+        cms.setStoreid(store.getUuid());
+        cms.setEnuu(store.getEnUU());
+        cms.setEnterName(store.getStoreName());
+        cms.setDescription(store.getDescription());
+        cms.setImg(store.getLogoUrl());
+        cms.setCreateTime(new Date());
+        return cms;
+    }
+}

+ 178 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/model/StoreContent.java

@@ -0,0 +1,178 @@
+package com.uas.platform.b2c.advertise.ad.model;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.uas.platform.b2c.core.utils.JacksonUtils;
+import com.uas.platform.b2c.prod.store.model.StoreIn;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+/**
+ * 店铺推荐信息类
+ *
+ * @author huxz
+ * @version 2017 -8-1 15:47:38 创建文件
+ */
+@Entity
+@Table(name = "store$content")
+@JsonInclude(JsonInclude.Include.NON_EMPTY)
+public class StoreContent {
+
+	/**
+	 * ID
+	 */
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "store$content_gen")
+	@SequenceGenerator(name = "store$content_gen", sequenceName = "store$content_seq", allocationSize = 1)
+	@Column(name = "id")
+	private Long id;
+
+	/**
+	 * 店铺UUID
+	 */
+	@Transient
+	private String uuid;
+
+	/**
+	 * 店铺信息
+	 */
+	@ManyToOne(cascade = CascadeType.REFRESH, optional = false)
+	@JoinColumn(name = "con_store_uuid", referencedColumnName = "st_uuid")
+	private StoreIn store;
+
+	/**
+	 * 分数
+	 */
+	@Column(name = "con_score")
+	private float score;
+
+	/**
+	 * 内容类型
+	 */
+	@Column(name = "con_type")
+	@Enumerated(EnumType.STRING)
+	private ContentType type;
+
+	public StoreContent() {
+	}
+
+	/**
+	 * Gets id.
+	 *
+	 * @return the id
+	 */
+	public Long getId() {
+		return id;
+	}
+
+	/**
+	 * Sets id.
+	 *
+	 * @param id the id
+	 */
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	/**
+	 * Gets uuid.
+	 *
+	 * @return the uuid
+	 */
+	public String getUuid() {
+		return uuid;
+	}
+
+	/**
+	 * Sets uuid.
+	 *
+	 * @param uuid the uuid
+	 */
+	public void setUuid(String uuid) {
+		this.uuid = uuid;
+	}
+
+	/**
+	 * Gets score.
+	 *
+	 * @return the score
+	 */
+	public float getScore() {
+		return score;
+	}
+
+	/**
+	 * Sets score.
+	 *
+	 * @param score the score
+	 */
+	public void setScore(float score) {
+		this.score = score;
+	}
+
+	/**
+	 * Gets type.
+	 *
+	 * @return the type
+	 */
+	public ContentType getType() {
+		return type;
+	}
+
+	/**
+	 * Sets type.
+	 *
+	 * @param type the type
+	 */
+	public void setType(ContentType type) {
+		this.type = type;
+	}
+
+	/**
+	 * Sets type.
+	 *
+	 * @param type the type
+	 */
+	public void setType(String type) {
+		try {
+			this.type = ContentType.valueOf(type);
+		} catch (Exception e) {
+			System.out.println(String.format("type %s 不属于枚举ContentType", type));
+			this.type = null;
+		}
+	}
+
+	@Override
+	public String toString() {
+		return JacksonUtils.toJson(this);
+	}
+
+	/**
+	 * Gets store.
+	 *
+	 * @return the store
+	 */
+	public StoreIn getStore() {
+		return store;
+	}
+
+	/**
+	 * Sets store.
+	 *
+	 * @param store the store
+	 */
+	public void setStore(StoreIn store) {
+		this.store = store;
+	}
+}

+ 33 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/AdvantageCommodityService.java

@@ -0,0 +1,33 @@
+package com.uas.platform.b2c.advertise.ad.service;
+
+
+import com.uas.platform.b2c.advertise.ad.model.AdvantageCommodity;
+import com.uas.platform.b2c.trade.support.ResultMap;
+
+import java.util.List;
+
+/**
+ * The interface Advantage commodity service
+ *
+ * @author huxz
+ * @version 2017-08-02 16:06:16 创建文件
+ */
+public interface AdvantageCommodityService {
+
+	/**
+	 * 根据店铺UUID获取优势库存列表信息
+	 *
+	 * @param storeUuid 店铺UUID
+	 * @return the list
+	 */
+	List<AdvantageCommodity> findByStoreUuid(String storeUuid);
+
+	/**
+	 * 验证批次信息是否是优势库存
+	 *
+	 * @param storeUuid 店铺UUID
+	 * @param batchCode the batch code
+	 * @return the result map
+	 */
+	ResultMap validCommodityIsAdvantageCommodity(String storeUuid, String batchCode);
+}

+ 23 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/AuthStoreCmsService.java

@@ -0,0 +1,23 @@
+package com.uas.platform.b2c.advertise.ad.service;
+
+import com.uas.platform.b2c.prod.store.model.StoreIn;
+import com.uas.platform.b2c.trade.support.ResultMap;
+
+/**
+ * The interface Auth store cms service.
+ *
+ * @author huxz
+ * @version 2017-08-02 16:06:40 创建文件
+ */
+public interface AuthStoreCmsService {
+
+	/**
+	 * 添加一条某一页面的某种内容
+	 *
+	 * @param store   商城店铺相关内容
+	 * @param useFor  内容呈现页面
+	 * @param cmsType 内容类型
+	 * @return the result map
+	 */
+	ResultMap addOneTypeStoreCms(StoreIn store, String useFor, String cmsType);
+}

+ 22 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/CarouselService.java

@@ -0,0 +1,22 @@
+package com.uas.platform.b2c.advertise.ad.service;
+
+import net.sf.json.JSONObject;
+
+import java.util.List;
+
+/**
+ * The interface Carousel service.
+ *
+ * @author huxz
+ * @version 2017-08-02 16:07:08 创建文件
+ */
+public interface CarouselService {
+
+    /**
+     * 获取轮播图片
+     *
+     * @param usedFor the used for
+     * @return carousels carousels
+     */
+    List<JSONObject> getCarousels(String usedFor);
+}

+ 22 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/FloorsService.java

@@ -0,0 +1,22 @@
+package com.uas.platform.b2c.advertise.ad.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+
+/**
+ * The interface Floors service.
+ *
+ * @author suntg
+ * @version 2017-03-23 16:08:02
+ */
+public interface FloorsService {
+
+	/**
+	 * Gets floors by module.
+	 *
+	 * @param module the module
+	 * @return the floors by module
+	 */
+	List<JSONObject> getFloorsByModule(String module);
+}

+ 23 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/HotComponentService.java

@@ -0,0 +1,23 @@
+package com.uas.platform.b2c.advertise.ad.service;
+
+import com.uas.platform.b2c.advertise.ad.model.HotComponent;
+
+import java.util.List;
+
+/**
+ * The interface Hot component service.
+ *
+ * @author huxz
+ * @version 2017-08-02 16:08:39 创建文件
+ */
+public interface HotComponentService {
+
+	/**
+	 * Gets hot component by use for and page for.
+	 *
+	 * @param useFor  the use for
+	 * @param pageFor the page for
+	 * @return the hot component by use for and page for
+	 */
+	List<HotComponent> getHotComponentByUseForAndPageFor(String useFor, String pageFor);
+}

+ 32 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/RecommendProductService.java

@@ -0,0 +1,32 @@
+package com.uas.platform.b2c.advertise.ad.service;
+
+import com.uas.platform.b2c.advertise.ad.model.RecommendProduct;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 产品推荐业务逻辑类
+ * 主要用户获取产品推荐信息,以及商品库存变化时更新产品推荐信息
+ *
+ * @author huxz
+ * @version 2017-08-04 17:00:44 创建文件
+ */
+public interface RecommendProductService {
+
+	/**
+	 * 当卖家更新商品库存时,异步更新已下架或已失效的推荐产品信息
+	 *
+	 * @param storeUuid		店铺UUID
+	 * @param batchCodes	待更新的产品批次号
+	 */
+	void deleteProductsWhenSellerUpdateReserve(String storeUuid, Set<String> batchCodes);
+
+	/**
+	 * 当用户访问店铺首页时,根据店铺的UUID获取产品推荐信息
+	 *
+	 * @param uuid 店铺UUID
+	 * @return the string
+	 */
+	List<RecommendProduct> findProductsWhenUserVisitStore(String uuid);
+}

+ 43 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/StoreCmsService.java

@@ -0,0 +1,43 @@
+package com.uas.platform.b2c.advertise.ad.service;
+
+import com.uas.platform.b2c.advertise.ad.model.StoreCms;
+import com.uas.platform.b2c.prod.commodity.model.Goods;
+import com.uas.platform.b2c.prod.store.model.StoreIn;
+import org.springframework.data.domain.Pageable;
+
+import java.util.List;
+
+/**
+ * The interface Store cms service.
+ *
+ * @author huxz
+ * @version 2017-08-02 16:09:05 创建文件
+ */
+public interface StoreCmsService {
+
+	/**
+	 * Gets store cms by use for and cms type.
+	 *
+	 * @param useFor  the use for
+	 * @param cmsType the cms type
+	 * @return the store cms by use for and cms type
+	 */
+	List<StoreCms> getStoreCmsByUseForAndCmsType(String useFor, String cmsType);
+
+	/**
+	 * 取库存量前几的代理经销商品信息
+	 *
+	 * @param pageable 分页信息
+	 * @return the list
+	 */
+	List<Goods> findGoodInventory(Pageable pageable);
+
+	/**
+	 * Find excellent provider list.
+	 *
+	 * @param num   the num
+	 * @param types the types
+	 * @return the list
+	 */
+	List<StoreIn> findExcellentProvider(Integer num, String types);
+}

+ 25 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/StoreContentService.java

@@ -0,0 +1,25 @@
+package com.uas.platform.b2c.advertise.ad.service;
+
+import com.uas.platform.b2c.advertise.ad.model.ContentType;
+import com.uas.platform.b2c.advertise.ad.model.StoreContent;
+import com.uas.platform.core.model.PageInfo;
+import org.springframework.data.domain.Page;
+
+/**
+ * The interface Store content service.
+ *
+ * @author huxz
+ * @version 2017-08-02 16:09:28 创建文件
+ */
+public interface StoreContentService {
+
+	/**
+	 * 分页获取某种类型的店铺内容信息
+	 *
+	 * @param pageInfo 分页参数
+	 * @param type     店铺内容类型
+	 * @return the content by type
+	 */
+	Page<StoreContent> getContentByType(PageInfo pageInfo, ContentType type);
+
+}

+ 74 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/AdvantageCommodityServiceImpl.java

@@ -0,0 +1,74 @@
+package com.uas.platform.b2c.advertise.ad.service.impl;
+
+import com.uas.platform.b2c.advertise.ad.model.AdvantageCommodity;
+import com.uas.platform.b2c.advertise.ad.service.AdvantageCommodityService;
+import com.uas.platform.b2c.core.config.MicroServicesConf;
+import com.uas.platform.b2c.core.config.SysConf;
+import com.uas.platform.b2c.core.utils.JacksonUtils;
+import com.uas.platform.b2c.trade.support.CodeType;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * The type Advantage commodity service implementation.
+ *
+ * @author huxz
+ * @version 2017-08-02 16:10:29 创建文件
+ */
+@Service
+public class AdvantageCommodityServiceImpl implements AdvantageCommodityService {
+
+	private final MicroServicesConf conf;
+
+	private final RestTemplate restTemplate;
+
+	private final SysConf sysConf;
+
+	@Autowired
+	public AdvantageCommodityServiceImpl(MicroServicesConf conf, RestTemplate restTemplate, SysConf sysConf) {
+		this.conf = conf;
+		this.restTemplate = restTemplate;
+		this.sysConf = sysConf;
+	}
+
+	@Override
+	public List<AdvantageCommodity> findByStoreUuid(String storeUuid) {
+		if (StringUtils.hasText(storeUuid)) {
+			String url = conf.getRequestUrl(20100, "/store-cms/advantages?storeUuid=" + storeUuid);
+			String result = restTemplate.getForEntity(url, String.class).getBody();
+			if (StringUtils.hasText(result)) {
+				return JacksonUtils.fromJsonArray(result, AdvantageCommodity.class);
+			}
+		}
+		return Collections.emptyList();
+	}
+
+	/**
+	 * 验证批次信息是否是优势库存
+	 *
+	 * @param storeUuid 店铺UUID
+	 * @param batchcode 批次信息
+	 */
+	@Override
+	public ResultMap validCommodityIsAdvantageCommodity(String storeUuid, String batchcode) {
+		if(StringUtils.isEmpty(storeUuid)) {
+			storeUuid = sysConf.getStoreid();
+		}
+		if(StringUtils.isEmpty(storeUuid) || StringUtils.isEmpty(batchcode)) {
+			return ResultMap.success("");
+		}
+		List<AdvantageCommodity> commodities = findByStoreUuid(storeUuid);
+		for (AdvantageCommodity commodity : commodities) {
+			if(batchcode.equalsIgnoreCase(commodity.getBatchCode())) {
+				return new ResultMap(CodeType.NOT_PERMIT, "该商品存在于优势库存,请替换对应的商品");
+			}
+		}
+		return ResultMap.success("");
+	}
+}

+ 57 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/AuthStoreCmsServiceImpl.java

@@ -0,0 +1,57 @@
+package com.uas.platform.b2c.advertise.ad.service.impl;
+
+import com.uas.platform.b2c.advertise.ad.model.StoreCms;
+import com.uas.platform.b2c.advertise.ad.service.AuthStoreCmsService;
+import com.uas.platform.b2c.core.config.MicroServicesConf;
+import com.uas.platform.b2c.core.utils.JacksonUtils;
+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 org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The type Auth store cms service implementation.
+ *
+ * @author huxz
+ * @version 2017-08-02 16:11:07 创建文件
+ */
+@Service
+public class AuthStoreCmsServiceImpl implements AuthStoreCmsService {
+
+	private final MicroServicesConf conf;
+
+	private final RestTemplate restTemplate;
+
+	@Autowired
+	public AuthStoreCmsServiceImpl(MicroServicesConf conf, RestTemplate restTemplate) {
+		this.conf = conf;
+		this.restTemplate = restTemplate;
+	}
+
+	@Override
+	public ResultMap addOneTypeStoreCms(StoreIn store, String useFor, String cmsType) {
+		if (store == null || StringUtils.isEmpty(useFor) || StringUtils.isEmpty(cmsType)) {
+			return new ResultMap(CodeType.NO_INFO, "店铺信息或内容信息不能为空");
+		}
+		Map<String, String> params = new HashMap<>();
+		params.put("useFor", useFor);
+		params.put("cmsType", cmsType);
+		StoreCms storeCms = StoreCms.newStoreCms(store);
+		storeCms.setUseFor(useFor);
+		storeCms.setCmsType(cmsType);
+		String url = conf.getRequestUrl(20180, "/mall-cms-service/storeCms?useFor={useFor}&cmsType={cmsType}");
+		String result = restTemplate.postForObject(url, storeCms, String.class, params);
+		HashMap hashMap = JacksonUtils.fromJson(result, HashMap.class);
+		if (hashMap != null && hashMap.containsKey("success") && (Boolean) hashMap.get("success")) {
+			return ResultMap.success(storeCms);
+		} else {
+			return new ResultMap(CodeType.ERROR_STATE, "添加失败");
+		}
+	}
+}

+ 39 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/CarouselsServiceImpl.java

@@ -0,0 +1,39 @@
+package com.uas.platform.b2c.advertise.ad.service.impl;
+
+import com.uas.platform.b2c.advertise.ad.service.CarouselService;
+import com.uas.platform.b2c.core.config.MicroServicesConf;
+import com.uas.platform.b2c.core.utils.JsonUtil;
+import net.sf.json.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.List;
+
+/**
+ * The type Carousels service implementation.
+ *
+ * @author huxz
+ * @version 2017-08-02 16:11:37 创建文件
+ */
+@Service
+public class CarouselsServiceImpl implements CarouselService{
+
+	private final MicroServicesConf conf;
+
+	private final RestTemplate restTemplate;
+
+	@Autowired
+	public CarouselsServiceImpl(MicroServicesConf conf, RestTemplate restTemplate) {
+		this.conf = conf;
+		this.restTemplate = restTemplate;
+	}
+
+	@Override
+	public List<JSONObject> getCarousels(String usedFor) {
+		String url = conf.getRequestUrl(20030, "/carousels?usedFor=" + usedFor);
+		String result = restTemplate.getForEntity(url, String.class).getBody();
+		List<JSONObject> r = JsonUtil.parseJsonToObject(result);
+		return r;
+	}
+}

+ 38 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/FloorsServiceImpl.java

@@ -0,0 +1,38 @@
+package com.uas.platform.b2c.advertise.ad.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.uas.platform.b2c.advertise.ad.service.FloorsService;
+import com.uas.platform.b2c.core.config.MicroServicesConf;
+import com.uas.platform.b2c.core.utils.JacksonUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.List;
+
+/**
+ * The type Floors service implementation.
+ *
+ * @author  suntg
+ * @version 2017-08-02 16:12:15 创建文件
+ */
+@Service
+public class FloorsServiceImpl implements FloorsService {
+
+	private final MicroServicesConf conf;
+
+	private final RestTemplate restTemplate;
+
+	@Autowired
+	public FloorsServiceImpl(MicroServicesConf conf, RestTemplate restTemplate) {
+		this.conf = conf;
+		this.restTemplate = restTemplate;
+	}
+
+	@Override
+	public List<JSONObject> getFloorsByModule(String module) {
+		String url = conf.getRequestUrl(20040, "/floors?usedFor=" + module);
+		String result = restTemplate.getForEntity(url, String.class).getBody();
+		return JacksonUtils.fromJsonArray(result, JSONObject.class);
+	}
+}

+ 43 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/HotComponentServiceImpl.java

@@ -0,0 +1,43 @@
+package com.uas.platform.b2c.advertise.ad.service.impl;
+
+import com.uas.platform.b2c.advertise.ad.model.HotComponent;
+import com.uas.platform.b2c.advertise.ad.service.HotComponentService;
+import com.uas.platform.b2c.core.config.MicroServicesConf;
+import com.uas.platform.b2c.core.utils.JacksonUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The type Hot component service implementation.
+ *
+ * @author huxz
+ * @version 2017-08-02 16:12:41 创建文件
+ */
+@Service
+public class HotComponentServiceImpl implements HotComponentService {
+
+	private final MicroServicesConf conf;
+
+	private final RestTemplate restTemplate;
+
+	@Autowired
+	public HotComponentServiceImpl(MicroServicesConf conf, RestTemplate restTemplate) {
+		this.conf = conf;
+		this.restTemplate = restTemplate;
+	}
+
+	@Override
+	public List<HotComponent> getHotComponentByUseForAndPageFor(String useFor, String pageFor) {
+		Map<String, String> params = new HashMap<>();
+		params.put("useFor", useFor);
+		params.put("pageFor", pageFor);
+		String url = conf.getRequestUrl(20180, "/mall-cms-service/hotComponents/useFor/pageFor?useFor={useFor}&pageFor={pageFor}");
+		String result = restTemplate.getForEntity(url, String.class, params).getBody();
+		return JacksonUtils.fromJsonArray(result, HotComponent.class);
+	}
+}

+ 83 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/RecommendProductServiceImpl.java

@@ -0,0 +1,83 @@
+package com.uas.platform.b2c.advertise.ad.service.impl;
+
+import com.uas.platform.b2c.advertise.ad.model.Message;
+import com.uas.platform.b2c.advertise.ad.model.RecommendProduct;
+import com.uas.platform.b2c.advertise.ad.service.RecommendProductService;
+import com.uas.platform.b2c.advertise.ad.utils.RecommendProductsUtils;
+import com.uas.platform.b2c.core.utils.JacksonUtils;
+import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
+import com.uas.platform.b2c.prod.commodity.model.Goods;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.kafka.core.KafkaTemplate;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 产品推荐业务实现类
+ *
+ * @author huxz
+ * @version 2017-08-04 17:02:40 创建文件
+ */
+@Service
+public class RecommendProductServiceImpl implements RecommendProductService {
+
+	private final RestTemplate restTemplate;
+
+	private final GoodsDao goodsDao;
+
+	private final KafkaTemplate<String, String> kafkaTemplate;
+
+	@Autowired
+	public RecommendProductServiceImpl(RestTemplate restTemplate, GoodsDao goodsDao, KafkaTemplate<String, String> kafkaTemplate) {
+		this.restTemplate = restTemplate;
+		this.goodsDao = goodsDao;
+		this.kafkaTemplate = kafkaTemplate;
+	}
+
+	@Override
+	public void deleteProductsWhenSellerUpdateReserve(String storeUuid, Set<String> batchCodes) {
+		if (StringUtils.isEmpty(storeUuid) || CollectionUtils.isEmpty(batchCodes)) {
+			return;
+		}
+
+		Date date = new Date();
+
+		Message message = new Message();
+		message.setId(date.getTime());
+		message.setSendTime(date);
+		message.setUuid(storeUuid);
+		message.setBatchCodes(batchCodes);
+		System.out.println(JacksonUtils.toJson(message));
+
+		kafkaTemplate.send("recommend-products-delete", "batchCode", JacksonUtils.toJson(message));
+	}
+
+	@Override
+	public List<RecommendProduct> findProductsWhenUserVisitStore(String uuid) {
+		Map<String, String> map = new HashMap<>();
+		map.put("uuid", uuid);
+		String content = restTemplate.getForObject("http://api.ubtob.com/api/recommend/products?condition=store_uuid&uuid={uuid}", String.class, map);
+		if (StringUtils.isEmpty(content)) {
+			return Collections.emptyList();
+		}
+
+		List<RecommendProduct> recommendProducts = JacksonUtils.fromJsonArray(content, RecommendProduct.class);
+
+		for (RecommendProduct product : recommendProducts) {
+			Goods commodity = goodsDao.findByBatchCode(product.getBatchCode());
+			if (commodity != null) {
+				RecommendProductsUtils.fillCommodityInfo(product, commodity);
+			}
+		}
+		return recommendProducts;
+	}
+}

+ 97 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/StoreCmsServiceImpl.java

@@ -0,0 +1,97 @@
+package com.uas.platform.b2c.advertise.ad.service.impl;
+
+import com.uas.platform.b2c.advertise.ad.model.StoreCms;
+import com.uas.platform.b2c.advertise.ad.service.StoreCmsService;
+import com.uas.platform.b2c.core.config.MicroServicesConf;
+import com.uas.platform.b2c.core.config.SysConf;
+import com.uas.platform.b2c.core.utils.JacksonUtils;
+import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
+import com.uas.platform.b2c.prod.commodity.model.Goods;
+import com.uas.platform.b2c.prod.store.dao.StoreInDao;
+import com.uas.platform.b2c.prod.store.model.StoreIn;
+import com.uas.platform.b2c.prod.store.model.StoreType;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Pageable;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * The type Store cms service implementation.
+ *
+ * @author huxz
+ * @version 2017-08-02 16:13:05 创建文件
+ */
+@Service
+public class StoreCmsServiceImpl implements StoreCmsService {
+
+	private final MicroServicesConf conf;
+
+	private SysConf sysConf;
+
+	private final RestTemplate restTemplate;
+
+	private final StoreInDao storeDao;
+
+	private final GoodsDao goodsDao;
+
+	@Autowired
+	public StoreCmsServiceImpl(MicroServicesConf conf, SysConf sysConf, RestTemplate restTemplate, StoreInDao storeDao, GoodsDao goodsDao) {
+		this.conf = conf;
+		this.sysConf = sysConf;
+		this.restTemplate = restTemplate;
+		this.storeDao = storeDao;
+		this.goodsDao = goodsDao;
+	}
+
+	@Override
+	public List<StoreCms> getStoreCmsByUseForAndCmsType(String useFor, String cmsType) {
+		Map<String, String> params = new HashMap<>();
+		params.put("useFor", useFor);
+		params.put("cmsType", cmsType);
+		String url = conf.getRequestUrl(20180, "/mall-cms-service/storeCms?useFor={useFor}&cmsType={cmsType}");
+		String result = restTemplate.getForEntity(url, String.class, params).getBody();
+		return JacksonUtils.fromJsonArray(result, StoreCms.class);
+	}
+
+	@Override
+	public List<Goods> findGoodInventory(Pageable pageable) {
+		List<Goods> goodsList = new ArrayList<>();
+		if (pageable == null) {
+			return goodsList;
+		}
+
+		Set<StoreType> storeTypes = new HashSet<>();
+		storeTypes.add(StoreType.AGENCY);
+		storeTypes.add(StoreType.DISTRIBUTION);
+		List<String> uuids = storeDao.findUuidByTypeIn(storeTypes);
+
+		assert sysConf != null;
+		uuids.remove(sysConf.getStoreid());
+		System.out.println(uuids);
+
+		List<Goods> goodList = goodsDao.findGoodInventoryByReserve(uuids, pageable);
+		if (!CollectionUtils.isEmpty(goodList)) {
+			return goodList;
+		} else {
+			return goodsList;
+		}
+	}
+
+	@Override
+	public List<StoreIn> findExcellentProvider(Integer num, String types) {
+		//组合店铺类型
+		String[] typeArray = types.split("-");
+		List<String> typeList = Arrays.asList(typeArray);
+
+		return storeDao.findFiveStoresByType(num, typeList);
+	}
+}

+ 51 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/service/impl/StoreContentServiceImpl.java

@@ -0,0 +1,51 @@
+package com.uas.platform.b2c.advertise.ad.service.impl;
+
+import com.uas.platform.b2c.advertise.ad.dao.StoreContentDao;
+import com.uas.platform.b2c.advertise.ad.model.ContentType;
+import com.uas.platform.b2c.advertise.ad.model.StoreContent;
+import com.uas.platform.b2c.advertise.ad.service.StoreContentService;
+import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.persistence.criteria.PredicateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+
+/**
+ * The type Store content service implementation.
+ *
+ * @author huxz
+ * @version 2017-08-02 16:13:26 创建文件
+ */
+@Service
+public class StoreContentServiceImpl implements StoreContentService {
+
+	private final StoreContentDao storeContentDao;
+
+	@Autowired
+	public StoreContentServiceImpl(StoreContentDao storeContentDao) {
+		this.storeContentDao = storeContentDao;
+	}
+
+	@Override
+	public Page<StoreContent> getContentByType(final PageInfo pageInfo, ContentType type) {
+		if (type == null) {
+			return null;
+		}
+		pageInfo.setSort(new Sort(Sort.Direction.DESC, "score"));
+		pageInfo.expression(PredicateUtils.eq("type", type, false));
+		return storeContentDao.findAll(new Specification<StoreContent>() {
+			@Override
+			public Predicate toPredicate(Root<StoreContent> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
+				query.where(pageInfo.getPredicates(root, query, builder));
+				return null;
+			}
+		}, pageInfo);
+	}
+}

+ 42 - 0
src/main/java/com/uas/platform/b2c/advertise/ad/utils/RecommendProductsUtils.java

@@ -0,0 +1,42 @@
+package com.uas.platform.b2c.advertise.ad.utils;
+
+import com.uas.platform.b2c.advertise.ad.model.RecommendProduct;
+import com.uas.platform.b2c.fa.payment.utils.StringUtils;
+import com.uas.platform.b2c.prod.commodity.model.Goods;
+
+/**
+ * 产品推荐业务工具类
+ * 主要用于前台获取展示时,包装商品信息到产品推荐类中
+ *
+ * @author huxz
+ * @version 2017-08-04 16:05:57 创建文件
+ */
+public class RecommendProductsUtils {
+
+	/**
+	 * 向已获取的产品推荐填充商品信息
+	 *
+	 * @param recommendProduct	获取的推荐产品信息
+	 * @param goods				产品推荐对应的商品信息
+	 */
+	public static RecommendProduct fillCommodityInfo(RecommendProduct recommendProduct, Goods goods) {
+		if (recommendProduct == null || goods == null) {
+			return recommendProduct;
+		}
+
+		// 添加商品信息
+		recommendProduct.setComUuid(goods.getUuid());
+		recommendProduct.setComCode(goods.getCode());
+		recommendProduct.setComImg(StringUtils.isEmpty(goods.getImg()) ? "static/img/store/common/default.png" : goods.getImg());
+		recommendProduct.setKindUuid(goods.getKindUuid() != null ? goods.getKindUuid().toString() : null);
+		recommendProduct.setKindNameCn(goods.getKindNameCn());
+		recommendProduct.setBrandNameCn(goods.getBrandNameEn());
+		recommendProduct.setMinPriceRMB(goods.getMinPriceRMB());
+		recommendProduct.setMinPriceUSD(goods.getMinPriceUSD());
+		recommendProduct.setReserve(goods.getReserve());
+		recommendProduct.setCurrency(goods.getCurrencyName());
+		recommendProduct.setStoreId(goods.getStoreid());
+
+		return recommendProduct;
+	}
+}

+ 19 - 0
src/main/java/com/uas/platform/b2c/advertise/news/Readme.md

@@ -0,0 +1,19 @@
+## name
+
+news
+
+## 名称
+
+新闻资讯
+
+## 创建人
+
+huxz
+
+## 创建时间
+
+2017年7月31日19:25:25
+
+## 说明
+
+新闻、专访

+ 61 - 0
src/main/java/com/uas/platform/b2c/advertise/news/api/NewsController.java

@@ -0,0 +1,61 @@
+package com.uas.platform.b2c.advertise.news.api;
+
+import com.alibaba.fastjson.JSONObject;
+import com.uas.platform.b2c.advertise.news.service.NewsService;
+import org.springframework.beans.factory.annotation.Autowired;
+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.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 新闻接口类
+ *
+ * @author suntg
+ * @version 2017-08-02 15:26:08 创建文件
+ */
+@RestController
+@RequestMapping("/api/news")
+public class NewsController {
+
+	private final NewsService newsService;
+
+	@Autowired
+	public NewsController(NewsService newsService) {
+		this.newsService = newsService;
+	}
+
+	/**
+	 * 分页获取优软科技官网中的新闻
+	 *
+	 * @param page		页码
+	 * @param pageSize	每页记录条数
+	 */
+	@RequestMapping(value = "/created", method = RequestMethod.GET)
+	public JSONObject getCarousels(@RequestParam(defaultValue = "1") int page , @RequestParam(defaultValue = "10") int pageSize) {
+		return newsService.getNewsListByPage(page, pageSize);
+	}
+
+	/**
+	 * 根据点击量获取优软科技官网中的新闻
+	 *
+	 * @param page		页码
+	 * @param pageSize	每页记录条数
+	 */
+	@RequestMapping(value = "/viewCount", method = RequestMethod.GET)
+	public JSONObject getNewsListOrderByViewCount(@RequestParam(defaultValue = "1") int page , @RequestParam(defaultValue = "10") int pageSize) {
+		return newsService.getNewsListOrderByViewCount(page, pageSize);
+	}
+
+	/**
+	 * 根据新闻ID获取具体新闻信息
+	 *
+	 * @param id	新闻ID
+	 * @return	新闻信息
+	 */
+	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
+	JSONObject getNewsById(@PathVariable Long id) {
+		return newsService.getNewsById(id);
+	}
+}

+ 35 - 0
src/main/java/com/uas/platform/b2c/advertise/news/service/NewsService.java

@@ -0,0 +1,35 @@
+package com.uas.platform.b2c.advertise.news.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * 新闻操作业务类
+ *
+ * @author suntg
+ * @version 2017-08-02 15:23:25 创建文件
+ */
+public interface NewsService {
+
+	/**
+	 * 根据创建时间获取新闻列表
+	 *
+	 * @param page          页码
+	 * @param pageSize      新闻条数
+	 */
+	JSONObject getNewsListByPage(int page, int pageSize);
+
+	/**
+	 * 根据查看数量获取新闻列表
+	 *
+	 * @param page          页码
+	 * @param pageSize      每页新闻条数
+	 */
+	JSONObject getNewsListOrderByViewCount(int page, int pageSize);
+
+	/**
+	 * 根据新闻ID获取新闻信息
+	 *
+	 * @param id		新闻ID
+	 */
+	JSONObject getNewsById(Long id);
+}

+ 53 - 0
src/main/java/com/uas/platform/b2c/advertise/news/service/impl/NewsServiceImpl.java

@@ -0,0 +1,53 @@
+package com.uas.platform.b2c.advertise.news.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.uas.platform.b2c.advertise.news.service.NewsService;
+import com.uas.platform.b2c.core.config.MicroServicesConf;
+import com.uas.platform.b2c.core.utils.JacksonUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * 新闻操作业务实现类
+ *
+ * @author suntg
+ * @version 2017-08-02 15:25:04 创建文件
+ */
+@Service
+public class NewsServiceImpl implements NewsService {
+
+	private final MicroServicesConf conf;
+
+	private final RestTemplate restTemplate;
+
+	@Autowired
+	public NewsServiceImpl(MicroServicesConf conf, RestTemplate restTemplate) {
+		this.conf = conf;
+		this.restTemplate = restTemplate;
+	}
+
+	@Override
+	public JSONObject getNewsListByPage(int page, int pageSize) {
+		if (page <= 0) page = 1;
+		String url = conf.getRequestUrl(20210, "/news/created/v2?pagenumber=" + page +"&pagesize=" + pageSize + "&taxonomySlug=B2C");
+		String result = restTemplate.getForEntity(url, String.class).getBody();
+		return JacksonUtils.fromJson(result, JSONObject.class);
+	}
+
+	@Override
+	public JSONObject getNewsListOrderByViewCount(int page, int pageSize) {
+		if (page <= 0) page = 1;
+		String url = conf.getRequestUrl(20210, "/news/viewcount/v2?pagenumber=" + page +"&pagesize=" + pageSize + "&taxonomySlug=B2C");
+		String result = restTemplate.getForEntity(url, String.class).getBody();
+		return JacksonUtils.fromJson(result, JSONObject.class);
+	}
+
+	@Override
+	public JSONObject getNewsById(Long id) {
+		if (id == null) return null;
+		String url = conf.getRequestUrl(20210, "/news/" +  id);
+		String result = restTemplate.getForEntity(url, String.class).getBody();
+		return JacksonUtils.fromJson(result, JSONObject.class);
+	}
+}

+ 19 - 0
src/main/java/com/uas/platform/b2c/analysis/bi/Readme.md

@@ -0,0 +1,19 @@
+## name
+
+bi
+
+## 名称
+
+数据挖掘
+
+## 创建人
+
+huxz
+
+## 创建时间
+
+2017年7月31日19:25:25
+
+## 说明
+
+数据挖掘

+ 19 - 0
src/main/java/com/uas/platform/b2c/analysis/stat/Readme.md

@@ -0,0 +1,19 @@
+## name
+
+stat
+
+## 名称
+
+统计模块
+
+## 创建人
+
+huxz
+
+## 创建时间
+
+2017年7月31日19:25:25
+
+## 说明
+
+交易、库存、财务的一些统计

+ 55 - 0
src/main/java/com/uas/platform/b2c/analysis/stat/controller/VendorSaleStatController.java

@@ -0,0 +1,55 @@
+package com.uas.platform.b2c.analysis.stat.controller;
+
+import com.uas.platform.b2c.analysis.stat.model.VendorSaleStatDay;
+import com.uas.platform.b2c.analysis.stat.model.VendorSaleStatMonth;
+import com.uas.platform.b2c.analysis.stat.model.VendorSaleStatYear;
+import com.uas.platform.b2c.analysis.stat.service.VendorSaleStatService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 供应商销售情况统计(年、月、日)
+ *
+ * @author zhangzl
+ * @version 2017-08-02 16:34:14 创建文件
+ */
+@RestController
+@RequestMapping("/trade/stat")
+public class VendorSaleStatController {
+	
+	@Autowired
+	private VendorSaleStatService vendorSaleStatService;
+
+	/**
+	 * 卖家年度销售情况统计
+	 *
+	 * @return year stat
+	 */
+	@RequestMapping(value="/year")
+	public List<VendorSaleStatYear> getYearStat() {
+		return vendorSaleStatService.getYearStat();
+	}
+
+	/**
+	 * 卖家月度销售情况统计
+	 *
+	 * @return month stat
+	 */
+	@RequestMapping(value="/month")
+	public List<VendorSaleStatMonth> getMonthStat() {
+		return vendorSaleStatService.getMonthStat();
+	}
+
+	/**
+	 * 卖家日销售情况统计
+	 *
+	 * @return day stat
+	 */
+	@RequestMapping(value="/day")
+	public List<VendorSaleStatDay> getDayStat() {
+		return vendorSaleStatService.getDayStat();
+	}
+}

+ 28 - 0
src/main/java/com/uas/platform/b2c/analysis/stat/dao/VendorSaleStatDayDao.java

@@ -0,0 +1,28 @@
+package com.uas.platform.b2c.analysis.stat.dao;
+
+import com.uas.platform.b2c.analysis.stat.model.VendorSaleStatDay;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * The interface Vendor sale stat day dao.
+ *
+ * @author zhangzl
+ * @version 2017-08-02 16:35:12 创建文件
+ */
+@Repository
+public interface VendorSaleStatDayDao extends JpaSpecificationExecutor<VendorSaleStatDay>, JpaRepository<VendorSaleStatDay, Long>  {
+
+	/**
+	 * 根据月份和企业UU查询上月统计情况
+	 *
+	 * @param enUU  the en uu
+	 * @param month the month
+	 * @return list
+	 */
+	List<VendorSaleStatDay> findByEnUUAndMonth(Long enUU, int month);
+
+}

+ 27 - 0
src/main/java/com/uas/platform/b2c/analysis/stat/dao/VendorSaleStatMonthDao.java

@@ -0,0 +1,27 @@
+package com.uas.platform.b2c.analysis.stat.dao;
+
+import com.uas.platform.b2c.analysis.stat.model.VendorSaleStatMonth;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * The interface Vendor sale stat month dao.
+ *
+ * @author zhangzl
+ * @version 2017-08-02 16:35:50 创建文件
+ */
+@Repository
+public interface VendorSaleStatMonthDao extends JpaSpecificationExecutor<VendorSaleStatMonth>, JpaRepository<VendorSaleStatMonth, Long> {
+
+	/**
+	 * 根据年份和企业UU查询月度统计情况
+	 *
+	 * @param enUU the en uu
+	 * @param year the year
+	 * @return list
+	 */
+	List<VendorSaleStatMonth> findByEnUUAndYear(Long enUU, int year);
+}

+ 27 - 0
src/main/java/com/uas/platform/b2c/analysis/stat/dao/VendorSaleStatYearDao.java

@@ -0,0 +1,27 @@
+package com.uas.platform.b2c.analysis.stat.dao;
+
+
+import com.uas.platform.b2c.analysis.stat.model.VendorSaleStatYear;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+/**
+ * The interface Vendor sale stat year dao.
+ *
+ * @author huxz
+ * @version 2017-08-02 16:36:28 创建文件
+ */
+@Repository
+public interface VendorSaleStatYearDao extends JpaSpecificationExecutor<VendorSaleStatYear>, JpaRepository<VendorSaleStatYear, Long>  {
+
+	/**
+	 * 根据年份和企业UU查询最近五年的销售情况
+	 *
+	 * @param enUU the en uu
+	 * @param year the year
+	 * @return vendor sale stat year
+	 */
+	VendorSaleStatYear findByEnUUAndYear(Long enUU, int year);
+
+}

+ 147 - 0
src/main/java/com/uas/platform/b2c/analysis/stat/model/VendorSaleStatDay.java

@@ -0,0 +1,147 @@
+package com.uas.platform.b2c.analysis.stat.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Index;
+import javax.persistence.Table;
+
+/**
+ * 销售额统计日
+ *
+ * @author zhangzl
+ * @version 2017-08-02 16:36:53 创建文件
+ */
+@Entity
+@Table(name="vendor$sale$stat$day", indexes = { @Index(name = "vendor$sale$stat$day_enuu_idx", columnList = "vss_enuu")})
+public class VendorSaleStatDay {
+
+	/**
+	 * ID
+	 */
+	@Id
+	@Column(name = "vss_id")
+	private Long id;
+	
+	/**
+	 * 企业UU
+	 */
+	@Column(name = "vss_enuu")
+	private Long enUU;
+
+	/**
+	 * 年
+	 */
+	@Column(name = "vss_year")
+	private int year;
+
+	/**
+	 * 月
+	 */
+	@Column(name = "vss_month")
+	private int month;
+
+	/**
+	 * 日
+	 */
+	@Column(name = "vss_day")
+	private int day;
+
+	/**
+	 * 总数
+	 */
+	@Column(name = "vss_total")
+	private Double total;
+
+	/**
+	 * Gets id.
+	 *
+	 * @return the id
+	 */
+	public Long getId() {
+		return id;
+	}
+
+	/**
+	 * Sets id.
+	 *
+	 * @param id the id
+	 */
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	/**
+	 * Gets year.
+	 *
+	 * @return the year
+	 */
+	public int getYear() {
+		return year;
+	}
+
+	/**
+	 * Sets year.
+	 *
+	 * @param year the year
+	 */
+	public void setYear(int year) {
+		this.year = year;
+	}
+
+	/**
+	 * Gets month.
+	 *
+	 * @return the month
+	 */
+	public int getMonth() {
+		return month;
+	}
+
+	/**
+	 * Sets month.
+	 *
+	 * @param month the month
+	 */
+	public void setMonth(int month) {
+		this.month = month;
+	}
+
+	/**
+	 * Gets day.
+	 *
+	 * @return the day
+	 */
+	public int getDay() {
+		return day;
+	}
+
+	/**
+	 * Sets day.
+	 *
+	 * @param day the day
+	 */
+	public void setDay(int day) {
+		this.day = day;
+	}
+
+	/**
+	 * Gets total.
+	 *
+	 * @return the total
+	 */
+	public Double getTotal() {
+		return total;
+	}
+
+	/**
+	 * Sets total.
+	 *
+	 * @param total the total
+	 */
+	public void setTotal(Double total) {
+		this.total = total;
+	}
+	
+	
+}

+ 140 - 0
src/main/java/com/uas/platform/b2c/analysis/stat/model/VendorSaleStatMonth.java

@@ -0,0 +1,140 @@
+package com.uas.platform.b2c.analysis.stat.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Index;
+import javax.persistence.Table;
+
+/**
+ * 销售额统计(月)
+ *
+ * @author zhangzl
+ * @version 2017-08-02 16:37:52 创建文件
+ */
+@Entity
+@Table(name = "vendor$sale$stat$month", indexes = { @Index(name = "vendor$sale$stat$day_enuu_idx", columnList = "vss_enuu") })
+public class VendorSaleStatMonth {
+
+	/**
+	 * ID
+	 */
+	@Id
+	@Column(name = "vss_id")
+	private Long id;
+
+	/**
+	 * 企业UU
+	 */
+	@Column(name = "vss_enuu")
+	private Long enUU;
+
+	/**
+	 * 年
+	 */
+	@Column(name = "vss_year")
+	private int year;
+
+	/**
+	 * 月
+	 */
+	@Column(name = "vss_month")
+	private int month;
+
+	/**
+	 * 日
+	 */
+	@Column(name = "vss_total")
+	private Double total;
+
+	/**
+	 * Gets id.
+	 *
+	 * @return the id
+	 */
+	public Long getId() {
+		return id;
+	}
+
+	/**
+	 * Sets id.
+	 *
+	 * @param id the id
+	 */
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	/**
+	 * Gets en uu.
+	 *
+	 * @return the en uu
+	 */
+	public Long getEnUU() {
+		return enUU;
+	}
+
+	/**
+	 * Sets en uu.
+	 *
+	 * @param enUU the en uu
+	 */
+	public void setEnUU(Long enUU) {
+		this.enUU = enUU;
+	}
+
+	/**
+	 * Gets year.
+	 *
+	 * @return the year
+	 */
+	public int getYear() {
+		return year;
+	}
+
+	/**
+	 * Sets year.
+	 *
+	 * @param year the year
+	 */
+	public void setYear(int year) {
+		this.year = year;
+	}
+
+	/**
+	 * Gets month.
+	 *
+	 * @return the month
+	 */
+	public int getMonth() {
+		return month;
+	}
+
+	/**
+	 * Sets month.
+	 *
+	 * @param month the month
+	 */
+	public void setMonth(int month) {
+		this.month = month;
+	}
+
+	/**
+	 * Gets total.
+	 *
+	 * @return the total
+	 */
+	public Double getTotal() {
+		return total;
+	}
+
+	/**
+	 * Sets total.
+	 *
+	 * @param total the total
+	 */
+	public void setTotal(Double total) {
+		this.total = total;
+	}
+
+}

+ 116 - 0
src/main/java/com/uas/platform/b2c/analysis/stat/model/VendorSaleStatYear.java

@@ -0,0 +1,116 @@
+package com.uas.platform.b2c.analysis.stat.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Index;
+import javax.persistence.Table;
+
+/**
+ * 销售额统计(年)
+ *
+ * @author yingp
+ * @version 2017-08-02 16:38:39 创建文件
+ */
+@Entity
+@Table(name = "vendor$sale$stat$year", indexes = { @Index(name = "vendor$sale$stat$day_enuu_idx", columnList = "vss_enuu") })
+public class VendorSaleStatYear {
+
+	/**
+	 * ID
+	 */
+	@Id
+	@Column(name = "vss_id")
+	private Long id;
+
+	/**
+	 * 企业UU
+	 */
+	@Column(name = "vss_enuu")
+	private Long enUU;
+
+	/**
+	 * 年
+	 */
+	@Column(name = "vss_year")
+	private int year;
+
+	/**
+	 * 总数
+	 */
+	@Column(name = "vss_total")
+	private Double total;
+
+	/**
+	 * Gets id.
+	 *
+	 * @return the id
+	 */
+	public Long getId() {
+		return id;
+	}
+
+	/**
+	 * Sets id.
+	 *
+	 * @param id the id
+	 */
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	/**
+	 * Gets en uu.
+	 *
+	 * @return the en uu
+	 */
+	public Long getEnUU() {
+		return enUU;
+	}
+
+	/**
+	 * Sets en uu.
+	 *
+	 * @param enUU the en uu
+	 */
+	public void setEnUU(Long enUU) {
+		this.enUU = enUU;
+	}
+
+	/**
+	 * Gets year.
+	 *
+	 * @return the year
+	 */
+	public int getYear() {
+		return year;
+	}
+
+	/**
+	 * Sets year.
+	 *
+	 * @param year the year
+	 */
+	public void setYear(int year) {
+		this.year = year;
+	}
+
+	/**
+	 * Gets total.
+	 *
+	 * @return the total
+	 */
+	public Double getTotal() {
+		return total;
+	}
+
+	/**
+	 * Sets total.
+	 *
+	 * @param total the total
+	 */
+	public void setTotal(Double total) {
+		this.total = total;
+	}
+
+}

+ 38 - 0
src/main/java/com/uas/platform/b2c/analysis/stat/service/VendorSaleStatService.java

@@ -0,0 +1,38 @@
+package com.uas.platform.b2c.analysis.stat.service;
+
+import com.uas.platform.b2c.analysis.stat.model.VendorSaleStatDay;
+import com.uas.platform.b2c.analysis.stat.model.VendorSaleStatMonth;
+import com.uas.platform.b2c.analysis.stat.model.VendorSaleStatYear;
+
+import java.util.List;
+
+/**
+ * The interface Vendor sale stat service.
+ *
+ * @author zhangzl
+ * @version 2017-08-02 16:39:39 创建文件
+ */
+public interface VendorSaleStatService {
+
+	/**
+	 * 卖家年销售情况统计
+	 *
+	 * @return year stat
+	 */
+	List<VendorSaleStatYear> getYearStat();
+
+	/**
+	 * 卖家月度销售情况统计
+	 *
+	 * @return month stat
+	 */
+	List<VendorSaleStatMonth> getMonthStat();
+
+	/**
+	 * 卖家日销售情况统计
+	 *
+	 * @return day stat
+	 */
+	List<VendorSaleStatDay> getDayStat();
+
+}

+ 72 - 0
src/main/java/com/uas/platform/b2c/analysis/stat/service/impl/VendorSaleStatServiceImpl.java

@@ -0,0 +1,72 @@
+package com.uas.platform.b2c.analysis.stat.service.impl;
+
+import com.uas.platform.b2c.analysis.stat.dao.VendorSaleStatDayDao;
+import com.uas.platform.b2c.analysis.stat.dao.VendorSaleStatMonthDao;
+import com.uas.platform.b2c.analysis.stat.dao.VendorSaleStatYearDao;
+import com.uas.platform.b2c.analysis.stat.model.VendorSaleStatDay;
+import com.uas.platform.b2c.analysis.stat.model.VendorSaleStatMonth;
+import com.uas.platform.b2c.analysis.stat.model.VendorSaleStatYear;
+import com.uas.platform.b2c.analysis.stat.service.VendorSaleStatService;
+import com.uas.platform.b2c.core.support.SystemSession;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+/**
+ * The type Vendor sale stat service implementation.
+ *
+ * @author zhangzl
+ * @version 2017-08-02 16:40:30 创建文件
+ */
+@Service
+public class VendorSaleStatServiceImpl implements VendorSaleStatService {
+
+
+	@Autowired
+	private VendorSaleStatYearDao vendorSaleStatYearDao;
+
+	@Autowired
+	private VendorSaleStatMonthDao vendorSaleStatMonthDao;
+
+	@Autowired
+	private VendorSaleStatDayDao vendorSaleStatDayDao;
+
+	@Override
+	public List<VendorSaleStatYear> getYearStat() {
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		Calendar c = Calendar.getInstance();
+		int year = c.get(Calendar.YEAR);
+		int[] arr = {year - 5, year - 4, year - 3, year - 2, year - 1, year};
+		List<VendorSaleStatYear> list = new ArrayList<VendorSaleStatYear>(6);
+		for (int i = 0; i < 6; i++) {
+			int y = arr[i];
+			VendorSaleStatYear yearStat = vendorSaleStatYearDao.findByEnUUAndYear(enuu, y);
+			if (yearStat != null) {
+				list.add(i, yearStat);
+			} else {
+				list.add(i, null);
+			}
+		}
+		return list;
+	}
+
+	@Override
+	public List<VendorSaleStatMonth> getMonthStat() {
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		Calendar c = Calendar.getInstance();
+		int year = c.get(Calendar.YEAR);
+		return vendorSaleStatMonthDao.findByEnUUAndYear(enuu, year);
+	}
+
+	@Override
+	public List<VendorSaleStatDay> getDayStat() {
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		Calendar c = Calendar.getInstance();
+		int month = c.get(Calendar.MONTH);
+		return vendorSaleStatDayDao.findByEnUUAndMonth(enuu, month);
+	}
+
+}

+ 19 - 0
src/main/java/com/uas/platform/b2c/common/account/Readme.md

@@ -0,0 +1,19 @@
+## name
+
+account
+
+## 名称
+
+账户模块
+
+## 创建人
+
+suntg
+
+## 创建时间
+
+2017年7月31日19:23:32
+
+## 说明
+
+系统登录用户,用户、企业、角色、资源、权限

+ 120 - 0
src/main/java/com/uas/platform/b2c/common/account/api/AuthedWebPageController.java

@@ -0,0 +1,120 @@
+package com.uas.platform.b2c.common.account.api;
+
+import com.uas.account.util.AccountUtils;
+import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.account.model.ResourceItem;
+import com.uas.platform.b2c.common.account.model.Role;
+import com.uas.platform.b2c.common.account.model.User;
+import com.uas.platform.b2c.common.account.service.EnterpriseService;
+import com.uas.platform.b2c.common.account.service.UserService;
+import com.uas.platform.b2c.common.account.support.AuthenErrors;
+import com.uas.platform.b2c.core.config.SysConf;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.b2c.core.support.TrustedAuthenticationToken;
+import com.uas.platform.core.exception.SystemError;
+import com.uas.platform.core.model.Constant;
+import com.uas.platform.core.util.AgentUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
+import org.springframework.stereotype.Controller;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * 认证信息跳转界面
+ * 
+ * @author yingp
+ * 
+ */
+@RequestMapping("/api")
+@Controller
+public class AuthedWebPageController {
+
+	@Autowired
+	private EnterpriseService enterpriseService;
+
+	@Autowired
+	private SysConf sysConf;
+
+	@Autowired
+	private UserService userService;
+
+	/**
+	 * 用token信息自动登录并打开web页面
+	 * 
+	 * @param request
+	 * @param response
+	 * @param access_token
+	 * @param redirect_page
+	 * @throws IOException
+	 */
+	@RequestMapping(value = "/webpage", method = RequestMethod.GET)
+	public void getWebPageAccessToken(HttpServletRequest request, HttpServletResponse response,
+			@RequestParam(value = "access_token", required = true) String access_token,
+			@RequestParam(value = "redirect_page", required = true) String redirect_page) throws Exception {
+		// 调用账户中心接口验证token
+		com.uas.account.entity.User accountUser = AccountUtils.loginByAccessToken(request, response, access_token);
+		if (accountUser != null) {
+			Enterprise enterprise = enterpriseService.getEnterpriseInfo(Long.parseLong(accountUser.getSpaceDialectUID()));
+			if (enterprise != null) {
+				// 将企业信息、企业管理员信息写入SystemSession
+				User user = userService.findUserByUserUU(Long.parseLong(accountUser.getDialectUID()));
+				if (null == user) {
+					user = userService.findUserByUserUU(enterprise.getEnAdminuu());
+				}
+				if (user != null) {
+					user.setEnterprise(enterprise);
+					user.setIp(AgentUtils.getIp(request));
+					SystemSession.setUser(user);
+					Collection<GrantedAuthority> array = getGrantedAuthorities(user);
+					TrustedAuthenticationToken authenticate = new TrustedAuthenticationToken(user.getUserUU(), array);
+					SecurityContextHolder.getContext().setAuthentication(authenticate);
+					request.getSession().setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY,
+							SecurityContextHolder.getContext());
+					request.getSession().setAttribute("user", user);
+					response.sendRedirect("../" + redirect_page);
+				}
+			}
+			throw new SystemError(AuthenErrors.EN_NOT_FOUND);
+		}
+		throw new SystemError(AuthenErrors.ACCESS_TOKEN_EXPIRES);
+	}
+
+	/**
+	 * 根据用户获取权限集合
+	 * @param user
+	 * @return
+	 */
+	private Set<GrantedAuthority> getGrantedAuthorities(User user) {
+		Set<GrantedAuthority> authSet = new HashSet<GrantedAuthority>();
+		Set<Role> roles = user.getRoles();
+		if (!CollectionUtils.isEmpty(roles)) {
+			for (Role role : roles) {
+				if (role.isSys()) {// 超级账号
+					user.setIssys(Constant.YES);
+					// break;
+				}
+				Set<ResourceItem> resourceItems = role.getResourceItems();
+				if (!CollectionUtils.isEmpty(resourceItems)) {
+					for (ResourceItem res : resourceItems) {
+						authSet.add(new SimpleGrantedAuthority(res.getName()));
+					}
+				}
+			}
+		}
+		return authSet;
+	}
+
+}

+ 109 - 0
src/main/java/com/uas/platform/b2c/common/account/api/TokenController.java

@@ -0,0 +1,109 @@
+package com.uas.platform.b2c.common.account.api;
+
+import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.account.model.User;
+import com.uas.platform.b2c.common.account.service.EnterpriseService;
+import com.uas.platform.b2c.common.account.service.UserService;
+import com.uas.platform.b2c.common.account.support.AuthenErrors;
+import com.uas.platform.b2c.common.base.model.AccessToken;
+import com.uas.platform.b2c.common.base.service.AccessTokenService;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.core.exception.SystemError;
+import com.uas.platform.core.util.AgentUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+
+@RestController
+@RequestMapping("/api")
+public class TokenController {
+
+	@Autowired
+	private AccessTokenService accessTokenService;
+
+	@Autowired
+	private EnterpriseService enterpriseService;
+
+	@Autowired
+	private UserService userService;
+
+	/**
+	 * 产生token信息,绑定企业信息
+	 * 
+	 * @param request
+	 * @param id
+	 * @param secret
+	 * @return
+	 */
+	@RequestMapping(value = "/token", method = RequestMethod.GET)
+	public ModelMap getAccessToken(HttpServletRequest request, @RequestParam(value = "id", required = true) Long id,
+			@RequestParam(value = "secret", required = true) String secret) {
+		ModelMap map = new ModelMap();
+		Enterprise enterprise = enterpriseService.getEnterpriseInfo(id);
+		if (enterprise == null)
+			throw new SystemError(AuthenErrors.EN_ID_NOT_FOUND);
+		if (enterprise.getAccessSecret() == null)
+			throw new SystemError(AuthenErrors.EN_IS_NOT_ALLOWED);
+		if (!secret.equals(enterprise.getAccessSecret()))
+			throw new SystemError(AuthenErrors.SECRET_IS_ERROR);
+		try {
+			// 将企业信息、企业管理员信息写入SystemSession
+			User user = userService.findUserByUserUU(enterprise.getEnAdminuu());
+			if (user != null) {
+				user.setEnterprise(enterprise);
+				user.setIp(AgentUtils.getIp(request));
+				SystemSession.setUser(user);
+			} else
+				throw new SystemError(AuthenErrors.EN_NOT_FOUND);
+			AccessToken token = accessTokenService.createNew(null, 60);
+			map.put("access_token", token.getId());
+			map.put("time", token.getTime());
+			map.put("expires_in", token.getExpires_in());
+		} finally {
+			SystemSession.clear();
+		}
+		return map;
+	}
+
+	/**
+	 * 获取web页面打开的token信息
+	 * 
+	 * @param request
+	 * @param id
+	 * @param secret
+	 * @return
+	 */
+	@RequestMapping(value = "/webpage/token", method = RequestMethod.GET)
+	public ModelMap getWebPageAccessToken(HttpServletRequest request, @RequestParam(value = "id", required = true) Long id,
+			@RequestParam(value = "secret", required = true) String secret) {
+		ModelMap map = new ModelMap();
+		Enterprise enterprise = enterpriseService.getEnterpriseInfo(id);
+		if (enterprise == null)
+			throw new SystemError(AuthenErrors.EN_ID_NOT_FOUND);
+		if (enterprise.getAccessSecret() == null)
+			throw new SystemError(AuthenErrors.EN_IS_NOT_ALLOWED);
+		if (!secret.equals(enterprise.getAccessSecret()))
+			throw new SystemError(AuthenErrors.SECRET_IS_ERROR);
+		try {
+			// 将企业信息、企业管理员信息写入SystemSession
+			User user = userService.findUserByUserUU(enterprise.getEnAdminuu());
+			if (user != null) {
+				user.setEnterprise(enterprise);
+				user.setIp(AgentUtils.getIp(request));
+				SystemSession.setUser(user);
+			} else
+				throw new SystemError(AuthenErrors.EN_NOT_FOUND);
+			AccessToken token = accessTokenService.createNew(null, 60);
+			map.put("access_token", token.getId());
+		} finally {
+			SystemSession.clear();
+		}
+		return map;
+	}
+
+}

+ 42 - 0
src/main/java/com/uas/platform/b2c/common/account/controller/AuthenticationController.java

@@ -0,0 +1,42 @@
+package com.uas.platform.b2c.common.account.controller;
+
+import com.uas.platform.b2c.common.account.model.User;
+import com.uas.platform.b2c.common.account.model.UserInfo;
+import com.uas.platform.b2c.core.support.SystemSession;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ *
+ */
+@RestController
+@RequestMapping("/user/authentication")
+public class AuthenticationController {
+
+	@RequestMapping(method = RequestMethod.GET, headers = "Accept=application/json")
+	@ResponseBody
+	@ResponseStatus(value = HttpStatus.OK)
+	public UserInfo getAuthentication() {
+		if (SystemSession.getUser() == null) {
+			return null;
+		}
+		return new UserInfo(SystemSession.getUser());
+	}
+
+	/**
+	 * 切换企业
+	 * 
+	 * @param enUU
+	 */
+	@RequestMapping(value = "/{enUU}")
+	@ResponseBody
+	public void switchEnterprise(@PathVariable("enUU") long enUU) {
+		User user = SystemSession.getUser();
+		if ( enUU == 0L){
+			user.setEnterprise(null);
+		}else {
+			user.setCurrentEnterprise(enUU);
+		}
+	}
+
+}

+ 93 - 0
src/main/java/com/uas/platform/b2c/common/account/controller/EnterpriseController.java

@@ -0,0 +1,93 @@
+package com.uas.platform.b2c.common.account.controller;
+
+import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.account.service.EnterpriseService;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.b2c.prod.store.service.StoreInService;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 企业信息
+ * @author suntg
+ * @version 2017年8月2日15:47:31 更新注释说明
+ */
+@RestController
+@RequestMapping("/basic/enterprise")
+public class EnterpriseController {
+	
+	@Autowired
+	private EnterpriseService enterpriseService;
+
+	@Autowired
+	private StoreInService storeService;
+
+	/**
+	 * 根据UU获取企业信息
+	 * @param enuu 企业uu号
+	 * @return 完整的企业信息
+	 */
+	@RequestMapping(value = "/{enuu}/info", method = RequestMethod.GET)
+	public Enterprise getEnterpriseInfo(@PathVariable Long enuu){
+		return enterpriseService.getEnterpriseInfo(enuu);
+	}
+
+	/**
+	 * 修改企业基本资料
+	 *
+	 * @return
+	 */
+	@RequestMapping(value = "/{enuu}/info", method = RequestMethod.POST)
+	public Enterprise updateEnterprise(@PathVariable Long enuu , @RequestBody Enterprise enterprise) {
+		enterprise = enterpriseService.save(enterprise);
+		SystemSession.getUser().setCurrentEnterprise(enterprise.getUu());
+		return enterprise;
+	}
+
+	/**
+	 * 根据注册地址返回币别信息
+	 * @return 企业的币别信息 USD/RMB
+	 */
+	@RequestMapping(value = "/currency", method = RequestMethod.GET)
+	public ResultMap getCurrencyByRegisterAddress() {
+		return enterpriseService.getCurrencyByRegisterAddress();
+	}
+
+	/**
+	 * 获取当前登录企业的店铺信息
+	 * @return 店铺信息
+	 */
+	@RequestMapping(value = "/store", method = RequestMethod.GET)
+	public ResultMap getStoreInfo() {
+		return storeService.getStoreInfo();
+	}
+
+	/**
+	 * 个人用户注册企业信息
+	 * @return
+	 */
+	@RequestMapping(value = "/register", method = RequestMethod.POST)
+	public ResultMap registerEnterprise(Enterprise enterprise, String filePath) {
+		return enterpriseService.registerEnterprise(enterprise,filePath,SystemSession.getUser());
+	}
+
+	/**
+	 * 个人用户注册企业信息(校验企业名称)
+	 * @return
+	 */
+	@RequestMapping(value = "/register/valid/name", method = RequestMethod.POST)
+	public ResultMap validName(String name) {
+		return enterpriseService.validName(name);
+	}
+
+	/**
+	 * 个人用户注册企业信息(校验营业执照)
+	 * @return
+	 */
+	@RequestMapping(value = "/register/valid/businessCode", method = RequestMethod.POST)
+	public ResultMap validBusinessCode(String businessCode) {
+		return enterpriseService.validBusinessCode(businessCode);
+	}
+
+}

+ 270 - 0
src/main/java/com/uas/platform/b2c/common/account/controller/SecurityController.java

@@ -0,0 +1,270 @@
+package com.uas.platform.b2c.common.account.controller;
+
+import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.account.model.SigninLog;
+import com.uas.platform.b2c.common.account.model.User;
+import com.uas.platform.b2c.common.account.service.SigninLogService;
+import com.uas.platform.b2c.common.account.service.UserService;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.core.util.AgentUtils;
+import com.uas.platform.core.util.serializer.FlexJsonUtils;
+import com.uas.sso.AuthToken;
+import com.uas.sso.SSOConfig;
+import com.uas.sso.SSOHelper;
+import com.uas.sso.SSOToken;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.mobile.device.Device;
+import org.springframework.mobile.device.DeviceResolver;
+import org.springframework.mobile.device.LiteDeviceResolver;
+import org.springframework.mobile.device.site.SitePreference;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.ResponseStatus;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+
+/**
+ * 处理登录和登录跳转
+ * @author yingp
+ * @version 2017年8月2日15:51:30 更新注释说明
+ */
+@Controller
+public class SecurityController {
+
+	private static final Logger logger = Logger.getLogger(SecurityController.class);
+
+	@Autowired
+	private UserService userService;
+	@Autowired
+	private SigninLogService signinLogService;
+	private final DeviceResolver deviceResolver = new LiteDeviceResolver();
+
+	/**
+	 * 退出登录
+	 * @param request
+	 * @param response
+	 * @param session
+	 * @param returnUrl 退出之后要跳转的路径
+	 * @return
+	 * @throws IOException
+	 */
+	@RequestMapping(value = "/logout", method = RequestMethod.GET, headers = "Accept=application/json")
+	@ResponseStatus(value = HttpStatus.OK)
+	@ResponseBody
+	public ModelMap logout(HttpServletRequest request, HttpServletResponse response, HttpSession session, String returnUrl)
+			throws IOException {
+		session.invalidate();
+		SSOHelper.clearLogin(request, response);
+		SystemSession.clear();
+		if (StringUtils.isEmpty(returnUrl)) {
+			returnUrl = request.getHeader("Referer");
+		}
+		boolean cross = SSOHelper.isCrossDomain(request);
+		if (cross) {
+			request.getSession().setAttribute(SSOConfig.SSOReferer, returnUrl);
+			// 跨域情况,需要再次询问账户中心
+			returnUrl = request.getContextPath() + "/logout/proxy";
+		}
+		return new ModelMap("content", returnUrl);
+	}
+
+	/**
+	 * 获取跳转登录的url
+	 * 
+	 * @param request
+	 * @param response
+	 * @return
+	 * @throws IOException
+	 */
+	@RequestMapping(value = "/login/page")
+	@ResponseBody
+	public ModelMap signin(HttpServletRequest request, HttpServletResponse response, String returnUrl) throws IOException {
+		request.getSession().setAttribute(SSOConfig.SSOReferer, returnUrl );
+		SSOHelper.clearLogin(request, response);
+		String redirectUrl = null;
+		if (StringUtils.isEmpty(returnUrl)) {
+			redirectUrl = SSOHelper.getRedirectRefererLoginUrl(request);
+		} else {
+			redirectUrl = SSOHelper.getRedirectLoginUrl(request, returnUrl);
+		}
+		boolean cross = SSOHelper.isCrossDomain(request);
+		if (cross) {
+			// 跨域代理界面
+			redirectUrl = request.getContextPath() + "/login/proxy";
+		}
+		return new ModelMap("content", redirectUrl);
+	}
+	/**
+	 * 获取跳转注册的url
+	 *
+	 * @param request
+	 * @param response
+	 * @return
+	 * @throws IOException
+	 */
+	@RequestMapping(value = "/register/page")
+	@ResponseBody
+	public ModelMap register(HttpServletRequest request, HttpServletResponse response, String returnUrl) throws IOException {
+		request.getSession().setAttribute(SSOConfig.SSOReferer, returnUrl );
+		SSOHelper.clearLogin(request, response);
+		String redirectUrl = null;
+		if (StringUtils.isEmpty(returnUrl)) {
+			redirectUrl = SSOHelper.getRedirectRefererRegisterUrl(request);
+		} else {
+			redirectUrl = SSOHelper.getRedirectRegisterUrl(request, returnUrl);
+		}
+		return new ModelMap("content", redirectUrl);
+	}
+
+	/**
+	 * 获取跨域登录的参数
+	 * 
+	 * @param request
+	 * @param response
+	 * @return
+	 * @throws IOException
+	 */
+	@RequestMapping(value = "/login/crossBefore")
+	@ResponseBody
+	public ModelMap getCrossLoginData(HttpServletRequest request, HttpServletResponse response) throws IOException {
+		ModelMap model = new ModelMap();
+		SSOConfig config = SSOHelper.getSSOService().getConfig();
+		// 业务系统私钥签名 authToken 自动设置临时会话 cookie 授权后自动销毁
+		AuthToken at = SSOHelper.askCiphertext(request, response, config.getClientPrivateKey());
+		// askUrl 询问 sso 是否登录地址
+		model.addAttribute("askUrl", config.getCrossAskUrl());
+		// askTxt 询问 token 密文
+		model.addAttribute("askData", at.encryptAuthToken());
+		// 未登录情况下,登录地址
+		Object loginUrl = null;
+		boolean cross = SSOHelper.isCrossDomain(request);
+		if (cross) {
+			loginUrl = SSOHelper.getRedirectRefererLoginUrl(request);
+		} else {
+			loginUrl = SSOHelper.getRedirectLoginUrl(request, String.valueOf(request.getSession().getAttribute("SSOReferer")));
+		}
+		model.addAttribute("loginUrl", loginUrl);
+		return model;
+	}
+
+	/**
+	 * 跨域登录后
+	 * 
+	 * @param request
+	 * @param response
+	 */
+	@RequestMapping(value = "/login/crossAfter")
+	@ResponseBody
+	public ModelMap afterCrossLogin(HttpServletRequest request, HttpServletResponse response, String replyTxt) {
+		if (!StringUtils.isEmpty(replyTxt)) {
+			Object returnUrl = request.getSession().getAttribute(SSOConfig.SSOReferer);
+			SSOConfig config = SSOHelper.getSSOService().getConfig();
+			AuthToken token = SSOHelper.ok(request, response, replyTxt, config.getClientPublicKey(), config.getCenterPublicKey());
+			if (token != null) {
+				SSOToken tk = new SSOToken();
+				tk.setUid(token.getUid());
+				tk.setTime(token.getTime());
+				tk.setData(token.getData());
+				SSOHelper.setSSOCookie(request, response, tk, true);
+				User user = getUserByToken(tk);
+				if (user != null) {
+					user.setIp(AgentUtils.getIp(request));
+					request.getSession().setAttribute("user", user);
+					SystemSession.setUser(user);
+					log(request, user);
+				}
+				return new ModelMap("returnUrl", returnUrl);
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * 获取跨域登录的参数
+	 * 
+	 * @param request
+	 * @param response
+	 * @return
+	 * @throws IOException
+	 */
+	@RequestMapping(value = "/logout/crossBefore")
+	@ResponseBody
+	public ModelMap getCrossLogoutData(HttpServletRequest request, HttpServletResponse response) throws IOException {
+		SSOHelper.clearLogin(request, response);
+		ModelMap model = new ModelMap();
+		SSOConfig config = SSOHelper.getSSOService().getConfig();
+		model.addAttribute("askUrl", config.getCrossAskOutUrl());
+		Object referer = request.getSession().getAttribute(SSOConfig.SSOReferer);
+		model.addAttribute("returnUrl", null == referer ? "/" : referer.toString());
+		return model;
+	}
+
+	private User getUserByToken(SSOToken token) {
+		User authedUser = null;
+		if (token.getData() != null) {
+			com.uas.account.entity.User tokenUser = FlexJsonUtils.fromJson(token.getData(), com.uas.account.entity.User.class);
+			if (tokenUser.getUid() != null) {
+				// UID表示所有系统公认的唯一标识,这里统一使用手机号
+				authedUser = userService.findUserByUserTel(tokenUser.getUid());
+			} else if (tokenUser.getDialectUID() != null) {
+				// dialectUID表示client系统自己的唯一标识,比如user_uu,手机号没设置的情况下使用
+				authedUser = userService.findUserByUserUU(Long.parseLong(tokenUser.getDialectUID()));
+			} else {
+				logger.error(String.format("invalid user %s, please set uid or dialectUID", tokenUser.getName()));
+			}
+			if (authedUser != null && authedUser.getEnterprises() != null) {
+				// 企业资料在client系统自己的唯一标识,比如en_uu
+				if (tokenUser.getSpaceDialectUID() != null) {
+					authedUser.setCurrentEnterprise(Long.parseLong(tokenUser.getSpaceDialectUID()));
+				} else if (tokenUser.getSpaceUID() != null) {
+					for (Enterprise enterprise : authedUser.getEnterprises()) {
+						// 企业资料在所有系统公认的唯一标识,这里使用商业登记证号
+						if (tokenUser.getSpaceUID().equals(enterprise.getEnBussinessCode())) {
+							authedUser.setEnterprise(enterprise);
+							break;
+						}
+					}
+				}
+			}
+		}
+		return authedUser;
+	}
+
+	/**
+	 * 记录登录日志
+	 * @param request
+	 * @param user
+	 */
+	private void log(HttpServletRequest request, User user) {
+		SitePreference preference = getDefaultSitePreferenceForDevice(this.deviceResolver.resolveDevice(request));
+		signinLogService.save(new SigninLog(user, preference, user.getIp(), true));
+	}
+
+	/**
+	 * 获取登录的设备类型
+	 * @param device
+	 * @return
+	 */
+	private SitePreference getDefaultSitePreferenceForDevice(Device device) {
+		if (device == null) {
+			return null;
+		}
+		if (device.isMobile()) {
+			return SitePreference.MOBILE;
+		}
+		if (device.isTablet()) {
+			return SitePreference.TABLET;
+		}
+		return SitePreference.NORMAL;
+	}
+
+}

+ 242 - 0
src/main/java/com/uas/platform/b2c/common/account/controller/UserController.java

@@ -0,0 +1,242 @@
+package com.uas.platform.b2c.common.account.controller;
+
+import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.account.model.User;
+import com.uas.platform.b2c.common.account.model.UserInfo;
+import com.uas.platform.b2c.common.account.service.UserService;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
+import com.uas.platform.b2c.trade.inquiry.model.TradeCharge;
+import com.uas.platform.core.exception.IllegalOperatorException;
+import com.uas.platform.core.logging.BufferedLoggerManager;
+import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.model.PageParams;
+import com.uas.platform.core.util.encry.Md5Utils;
+import com.uas.platform.core.util.serializer.FlexJsonUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.util.List;
+
+/**
+ * 用户信息的请求
+ * @author yujia
+ * @version 2016年7月1日 上午11:35:16 获取个人用户资料的数据
+ * @version 2017年8月1日15:17:38 完善类的注释
+ */
+@RestController
+@RequestMapping(value = "/basic/user")
+public class UserController {
+
+	@Autowired
+	private UserService userService;
+
+	private final static UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
+
+	/**
+	 * 获取当前登录的用户信息
+	 * @return
+	 */
+	@RequestMapping(value = "/personal", method = RequestMethod.GET)
+	public User getUser() {
+		return SystemSession.getUser();
+	}
+
+	/**
+	 * 设置头像路径
+	 * @param imageUrl
+	 * @return
+	 */
+	@RequestMapping(value = "/setImageUrl", method = RequestMethod.POST)
+	public User setUserImageUrl(@RequestBody String imageUrl) {
+		User user = SystemSession.getUser();
+		if (user == null) {
+			throw new IllegalOperatorException("您当前的账号不存在,或未登录!不能设置图像。");
+		}
+		user.setImageUrl(imageUrl);
+		return userService.save(user);
+	}
+
+	@RequestMapping(value = "/getUserByUU", method = RequestMethod.GET)
+	public User getUserByUU(Long uu) {
+		return userService.findUserByUserUU(uu);
+	}
+
+	/**
+	 * 验证用户输入的密码是否正确
+	 *
+	 * @param password 用户输入密码
+	 */
+	@RequestMapping(value = "/checkPassword", method = RequestMethod.GET)
+	public ResponseEntity<String> checkPassword(String password) {
+		User sysUser = SystemSession.getUser();
+		User user = userService.findUserPwdByUserUU(sysUser.getUserUU());
+		if (!StringUtils.isEmpty(password)) {
+			boolean result = user.getUserPwd().equals(Md5Utils.encode(password, user.getUserUU()));
+			if (result) {
+				return new ResponseEntity<>(HttpStatus.OK);
+			}
+			assert logger != null;
+			logger.log("用户信息", "验证用户密码,UU:" + user.getUserUU());
+		}
+		return new ResponseEntity<>(HttpStatus.EXPECTATION_FAILED);
+	}
+
+	/**
+	 * 修改用户密码
+	 *
+	 * @param password	用户输入密码
+	 */
+	@RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
+	public ResponseEntity<String> updatePassword(HttpSession session, String password, String newPassword) {
+		User sysUser = SystemSession.getUser();
+		User user = userService.findUserPwdByUserUU(sysUser.getUserUU());
+		Enterprise enterprise = user.getEnterprise();
+		if (!StringUtils.isEmpty(newPassword)) {
+			user = userService.updatePassword(user, password, newPassword);
+			user.setEnterprise(enterprise);
+			session.setAttribute("user", user);
+			SystemSession.setUser(user);
+			assert logger != null;
+			logger.log("用户信息", "修改用户密码,UU:" + user.getUserUU());
+			return new ResponseEntity<>(HttpStatus.OK);
+		} else
+			throw new IllegalOperatorException("新密码不能为空");
+	}
+
+	/**
+	 * 根据UU获取该企业所有人员信息
+	 * @param enuu 企业uu号
+	 * @return 完整的企业人员信息
+	 */
+	@RequestMapping(value = "/enterprise/info",method = RequestMethod.GET)
+	public Page<User> getEnterpriseAllUsersInfo(PageParams params, Long enuu){
+		PageInfo pageInfo = new PageInfo(params);
+		return userService.findUsersPageByEnUU(pageInfo,enuu);
+	}
+	/**
+	 * 通过关键词获取该企业所有人员信息
+	 * @param enuu 企业uu号
+	 * @return 完整的企业人员信息
+	 */
+	@RequestMapping(value = "/enterprise/keywordinfo",method = RequestMethod.GET)
+	public Page<User> getEnterpriseAllUsersInfoByKeyword(PageParams params, Long enuu, String keyword){
+		PageInfo pageInfo = new PageInfo(params);
+		return userService.findUsersPageByEnUUAndKeyword(pageInfo,enuu,keyword);
+	}
+
+	/**
+	 * 新增用户
+	 *
+	 * @param
+	 * @return
+	 */
+	@RequestMapping(method = RequestMethod.POST)
+	public ResponseEntity<String> addUser(@RequestBody String json, HttpServletRequest request) {
+		User user = FlexJsonUtils.fromJson(json, User.class);
+		user = userService.addUser(user, request);
+		if (user != null) {
+			logger.log("用户信息", "新增用户,姓名:" + user.getUserName());
+		}
+		return new ResponseEntity<String>(HttpStatus.OK);
+	}
+	/**
+	 * 删除用户
+	 *
+	 * @param
+	 * @return
+	 */
+	@RequestMapping(value = "/{uu}", method = RequestMethod.DELETE)
+	public ResponseEntity<String> removeUser(@PathVariable("uu") Long uu) {
+		userService.removeUser(uu);
+		logger.log("用户信息", "删除用户,UU:" + uu);
+		return new ResponseEntity<String>(HttpStatus.OK);
+	}
+	/**
+	 * 修改用户
+	 *
+	 * @param
+	 * @return
+	 */
+	@RequestMapping(value = "/{uu}", method = RequestMethod.PUT)
+	public ResponseEntity<String> updateUser(@PathVariable("uu") Long uu , @RequestBody String json) {
+		User user = FlexJsonUtils.fromJson(json, User.class);
+		userService.save(user);
+		logger.log("用户信息", "修改用户,UU:" + uu);
+		return new ResponseEntity<String>(HttpStatus.OK);
+	}
+	/**
+	 *
+	 * 通过UU号、手机号或邮箱查找用户
+	 *
+	 * @param keyWord
+	 * @author luoq
+	 * @return
+	 */
+	@RequestMapping(value = "/searchUser", method = RequestMethod.GET)
+	@ResponseBody
+	public UserInfo getUser(String keyWord) {
+		return userService.findUserByKeyWord(keyWord);
+	}
+
+	/**
+	 * 绑定用户到企业(管理员才能操作)
+	 *
+	 * @param userUU
+	 * @author luoq
+	 * @return
+	 */
+	@RequestMapping(value = "/bindUser", method = RequestMethod.GET)
+	@ResponseBody
+	public ResponseEntity<String> bindUser(Long userUU) {
+		userService.bindUserToMyEnterprise(userUU);
+		return new ResponseEntity<String>(HttpStatus.OK);
+	}
+	/**
+	 * 手机号是否可用
+	 *
+	 * @param tel
+	 * @return
+	 */
+	@RequestMapping(value = "/telEnable", method = RequestMethod.GET)
+	public ResponseEntity<Boolean> telEnable(String tel) {
+		if (tel == null) {
+			throw new IllegalOperatorException("手机号不能为空!");
+		} else {
+			HttpHeaders headers = new HttpHeaders();
+			headers.add("Content-Type", "application/text; charset=utf-8");
+			return new ResponseEntity<Boolean>(userService.isTelUseable(tel.replaceAll("\\s*", "")), headers,
+					HttpStatus.OK);
+		}
+	}
+
+	/**
+	 * 邮箱地址是否可用
+	 *
+	 * @param email
+	 * @return
+	 */
+	@RequestMapping(value = "/emailEnable", method = RequestMethod.GET)
+	public ResponseEntity<Boolean> emailEnable(String email) {
+		if (email == null) {
+			throw new IllegalOperatorException("邮箱不能为空");
+		} else {
+			HttpHeaders headers = new HttpHeaders();
+			headers.add("Content-Type", "application/text; charset=utf-8");
+			return new ResponseEntity<Boolean>(userService.isEmailUseable(email.replaceAll("\\s*", "")), headers,
+					HttpStatus.OK);
+		}
+	}
+}

+ 73 - 0
src/main/java/com/uas/platform/b2c/common/account/controller/VendorController.java

@@ -0,0 +1,73 @@
+package com.uas.platform.b2c.common.account.controller;
+
+import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.account.service.VendorService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+/**
+ * 供应商信息
+ *
+ * @version 2017年8月2日15:56:10 更新注释说明
+ */
+@RestController
+@RequestMapping("/basic/vendor")
+public class VendorController {
+
+	@Autowired
+	private VendorService vendorService;
+
+	/**
+	 * 获取供应商信息
+	 */
+	@RequestMapping(value = "/info")
+	@ResponseBody
+	public Enterprise getVendorInfo() {
+		return vendorService.getVendorInfo();
+	}
+
+	/**
+	 * 根据供应商enuu获取供应商信息
+	 */
+	@RequestMapping(value = "/{sellerenuu}/findSeller", method = RequestMethod.GET)
+	public Enterprise getUserInfo(@PathVariable Long sellerenuu) {
+		Enterprise enterprise = vendorService.getVendorByUu(sellerenuu);
+		return enterprise;
+	}
+
+	/**
+	 * 获取供应商待出货出货单总数
+	 */
+	@RequestMapping(value = "/toshippedcount")
+	@ResponseBody
+	public String getToBeShippedCount() {
+		String count = "" + vendorService.getToBeShippedCount();
+		return count;
+	}
+
+	/**
+	 * 获取供应商待收货出货单总数
+	 */
+	@RequestMapping(value = "/inboundcount")
+	@ResponseBody
+	public String getInboundCount() {
+		String count = "" + vendorService.getInboundCount();
+		return count;
+	}
+
+	/**
+	 * 获取供应商待收款出货单总数
+	 */
+	@RequestMapping(value = "/tomoneycount")
+	@ResponseBody
+	public String getToMoneyCount() {
+		return String.valueOf(vendorService.getToMoneyCount());
+	}
+
+	@RequestMapping(value = "/transactionInfo", method = RequestMethod.GET)
+	public Map<String, Object> getTransactionInfo() {
+		return vendorService.getTransactionInfo();
+	}
+}

+ 22 - 0
src/main/java/com/uas/platform/b2c/common/account/dao/EnterpriseDao.java

@@ -0,0 +1,22 @@
+package com.uas.platform.b2c.common.account.dao;
+
+import com.uas.platform.b2c.common.account.model.Enterprise;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface EnterpriseDao extends JpaSpecificationExecutor<Enterprise>, JpaRepository<Enterprise, Long>  {
+	
+	public Enterprise findByUu(Long uu);
+	
+	@Query("from Enterprise e where e.uu in (:uus)")
+	public List<Enterprise> findByUus(@Param("uus") List<Long> uus);
+	
+	@Query(value="select e.uu from Enterprise e where e.enName like %?1%")
+	public List<Long> findEnuuByName(String name);
+}

+ 11 - 0
src/main/java/com/uas/platform/b2c/common/account/dao/ErpB2cLogDao.java

@@ -0,0 +1,11 @@
+package com.uas.platform.b2c.common.account.dao;
+
+import com.uas.platform.b2c.common.account.model.ErpB2cLog;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ErpB2cLogDao extends JpaSpecificationExecutor<ErpB2cLog>, JpaRepository<ErpB2cLog, Long> {
+
+}

+ 10 - 0
src/main/java/com/uas/platform/b2c/common/account/dao/ResourceItemDao.java

@@ -0,0 +1,10 @@
+package com.uas.platform.b2c.common.account.dao;
+
+import com.uas.platform.b2c.common.account.model.ResourceItem;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ResourceItemDao extends JpaRepository<ResourceItem, Long>{
+
+}

+ 15 - 0
src/main/java/com/uas/platform/b2c/common/account/dao/SigninLogDao.java

@@ -0,0 +1,15 @@
+package com.uas.platform.b2c.common.account.dao;
+
+import com.uas.platform.b2c.common.account.model.SigninLog;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface SigninLogDao extends JpaRepository<SigninLog, Long> {
+
+	@Query("from SigninLog s where s.id=(select max(l.id) from SigninLog l where l.userUU = :userUU)")
+	public SigninLog findLast(@Param("userUU") long userUU);
+	
+}

+ 11 - 0
src/main/java/com/uas/platform/b2c/common/account/dao/TradeLogDao.java

@@ -0,0 +1,11 @@
+package com.uas.platform.b2c.common.account.dao;
+
+import com.uas.platform.b2c.common.account.model.TradeLog;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface TradeLogDao extends JpaSpecificationExecutor<TradeLog>, JpaRepository<TradeLog, Long> {
+
+}

+ 11 - 0
src/main/java/com/uas/platform/b2c/common/account/dao/UsageLogDao.java

@@ -0,0 +1,11 @@
+package com.uas.platform.b2c.common.account.dao;
+
+import com.uas.platform.b2c.common.account.model.UsageLog;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface UsageLogDao extends JpaSpecificationExecutor<UsageLog>, JpaRepository<UsageLog, Long> {
+
+}

+ 31 - 0
src/main/java/com/uas/platform/b2c/common/account/dao/UserBaseInfoDao.java

@@ -0,0 +1,31 @@
+package com.uas.platform.b2c.common.account.dao;
+
+import com.uas.platform.b2c.common.account.model.UserBaseInfo;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+import java.util.List;
+
+public interface UserBaseInfoDao extends JpaSpecificationExecutor<UserBaseInfo>, JpaRepository<UserBaseInfo, Long> {
+
+	/**
+	 * 通过userUU查询用户简单信息
+	 * 
+	 * @return
+	 */
+	public UserBaseInfo findUserByUserUU(Long userUU);
+
+	/**
+	 * 通过用户邮箱查询用户简单信息
+	 * @param userEmail
+	 * @return
+	 */
+	public List<UserBaseInfo> findByUserEmailOrderByUserUU(String userEmail);
+
+	/**
+	 * 通过用户号码查询用户简单信息
+	 * @param userTel
+	 * @return
+	 */
+	public List<UserBaseInfo> findByUserTelOrderByUserUU(String userTel);
+}

+ 113 - 0
src/main/java/com/uas/platform/b2c/common/account/dao/UserDao.java

@@ -0,0 +1,113 @@
+package com.uas.platform.b2c.common.account.dao;
+
+import com.uas.platform.b2c.common.account.model.User;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.jpa.repository.QueryHints;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+
+import javax.persistence.QueryHint;
+import java.util.List;
+
+@Repository
+public interface UserDao extends JpaSpecificationExecutor<User>, JpaRepository<User, Long> {
+
+	@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true") })
+	public List<User> findUserByUserUU(Long userUU);
+
+	@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true") })
+	public List<User> findUserByUserEmail(String userEmail);
+
+	@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true") })
+	public List<User> findUserByUserTel(String userTel);
+
+	@Query("select u from User u  where u.userUU = :userUU")
+	public List<User> findUserPwdByUserUU(@Param("userUU") Long userUU);
+
+	/**
+	 * 按企业ID和个人ID查找个人
+	 * 
+	 * @param enUU
+	 * @param userUU
+	 * @return
+	 */
+	@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true") })
+	@Query("select u from User u inner join u.enterprises as e where e.uu = :enUU and u.userUU = :userUU")
+	public List<User> findByEnUUAndUserUU(@Param("enUU") long enUU, @Param("userUU") long userUU);
+
+	/**
+	 * 按企业ID和查找个人
+	 * 
+	 * @param enUU
+	 * @return
+	 */
+	@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true") })
+	@Query("select u from User u inner join u.enterprises as e where e.uu = :enUU")
+	public List<User> findByEnUU(@Param("enUU") long enUU);
+
+	/**
+	 * 按企业ID和查找个人id
+	 *
+	 * @param enUU
+	 * @return
+	 */
+	@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true") })
+	@Query("select u.userUU from User u inner join u.enterprises as e where e.uu = :enUU")
+	public List<Long> findIdByEnUU(@Param("enUU") long enUU);
+
+	/**
+	 * 按角色ID查找该角色下的用户
+	 * 
+	 * @param roleId
+	 * @return
+	 */
+	@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true") })
+	@Query("select u from User u inner join u.roles as r where r.id = :roleId")
+	public List<User> findByRole(@Param("roleId") long roleId);
+
+	/**
+	 * 按名字查询当前企业的用户信息
+	 *
+	 * @param userName
+	 * @param enUU
+	 * @return
+	 */
+	@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true") })
+	@Query("select u.userUU from User u inner join u.enterprises as e where e.uu = :enUU and u.userName = :userName")
+	public List<Long> findUserByUserNameAndEnUU(@Param("userName") String userName, @Param("enUU") Long enUU);
+
+	/**
+	 * 按邮箱查询当前企业用户信息
+	 *
+	 * @param userEmail
+	 * @param enUU
+	 * @return
+	 */
+	@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true") })
+	@Query("select u.userUU from User u inner join u.enterprises as e where e.uu = :enUU and u.userEmail = :userEmail")
+	public List<Long> findUserByUserEmailAndEnUU(@Param("userEmail") String userEmail, @Param("enUU") Long enUU);
+
+	/**
+	 * 按电话查询当前企业用户信息
+	 *
+	 * @param userTel
+	 * @param enUU
+	 * @return
+	 */
+	@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true") })
+	@Query("select u.userUU from User u inner join u.enterprises as e where e.uu = :enUU and u.userTel = :userTel")
+	public List<Long> findUserByUserTelAndEnUU(@Param("userTel") String userTel, @Param("enUU") Long enUU);
+
+	/**
+	 * 按企业ID和个人ID查找个人
+	 *
+	 * @param enUU
+	 * @param userUU
+	 * @return
+	 */
+	@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true") })
+	@Query("select u.userUU from User u inner join u.enterprises as e where e.uu = :enUU and u.userUU = :userUU")
+	public List<Long> findUserByEnUUAndUserUU(@Param("enUU") long enUU, @Param("userUU") long userUU);
+}

+ 381 - 0
src/main/java/com/uas/platform/b2c/common/account/model/Enterprise.java

@@ -0,0 +1,381 @@
+/*CopyRright (c)2014: <www.usoftchina.com>
+ */
+package com.uas.platform.b2c.common.account.model;
+
+import com.uas.platform.core.model.Status;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 企业信息
+ * 
+ * @author yingp
+ */
+@Entity
+@Table(name = "sec$enterprises")
+@Cacheable
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.uas.platform.b2c.model.Enterprise")
+public class Enterprise implements Serializable {
+
+	/**
+	 * 序列号
+	 */
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@Column(name = "en_uu")
+	private Long uu;
+
+	/**
+	 * 公司名称
+	 */
+	@Column(name = "en_name")
+	private String enName;
+	/**
+	 * 简称
+	 */
+	@Column(name = "en_shortname")
+	private String enShortname;
+	/**
+	 * 公司类型
+	 */
+	@Column(name = "en_type")
+	private String enType;
+	/**
+	 * 企业注册地区
+	 */
+	@Column(name = "en_area")
+	private String enArea;
+	/**
+	 * 状态
+	 */
+	@Column(name = "en_status")
+	private Short enStatus;
+	/**
+	 * 注册地址
+	 */
+	@Column(name = "en_address")
+	private String enAddress;
+	/**
+	 * 默认送货地址
+	 */
+	@Column(name = "en_deliveraddr")
+	private String enDeliverAddr;
+	/**
+	 * 公司电话
+	 */
+	@Column(name = "en_tel")
+	private String enTel;
+	/**
+	 * 传真
+	 */
+	@Column(name = "en_fax")
+	private String enFax;
+	/**
+	 * 公司邮箱
+	 */
+	@Column(name = "en_email")
+	private String enEmail;
+	/**
+	 * 公司法人
+	 */
+	@Column(name = "en_corporation")
+	private String enCorporation;
+	/**
+	 * 商业登记证号
+	 */
+	@Column(name = "en_businesscode")
+	private String enBussinessCode;
+	/**
+	 * 公司主页地址
+	 */
+	@Column(name = "en_url")
+	private String enUrl;
+	/**
+	 * 注册时间
+	 */
+	@Column(name = "en_time")
+	private Date enDate;
+
+	/**
+	 * 管理员UU号
+	 */
+	@Column(name = "en_adminuu")
+	private Long enAdminuu;
+
+	/**
+	 * 所属行业
+	 */
+	@Column(name = "en_industry")
+	private String enIndustry;
+
+	/**
+	 * LOGO
+	 */
+	@Column(name = "en_logurl")
+	private String enLogoUrl;
+
+	/**
+	 * saas域名
+	 */
+	@Column(name = "en_saasurl")
+	private String enSaasUrl;
+
+	/**
+	 * SAAS状态
+	 */
+	@Column(name = "en_saasstatus")
+	private Short enSaasStatus;
+
+	/**
+	 * enIsErp
+	 */
+	@Column(name = "en_iserp")
+	private Short enIsErp;
+
+	/**
+	 * 私钥
+	 */
+	@Column(name = "en_accesssecret")
+	private String accessSecret;
+
+	@Transient
+	private Integer receiptStatus;
+
+	public String getAccessSecret() {
+		return accessSecret;
+	}
+
+	public void setAccessSecret(String accessSecret) {
+		this.accessSecret = accessSecret;
+	}
+
+	public Long getEnAdminuu() {
+		return enAdminuu;
+	}
+
+	public void setEnAdminuu(Long enAdminuu) {
+		this.enAdminuu = enAdminuu;
+	}
+
+	private Short enable;
+
+	public Long getUu() {
+		return uu;
+	}
+
+	public void setUu(Long uu) {
+		this.uu = uu;
+	}
+
+	public String getEnName() {
+		return enName;
+	}
+
+	public void setEnName(String enName) {
+		this.enName = enName;
+	}
+
+	public String getEnShortname() {
+		return enShortname;
+	}
+
+	public void setEnShortname(String enShortname) {
+		this.enShortname = enShortname;
+	}
+
+	public String getEnType() {
+		return enType;
+	}
+
+	public void setEnType(String enType) {
+		this.enType = enType;
+	}
+
+	public String getEnBussinessCode() {
+		return enBussinessCode;
+	}
+
+	public void setEnBussinessCode(String enBussinessCode) {
+		this.enBussinessCode = enBussinessCode;
+	}
+
+	public Short getEnStatus() {
+		return enStatus;
+	}
+
+	public void setEnStatus(Short enStatus) {
+		this.enStatus = enStatus;
+	}
+
+	public String getEnAddress() {
+		return enAddress;
+	}
+
+	public void setEnAddress(String enAddress) {
+		this.enAddress = enAddress;
+	}
+
+	public String getEnDeliverAddr() {
+		return enDeliverAddr;
+	}
+
+	public void setEnDeliverAddr(String enDeliverAddr) {
+		this.enDeliverAddr = enDeliverAddr;
+	}
+
+	public String getEnTel() {
+		return enTel;
+	}
+
+	public void setEnTel(String enTel) {
+		this.enTel = enTel;
+	}
+
+	public String getEnFax() {
+		return enFax;
+	}
+
+	public void setEnFax(String enFax) {
+		this.enFax = enFax;
+	}
+
+	public String getEnCorporation() {
+		return enCorporation;
+	}
+
+	public void setEnCorporation(String enCorporation) {
+		this.enCorporation = enCorporation;
+	}
+
+	public String getEnUrl() {
+		return enUrl;
+	}
+
+	public void setEnUrl(String enUrl) {
+		this.enUrl = enUrl;
+	}
+
+	public Date getEnDate() {
+		return enDate;
+	}
+
+	public void setEnDate(Date enDate) {
+		this.enDate = enDate;
+	}
+
+	public Short getEnable() {
+		return enable;
+	}
+
+	public void setEnable(Short enable) {
+		this.enable = enable;
+	}
+
+	public String getEnEmail() {
+		return enEmail;
+	}
+
+	public void setEnEmail(String enEmail) {
+		this.enEmail = enEmail;
+	}
+
+	public String getEnArea() {
+		return enArea;
+	}
+
+	public void setEnArea(String enArea) {
+		this.enArea = enArea;
+	}
+
+	public String getEnIndustry() {
+		return enIndustry;
+	}
+
+	public void setEnIndustry(String enIndustry) {
+		this.enIndustry = enIndustry;
+	}
+
+	public String getEnSaasUrl() {
+		return enSaasUrl;
+	}
+
+	public void setEnSaasUrl(String enSaasUrl) {
+		this.enSaasUrl = enSaasUrl;
+	}
+
+	public Short getEnSaasStatus() {
+		return enSaasStatus;
+	}
+
+	public void setEnSaasStatus(Short enSaasStatus) {
+		this.enSaasStatus = enSaasStatus;
+	}
+
+	public Integer getReceiptStatus() {
+		return receiptStatus;
+	}
+
+	public void setReceiptStatus(Integer receiptStatus) {
+		this.receiptStatus = receiptStatus;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((uu == null) ? 0 : uu.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		Enterprise other = (Enterprise) obj;
+		if (uu == null) {
+			if (other.uu != null)
+				return false;
+		} else if (!uu.equals(other.uu))
+			return false;
+		return true;
+	}
+
+	public Enterprise() {
+		this.receiptStatus = Status.NOTSETTLED.value();
+	}
+
+	public Short getEnIsErp() {
+		return enIsErp;
+	}
+
+	public void setEnIsErp(Short enIsErp) {
+		this.enIsErp = enIsErp;
+	}
+
+	public String getEnLogoUrl() {
+		return enLogoUrl;
+	}
+
+	public void setEnLogoUrl(String enLogoUrl) {
+		this.enLogoUrl = enLogoUrl;
+	}
+
+	/**
+	 * saas用户
+	 * 
+	 * @return
+	 */
+	public boolean isSaas() {
+		return this.enSaasStatus != null && Status.ENABLED.value() == this.enSaasStatus;
+	}
+
+}

+ 218 - 0
src/main/java/com/uas/platform/b2c/common/account/model/ErpB2cLog.java

@@ -0,0 +1,218 @@
+package com.uas.platform.b2c.common.account.model;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.core.logging.BufferedLogable;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.springframework.util.StringUtils;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * UAS调用商城接口的日志记录类
+ * 
+ * @author suntg
+ * 
+ */
+@Entity
+@Table(name = "log$erp_b2c", indexes = { @Index(name = "log$erp_b2c_enuu_idx", columnList = "log_enuu") })
+public class ErpB2cLog extends BufferedLogable implements Serializable {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "log$erp_b2c_gen")
+	@SequenceGenerator(name = "log$erp_b2c_gen", sequenceName = "log$erp_b2c_seq", allocationSize = 1)
+	@Column(name = "log_id")
+	private Long id;
+
+	@Column(name = "log_enuu")
+	private Long enUU;
+
+	@OneToOne(cascade = { CascadeType.REFRESH })
+	@JoinColumn(name = "log_useruu", insertable = false, updatable = false)
+	private UserBaseInfo user;
+
+	@NotNull
+	@Column(name = "log_useruu")
+	private Long userUU;
+
+	/**
+	 * 日志时间
+	 */
+	@Column(name = "log_time")
+	private Long time;
+
+	/**
+	 * ip
+	 */
+	@Column(name = "log_ip")
+	private String ip;
+
+	/**
+	 * 标题
+	 */
+	@Column(name = "log_title")
+	private String title;
+
+	/**
+	 * 具体内容
+	 */
+	@Column(name = "log_message")
+	private String message;
+
+	/**
+	 * 相关单据号
+	 */
+	@Column(name = "rel_code")
+	private String code;
+
+	/**
+	 * 相关单据主键
+	 */
+	@Column(name = "rel_key")
+	private Long key;
+
+	@JsonIgnore
+	@JSONField(serialize = false)
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getEnUU() {
+		return enUU;
+	}
+
+	public void setEnUU(Long enUU) {
+		this.enUU = enUU;
+	}
+
+	public Long getUserUU() {
+		return userUU;
+	}
+
+	public void setUserUU(Long userUU) {
+		this.userUU = userUU;
+	}
+
+	public Long getTime() {
+		return time;
+	}
+
+	public void setTime(Long time) {
+		this.time = time;
+	}
+
+	public String getIp() {
+		return ip;
+	}
+
+	public void setIp(String ip) {
+		this.ip = ip;
+	}
+
+	public String getTitle() {
+		return title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+
+	public void setMessage(String message) {
+		this.message = message;
+	}
+
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public Long getKey() {
+		return key;
+	}
+
+	public void setKey(Long key) {
+		this.key = key;
+	}
+
+	public UserBaseInfo getUser() {
+		return user;
+	}
+
+	public void setUser(UserBaseInfo user) {
+		this.user = user;
+	}
+
+	public ErpB2cLog() {
+
+	}
+
+	public ErpB2cLog(String title, String message, String code, Long key) {
+		this.enUU = SystemSession.getUser().getEnterprise().getUu();
+		this.title = title;
+		this.message = message;
+		this.code = code;
+		this.key = key;
+		this.time = new Date().getTime();
+		this.userUU = SystemSession.getUser().getUserUU();
+		this.ip = SystemSession.getUser().getIp();
+	}
+
+	public ErpB2cLog(String title, String message, Long userUU, String ip, String code, Long key) {
+		this.enUU = 0L;
+		this.title = title;
+		this.message = message;
+		this.code = code;
+		this.key = key;
+		this.time = new Date().getTime();
+		this.userUU = userUU;
+		this.ip = ip;
+	}
+
+	public void bufferedLog(String bufferedMessage) {
+		String[] strArray = bufferedMessage.split(separator);
+		if (strArray.length == 8) {
+			this.time = Long.parseLong(strArray[0]);
+			this.ip = strArray[1];
+			this.enUU = Long.parseLong(strArray[2]);
+			this.userUU = Long.parseLong(strArray[3]);
+			this.title = strArray[4];
+			this.message = strArray[5];
+			this.code = StringUtils.hasText(strArray[6]) ? strArray[6] : null;
+			this.key = StringUtils.hasText(strArray[7]) ? Long.parseLong(strArray[7]) : null;
+		}
+	}
+
+	@Override
+	public String bufferedMessage() {
+		StringBuffer sb = new StringBuffer();
+		sb.append(this.time).append(separator);
+		sb.append(this.ip).append(separator);
+		sb.append(this.enUU).append(separator);
+		sb.append(this.userUU).append(separator);
+		sb.append(this.title).append(separator);
+		sb.append(this.message).append(separator);
+		sb.append(this.code == null ? "" : this.code).append(separator);
+		sb.append(this.key == null ? " " : this.key);
+		return sb.toString();
+	}
+
+}

+ 86 - 0
src/main/java/com/uas/platform/b2c/common/account/model/Resource.java

@@ -0,0 +1,86 @@
+package com.uas.platform.b2c.common.account.model;
+
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Set;
+
+/**
+ * 资源表-主表
+ * 
+ * @author yingp
+ *
+ */
+@Table(name = "sec$resources_b2c")
+@Entity
+@Cacheable
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.uas.platform.b2c.model.Resource")
+public class Resource implements Serializable {
+
+	/**
+	 * 序列号
+	 */
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sec$resources_gen_b2c")
+	@SequenceGenerator(name = "sec$resources_gen_b2c", sequenceName = "sec$resources_seq_b2c", allocationSize = 1)
+	@Column(name = "res_id")
+	private Long id;
+
+	/**
+	 * 资源名称
+	 */
+	@Column(name = "res_name")
+	private String name;
+
+	/**
+	 * 资源的具体作业描述
+	 */
+	@Column(name = "res_desc")
+	private String desc;
+
+	/**
+	 * 资源的详细清单
+	 */
+	@OneToMany(cascade = { CascadeType.REFRESH, CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.MERGE }, fetch = FetchType.EAGER)
+	@JoinColumn(name = "item_resid")
+	@OrderBy("id")
+	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
+	private Set<ResourceItem> items;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+	public void setDesc(String desc) {
+		this.desc = desc;
+	}
+
+	public Set<ResourceItem> getItems() {
+		return items;
+	}
+
+	public void setItems(Set<ResourceItem> items) {
+		this.items = items;
+	}
+
+}

+ 93 - 0
src/main/java/com/uas/platform/b2c/common/account/model/ResourceItem.java

@@ -0,0 +1,93 @@
+package com.uas.platform.b2c.common.account.model;
+
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+/**
+ * 系统可请求资源
+ * 
+ * @author yingp
+ * 
+ */
+@Table(name = "sec$resourceitems_b2c")
+@Entity
+@Cacheable
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.uas.platform.b2c.model.ResourceItem")
+public class ResourceItem implements Serializable {
+
+	/**
+	 * 序列号
+	 */
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sec$resourceitems_gen_b2c")
+	@SequenceGenerator(name = "sec$resourceitems_gen_b2c", sequenceName = "sec$resourceitems_seq_b2c", allocationSize = 1)
+	@Column(name = "item_id")
+	private Long id;
+
+	/**
+	 * 资源名称
+	 */
+	@Column(name = "item_name")
+	private String name;
+	/**
+	 * 资源类型GET、POST、PUT、DELETE等
+	 */
+	@Column(name = "item_method")
+	private String method;
+	/**
+	 * 资源请求URL链接
+	 */
+	@Column(name = "item_url")
+	private String url;
+	/**
+	 * 对资源的具体操作对象及行为的描述
+	 */
+	@Column(name = "item_desc")
+	private String desc;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getMethod() {
+		return method == null ? "" : method;
+	}
+
+	public void setMethod(String method) {
+		this.method = method;
+	}
+
+	public String getUrl() {
+		return url;
+	}
+
+	public void setUrl(String url) {
+		this.url = url;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+	public void setDesc(String desc) {
+		this.desc = desc;
+	}
+
+}

+ 171 - 0
src/main/java/com/uas/platform/b2c/common/account/model/Role.java

@@ -0,0 +1,171 @@
+package com.uas.platform.b2c.common.account.model;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.uas.platform.core.model.Constant;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Set;
+
+@Entity
+@Table(name = "sec$roles_b2c", indexes = { @Index(name = "sec$roles_enuu_name_b2c", columnList = "role_enuu,role_name", unique = true),
+@Index(name = "sec$roles_enuu_desc_b2c", columnList = "role_enuu,role_desc", unique = true) })
+@Cacheable
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.uas.platform.b2c.model.Role")
+public class Role implements Serializable {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sec$roles_gen_b2c")
+	@SequenceGenerator(name = "sec$roles_gen_b2c", sequenceName = "sec$roles_seq_b2c", allocationSize = 1)
+	@Column(name = "role_id")
+	private Long id;
+
+	/**
+	 * 角色名称
+	 */
+	@Column(name = "role_name")
+	private String name;
+
+	/**
+	 * 角色是否属于超级用户组
+	 */
+	@Column(name = "issys")
+	private Short issys;
+
+	/**
+	 * 角色是否系统默认创建
+	 */
+	@Column(name = "isdefault")
+	private Short isdefault;
+
+	/**
+	 * 角色详细描述
+	 */
+	@Column(name = "role_desc")
+	private String desc;
+
+	/**
+	 * 角色拥有的权限
+	 */
+	@ManyToMany(cascade = { CascadeType.REFRESH }, fetch = FetchType.EAGER)
+	@JoinTable(name = "sec$roleresource_b2c", joinColumns = @JoinColumn(name = "role_id", referencedColumnName = "role_id"), inverseJoinColumns = @JoinColumn(name = "res_id", referencedColumnName = "item_id"))
+	@OrderBy("id")
+	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
+	private Set<ResourceItem> resourceItems;
+
+	/**
+	 * 所属企业UU
+	 */
+	@Column(name = "role_enuu")
+	private Long enUU;
+
+	/**
+	 * 职责
+	 */
+	@Column(name = "role_duty")
+	private String duty;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+	public void setDesc(String desc) {
+		this.desc = desc;
+	}
+
+	public Short getIssys() {
+		return issys;
+	}
+
+	public void setIssys(Short issys) {
+		this.issys = issys;
+	}
+
+	public Set<ResourceItem> getResourceItems() {
+		return resourceItems;
+	}
+
+	public void setResourceItems(Set<ResourceItem> resourceItems) {
+		this.resourceItems = resourceItems;
+	}
+
+	public Long getEnUU() {
+		return enUU;
+	}
+
+	public void setEnUU(Long enUU) {
+		this.enUU = enUU;
+	}
+
+	public Short getIsdefault() {
+		return isdefault;
+	}
+
+	public void setIsdefault(Short isdefault) {
+		this.isdefault = isdefault;
+	}
+
+	@JsonIgnore
+	@JSONField(serialize = false)
+	public boolean isSys() {
+		return getIssys() != null && getIssys() == Constant.YES;
+	}
+
+	public String getDuty() {
+		return duty;
+	}
+
+	public void setDuty(String duty) {
+		this.duty = duty;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((id == null) ? 0 : id.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		Role other = (Role) obj;
+		if (id == null) {
+			if (other.id != null)
+				return false;
+		} else if (!id.equals(other.id))
+			return false;
+		return true;
+	}
+
+}

+ 147 - 0
src/main/java/com/uas/platform/b2c/common/account/model/SigninLog.java

@@ -0,0 +1,147 @@
+package com.uas.platform.b2c.common.account.model;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.uas.platform.core.model.Constant;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.springframework.mobile.device.site.SitePreference;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 登录日志
+ * 
+ * @author yingp
+ * 
+ */
+@Entity
+@Table(name = "log$signin_b2c")
+public class SigninLog implements Serializable {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "log$signin_b2c_gen")
+	@SequenceGenerator(name = "log$signin_b2c_gen", sequenceName = "log$signin_b2c_seq", allocationSize = 1)
+	@Column(name = "log_id")
+	private Long id;
+
+	@Column(name = "log_enuu")
+	private Long enUU;
+
+	@NotNull
+	@Column(name = "log_useruu")
+	private Long userUU;
+
+	/**
+	 * 登录时间
+	 */
+	@Temporal(value = TemporalType.TIMESTAMP)
+	@Column(name = "log_time")
+	private Date time;
+
+	/**
+	 * ip
+	 */
+	@Column(name = "log_ip")
+	private String ip;
+
+	/**
+	 * @see SitePreference
+	 */
+	@Column(name = "log_agent")
+	private String agent;
+
+	/**
+	 * 记住用户登录方式:通过浏览器cookie和数据库persistent_logins
+	 */
+	@Column(name = "log_remember")
+	private Short isRemember;
+
+	public SigninLog() {
+		this.time = new Date();
+	}
+
+	public SigninLog(User user) {
+		this();
+		Enterprise enterprise = user.getEnterprise();
+		if (enterprise != null)
+			this.enUU = enterprise.getUu();
+		this.userUU = user.getUserUU();
+	}
+
+	public SigninLog(User user, SitePreference preference, String ip, boolean remember) {
+		this(user);
+		setAgent(preference);
+		setIp(ip);
+		setIsRemember(remember ? Constant.YES : Constant.NO);
+	}
+
+	@JsonIgnore
+	@JSONField(serialize = false)
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getEnUU() {
+		return enUU;
+	}
+
+	public void setEnUU(Long enUU) {
+		this.enUU = enUU;
+	}
+
+	public Long getUserUU() {
+		return userUU;
+	}
+
+	public void setUserUU(Long userUU) {
+		this.userUU = userUU;
+	}
+
+	public Date getTime() {
+		return time;
+	}
+
+	public void setTime(Date time) {
+		this.time = time;
+	}
+
+	public String getIp() {
+		return ip;
+	}
+
+	public void setIp(String ip) {
+		this.ip = ip;
+	}
+
+	public String getAgent() {
+		return agent;
+	}
+
+	public void setAgent(String agent) {
+		this.agent = agent;
+	}
+
+	public void setAgent(SitePreference preference) {
+		this.agent = preference.name();
+	}
+
+	public Short getIsRemember() {
+		return isRemember;
+	}
+
+	public void setIsRemember(Short isRemember) {
+		this.isRemember = isRemember;
+	}
+
+}

+ 203 - 0
src/main/java/com/uas/platform/b2c/common/account/model/TradeLog.java

@@ -0,0 +1,203 @@
+package com.uas.platform.b2c.common.account.model;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.core.logging.BufferedLogable;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.springframework.util.StringUtils;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 记录交易过程中订单,采购单,出库单,退货单,退款单以及换货单的操作
+ * 记录和数据变化
+ *
+ * @author huxz
+ */
+@Entity
+@Table(name = "TRADE$LOG_VOUCHER", indexes = { @Index(name = "TRADE$LOG_VOUCHER_enUU_idx", columnList = "log_enUU") })
+public class TradeLog extends BufferedLogable implements Serializable {
+
+	private static final long serialVersionUID = 6066338442401737012L;
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TRADE$LOG_VOUCHER_GEN")
+	@SequenceGenerator(name = "TRADE$LOG_VOUCHER_GEN", sequenceName = "TRADE$LOG_VOUCHER_SEQ", allocationSize = 1)
+	@Column(name = "log_id")
+	private Long id;
+
+	//***************************************************************
+	// 操作人信息
+	//***************************************************************
+
+	/**
+	 * 操作人企业UU
+	 */
+	@Column(name = "log_enUU")
+	private Long enUU;
+
+	/**
+	 * 操作人UU
+	 */
+	@Column(name = "log_userUU")
+	private Long userUU;
+
+	//***************************************************************
+	// 基础信息
+	//***************************************************************
+
+	/**
+	 * 日志记录时间
+	 */
+	@Column(name = "log_create_time")
+	private Date createTime;
+
+	/**
+	 * 操作单据实体类名称
+	 */
+	@Column(name = "log_entity_name")
+	private String entityName;
+
+	/**
+	 * 操作单据编号ID
+	 */
+	@Column(name = "log_voucher_id")
+	private String voucherId;
+
+	/**
+	 * 单据交易操作类型
+	 */
+	@Column(name = "log_voucher_operation")
+	@Enumerated(EnumType.STRING)
+	private VoucherOperation voucherOperation;
+
+	/**
+	 * 单据操作日志信息记录,主要记录其状态变更以及异常
+	 * 1、单据生成时,记录其明细单据编号ID
+	 * 2、状态变更时,记录其状态变更以及受影响的单据编号
+	 * 3、启动异常流程时,记录异常单据的
+	 */
+	@Column(name = "log_change_log",length = 4000)
+	private String changeLog;
+
+	public enum VoucherOperation {
+		BUYER_CREATE_ORDER,
+		BUYER_BUY_NOW,
+		BUYER_ENSURE_ORDER,
+		SELLER_PREPARE_SHIP,
+		PLATFORM_PREPARE_SHIP
+	}
+
+	public TradeLog() {
+	}
+
+	public TradeLog(String entityName, String voucherId, VoucherOperation voucherOperation,
+			String changeLog) {
+		User user = SystemSession.getUser();
+		this.enUU = user.getEnterprise() != null ? user.getEnterprise().getUu() : null;
+		this.userUU = user.getUserUU();
+		this.createTime = new Date();
+		this.entityName = entityName;
+		this.voucherId = voucherId;
+		this.voucherOperation = voucherOperation;
+		this.changeLog = changeLog;
+	}
+
+	@JsonIgnore
+	@JSONField(serialize = false)
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getEnUU() {
+		return enUU;
+	}
+
+	public void setEnUU(Long enUU) {
+		this.enUU = enUU;
+	}
+
+	public Long getUserUU() {
+		return userUU;
+	}
+
+	public void setUserUU(Long userUU) {
+		this.userUU = userUU;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	public String getEntityName() {
+		return entityName;
+	}
+
+	public void setEntityName(String entityName) {
+		this.entityName = entityName;
+	}
+
+	public String getVoucherId() {
+		return voucherId;
+	}
+
+	public void setVoucherId(String voucherId) {
+		this.voucherId = voucherId;
+	}
+
+	public VoucherOperation getVoucherOperation() {
+		return voucherOperation;
+	}
+
+	public void setVoucherOperation(VoucherOperation voucherOperation) {
+		this.voucherOperation = voucherOperation;
+	}
+
+	public String getChangeLog() {
+		return changeLog;
+	}
+
+	public void setChangeLog(String changeLog) {
+		this.changeLog = changeLog;
+	}
+
+	@Override
+	public String bufferedMessage() {
+		//noinspection StringBufferReplaceableByString
+		StringBuilder sb = new StringBuilder();
+		sb.append(this.enUU).append(separator);
+		sb.append(this.userUU).append(separator);
+		sb.append(this.createTime.getTime()).append(separator);
+		sb.append(this.entityName == null ? "" : this.entityName).append(separator);
+		sb.append(this.voucherId == null ? "" : this.voucherId).append(separator);
+		sb.append(this.voucherOperation == null ? "" : this.voucherOperation.name()).append(separator);
+		sb.append(this.changeLog == null ? "" : this.changeLog).append(separator);
+		return sb.toString();
+	}
+
+	@Override
+	public void bufferedLog(String bufferedMessage) {
+		String[] strArray = bufferedMessage.split(separator);
+		if (strArray.length == 7) {
+			if (strArray[0] != null)
+				this.enUU = Long.parseLong(strArray[0]);
+			this.userUU = Long.parseLong(strArray[1]);
+			this.createTime = new Date(Long.parseLong(strArray[2]));
+			this.entityName = StringUtils.hasText(strArray[3]) ? strArray[3] : null;
+			this.voucherId = StringUtils.hasText(strArray[4]) ? strArray[4] : null;
+			this.voucherOperation = StringUtils.hasLength(strArray[5]) ? VoucherOperation.valueOf(strArray[5]) : null;
+			this.changeLog = StringUtils.hasLength(strArray[6]) ? strArray[6] : null;
+		}
+	}
+
+}

+ 236 - 0
src/main/java/com/uas/platform/b2c/common/account/model/UsageLog.java

@@ -0,0 +1,236 @@
+package com.uas.platform.b2c.common.account.model;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.core.logging.BufferedLogable;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.springframework.util.StringUtils;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 平台使用日志
+ * 
+ * @author yingp
+ * 
+ */
+@Entity
+@Table(name = "log$usage_b2c", indexes = { @Index(name = "log$usage_b2c_enuu_idx", columnList = "log_enuu") })
+public class UsageLog extends BufferedLogable implements Serializable {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "log$usage_b2c_gen")
+	@SequenceGenerator(name = "log$usage_b2c_gen", sequenceName = "log$usage_b2c_seq", allocationSize = 1)
+	@Column(name = "log_id")
+	private Long id;
+
+	@Column(name = "log_enuu")
+	private Long enUU;
+
+	@OneToOne(cascade = { CascadeType.REFRESH })
+	@JoinColumn(name = "log_useruu", insertable = false, updatable = false)
+	private UserBaseInfo user;
+
+	@NotNull
+	@Column(name = "log_useruu")
+	private Long userUU;
+
+	/**
+	 * 日志时间
+	 */
+	@Column(name = "log_time")
+	private Long time;
+
+	/**
+	 * ip
+	 */
+	@Column(name = "log_ip")
+	private String ip;
+
+	/**
+	 * 标题
+	 */
+	@Column(name = "log_title")
+	private String title;
+
+	/**
+	 * 具体操作信息
+	 */
+	@Column(name = "log_message",length = 2000)
+	private String message;
+
+	/**
+	 * 详情
+	 */
+	@Column(name = "log_detail", length = 1000)
+	private String detail;
+
+	/**
+	 * 相关单据号
+	 */
+	@Column(name = "rel_code")
+	private String code;
+
+	/**
+	 * 相关单据主键
+	 */
+	@Column(name = "rel_key")
+	private Long key;
+
+	@JsonIgnore
+	@JSONField(serialize = false)
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getEnUU() {
+		return enUU;
+	}
+
+	public void setEnUU(Long enUU) {
+		this.enUU = enUU;
+	}
+
+	public Long getUserUU() {
+		return userUU;
+	}
+
+	public void setUserUU(Long userUU) {
+		this.userUU = userUU;
+	}
+
+	public Long getTime() {
+		return time;
+	}
+
+	public void setTime(Long time) {
+		this.time = time;
+	}
+
+	public String getIp() {
+		return ip;
+	}
+
+	public void setIp(String ip) {
+		this.ip = ip;
+	}
+
+	public String getTitle() {
+		return title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+
+	public void setMessage(String message) {
+		this.message = message;
+	}
+
+	public String getDetail() {
+		return detail;
+	}
+
+	public void setDetail(String detail) {
+		this.detail = detail;
+	}
+
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public Long getKey() {
+		return key;
+	}
+
+	public void setKey(Long key) {
+		this.key = key;
+	}
+
+	public UserBaseInfo getUser() {
+		return user;
+	}
+
+	public void setUser(UserBaseInfo user) {
+		this.user = user;
+	}
+
+	public UsageLog() {
+
+	}
+
+	public UsageLog(String title, String message, String detail, String code, Long key) {
+		this.enUU = SystemSession.getUser().getEnterprise() != null ? SystemSession.getUser().getEnterprise().getUu() : null;
+		this.title = title;
+		this.message = message;
+		this.detail = detail;
+		this.code = code;
+		this.key = key;
+		this.time = new Date().getTime();
+		this.userUU = SystemSession.getUser().getUserUU();
+		this.ip = SystemSession.getUser().getIp();
+	}
+
+	public UsageLog(String title, String message, Long userUU, String ip, String code, Long key) {
+		this.enUU = 0L;
+		this.title = title;
+		this.message = message;
+		this.code = code;
+		this.key = key;
+		this.time = new Date().getTime();
+		this.userUU = userUU;
+		this.ip = ip;
+	}
+
+	public void bufferedLog(String bufferedMessage) {
+		String[] strArray = bufferedMessage.split(separator);
+		if (strArray.length == 9) {
+			this.time = Long.parseLong(strArray[0]);
+			this.ip = strArray[1];
+			if (!strArray[2].equals("null"))
+				this.enUU = Long.parseLong(strArray[2]);
+			this.userUU = Long.parseLong(strArray[3]);
+			this.title = strArray[4];
+			this.message = strArray[5];
+			this.detail = StringUtils.hasText(strArray[6]) ? strArray[6] : null;
+			this.code = StringUtils.hasText(strArray[7]) ? strArray[7] : null;
+			this.key = StringUtils.hasText(strArray[8]) ? Long.parseLong(strArray[8]) : null;
+		}
+	}
+
+	@Override
+	public String bufferedMessage() {
+		StringBuffer sb = new StringBuffer();
+		sb.append(this.time).append(separator);
+		sb.append(this.ip).append(separator);
+		sb.append(this.enUU).append(separator);
+		sb.append(this.userUU).append(separator);
+		sb.append(this.title).append(separator);
+		sb.append(this.message).append(separator);
+		sb.append(this.detail == null ? "" : this.detail).append(separator);
+		sb.append(this.code == null ? "" : this.code).append(separator);
+		sb.append(this.key == null ? " " : this.key);
+		return sb.toString();
+	}
+
+}

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

@@ -0,0 +1,369 @@
+package com.uas.platform.b2c.common.account.model;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.uas.platform.core.model.Constant;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+import org.hibernate.annotations.NotFound;
+import org.hibernate.annotations.NotFoundAction;
+import org.springframework.util.CollectionUtils;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * 用户信息
+ * @author suntg
+ * @version 2017年8月2日15:10:28 完善注释说明
+ */
+@Entity
+@Table(name = "sec$users")
+@Cacheable
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.uas.platform.b2b.model.User")
+public class User implements Serializable {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public User() {
+	}
+
+	public User(Long userUU) {
+		this.userUU = userUU;
+	}
+
+	/**
+	 * uu号,ID
+	 */
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "users_gen")
+	@SequenceGenerator(name = "users_gen", sequenceName = "users_seq", allocationSize = 1)
+	@Column(name = "user_uu")
+	private Long userUU;
+
+	/**
+	 * 用户名
+	 */
+	@Column(name = "user_name", length = 50)
+	private String userName;
+
+	/**
+	 * 密码
+	 */
+	@Column(name = "user_pwd", length = 32)
+	private String userPwd;
+
+	/**
+	 * 邮箱
+	 */
+	@Column(name = "user_email", length = 50, nullable = false)
+	@NotNull
+	private String userEmail;
+
+	/**
+	 * 手机号
+	 */
+	@Column(name = "user_tel", length = 30)
+	private String userTel;
+
+	/**
+	 * 性别
+	 */
+	@Column(name = "user_sex", length = 10)
+	private String userSex;
+
+	/**
+	 * 身份证号
+	 */
+	@Column(name = "user_idcode", length = 20)
+	private String userIdcode;
+
+	/**
+	 * 是否启用
+	 */
+	private Short enable;
+
+	/**
+	 * 是否管理员
+	 */
+	private Short issys;
+
+	/**
+	 * imid
+	 */
+	@Column(name = "user_imid")
+	private Long userIMId;
+
+	public Long getUserIMId() {
+		return userIMId;
+	}
+
+	public void setUserIMId(Long userIMId) {
+		this.userIMId = userIMId;
+	}
+
+	/**
+	 * 用户类型
+	 */
+	@Column(name = "user_type", length = 20)
+	private String userType;
+
+	/**
+	 * 所属所有公司
+	 */
+	@ManyToMany(cascade = { CascadeType.REFRESH, CascadeType.REMOVE }, fetch = FetchType.EAGER)
+	@JoinTable(name = "sec$userenterprise", joinColumns = @JoinColumn(name = "user_uu", referencedColumnName = "user_uu"), inverseJoinColumns = @JoinColumn(name = "en_uu", referencedColumnName = "en_uu"))
+	@OrderBy("uu")
+	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
+	private Set<Enterprise> enterprises;
+
+	/**
+	 * 所属当前登录公司
+	 */
+	@Transient
+	@NotFound(action = NotFoundAction.IGNORE)
+	private Enterprise enterprise;
+
+	/**
+	 * 角色
+	 */
+	@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.EAGER)
+	@JoinTable(name = "sec$userrole_b2c", joinColumns = @JoinColumn(name = "user_uu", referencedColumnName = "user_uu"), inverseJoinColumns = @JoinColumn(name = "role_id", referencedColumnName = "role_id"))
+	@OrderBy("id")
+	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
+	private Set<Role> roles;
+
+	/**
+	 * 最近登录IP地址
+	 */
+	@Transient
+	@NotFound(action = NotFoundAction.IGNORE)
+	private String ip;
+
+	/**
+	 * 用户头像图片路径
+	 */
+	@Column(name = "user_imageurl")
+	private String imageUrl;
+
+	public String getImageUrl() {
+		return imageUrl;
+	}
+
+	public void setImageUrl(String imageUrl) {
+		this.imageUrl = imageUrl;
+	}
+
+	public Long getUserUU() {
+		return userUU;
+	}
+
+	public void setUserUU(Long userUU) {
+		this.userUU = userUU;
+	}
+
+	public String getUserEmail() {
+		return userEmail;
+	}
+
+	public void setUserEmail(String userEmail) {
+		this.userEmail = userEmail;
+	}
+
+	public String getUserTel() {
+		return userTel;
+	}
+
+	public void setUserTel(String userTel) {
+		this.userTel = userTel;
+	}
+
+	public String getUserIdcode() {
+		return userIdcode;
+	}
+
+	public void setUserIccode(String userIdcode) {
+		this.userIdcode = userIdcode;
+	}
+
+	public String getUserName() {
+		return userName;
+	}
+
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
+
+	@JsonIgnore
+	@JSONField(serialize = false)
+	public String getUserPwd() {
+		return userPwd;
+	}
+
+	public void setUserPwd(String userPwd) {
+		this.userPwd = userPwd;
+	}
+
+	public Short getEnable() {
+		return enable;
+	}
+
+	public void setEnable(Short enable) {
+		this.enable = enable;
+	}
+
+	@JsonIgnore
+	@JSONField(serialize = false)
+	public Short getIssys() {
+		return issys;
+	}
+
+	public void setIssys(Short issys) {
+		this.issys = issys;
+	}
+
+	public String getUserSex() {
+		return userSex;
+	}
+
+	public void setUserSex(String userSex) {
+		this.userSex = userSex;
+	}
+
+	public Enterprise getEnterprise() {
+		return enterprise;
+	}
+
+	public void setEnterprise(Enterprise enterprise) {
+		this.enterprise = enterprise;
+	}
+
+	public String getUserType() {
+		return userType;
+	}
+
+	public void setUserType(String userType) {
+		this.userType = userType;
+	}
+
+	public void setUserIdcode(String userIdcode) {
+		this.userIdcode = userIdcode;
+	}
+
+	@JsonIgnore
+	@JSONField(serialize = false)
+	public Set<Enterprise> getEnterprises() {
+		return enterprises;
+	}
+
+	public void setEnterprises(Set<Enterprise> enterprises) {
+		this.enterprises = enterprises;
+	}
+
+	@JsonIgnore
+	@JSONField(serialize = false)
+	public boolean enable() {
+		return this.getEnable() != null && this.getEnable() == Constant.YES;
+	}
+
+	public void setCurrentEnterprise() {
+		if (this.enterprises != null && this.enterprises.size() > 0)
+			this.enterprise = this.enterprises.iterator().next();
+	}
+
+	public void setCurrentEnterprise(long enUU) {
+		if (this.enterprises != null && this.enterprises.size() > 0)
+			for (Enterprise enterprise : enterprises) {
+				if (enterprise.getUu() == enUU) {
+					this.enterprise = enterprise;
+					break;
+				}
+			}
+		if (this.enterprise == null)
+			setCurrentEnterprise();
+	}
+
+	public Set<Role> getRoles() {
+		return roles;
+	}
+
+	public void setRoles(Set<Role> roles) {
+		this.roles = roles;
+	}
+
+	public void addEnterprise(Enterprise enterprise) {
+		if (this.enterprises == null) {
+			Set<Enterprise> enterprises = new HashSet<Enterprise>();
+			enterprises.add(enterprise);
+			this.enterprises = enterprises;
+			return;
+		}
+		if (!this.enterprises.contains(enterprise)) {
+			this.enterprises.add(enterprise);
+		}
+		if (this.enterprise == null) {
+			this.enterprise = enterprise;
+		}
+	}
+
+	public void removeEnterprise(Enterprise enterprise) {
+		if (this.enterprises.contains(enterprise)) {
+			this.enterprises.remove(enterprise);
+		}
+	}
+
+	public boolean isSys() {
+		return getIssys() != null && getIssys() == Constant.YES;
+	}
+
+	@JsonIgnore
+	@JSONField(serialize = false)
+	public String getIp() {
+		return ip;
+	}
+
+	public void setIp(String ip) {
+		this.ip = ip;
+	}
+
+	/**
+	 * 获取用户所属企业UU号
+	 *
+	 * @return
+	 */
+	@JSONField(serialize = false)
+	@JsonIgnore
+	public Set<Long> getEnUUs() {
+		Set<Long> enUUs = new HashSet<Long>();
+		if (!CollectionUtils.isEmpty(enterprises)) {
+			for (Enterprise en : enterprises) {
+				enUUs.add(en.getUu());
+			}
+		}
+		return enUUs;
+	}
+
+	/**
+	 * 将角色设置为当前登录企业的角色
+	 */
+	public void setCurrentEnterpriseRoles() {
+		if(!CollectionUtils.isEmpty(this.roles) && this.enterprise != null) {
+			Iterator<Role> iterator = this.roles.iterator();
+			Long enuu = this.enterprise.getUu();
+			while (iterator.hasNext()) {
+				Role role = iterator.next();
+				if(!role.getEnUU().equals(enuu)) {
+					iterator.remove();
+				}
+			}
+		}
+	}
+
+}

+ 96 - 0
src/main/java/com/uas/platform/b2c/common/account/model/UserBaseInfo.java

@@ -0,0 +1,96 @@
+package com.uas.platform.b2c.common.account.model;
+
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+/**
+ * 只包含最基本的信息,用与跟单据关联展现
+ * @author suntg
+ *
+ */
+@Entity
+@Table(name = "sec$users")
+@Cacheable
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.uas.platform.b2b.model.User")
+public class UserBaseInfo implements Serializable {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 个人UU号
+	 */
+	@Id
+	@Column(name = "user_uu")
+	private Long userUU;
+
+	/**
+	 * 用户名
+	 */
+	@Column(name = "user_name")
+	private String userName;
+
+	/**
+	 * 用户邮箱地址
+	 */
+	@Column(name = "user_email")
+	private String userEmail;
+
+	/**
+	 * 用户手机号
+	 */
+	@Column(name = "user_tel")
+	private String userTel;
+
+	/**
+	 * 用户性别
+	 */
+	@Column(name = "user_sex")
+	private String userSex;
+
+	public Long getUserUU() {
+		return userUU;
+	}
+
+	public void setUserUU(Long userUU) {
+		this.userUU = userUU;
+	}
+
+	public String getUserName() {
+		return userName;
+	}
+
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
+
+	public String getUserEmail() {
+		return userEmail;
+	}
+
+	public void setUserEmail(String userEmail) {
+		this.userEmail = userEmail;
+	}
+
+	public String getUserTel() {
+		return userTel;
+	}
+
+	public void setUserTel(String userTel) {
+		this.userTel = userTel;
+	}
+
+	public String getUserSex() {
+		return userSex;
+	}
+
+	public void setUserSex(String userSex) {
+		this.userSex = userSex;
+	}
+
+}

+ 145 - 0
src/main/java/com/uas/platform/b2c/common/account/model/UserInfo.java

@@ -0,0 +1,145 @@
+package com.uas.platform.b2c.common.account.model;
+
+import com.uas.platform.core.model.Status;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 用户简单信息,前台程序使用
+ * 
+ * @author yingp
+ * 
+ */
+public class UserInfo {
+
+	public UserInfo(User user) {
+		this.userUU = user.getUserUU();
+		this.userEmail = user.getUserEmail();
+		this.userName = user.getUserName();
+		this.userTel = user.getUserTel();
+		this.userSex = user.getUserSex();
+		this.sys = user.isSys();
+		if (user.getRoles() != null && user.getRoles().size() > 0) {
+			StringBuffer sb = new StringBuffer();
+			for (Role role : user.getRoles()) {
+				if (sb.length() > 0)
+					sb.append(" ");
+				sb.append(role.getDesc());
+			}
+			this.role = sb.toString();
+		}
+		if (!CollectionUtils.isEmpty(user.getEnterprises())) {
+			Enterprise current = user.getEnterprise();
+			List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
+			for (Enterprise enterprise : user.getEnterprises()) {
+				Map<String, Object> map = new HashMap<String, Object>();
+				map.put("enName", enterprise.getEnName());
+				map.put("uu", enterprise.getUu());
+				if(enterprise.getEnSaasStatus() != null && enterprise.getEnSaasStatus() == Status.ENABLED.value()) {
+					map.put("enSaasUrl", enterprise.getEnSaasUrl());
+				}
+				if (enterprise.equals(current))
+					map.put("current", true);
+				list.add(map);
+			}
+			this.enterprises = list;
+		}
+	}
+
+	public static Page<UserInfo> getUserInfo(Page<User> page) {
+		List<UserInfo> infos = new ArrayList<UserInfo>();
+		if (page != null && page.getContent() != null && !page.getContent().isEmpty()) {
+			for (User user : page.getContent()) {
+				infos.add(new UserInfo(user));
+			}
+		}
+		return new PageImpl<UserInfo>(infos);
+	}
+
+	private Long userUU;
+
+	private String userName;
+
+	private String userEmail;
+
+	private String userTel;
+
+	private String userSex;
+
+	private String role;
+	
+	private boolean sys;
+
+	private List<Map<String, Object>> enterprises;
+
+	public Long getUserUU() {
+		return userUU;
+	}
+
+	public void setUserUU(Long userUU) {
+		this.userUU = userUU;
+	}
+
+	public String getUserName() {
+		return userName;
+	}
+
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
+
+	public String getUserEmail() {
+		return userEmail;
+	}
+
+	public void setUserEmail(String userEmail) {
+		this.userEmail = userEmail;
+	}
+
+	public String getUserTel() {
+		return userTel;
+	}
+
+	public void setUserTel(String userTel) {
+		this.userTel = userTel;
+	}
+
+	public String getUserSex() {
+		return userSex;
+	}
+
+	public void setUserSex(String userSex) {
+		this.userSex = userSex;
+	}
+
+	public String getRole() {
+		return role;
+	}
+
+	public void setRole(String role) {
+		this.role = role;
+	}
+
+	public List<Map<String, Object>> getEnterprises() {
+		return enterprises;
+	}
+
+	public void setEnterprises(List<Map<String, Object>> enterprises) {
+		this.enterprises = enterprises;
+	}
+
+	public boolean isSys() {
+		return sys;
+	}
+
+	public void setSys(boolean sys) {
+		this.sys = sys;
+	}
+
+}

+ 45 - 0
src/main/java/com/uas/platform/b2c/common/account/service/EnterpriseService.java

@@ -0,0 +1,45 @@
+package com.uas.platform.b2c.common.account.service;
+
+import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.account.model.User;
+import com.uas.platform.b2c.trade.support.ResultMap;
+
+public interface EnterpriseService {
+
+	// 根据企业uu获取企业信息
+	public Enterprise getEnterpriseInfo(Long uu);
+	
+	// 得到企业是否有需要结算单据状态
+	public Enterprise getReceiptStatus(Enterprise enter);
+
+	/**
+	 * 修改企业信息
+	 *
+	 * @param enterprise
+	 * @return
+	 */
+	public Enterprise save(Enterprise enterprise);
+	/**
+	 * 根据注册地址确定币别
+	 * @return
+	 */
+	ResultMap getCurrencyByRegisterAddress();
+
+	/**
+	 * 个人用户注册企业信息
+	 * @return 店铺信息
+	 */
+	ResultMap registerEnterprise(Enterprise enterprise, String filePath,User user);
+
+	/**
+	 * 个人用户注册企业信息(验证名称)
+	 * @return 店铺信息
+	 */
+	ResultMap validName(String name);
+
+	/**
+	 * 个人用户注册企业信息(验证营业执照)
+	 * @return 店铺信息
+	 */
+	ResultMap validBusinessCode(String businessCode);
+}

+ 18 - 0
src/main/java/com/uas/platform/b2c/common/account/service/ErpB2cLogService.java

@@ -0,0 +1,18 @@
+package com.uas.platform.b2c.common.account.service;
+
+import com.uas.platform.b2c.common.account.model.ErpB2cLog;
+import com.uas.platform.core.logging.LogService;
+import com.uas.platform.core.model.PageInfo;
+import org.springframework.data.domain.Page;
+
+public interface ErpB2cLogService extends LogService<ErpB2cLog> {
+
+	/**
+	 * 分页查找使用日志
+	 * 
+	 * @param pageInfo
+	 * @return
+	 */
+	public Page<ErpB2cLog> findAllByPageInfo(PageInfo pageInfo);
+
+}

+ 13 - 0
src/main/java/com/uas/platform/b2c/common/account/service/LogService.java

@@ -0,0 +1,13 @@
+package com.uas.platform.b2c.common.account.service;
+
+import com.uas.platform.core.util.mq.MessageLog;
+
+public interface LogService {
+
+	/**
+	 * 发送短信日志
+	 * 
+	 * @param log
+	 */
+	public void saveMessageLog(MessageLog log);
+}

+ 23 - 0
src/main/java/com/uas/platform/b2c/common/account/service/SigninLogService.java

@@ -0,0 +1,23 @@
+package com.uas.platform.b2c.common.account.service;
+
+
+import com.uas.platform.b2c.common.account.model.SigninLog;
+
+public interface SigninLogService {
+
+	/**
+	 * 保存登录日志
+	 * 
+	 * @param log
+	 */
+	public void save(SigninLog log);
+
+	/**
+	 * 查找最近一次登录日志
+	 * 
+	 * @param userUU
+	 * @return
+	 */
+	public SigninLog findLast(long userUU);
+
+}

+ 8 - 0
src/main/java/com/uas/platform/b2c/common/account/service/TradeLogService.java

@@ -0,0 +1,8 @@
+package com.uas.platform.b2c.common.account.service;
+
+import com.uas.platform.b2c.common.account.model.TradeLog;
+import com.uas.platform.core.logging.LogService;
+
+public interface TradeLogService extends LogService<TradeLog> {
+
+}

+ 21 - 0
src/main/java/com/uas/platform/b2c/common/account/service/UsageAopLogService.java

@@ -0,0 +1,21 @@
+package com.uas.platform.b2c.common.account.service;
+
+import com.uas.platform.b2c.core.support.log.UsageAopLog;
+import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.logging.LogService;
+import org.springframework.data.domain.Page;
+
+/**
+ * Created by Administrator on 2017/8/3.
+ */
+public interface UsageAopLogService extends com.uas.platform.core.logging.LogService<UsageAopLog> {
+
+    /**
+     * 分页查找使用日志
+     *
+     * @param pageInfo
+     * @return
+     */
+    public Page<UsageAopLog> findAllByPageInfo(PageInfo pageInfo);
+
+}

+ 18 - 0
src/main/java/com/uas/platform/b2c/common/account/service/UsageLogService.java

@@ -0,0 +1,18 @@
+package com.uas.platform.b2c.common.account.service;
+
+import com.uas.platform.b2c.common.account.model.UsageLog;
+import com.uas.platform.core.logging.LogService;
+import com.uas.platform.core.model.PageInfo;
+import org.springframework.data.domain.Page;
+
+public interface UsageLogService extends LogService<UsageLog> {
+
+	/**
+	 * 分页查找使用日志
+	 * 
+	 * @param pageInfo
+	 * @return
+	 */
+	public Page<UsageLog> findAllByPageInfo(PageInfo pageInfo);
+
+}

+ 106 - 0
src/main/java/com/uas/platform/b2c/common/account/service/UserService.java

@@ -0,0 +1,106 @@
+package com.uas.platform.b2c.common.account.service;
+
+
+import com.uas.platform.b2c.common.account.model.User;
+import com.uas.platform.b2c.common.account.model.UserInfo;
+import com.uas.platform.core.model.PageInfo;
+import org.springframework.data.domain.Page;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+public interface UserService {
+
+	/**
+	 * 按uu取用户信息
+	 * 
+	 * @param userUU
+	 * @return
+	 */
+	User findUserByUserUU(Long userUU);
+
+	/**
+	 * 按uu取用户信息(不读取缓存)
+	 *
+	 * @param userUU
+	 * @return
+	 */
+	User findUserPwdByUserUU(Long uu);
+	/**
+	 * 按企业及个人uu取用户信息
+	 * 
+	 * @param enUU
+	 * @param userUU
+	 * @return
+	 */
+	User findUserByEnUUAndUserUU(Long enUU, Long userUU);
+	
+	/**
+	 * 按企业uu取用户信息
+	 * 
+	 * @param enUU
+	 * @return
+	 */
+	List<User> findUsersByEnUU(Long enUU);
+
+	/**
+	 * 按企业uu分页取用户信息
+	 *
+	 * @param enUU
+	 * @return
+	 */
+	Page<User> findUsersPageByEnUU(PageInfo pageInfo, Long enUU);
+	Page<User> findUsersPageByEnUUAndKeyword(PageInfo pageInfo , Long enUU , String keyword);
+	/**
+	 * 按email取用户信息
+	 * 
+	 * @param userEmail
+	 * @return
+	 */
+	User findUserByUserEmail(String userEmail);
+
+	/**
+	 * 按tel取用户信息
+	 * 
+	 * @param userTel
+	 * @return
+	 */
+	User findUserByUserTel(String userTel);
+
+	/**
+	 * 查找所有用户资料
+	 * 
+	 * @return
+	 */
+	List<User> findAll();
+	
+	User save(User user);
+
+	/**
+	 * 修改用户密码
+	 *
+	 * @param user
+	 *            用户
+	 * @param password
+	 *            原密码
+	 * @param newPassword
+	 *            新密码
+	 */
+	User updatePassword(User user, String password, String newPassword);
+
+	/**
+	 * 新增用户
+	 *
+	 * @param user 用户
+	 * @param request 请求
+	 */
+	public User addUser(User user, HttpServletRequest request) ;
+
+	public UserInfo findUserByKeyWord(String keyWord);
+
+	public void bindUserToMyEnterprise(Long userUU);
+
+	public void removeUser(Long uu);
+	public boolean isEmailUseable(String email);
+	public boolean isTelUseable(String tel);
+}

+ 40 - 0
src/main/java/com/uas/platform/b2c/common/account/service/VendorService.java

@@ -0,0 +1,40 @@
+package com.uas.platform.b2c.common.account.service;
+
+
+import com.uas.platform.b2c.common.account.model.Enterprise;
+
+import java.util.Map;
+
+public interface VendorService {
+	
+	/**
+	 * 获取当前供应商信息
+	 */
+	public Enterprise getVendorInfo();
+	
+	/**
+	 * 获取供应商待出货出货单总数
+	 */
+	public int getToBeShippedCount();
+
+	/**
+	 * 获取供应商待收货出货单总数
+	 */
+	public int getInboundCount();	
+	
+	/**
+	 * 获取供应商待收款出货单总数
+	 */
+	public int getToMoneyCount();
+
+	/**
+	 * 根据uu获取供应商信息
+	 */
+	public Enterprise getVendorByUu(Long uu);
+
+	/**
+	 * 获取订单的交易信息,目前只包含库存总量,
+	 * @return
+	 */
+	Map<String, Object> getTransactionInfo();
+}

+ 171 - 0
src/main/java/com/uas/platform/b2c/common/account/service/impl/EnterpriseServiceImpl.java

@@ -0,0 +1,171 @@
+package com.uas.platform.b2c.common.account.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.uas.account.entity.UserSpaceDetail;
+import com.uas.account.util.AccountUtils;
+import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
+import com.uas.platform.b2c.common.account.dao.UserBaseInfoDao;
+import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.account.model.User;
+import com.uas.platform.b2c.common.account.model.UserBaseInfo;
+import com.uas.platform.b2c.common.account.service.EnterpriseService;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.b2c.logistics.dao.ReceiptDao;
+import com.uas.platform.b2c.logistics.model.Receipt;
+import com.uas.platform.b2c.trade.support.CodeType;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import com.uas.platform.core.exception.SystemException;
+import com.uas.platform.core.model.Status;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import java.util.List;
+
+@Service
+public class EnterpriseServiceImpl implements EnterpriseService{
+
+	@Autowired
+	private EnterpriseDao enterpriseDao;
+	
+	@Autowired
+	private ReceiptDao receiptDao;
+
+	@Autowired
+	private UserBaseInfoDao userBaseInfoDao;
+
+	
+	@Override
+	public Enterprise getEnterpriseInfo(Long uu) {
+		
+		return enterpriseDao.findByUu(uu);
+	}
+
+	@Override
+	public Enterprise getReceiptStatus(Enterprise enter) {
+		List<Receipt> receipts = receiptDao.findBySellerenuu(enter.getUu());
+		if(!CollectionUtils.isEmpty(receipts)) {
+			for(Receipt r : receipts) {
+				r.getStatus().equals(Status.AVAILABLE.value());
+				enter.setReceiptStatus(Status.NOTSETTLED.value());
+				return enter;
+			}
+		}
+		enter.setReceiptStatus(Status.SETTLED.value());
+		return enter;
+	}
+
+
+	/**
+	 * 根据注册地址确定币别
+	 *
+	 * @return
+	 */
+	@Override
+	public ResultMap getCurrencyByRegisterAddress() {
+		User user = SystemSession.getUser();
+		if(user == null) {
+			return new ResultMap(CodeType.NO_INFO, "个人信息缺失,请确定是否登录");
+		}
+		Enterprise enterprise = user.getEnterprise();
+		if(enterprise == null) {
+			return new ResultMap(CodeType.NO_INFO, "企业信息缺失,请完善对应的信息");
+		}
+		String enAddress = enterprise.getEnAddress();
+		if(StringUtils.isEmpty(enAddress)) {
+			return new ResultMap(CodeType.NO_INFO, "企业注册地址信息缺失,请完善对应的信息");
+		}
+		if(enAddress.contains("香港")) {
+			return ResultMap.success("USD");
+		}else {
+			return ResultMap.success("RMB");
+		}
+	}
+
+	@Override
+	public Enterprise save(Enterprise enterprise) {
+		Enterprise existEnterprise = enterpriseDao.findOne(enterprise.getUu());
+		if (existEnterprise == null)
+			throw new IllegalArgumentException();
+		try {
+			postToAccountCenter(enterprise);
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw new SystemException("账户中心更新失败:" + e.getMessage());
+		}
+		return enterpriseDao.save(enterprise);
+	}
+
+	private void postToAccountCenter(Enterprise enterprise) throws Exception {
+		UserSpaceDetail detail = new UserSpaceDetail();
+		detail.setAddress(enterprise.getEnAddress());
+		/*detail.setArea(enterprise.getEnArea());
+		detail.setCorporation(enterprise.getEnCorporation());
+		detail.setFax(enterprise.getEnFax());
+		detail.setIndustry(enterprise.getEnIndustry());*/
+		detail.setName(enterprise.getEnName());
+		detail.setShortName(enterprise.getEnShortname());
+		/*enterprise.setEnType(detail.getType());
+		detail.setType(enterprise.getEnType());*/
+		detail.setUrl(enterprise.getEnUrl());
+		detail.setBusinessCode(enterprise.getEnBussinessCode());
+		UserBaseInfo user = userBaseInfoDao.findUserByUserUU(enterprise.getEnAdminuu());
+		detail.setAdminName(user.getUserName());
+		detail.setAdminEmail(user.getUserEmail());
+		detail.setAdminTel(user.getUserTel());
+		AccountUtils.saveUserSpace(enterprise.getUu(), detail);
+	}
+
+	@Override
+	public ResultMap registerEnterprise(Enterprise enterprise, String filePath, User user) {
+		UserSpaceDetail detail = new UserSpaceDetail();
+		detail.setName(enterprise.getEnName());
+		detail.setShortName(enterprise.getEnShortname());
+		detail.setBusinessCode(enterprise.getEnBussinessCode());
+		detail.setBusinessCodeImage(filePath);
+		detail.setArea("中国大陆");
+		detail.setAddress(enterprise.getEnAddress());
+		detail.setUrl(enterprise.getEnUrl());
+		detail.setAdminName(user.getUserName());
+		detail.setAdminEmail(user.getUserEmail());
+		detail.setAdminTel(user.getUserTel());
+		try {
+			AccountUtils.applyApp(detail,null);
+		}catch (Exception e){
+			return new ResultMap(CodeType.SYSTEM_ERROR, "注册失败");
+		}
+
+		return ResultMap.success("注册成功");
+	}
+
+	@Override
+	public ResultMap validName(String name) {
+		try {
+			String result = AccountUtils.validName(name);
+			JSONObject resultJSON = JSONObject.parseObject(result);
+			if (null !=resultJSON.get("businessCode")){
+				return new ResultMap(CodeType.SYSTEM_ERROR, "校验失败");
+			}else{
+				return ResultMap.success("校验成功");
+			}
+		}catch (Exception e){
+			return new ResultMap(CodeType.SYSTEM_ERROR, "校验失败");
+		}
+	}
+
+	@Override
+	public ResultMap validBusinessCode(String businessCode) {
+		try {
+			String result = AccountUtils.validBusinessCode(businessCode);
+			JSONObject resultJSON = JSONObject.parseObject(result);
+			if (null !=resultJSON.get("name")){
+				return new ResultMap(CodeType.SYSTEM_ERROR, "校验失败");
+			}else{
+				return ResultMap.success("校验成功");
+			}
+		}catch (Exception e){
+			return new ResultMap(CodeType.SYSTEM_ERROR, "校验失败");
+		}
+	}
+}

+ 45 - 0
src/main/java/com/uas/platform/b2c/common/account/service/impl/ErpB2cLogServiceImpl.java

@@ -0,0 +1,45 @@
+package com.uas.platform.b2c.common.account.service.impl;
+
+
+import com.uas.platform.b2c.common.account.dao.ErpB2cLogDao;
+import com.uas.platform.b2c.common.account.model.ErpB2cLog;
+import com.uas.platform.b2c.common.account.service.ErpB2cLogService;
+import com.uas.platform.core.model.PageInfo;
+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 javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+
+@Service
+public class ErpB2cLogServiceImpl implements ErpB2cLogService {
+
+	@Autowired
+	private ErpB2cLogDao erpB2cLogDao;
+
+	@Override
+	public void save(ErpB2cLog logable) {
+		erpB2cLogDao.save(logable);
+	}
+
+	@Override
+	public void save(Iterable<ErpB2cLog> logables) {
+		erpB2cLogDao.save(logables);
+	}
+
+	@Override
+	public Page<ErpB2cLog> findAllByPageInfo(final PageInfo pageInfo) {
+		Page<ErpB2cLog> pageLogs = erpB2cLogDao.findAll(new Specification<ErpB2cLog>() {
+			public Predicate toPredicate(Root<ErpB2cLog> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
+				query.where(pageInfo.getPredicates(root, query, builder));
+				return null;
+			}
+		}, pageInfo);
+		return pageLogs;
+	}
+
+}

+ 38 - 0
src/main/java/com/uas/platform/b2c/common/account/service/impl/LogServiceImpl.java

@@ -0,0 +1,38 @@
+package com.uas.platform.b2c.common.account.service.impl;
+
+
+import com.uas.platform.b2c.common.account.service.LogService;
+import com.uas.platform.b2c.core.config.SysConf;
+import com.uas.platform.core.util.HttpUtil;
+import com.uas.platform.core.util.HttpUtil.Response;
+import com.uas.platform.core.util.mq.MessageLog;
+import com.uas.platform.core.util.serializer.FlexJsonUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.mail.IllegalWriteException;
+import java.util.HashMap;
+import java.util.Map;
+
+@Service
+public class LogServiceImpl implements LogService {
+
+	@Autowired
+	private SysConf sysConf;
+
+	@Override
+	public void saveMessageLog(MessageLog log) {
+		Map<String, String> map = new HashMap<String, String>();
+		String data = FlexJsonUtils.toJson(log);
+		map.put("data", data);
+		try {
+			Response res = HttpUtil.sendGetRequest(sysConf.getManageInner() + "/public/message/log", map, true);
+			if (res.getStatusCode() != 200) {
+				new IllegalWriteException("发送到管理平台保存短信信息报错");
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+}

+ 25 - 0
src/main/java/com/uas/platform/b2c/common/account/service/impl/SigninLogServiceImpl.java

@@ -0,0 +1,25 @@
+package com.uas.platform.b2c.common.account.service.impl;
+
+import com.uas.platform.b2c.common.account.dao.SigninLogDao;
+import com.uas.platform.b2c.common.account.model.SigninLog;
+import com.uas.platform.b2c.common.account.service.SigninLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class SigninLogServiceImpl implements SigninLogService {
+
+	@Autowired
+	private SigninLogDao signinLogDao;
+
+	@Override
+	public void save(SigninLog log) {
+		signinLogDao.save(log);
+	}
+
+	@Override
+	public SigninLog findLast(long userUU) {
+		return signinLogDao.findLast(userUU);
+	}
+
+}

+ 29 - 0
src/main/java/com/uas/platform/b2c/common/account/service/impl/TradeLogServiceImpl.java

@@ -0,0 +1,29 @@
+package com.uas.platform.b2c.common.account.service.impl;
+
+import com.uas.platform.b2c.common.account.dao.TradeLogDao;
+import com.uas.platform.b2c.common.account.model.TradeLog;
+import com.uas.platform.b2c.common.account.service.TradeLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class TradeLogServiceImpl implements TradeLogService {
+
+	private final TradeLogDao logDao;
+
+	@Autowired
+	public TradeLogServiceImpl(TradeLogDao logDao) {
+		this.logDao = logDao;
+	}
+
+	@Override
+	public void save(TradeLog logable) {
+		logDao.save(logable);
+	}
+
+	@Override
+	public void save(Iterable<TradeLog> logables) {
+		logDao.save(logables);
+	}
+
+}

+ 50 - 0
src/main/java/com/uas/platform/b2c/common/account/service/impl/UsageAopLogServiceImpl.java

@@ -0,0 +1,50 @@
+package com.uas.platform.b2c.common.account.service.impl;
+
+import com.uas.platform.b2c.common.account.service.UsageAopLogService;
+import com.uas.platform.b2c.core.config.MicroServicesConf;
+import com.uas.platform.b2c.core.support.log.UsageAopLog;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import com.uas.platform.core.model.PageInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+@Service
+public class UsageAopLogServiceImpl implements UsageAopLogService {
+
+	private final MicroServicesConf conf;
+
+	private final RestTemplate restTemplate;
+
+	@Autowired
+	public UsageAopLogServiceImpl(MicroServicesConf conf, RestTemplate restTemplate) {
+		this.conf = conf;
+		this.restTemplate = restTemplate;
+	}
+
+	@Override
+	@SuppressWarnings("unchecked")
+	public Page<UsageAopLog> findAllByPageInfo(final PageInfo pageInfo) {
+		String url = conf.getRequestUrl(20255, "/api/service/log/usage?page={pageNumber}&size={pageSize}&op=pageLogs");
+		ResultMap resultMap = restTemplate.getForObject(url, ResultMap.class);
+		return (Page<UsageAopLog>) resultMap.getData();
+	}
+
+	@Override
+	public void save(UsageAopLog logable) {
+		String url = conf.getRequestUrl(20255, "/api/service/log/usage");
+		restTemplate.postForObject(url, logable, ResultMap.class);
+	}
+
+	@Override
+	public void save(Iterable<UsageAopLog> logables) {
+		if (logables == null || !logables.iterator().hasNext()) {
+			return ;
+		}
+		while (logables.iterator().hasNext()) {
+			UsageAopLog usageLog = logables.iterator().next();
+			save(usageLog);
+		}
+	}
+}

+ 44 - 0
src/main/java/com/uas/platform/b2c/common/account/service/impl/UsageLogServiceImpl.java

@@ -0,0 +1,44 @@
+package com.uas.platform.b2c.common.account.service.impl;
+
+import com.uas.platform.b2c.common.account.dao.UsageLogDao;
+import com.uas.platform.b2c.common.account.model.UsageLog;
+import com.uas.platform.b2c.common.account.service.UsageLogService;
+import com.uas.platform.core.model.PageInfo;
+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 javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+
+@Service
+public class UsageLogServiceImpl implements UsageLogService {
+
+	@Autowired
+	private UsageLogDao usageLogDao;
+
+	@Override
+	public void save(UsageLog logable) {
+		usageLogDao.save(logable);
+	}
+
+	@Override
+	public void save(Iterable<UsageLog> logables) {
+		usageLogDao.save(logables);
+	}
+
+	@Override
+	public Page<UsageLog> findAllByPageInfo(final PageInfo pageInfo) {
+		Page<UsageLog> pageLogs = usageLogDao.findAll(new Specification<UsageLog>() {
+			public Predicate toPredicate(Root<UsageLog> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
+				query.where(pageInfo.getPredicates(root, query, builder));
+				return null;
+			}
+		}, pageInfo);
+		return pageLogs;
+	}
+
+}

+ 376 - 0
src/main/java/com/uas/platform/b2c/common/account/service/impl/UserServiceImpl.java

@@ -0,0 +1,376 @@
+package com.uas.platform.b2c.common.account.service.impl;
+
+import com.uas.account.entity.UserDetail;
+import com.uas.account.util.AccountUtils;
+import com.uas.message.mail.service.MailService;
+import com.uas.platform.b2c.common.account.dao.UserDao;
+import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.account.model.Role;
+import com.uas.platform.b2c.common.account.model.User;
+import com.uas.platform.b2c.common.account.model.UserInfo;
+import com.uas.platform.b2c.common.account.service.UserService;
+import com.uas.platform.b2c.common.base.dao.CommonDao;
+import com.uas.platform.b2c.core.config.MessageConf;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.core.exception.IllegalOperatorException;
+import com.uas.platform.core.exception.SystemException;
+import com.uas.platform.core.model.Constant;
+import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.model.Status;
+import com.uas.platform.core.util.AgentUtils;
+import com.uas.platform.core.util.encry.Md5Utils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@Service
+public class UserServiceImpl implements UserService {
+
+	static final String TEL_REGEXP = "^((\\(\\d{3}\\))|(\\d{3}\\-))?(13|15|18|17)\\d{9}$";
+
+	static final String UU_REGEXP = "^\\d{4,}$";
+
+	/**
+	 * 匹配中文正则式
+	 */
+	private static final String CHINESE_REGEXP = "^[\u4e00-\u9fa5]*$";
+
+	/**
+	 * 匹配英文正则式
+	 */
+	private static final String ENGLISH_REGEXP = "^[A-Za-z]+$";
+
+	@Autowired
+	private UserDao userDao;
+
+	@Autowired
+	private CommonDao commonDao;
+
+	@Autowired
+	private MailService mailService;
+	@Autowired
+	private MessageConf messageConf;
+
+	@Override
+	public User findUserByUserUU(Long uu) {
+		List<User> users = userDao.findUserByUserUU(uu);
+		if (users.size() == 0)
+			throw new UsernameNotFoundException("没有找到您的账号 " + uu);
+		return users.get(0);
+	}
+
+	@Override
+	public User findUserPwdByUserUU(Long uu) {
+		List<User> users = userDao.findUserPwdByUserUU(uu);
+		if (users.size() == 0)
+			throw new UsernameNotFoundException("没有找到您的账号 " + uu);
+		return users.get(0);
+	}
+
+	@Override
+	public User findUserByUserEmail(String email) {
+		List<User> users = userDao.findUserByUserEmail(email);
+		if (users.size() == 0)
+			throw new UsernameNotFoundException("没有找到您的账号 " + email);
+		return users.get(0);
+	}
+
+	@Override
+	public User findUserByUserTel(String tel) {
+		List<User> users = userDao.findUserByUserTel(tel);
+		if (users.size() == 0)
+			throw new UsernameNotFoundException("没有找到您的账号 " + tel);
+		return users.get(0);
+	}
+	@Override
+	public boolean isTelUseable(String tel) {
+		return userDao.findUserByUserTel(tel).size() == 0;
+	}
+	@Override
+	public boolean isEmailUseable(String email) {
+		return userDao.findUserByUserEmail(email).size() == 0;
+	}
+
+	@Override
+	public List<User> findAll() {
+		List<User> users = userDao.findByEnUU(SystemSession.getUser().getEnterprise().getUu());
+		if(!CollectionUtils.isEmpty(users)) {
+			for (User user : users) {
+				Set<Role> roles = user.getRoles();
+				Long enuu = SystemSession.getUser().getEnterprise().getUu();
+				if(!CollectionUtils.isEmpty(roles)) {
+					Iterator<Role> iterator = roles.iterator();
+					while (iterator.hasNext()) {
+						Role role = iterator.next();
+						if(!role.getEnUU().equals(enuu)) {
+							iterator.remove();
+						}
+					}
+				}
+			}
+		}
+		return users;
+	}
+
+	@Override
+	public User findUserByEnUUAndUserUU(Long enUU, Long userUU) {
+		List<User> users = userDao.findByEnUUAndUserUU(enUU, userUU);
+		return CollectionUtils.isEmpty(users) ? null : users.get(0);
+	}
+
+	@Override
+	public List<User> findUsersByEnUU(Long enUU) {
+		List<User> users = userDao.findByEnUU(enUU);
+		return users;
+	}
+
+	@Override
+	public Page<User> findUsersPageByEnUU(final PageInfo pageInfo , Long enUU) {
+		final List<Long> usersId = userDao.findIdByEnUU(enUU);
+		if (usersId.size()>0) {
+			Page<User> pUser = userDao.findAll(new Specification<User>() {
+				public Predicate toPredicate(Root<User> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
+					Predicate predicateId = root.get("userUU").in(usersId);
+					query.where(predicateId);
+					return null;
+				}
+			}, pageInfo);
+			for (User user : pUser) {
+				Set<Role> roles = user.getRoles();
+				Long enuu = SystemSession.getUser().getEnterprise().getUu();
+				if (!CollectionUtils.isEmpty(roles)) {
+					Iterator<Role> iterator = roles.iterator();
+					while (iterator.hasNext()) {
+						Role role = iterator.next();
+						if (!role.getEnUU().equals(enuu)) {
+							iterator.remove();
+						}
+					}
+				}
+			}
+			return pUser;
+		}else{
+			return null;
+		}
+
+	}
+	@Override
+	public UserInfo findUserByKeyWord(String keyWord) {
+		User user = null;
+		if (keyWord.contains("@")) { // 按邮箱查找
+			user = findUserByUserEmail(keyWord);
+		} else if (keyWord.matches(TEL_REGEXP)) { // 按手机号查找
+			user = findUserByUserTel(keyWord);
+		} else if (keyWord.matches(UU_REGEXP)) { // 按UU号查找
+			user = findUserByUserUU(Long.parseLong(keyWord));
+		}
+		if (user == null)
+			throw new IllegalOperatorException("未查找到您输入账号的用户信息");
+
+		UserInfo simpleUser = new UserInfo(user); // 将user重新封装为简单对象,只返回前台需要的用户信息
+		return simpleUser;
+	}
+	@Override
+	public void bindUserToMyEnterprise(Long userUU) {
+		User user = userDao.findOne(userUU);
+		if (user == null)
+			throw new IllegalArgumentException("不存在的用户!");
+
+		Set<Enterprise> enterprises = user.getEnterprises();
+		if (CollectionUtils.isEmpty(enterprises)) {
+			enterprises = new HashSet<Enterprise>();
+		}
+		enterprises.add(SystemSession.getUser().getEnterprise());
+		user.setEnterprises(enterprises);
+		userDao.save(user);
+		try {
+			postToAccountCenter(user);
+		} catch (Exception e) {
+			throw new SystemException(e.getMessage());
+		}
+	}
+	@Override
+	public Page<User> findUsersPageByEnUUAndKeyword(final PageInfo pageInfo , Long enUU , String keyword) {
+		List<Long> usersId = new ArrayList<>();
+		if (keyword.contains("@")) { // 按邮箱查找
+			usersId = userDao.findUserByUserEmailAndEnUU(keyword, enUU);
+		} else if (keyword.matches(TEL_REGEXP)) { // 按手机号查找
+			usersId = userDao.findUserByUserTelAndEnUU(keyword, enUU);
+		} else if (keyword.matches(UU_REGEXP)) { // 按UU号查找
+			usersId = userDao.findUserByEnUUAndUserUU(enUU, Long.parseLong(keyword));
+		} else if (!keyword.contains("@") && (keyword.matches(CHINESE_REGEXP) || keyword.matches(ENGLISH_REGEXP))) {// 按名字查找
+			usersId = userDao.findUserByUserNameAndEnUU(keyword, enUU);
+		} else{
+			usersId = userDao.findUserByUserNameAndEnUU(keyword, enUU);
+		}
+		final List<Long> users = usersId;
+		if (users.size()>0) {
+			Page<User> pUser = userDao.findAll(new Specification<User>() {
+				public Predicate toPredicate(Root<User> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
+					Predicate predicateId = root.get("userUU").in(users);
+					query.where(predicateId);
+					return null;
+				}
+			}, pageInfo);
+			for (User user : pUser) {
+				Set<Role> roles = user.getRoles();
+				Long enuu = SystemSession.getUser().getEnterprise().getUu();
+				if (!CollectionUtils.isEmpty(roles)) {
+					Iterator<Role> iterator = roles.iterator();
+					while (iterator.hasNext()) {
+						Role role = iterator.next();
+						if (!role.getEnUU().equals(enuu)) {
+							iterator.remove();
+						}
+					}
+				}
+			}
+			return pUser;
+		}else{
+			return null;
+		}
+
+	}
+
+	@Override
+	public User save(User user) {
+        User userOld = userDao.findOne(user.getUserUU());
+        userOld.setUserEmail(user.getUserEmail());
+        userOld.setUserTel(user.getUserTel());
+        userOld.setUserName(user.getUserName());
+        try {
+            postToAccountCenter(userOld);
+            return userDao.save(userOld);
+        } catch (Exception e) {
+            throw new RuntimeException(e.getMessage());
+        }
+	}
+
+	@Override
+	public User updatePassword(User user, String password, String newPassword) {
+		boolean result = user.getUserPwd().equals(Md5Utils.encode(password, user.getUserUU()));
+		if (result) {
+			User user1 = userDao.findOne(user.getUserUU());
+			user1.setUserPwd(Md5Utils.encode(newPassword, user1.getUserUU()));
+			if (user1.getEnterprise() == null)
+				user1.setCurrentEnterprise();// 随便绑定一个用户所属企业
+			Enterprise enterprise = user1.getEnterprise();
+			try {
+                //判断是否为个人账户
+                if (enterprise == null){
+                    AccountUtils.resetPassword(user1.getUserUU(), null, newPassword);
+                }else {
+                    AccountUtils.resetPassword(user1.getUserUU(), enterprise.getUu(), newPassword);
+                }
+				//user1 = userDao.save(user1);
+			} catch (Exception e) {
+				throw new SystemException(e.getMessage());
+			}
+			return user1;
+		} else {
+			throw new IllegalOperatorException("原密码验证错误");
+		}
+	}
+
+
+	static final String defaultPassword = "111111";
+	@Override
+	public User addUser(User user, HttpServletRequest request) {
+		List<User> users = userDao.findUserByUserTel(user.getUserTel().trim());
+		if (users.size() > 0) {
+			throw new IllegalOperatorException("电话号码重复,建议输入您自己的手机号");
+		}
+		List<User> users2 = userDao.findUserByUserEmail(user.getUserEmail().trim());
+		if (users2.size() > 0) {
+			throw new IllegalOperatorException("邮箱地址重复,建议输入您自己的电子邮箱地址");
+		}
+		Long uu = commonDao.queryForObject("select users_seq.nextval from dual", Long.class);
+		user.setUserUU(uu);
+		user.addEnterprise(SystemSession.getUser().getEnterprise());
+		user.setCurrentEnterprise();
+		user = userDao.save(user);
+
+		user.setUserPwd(Md5Utils.encode(defaultPassword, user.getUserUU()));
+		try {
+			user = userDao.save(user);
+			postToAccountCenter(user, defaultPassword);
+		} catch (Exception e) {
+			userDao.delete(user);
+			throw new RuntimeException(e.getMessage());
+		}
+		// 发送邮件
+		Map<String, Object> model = new HashMap<String, Object>();
+		model.put("userName", user.getUserName());
+		model.put("userUU", user.getUserUU());
+		model.put("userEmail", user.getUserEmail());
+		model.put("enName", SystemSession.getUser().getEnterprise().getEnName());
+		model.put("adminName", SystemSession.getUser().getUserName());
+		SimpleDateFormat timeFormat = new SimpleDateFormat("MM月dd日 HH:mm:ss");
+		model.put("dateTime", timeFormat.format(new Date()));
+		model.put("userTel", user.getUserTel());
+		model.put("rootpath", AgentUtils.getHost(request));
+		if (user.getUserEmail() != null) {
+			//mailService.send(messageConf.getTplInvitationForB2B(), user.getUserEmail(), model);
+		}
+		return user;
+	}
+
+	public void postToAccountCenter(User user, String password) throws Exception {
+		UserDetail detail = new UserDetail();
+		detail.setEmail(user.getUserEmail());
+		detail.setIdCode(user.getUserIdcode());
+		detail.setMobile(user.getUserTel());
+		detail.setName(user.getUserName());
+		detail.setSex(user.getUserSex());
+		AccountUtils.addUser(user.getUserUU(), SystemSession.getUser().getEnterprise().getUu(), detail, password);
+	}
+	public void postToAccountCenter(User user) throws Exception {
+		UserDetail detail = new UserDetail();
+		detail.setEmail(user.getUserEmail());
+		detail.setIdCode(user.getUserIdcode());
+		detail.setMobile(user.getUserTel());
+		detail.setName(user.getUserName());
+		detail.setSex(user.getUserSex());
+		AccountUtils.saveUser(user.getUserUU(), SystemSession.getUser().getEnterprise().getUu(), detail);
+	}
+	@Override
+	public void removeUser(Long uu) {
+		User user = userDao.findOne(uu);
+		com.uas.account.entity.User userInfo = new com.uas.account.entity.User();
+		userInfo.setAppId("b2b");
+		userInfo.setName(user.getUserName());
+		userInfo.setSalt(String.valueOf(uu));
+		userInfo.setSpaceUID(SystemSession.getUser().getEnterprise().getEnBussinessCode());
+		userInfo.setUid(user.getUserTel());
+		userInfo.setSecondUID(user.getUserEmail());
+		userInfo.setDialectUID(String.valueOf(uu));
+		if (user.getEnterprises().contains(SystemSession.getUser().getEnterprise())) {
+			user.removeEnterprise(SystemSession.getUser().getEnterprise());
+			if (user.getEnterprises().size() == 0)
+				user.setEnable((short) Status.DISABLED.value());
+			userDao.save(user);
+			if (user.getEnterprises().size() == 0) {
+				//userDao.delete(user);
+			}
+			try {
+				AccountUtils.unbindUser(userInfo);// 同步数据到账户中心
+			} catch (Exception e) {
+				// 尝试删除,存在关联的单据则不删
+			}
+		} else {
+			throw new IllegalArgumentException();
+		}
+	}
+
+}

+ 112 - 0
src/main/java/com/uas/platform/b2c/common/account/service/impl/VendorServiceImpl.java

@@ -0,0 +1,112 @@
+package com.uas.platform.b2c.common.account.service.impl;
+
+import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
+import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.account.service.VendorService;
+import com.uas.platform.b2c.core.config.SysConf;
+import com.uas.platform.b2c.prod.store.dao.StoreInDao;
+import com.uas.platform.b2c.prod.store.model.StoreIn;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
+import com.uas.platform.b2c.logistics.dao.InvoiceFPurchaseDao;
+import com.uas.platform.b2c.trade.order.dao.PurchaseDao;
+import com.uas.platform.core.model.Status;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class VendorServiceImpl implements VendorService {
+
+	private final InvoiceFPurchaseDao invoiceFPurchaseDao;
+
+	private final EnterpriseDao enterpriseDao;
+
+	private final PurchaseDao purchaseDao;
+
+	private final GoodsDao goodsDao;
+
+	private final StoreInDao storeInDao;
+
+	private final SysConf sysConf;
+
+	@Autowired
+	public VendorServiceImpl(InvoiceFPurchaseDao invoiceFPurchaseDao, EnterpriseDao enterpriseDao, PurchaseDao purchaseDao, GoodsDao goodsDao, StoreInDao storeInDao, SysConf sysConf) {
+		this.invoiceFPurchaseDao = invoiceFPurchaseDao;
+		this.enterpriseDao = enterpriseDao;
+		this.purchaseDao = purchaseDao;
+		this.goodsDao = goodsDao;
+		this.storeInDao = storeInDao;
+		this.sysConf = sysConf;
+	}
+
+	@Override
+	public Enterprise getVendorInfo() {
+		return SystemSession.getUser().getEnterprise();
+	}
+
+	@Override
+	public int getToBeShippedCount() {
+		Integer status = Status.TOBESHIPPED.value();
+		return invoiceFPurchaseDao.getCountByEnuuAndStatus(SystemSession.getUser().getEnterprise().getUu(), status);
+	}
+
+	@Override
+	public int getInboundCount() {
+		Integer status = Status.INBOUND.value();
+		return invoiceFPurchaseDao.getCountByEnuuAndStatus(SystemSession.getUser().getEnterprise().getUu(), status);
+	}
+
+	@Override
+	public int getToMoneyCount() {
+		Integer status = Status.TORECEIVEMONEY.value();
+		return invoiceFPurchaseDao.getCountByEnuuAndStatus(SystemSession.getUser().getEnterprise().getUu(), status);
+	}
+
+	@Override
+	public Enterprise getVendorByUu(Long uu) {
+
+		return enterpriseDao.findOne(uu);
+	}
+
+	/**
+	 * 获取订单的交易信息,目前只包含库存总量,
+	 *
+	 * @return
+	 */
+	@Override
+	public Map<String, Object> getTransactionInfo() {
+		Boolean isOpenStore = true, isAdminEnterprise = false;
+		Map<String, Object> map = new HashMap<String, Object>();
+		Long uu = SystemSession.getUser().getEnterprise().getUu();
+		if(uu.longValue() == sysConf.getEnUU().longValue()) {
+			isAdminEnterprise = true;
+		}
+		List<StoreIn> storeIns = storeInDao.findByEnUU(uu);
+		if(CollectionUtils.isEmpty(storeIns)) {
+			isOpenStore = false;
+		}
+		int countBySellerenuu = purchaseDao.getCountBySellerenuuAndStoreid(uu, sysConf.getStoreid());
+		map.put("mallOrder", countBySellerenuu);
+		Double reserveByEnuu = goodsDao.findSumReserveByEnuuAndStoreid(uu, sysConf.getStoreid());
+		map.put("mallreserve", reserveByEnuu == null ? 0 : reserveByEnuu);
+		Double rmbByEnuu = purchaseDao.getSumPriceByCurrencyAndSelleruuAndStoreid("RMB", uu, sysConf.getStoreid());
+		map.put("mallRMB", rmbByEnuu == null ? 0 : rmbByEnuu);
+		if(isOpenStore) {
+			StoreIn storeIn = storeIns.get(0);
+			int selfOrder = purchaseDao.getCountBySellerenuuAndStoreid(uu, storeIn.getUuid());
+			map.put("selfOrder", selfOrder);
+			Double selfreserve = goodsDao.findSumReserveByEnuuAndStoreid(uu, storeIn.getUuid());
+			map.put("selfreserve", selfreserve== null ? 0 : selfreserve);
+			Double selfRMB = purchaseDao.getSumPriceByCurrencyAndSelleruuAndStoreid("RMB", uu, storeIn.getUuid());
+			map.put("selfRMB", selfRMB== null ? 0 : selfRMB);
+		}
+		map.put("isOpenStore", isOpenStore);
+		map.put("isAdminEnterprise", isAdminEnterprise);
+		return map;
+	}
+}

+ 26 - 0
src/main/java/com/uas/platform/b2c/common/account/support/AuthenErrors.java

@@ -0,0 +1,26 @@
+package com.uas.platform.b2c.common.account.support;
+
+import com.uas.platform.core.exception.Error;
+
+/**
+ * 登录验证的错误类型
+ *
+ * @version 2017年8月2日15:57:23 suntg 更新注释说明
+ */
+public class AuthenErrors {
+
+	public static final Error EN_NOT_FOUND = new Error(40002, "没有找到企业");
+
+	public static final Error EN_ID_NOT_FOUND = new Error(40003, "没有找到企业ID");
+
+	public static final Error EN_IS_NOT_ALLOWED = new Error(40004, "接口未授权");
+
+	public static final Error SECRET_IS_ERROR = new Error(40005, "密钥错误");
+
+	public static final Error EN_IS_NOT_YOUR_CUST = new Error(40006, "指定的企业ID错误,或该企业并非您的客户");
+
+	public static final Error NO_ACCESS_TOKEN_FOUND = new Error(40008, "请提供access_token");
+
+	public static final Error ACCESS_TOKEN_EXPIRES = new Error(40009, "access_token错误,或access_token已过期");
+
+}

+ 19 - 0
src/main/java/com/uas/platform/b2c/common/base/Readme.md

@@ -0,0 +1,19 @@
+## name
+
+common
+
+## 名称
+
+通用模块
+
+## 创建人
+
+suntg
+
+## 创建时间
+
+2017年7月31日19:23:32
+
+## 说明
+
+通用功能,比如文件上传、下载、报表、短信、发邮件等与具体业务无关的功能

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