xielq 4 rokov pred
rodič
commit
d04f30ece1
55 zmenil súbory, kde vykonal 3658 pridanie a 0 odobranie
  1. 12 0
      README.md
  2. 181 0
      pom.xml
  3. 2 0
      reservation-common/README.md
  4. 24 0
      reservation-common/pom.xml
  5. 44 0
      reservation-common/src/main/java/com/uas/reservation/util/CodeGenerator.java
  6. 23 0
      reservation-common/src/main/java/com/uas/reservation/util/FileUtils.java
  7. 16 0
      reservation-common/src/main/java/com/uas/reservation/util/ResourceUtils.java
  8. 16 0
      reservation-server/README.md
  9. 235 0
      reservation-server/pom.xml
  10. 45 0
      reservation-server/src/main/java/com/uas/reservation/Application.java
  11. 261 0
      reservation-server/src/main/java/com/uas/reservation/DruidDBConfiguration.java
  12. 73 0
      reservation-server/src/main/java/com/uas/reservation/WebAppConfiguration.java
  13. 158 0
      reservation-server/src/main/java/com/uas/reservation/company/api/CompanyController.java
  14. 310 0
      reservation-server/src/main/java/com/uas/reservation/company/entity/Company.java
  15. 221 0
      reservation-server/src/main/java/com/uas/reservation/company/entity/CompanyApply.java
  16. 85 0
      reservation-server/src/main/java/com/uas/reservation/company/entity/CompanyDayOff.java
  17. 16 0
      reservation-server/src/main/java/com/uas/reservation/company/repository/CompanyApplyRepository.java
  18. 16 0
      reservation-server/src/main/java/com/uas/reservation/company/repository/CompanyDayOffRepository.java
  19. 16 0
      reservation-server/src/main/java/com/uas/reservation/company/repository/CompanyRepository.java
  20. 47 0
      reservation-server/src/main/java/com/uas/reservation/company/service/CompanyApplyService.java
  21. 18 0
      reservation-server/src/main/java/com/uas/reservation/company/service/CompanyService.java
  22. 120 0
      reservation-server/src/main/java/com/uas/reservation/company/service/impl/CompanyApplyServiceImpl.java
  23. 35 0
      reservation-server/src/main/java/com/uas/reservation/company/service/impl/CompanyServiceImpl.java
  24. 31 0
      reservation-server/src/main/java/com/uas/reservation/constant/Status.java
  25. 16 0
      reservation-server/src/main/java/com/uas/reservation/dao/DeskStatusDao.java
  26. 16 0
      reservation-server/src/main/java/com/uas/reservation/dao/ServiceBookDao.java
  27. 16 0
      reservation-server/src/main/java/com/uas/reservation/dao/ServiceManDao.java
  28. 16 0
      reservation-server/src/main/java/com/uas/reservation/dao/ServiceManDayOffDao.java
  29. 16 0
      reservation-server/src/main/java/com/uas/reservation/dao/ServiceTypeDao.java
  30. 16 0
      reservation-server/src/main/java/com/uas/reservation/dao/StoreDeskDao.java
  31. 27 0
      reservation-server/src/main/java/com/uas/reservation/exception/IllegalOperationException.java
  32. 27 0
      reservation-server/src/main/java/com/uas/reservation/exception/IllegalStatusException.java
  33. 27 0
      reservation-server/src/main/java/com/uas/reservation/exception/NotFoundException.java
  34. 29 0
      reservation-server/src/main/java/com/uas/reservation/exception/UploadException.java
  35. 42 0
      reservation-server/src/main/java/com/uas/reservation/helper/UploadHelper.java
  36. 41 0
      reservation-server/src/main/java/com/uas/reservation/intercept/ExceptionHandlerAdvice.java
  37. 114 0
      reservation-server/src/main/java/com/uas/reservation/model/DeskStatus.java
  38. 355 0
      reservation-server/src/main/java/com/uas/reservation/model/ServiceBook.java
  39. 186 0
      reservation-server/src/main/java/com/uas/reservation/model/ServiceMan.java
  40. 115 0
      reservation-server/src/main/java/com/uas/reservation/model/ServiceManDayOff.java
  41. 144 0
      reservation-server/src/main/java/com/uas/reservation/model/ServiceType.java
  42. 144 0
      reservation-server/src/main/java/com/uas/reservation/model/StoreDesk.java
  43. 28 0
      reservation-server/src/main/java/com/uas/reservation/sso/ResultWrap.java
  44. 36 0
      reservation-server/src/main/java/com/uas/reservation/sso/api/UserController.java
  45. 45 0
      reservation-server/src/main/java/com/uas/reservation/sso/api/UserSpaceController.java
  46. 20 0
      reservation-server/src/main/java/com/uas/reservation/sso/service/UserSpaceService.java
  47. 41 0
      reservation-server/src/main/java/com/uas/reservation/sso/service/impl/UserSpaceServiceImpl.java
  48. 41 0
      reservation-server/src/main/resources/application.yml
  49. 19 0
      reservation-server/src/main/resources/config/application-dev.properties
  50. 14 0
      reservation-server/src/main/resources/dubbo.xml
  51. 44 0
      reservation-server/src/main/resources/logback.xml
  52. 13 0
      reservation-server/src/main/webapp/WEB-INF/views/index.html
  53. 3 0
      reservation-server/src/main/webapp/resources/css/index.css
  54. 1 0
      reservation-server/src/main/webapp/resources/js/index/app.js
  55. 1 0
      reservation-server/src/main/webapp/resources/lib/jquery/jquery.min.js

+ 12 - 0
README.md

@@ -0,0 +1,12 @@
+## Introduction
+Manage modules, dependencies, plugins, repositories, etc.
+
+## Frameworks
+Maven, Spring Boot, Hibernate
+
+## Modules
+#### reservation-common
+Common helper classes
+ 
+#### reservation-server
+Main service

+ 181 - 0
pom.xml

@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>1.4.1.RELEASE</version>
+    </parent>
+    <groupId>com.uas.reservation</groupId>
+    <artifactId>reservation-parent</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>reservation-server</module>
+        <module>reservation-common</module>
+    </modules>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <maven.compiler.source>1.7</maven.compiler.source>
+        <maven.compiler.target>1.7</maven.compiler.target>
+        <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
+        <mysql.jdbc.version>5.1.41</mysql.jdbc.version>
+        <druid.version>1.0.24</druid.version>
+        <fastjson.version>1.2.15</fastjson.version>
+        <reservation.common.version>0.0.1-SNAPSHOT</reservation.common.version>
+        <ps.httplog.version>0.0.1-SNAPSHOT</ps.httplog.version>
+        <ps.sync.core.version>0.0.1-SNAPSHOT</ps.sync.core.version>
+        <dubbo.version>2.8.4</dubbo.version>
+        <zkclient.version>0.1</zkclient.version>
+        <dfs.version>0.0.2</dfs.version>
+        <hessian.version>4.0.38</hessian.version>
+        <sso.integration.version>1.1.12-SNAPSHOT</sso.integration.version>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>mysql</groupId>
+                <artifactId>mysql-connector-java</artifactId>
+                <version>${mysql.jdbc.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.alibaba</groupId>
+                <artifactId>druid</artifactId>
+                <version>${druid.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.alibaba</groupId>
+                <artifactId>fastjson</artifactId>
+                <version>${fastjson.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.uas.reservation</groupId>
+                <artifactId>reservation-common</artifactId>
+                <version>${reservation.common.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.uas.ps</groupId>
+                <artifactId>ps-httplog</artifactId>
+                <version>${ps.httplog.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.uas.ps</groupId>
+                <artifactId>ps-core</artifactId>
+                <version>${ps.sync.core.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>*</groupId>
+                        <artifactId>*</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+
+            <!-- dubbo -->
+            <dependency>
+                <groupId>com.alibaba</groupId>
+                <artifactId>dubbo</artifactId>
+                <version>${dubbo.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.github.sgroschupf</groupId>
+                <artifactId>zkclient</artifactId>
+                <version>${zkclient.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <artifactId>slf4j-log4j12</artifactId>
+                        <groupId>org.slf4j</groupId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>com.uas.dfs</groupId>
+                <artifactId>dfs-api</artifactId>
+                <version>${dfs.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.caucho</groupId>
+                <artifactId>hessian</artifactId>
+                <version>${hessian.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.uas.account</groupId>
+                <artifactId>sso-integration</artifactId>
+                <version>${sso.integration.version}</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <!-- 生成javadoc文档包的插件 -->
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-javadoc-plugin</artifactId>
+                    <version>2.10.4</version>
+                    <executions>
+                        <execution>
+                            <id>attach-javadocs</id>
+                            <goals>
+                                <goal>aggregate</goal>
+                                <goal>jar</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+                <!-- 生成sources源码包的插件 -->
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-source-plugin</artifactId>
+                    <version>2.4</version>
+                    <configuration>
+                        <attach>true</attach>
+                    </configuration>
+                    <executions>
+                        <execution>
+                            <phase>package</phase>
+                            <goals>
+                                <goal>jar-no-fork</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+                <!-- spring boot war 打包插件 -->
+                <plugin>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-maven-plugin</artifactId>
+                    <version>1.5.8.RELEASE</version>
+                    <executions>
+                        <execution>
+                            <goals>
+                                <goal>repackage</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </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>

+ 2 - 0
reservation-common/README.md

@@ -0,0 +1,2 @@
+## Introduction
+Common helper classes

+ 24 - 0
reservation-common/pom.xml

@@ -0,0 +1,24 @@
+<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>
+    <parent>
+        <groupId>com.uas.reservation</groupId>
+        <artifactId>reservation-parent</artifactId>
+        <version>0.0.1-SNAPSHOT</version>
+    </parent>
+    <artifactId>reservation-common</artifactId>
+    <packaging>jar</packaging>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 44 - 0
reservation-common/src/main/java/com/uas/reservation/util/CodeGenerator.java

@@ -0,0 +1,44 @@
+package com.uas.reservation.util;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * generate unique code
+ *
+ * @author sunyj
+ * @since 2018/2/10 11:01
+ */
+public class CodeGenerator {
+
+    private final static int MAX_OFFSET = 16 * 16 * 16 - 16 * 16;
+    private volatile static CodeGenerator generator;
+    private int offset = 0;
+
+    private CodeGenerator() {
+    }
+
+    public static CodeGenerator getGenerator() {
+        if (generator == null) {
+            synchronized (CodeGenerator.class) {
+                if (generator == null) {
+                    generator = new CodeGenerator();
+                }
+            }
+        }
+        return generator;
+    }
+
+    /**
+     * generate one code: yyyyMMddHHmm + AAA(offset in 3 byte)
+     * <p>
+     * ensure that codes will not duplicate as long as generated codes' number is not greater than {@link CodeGenerator#MAX_OFFSET} every second
+     *
+     * @return code
+     */
+    public synchronized String generate() {
+        // offset, less than MAX_OFFSET
+        offset = (offset + 1) % MAX_OFFSET + 16 * 16;
+        return new SimpleDateFormat("yyyyMMddHHmm").format(new Date()) + Integer.toHexString(offset).toUpperCase();
+    }
+}

+ 23 - 0
reservation-common/src/main/java/com/uas/reservation/util/FileUtils.java

@@ -0,0 +1,23 @@
+package com.uas.reservation.util;
+
+/**
+ * tools to operate files
+ *
+ * @author sunyj
+ * @since 2016年11月3日 上午9:24:04
+ */
+public class FileUtils {
+
+    /**
+     * get type of the file
+     *
+     * @param fileName
+     * @return
+     */
+    public static String getFileType(String fileName) {
+        if (fileName != null && fileName.contains(".")) {
+            return fileName.substring(fileName.lastIndexOf(".") + 1);
+        }
+        return null;
+    }
+}

+ 16 - 0
reservation-common/src/main/java/com/uas/reservation/util/ResourceUtils.java

@@ -0,0 +1,16 @@
+package com.uas.reservation.util;
+
+import java.io.File;
+import java.net.URL;
+
+/**
+ * @author sunyj
+ * @since 2017/12/7 10:09
+ */
+public class ResourceUtils {
+
+    public static File getFile(String name) {
+        URL resource = ResourceUtils.class.getClassLoader().getResource(name);
+        return resource == null ? null : new File(resource.getFile());
+    }
+}

+ 16 - 0
reservation-server/README.md

@@ -0,0 +1,16 @@
+## Introduction
+Main service
+
+## Packages
+#### com.uas.reservation.company.*
+Company applying, manage business information, etc.
+#### com.uas.reservation.constant
+Constant variables
+#### com.uas.reservation.exception
+Exceptions
+#### com.uas.reservation.helper
+Helper classes
+#### com.uas.reservation.intercept
+Interceptors
+#### com.uas.reservation.sso.*
+Get user information

+ 235 - 0
reservation-server/pom.xml

@@ -0,0 +1,235 @@
+<?xml version="1.0"?>
+<project
+        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+        xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.uas.reservation</groupId>
+        <artifactId>reservation-parent</artifactId>
+        <version>0.0.1-SNAPSHOT</version>
+    </parent>
+    <artifactId>reservation-server</artifactId>
+    <packaging>war</packaging>
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <!-- spring boot -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-security</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-configuration-processor</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-tx</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.uas.reservation</groupId>
+            <artifactId>reservation-common</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.uas.ps</groupId>
+            <artifactId>ps-httplog</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.uas.ps</groupId>
+            <artifactId>ps-core</artifactId>
+        </dependency>
+
+        <!-- dubbo -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>dubbo</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.github.sgroschupf</groupId>
+            <artifactId>zkclient</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.uas.dfs</groupId>
+            <artifactId>dfs-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.caucho</groupId>
+            <artifactId>hessian</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.uas.account</groupId>
+            <artifactId>sso-integration</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <!-- 在maven生命周期validate阶段生成timestamp -->
+            <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>
+                    <encoding>${project.build.sourceEncoding}</encoding>
+                    <source>1.7</source>
+                    <target>1.7</target>
+                </configuration>
+            </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>
+                            <staticUrl>static</staticUrl>
+                            <webappDir>${project.build.directory}/minify</webappDir>
+                            <sourceDir>/</sourceDir>
+                            <targetDir>${project.build.directory}/statics</targetDir>
+                            <staticDir>/</staticDir>
+                            <sourceIncludes>
+                                <sourceInclude>resources/js/**/*.js</sourceInclude>
+                                <sourceInclude>WEB-INF/views/**/*.html</sourceInclude>
+                            </sourceIncludes>
+                            <!-- http://static.ubtoc.com/css/index.css?_v=1450321871828 -->
+                            <versionSuffix>
+                                <suffix>?_v=${timestamp}</suffix>
+                                <exclude>**/lib/**/*</exclude>
+                            </versionSuffix>
+                        </configuration>
+                        <goals>
+                            <goal>static</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <configuration>
+                    <webResources>
+                        <resource>
+                            <directory>${project.build.directory}/statics</directory>
+                        </resource>
+                        <resource>
+                            <directory>${project.build.directory}/minify</directory>
+                        </resource>
+                    </webResources>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </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>
+</project>

+ 45 - 0
reservation-server/src/main/java/com/uas/reservation/Application.java

@@ -0,0 +1,45 @@
+package com.uas.reservation;
+
+import com.uas.account.sso.integration.config.token.EnableSSOToken;
+import com.uas.ps.core.util.ContextUtils;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.context.event.ApplicationPreparedEvent;
+import org.springframework.context.ApplicationListener;
+import org.springframework.context.annotation.ImportResource;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+
+/**
+ * 应用入口
+ *
+ * @author sunyj
+ * @since 2017年8月16日 下午4:00:03
+ */
+@EnableSSOToken
+@EnableTransactionManagement
+@SpringBootApplication
+@EnableWebMvc
+@ImportResource("classpath:dubbo.xml")
+public class Application {
+    public static void main(String[] args) throws FileNotFoundException {
+        File logFile = new File("logs/log.log");
+        if (!logFile.getParentFile().exists()) {
+            logFile.getParentFile().mkdir();
+        }
+        System.setErr(new PrintStream(new FileOutputStream(logFile, true)));
+        SpringApplication application = new SpringApplication(Application.class);
+        application.addListeners(new ApplicationListener<ApplicationPreparedEvent>() {
+            @Override
+            public void onApplicationEvent(ApplicationPreparedEvent event) {
+                ContextUtils.setApplicationContext(event.getApplicationContext());
+            }
+        });
+        application.run(args);
+    }
+}

+ 261 - 0
reservation-server/src/main/java/com/uas/reservation/DruidDBConfiguration.java

@@ -0,0 +1,261 @@
+package com.uas.reservation;
+
+import com.alibaba.druid.pool.DruidDataSource;
+import com.alibaba.druid.support.http.StatViewServlet;
+import com.alibaba.druid.support.http.WebStatFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.boot.web.servlet.ServletRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Primary;
+import org.springframework.stereotype.Component;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+@Component
+@ConfigurationProperties(prefix = "datasource")
+public class DruidDBConfiguration {
+
+    private Logger logger = LoggerFactory.getLogger(DruidDBConfiguration.class);
+
+    private String url;
+
+    private String username;
+
+    private String password;
+
+    private String driverClassName;
+
+    private int initialSize;
+
+    private int minIdle;
+
+    private int maxActive;
+
+    private int maxWait;
+
+    private int timeBetweenEvictionRunsMillis;
+
+    private int minEvictableIdleTimeMillis;
+
+    private String validationQuery;
+
+    private boolean testWhileIdle;
+
+    private boolean testOnBorrow;
+
+    private boolean testOnReturn;
+
+    private int timeBetweenLogStatsMillis;
+
+    private boolean poolPreparedStatements;
+
+    private int maxPoolPreparedStatementPerConnectionSize;
+
+    private String filters;
+
+    private String connectionProperties;
+
+    @Bean
+    @Primary
+    public DataSource dataSource() {
+        DruidDataSource dataSource = new DruidDataSource();
+
+        dataSource.setUrl(url);
+        dataSource.setUsername(username);
+        dataSource.setPassword(password);
+        dataSource.setDriverClassName(driverClassName);
+
+        // configuration
+        dataSource.setInitialSize(initialSize);
+        dataSource.setMinIdle(minIdle);
+        dataSource.setMaxActive(maxActive);
+        dataSource.setMaxWait(maxWait);
+        dataSource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
+        dataSource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
+        dataSource.setValidationQuery(validationQuery);
+        dataSource.setTestWhileIdle(testWhileIdle);
+        dataSource.setTestOnBorrow(testOnBorrow);
+        dataSource.setTestOnReturn(testOnReturn);
+        dataSource.setTimeBetweenLogStatsMillis(timeBetweenLogStatsMillis);
+        dataSource.setPoolPreparedStatements(poolPreparedStatements);
+        dataSource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
+        try {
+            dataSource.setFilters(filters);
+        } catch (SQLException e) {
+            logger.error("数据源初始化失败: setFilters", e);
+        }
+        dataSource.setConnectionProperties(connectionProperties);
+        return dataSource;
+    }
+
+    @Bean
+    public ServletRegistrationBean servletRegistrationBean() {
+        return new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
+    }
+
+    @Bean
+    public FilterRegistrationBean filterRegistrationBean() {
+        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
+        filterRegistrationBean.setFilter(new WebStatFilter());
+        filterRegistrationBean.addUrlPatterns("/*");
+        filterRegistrationBean.addInitParameter("exclusions",
+                "*.js,*.gif,*.jpg,*.png,*.bmp,*.css,*.ico,*.html,/druid/*");
+        return filterRegistrationBean;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getDriverClassName() {
+        return driverClassName;
+    }
+
+    public void setDriverClassName(String driverClassName) {
+        this.driverClassName = driverClassName;
+    }
+
+    public int getInitialSize() {
+        return initialSize;
+    }
+
+    public void setInitialSize(int initialSize) {
+        this.initialSize = initialSize;
+    }
+
+    public int getMinIdle() {
+        return minIdle;
+    }
+
+    public void setMinIdle(int minIdle) {
+        this.minIdle = minIdle;
+    }
+
+    public int getMaxActive() {
+        return maxActive;
+    }
+
+    public void setMaxActive(int maxActive) {
+        this.maxActive = maxActive;
+    }
+
+    public int getMaxWait() {
+        return maxWait;
+    }
+
+    public void setMaxWait(int maxWait) {
+        this.maxWait = maxWait;
+    }
+
+    public int getTimeBetweenEvictionRunsMillis() {
+        return timeBetweenEvictionRunsMillis;
+    }
+
+    public void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis) {
+        this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
+    }
+
+    public int getMinEvictableIdleTimeMillis() {
+        return minEvictableIdleTimeMillis;
+    }
+
+    public void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis) {
+        this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
+    }
+
+    public String getValidationQuery() {
+        return validationQuery;
+    }
+
+    public void setValidationQuery(String validationQuery) {
+        this.validationQuery = validationQuery;
+    }
+
+    public boolean isTestWhileIdle() {
+        return testWhileIdle;
+    }
+
+    public void setTestWhileIdle(boolean testWhileIdle) {
+        this.testWhileIdle = testWhileIdle;
+    }
+
+    public boolean isTestOnBorrow() {
+        return testOnBorrow;
+    }
+
+    public void setTestOnBorrow(boolean testOnBorrow) {
+        this.testOnBorrow = testOnBorrow;
+    }
+
+    public boolean isTestOnReturn() {
+        return testOnReturn;
+    }
+
+    public void setTestOnReturn(boolean testOnReturn) {
+        this.testOnReturn = testOnReturn;
+    }
+
+    public int getTimeBetweenLogStatsMillis() {
+        return timeBetweenLogStatsMillis;
+    }
+
+    public void setTimeBetweenLogStatsMillis(int timeBetweenLogStatsMillis) {
+        this.timeBetweenLogStatsMillis = timeBetweenLogStatsMillis;
+    }
+
+    public boolean isPoolPreparedStatements() {
+        return poolPreparedStatements;
+    }
+
+    public void setPoolPreparedStatements(boolean poolPreparedStatements) {
+        this.poolPreparedStatements = poolPreparedStatements;
+    }
+
+    public int getMaxPoolPreparedStatementPerConnectionSize() {
+        return maxPoolPreparedStatementPerConnectionSize;
+    }
+
+    public void setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize) {
+        this.maxPoolPreparedStatementPerConnectionSize = maxPoolPreparedStatementPerConnectionSize;
+    }
+
+    public String getFilters() {
+        return filters;
+    }
+
+    public void setFilters(String filters) {
+        this.filters = filters;
+    }
+
+    public String getConnectionProperties() {
+        return connectionProperties;
+    }
+
+    public void setConnectionProperties(String connectionProperties) {
+        this.connectionProperties = connectionProperties;
+    }
+}

+ 73 - 0
reservation-server/src/main/java/com/uas/reservation/WebAppConfiguration.java

@@ -0,0 +1,73 @@
+package com.uas.reservation;
+
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.alibaba.fastjson.support.config.FastJsonConfig;
+import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
+import com.uas.ps.httplog.config.EnableHttpLog;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.MediaType;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.StringHttpMessageConverter;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import org.springframework.web.servlet.view.InternalResourceViewResolver;
+
+import java.nio.charset.Charset;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Web相关配置
+ *
+ * @author sunyj
+ * @since 2017年2月17日 下午5:45:38
+ */
+@EnableHttpLog
+@Configuration
+@ComponentScan
+public class WebAppConfiguration extends WebMvcConfigurerAdapter {
+
+    @Override
+    public void addResourceHandlers(ResourceHandlerRegistry registry) {
+        // Spring boot默认资源路径在src/main/resources下,而非/src/main/webapp
+        // 使用/src/main/webapp下资源均需在此添加
+        registry.addResourceHandler("/static/**").addResourceLocations("/resources/");
+        registry.addResourceHandler("/WEB-INF/**").addResourceLocations("/WEB-INF/");
+        super.addResourceHandlers(registry);
+    }
+
+    @Override
+    public void configureViewResolvers(ViewResolverRegistry registry) {
+        InternalResourceViewResolver viewResolver = new InternalResourceViewResolver("/WEB-INF/views/", ".html");
+        viewResolver.setContentType("text/html;charset=UTF-8");
+        registry.viewResolver(viewResolver);
+        super.configureViewResolvers(registry);
+    }
+
+    @Override
+    public void addViewControllers(ViewControllerRegistry registry) {
+        registry.addViewController("/").setViewName("index");
+        registry.addViewController("/index").setViewName("index");
+        super.addViewControllers(registry);
+    }
+
+    @Override
+    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
+        FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter();
+        fastJsonHttpMessageConverter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON_UTF8));
+        FastJsonConfig fastJsonConfig = new FastJsonConfig();
+        fastJsonConfig.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect);
+        fastJsonHttpMessageConverter.setFastJsonConfig(fastJsonConfig);
+        converters.add(fastJsonHttpMessageConverter);
+
+        StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(
+                Charset.forName("UTF-8"));
+        stringHttpMessageConverter.setSupportedMediaTypes(Arrays.asList(MediaType.TEXT_HTML));
+        converters.add(stringHttpMessageConverter);
+        super.configureMessageConverters(converters);
+    }
+
+}

+ 158 - 0
reservation-server/src/main/java/com/uas/reservation/company/api/CompanyController.java

@@ -0,0 +1,158 @@
+package com.uas.reservation.company.api;
+
+import com.alibaba.fastjson.JSONObject;
+import com.uas.ps.core.util.Assert;
+import com.uas.ps.httplog.annotation.HttpLog;
+import com.uas.reservation.company.entity.Company;
+import com.uas.reservation.company.entity.CompanyApply;
+import com.uas.reservation.company.service.CompanyApplyService;
+import com.uas.reservation.company.service.CompanyService;
+import com.uas.reservation.exception.IllegalOperationException;
+import com.uas.reservation.exception.IllegalStatusException;
+import com.uas.reservation.exception.NotFoundException;
+import com.uas.reservation.exception.UploadException;
+import com.uas.reservation.helper.UploadHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 商家
+ *
+ * @author sunyj
+ * @since 2018/2/10 9:16
+ */
+@RestController
+@RequestMapping("/company")
+public class CompanyController {
+
+    private static final Integer PAGE = 1;
+    private static final Integer SIZE = 10;
+
+    private final CompanyApplyService companyApplyService;
+    private final CompanyService companyService;
+    private final UploadHelper uploadHelper;
+
+    @Autowired
+    public CompanyController(CompanyApplyService companyApplyService, UploadHelper uploadHelper, CompanyService companyService) {
+        this.companyApplyService = companyApplyService;
+        this.uploadHelper = uploadHelper;
+        this.companyService = companyService;
+    }
+
+    /**
+     * 申请开店
+     *
+     * @param businessLicence 营业执照
+     * @param businessPermit  营业许可
+     * @param managerPicture  负责人图片
+     * @param data            申请资料,键值对
+     *                        <table border=10 cellpadding=5 cellspacing=5 summary=
+     *                        "Fields and types">
+     *                        <tr>
+     *                        <th>Field</th>
+     *                        <th>Type</th>
+     *                        <th>Description</th>
+     *                        <th>Not Null</th>
+     *                        </tr>
+     *                        <tr>
+     *                        <td>contactName</td>
+     *                        <td>String</td>
+     *                        <td>联系人名称</td>
+     *                        <td>√</td>
+     *                        </tr>
+     *                        <tr>
+     *                        <td>mainBusiness</td>
+     *                        <td>String</td>
+     *                        <td>门店分类:主营分类</td>
+     *                        <td>√</td>
+     *                        </tr>
+     *                        <tr>
+     *                        <td>subAttalionBusiness</td>
+     *                        <td>String</td>
+     *                        <td>门店分类:次营分类</td>
+     *                        <td>√</td>
+     *                        </tr>
+     *                        <tr>
+     *                        <td>address</td>
+     *                        <td>String</td>
+     *                        <td>地址</td>
+     *                        <td>√</td>
+     *                        </tr>
+     *                        </table>
+     */
+    @HttpLog
+    @PostMapping("/apply")
+    public void apply(@RequestParam MultipartFile businessLicence, @RequestParam MultipartFile businessPermit,
+                      @RequestParam MultipartFile managerPicture, @RequestParam String data) throws UploadException {
+        CompanyApply apply = JSONObject.parseObject(data, CompanyApply.class);
+        Assert.notEmpty(apply.getContactName(), "contactName is empty");
+        Assert.notEmpty(apply.getMainBusiness(), "mainBusiness is empty");
+        Assert.notEmpty(apply.getSubAttalionBusiness(), "subAttalionBusiness is empty");
+        Assert.notEmpty(apply.getAddress(), "address is empty");
+
+        apply.setBusinessLicenseUrl(uploadHelper.upload(businessLicence));
+        apply.setBusinessPermitUrl(uploadHelper.upload(businessPermit));
+        apply.setManagerPictureUrl(uploadHelper.upload(managerPicture));
+        companyApplyService.apply(apply);
+    }
+
+    /**
+     * 分页获取开店申请
+     *
+     * @param page 页码
+     * @param size 分页大小
+     * @return 开店申请
+     */
+    @HttpLog
+    @GetMapping("/applies")
+    public Page<CompanyApply> getApplies(Integer page, Integer size) {
+        page = page == null ? PAGE : page;
+        size = size == null ? SIZE : size;
+        return companyApplyService.getSubmittedApplies(page, size);
+    }
+
+    /**
+     * 同意开店申请
+     *
+     * @param code 申请单号
+     * @throws IllegalStatusException
+     * @throws NotFoundException
+     * @throws IllegalOperationException
+     */
+    @HttpLog
+    @PostMapping("/apply/approve/{code}")
+    public void approve(@PathVariable String code) throws IllegalStatusException, NotFoundException, IllegalOperationException {
+        companyApplyService.approve(code);
+    }
+
+    /**
+     * 拒绝开店申请
+     *
+     * @param code   申请单号
+     * @param reason 拒绝原因
+     * @throws IllegalStatusException
+     * @throws NotFoundException
+     * @throws IllegalOperationException
+     */
+    @HttpLog
+    @PostMapping("/apply/reject/{code}")
+    public void reject(@PathVariable String code, @RequestParam String reason) throws IllegalStatusException, NotFoundException, IllegalOperationException {
+        companyApplyService.reject(code, reason);
+    }
+
+    /**
+     * 维护商家信息
+     *
+     * @param data 商家信息
+     * @throws NotFoundException
+     */
+    @HttpLog
+    @PostMapping("/update")
+    public void updateCompany(@RequestParam String data) throws NotFoundException {
+        // TODO Picture
+        // TODO 明确指定更新哪部分数据
+        companyService.update(JSONObject.parseObject(data, Company.class));
+    }
+}

+ 310 - 0
reservation-server/src/main/java/com/uas/reservation/company/entity/Company.java

@@ -0,0 +1,310 @@
+package com.uas.reservation.company.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 商家表
+ *
+ * @author sunyj
+ * @since 2018/1/3 20:13
+ */
+@Entity
+@Table(name = "ServiceCompany")
+public class Company implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @Column(name = "sc_id")
+    private Long id;
+
+    /**
+     * 商家UU号
+     */
+    @Column(name = "sc_uu")
+    private Long uu;
+
+    /**
+     * 商家名称
+     */
+    @Column(name = "sc_companyname")
+    private String companyName;
+
+    /**
+     * 行业代码
+     */
+    @Column(name = "sc_industrycode")
+    private Long industryCode;
+
+    /**
+     * 行业名称
+     */
+    @Column(name = "sc_industry")
+    private String industry;
+
+    /**
+     * 商家地址
+     */
+    @Column(name = "sc_address")
+    private String address;
+
+    /**
+     * 管理员姓名
+     */
+    @Column(name = "sc_adminname")
+    private String adminName;
+
+    /**
+     * 管理员APPID
+     */
+    @Column(name = "sc_imid")
+    private Long imId;
+
+    /**
+     * 电话号码
+     */
+    @Column(name = "sc_telephone")
+    private String telephone;
+
+    /**
+     * 商家等级
+     */
+    @Column(name = "sc_rank")
+    private Long rank;
+
+    /**
+     * 经度
+     */
+    @Column(name = "sc_longitude")
+    private Double longitude;
+
+    /**
+     * 纬度
+     */
+    @Column(name = "sc_latitude")
+    private Double latitude;
+
+    /**
+     * 商家形象照片
+     */
+    @Column(name = "sc_imageurl")
+    private String imageUrl;
+
+    /**
+     * 营业开始时间
+     */
+    @Column(name = "sc_starttime")
+    private String startTime;
+
+    /**
+     * 营业结束时间
+     */
+    @Column(name = "sc_endtime")
+    private String endTime;
+
+    /**
+     * 预订类型
+     */
+    @Column(name = "sc_booktype")
+    private Long bookType;
+
+    /**
+     * 注册日期
+     */
+    @Column(name = "sc_date")
+    private Date date;
+
+    /**
+     * 商家介绍
+     */
+    @Column(name = "sc_introduce")
+    private String introduce;
+
+    /**
+     * 餐饮商家早中晚类型
+     */
+    @Column(name = "sc_cytype")
+    private String cyType;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getUu() {
+        return uu;
+    }
+
+    public void setUu(Long uu) {
+        this.uu = uu;
+    }
+
+    public String getCompanyName() {
+        return companyName;
+    }
+
+    public void setCompanyName(String companyName) {
+        this.companyName = companyName;
+    }
+
+    public Long getIndustryCode() {
+        return industryCode;
+    }
+
+    public void setIndustryCode(Long industryCode) {
+        this.industryCode = industryCode;
+    }
+
+    public String getIndustry() {
+        return industry;
+    }
+
+    public void setIndustry(String industry) {
+        this.industry = industry;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public String getAdminName() {
+        return adminName;
+    }
+
+    public void setAdminName(String adminName) {
+        this.adminName = adminName;
+    }
+
+    public Long getImId() {
+        return imId;
+    }
+
+    public void setImId(Long imId) {
+        this.imId = imId;
+    }
+
+    public String getTelephone() {
+        return telephone;
+    }
+
+    public void setTelephone(String telephone) {
+        this.telephone = telephone;
+    }
+
+    public Long getRank() {
+        return rank;
+    }
+
+    public void setRank(Long rank) {
+        this.rank = rank;
+    }
+
+    public Double getLongitude() {
+        return longitude;
+    }
+
+    public void setLongitude(Double longitude) {
+        this.longitude = longitude;
+    }
+
+    public Double getLatitude() {
+        return latitude;
+    }
+
+    public void setLatitude(Double latitude) {
+        this.latitude = latitude;
+    }
+
+    public String getImageUrl() {
+        return imageUrl;
+    }
+
+    public void setImageUrl(String imageUrl) {
+        this.imageUrl = imageUrl;
+    }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    public Long getBookType() {
+        return bookType;
+    }
+
+    public void setBookType(Long bookType) {
+        this.bookType = bookType;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    public String getIntroduce() {
+        return introduce;
+    }
+
+    public void setIntroduce(String introduce) {
+        this.introduce = introduce;
+    }
+
+    public String getCyType() {
+        return cyType;
+    }
+
+    public void setCyType(String cyType) {
+        this.cyType = cyType;
+    }
+
+    @Override
+    public String toString() {
+        return "Company{" +
+                "id=" + id +
+                ", uu=" + uu +
+                ", companyName='" + companyName + '\'' +
+                ", industryCode=" + industryCode +
+                ", industry='" + industry + '\'' +
+                ", address='" + address + '\'' +
+                ", adminName='" + adminName + '\'' +
+                ", imId=" + imId +
+                ", telephone='" + telephone + '\'' +
+                ", rank=" + rank +
+                ", longitude=" + longitude +
+                ", latitude=" + latitude +
+                ", imageUrl='" + imageUrl + '\'' +
+                ", startTime='" + startTime + '\'' +
+                ", endTime='" + endTime + '\'' +
+                ", bookType=" + bookType +
+                ", date=" + date +
+                ", introduce='" + introduce + '\'' +
+                ", cyType='" + cyType + '\'' +
+                '}';
+    }
+}

+ 221 - 0
reservation-server/src/main/java/com/uas/reservation/company/entity/CompanyApply.java

@@ -0,0 +1,221 @@
+package com.uas.reservation.company.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 开店申请
+ *
+ * @author sunyj
+ * @since 2018/2/7 19:29
+ */
+@Entity
+@Table(name = "service$company_apply")
+public class CompanyApply implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @Column(name = "ca_id")
+    private Long id;
+
+    /**
+     * 申请单号
+     */
+    @Column(name = "ca_code", nullable = false, unique = true)
+    private String code;
+
+    /**
+     * 商家UU号
+     */
+    @Column(name = "ca_uu", nullable = false)
+    private Long uu;
+
+    /**
+     * 营业执照
+     */
+    @Column(name = "ca_business_license_url", nullable = false)
+    private String businessLicenseUrl;
+
+    /**
+     * 营业许可证
+     */
+    @Column(name = "ca_business_permit_url", nullable = false)
+    private String businessPermitUrl;
+
+    /**
+     * 营业负责人照片
+     */
+    @Column(name = "ca_manager_picture_url", nullable = false)
+    private String managerPictureUrl;
+
+    /**
+     * 联系人名称
+     */
+    @Column(name = "ca_contact_name", nullable = false)
+    private String contactName;
+
+    /**
+     * 门店分类:主营分类
+     */
+    @Column(name = "ca_main_business", nullable = false)
+    private String mainBusiness;
+
+    /**
+     * 门店分类:次营分类
+     */
+    @Column(name = "ca_sub_battalion_business", nullable = false)
+    private String subAttalionBusiness;
+
+    /**
+     * 地址
+     */
+    @Column(name = "ca_address", nullable = false)
+    private String address;
+
+    /**
+     * 申请时间
+     */
+    @Column(name = "ca_time", nullable = false)
+    private Date applyTime;
+
+    /**
+     * 审核状态
+     */
+    @Column(name = "ca_status")
+    private Integer status;
+
+    /**
+     * 审核理由
+     */
+    @Column(name = "ca_reason")
+    private String reason;
+
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public Long getUu() {
+        return uu;
+    }
+
+    public void setUu(Long uu) {
+        this.uu = uu;
+    }
+
+    public String getBusinessLicenseUrl() {
+        return businessLicenseUrl;
+    }
+
+    public void setBusinessLicenseUrl(String businessLicenseUrl) {
+        this.businessLicenseUrl = businessLicenseUrl;
+    }
+
+    public String getBusinessPermitUrl() {
+        return businessPermitUrl;
+    }
+
+    public void setBusinessPermitUrl(String businessPermitUrl) {
+        this.businessPermitUrl = businessPermitUrl;
+    }
+
+    public String getManagerPictureUrl() {
+        return managerPictureUrl;
+    }
+
+    public void setManagerPictureUrl(String managerPictureUrl) {
+        this.managerPictureUrl = managerPictureUrl;
+    }
+
+    public String getContactName() {
+        return contactName;
+    }
+
+    public void setContactName(String contactName) {
+        this.contactName = contactName;
+    }
+
+    public String getMainBusiness() {
+        return mainBusiness;
+    }
+
+    public void setMainBusiness(String mainBusiness) {
+        this.mainBusiness = mainBusiness;
+    }
+
+    public String getSubAttalionBusiness() {
+        return subAttalionBusiness;
+    }
+
+    public void setSubAttalionBusiness(String subAttalionBusiness) {
+        this.subAttalionBusiness = subAttalionBusiness;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public Date getApplyTime() {
+        return applyTime;
+    }
+
+    public void setApplyTime(Date applyTime) {
+        this.applyTime = applyTime;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    @Override
+    public String toString() {
+        return "CompanyApply{" +
+                "id=" + id +
+                ", code='" + code + '\'' +
+                ", uu=" + uu +
+                ", businessLicenseUrl='" + businessLicenseUrl + '\'' +
+                ", businessPermitUrl='" + businessPermitUrl + '\'' +
+                ", managerPictureUrl='" + managerPictureUrl + '\'' +
+                ", contactName='" + contactName + '\'' +
+                ", mainBusiness='" + mainBusiness + '\'' +
+                ", subAttalionBusiness='" + subAttalionBusiness + '\'' +
+                ", address='" + address + '\'' +
+                ", applyTime=" + applyTime +
+                ", status=" + status +
+                ", reason='" + reason + '\'' +
+                '}';
+    }
+}

+ 85 - 0
reservation-server/src/main/java/com/uas/reservation/company/entity/CompanyDayOff.java

@@ -0,0 +1,85 @@
+package com.uas.reservation.company.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 商家休息日表
+ *
+ * @author sunyj
+ * @since 2018/1/3 20:09
+ */
+@Entity
+@Table(name = "ServciecompanyDayoff")
+public class CompanyDayOff implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @Column(name = "sc_id")
+    private Long id;
+
+    /**
+     * 商家UU号
+     */
+    @Column(name = "sc_companyid")
+    private Long componentId;
+
+    /**
+     * 商家名称
+     */
+    @Column(name = "sc_companyname")
+    private String componentName;
+
+    /**
+     * sc_date
+     */
+    @Column(name = "sc_date")
+    private Date date;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getComponentId() {
+        return componentId;
+    }
+
+    public void setComponentId(Long componentId) {
+        this.componentId = componentId;
+    }
+
+    public String getComponentName() {
+        return componentName;
+    }
+
+    public void setComponentName(String componentName) {
+        this.componentName = componentName;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    @Override
+    public String toString() {
+        return "CompanyDayOff{" +
+                "id=" + id +
+                ", componentId=" + componentId +
+                ", componentName='" + componentName + '\'' +
+                ", date=" + date +
+                '}';
+    }
+}

+ 16 - 0
reservation-server/src/main/java/com/uas/reservation/company/repository/CompanyApplyRepository.java

@@ -0,0 +1,16 @@
+package com.uas.reservation.company.repository;
+
+import com.uas.reservation.company.entity.CompanyApply;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author sunyj
+ * @since 2018/2/10 9:10
+ */
+@Repository
+public interface CompanyApplyRepository extends JpaRepository<CompanyApply, Long>, JpaSpecificationExecutor<Long> {
+
+    CompanyApply findByCode(String code);
+}

+ 16 - 0
reservation-server/src/main/java/com/uas/reservation/company/repository/CompanyDayOffRepository.java

@@ -0,0 +1,16 @@
+package com.uas.reservation.company.repository;
+
+import com.uas.reservation.company.entity.CompanyDayOff;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 商家休息日
+ *
+ * @author sunyj
+ * @since 2018/1/4 8:38
+ */
+@Repository
+public interface CompanyDayOffRepository extends JpaRepository<CompanyDayOff, Long>, JpaSpecificationExecutor<CompanyDayOff> {
+}

+ 16 - 0
reservation-server/src/main/java/com/uas/reservation/company/repository/CompanyRepository.java

@@ -0,0 +1,16 @@
+package com.uas.reservation.company.repository;
+
+import com.uas.reservation.company.entity.Company;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 商家
+ *
+ * @author sunyj
+ * @since 2018/1/4 8:38
+ */
+@Repository
+public interface CompanyRepository extends JpaRepository<Company, Long>, JpaSpecificationExecutor<Company> {
+}

+ 47 - 0
reservation-server/src/main/java/com/uas/reservation/company/service/CompanyApplyService.java

@@ -0,0 +1,47 @@
+package com.uas.reservation.company.service;
+
+import com.uas.reservation.company.entity.CompanyApply;
+import com.uas.reservation.exception.IllegalOperationException;
+import com.uas.reservation.exception.IllegalStatusException;
+import com.uas.reservation.exception.NotFoundException;
+import org.springframework.data.domain.Page;
+
+/**
+ * 开店申请
+ *
+ * @author sunyj
+ * @since 2018/2/10 9:11
+ */
+public interface CompanyApplyService {
+
+    /**
+     * 申请开店
+     *
+     * @param apply 申请资料
+     */
+    void apply(CompanyApply apply);
+
+    /**
+     * 审核
+     *
+     * @param code 申请单号
+     */
+    void approve(String code) throws IllegalOperationException, IllegalStatusException, NotFoundException;
+
+    /**
+     * 拒绝
+     *
+     * @param code   申请单号
+     * @param reason 拒绝理由
+     */
+    void reject(String code, String reason) throws IllegalStatusException, NotFoundException, IllegalOperationException;
+
+    /**
+     * 获取已提交的开店申请
+     *
+     * @param page 页码
+     * @param size 分页大小
+     * @return 开店申请
+     */
+    Page<CompanyApply> getSubmittedApplies(Integer page, Integer size);
+}

+ 18 - 0
reservation-server/src/main/java/com/uas/reservation/company/service/CompanyService.java

@@ -0,0 +1,18 @@
+package com.uas.reservation.company.service;
+
+import com.uas.reservation.company.entity.Company;
+import com.uas.reservation.exception.NotFoundException;
+
+/**
+ * @author sunyj
+ * @since 2018/2/10 17:21
+ */
+public interface CompanyService {
+
+    /**
+     * 维护商家信息
+     *
+     * @param company 商家
+     */
+    void update(Company company) throws NotFoundException;
+}

+ 120 - 0
reservation-server/src/main/java/com/uas/reservation/company/service/impl/CompanyApplyServiceImpl.java

@@ -0,0 +1,120 @@
+package com.uas.reservation.company.service.impl;
+
+import com.uas.account.sso.integration.entity.UserSpaceView;
+import com.uas.account.sso.integration.util.SSO;
+import com.uas.ps.core.page.PageInfo;
+import com.uas.ps.core.util.Assert;
+import com.uas.reservation.company.entity.Company;
+import com.uas.reservation.company.entity.CompanyApply;
+import com.uas.reservation.company.repository.CompanyApplyRepository;
+import com.uas.reservation.company.repository.CompanyRepository;
+import com.uas.reservation.company.service.CompanyApplyService;
+import com.uas.reservation.constant.Status;
+import com.uas.reservation.exception.IllegalOperationException;
+import com.uas.reservation.exception.IllegalStatusException;
+import com.uas.reservation.exception.NotFoundException;
+import com.uas.reservation.sso.service.UserSpaceService;
+import com.uas.reservation.util.CodeGenerator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Sort;
+import org.springframework.stereotype.Service;
+
+import javax.transaction.Transactional;
+import java.util.Date;
+
+/**
+ * 开店申请
+ *
+ * @author sunyj
+ * @since 2018/2/10 9:13
+ */
+@Service
+public class CompanyApplyServiceImpl implements CompanyApplyService {
+
+    private final CompanyApplyRepository companyApplyRepository;
+
+    private final CompanyRepository companyRepository;
+
+    private final UserSpaceService userSpaceService;
+
+    @Autowired
+    public CompanyApplyServiceImpl(CompanyApplyRepository companyApplyRepository, CompanyRepository companyRepository, UserSpaceService userSpaceService) {
+        this.companyApplyRepository = companyApplyRepository;
+        this.companyRepository = companyRepository;
+        this.userSpaceService = userSpaceService;
+    }
+
+    @Override
+    public void apply(CompanyApply apply) {
+        apply.setStatus(Status.SUBMITTED.getCode());
+        apply.setCode(CodeGenerator.getGenerator().generate());
+        apply.setApplyTime(new Date());
+        companyApplyRepository.save(apply);
+    }
+
+    @Override
+    @Transactional
+    public void approve(String code) throws IllegalOperationException, IllegalStatusException, NotFoundException {
+        CompanyApply apply = processApply(code, Status.APPROVED, null);
+        // TODO 从账户中心获取企业信息
+        UserSpaceView userSpace = userSpaceService.getUserSpace(SSO.get().getSpaceName());
+        Company company = new Company();
+        company.setUu(userSpace.getUu());
+        company.setDate(apply.getApplyTime());
+        company.setAddress(apply.getAddress());
+        companyRepository.save(company);
+    }
+
+    @Override
+    public void reject(String code, String reason) throws IllegalStatusException, NotFoundException, IllegalOperationException {
+        Assert.notEmpty(reason, "请说明拒绝原因");
+        processApply(code, Status.REJECTED, reason);
+    }
+
+    /**
+     * 处理开店申请
+     *
+     * @param code   申请单号
+     * @param status 处理的状态
+     * @param reason 处理的原因
+     * @return 处理后的申请
+     * @throws IllegalOperationException
+     * @throws IllegalStatusException
+     * @throws NotFoundException
+     */
+    private CompanyApply processApply(String code, Status status, String reason) throws IllegalOperationException, IllegalStatusException, NotFoundException {
+        CompanyApply apply = companyApplyRepository.findByCode(code);
+        if (apply == null) {
+            throw new NotFoundException("申请不存在: " + code);
+        }
+        Integer currentStatus = apply.getStatus();
+        Assert.notNull(currentStatus, "currentStatus is null: code = " + code);
+        if (currentStatus == Status.SUBMITTED.getCode()) {
+            apply.setStatus(status.getCode());
+            if (reason != null) {
+                apply.setReason(reason);
+            }
+            return companyApplyRepository.save(apply);
+        } else if (currentStatus == Status.APPROVED.getCode()) {
+            throw new IllegalOperationException("申请已被审核");
+        } else if (currentStatus == Status.REJECTED.getCode()) {
+            throw new IllegalOperationException("申请已被拒绝");
+        } else {
+            throw new IllegalStatusException("单据状态异常 " + currentStatus);
+        }
+    }
+
+
+    @Override
+    public Page<CompanyApply> getSubmittedApplies(Integer page, Integer size) {
+        Assert.greaterThanZero(page, "page is not greater than 0");
+        Assert.greaterThanZero(page, "size is not greater than 0");
+        PageInfo pageInfo = new PageInfo();
+        pageInfo.setPageNumber(page);
+        pageInfo.setPageNumber(size);
+        pageInfo.sorting("applyTime", Sort.Direction.ASC);
+        pageInfo.filter("status", Status.SUBMITTED.getCode());
+        return companyApplyRepository.findAll(pageInfo);
+    }
+}

+ 35 - 0
reservation-server/src/main/java/com/uas/reservation/company/service/impl/CompanyServiceImpl.java

@@ -0,0 +1,35 @@
+package com.uas.reservation.company.service.impl;
+
+import com.uas.ps.core.util.Assert;
+import com.uas.reservation.company.entity.Company;
+import com.uas.reservation.company.repository.CompanyRepository;
+import com.uas.reservation.company.service.CompanyService;
+import com.uas.reservation.exception.NotFoundException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author sunyj
+ * @since 2018/2/10 17:22
+ */
+@Service
+public class CompanyServiceImpl implements CompanyService {
+
+    private final CompanyRepository companyRepository;
+
+    @Autowired
+    public CompanyServiceImpl(CompanyRepository companyRepository) {
+        this.companyRepository = companyRepository;
+    }
+
+    @Override
+    public void update(Company company) throws NotFoundException {
+        Assert.notNull(company, "company is null");
+        Long id = company.getId();
+        Assert.notNull(id, "id is null");
+        if (companyRepository.findOne(id) == null) {
+            throw new NotFoundException("商家不存在:" + id);
+        }
+        companyRepository.save(company);
+    }
+}

+ 31 - 0
reservation-server/src/main/java/com/uas/reservation/constant/Status.java

@@ -0,0 +1,31 @@
+package com.uas.reservation.constant;
+
+/**
+ * @author sunyj
+ * @since 2018/2/10 11:34
+ */
+public enum Status {
+
+    SUBMITTED(100, "已提交"),
+
+    APPROVED(101, "已同意"),
+
+    REJECTED(102, "已拒绝");
+
+    private int code;
+
+    private String description;
+
+    Status(int code, String description) {
+        this.code = code;
+        this.description = description;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+}

+ 16 - 0
reservation-server/src/main/java/com/uas/reservation/dao/DeskStatusDao.java

@@ -0,0 +1,16 @@
+package com.uas.reservation.dao;
+
+import com.uas.reservation.model.DeskStatus;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 桌位状态
+ *
+ * @author sunyj
+ * @since 2018/1/4 8:38
+ */
+@Repository
+public interface DeskStatusDao extends JpaRepository<DeskStatus, Long>, JpaSpecificationExecutor<DeskStatus> {
+}

+ 16 - 0
reservation-server/src/main/java/com/uas/reservation/dao/ServiceBookDao.java

@@ -0,0 +1,16 @@
+package com.uas.reservation.dao;
+
+import com.uas.reservation.model.ServiceBook;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 服务预约
+ *
+ * @author sunyj
+ * @since 2018/1/4 8:38
+ */
+@Repository
+public interface ServiceBookDao extends JpaRepository<ServiceBook, Long>, JpaSpecificationExecutor<ServiceBook> {
+}

+ 16 - 0
reservation-server/src/main/java/com/uas/reservation/dao/ServiceManDao.java

@@ -0,0 +1,16 @@
+package com.uas.reservation.dao;
+
+import com.uas.reservation.model.ServiceMan;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 服务人员
+ *
+ * @author sunyj
+ * @since 2018/1/4 8:38
+ */
+@Repository
+public interface ServiceManDao extends JpaRepository<ServiceMan, Long>, JpaSpecificationExecutor<ServiceMan> {
+}

+ 16 - 0
reservation-server/src/main/java/com/uas/reservation/dao/ServiceManDayOffDao.java

@@ -0,0 +1,16 @@
+package com.uas.reservation.dao;
+
+import com.uas.reservation.model.ServiceManDayOff;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 员工休息
+ *
+ * @author sunyj
+ * @since 2018/1/4 8:38
+ */
+@Repository
+public interface ServiceManDayOffDao extends JpaRepository<ServiceManDayOff, Long>, JpaSpecificationExecutor<ServiceManDayOff> {
+}

+ 16 - 0
reservation-server/src/main/java/com/uas/reservation/dao/ServiceTypeDao.java

@@ -0,0 +1,16 @@
+package com.uas.reservation.dao;
+
+import com.uas.reservation.model.ServiceType;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 服务类型
+ *
+ * @author sunyj
+ * @since 2018/1/4 8:38
+ */
+@Repository
+public interface ServiceTypeDao extends JpaRepository<ServiceType, Long>, JpaSpecificationExecutor<ServiceType> {
+}

+ 16 - 0
reservation-server/src/main/java/com/uas/reservation/dao/StoreDeskDao.java

@@ -0,0 +1,16 @@
+package com.uas.reservation.dao;
+
+import com.uas.reservation.model.StoreDesk;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 桌位设置
+ *
+ * @author sunyj
+ * @since 2018/1/4 8:38
+ */
+@Repository
+public interface StoreDeskDao extends JpaRepository<StoreDesk, Long>, JpaSpecificationExecutor<StoreDesk> {
+}

+ 27 - 0
reservation-server/src/main/java/com/uas/reservation/exception/IllegalOperationException.java

@@ -0,0 +1,27 @@
+package com.uas.reservation.exception;
+
+/**
+ * @author sunyj
+ * @since 2018/2/10 11:48
+ */
+public class IllegalOperationException extends Exception {
+
+    public IllegalOperationException() {
+    }
+
+    public IllegalOperationException(String message) {
+        super(message);
+    }
+
+    public IllegalOperationException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public IllegalOperationException(Throwable cause) {
+        super(cause);
+    }
+
+    public IllegalOperationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

+ 27 - 0
reservation-server/src/main/java/com/uas/reservation/exception/IllegalStatusException.java

@@ -0,0 +1,27 @@
+package com.uas.reservation.exception;
+
+/**
+ * @author sunyj
+ * @since 2018/2/10 11:50
+ */
+public class IllegalStatusException extends Exception {
+
+    public IllegalStatusException() {
+    }
+
+    public IllegalStatusException(String message) {
+        super(message);
+    }
+
+    public IllegalStatusException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public IllegalStatusException(Throwable cause) {
+        super(cause);
+    }
+
+    public IllegalStatusException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

+ 27 - 0
reservation-server/src/main/java/com/uas/reservation/exception/NotFoundException.java

@@ -0,0 +1,27 @@
+package com.uas.reservation.exception;
+
+/**
+ * @author sunyj
+ * @since 2018/2/10 11:40
+ */
+public class NotFoundException extends Exception {
+
+    public NotFoundException() {
+    }
+
+    public NotFoundException(String message) {
+        super(message);
+    }
+
+    public NotFoundException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public NotFoundException(Throwable cause) {
+        super(cause);
+    }
+
+    public NotFoundException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

+ 29 - 0
reservation-server/src/main/java/com/uas/reservation/exception/UploadException.java

@@ -0,0 +1,29 @@
+package com.uas.reservation.exception;
+
+/**
+ * 文件上传异常
+ *
+ * @author sunyj
+ * @since 2018/2/10 10:15
+ */
+public class UploadException extends Exception {
+
+    public UploadException() {
+    }
+
+    public UploadException(String message) {
+        super(message);
+    }
+
+    public UploadException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public UploadException(Throwable cause) {
+        super(cause);
+    }
+
+    public UploadException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

+ 42 - 0
reservation-server/src/main/java/com/uas/reservation/helper/UploadHelper.java

@@ -0,0 +1,42 @@
+package com.uas.reservation.helper;
+
+import com.uas.dfs.service.FileClient;
+import com.uas.ps.core.util.Assert;
+import com.uas.reservation.exception.UploadException;
+import com.uas.reservation.util.FileUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * help to upload files
+ *
+ * @author sunyj
+ * @since 2018/2/10 10:13
+ */
+@Component
+public class UploadHelper {
+
+    private final FileClient fileClient;
+
+    @Autowired
+    public UploadHelper(FileClient fileClient) {
+        this.fileClient = fileClient;
+    }
+
+    /**
+     * upload one file
+     *
+     * @param file file to upload
+     * @return remote url
+     * @throws UploadException failed to upload
+     */
+    public String upload(MultipartFile file) throws UploadException {
+        Assert.notNull(file, "file is null");
+        try {
+            return fileClient.upload(file.getBytes(), file.getSize(), FileUtils.getFileType(file.getName()), null);
+        } catch (Exception e) {
+            throw new UploadException("failed to upload file: " + file.getName(), e);
+        }
+    }
+}

+ 41 - 0
reservation-server/src/main/java/com/uas/reservation/intercept/ExceptionHandlerAdvice.java

@@ -0,0 +1,41 @@
+package com.uas.reservation.intercept;
+
+import com.uas.ps.core.util.ExceptionUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+
+/**
+ * 基于Application的异常处理,以AOP的形式注册到 SpringMVC 的处理链
+ *
+ * @author sunyj
+ * @since 2017年7月11日 下午4:58:01
+ */
+@ControllerAdvice
+public class ExceptionHandlerAdvice {
+
+    private static Logger logger = LoggerFactory.getLogger(com.uas.ps.core.intercept.ExceptionHandlerAdvice.class);
+
+    /**
+     * 处理已捕获异常,明确传达给客户端错误码、错误信息
+     *
+     * @param e
+     * @return
+     */
+    @ExceptionHandler(Exception.class)
+    public ResponseEntity<ModelMap> handleError(Exception e) {
+        logger.error("", e);
+        ModelMap map = new ModelMap();
+        map.put("success", false);
+        map.put("message", e.getMessage());
+        map.put("detailedMessage", ExceptionUtils.getDetailedMessage(e));
+        HttpHeaders headers = new HttpHeaders();
+        headers.add("Content-Type", "application/json; charset=utf-8");
+        return new ResponseEntity<>(map, headers, HttpStatus.INTERNAL_SERVER_ERROR);
+    }
+}

+ 114 - 0
reservation-server/src/main/java/com/uas/reservation/model/DeskStatus.java

@@ -0,0 +1,114 @@
+package com.uas.reservation.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+
+/**
+ * 桌位状态表
+ *
+ * @author sunyj
+ * @since 2018/1/3 20:35
+ */
+@Entity
+@Table(name = "app_deskstatus")
+public class DeskStatus implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @Column(name = "ad_id")
+    private Long id;
+
+    /**
+     * 就餐号
+     */
+    @Column(name = "ad_deskcode")
+    private String deskCode;
+
+    /**
+     * 商家UU号
+     */
+    @Column(name = "ad_companyid")
+    private Long componentId;
+
+    /**
+     * 桌位状态(0代表空闲,1代表锁定)
+     */
+    @Column(name = "ad_status")
+    private Long status;
+
+    /**
+     * 桌位类型
+     */
+    @Column(name = "ad_desktype")
+    private String deskType;
+
+    /**
+     * 预约订单号
+     */
+    @Column(name = "ad_bookid")
+    private Long bookId;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getDeskCode() {
+        return deskCode;
+    }
+
+    public void setDeskCode(String deskCode) {
+        this.deskCode = deskCode;
+    }
+
+    public Long getComponentId() {
+        return componentId;
+    }
+
+    public void setComponentId(Long componentId) {
+        this.componentId = componentId;
+    }
+
+    public Long getStatus() {
+        return status;
+    }
+
+    public void setStatus(Long status) {
+        this.status = status;
+    }
+
+    public String getDeskType() {
+        return deskType;
+    }
+
+    public void setDeskType(String deskType) {
+        this.deskType = deskType;
+    }
+
+    public Long getBookId() {
+        return bookId;
+    }
+
+    public void setBookId(Long bookId) {
+        this.bookId = bookId;
+    }
+
+    @Override
+    public String toString() {
+        return "DeskStatus{" +
+                "id=" + id +
+                ", deskCode='" + deskCode + '\'' +
+                ", componentId=" + componentId +
+                ", status=" + status +
+                ", deskType='" + deskType + '\'' +
+                ", bookId=" + bookId +
+                '}';
+    }
+}

+ 355 - 0
reservation-server/src/main/java/com/uas/reservation/model/ServiceBook.java

@@ -0,0 +1,355 @@
+package com.uas.reservation.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 服务预约表
+ *
+ * @author sunyj
+ * @since 2018/1/3 20:35
+ */
+@Entity
+@Table
+public class ServiceBook implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @Column(name = "sb_id")
+    private Long id;
+
+    /**
+     * 商家UU号
+     */
+    @Column(name = "sb_companyid")
+    private Long componentId;
+
+    /**
+     * 商家名称
+     */
+    @Column(name = "sb_companyname")
+    private String componentName;
+
+    /**
+     * 人员APPID
+     */
+    @Column(name = "sb_userid")
+    private String userId;
+
+    /**
+     * 姓名
+     */
+    @Column(name = "sb_username")
+    private Long userName;
+
+    /**
+     * 手机号
+     */
+    @Column(name = "sb_telephone")
+    private String telephone;
+
+    /**
+     * 服务项目ID
+     */
+    @Column(name = "sb_stid")
+    private Long stId;
+
+    /**
+     * 项目名称
+     */
+    @Column(name = "sb_stname")
+    private String stName;
+
+    /**
+     * 房间ID
+     */
+    @Column(name = "sb_spid")
+    private Long spId;
+
+    /**
+     * 房间名称
+     */
+    @Column(name = "sb_spname")
+    private String spName;
+
+    /**
+     * 开始时间
+     */
+    @Column(name = "sb_starttime")
+    private Date startTime;
+
+    /**
+     * 结束时间
+     */
+    @Column(name = "sb_endtime")
+    private Date endTime;
+
+    /**
+     * 预约人APPID
+     */
+    @Column(name = "sb_recordid")
+    private Long recordId;
+
+    /**
+     * 姓名
+     */
+    @Column(name = "sb_recordor")
+    private String recordor;
+
+    /**
+     * 备注
+     */
+    @Column(name = "sb_remark")
+    private String remark;
+
+    /**
+     * 预约状态
+     */
+    @Column(name = "sb_status")
+    private String status;
+
+    /**
+     * 预约时间
+     */
+    @Column(name = "sb_recorddate")
+    private Date recordDate;
+
+    /**
+     * 人数
+     */
+    @Column(name = "sb_person")
+    private String person;
+
+    /**
+     * 商家地址
+     */
+    @Column(name = "sb_address")
+    private String address;
+
+    /**
+     * 商家行业
+     */
+    @Column(name = "sb_industry")
+    private String industry;
+
+    /**
+     * 餐饮商家预约类型
+     */
+    @Column(name = "sb_cytpe")
+    private String cyType;
+
+    /**
+     * 性别(0代表女1代表男)
+     */
+    @Column(name = "sb_sex")
+    private Short sex;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getComponentId() {
+        return componentId;
+    }
+
+    public void setComponentId(Long componentId) {
+        this.componentId = componentId;
+    }
+
+    public String getComponentName() {
+        return componentName;
+    }
+
+    public void setComponentName(String componentName) {
+        this.componentName = componentName;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public Long getUserName() {
+        return userName;
+    }
+
+    public void setUserName(Long userName) {
+        this.userName = userName;
+    }
+
+    public String getTelephone() {
+        return telephone;
+    }
+
+    public void setTelephone(String telephone) {
+        this.telephone = telephone;
+    }
+
+    public Long getStId() {
+        return stId;
+    }
+
+    public void setStId(Long stId) {
+        this.stId = stId;
+    }
+
+    public String getStName() {
+        return stName;
+    }
+
+    public void setStName(String stName) {
+        this.stName = stName;
+    }
+
+    public Long getSpId() {
+        return spId;
+    }
+
+    public void setSpId(Long spId) {
+        this.spId = spId;
+    }
+
+    public String getSpName() {
+        return spName;
+    }
+
+    public void setSpName(String spName) {
+        this.spName = spName;
+    }
+
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
+    public Long getRecordId() {
+        return recordId;
+    }
+
+    public void setRecordId(Long recordId) {
+        this.recordId = recordId;
+    }
+
+    public String getRecordor() {
+        return recordor;
+    }
+
+    public void setRecordor(String recordor) {
+        this.recordor = recordor;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public Date getRecordDate() {
+        return recordDate;
+    }
+
+    public void setRecordDate(Date recordDate) {
+        this.recordDate = recordDate;
+    }
+
+    public String getPerson() {
+        return person;
+    }
+
+    public void setPerson(String person) {
+        this.person = person;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public String getIndustry() {
+        return industry;
+    }
+
+    public void setIndustry(String industry) {
+        this.industry = industry;
+    }
+
+    public String getCyType() {
+        return cyType;
+    }
+
+    public void setCyType(String cyType) {
+        this.cyType = cyType;
+    }
+
+    public Short getSex() {
+        return sex;
+    }
+
+    public void setSex(Short sex) {
+        this.sex = sex;
+    }
+
+    @Override
+    public String toString() {
+        return "ServiceBook{" +
+                "id=" + id +
+                ", componentId=" + componentId +
+                ", componentName='" + componentName + '\'' +
+                ", userId='" + userId + '\'' +
+                ", userName=" + userName +
+                ", telephone='" + telephone + '\'' +
+                ", stId=" + stId +
+                ", stName='" + stName + '\'' +
+                ", spId=" + spId +
+                ", spName='" + spName + '\'' +
+                ", startTime=" + startTime +
+                ", endTime=" + endTime +
+                ", recordId=" + recordId +
+                ", recordor='" + recordor + '\'' +
+                ", remark='" + remark + '\'' +
+                ", status='" + status + '\'' +
+                ", recordDate=" + recordDate +
+                ", person='" + person + '\'' +
+                ", address='" + address + '\'' +
+                ", industry='" + industry + '\'' +
+                ", cyType='" + cyType + '\'' +
+                ", sex=" + sex +
+                '}';
+    }
+}

+ 186 - 0
reservation-server/src/main/java/com/uas/reservation/model/ServiceMan.java

@@ -0,0 +1,186 @@
+package com.uas.reservation.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+
+/**
+ * 服务人员表
+ *
+ * @author sunyj
+ * @since 2018/1/3 20:26
+ */
+@Entity
+@Table
+public class ServiceMan implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @Column(name = "sm_id")
+    private Long id;
+
+    /**
+     * 服务项目ID
+     */
+    @Column(name = "sm_stid")
+    private Long stId;
+
+    /**
+     * 项目名称
+     */
+    @Column(name = "sm_stname")
+    private String stName;
+
+    /**
+     * 员工 APPID
+     */
+    @Column(name = "sm_userid")
+    private Long userId;
+
+    /**
+     * 员工姓名
+     */
+    @Column(name = "sm_username")
+    private String userName;
+
+    /**
+     * 商家UU号
+     */
+    @Column(name = "sm_companyid")
+    private Long componentId;
+
+    /**
+     * 商家名称
+     */
+    @Column(name = "sm_companyname")
+    private String componentName;
+
+    /**
+     * 人员职位/等级
+     */
+    @Column(name = "sm_level")
+    private String level;
+
+    /**
+     * 电话号码
+     */
+    @Column(name = "sm_telephone")
+    private String telephone;
+
+    /**
+     * 性别
+     */
+    @Column(name = "sm_sex")
+    private String sex;
+
+    @Column(name = "sm_email")
+    private String email;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getStId() {
+        return stId;
+    }
+
+    public void setStId(Long stId) {
+        this.stId = stId;
+    }
+
+    public String getStName() {
+        return stName;
+    }
+
+    public void setStName(String stName) {
+        this.stName = stName;
+    }
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public Long getComponentId() {
+        return componentId;
+    }
+
+    public void setComponentId(Long componentId) {
+        this.componentId = componentId;
+    }
+
+    public String getComponentName() {
+        return componentName;
+    }
+
+    public void setComponentName(String componentName) {
+        this.componentName = componentName;
+    }
+
+    public String getLevel() {
+        return level;
+    }
+
+    public void setLevel(String level) {
+        this.level = level;
+    }
+
+    public String getTelephone() {
+        return telephone;
+    }
+
+    public void setTelephone(String telephone) {
+        this.telephone = telephone;
+    }
+
+    public String getSex() {
+        return sex;
+    }
+
+    public void setSex(String sex) {
+        this.sex = sex;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    @Override
+    public String toString() {
+        return "ServiceMan{" +
+                "id=" + id +
+                ", stId=" + stId +
+                ", stName='" + stName + '\'' +
+                ", userId=" + userId +
+                ", userName='" + userName + '\'' +
+                ", componentId=" + componentId +
+                ", componentName='" + componentName + '\'' +
+                ", level='" + level + '\'' +
+                ", telephone='" + telephone + '\'' +
+                ", sex='" + sex + '\'' +
+                ", email='" + email + '\'' +
+                '}';
+    }
+}

+ 115 - 0
reservation-server/src/main/java/com/uas/reservation/model/ServiceManDayOff.java

@@ -0,0 +1,115 @@
+package com.uas.reservation.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 员工休息表
+ *
+ * @author sunyj
+ * @since 2018/1/3 20:26
+ */
+@Entity
+@Table(name = "ServicemanDayoff")
+public class ServiceManDayOff implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @Column(name = "sf_id")
+    private Long id;
+
+    /**
+     * 员工 APPID
+     */
+    @Column(name = "sf_userid")
+    private Long userId;
+
+    /**
+     * 员工姓名
+     */
+    @Column(name = "sf_username")
+    private String userName;
+
+    /**
+     * 商家UU号
+     */
+    @Column(name = "sf_companyid")
+    private Long componentId;
+
+    /**
+     * 商家名称
+     */
+    @Column(name = "sf_companyname")
+    private String componentName;
+
+    /**
+     * 休息日
+     */
+    @Column(name = "sf_date")
+    private Date date;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public Long getComponentId() {
+        return componentId;
+    }
+
+    public void setComponentId(Long componentId) {
+        this.componentId = componentId;
+    }
+
+    public String getComponentName() {
+        return componentName;
+    }
+
+    public void setComponentName(String componentName) {
+        this.componentName = componentName;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    @Override
+    public String toString() {
+        return "ServiceManDayOff{" +
+                "id=" + id +
+                ", userId=" + userId +
+                ", userName='" + userName + '\'' +
+                ", componentId=" + componentId +
+                ", componentName='" + componentName + '\'' +
+                ", date=" + date +
+                '}';
+    }
+}

+ 144 - 0
reservation-server/src/main/java/com/uas/reservation/model/ServiceType.java

@@ -0,0 +1,144 @@
+package com.uas.reservation.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+
+/**
+ * 服务类型表
+ *
+ * @author sunyj
+ * @since 2018/1/3 20:32
+ */
+@Entity
+@Table
+public class ServiceType implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @Column(name = "st_id")
+    private Long id;
+
+    /**
+     * 服务名称/房间名称/场地名称
+     */
+    @Column(name = "st_name")
+    private String name;
+
+    /**
+     * 行业代码
+     */
+    @Column(name = "st_siid")
+    private Long siId;
+
+    /**
+     * 商家UU号
+     */
+    @Column(name = "st_companyid")
+    private Long componentId;
+
+    /**
+     * 商家名称
+     */
+    @Column(name = "st_companyname")
+    private String componentName;
+
+    /**
+     * 服务分钟数
+     */
+    @Column(name = "st_servicetime")
+    private Long serviceTime;
+
+    /**
+     * 服务名称/房间名称/场地名称照片
+     */
+    @Column(name = "st_imageurl")
+    private String imageUrl;
+
+    /**
+     * 价格
+     */
+    @Column(name = "st_price")
+    private Double price;
+
+    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 Long getSiId() {
+        return siId;
+    }
+
+    public void setSiId(Long siId) {
+        this.siId = siId;
+    }
+
+    public Long getComponentId() {
+        return componentId;
+    }
+
+    public void setComponentId(Long componentId) {
+        this.componentId = componentId;
+    }
+
+    public String getComponentName() {
+        return componentName;
+    }
+
+    public void setComponentName(String componentName) {
+        this.componentName = componentName;
+    }
+
+    public Long getServiceTime() {
+        return serviceTime;
+    }
+
+    public void setServiceTime(Long serviceTime) {
+        this.serviceTime = serviceTime;
+    }
+
+    public String getImageUrl() {
+        return imageUrl;
+    }
+
+    public void setImageUrl(String imageUrl) {
+        this.imageUrl = imageUrl;
+    }
+
+    public Double getPrice() {
+        return price;
+    }
+
+    public void setPrice(Double price) {
+        this.price = price;
+    }
+
+    @Override
+    public String toString() {
+        return "ServiceType{" +
+                "id=" + id +
+                ", name='" + name + '\'' +
+                ", siId=" + siId +
+                ", componentId=" + componentId +
+                ", componentName='" + componentName + '\'' +
+                ", serviceTime=" + serviceTime +
+                ", imageUrl='" + imageUrl + '\'' +
+                ", price=" + price +
+                '}';
+    }
+}

+ 144 - 0
reservation-server/src/main/java/com/uas/reservation/model/StoreDesk.java

@@ -0,0 +1,144 @@
+package com.uas.reservation.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+
+/**
+ * 桌位设置表
+ *
+ * @author sunyj
+ * @since 2018/1/3 20:35
+ */
+@Entity
+@Table(name = "app_storedesk")
+public class StoreDesk implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @Column(name = "as_id")
+    private Long id;
+
+    /**
+     * 桌位类型
+     */
+    @Column(name = "as_type")
+    private String type;
+
+    /**
+     * 桌位代码
+     */
+    @Column(name = "as_deskcode")
+    private String deskCode;
+
+    /**
+     * 桌位数
+     */
+    @Column(name = "as_number")
+    private Long number;
+
+    /**
+     * 可预约桌数
+     */
+    @Column(name = "as_booknumber")
+    private Long bookNumber;
+
+    /**
+     * 备注
+     */
+    @Column(name = "as_remark")
+    private String remark;
+
+    /**
+     * 商家UU号
+     */
+    @Column(name = "as_companyid")
+    private Long componentId;
+
+    /**
+     * 桌位人数
+     */
+    @Column(name = "as_maxperson")
+    private Long maxPerson;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getDeskCode() {
+        return deskCode;
+    }
+
+    public void setDeskCode(String deskCode) {
+        this.deskCode = deskCode;
+    }
+
+    public Long getNumber() {
+        return number;
+    }
+
+    public void setNumber(Long number) {
+        this.number = number;
+    }
+
+    public Long getBookNumber() {
+        return bookNumber;
+    }
+
+    public void setBookNumber(Long bookNumber) {
+        this.bookNumber = bookNumber;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public Long getComponentId() {
+        return componentId;
+    }
+
+    public void setComponentId(Long componentId) {
+        this.componentId = componentId;
+    }
+
+    public Long getMaxPerson() {
+        return maxPerson;
+    }
+
+    public void setMaxPerson(Long maxPerson) {
+        this.maxPerson = maxPerson;
+    }
+
+    @Override
+    public String toString() {
+        return "StoreDesk{" +
+                "id=" + id +
+                ", type='" + type + '\'' +
+                ", deskCode='" + deskCode + '\'' +
+                ", number=" + number +
+                ", bookNumber=" + bookNumber +
+                ", remark='" + remark + '\'' +
+                ", componentId=" + componentId +
+                ", maxPerson=" + maxPerson +
+                '}';
+    }
+}

+ 28 - 0
reservation-server/src/main/java/com/uas/reservation/sso/ResultWrap.java

@@ -0,0 +1,28 @@
+package com.uas.reservation.sso;
+
+/**
+ * @author sunyj
+ * @since 2018/3/12 17:23
+ */
+public class ResultWrap<T> {
+
+    private boolean success;
+
+    private T content;
+
+    public boolean isSuccess() {
+        return success;
+    }
+
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+    public T getContent() {
+        return content;
+    }
+
+    public void setContent(T content) {
+        this.content = content;
+    }
+}

+ 36 - 0
reservation-server/src/main/java/com/uas/reservation/sso/api/UserController.java

@@ -0,0 +1,36 @@
+package com.uas.reservation.sso.api;
+
+import com.uas.account.sso.integration.entity.UserView;
+import com.uas.account.sso.integration.util.SSO;
+import com.uas.ps.core.util.ObjectUtils;
+import com.uas.ps.httplog.annotation.HttpLog;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.io.IOException;
+
+/**
+ * 用户
+ *
+ * @author sunyj
+ * @since 2018/3/12 16:02
+ */
+@RestController
+@RequestMapping("/user")
+public class UserController {
+
+    /**
+     * 获取用户信息
+     *
+     * @throws IOException
+     * @throws ClassNotFoundException
+     */
+    @HttpLog
+    @GetMapping("/get")
+    public UserView getUser() throws IOException, ClassNotFoundException {
+        UserView user = ObjectUtils.clone(SSO.get());
+        user.setPassword(null);
+        return user;
+    }
+}

+ 45 - 0
reservation-server/src/main/java/com/uas/reservation/sso/api/UserSpaceController.java

@@ -0,0 +1,45 @@
+package com.uas.reservation.sso.api;
+
+import com.uas.account.sso.integration.entity.UserSpaceView;
+import com.uas.account.sso.integration.entity.UserView;
+import com.uas.account.sso.integration.util.SSO;
+import com.uas.ps.core.util.ObjectUtils;
+import com.uas.ps.httplog.annotation.HttpLog;
+import com.uas.reservation.sso.service.UserSpaceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.io.IOException;
+
+/**
+ * 企业
+ *
+ * @author sunyj
+ * @since 2018/3/12 16:02
+ */
+@RestController
+@RequestMapping("/userspace")
+public class UserSpaceController {
+
+    private final UserSpaceService userSpaceService;
+
+    @Autowired
+    public UserSpaceController(UserSpaceService userSpaceService) {
+        this.userSpaceService = userSpaceService;
+    }
+
+    /**
+     * 获取企业信息
+     *
+     * @throws IOException
+     * @throws ClassNotFoundException
+     */
+    @HttpLog
+    @GetMapping("/get")
+    public UserSpaceView getUserSpace() throws IOException, ClassNotFoundException {
+        UserView user = ObjectUtils.clone(SSO.get());
+        return userSpaceService.getUserSpace(user.getSpaceName());
+    }
+}

+ 20 - 0
reservation-server/src/main/java/com/uas/reservation/sso/service/UserSpaceService.java

@@ -0,0 +1,20 @@
+package com.uas.reservation.sso.service;
+
+import com.uas.account.sso.integration.entity.UserSpaceView;
+
+/**
+ * 企业
+ *
+ * @author sunyj
+ * @since 2018/3/12 16:55
+ */
+public interface UserSpaceService {
+
+    /**
+     * 获取企业信息
+     *
+     * @param spaceName 企业名称
+     * @return 企业信息
+     */
+    UserSpaceView getUserSpace(String spaceName);
+}

+ 41 - 0
reservation-server/src/main/java/com/uas/reservation/sso/service/impl/UserSpaceServiceImpl.java

@@ -0,0 +1,41 @@
+package com.uas.reservation.sso.service.impl;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.uas.account.sso.integration.config.api.SSOApiProperties;
+import com.uas.account.sso.integration.entity.UserSpaceView;
+import com.uas.reservation.sso.ResultWrap;
+import com.uas.reservation.sso.service.UserSpaceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * 企业
+ *
+ * @author sunyj
+ * @since 2018/3/12 16:59
+ */
+@Service
+public class UserSpaceServiceImpl implements UserSpaceService {
+
+    private RestTemplate restTemplate = new RestTemplate();
+
+    private ObjectMapper mapper = new ObjectMapper();
+
+    @Autowired
+    private SSOApiProperties ssoApiProperties;
+
+    @Override
+    public UserSpaceView getUserSpace(String spaceName) {
+        try {
+            String returnStr = restTemplate.getForObject(ssoApiProperties.getGetUserspace(), String.class, spaceName);
+            ResultWrap<UserSpaceView> result = mapper.readValue(returnStr, new TypeReference<ResultWrap<UserSpaceView>>() {
+            });
+            return result.getContent();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+}

+ 41 - 0
reservation-server/src/main/resources/application.yml

@@ -0,0 +1,41 @@
+spring:
+ jpa:
+  properties:
+   hibernate:
+    hbm2ddl:
+     auto: update
+  hibernate:
+    naming:
+      physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
+ http:
+  encoding:
+   force: true
+  multipart:
+   enabled: true
+   max-file-size: 512MB
+   max-request-size: 512MB
+
+security:
+ basic:
+  enabled: true
+  path: /console
+ user:
+  name: admin
+  password: select111***
+  role: ADMIN
+ ignored: false
+
+zk:
+ url: zookeeper://10.10.100.11:2181
+
+# SSO
+sso:
+ app: reservation
+ token:
+  cookieName: uid
+  secretKey: 0taQcW073Z7G628g5H
+ api:
+  # 获取企业信息
+  getUserspace: https://account.ubtob.com/api/userspace/detail/info?name={name}
+  # 获取用户全部账户
+  getAccounts: https://account.ubtob.com/api/user/all?mobile={mobile}

+ 19 - 0
reservation-server/src/main/resources/config/application-dev.properties

@@ -0,0 +1,19 @@
+datasource.url=jdbc:mysql://10.10.100.18:3306/mobileapp?characterEncoding=utf-8
+datasource.username=imapi
+datasource.password=li1026
+datasource.driverClassName=com.mysql.jdbc.Driver
+datasource.initialSize=1
+datasource.minIdle=1
+datasource.maxActive=20
+datasource.maxWait=60000
+datasource.timeBetweenEvictionRunsMillis=60000
+datasource.minEvictableIdleTimeMillis=300000
+datasource.validationQuery=SELECT 1 FROM DUAL
+datasource.testWhileIdle=true
+datasource.testOnBorrow=true
+datasource.testOnReturn=false
+datasource.poolPreparedStatements=true
+datasource.timeBetweenLogStatsMillis=60000
+datasource.maxPoolPreparedStatementPerConnectionSize=20
+datasource.filters=stat,slf4j
+datasource.connectionProperties=druid.stat.mergeSql=false;druid.stat.slowSqlMillis=5000

+ 14 - 0
reservation-server/src/main/resources/dubbo.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+	http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
+
+    <dubbo:application name="reservation_consumer"/>
+
+    <dubbo:registry address="${zk.url}" check="false"/>
+
+    <!-- 分布式文件服务 -->
+    <dubbo:reference id="fileClient" interface="com.uas.dfs.service.FileClient" timeout="100000"/>
+
+</beans>

+ 44 - 0
reservation-server/src/main/resources/logback.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+	<appender name="FILE"
+		class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<File>logs/log.log</File>
+		<encoder>
+			<pattern>
+				%date{yyyy-MM-dd HH:mm:ss:SSS} [%relative ms] %-5level [%50.50(%logger{36}.%method:%line)] ---- %msg%n
+			</pattern>
+			<charset>UTF-8</charset> <!-- 此处设置字符集 -->
+		</encoder>
+		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+			<!-- daily rollover -->
+			<FileNamePattern>logs/log.%d{yyyy-MM-dd}.log</FileNamePattern>
+			<!-- keep 10 days' worth of history -->
+			<maxHistory>10</maxHistory>
+		</rollingPolicy>
+		<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+			<level>INFO</level>
+		</filter>
+	</appender>
+
+	<!-- Console output -->
+	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+		<!-- encoder defaults to ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
+		<encoder>
+			<pattern>
+				%date{yyyy-MM-dd HH:mm:ss:SSS} [%relative ms] %-5level [%50.50(%logger{36}.%method:%line)] ---- %msg%n
+			</pattern>
+			<charset>UTF-8</charset> <!-- 此处设置字符集 -->
+		</encoder>
+		<!-- Only log level WARN and above -->
+		<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+			<level>INFO</level>
+		</filter>
+	</appender>
+
+	<!-- Enable FILE and STDOUT appenders for all log messages. By default, 
+		only log at level INFO and above. -->
+	<root level="INFO">
+		<appender-ref ref="FILE" />
+		<appender-ref ref="STDOUT" />
+	</root>
+</configuration>

+ 13 - 0
reservation-server/src/main/webapp/WEB-INF/views/index.html

@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="UTF-8">
+    <title>Reservation Server</title>
+    <link rel="stylesheet" href="static/css/index.css">
+</head>
+<body>
+<p>Reservation Home</p>
+</body>
+<script src="static/lib/jquery/jquery.min.js"></script>
+<script src="static/js/index/app.js"></script>
+</html>

+ 3 - 0
reservation-server/src/main/webapp/resources/css/index.css

@@ -0,0 +1,3 @@
+body {
+	font-family: courier;
+}

+ 1 - 0
reservation-server/src/main/webapp/resources/js/index/app.js

@@ -0,0 +1 @@
+console.log("1243");

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 0
reservation-server/src/main/webapp/resources/lib/jquery/jquery.min.js


Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov