Browse Source

初始化

jz.kai 3 years ago
parent
commit
5bbfc5602e
100 changed files with 9530 additions and 0 deletions
  1. 31 0
      .gitignore
  2. 217 0
      common/pom.xml
  3. 13 0
      common/src/main/java/com/jpsoft/order/config/BaiduConfig.java
  4. 17 0
      common/src/main/java/com/jpsoft/order/config/OSSConfig.java
  5. 30 0
      common/src/main/java/com/jpsoft/order/config/WechatConfig.java
  6. 50 0
      common/src/main/java/com/jpsoft/order/modules/common/dto/MessageResult.java
  7. 19 0
      common/src/main/java/com/jpsoft/order/modules/common/dto/QueryListDTO.java
  8. 32 0
      common/src/main/java/com/jpsoft/order/modules/common/dto/Sort.java
  9. 21 0
      common/src/main/java/com/jpsoft/order/modules/common/service/BaseService.java
  10. 105 0
      common/src/main/java/com/jpsoft/order/modules/common/service/IRedisService.java
  11. 37 0
      common/src/main/java/com/jpsoft/order/modules/common/service/impl/RedisServiceImpl.java
  12. 130 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/AESUtil.java
  13. 95 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/BASE64DecodedMultipartFile.java
  14. 106 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/BaiduOCR.java
  15. 273 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/Base64.java
  16. 198 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/CheckIdCard.java
  17. 76 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/DES3.java
  18. 72 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/FileUtil.java
  19. 135 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/Generator/AbstractCaptchaA.java
  20. 29 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/Generator/AbstractGeneratorA.java
  21. 39 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/Generator/CaptchaUtilA.java
  22. 55 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/Generator/CircleCaptchaA.java
  23. 31 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/Generator/RandomGeneratorA.java
  24. 387 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/HttpConnectionUtil.java
  25. 130 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/HttpUtil.java
  26. 24 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/MyX509TrustManager.java
  27. 501 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/OSSUtil.java
  28. 428 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/POIUtils.java
  29. 84 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/PojoUtils.java
  30. 155 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/SMSUtil.java
  31. 70 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/Sign.java
  32. 161 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/StringUtils.java
  33. 93 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/TimeZonesUtil.java
  34. 218 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/WechatMessageUtil.java
  35. 327 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/WeixinUtil.java
  36. 60 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/enterprise/AesException.java
  37. 26 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/enterprise/ByteGroup.java
  38. 67 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/enterprise/PKCS7Encoder.java
  39. 61 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/enterprise/SHA1.java
  40. 291 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/enterprise/WXBizMsgCrypt.java
  41. 72 0
      common/src/main/java/com/jpsoft/order/modules/common/utils/enterprise/XMLParse.java
  42. 32 0
      common/src/main/java/com/jpsoft/order/modules/sys/dao/DataDictionaryDAO.java
  43. 21 0
      common/src/main/java/com/jpsoft/order/modules/sys/dao/MenuDAO.java
  44. 21 0
      common/src/main/java/com/jpsoft/order/modules/sys/dao/PermissionDAO.java
  45. 18 0
      common/src/main/java/com/jpsoft/order/modules/sys/dao/RoleDAO.java
  46. 22 0
      common/src/main/java/com/jpsoft/order/modules/sys/dao/RoleMenuDAO.java
  47. 20 0
      common/src/main/java/com/jpsoft/order/modules/sys/dao/RolePermissionDAO.java
  48. 19 0
      common/src/main/java/com/jpsoft/order/modules/sys/dao/SysLogDAO.java
  49. 22 0
      common/src/main/java/com/jpsoft/order/modules/sys/dao/UserDAO.java
  50. 24 0
      common/src/main/java/com/jpsoft/order/modules/sys/dao/UserRoleDAO.java
  51. 24 0
      common/src/main/java/com/jpsoft/order/modules/sys/dto/RoleRelatedDTO.java
  52. 37 0
      common/src/main/java/com/jpsoft/order/modules/sys/entity/DataDictionary.java
  53. 199 0
      common/src/main/java/com/jpsoft/order/modules/sys/entity/Menu.java
  54. 142 0
      common/src/main/java/com/jpsoft/order/modules/sys/entity/Permission.java
  55. 129 0
      common/src/main/java/com/jpsoft/order/modules/sys/entity/Role.java
  56. 129 0
      common/src/main/java/com/jpsoft/order/modules/sys/entity/RoleMenu.java
  57. 129 0
      common/src/main/java/com/jpsoft/order/modules/sys/entity/RolePermission.java
  58. 37 0
      common/src/main/java/com/jpsoft/order/modules/sys/entity/SysLog.java
  59. 36 0
      common/src/main/java/com/jpsoft/order/modules/sys/entity/User.java
  60. 129 0
      common/src/main/java/com/jpsoft/order/modules/sys/entity/UserRole.java
  61. 27 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/DataDictionaryService.java
  62. 21 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/MenuService.java
  63. 19 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/PermissionService.java
  64. 19 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/RoleMenuService.java
  65. 21 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/RolePermissionService.java
  66. 17 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/RoleService.java
  67. 18 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/SysLogService.java
  68. 23 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/UserRoleService.java
  69. 19 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/UserService.java
  70. 118 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/impl/DataDictionaryServiceImpl.java
  71. 83 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/impl/MenuServiceImpl.java
  72. 74 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/impl/PermissionServiceImpl.java
  73. 79 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/impl/RoleMenuServiceImpl.java
  74. 79 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/impl/RolePermissionServiceImpl.java
  75. 69 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/impl/RoleServiceImpl.java
  76. 70 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/impl/SysLogServiceImpl.java
  77. 91 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/impl/UserRoleServiceImpl.java
  78. 81 0
      common/src/main/java/com/jpsoft/order/modules/sys/service/impl/UserServiceImpl.java
  79. 29 0
      common/src/main/java/com/jpsoft/order/modules/wechat/entity/AccessToken.java
  80. 20 0
      common/src/main/java/com/jpsoft/order/modules/wechat/vo/UserInfo.java
  81. 213 0
      common/src/main/resources/mapper/sys/DataDictionary.xml
  82. 143 0
      common/src/main/resources/mapper/sys/Menu.xml
  83. 108 0
      common/src/main/resources/mapper/sys/Permission.xml
  84. 93 0
      common/src/main/resources/mapper/sys/Role.xml
  85. 97 0
      common/src/main/resources/mapper/sys/RoleMenu.xml
  86. 96 0
      common/src/main/resources/mapper/sys/RolePermission.xml
  87. 111 0
      common/src/main/resources/mapper/sys/SysLog.xml
  88. 112 0
      common/src/main/resources/mapper/sys/User.xml
  89. 117 0
      common/src/main/resources/mapper/sys/UserRole.xml
  90. 0 0
      loggerPath_IS_UNDEFINED/logfile.log
  91. 310 0
      mvnw
  92. 182 0
      mvnw.cmd
  93. 87 0
      pom.xml
  94. 33 0
      web/.gitignore
  95. 186 0
      web/pom.xml
  96. 25 0
      web/src/main/java/com/jpsoft/order/OrderServerApplication.java
  97. 59 0
      web/src/main/java/com/jpsoft/order/advice/GlobalExceptionHandler.java
  98. 166 0
      web/src/main/java/com/jpsoft/order/advice/PermissionAdvice.java
  99. 187 0
      web/src/main/java/com/jpsoft/order/config/RedisConfig.java
  100. 72 0
      web/src/main/java/com/jpsoft/order/config/SwaggerConfig.java

+ 31 - 0
.gitignore

@@ -0,0 +1,31 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**
+!**/src/test/**
+.mvn
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+
+### VS Code ###
+.vscode/

+ 217 - 0
common/pom.xml

@@ -0,0 +1,217 @@
+<?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">
+    <parent>
+        <artifactId>order-server</artifactId>
+        <groupId>com.jpsoft.order</groupId>
+        <version>1.0.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>common</artifactId>
+    <name>common</name>
+    <description>开发区网上入学系统公共库</description>
+    <packaging>jar</packaging>
+    <properties>
+        <swagger2.version>2.7.0</swagger2.version>
+        <jwts.version>0.10.5</jwts.version>
+        <netty-all.version>4.1.6.Final</netty-all.version>
+        <fastjson.version>1.2.29</fastjson.version>
+        <alipay.version>4.8.10.ALL</alipay.version>
+        <ijpay.version>2.3.2</ijpay.version>
+        <poi.version>4.1.0</poi.version>
+    </properties>
+    <dependencies>
+
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+            <version>1.9</version>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+            <version>${poi.version}</version>
+            <scope>compile</scope>
+            <exclusions>
+                <exclusion>
+                    <artifactId>commons-codec</artifactId>
+                    <groupId>commons-codec</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-scratchpad</artifactId>
+            <version>${poi.version}</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>${poi.version}</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml-schemas</artifactId>
+            <version>${poi.version}</version>
+            <!--  <scope>compile</scope>-->
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+            <version>${swagger2.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger-ui</artifactId>
+            <version>${swagger2.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-all</artifactId>
+            <version>${netty-all.version}</version>
+        </dependency>
+        <!--json start-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>${fastjson.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>net.sf.json-lib</groupId>
+            <artifactId>json-lib</artifactId>
+            <version>2.4</version>
+            <type>jar</type>
+            <classifier>jdk15</classifier>
+        </dependency>
+        <!--json end-->
+
+        <dependency>
+            <groupId>com.github.dozermapper</groupId>
+            <artifactId>dozer-core</artifactId>
+            <version>6.4.1</version>
+        </dependency>
+
+        <!-- 数据库相关 start-->
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>2.0.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <version>LATEST</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.1.10</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <!-- 数据库相关 end-->
+
+        <!--短信相关 start-->
+        <dependency>
+            <groupId>com.taobao</groupId>
+            <artifactId>taobao-sdk-java</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+        <!--短信相关 end-->
+
+
+        <!-- aliyun oss start -->
+        <dependency>
+            <groupId>com.aliyun.oss</groupId>
+            <artifactId>aliyun-sdk-oss</artifactId>
+            <version>3.1.0</version>
+        </dependency>
+        <!-- aliyun oss end -->
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <version>3.1.0</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>joda-time</groupId>
+            <artifactId>joda-time</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.binarywang</groupId>
+            <artifactId>weixin-java-cp</artifactId>
+            <version>3.7.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.bouncycastle</groupId>
+            <artifactId>bcprov-jdk16</artifactId>
+            <version>1.46</version>
+        </dependency>
+
+        <!--rabbmitmq-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-amqp</artifactId>
+        </dependency>
+
+        <!-- hibernate validator-->
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-validator</artifactId>
+            <version>5.2.0.Final</version>
+        </dependency>
+    </dependencies>
+
+</project>

+ 13 - 0
common/src/main/java/com/jpsoft/order/config/BaiduConfig.java

@@ -0,0 +1,13 @@
+package com.jpsoft.order.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Component
+@ConfigurationProperties(prefix = "baidu")
+@Data
+public class BaiduConfig {
+    private String ak;
+    private String sk;
+}

+ 17 - 0
common/src/main/java/com/jpsoft/order/config/OSSConfig.java

@@ -0,0 +1,17 @@
+package com.jpsoft.order.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Component
+@ConfigurationProperties(prefix = "oss")
+@Data
+public class OSSConfig {
+    private String accessKeyId;
+    private String accessKeySecret;
+    private String endpoint;
+    private String bucketName;
+    private String urlPrefix;
+    private String objectPre;
+}

+ 30 - 0
common/src/main/java/com/jpsoft/order/config/WechatConfig.java

@@ -0,0 +1,30 @@
+package com.jpsoft.order.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Data
+@ConfigurationProperties(prefix = "wechat")
+@Component
+public class WechatConfig {
+    /**
+     * 设置微信公众号或者小程序等的appid
+     */
+    private String appId;
+
+    /**
+     * 设置微信公众号或者小程序等的appSecret
+     */
+    private String appSecret;
+
+    /**
+     * 获取通用token地址
+     */
+    private String tokenUrl;
+
+    /**
+     * 退回通知模板编号
+     */
+    private String backNoticeTemplateId;
+}

+ 50 - 0
common/src/main/java/com/jpsoft/order/modules/common/dto/MessageResult.java

@@ -0,0 +1,50 @@
+package com.jpsoft.order.modules.common.dto;
+
+public class MessageResult<T> {
+	private boolean result;
+	private String message;
+	private T data;
+	private int code = 200;
+
+	public MessageResult() {
+	}
+
+	public MessageResult(boolean result, String message, T data, int code) {
+		this.result = result;
+		this.message = message;
+		this.data = data;
+		this.code = code;
+	}
+
+	public boolean isResult() {
+		return result;
+	}
+
+	public void setResult(boolean result) {
+		this.result = result;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+
+	public void setMessage(String message) {
+		this.message = message;
+	}
+
+	public T getData() {
+		return data;
+	}
+
+	public void setData(T data) {
+		this.data = data;
+	}
+
+	public int getCode() {
+		return code;
+	}
+
+	public void setCode(int code) {
+		this.code = code;
+	}
+}

+ 19 - 0
common/src/main/java/com/jpsoft/order/modules/common/dto/QueryListDTO.java

@@ -0,0 +1,19 @@
+package com.jpsoft.order.modules.common.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+  描述:base_commodity的实体类
+ */
+@Data
+@ApiModel(value = "下拉菜单的实体类")
+public class QueryListDTO {
+    @ApiModelProperty(value = "编号")
+    private String id;
+    @ApiModelProperty(value = "名称")
+    private String name;
+    @ApiModelProperty(value = "父级")
+    private String parentId;
+}

+ 32 - 0
common/src/main/java/com/jpsoft/order/modules/common/dto/Sort.java

@@ -0,0 +1,32 @@
+package com.jpsoft.order.modules.common.dto;
+
+import java.io.Serializable;
+
+public class Sort implements Serializable {
+    private String name;
+    private String order;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getOrder() {
+        return order;
+    }
+
+    public void setOrder(String order) {
+        this.order = order;
+    }
+
+    public Sort() {
+    }
+
+    public Sort(String name, String order) {
+        this.name = name;
+        this.order = order;
+    }
+}

+ 21 - 0
common/src/main/java/com/jpsoft/order/modules/common/service/BaseService.java

@@ -0,0 +1,21 @@
+package com.jpsoft.order.modules.common.service;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.common.dto.Sort;
+
+import java.util.List;
+import java.util.Map;
+
+public interface BaseService<T> {
+    List<T> selectAll();
+
+    Page<T> pageList(int pageIndex, int pageSize, Map<String, Object> searchParams, List<Sort> orderList);
+
+    T get(String id);
+
+    int insert(T record);
+
+    int update(T record);
+
+    int delete(String id);
+}

+ 105 - 0
common/src/main/java/com/jpsoft/order/modules/common/service/IRedisService.java

@@ -0,0 +1,105 @@
+package com.jpsoft.order.modules.common.service;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.HashOperations;
+import org.springframework.data.redis.core.RedisTemplate;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+public abstract class IRedisService<T> {
+    @Autowired
+    protected RedisTemplate<String, Object> redisTemplate;
+    @Resource
+    protected HashOperations<String, String, T> hashOperations;
+
+    /**
+     * 存入redis中的key
+     *
+     * @return
+     */
+    protected abstract String getRedisKey(String jpKey);
+
+    /**
+     * 添加
+     *
+     * @param key    key
+     * @param doamin 对象
+     * @param expire 过期时间(单位:秒),传入 -1 时表示不设置过期时间
+     */
+    public void put(String jpKey, String key, T doamin, long expire) {
+        hashOperations.put(getRedisKey(jpKey), key, doamin);
+        if (expire != -1) {
+            redisTemplate.expire(getRedisKey(jpKey), expire, TimeUnit.SECONDS);
+        }
+    }
+
+    /**
+     * 删除
+     *
+     * @param key 传入key的名称
+     */
+    public void remove(String key) {
+        hashOperations.delete(getRedisKey(""), key);
+    }
+
+    /**
+     * 查询
+     *
+     * @param key 查询的key
+     * @return
+     */
+    public T get(String jpKey ,String key) {
+        return hashOperations.get(getRedisKey(jpKey), key);
+    }
+
+    /**
+     * 获取当前redis库下所有对象
+     *
+     * @return
+     */
+    public List<T> getAll(String jpkey) {
+        return hashOperations.values(getRedisKey(jpkey));
+    }
+
+    /**
+     * 查询查询当前redis库下所有key
+     *
+     * @return
+     */
+    public Set<String> getKeys() {
+        return hashOperations.keys(getRedisKey(""));
+    }
+
+    /**
+     * 判断key是否存在redis中
+     *
+     * @param key 传入key的名称
+     * @return
+     */
+    public boolean isKeyExists(String key) {
+        return hashOperations.hasKey(getRedisKey(""), key);
+    }
+
+    /**
+     * 查询当前key下缓存数量
+     *
+     * @return
+     */
+    public long count() {
+        return hashOperations.size(getRedisKey(""));
+    }
+
+    /**
+     * 清空redis
+     */
+    public void empty() {
+        Set<String> set = hashOperations.keys(getRedisKey(""));
+
+        for (String key : set) {
+        	hashOperations.delete(getRedisKey(""), key);
+        }
+    }
+}

+ 37 - 0
common/src/main/java/com/jpsoft/order/modules/common/service/impl/RedisServiceImpl.java

@@ -0,0 +1,37 @@
+package com.jpsoft.order.modules.common.service.impl;
+
+import com.jpsoft.order.modules.common.service.IRedisService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+@Service(value="redisService")
+public class RedisServiceImpl extends IRedisService<Object> {
+    private static final String REDIS_KEY = "JP_HOUSEPROPERTY_REDIS_KEY";
+    private static final String REDIS_KEY1 = "VERIFYCODE_REDIS_KEY";
+    private static final String REDIS_KEY2 = "APITOKEN_REDIS_KEY";
+    private static final String REDIS_KEY3 = "ACCESSTOKEN_REDIS_KEY";
+    private static final String REDIS_KEY4 = "PERSONINFO_REDIS_KEY";
+
+
+    @SuppressWarnings("static-access")
+	@Override
+    protected String getRedisKey(String jpKey) {
+        if (jpKey.equals("code")){
+            return REDIS_KEY1;
+        }
+        if (jpKey.equals("apiToken")){
+            return REDIS_KEY2;
+        }
+        if (jpKey.equals("accessToken")){
+            return REDIS_KEY3;
+        }
+        if (jpKey.equals("personInfo")){
+            return REDIS_KEY4;
+        }
+        if (StringUtils.isBlank(jpKey)){
+            return REDIS_KEY;
+        }
+        return REDIS_KEY;
+
+    }
+}

+ 130 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/AESUtil.java

@@ -0,0 +1,130 @@
+package com.jpsoft.order.modules.common.utils;
+
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+
+import java.io.UnsupportedEncodingException;
+import java.security.Security;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+
+public class AESUtil{
+    private static final String KEY_ALGORITHM = "AES";
+    private static final String DEFAULT_CIPHER_ALGORITHM = "AES/CBC/PKCS7Padding";//默认的加密算法
+
+    static {
+        Security.addProvider(new BouncyCastleProvider());
+    }
+
+    /**
+     * AES 加密操作,注意要先替换jre/lib/security/local_policy.jar和US_export_policy.jar,否则会报keysize不对
+     * @param content 待加密内容
+     * @param key 加密密钥
+     * @return 返回Base64转码后的加密数据
+     */
+    public static String encrypt(String content, String key) {
+        try {
+            Cipher cipher = Cipher.getInstance(DEFAULT_CIPHER_ALGORITHM);// 创建密码器
+
+            byte[] byteContent = content.getBytes("utf-8");
+            IvParameterSpec ivParameterSpec = createIV(key);
+
+            cipher.init(Cipher.ENCRYPT_MODE, getSecretKey(key),ivParameterSpec);// 初始化为加密模式的密码器
+
+            byte[] result = cipher.doFinal(byteContent);// 加密
+
+            System.out.println(cipher.getBlockSize());
+
+            return Base64.encode(result);//通过Base64转码返回
+
+        } catch (Exception ex) {
+            Logger.getLogger(AESUtil.class.getName()).log(Level.SEVERE, null, ex);
+        }
+
+        return null;
+    }
+
+    /**
+     * AES 解密操作
+     *
+     * @param content
+     * @param key
+     * @return
+     */
+    public static String decrypt(String content, String key) {
+
+        try {
+            //实例化
+            Cipher cipher = Cipher.getInstance(DEFAULT_CIPHER_ALGORITHM);
+            IvParameterSpec ivParameterSpec = createIV(key);
+
+            //使用密钥初始化,设置为解密模式
+            cipher.init(Cipher.DECRYPT_MODE, getSecretKey(key),ivParameterSpec);
+
+            //执行操作
+            byte[] result = cipher.doFinal(Base64.decode(content));
+
+            return new String(result, "utf-8");
+        } catch (Exception ex) {
+            Logger.getLogger(AESUtil.class.getName()).log(Level.SEVERE, null, ex);
+        }
+
+        return null;
+    }
+
+    // 创建初始化向量, 长度为16bytes, 向量的作用其实就是salt
+    private static IvParameterSpec createIV(String key) throws UnsupportedEncodingException {
+        byte[] src = key.getBytes("UTF-8");
+
+        if (src.length < 16) {
+            throw new RuntimeException("无法从Key中获取偏移量!");
+        }
+
+        byte[] bs = new byte[16];
+        for (int i=0; i<16; i++){
+            bs[i] = src[i];
+        }
+
+        return new IvParameterSpec(bs);
+    }
+
+    /**
+     * 生成加密秘钥
+     *
+     * @return
+     */
+    private static SecretKeySpec getSecretKey(final String key) throws UnsupportedEncodingException {
+        //返回生成指定算法密钥生成器的 KeyGenerator 对象
+//        KeyGenerator kg = null;
+//
+//        try {
+//            kg = KeyGenerator.getInstance(KEY_ALGORITHM);
+//
+//            //AES 要求密钥长度为 256
+//            kg.init(256, new SecureRandom(key.getBytes("UTF-8")));
+//
+//            //生成一个密钥
+//            SecretKey secretKey = kg.generateKey();
+//
+//            return new SecretKeySpec(secretKey.getEncoded(), KEY_ALGORITHM);// 转换为AES专用密钥
+//        } catch (Exception ex) {
+//            Logger.getLogger(AESUtil.class.getName()).log(Level.SEVERE, null, ex);
+//        }
+
+        SecretKeySpec keySpec = new SecretKeySpec(key.getBytes("UTF-8"), KEY_ALGORITHM);
+
+        return keySpec;
+    }
+
+    public static void main(String[] args) {
+        String content = "421002198311131816";
+        String key = "534a33e888b001a246b635b76e42d0dd";
+
+        //g5mIt+8LgfpLWpPOXg1vyl7j1jv+wN3vwIb6wdpir5M=
+        String enc = encrypt(content,key);
+
+        System.out.println(enc);
+    }
+}

+ 95 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/BASE64DecodedMultipartFile.java

@@ -0,0 +1,95 @@
+package com.jpsoft.order.modules.common.utils;
+
+import org.springframework.web.multipart.MultipartFile;
+import sun.misc.BASE64Decoder;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2020-3-15 16:06
+ */
+public class BASE64DecodedMultipartFile implements MultipartFile {
+
+    private final byte[] imgContent;
+    private final String header;
+
+    public BASE64DecodedMultipartFile(byte[] imgContent, String header) {
+        this.imgContent = imgContent;
+        this.header = header.split(";")[0];
+    }
+
+
+
+    @Override
+    public String getName() {
+        return null;
+    }
+
+    @Override
+    public String getOriginalFilename() {
+        return null;
+    }
+
+    @Override
+    public String getContentType() {
+        return null;
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return false;
+    }
+
+    @Override
+    public long getSize() {
+        return 0;
+    }
+
+    @Override
+    public byte[] getBytes() throws IOException {
+        return new byte[0];
+    }
+
+    @Override
+    public InputStream getInputStream() throws IOException {
+        return null;
+    }
+
+    @Override
+    public void transferTo(File file) throws IOException, IllegalStateException {
+
+    }
+
+    /**
+     * base64转MultipartFile文件
+     *
+     * @param base64
+     * @return
+     */
+    public static MultipartFile base64ToMultipart(String base64) {
+        try {
+            String[] baseStrs = base64.split(",");
+
+            System.out.println("base64:"+base64);
+            BASE64Decoder decoder = new BASE64Decoder();
+            byte[] b = new byte[0];
+            b = decoder.decodeBuffer(baseStrs[1]);
+
+            for (int i = 0; i < b.length; ++i) {
+                if (b[i] < 0) {
+                    b[i] += 256;
+                }
+            }
+
+            return new BASE64DecodedMultipartFile(b, baseStrs[0]);
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+
+}

+ 106 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/BaiduOCR.java

@@ -0,0 +1,106 @@
+package com.jpsoft.order.modules.common.utils;
+
+import net.sf.json.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLEncoder;
+
+public class BaiduOCR {
+    /**
+     * 获取API访问token
+     * 该token有一定的有效期,需要自行管理,当失效时需重新获取.
+     * @param ak - 百度云官网获取的 API Key
+     * @param sk - 百度云官网获取的 Securet Key
+     * @return assess_token 示例:
+     * "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567"
+     */
+    public static JSONObject getAuth(String ak, String sk) {
+        // 获取token地址
+        String authHost = "https://aip.baidubce.com/oauth/2.0/token?";
+        String getAccessTokenUrl = authHost
+                // 1. grant_type为固定参数
+                + "grant_type=client_credentials"
+                // 2. 官网获取的 API Key
+                + "&client_id=" + ak
+                // 3. 官网获取的 Secret Key
+                + "&client_secret=" + sk;
+
+        try {
+            URL realUrl = new URL(getAccessTokenUrl);
+            // 打开和URL之间的连接
+            HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection();
+            connection.setRequestMethod("GET");
+            connection.connect();
+
+            // 定义 BufferedReader输入流来读取URL的响应
+            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+            String result = "";
+            String line;
+
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+
+            System.err.println("result:" + result);
+            JSONObject jsonObject = JSONObject.fromObject(result);
+
+            return jsonObject;
+        } catch (Exception e) {
+            System.err.printf("获取token失败!");
+            e.printStackTrace(System.err);
+        }
+
+        return null;
+    }
+
+    public static JSONObject idcard(String accessToken,String base64Data) {
+        // 请求url
+        String url = "https://aip.baidubce.com/rest/2.0/ocr/v1/idcard";
+
+        try {
+//            byte[] imgData = FileUtil.readFileByBytes(filePath);
+//            String imgStr = Base64.encode(imgData);
+            String imgParam = URLEncoder.encode(base64Data, "UTF-8");
+
+            String param = "id_card_side=" + "front" + "&image=" + imgParam;
+
+            String result = HttpUtil.post(url, accessToken, param);
+            JSONObject jsonObject = JSONObject.fromObject(result);
+
+            System.out.println(result);
+
+            return jsonObject;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return null;
+    }
+
+    public static JSONObject householdRegister(String accessToken, String base64Data) {
+        // 请求url
+        String url = "https://aip.baidubce.com/rest/2.0/ocr/v1/household_register";
+
+        try {
+            // 本地文件路径
+//            byte[] imgData = FileUtil.readFileByBytes(filePath);
+//            String imgStr = Base64.encode(imgData);
+            String imgParam = URLEncoder.encode(base64Data, "UTF-8");
+
+            String param = "image=" + imgParam;
+
+            String result = HttpUtil.post(url, accessToken, param);
+            JSONObject jsonObject = JSONObject.fromObject(result);
+
+            System.out.println(result);
+
+            return jsonObject;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+}

+ 273 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/Base64.java

@@ -0,0 +1,273 @@
+package com.jpsoft.order.modules.common.utils;
+
+public final class Base64 {
+
+    static private final int     BASELENGTH           = 128;
+    static private final int     LOOKUPLENGTH         = 64;
+    static private final int     TWENTYFOURBITGROUP   = 24;
+    static private final int     EIGHTBIT             = 8;
+    static private final int     SIXTEENBIT           = 16;
+    static private final int     FOURBYTE             = 4;
+    static private final int     SIGN                 = -128;
+    static private final char    PAD                  = '=';
+    static private final boolean fDebug               = false;
+    static final private byte[]  base64Alphabet       = new byte[BASELENGTH];
+    static final private char[]  lookUpBase64Alphabet = new char[LOOKUPLENGTH];
+
+    static {
+        for (int i = 0; i < BASELENGTH; ++i) {
+            base64Alphabet[i] = -1;
+        }
+        for (int i = 'Z'; i >= 'A'; i--) {
+            base64Alphabet[i] = (byte) (i - 'A');
+        }
+        for (int i = 'z'; i >= 'a'; i--) {
+            base64Alphabet[i] = (byte) (i - 'a' + 26);
+        }
+
+        for (int i = '9'; i >= '0'; i--) {
+            base64Alphabet[i] = (byte) (i - '0' + 52);
+        }
+
+        base64Alphabet['+'] = 62;
+        base64Alphabet['/'] = 63;
+
+        for (int i = 0; i <= 25; i++) {
+            lookUpBase64Alphabet[i] = (char) ('A' + i);
+        }
+
+        for (int i = 26, j = 0; i <= 51; i++, j++) {
+            lookUpBase64Alphabet[i] = (char) ('a' + j);
+        }
+
+        for (int i = 52, j = 0; i <= 61; i++, j++) {
+            lookUpBase64Alphabet[i] = (char) ('0' + j);
+        }
+        lookUpBase64Alphabet[62] = (char) '+';
+        lookUpBase64Alphabet[63] = (char) '/';
+
+    }
+
+    private static boolean isWhiteSpace(char octect) {
+        return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9);
+    }
+
+    private static boolean isPad(char octect) {
+        return (octect == PAD);
+    }
+
+    private static boolean isData(char octect) {
+        return (octect < BASELENGTH && base64Alphabet[octect] != -1);
+    }
+
+    /**
+     * Encodes hex octects into Base64
+     *
+     * @param binaryData Array containing binaryData
+     * @return Encoded Base64 array
+     */
+    public static String encode(byte[] binaryData) {
+
+        if (binaryData == null) {
+            return null;
+        }
+
+        int lengthDataBits = binaryData.length * EIGHTBIT;
+        if (lengthDataBits == 0) {
+            return "";
+        }
+
+        int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
+        int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
+        int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets;
+        char encodedData[] = null;
+
+        encodedData = new char[numberQuartet * 4];
+
+        byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0;
+
+        int encodedIndex = 0;
+        int dataIndex = 0;
+        if (fDebug) {
+            System.out.println("number of triplets = " + numberTriplets);
+        }
+
+        for (int i = 0; i < numberTriplets; i++) {
+            b1 = binaryData[dataIndex++];
+            b2 = binaryData[dataIndex++];
+            b3 = binaryData[dataIndex++];
+
+            if (fDebug) {
+                System.out.println("b1= " + b1 + ", b2= " + b2 + ", b3= " + b3);
+            }
+
+            l = (byte) (b2 & 0x0f);
+            k = (byte) (b1 & 0x03);
+
+            byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
+            byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0);
+            byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc);
+
+            if (fDebug) {
+                System.out.println("val2 = " + val2);
+                System.out.println("k4   = " + (k << 4));
+                System.out.println("vak  = " + (val2 | (k << 4)));
+            }
+
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f];
+        }
+
+        // form integral number of 6-bit groups
+        if (fewerThan24bits == EIGHTBIT) {
+            b1 = binaryData[dataIndex];
+            k = (byte) (b1 & 0x03);
+            if (fDebug) {
+                System.out.println("b1=" + b1);
+                System.out.println("b1<<2 = " + (b1 >> 2));
+            }
+            byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4];
+            encodedData[encodedIndex++] = PAD;
+            encodedData[encodedIndex++] = PAD;
+        } else if (fewerThan24bits == SIXTEENBIT) {
+            b1 = binaryData[dataIndex];
+            b2 = binaryData[dataIndex + 1];
+            l = (byte) (b2 & 0x0f);
+            k = (byte) (b1 & 0x03);
+
+            byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
+            byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0);
+
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2];
+            encodedData[encodedIndex++] = PAD;
+        }
+
+        return new String(encodedData);
+    }
+
+    /**
+     * Decodes Base64 data into octects
+     *
+     * @param encoded string containing Base64 data
+     * @return Array containind decoded data.
+     */
+    public static byte[] decode(String encoded) {
+
+        if (encoded == null) {
+            return null;
+        }
+
+        char[] base64Data = encoded.toCharArray();
+        // remove white spaces
+        int len = removeWhiteSpace(base64Data);
+
+        if (len % FOURBYTE != 0) {
+            return null;//should be divisible by four
+        }
+
+        int numberQuadruple = (len / FOURBYTE);
+
+        if (numberQuadruple == 0) {
+            return new byte[0];
+        }
+
+        byte decodedData[] = null;
+        byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
+        char d1 = 0, d2 = 0, d3 = 0, d4 = 0;
+
+        int i = 0;
+        int encodedIndex = 0;
+        int dataIndex = 0;
+        decodedData = new byte[(numberQuadruple) * 3];
+
+        for (; i < numberQuadruple - 1; i++) {
+
+            if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))
+                    || !isData((d3 = base64Data[dataIndex++]))
+                    || !isData((d4 = base64Data[dataIndex++]))) {
+                return null;
+            }//if found "no data" just return null
+
+            b1 = base64Alphabet[d1];
+            b2 = base64Alphabet[d2];
+            b3 = base64Alphabet[d3];
+            b4 = base64Alphabet[d4];
+
+            decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
+            decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
+            decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
+        }
+
+        if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) {
+            return null;//if found "no data" just return null
+        }
+
+        b1 = base64Alphabet[d1];
+        b2 = base64Alphabet[d2];
+
+        d3 = base64Data[dataIndex++];
+        d4 = base64Data[dataIndex++];
+        if (!isData((d3)) || !isData((d4))) {//Check if they are PAD characters
+            if (isPad(d3) && isPad(d4)) {
+                if ((b2 & 0xf) != 0)//last 4 bits should be zero
+                {
+                    return null;
+                }
+                byte[] tmp = new byte[i * 3 + 1];
+                System.arraycopy(decodedData, 0, tmp, 0, i * 3);
+                tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
+                return tmp;
+            } else if (!isPad(d3) && isPad(d4)) {
+                b3 = base64Alphabet[d3];
+                if ((b3 & 0x3) != 0)//last 2 bits should be zero
+                {
+                    return null;
+                }
+                byte[] tmp = new byte[i * 3 + 2];
+                System.arraycopy(decodedData, 0, tmp, 0, i * 3);
+                tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
+                tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
+                return tmp;
+            } else {
+                return null;
+            }
+        } else { //No PAD e.g 3cQl
+            b3 = base64Alphabet[d3];
+            b4 = base64Alphabet[d4];
+            decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
+            decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
+            decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
+
+        }
+
+        return decodedData;
+    }
+
+    /**
+     * remove WhiteSpace from MIME containing encoded Base64 data.
+     *
+     * @param data  the byte array of base64 data (with WS)
+     * @return      the new length
+     */
+    private static int removeWhiteSpace(char[] data) {
+        if (data == null) {
+            return 0;
+        }
+
+        // count characters that's not whitespace
+        int newSize = 0;
+        int len = data.length;
+        for (int i = 0; i < len; i++) {
+            if (!isWhiteSpace(data[i])) {
+                data[newSize++] = data[i];
+            }
+        }
+        return newSize;
+    }
+}

+ 198 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/CheckIdCard.java

@@ -0,0 +1,198 @@
+package com.jpsoft.order.modules.common.utils;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+/**
+ * 验证身份证号码 身份证号码, 可以解析身份证号码的各个字段,以及验证身份证号码是否有效; 身份证号码构成:6位地址编码+8位生日+3位顺序码+1位校验码
+ * 
+ * @ClassName: CheckIdCard
+ * @Description: TODO
+ * @author suncy
+ * @date 2013-1-4 上午11:06:09
+ * 
+ */
+public class CheckIdCard {
+	private String cardNumber; // 完整的身份证号码
+	private Boolean cacheValidateResult = null; // 缓存身份证是否有效,因为验证有效性使用频繁且计算复杂
+	private Date cacheBirthDate = null; // 缓存出生日期,因为出生日期使用频繁且计算复杂
+	private final static String BIRTH_DATE_FORMAT = "yyyyMMdd"; // 身份证号码中的出生日期的格式
+	private final static Date MINIMAL_BIRTH_DATE = new Date(-2209017600000L); // 身份证的最小出生日期,1900年1月1日
+	private final static int NEW_CARD_NUMBER_LENGTH = 18;
+	private final static int OLD_CARD_NUMBER_LENGTH = 15;
+	private final static char[] VERIFY_CODE = { '1', '0', 'X', '9', '8', '7',
+			'6', '5', '4', '3', '2' }; // 18位身份证中最后一位校验码
+	private final static int[] VERIFY_CODE_WEIGHT = { 7, 9, 10, 5, 8, 4, 2, 1,
+			6, 3, 7, 9, 10, 5, 8, 4, 2 };// 18位身份证中,各个数字的生成校验码时的权值
+
+	public boolean validate() {
+		if (null == cacheValidateResult) {
+			boolean result = true;
+			result = result && (null != cardNumber); // 身份证号不能为空
+			result = result && NEW_CARD_NUMBER_LENGTH == cardNumber.length(); // 身份证号长度是18(新证)
+			// 身份证号的前17位必须是阿拉伯数字
+			for (int i = 0; result && i < NEW_CARD_NUMBER_LENGTH - 1; i++) {
+				char ch = cardNumber.charAt(i);
+				result = result && ch >= '0' && ch <= '9';
+			}
+			// 身份证号的第18位校验正确
+			result = result
+					&& (calculateVerifyCode(cardNumber) == cardNumber
+							.charAt(NEW_CARD_NUMBER_LENGTH - 1));
+			// 出生日期不能晚于当前时间,并且不能早于1900年
+			try {
+				Date birthDate = this.getBirthDate();
+				result = result && null != birthDate;
+				result = result && birthDate.before(new Date());
+				result = result && birthDate.after(MINIMAL_BIRTH_DATE);
+				/**
+				 * 出生日期中的年、月、日必须正确,比如月份范围是[1,12],日期范围是[1,31],还需要校验闰年、大月、小月的情况时,
+				 * 月份和日期相符合
+				 */
+				String birthdayPart = this.getBirthDayPart();
+				String realBirthdayPart = this.createBirthDateParser().format(
+						birthDate);
+				result = result && (birthdayPart.equals(realBirthdayPart));
+			} catch (Exception e) {
+				result = false;
+			}
+			cacheValidateResult = Boolean.valueOf(result);// TODO
+			// 完整身份证号码的省市县区检验规则
+		}
+		return cacheValidateResult;
+	}
+
+	/**
+	 * 如果是15位身份证号码,则自动转换为18位
+	 * 
+	 * @param cardNumber
+	 * @return
+	 */
+	public CheckIdCard(String cardNumber) {
+		if (null != cardNumber) {
+			cardNumber = cardNumber.trim();
+			if (OLD_CARD_NUMBER_LENGTH == cardNumber.length()) {
+				cardNumber = contertToNewCardNumber(cardNumber);
+			}
+		}
+		this.cardNumber = cardNumber;
+	}
+
+	public String getCardNumber() {
+		return cardNumber;
+	}
+
+	public String getAddressCode() {
+		this.checkIfValid();
+		return this.cardNumber.substring(0, 6);
+	}
+
+	public Date getBirthDate() {
+		if (null == this.cacheBirthDate) {
+			try {
+				this.cacheBirthDate = this.createBirthDateParser().parse(
+						this.getBirthDayPart());
+			} catch (Exception e) {
+				throw new RuntimeException("身份证的出生日期无效");
+			}
+		}
+		return new Date(this.cacheBirthDate.getTime());
+	}
+
+	public boolean isMale() {
+		return 1 == this.getGenderCode();
+	}
+
+	public boolean isFemal() {
+		return false == this.isMale();
+	}
+
+	/**
+	 * 获取身份证的第17位,奇数为男性,偶数为女性
+	 * 
+	 * @return
+	 */
+	private int getGenderCode() {
+		this.checkIfValid();
+		char genderCode = this.cardNumber.charAt(NEW_CARD_NUMBER_LENGTH - 2);
+		return (((int) (genderCode - '0')) & 0x1);
+	}
+
+	private String getBirthDayPart() {
+		return this.cardNumber.substring(6, 14);
+	}
+
+	private SimpleDateFormat createBirthDateParser() {
+		return new SimpleDateFormat(BIRTH_DATE_FORMAT);
+	}
+
+	private void checkIfValid() {
+		if (false == this.validate()) {
+			throw new RuntimeException("身份证号码不正确!");
+		}
+	}
+
+	/**
+	 * 校验码(第十八位数):
+	 * 
+	 * 十七位数字本体码加权求和公式 S = Sum(Ai * Wi), i = 0...16 ,先对前17位数字的权求和;
+	 * Ai:表示第i位置上的身份证号码数字值 Wi:表示第i位置上的加权因子 Wi: 7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4
+	 * 2; 计算模 Y = mod(S, 11)< 通过模得到对应的校验码 Y: 0 1 2 3 4 5 6 7 8 9 10 校验码: 1 0 X 9
+	 * 8 7 6 5 4 3 2
+	 * 
+	 * @param cardNumber
+	 * @return
+	 */
+	private static char calculateVerifyCode(CharSequence cardNumber) {
+		int sum = 0;
+		for (int i = 0; i < NEW_CARD_NUMBER_LENGTH - 1; i++) {
+			char ch = cardNumber.charAt(i);
+			sum += ((int) (ch - '0')) * VERIFY_CODE_WEIGHT[i];
+		}
+		return VERIFY_CODE[sum % 11];
+	}
+	
+	/**  
+     * 获取年龄
+     */    
+    public Integer getAge() {    
+        try {    
+            boolean validateAccess = validate();    
+            if (validateAccess) {
+                // 获取出生日期    
+                Date birthdate = getBirthDate();    
+                GregorianCalendar currentDay = new GregorianCalendar();
+                currentDay.setTime(birthdate);    
+                int year = currentDay.get(Calendar.YEAR);
+                //获取年龄  
+                SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy");
+                String nowYear=simpleDateFormat.format(new Date());  
+                return Integer.parseInt(nowYear)-year;     
+            }else{
+            	return null;
+            }
+        } catch (Exception e) {    
+            return null; 
+        }    
+    }    
+
+	/**
+	 * 把15位身份证号码转换到18位身份证号码<br>
+	 * 15位身份证号码与18位身份证号码的区别为:<br>
+	 * 1、15位身份证号码中,"出生年份"字段是2位,转换时需要补入"19",表示20世纪<br>
+	 * 2、15位身份证无最后一位校验码。18位身份证中,校验码根据根据前17位生成
+	 * 
+	 * @param oldCardNumber
+	 * @return
+	 */
+	private static String contertToNewCardNumber(String oldCardNumber) {
+		StringBuilder buf = new StringBuilder(NEW_CARD_NUMBER_LENGTH);
+		buf.append(oldCardNumber.substring(0, 6));
+		buf.append("19");
+		buf.append(oldCardNumber.substring(6));
+		buf.append(CheckIdCard.calculateVerifyCode(buf));
+		return buf.toString();
+	}
+}

+ 76 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/DES3.java

@@ -0,0 +1,76 @@
+package com.jpsoft.order.modules.common.utils;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.DESedeKeySpec;
+import java.io.UnsupportedEncodingException;
+import java.security.Key;
+
+public class DES3 {
+	public String encrypt(byte[] key, byte[] data)  throws Exception {
+
+        Key deskey = null;
+        DESedeKeySpec spec = new DESedeKeySpec(key);
+        SecretKeyFactory keyfactory = SecretKeyFactory.getInstance("desede");
+        deskey = keyfactory.generateSecret(spec);
+        Cipher cipher = Cipher.getInstance("desede" + "/ECB/PKCS5Padding");
+        cipher.init(Cipher.ENCRYPT_MODE, deskey);
+        byte[] bOut = cipher.doFinal(data);
+
+        return Base64.encode(bOut);
+    }
+    
+    public String encrypt(String key, String data)  throws Exception {
+    	return encrypt(getKeyByte(key),data.getBytes("UTF-8"));
+    }
+
+    public String decrypt(byte[] key, byte[] data) throws Exception {
+        Key deskey = null;
+        DESedeKeySpec spec = new DESedeKeySpec(key);
+        SecretKeyFactory keyfactory = SecretKeyFactory.getInstance("desede");
+        deskey = keyfactory.generateSecret(spec);
+
+        Cipher cipher = Cipher.getInstance("desede" + "/ECB/PKCS5Padding");
+
+        cipher.init(Cipher.DECRYPT_MODE, deskey);
+
+        byte[] bOut = cipher.doFinal(data);
+
+        return new String(bOut, "UTF-8");
+    }
+    
+    public String decrypt(String key, String data)  throws Exception {
+    	return decrypt(getKeyByte(key), Base64.decode(data));
+    }
+
+    public byte[] getKeyByte(String key) throws UnsupportedEncodingException {
+        if (key == null) {
+            return new byte[0];
+        }
+
+        int length = key.length();
+        if (length >= 24) {
+            return key.substring(0, 24).getBytes("UTF-8");
+        } else {
+            for (int i = 0; i < (24 - length); i++) {
+                key += "0";
+            }
+            
+            return key.getBytes("UTF-8");
+        }
+    }
+    
+    public static void main(String[] args) {
+    	DES3 des3 = new DES3();
+		String appKey = "8ZZAHLlTMeNRCP6X";
+		
+		try {
+			System.out.println(des3.encrypt(appKey, "ac5c629f-068d-4b8d-8700-3c3d362337f0"));
+
+			System.out.println(des3.decrypt(appKey, "Xkb9FDXbmw8tEybl2ItjvomEK0QrL+pn6wt9yO7/vA7G9jIUiDhFLg=="));
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+}

+ 72 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/FileUtil.java

@@ -0,0 +1,72 @@
+package com.jpsoft.order.modules.common.utils;
+
+import java.io.*;
+
+/**
+ * 文件读取工具类
+ */
+public class FileUtil {
+
+    /**
+     * 读取文件内容,作为字符串返回
+     */
+    public static String readFileAsString(String filePath) throws IOException {
+        File file = new File(filePath);
+        if (!file.exists()) {
+            throw new FileNotFoundException(filePath);
+        } 
+
+        if (file.length() > 1024 * 1024 * 1024) {
+            throw new IOException("File is too large");
+        } 
+
+        StringBuilder sb = new StringBuilder((int) (file.length()));
+        // 创建字节输入流  
+        FileInputStream fis = new FileInputStream(filePath);  
+        // 创建一个长度为10240的Buffer
+        byte[] bbuf = new byte[10240];  
+        // 用于保存实际读取的字节数  
+        int hasRead = 0;  
+        while ( (hasRead = fis.read(bbuf)) > 0 ) {  
+            sb.append(new String(bbuf, 0, hasRead));  
+        }  
+        fis.close();  
+        return sb.toString();
+    }
+
+    /**
+     * 根据文件路径读取byte[] 数组
+     */
+    public static byte[] readFileByBytes(String filePath) throws IOException {
+        File file = new File(filePath);
+        if (!file.exists()) {
+            throw new FileNotFoundException(filePath);
+        } else {
+            ByteArrayOutputStream bos = new ByteArrayOutputStream((int) file.length());
+            BufferedInputStream in = null;
+
+            try {
+                in = new BufferedInputStream(new FileInputStream(file));
+                short bufSize = 1024;
+                byte[] buffer = new byte[bufSize];
+                int len1;
+                while (-1 != (len1 = in.read(buffer, 0, bufSize))) {
+                    bos.write(buffer, 0, len1);
+                }
+
+                byte[] var7 = bos.toByteArray();
+                return var7;
+            } finally {
+                try {
+                    if (in != null) {
+                        in.close();
+                    }
+                } catch (IOException var14) {
+                    var14.printStackTrace();
+                }
+
+                bos.close();
+            }
+        }
+    }
+}

+ 135 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/Generator/AbstractCaptchaA.java

@@ -0,0 +1,135 @@
+package com.jpsoft.order.modules.common.utils.Generator;
+
+import cn.hutool.captcha.ICaptcha;
+import cn.hutool.captcha.generator.CodeGenerator;
+import cn.hutool.core.codec.Base64;
+import cn.hutool.core.img.ImgUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.io.IORuntimeException;
+import cn.hutool.core.io.IoUtil;
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.*;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2019-8-8 15:27
+ */
+
+public abstract class AbstractCaptchaA implements ICaptcha {
+    private static final long serialVersionUID = 3180820918087507254L;
+    protected int width;
+    protected int height;
+    protected int interfereCount;
+    protected Font font;
+    protected String code;
+    protected byte[] imageBytes;
+    protected CodeGenerator generator;
+    protected Color background;
+
+    public AbstractCaptchaA(int width, int height, int codeCount, int interfereCount) {
+        this(width, height, new RandomGeneratorA(codeCount), interfereCount);
+    }
+
+    public AbstractCaptchaA(int width, int height, CodeGenerator generator, int interfereCount) {
+        this.width = 100;
+        this.height = 37;
+        this.interfereCount = 15;
+        this.width = width;
+        this.height = height;
+        this.generator = generator;
+        this.interfereCount = interfereCount;
+        this.font = new Font("Courier", 0, (int) ((double) this.height * 0.75D));
+        this.createCode();
+    }
+
+    public void createCode() {
+        this.generateCode();
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        ImgUtil.writePng(this.createImage(this.code), out);
+        this.imageBytes = out.toByteArray();
+    }
+
+    protected void generateCode() {
+        this.code = this.generator.generate();
+    }
+
+    protected abstract Image createImage(String var1);
+
+    public String getCode() {
+        return this.code;
+    }
+
+    public boolean verify(String userInputCode) {
+        return this.generator.verify(this.code, userInputCode);
+    }
+
+    public void write(String path) throws IORuntimeException {
+        this.write(FileUtil.touch(path));
+    }
+
+    public void write(File file) throws IORuntimeException {
+        try {
+            OutputStream out = FileUtil.getOutputStream(file);
+            Throwable var3 = null;
+
+            try {
+                this.write((OutputStream) out);
+            } catch (Throwable var13) {
+                var3 = var13;
+                throw var13;
+            } finally {
+                if (out != null) {
+                    if (var3 != null) {
+                        try {
+                            out.close();
+                        } catch (Throwable var12) {
+                            var3.addSuppressed(var12);
+                        }
+                    } else {
+                        out.close();
+                    }
+                }
+
+            }
+
+        } catch (IOException var15) {
+            throw new IORuntimeException(var15);
+        }
+    }
+
+    public void write(OutputStream out) {
+        IoUtil.write(out, false, this.imageBytes);
+    }
+
+    public BufferedImage getImage() {
+        if (null == this.imageBytes) {
+            this.createCode();
+        }
+
+        return ImgUtil.read(new ByteArrayInputStream(this.imageBytes));
+    }
+
+    public String getImageBase64() {
+        return Base64.encode(this.imageBytes);
+    }
+
+    public void setFont(Font font) {
+        this.font = font;
+    }
+
+    public CodeGenerator getGenerator() {
+        return this.generator;
+    }
+
+    public void setGenerator(CodeGenerator generator) {
+        this.generator = generator;
+        this.createCode();
+    }
+
+    public void setBackground(Color background) {
+        this.background = background;
+    }
+}
+

+ 29 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/Generator/AbstractGeneratorA.java

@@ -0,0 +1,29 @@
+package com.jpsoft.order.modules.common.utils.Generator;
+
+import cn.hutool.captcha.generator.CodeGenerator;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2019-8-8 15:21
+ */
+
+
+public abstract class AbstractGeneratorA implements CodeGenerator {
+    private static final long serialVersionUID = 8685744597154953479L;
+    protected String baseStr;
+    protected int length;
+
+    public AbstractGeneratorA(int count) {
+        this("0123456789", count);
+    }
+
+    public AbstractGeneratorA(String baseStr, int length) {
+        this.baseStr = baseStr;
+        this.length = length;
+    }
+
+    public int getLength() {
+        return this.length;
+    }
+}
+

+ 39 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/Generator/CaptchaUtilA.java

@@ -0,0 +1,39 @@
+package com.jpsoft.order.modules.common.utils.Generator;
+
+import cn.hutool.captcha.CircleCaptcha;
+import cn.hutool.captcha.LineCaptcha;
+import cn.hutool.captcha.ShearCaptcha;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2019-8-8 15:30
+ */
+public class CaptchaUtilA {
+
+    public CaptchaUtilA() {
+    }
+
+    public static LineCaptcha createLineCaptcha(int width, int height) {
+        return new LineCaptcha(width, height);
+    }
+
+    public static LineCaptcha createLineCaptcha(int width, int height, int codeCount, int lineCount) {
+        return new LineCaptcha(width, height, codeCount, lineCount);
+    }
+
+    public static CircleCaptcha createCircleCaptcha(int width, int height) {
+        return new CircleCaptcha(width, height);
+    }
+
+    public static CircleCaptchaA createCircleCaptcha(int width, int height, int codeCount, int circleCount) {
+        return new CircleCaptchaA(width, height, codeCount, circleCount);
+    }
+
+    public static ShearCaptcha createShearCaptcha(int width, int height) {
+        return new ShearCaptcha(width, height);
+    }
+
+    public static ShearCaptcha createShearCaptcha(int width, int height, int codeCount, int thickness) {
+        return new ShearCaptcha(width, height, codeCount, thickness);
+    }
+}

+ 55 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/Generator/CircleCaptchaA.java

@@ -0,0 +1,55 @@
+package com.jpsoft.order.modules.common.utils.Generator;
+
+import cn.hutool.core.img.GraphicsUtil;
+import cn.hutool.core.img.ImgUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.RandomUtil;
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2019-8-8 15:29
+ */
+
+    public class CircleCaptchaA extends AbstractCaptchaA {
+        private static final long serialVersionUID = -7096627300356535494L;
+
+        public CircleCaptchaA(int width, int height) {
+            this(width, height, 5);
+        }
+
+        public CircleCaptchaA(int width, int height, int codeCount) {
+            this(width, height, codeCount, 15);
+        }
+
+        public CircleCaptchaA(int width, int height, int codeCount, int interfereCount) {
+            super(width, height, codeCount, interfereCount);
+        }
+
+        public Image createImage(String code) {
+            BufferedImage image = new BufferedImage(this.width, this.height, 1);
+            Graphics2D g = ImgUtil.createGraphics(image, (Color) ObjectUtil.defaultIfNull(this.background, Color.WHITE));
+            this.drawInterfere(g);
+            this.drawString(g, code);
+            return image;
+        }
+
+        private void drawString(Graphics2D g, String code) {
+            g.setComposite(AlphaComposite.getInstance(3, 0.9F));
+            GraphicsUtil.drawStringColourful(g, code, this.font, this.width, this.height);
+        }
+
+        private void drawInterfere(Graphics2D g) {
+            ThreadLocalRandom random = RandomUtil.getRandom();
+
+            for(int i = 0; i < this.interfereCount; ++i) {
+                g.setColor(ImgUtil.randomColor(random));
+                g.drawOval(random.nextInt(this.width), random.nextInt(this.height), random.nextInt(this.height >> 1), random.nextInt(this.height >> 1));
+            }
+
+        }
+    }
+

+ 31 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/Generator/RandomGeneratorA.java

@@ -0,0 +1,31 @@
+package com.jpsoft.order.modules.common.utils.Generator;
+
+import cn.hutool.core.util.RandomUtil;
+import cn.hutool.core.util.StrUtil;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2019-8-8 15:25
+ */
+
+
+    public class RandomGeneratorA extends AbstractGeneratorA {
+        private static final long serialVersionUID = -7802758587765561876L;
+
+        public RandomGeneratorA(int count) {
+            super(count);
+        }
+
+        public RandomGeneratorA(String baseStr, int length) {
+            super(baseStr, length);
+        }
+
+        public String generate() {
+            return RandomUtil.randomString(this.baseStr, this.length);
+        }
+
+        public boolean verify(String code, String userInputCode) {
+            return StrUtil.isNotBlank(userInputCode) ? StrUtil.equalsIgnoreCase(code, userInputCode) : false;
+        }
+    }
+

+ 387 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/HttpConnectionUtil.java

@@ -0,0 +1,387 @@
+package com.jpsoft.order.modules.common.utils;
+
+import net.sf.json.JSONObject;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.config.RegistryBuilder;
+import org.apache.http.conn.socket.ConnectionSocketFactory;
+import org.apache.http.conn.socket.PlainConnectionSocketFactory;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
+import org.apache.http.util.EntityUtils;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import java.io.*;
+import java.net.ConnectException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Map;
+
+public class HttpConnectionUtil {
+	private static int connectTimeoutMs = 10000;
+	private static int readTimeoutMs = 10000;
+	private static String charSet = "UTF-8";
+
+	public static String getHttpContent(String url) {
+        return getHttpContent(url, "UTF-8");
+    }
+
+    public static String getHttpContent(String url, String charSet) {
+        HttpURLConnection connection = null;
+        String content = "";
+        try {
+            URL address_url = new URL(url);
+            connection = (HttpURLConnection) address_url.openConnection();
+            connection.setRequestMethod("GET");
+            //设置访问超时时间及读取网页流的超市时间,毫秒值
+            System.setProperty("sun.net.client.defaultConnectTimeout","30000");
+            System.setProperty("sun.net.client.defaultReadTimeout", "30000");
+
+            //after JDK 1.5
+//            connection.setConnectTimeout(10000);
+//            connection.setReadTimeout(10000);
+            //得到访问页面的返回值
+            int response_code = connection.getResponseCode();
+            if (response_code == HttpURLConnection.HTTP_OK) {
+                InputStream in = connection.getInputStream();
+//                InputStreamReader reader = new InputStreamReader(in,charSet);
+                BufferedReader reader = new BufferedReader(new InputStreamReader(in, charSet));
+                String line = null;
+                while ((line = reader.readLine()) != null) {
+                    content+=line;
+                }
+                return content;
+            }
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            if(connection !=null){
+                connection.disconnect();
+            }
+        }
+        return "";
+    }
+    
+    @SuppressWarnings("rawtypes")
+    public static String getHttpContentByPost(String url, String charSet,Map<String, Object> requestParamsMap) {
+        HttpURLConnection connection = null;
+        DataOutputStream out = null;
+        String content = "";
+        StringBuffer params = new StringBuffer();  
+        try {
+        	
+        	// 组织请求参数  
+            Iterator it = requestParamsMap.entrySet().iterator();  
+            while (it.hasNext()) {  
+				Map.Entry element = (Map.Entry) it.next();  
+                params.append(element.getKey());  
+                params.append("=");  
+                params.append(element.getValue());  
+                params.append("&");  
+            }  
+            if (params.length() > 0) {  
+                params.deleteCharAt(params.length() - 1);  
+            }  
+        	
+            System.out.println("url>>>>>>>>>>" + url);
+            System.out.println("params>>>>>>>>>>" + params);
+            
+            URL address_url = new URL(url);
+            connection = (HttpURLConnection) address_url.openConnection();
+            connection.setRequestMethod("POST");
+            //设置访问超时时间及读取网页流的超市时间,毫秒值
+            System.setProperty("sun.net.client.defaultConnectTimeout","30000");
+            System.setProperty("sun.net.client.defaultReadTimeout", "30000");
+
+         // 设置通用的请求属性  
+            connection.setRequestProperty("accept", "*/*");  
+            connection.setRequestProperty("connection", "Keep-Alive");  
+            connection.setRequestProperty("Content-Length", String.valueOf(params.length()));  
+            // 发送POST请求必须设置如下两行  
+            connection.setDoOutput(true);  
+            connection.setDoInput(true);  
+            // 获取URLConnection对象对应的输出流  
+            out = new DataOutputStream(connection.getOutputStream());
+            // 发送请求参数 
+            out.write(params.toString().getBytes("utf-8"));
+            out.flush();
+            out.close();
+            //得到访问页面的返回值
+            int response_code = connection.getResponseCode();
+            
+            System.out.println("response_code>>>>>" + response_code);
+            
+            if (response_code == HttpURLConnection.HTTP_OK) {
+                InputStream in = connection.getInputStream();
+//                InputStreamReader reader = new InputStreamReader(in,charSet);
+                BufferedReader reader = new BufferedReader(new InputStreamReader(in, charSet));
+                String line = null;
+                while ((line = reader.readLine()) != null) {
+                    content+=line;
+                }
+                
+                System.out.println("content>>>>>" + content);
+                return content;
+            }
+            
+            
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            if(connection !=null){
+                connection.disconnect();
+            }
+        }
+        return "";
+    }
+    
+    public static String getHttpContentByPost(String url, String charSet,String params) {
+        HttpURLConnection connection = null;
+        String content = "";
+        PrintWriter printWriter = null;
+        try {
+
+            URL address_url = new URL(url);
+            connection = (HttpURLConnection) address_url.openConnection();
+            connection.setRequestMethod("POST");
+            //设置访问超时时间及读取网页流的超市时间,毫秒值
+            System.setProperty("sun.net.client.defaultConnectTimeout","30000");
+            System.setProperty("sun.net.client.defaultReadTimeout", "30000");
+
+         // 设置通用的请求属性  
+            connection.setRequestProperty("accept", "*/*");  
+            connection.setRequestProperty("connection", "Keep-Alive");  
+            connection.setRequestProperty("Content-Length", String.valueOf(params.length()));  
+            // 发送POST请求必须设置如下两行  
+            connection.setDoOutput(true);  
+            connection.setDoInput(true);  
+            // 获取URLConnection对象对应的输出流  
+            printWriter = new PrintWriter(connection.getOutputStream());  
+            // 发送请求参数  
+            printWriter.write(params);  
+            // flush输出流的缓冲  
+            printWriter.flush();  
+            //得到访问页面的返回值
+            int response_code = connection.getResponseCode();
+            if (response_code == HttpURLConnection.HTTP_OK) {
+                InputStream in = connection.getInputStream();
+//                InputStreamReader reader = new InputStreamReader(in,charSet);
+                BufferedReader reader = new BufferedReader(new InputStreamReader(in, charSet));
+                String line = null;
+                while ((line = reader.readLine()) != null) {
+                    content+=line;
+                }
+                return content;
+            }
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            if(connection !=null){
+                connection.disconnect();
+            }
+        }
+        return "";
+    }
+
+	/**
+	 * 以http post方式请求
+	 * @param url 请求地址
+	 * @param data 请求参数
+	 * @return
+	 */
+	public static String requestByPost(String url,String data){
+		return requestByPost(url,charSet,data,connectTimeoutMs,readTimeoutMs);
+	}
+	
+	/**
+	 * 以http get方式请求
+	 * @param url 请求地址
+	 * @return
+	 */
+	public static String requestByGet(String url){
+		return requestByGet(url,charSet,connectTimeoutMs,readTimeoutMs);
+	}
+	
+	/**
+	 * 以http post方式请求
+	 * @param url 请求地址
+	 * @param charSet 字符编码
+	 * @param data 请求参数
+	 * @param connectTimeoutMs 连接超时(毫秒)
+	 * @param readTimeoutMs 数据读取超时(毫秒)
+	 * @return
+	 */
+    public static String requestByPost(String url,String charSet,String data, int connectTimeoutMs, int readTimeoutMs){
+    	try{
+	        BasicHttpClientConnectionManager connManager;
+
+	        connManager = new BasicHttpClientConnectionManager(
+	                RegistryBuilder.<ConnectionSocketFactory>create()
+	                        .register("http", PlainConnectionSocketFactory.getSocketFactory())
+	                        .register("https", SSLConnectionSocketFactory.getSocketFactory())
+	                        .build(),
+	                null,
+	                null,
+	                null
+	        );
+
+	        HttpClient httpClient = HttpClientBuilder.create()
+					//取消HttpClient 设置超时后,若在设定的时间内没有返回数据,httpClient底层会重复请求
+					.setRetryHandler(new DefaultHttpRequestRetryHandler(0, false))
+	                .setConnectionManager(connManager)
+	                .build();
+
+	        HttpPost httpPost = new HttpPost(url);
+
+	        RequestConfig requestConfig = RequestConfig.custom()
+					.setSocketTimeout(readTimeoutMs)
+					.setConnectTimeout(connectTimeoutMs)
+					.build();
+
+	        httpPost.setConfig(requestConfig);
+
+	        StringEntity postEntity = new StringEntity(data, charSet);
+	        httpPost.addHeader("Content-Type", "text/xml");
+	        httpPost.setEntity(postEntity);
+
+	        HttpResponse httpResponse = httpClient.execute(httpPost);
+	        HttpEntity httpEntity = httpResponse.getEntity();
+	        return EntityUtils.toString(httpEntity, "UTF-8");
+    	}catch(Exception e){
+    		e.printStackTrace();
+    	}
+    	
+    	return "";
+
+    }
+    
+    /**
+	 * 以http get方式请求
+	 * @param url 请求地址
+	 * @param charSet 字符编码
+	 * @param connectTimeoutMs 连接超时(毫秒)
+	 * @param readTimeoutMs 数据读取超时(毫秒)
+	 * @return
+	 */
+    public static String requestByGet(String url,String charSet,int connectTimeoutMs, int readTimeoutMs){
+    	try{
+	        BasicHttpClientConnectionManager connManager;
+	        
+	        connManager = new BasicHttpClientConnectionManager(
+	                RegistryBuilder.<ConnectionSocketFactory>create()
+	                        .register("http", PlainConnectionSocketFactory.getSocketFactory())
+	                        .register("https", SSLConnectionSocketFactory.getSocketFactory())
+	                        .build(),
+	                null,
+	                null,
+	                null
+	        );
+	
+	        HttpClient httpClient = HttpClientBuilder.create()
+	                .setConnectionManager(connManager)
+	                .build();
+	        
+	        HttpGet httpGet = new HttpGet(url);
+	        
+	        RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(readTimeoutMs).setConnectTimeout(connectTimeoutMs).build();
+	        httpGet.setConfig(requestConfig);	
+	        httpGet.addHeader("Content-Type", "text/xml");
+	
+	        HttpResponse httpResponse = httpClient.execute(httpGet);
+	        HttpEntity httpEntity = httpResponse.getEntity();
+	        return EntityUtils.toString(httpEntity, "UTF-8");
+    	}catch(Exception e){
+    		e.printStackTrace();
+    	}
+    	
+    	return "";
+
+    }
+    
+    /**
+	 * 发起https请求并获取结果
+	 * 
+	 * @param requestUrl 请求地址
+	 * @param requestMethod 请求方式(GET、POST)
+	 * @param outputStr 提交的数据
+	 * @return JSONObject(通过JSONObject.get(key)的方式获取json对象的属性值)
+	 */
+	public static JSONObject httpRequest(String requestUrl, String requestMethod, String outputStr) {
+		JSONObject jsonObject = null;
+		StringBuffer buffer = new StringBuffer();
+		try {
+			URL url = new URL(requestUrl);
+			HttpURLConnection httpUrlConn = (HttpURLConnection)url.openConnection();
+
+			if (requestUrl.startsWith("https")) {
+				HttpsURLConnection httpsURLConnection = (HttpsURLConnection)httpUrlConn;
+
+				// 创建SSLContext对象,并使用我们指定的信任管理器初始化
+				TrustManager[] tm = { new MyX509TrustManager() };
+				SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");
+				sslContext.init(null, tm, new java.security.SecureRandom());
+				// 从上述SSLContext对象中得到SSLSocketFactory对象
+				SSLSocketFactory ssf = sslContext.getSocketFactory();
+
+				httpsURLConnection.setSSLSocketFactory(ssf);
+			}
+
+			httpUrlConn.setDoOutput(true);
+			httpUrlConn.setDoInput(true);
+			httpUrlConn.setUseCaches(false);
+			// 设置请求方式(GET/POST)
+			httpUrlConn.setRequestMethod(requestMethod);
+
+			if ("GET".equalsIgnoreCase(requestMethod))
+				httpUrlConn.connect();
+
+			// 当有数据需要提交时
+			if (null != outputStr) {
+				OutputStream outputStream = httpUrlConn.getOutputStream();
+				// 注意编码格式,防止中文乱码
+				outputStream.write(outputStr.getBytes("UTF-8"));
+				outputStream.close();
+			}
+
+			// 将返回的输入流转换成字符串
+			InputStream inputStream = httpUrlConn.getInputStream();
+			InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "utf-8");
+			BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
+
+			String str = null;
+			while ((str = bufferedReader.readLine()) != null) {
+				buffer.append(str);
+			}
+			bufferedReader.close();
+			inputStreamReader.close();
+			// 释放资源
+			inputStream.close();
+			inputStream = null;
+			httpUrlConn.disconnect();
+			jsonObject = JSONObject.fromObject(buffer.toString());
+		} catch (ConnectException ce) {
+			System.out.println("Weixin server connection timed out.");
+		} catch (Exception e) {
+			System.out.println("https request error:" +  e.getMessage());
+		}
+		return jsonObject;
+	}
+}

+ 130 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/HttpUtil.java

@@ -0,0 +1,130 @@
+package com.jpsoft.order.modules.common.utils;
+
+import lombok.extern.slf4j.Slf4j;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.BufferedReader;
+import java.io.DataOutputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+public class HttpUtil {
+    public final static String getIpAddress(HttpServletRequest request){
+        // 获取请求主机IP地址,如果通过代理进来,则透过防火墙获取真实IP地址  
+
+        String ip = request.getHeader("X-Forwarded-For");
+        if (log.isInfoEnabled()) {
+            log.info("getIpAddress(HttpServletRequest) - X-Forwarded-For - String ip=" + ip);
+        }
+
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+                ip = request.getHeader("Proxy-Client-IP");
+                if (log.isInfoEnabled()) {
+                    log.info("getIpAddress(HttpServletRequest) - Proxy-Client-IP - String ip=" + ip);
+                }
+            }
+            if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+                ip = request.getHeader("WL-Proxy-Client-IP");
+                if (log.isInfoEnabled()) {
+                    log.info("getIpAddress(HttpServletRequest) - WL-Proxy-Client-IP - String ip=" + ip);
+                }
+            }
+            if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+                ip = request.getHeader("HTTP_CLIENT_IP");
+                if (log.isInfoEnabled()) {
+                    log.info("getIpAddress(HttpServletRequest) - HTTP_CLIENT_IP - String ip=" + ip);
+                }
+            }
+            if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+                ip = request.getHeader("HTTP_X_FORWARDED_FOR");
+                if (log.isInfoEnabled()) {
+                    log.info("getIpAddress(HttpServletRequest) - HTTP_X_FORWARDED_FOR - String ip=" + ip);
+                }
+            }
+            if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+                ip = request.getRemoteAddr();
+                if (log.isInfoEnabled()) {
+                    log.info("getIpAddress(HttpServletRequest) - getRemoteAddr - String ip=" + ip);
+                }
+            }
+        } else if (ip.length() > 15) {
+            String[] ips = ip.split(",");
+            for (int index = 0; index < ips.length; index++) {
+                String strIp = (String) ips[index];
+                if (!("unknown".equalsIgnoreCase(strIp))) {
+                    ip = strIp;
+                    break;
+                }
+            }
+        }
+        return ip;
+    }
+
+
+    public static String post(String requestUrl, String accessToken, String params)
+            throws Exception {
+        String contentType = "application/x-www-form-urlencoded";
+        return HttpUtil.post(requestUrl, accessToken, contentType, params);
+    }
+
+    public static String post(String requestUrl, String accessToken, String contentType, String params)
+            throws Exception {
+        String encoding = "UTF-8";
+        if (requestUrl.contains("nlp")) {
+            encoding = "GBK";
+        }
+        return HttpUtil.post(requestUrl, accessToken, contentType, params, encoding);
+    }
+
+    public static String post(String requestUrl, String accessToken, String contentType, String params, String encoding)
+            throws Exception {
+        String url = requestUrl + "?access_token=" + accessToken;
+        return HttpUtil.postGeneralUrl(url, contentType, params, encoding);
+    }
+
+    public static String postGeneralUrl(String generalUrl, String contentType, String params, String encoding)
+            throws Exception {
+        URL url = new URL(generalUrl);
+        // 打开和URL之间的连接
+        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+        connection.setRequestMethod("POST");
+        // 设置通用的请求属性
+        connection.setRequestProperty("Content-Type", contentType);
+        connection.setRequestProperty("Connection", "Keep-Alive");
+        connection.setUseCaches(false);
+        connection.setDoOutput(true);
+        connection.setDoInput(true);
+
+        // 得到请求的输出流对象
+        DataOutputStream out = new DataOutputStream(connection.getOutputStream());
+        out.write(params.getBytes(encoding));
+        out.flush();
+        out.close();
+
+        // 建立实际的连接
+        connection.connect();
+        // 获取所有响应头字段
+        Map<String, List<String>> headers = connection.getHeaderFields();
+        // 遍历所有的响应头字段
+        for (String key : headers.keySet()) {
+            System.err.println(key + "--->" + headers.get(key));
+        }
+        // 定义 BufferedReader输入流来读取URL的响应
+        BufferedReader in = null;
+        in = new BufferedReader(
+                new InputStreamReader(connection.getInputStream(), encoding));
+        String result = "";
+        String getLine;
+        while ((getLine = in.readLine()) != null) {
+            result += getLine;
+        }
+        in.close();
+        System.err.println("result:" + result);
+        return result;
+    }
+}

+ 24 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/MyX509TrustManager.java

@@ -0,0 +1,24 @@
+package com.jpsoft.order.modules.common.utils;
+
+import javax.net.ssl.X509TrustManager;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+
+/**
+ * 证书信任管理器(用于https请求)
+ * 
+ * @author lt
+ * @date 2013-08-08
+ */
+public class MyX509TrustManager implements X509TrustManager {
+
+	public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
+	}
+
+	public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
+	}
+
+	public X509Certificate[] getAcceptedIssuers() {
+		return null;
+	}
+}

+ 501 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/OSSUtil.java

@@ -0,0 +1,501 @@
+package com.jpsoft.order.modules.common.utils;
+
+import cn.hutool.core.codec.Base64Encoder;
+import cn.hutool.core.date.DateTime;
+import com.aliyun.oss.HttpMethod;
+import com.aliyun.oss.OSS;
+import com.aliyun.oss.OSSClientBuilder;
+import com.aliyun.oss.model.GeneratePresignedUrlRequest;
+import com.aliyun.oss.model.OSSObject;
+import com.aliyun.oss.model.PutObjectResult;
+import com.jpsoft.order.config.OSSConfig;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLEncoder;
+import java.util.*;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+@Slf4j
+public class OSSUtil {
+    public static String upload(OSSConfig ossConfig,
+                                String subFolder, String fileName,
+                                InputStream fileInputStream,String watermark) {
+        String retUrl = "";
+
+        try {
+            Image srcImage = ImageIO.read(fileInputStream);
+            int imageWidth = srcImage.getWidth(null);
+            int imageHeight = srcImage.getHeight(null);
+
+            int fontHeight = imageHeight / 20;
+
+            fontHeight = Math.min(30, fontHeight);
+
+            Color color = new Color(128, 128, 128, 200);   // 水印颜色
+            Font font = new Font("宋体", Font.ITALIC, fontHeight);  //水印字体
+
+            BufferedImage bufferedImage = new BufferedImage(
+                    srcImage.getWidth(null), srcImage.getHeight(null),
+                    BufferedImage.TYPE_INT_RGB);
+
+            Graphics2D g = bufferedImage.createGraphics();
+
+            g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+            g.drawImage(srcImage.getScaledInstance(imageWidth, imageHeight, Image.SCALE_SMOOTH), 0,
+                    0, null);
+
+            g.setColor(color); //水印颜色
+            g.setFont(font); //水印字体
+
+            int markWidth = g.getFontMetrics(g.getFont()).charsWidth(watermark.toCharArray(), 0, watermark.length());
+
+            g.rotate(Math.toRadians(-45), imageWidth / 2, imageHeight / 2);
+
+            for (int i=0;i<imageHeight/3;i++) {
+                g.drawString(watermark, (imageWidth - markWidth) / 2, imageHeight*i/3); //水印位置
+            }
+
+            g.dispose(); //释放资源
+
+            ByteArrayOutputStream outImgStream = new ByteArrayOutputStream();
+            ImageIO.write(bufferedImage, "jpg", outImgStream);
+
+            byte[] outImg = outImgStream.toByteArray();
+
+            ByteArrayInputStream inputImgStream = new ByteArrayInputStream(outImg);
+
+            retUrl = upload(ossConfig,subFolder,fileName,inputImgStream);
+        }
+        catch (Exception ex){
+            log.error(ex.getMessage(),ex);
+        }
+
+        return retUrl;
+    }
+
+    public static String upload(OSSConfig ossConfig,
+                                   String subFolder, String fileName,
+                                   InputStream fileInputStream) {
+        Date now = new Date();
+
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(now);
+
+        String savePath = ossConfig.getObjectPre();
+
+        if (!subFolder.startsWith("/")) {
+            savePath += "/";
+        }
+
+        savePath += subFolder;
+
+        savePath = savePath + "/" + cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/";
+
+        OSS ossClient = new OSSClientBuilder().build(ossConfig.getEndpoint(), ossConfig.getAccessKeyId(), ossConfig.getAccessKeySecret());
+
+        int index = fileName.indexOf(".");
+
+//        String prefix = fileName.substring(0,index);
+
+        String ext = fileName.substring(index);
+
+        String newFileName = DateTime.now().toString("ddHHmmssSSS") + ext;
+
+        String retFileUrl = savePath + newFileName;
+
+        // 上传文件流
+        PutObjectResult result = ossClient.putObject(ossConfig.getBucketName(), retFileUrl, fileInputStream);
+
+        // 关闭OSSClient
+        ossClient.shutdown();
+
+        return ossConfig.getUrlPrefix() + "/" + retFileUrl;
+    }
+
+    public static boolean download(String fileUrl,String filePath){
+        boolean result;
+
+        try {
+            FileOutputStream output = new FileOutputStream(filePath);
+
+            URL url = new URL(encodeFileName(fileUrl));
+            URLConnection conn = url.openConnection();
+            InputStream input = conn.getInputStream();
+
+            byte[] buffs = new byte[1024 * 10];
+
+            BufferedInputStream bis = new BufferedInputStream(input, 1024 * 10);
+
+            int read;
+            while ((read = bis.read(buffs, 0, 1024 * 10)) != -1) {
+                output.write(buffs, 0, read);
+            }
+
+            input.close();
+            output.close();
+
+            result = true;
+        } catch (Exception e) {
+            result = false;
+            log.error(e.getMessage(),e);
+        }
+
+        return result;
+    }
+    public static String  downloadToBase64(String fileUrl){
+            ByteArrayOutputStream data = new ByteArrayOutputStream();;
+        try {
+       //     FileOutputStream output = new FileOutputStream();
+       //     OutputStream outputStream =null;
+
+
+
+            URL url = new URL(encodeFileName(fileUrl));
+        //    URLConnection conn = url.openConnection();
+        //    InputStream input = conn.getInputStream();
+
+            byte[] buffs = new byte[1024 * 10];
+            //创建连接
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+            conn.setRequestMethod("GET");
+            conn.setConnectTimeout(5000);
+            InputStream input = conn.getInputStream();
+            //将内容读到内存中
+            int len = -1;
+            while ((len =input.read(buffs))!=-1){
+                data.write(buffs,0,len);
+            }
+            input.close();
+
+
+
+        } catch (Exception e) {
+
+            log.error(e.getMessage(),e);
+        }
+
+
+        return Base64Encoder.encode(data.toByteArray());
+    }
+
+    public static boolean deleteFile(OSSConfig ossConfig,String filePath) {
+        OSS ossClient = new OSSClientBuilder().build(ossConfig.getEndpoint(), ossConfig.getAccessKeyId(), ossConfig.getAccessKeySecret());
+
+        String key = "";
+
+        if (filePath.startsWith(ossConfig.getUrlPrefix())) {
+            key = filePath.substring(ossConfig.getUrlPrefix().length());
+        }
+
+        if (key.startsWith("/")) {
+            key = key.substring(1);
+        }
+
+        boolean exist = ossClient.doesObjectExist(ossConfig.getBucketName(), key);
+
+        if (!exist) {
+            log.error("文件不存在,key={}", key);
+            return false;
+        }
+
+        log.info("删除文件,key={}", key);
+        ossClient.deleteObject(ossConfig.getBucketName(), key);
+
+        ossClient.shutdown();
+
+        return true;
+    }
+
+    public static void batchDownload(List<Map<String,Object>> fileList, OutputStream output){
+        try{
+            ZipOutputStream zos = new ZipOutputStream(output);
+
+            for (Map<String,Object> map : fileList) {
+                String fileUrl = (String)map.get("fileUrl");
+                String filePath = (String)map.get("filePath");
+                String fileName = (String)map.get("fileName");
+
+                try {
+                    if (StringUtils.isEmpty(fileName)) {
+                        fileName = fileUrl;
+                    }
+
+                    if (fileName.indexOf("?") != -1) {
+                        fileName = fileName.substring(0, fileName.indexOf("?"));
+                    }
+
+                    fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
+
+                    String zipFile = fileName;
+
+                    if(StringUtils.isNotEmpty(filePath)){
+                        zipFile = filePath + fileName;
+                    }
+
+                    if(StringUtils.isNotEmpty(fileUrl)) {
+                        ZipEntry zipEntry = new ZipEntry(zipFile);
+                        zos.putNextEntry(zipEntry);
+
+                        URL url = new URL(encodeFileName(fileUrl));
+
+                        HttpURLConnection conn = (HttpURLConnection)url.openConnection();
+                        // 设置连接主机超时(单位:毫秒)
+                        conn.setConnectTimeout(5000);
+                        // 设置从主机读取数据超时(单位:毫秒)
+                        conn.setReadTimeout(5000);
+
+                        if(conn.getResponseCode()==200) {
+                            InputStream inputStream = conn.getInputStream();
+
+                            byte[] buffs = new byte[1024 * 10];
+
+                            BufferedInputStream bis = new BufferedInputStream(inputStream, 1024 * 10);
+
+                            int read;
+                            while ((read = bis.read(buffs, 0, 1024 * 10)) != -1) {
+                                zos.write(buffs, 0, read);
+                            }
+
+                            bis.close();
+                        }
+                    }
+                    else if(map.containsKey("localPath")){
+                        ZipEntry zipEntry = new ZipEntry(zipFile);
+                        zos.putNextEntry(zipEntry);
+
+                        String localPath = (String)map.get("localPath");
+                        byte[] buffs = new byte[1024 * 10];
+
+                        InputStream bis = new BufferedInputStream(new FileInputStream(localPath));
+
+                        int read;
+                        while ((read = bis.read(buffs, 0, 1024 * 10)) != -1) {
+                            zos.write(buffs, 0, read);
+                        }
+
+                        bis.close();
+                    }
+                    else if(map.containsKey("fileData")){
+                        ZipEntry zipEntry = new ZipEntry(zipFile);
+                        zos.putNextEntry(zipEntry);
+
+                        byte[] data = (byte[])map.get("fileData");
+
+                        zos.write(data, 0, data.length);
+                    }
+                }
+                catch(Exception ex){
+                    log.error(ex.getMessage(),ex);
+                }
+            }
+
+            zos.close();
+        }
+        catch(Exception ex){
+            log.error(ex.getMessage(),ex);
+        }
+    }
+
+    private static String encodeFileName(String fileUrl) throws Exception{
+        String[] segements = fileUrl.split("\\?");
+
+        String[] arr = segements[0].split("/");
+
+        //文件名可能是中文,用utf-8编码
+        arr[arr.length - 1] = URLEncoder.encode(arr[arr.length - 1],"UTF-8");
+
+        String encFileUrl = Arrays.stream(arr).collect(Collectors.joining("/"));
+
+        if (segements.length>1){
+            encFileUrl += "?" + segements[1];
+        }
+
+        return encFileUrl;
+    }
+
+    public static String generatePresignedUrl(OSSConfig ossConfig, String imageUrl,int expireSeconds,int maxSize){
+        OSS ossClient = new OSSClientBuilder().build(ossConfig.getEndpoint(), ossConfig.getAccessKeyId(), ossConfig.getAccessKeySecret());
+        Date expiration = new Date(System.currentTimeMillis() + expireSeconds * 1000);
+
+        if (imageUrl.startsWith(ossConfig.getUrlPrefix())) {
+            imageUrl = imageUrl.substring(ossConfig.getUrlPrefix().length());
+        }
+
+        if (imageUrl.indexOf("?") != -1) {
+            imageUrl = imageUrl.substring(0, imageUrl.indexOf("?"));
+        }
+
+        if (imageUrl.startsWith("/")) {
+            imageUrl = imageUrl.substring(1);
+        }
+
+        GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(ossConfig.getBucketName(), imageUrl, HttpMethod.GET);
+
+        // 设置过期时间。
+        request.setExpiration(expiration);
+
+        //设置缩放
+        request.setProcess("image/resize,l_" + maxSize + ",limit_1");
+
+        // 生成签名URL(HTTP GET请求)。
+        URL signedUrl = ossClient.generatePresignedUrl(request);
+
+        return signedUrl.toString();
+    }
+
+    public static void presignedDownload(OSSConfig ossConfig, List<Map> fileList, OutputStream output){
+        BufferedInputStream bis = null;
+
+        try{
+            ZipOutputStream zos = new ZipOutputStream(output);
+
+            OSS ossClient = new OSSClientBuilder().build(ossConfig.getEndpoint(), ossConfig.getAccessKeyId(), ossConfig.getAccessKeySecret());
+
+            for (Map<String,String> map : fileList) {
+                try {
+                    String fileUrl = map.get("fileUrl");
+                    String filePath = map.get("filePath");
+
+                    Date expiration = new Date(System.currentTimeMillis() + 3600 * 1000);
+
+                    if (fileUrl.startsWith(ossConfig.getUrlPrefix())) {
+                        fileUrl = fileUrl.substring(ossConfig.getUrlPrefix().length());
+                    }
+
+                    if (fileUrl.indexOf("?") != -1) {
+                        fileUrl = fileUrl.substring(0, fileUrl.indexOf("?"));
+                    }
+
+                    if (fileUrl.startsWith("/")) {
+                        fileUrl = fileUrl.substring(1);
+                    }
+
+                    GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(ossConfig.getBucketName(), fileUrl, HttpMethod.GET);
+
+                    // 设置过期时间。
+                    request.setExpiration(expiration);
+
+                    //设置缩放
+                    request.setProcess("image/resize,l_1024,limit_1");
+
+                    // 生成签名URL(HTTP GET请求)。
+                    URL signedUrl = ossClient.generatePresignedUrl(request);
+
+                    // 使用签名URL发送请求。
+                    OSSObject ossObject = ossClient.getObject(signedUrl, new HashMap<>());
+
+                    if (ossObject != null) {
+                        InputStream inputStream = ossObject.getObjectContent();
+                        byte[] buffs = new byte[1024 * 10];
+                        String fileName = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
+                        String zipFile = fileName;
+
+                        if (StringUtils.isNotEmpty(filePath)){
+                            zipFile = filePath + fileName;
+                        }
+
+                        ZipEntry zipEntry = new ZipEntry(zipFile);
+                        zos.putNextEntry(zipEntry);
+                        bis = new BufferedInputStream(inputStream, 1024 * 10);
+
+                        int read;
+                        while ((read = bis.read(buffs, 0, 1024 * 10)) != -1) {
+                            zos.write(buffs, 0, read);
+                        }
+
+                        ossObject.close();
+                    }
+                }
+                catch(Exception ex){
+                    log.error(ex.getMessage(),ex);
+                }
+            }
+
+            zos.close();
+            ossClient.shutdown();
+        }
+        catch(Exception ex){
+            log.error(ex.getMessage(),ex);
+        }
+        finally {
+            if(bis!=null){
+                try {
+                    bis.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+
+
+    public static String uploadOfferImg(OSSConfig ossConfig,
+                                String subFolder, String fileName,
+                                String outImgUrl,String offerCode,String personName,
+                                        String userName,String schoolName) {
+        String retUrl = "";
+
+        try {
+            File _file = new File(outImgUrl);
+            Image srcImage = ImageIO.read(_file);
+            int imageWidth = srcImage.getWidth(null);
+            int imageHeight = srcImage.getHeight(null);
+
+            int fontHeight = imageHeight / 20;
+
+            fontHeight = Math.min(30, fontHeight);
+
+            Color color = new Color(128, 128, 128, 200);   // 水印颜色
+            Font font = new Font("宋体", Font.ITALIC, fontHeight);  //水印字体
+
+            BufferedImage bufferedImage = new BufferedImage(
+                    srcImage.getWidth(null), srcImage.getHeight(null),
+                    BufferedImage.TYPE_INT_RGB);
+
+            Graphics2D g = bufferedImage.createGraphics();
+
+            g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+            g.drawImage(srcImage.getScaledInstance(imageWidth, imageHeight, Image.SCALE_SMOOTH), 0,
+                    0, null);
+
+            g.setColor(color); //水印颜色
+            g.setFont(font); //水印字体
+
+            int markWidth = g.getFontMetrics(g.getFont()).charsWidth(offerCode.toCharArray(), 0, offerCode.length());
+
+            g.rotate(Math.toRadians(-45), imageWidth / 2, imageHeight / 2);
+
+            for (int i=0;i<imageHeight/3;i++) {
+                g.drawString(offerCode, (imageWidth - markWidth) / 2, imageHeight*i/3); //水印位置
+            }
+
+            g.dispose(); //释放资源
+
+            ByteArrayOutputStream outImgStream = new ByteArrayOutputStream();
+            ImageIO.write(bufferedImage, "jpg", outImgStream);
+
+            byte[] outImg = outImgStream.toByteArray();
+
+            ByteArrayInputStream inputImgStream = new ByteArrayInputStream(outImg);
+
+            retUrl = upload(ossConfig,subFolder,fileName,inputImgStream);
+        }
+        catch (Exception ex){
+            log.error(ex.getMessage(),ex);
+        }
+
+        return retUrl;
+    }
+}

+ 428 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/POIUtils.java

@@ -0,0 +1,428 @@
+package com.jpsoft.order.modules.common.utils;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.converter.ExcelToHtmlConverter;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.*;
+import org.w3c.dom.Document;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.*;
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Description:POI解析Excel获取所有数据(支持xls/xlsx)
+ *
+ * @author zhjun 2015-11-5
+ */
+public class POIUtils {
+    InputStream ins = null;
+    Workbook wb = null;
+    List<Object[]> dataList = new ArrayList<Object[]>(100);
+
+    public static void CreateBorder(CellStyle cellStyle) {
+        if (cellStyle != null) {
+            cellStyle.setBorderTop(BorderStyle.THIN);
+            cellStyle.setBorderBottom(BorderStyle.THIN);
+            cellStyle.setBorderLeft(BorderStyle.THIN);
+            cellStyle.setBorderRight(BorderStyle.THIN);
+        }
+    }
+
+    public static Cell setCellValue(Row row, int i, String value) {
+        // TODO Auto-generated method stub
+        Cell cell = row.createCell(i);
+        cell.setCellValue(value);
+
+        return cell;
+    }
+
+    public static Cell setCellValue(Row row, int i, int value) {
+        // TODO Auto-generated method stub
+        Cell cell = row.createCell(i);
+        cell.setCellValue(value);
+
+        return cell;
+    }
+
+    public static Cell setCellValue(Row row, int cellIndex, CellStyle cellStyle, Object value) {
+        Cell cell = row.createCell(cellIndex);
+        cell.setCellStyle(cellStyle);
+
+        if (value != null) {
+            if (value instanceof BigDecimal) {
+                cell.setCellValue(((BigDecimal) value).doubleValue());
+            } else if (value instanceof String) {
+                cell.setCellValue(value.toString());
+            } else if (value instanceof Integer) {
+                cell.setCellValue(Double.valueOf(value.toString()));
+            } else if (value instanceof Long) {
+                cell.setCellValue(Double.valueOf(value.toString()));
+            }
+        }
+
+        return cell;
+    }
+
+    public static String xls2html(HSSFWorkbook wb) {
+        String result = "";
+
+        try {
+            ExcelToHtmlConverter converter = new ExcelToHtmlConverter(DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument());
+            converter.setOutputColumnHeaders(false);
+            converter.setOutputRowNumbers(false);
+
+            converter.processWorkbook(wb);
+
+            Document htmlDocument = converter.getDocument();
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+            DOMSource domSource = new DOMSource(htmlDocument);
+            StreamResult streamResult = new StreamResult(out);
+            TransformerFactory tf = TransformerFactory.newInstance();
+            Transformer serializer = tf.newTransformer();
+            serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+            serializer.setOutputProperty(OutputKeys.INDENT, "yes");
+            serializer.setOutputProperty(OutputKeys.METHOD, "html");
+            serializer.transform(domSource, streamResult);
+            out.close();
+
+            result = new String(out.toByteArray(), "UTF-8");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过流读取
+     *
+     * @param ins
+     */
+    public POIUtils(InputStream ins) {
+        try {
+            wb = WorkbookFactory.create(ins);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (ins != null) {
+                try {
+                    ins.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+    public POIUtils() {
+        wb = new HSSFWorkbook();
+    }
+
+    public Sheet getSheetAt(int sheetIndex){
+        return wb.getSheetAt(sheetIndex);
+    }
+
+    public Workbook getWorkbook(){
+        return wb;
+    }
+
+    /**
+     * 通过文件读取
+     *
+     * @param file
+     */
+    public POIUtils(File file) {
+        try {
+            ins = new FileInputStream(file);
+            wb = WorkbookFactory.create(ins);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (ins != null) {
+                try {
+                    ins.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+    /**
+     * 通过文件路径读取
+     *
+     * @param path
+     */
+    public POIUtils(String path) {
+        try {
+            ins = new FileInputStream(path);
+            wb = WorkbookFactory.create(ins);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (ins != null) {
+                try {
+                    ins.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+    /**
+     * 取Excel所有数据,包含header
+     *
+     * @return List<Object   [   ]>
+     */
+    public List<Object[]> getAllData(int sheetIndex) {
+        int columnNum = 0;
+        Sheet sheet = wb.getSheetAt(sheetIndex);
+        if (sheet.getRow(0) != null) {
+            columnNum = sheet.getRow(0).getLastCellNum() - sheet.getRow(0).getFirstCellNum();
+        }
+        if (columnNum > 0) {
+            for (Row row : sheet) {
+                Object[] singleRow = new Object[columnNum];
+                int n = 0;
+
+                for (int i = 0; i < columnNum; i++) {
+                    Cell cell = row.getCell(i, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
+                    singleRow[n] = getCellValue(cell);
+                    n++;
+                }
+
+                //在后续方法中校验
+//				if("".equals(singleRow[0])){continue;}//如果第一列为空,跳过
+
+                dataList.add(singleRow);
+            }
+        }
+        return dataList;
+    }
+
+    public List<Object[]> getAllData(int sheetIndex, int firstRowNum) {
+        int columnNum = 0;
+        Sheet sheet = wb.getSheetAt(sheetIndex);
+        if (sheet.getRow(0) != null) {
+            columnNum = sheet.getRow(firstRowNum).getLastCellNum();
+        }
+        if (columnNum > 0) {
+            for (Row row : sheet) {
+                Object[] singleRow = new Object[columnNum];
+                int n = 0;
+                for (int i = 0; i < columnNum; i++) {
+                    Cell cell = row.getCell(i, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
+                    singleRow[n] = getCellValue(cell);
+                    n++;
+                }
+                if ("".equals(singleRow[0])) {
+                    continue;
+                }//如果第一行为空,跳过
+                dataList.add(singleRow);
+            }
+        }
+        return dataList;
+    }
+
+    public Object getCellValue(int sheetIndex,int rowIndex,int colIndex){
+        Row row = wb.getSheetAt(sheetIndex).getRow(rowIndex);
+        Cell cell = row.getCell(colIndex, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
+
+        return getCellValue(cell);
+    }
+
+    /**
+     * 获取列的数据信息
+     *
+     * @param cell
+     * @return
+     */
+    private Object getCellValue(Cell cell) {
+        Object cellValue = null;
+        FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
+
+        switch (cell.getCellType()) {
+            case BLANK:
+                cellValue = "";
+                break;
+            case BOOLEAN:
+                cellValue = Boolean.toString(cell.getBooleanCellValue());
+                break;
+            //数值
+            case NUMERIC:
+                DecimalFormat df = new DecimalFormat("0");
+                double value = cell.getNumericCellValue();
+
+                if (value > Math.floor(value)) {
+                    df = new DecimalFormat("0.00");
+                }
+
+                cellValue = df.format(value);
+                break;
+            case STRING:
+                cellValue = cell.getStringCellValue().trim();
+                break;
+            case ERROR:
+                cellValue = "";
+                break;
+            case FORMULA:
+                CellValue cv = evaluator.evaluate(cell);
+
+                if (cv.getCellType() == CellType.STRING) {
+                    cellValue = cv.getStringValue();
+                } else if (cv.getCellType() == CellType.NUMERIC) {
+                    cellValue = cv.getNumberValue();
+                } else {
+                    cellValue = cell.getCellFormula();
+                }
+
+                break;
+            default:
+                cellValue = "";
+        }
+
+        return cellValue;
+    }
+
+
+    /**
+     * 返回Excel最大行index值,实际行数要加1
+     *
+     * @return
+     */
+    public int getRowNum(int sheetIndex) {
+        Sheet sheet = wb.getSheetAt(sheetIndex);
+        return sheet.getLastRowNum();
+    }
+
+    /**
+     * 返回数据的列数
+     *
+     * @param sheetIndex
+     * @return
+     */
+    public int getColumnNum(int sheetIndex) {
+        Sheet sheet = wb.getSheetAt(sheetIndex);
+        Row row = sheet.getRow(0);
+        if (row != null && row.getLastCellNum() > 0) {
+            return row.getLastCellNum();
+        }
+        return 0;
+    }
+
+    /**
+     * 获取某一行数据
+     *
+     * @param rowIndex 计数从0开始,rowIndex为0代表header行
+     * @return
+     */
+    public Object[] getRowData(int sheetIndex, int rowIndex) {
+        Object[] dataArray = null;
+        if (rowIndex > this.getColumnNum(sheetIndex)) {
+            return dataArray;
+        } else {
+//			dataArray = new Object[this.getColumnNum(sheetIndex)];
+            return this.dataList.get(rowIndex);
+        }
+    }
+
+
+    /**
+     * 获取某一列数据
+     *
+     * @param colIndex
+     * @return
+     */
+    public Object[] getColumnData(int sheetIndex, int colIndex) {
+        Object[] dataArray = null;
+        if (colIndex > this.getColumnNum(sheetIndex)) {
+            return dataArray;
+        } else {
+            if (this.dataList != null && this.dataList.size() > 0) {
+                dataArray = new Object[this.getRowNum(sheetIndex) + 1];
+                int index = 0;
+                for (Object[] rowData : dataList) {
+                    if (rowData != null) {
+                        dataArray[index] = rowData[colIndex];
+                        index++;
+                    }
+                }
+            }
+        }
+
+        return dataArray;
+    }
+
+    public static void main(String[] args) {
+        POIUtils re = new POIUtils("D:\\fpb.xlsx");
+
+        List<Object[]> objList = re.getAllData(0);
+
+        for (int i = 0; i < objList.size(); i++) {
+            String result = "";
+            for (int j = 0; j < objList.get(i).length; j++) {
+                result += objList.get(i)[j] + "_";
+            }
+
+            System.out.println(result);
+        }
+    }
+
+    public Workbook exportErrorXls(int sheetIndex,int validateColIndex, int rowNum) {
+        Workbook destBook = new HSSFWorkbook();
+        Sheet destSheet = destBook.createSheet();
+
+        //复制列头
+        Sheet srcSheet = wb.getSheetAt(sheetIndex);
+        Row srcHeaderRow = wb.getSheetAt(sheetIndex).getRow(0);
+        Row destHeaderRow = destSheet.createRow(0);
+
+        for (int i=0;i<srcHeaderRow.getLastCellNum();i++){
+            if (srcHeaderRow.getCell(i)!=null) {
+                destHeaderRow.createCell(i).setCellValue(srcHeaderRow.getCell(i).getStringCellValue());
+            }
+            else{
+                break;
+            }
+        }
+
+        int srcRowIndex = 1;
+        int destRowIndex = 1;
+
+        while(srcRowIndex<= rowNum){
+            Row dataRow1 = srcSheet.getRow(srcRowIndex);
+
+            if(dataRow1!=null) {
+                Cell cell = dataRow1.getCell(validateColIndex);
+
+                if (cell != null && StringUtils.isNotEmpty(cell.getStringCellValue())) {
+                    Row dataRow2 = destSheet.createRow(destRowIndex);
+
+                    int lastCellNum = Math.min(dataRow1.getLastCellNum(),100);
+
+                    for (int i = 0; i < lastCellNum; i++) {
+                        if (dataRow1.getCell(i) != null) {
+                            dataRow2.createCell(i).setCellValue((String) getCellValue(0, srcRowIndex, i));
+                        }
+                    }
+
+                    destRowIndex++;
+                }
+            }
+
+            srcRowIndex++;
+        }
+
+        return destBook;
+    }
+}

+ 84 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/PojoUtils.java

@@ -0,0 +1,84 @@
+package com.jpsoft.order.modules.common.utils;
+
+import com.github.dozermapper.core.DozerBeanMapperBuilder;
+import com.github.dozermapper.core.Mapper;
+import com.github.pagehelper.Page;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.util.HashMap;
+import java.util.Map;
+
+public class PojoUtils {
+    private static Logger logger = LoggerFactory.getLogger("root");
+    private static Mapper MAPPER = DozerBeanMapperBuilder.buildDefault();
+
+    public static <T> T map(Object source, Class<T> destinationClass) {
+        if (source == null) {
+            return null;
+        }
+        return MAPPER.map(source, destinationClass);
+    }
+
+    public static void map(Object source, Object destination) {
+        MAPPER.map(source, destination);
+    }
+
+    public static <T> Map<String, Object> pojo2map(T t) {
+        // TODO Auto-generated method stub
+        Map<String,Object> map = new HashMap<String,Object>();
+
+        try{
+            BeanInfo beanInfo  = Introspector.getBeanInfo(t.getClass());
+            PropertyDescriptor[] props = beanInfo.getPropertyDescriptors();
+
+            for (PropertyDescriptor pd : props) {
+                if (pd.getReadMethod()!=null) {
+                    try {
+                        Object srcValue = pd.getReadMethod().invoke(t);
+                        map.put(pd.getName(), srcValue);
+                    }
+                    catch (Exception ex){
+                        logger.error(ex.getMessage(),ex);
+                    }
+                }
+            }
+        }
+        catch(Exception ex){
+            ex.printStackTrace();
+        }
+
+        return map;
+    }
+
+    public static Map pageWrapper(Page page){
+        Map<String,Object> pageMap = new HashMap<>();
+
+        pageMap.put("recordsTotal",page.getTotal());
+        pageMap.put("recordsFiltered",page.getTotal());
+        pageMap.put("totalPage",page.getPages());
+        pageMap.put("pageNumber",page.getPageNum());
+        pageMap.put("pageSize",page.getPageSize());
+        pageMap.put("data", page.getResult());
+
+        return pageMap;
+    }
+
+    public static <T> Page<T> convertPage(Page page, Class<T> destinationClass){
+        Page newPage = new Page();
+
+        newPage.setPageNum(page.getPageNum());
+        newPage.setPageSize(page.getPageSize());
+        newPage.setPages(page.getPages());
+        newPage.setTotal(page.getTotal());
+
+        for (Object obj: page) {
+            newPage.add(map(obj,destinationClass));
+        }
+
+        return newPage;
+    }
+}

+ 155 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/SMSUtil.java

@@ -0,0 +1,155 @@
+package com.jpsoft.order.modules.common.utils;
+
+import com.jpsoft.order.modules.common.dto.MessageResult;
+import com.taobao.api.ApiException;
+import com.taobao.api.DefaultTaobaoClient;
+import com.taobao.api.TaobaoClient;
+import com.taobao.api.request.AlibabaAliqinFcSmsNumSendRequest;
+import com.taobao.api.response.AlibabaAliqinFcSmsNumSendResponse;
+import net.sf.json.JSONException;
+import net.sf.json.JSONObject;
+
+import java.util.Random;
+
+
+public class SMSUtil {
+	
+	public final static String REG_TEMPLATE_CODE = "SMS_49390047";
+	public static final String NUMBERCHAR = "0123456789";
+	
+	private final static String APP_KEY = "24698874";
+	private final static String APP_SECRET = "5f5b21d1dc93e124aa803f95d71c00b8";
+	private final static String APP_URL = "https://eco.taobao.com/router/rest";
+	private final static String SIGN_NAME = "荆鹏云平台";
+	private final static String SMS_TYPE = "normal";
+	
+	/**
+	 * 
+	 * @param phones 手机号,多个以英文逗号","隔开
+	 * @param smsTemplateCode 短信模版ID
+	 * @param jsonStr 短信模板变量,传参规则{"key":"value"},key的名字须和申请模板中的变量名一致,多个变量之间以逗号隔开。示例:针对模板“验证码${code},您正在进行${product}身份验证,打死不要告诉别人哦!”,传参时需传入{"code":"1234","product":"alidayu"}
+	 * @return
+	 */
+	public static MessageResult send(String phones, String smsTemplateCode, String jsonStr){
+		
+		boolean success = true;
+		String msg = "发送成功";
+		
+		TaobaoClient client = new DefaultTaobaoClient(APP_URL, APP_KEY, APP_SECRET);
+		AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
+		req.setSmsType(SMS_TYPE);
+		req.setSmsFreeSignName(SIGN_NAME);
+		if(jsonStr != null){
+			req.setSmsParamString(jsonStr);
+		}
+		req.setRecNum(phones);
+		req.setSmsTemplateCode(smsTemplateCode);
+		AlibabaAliqinFcSmsNumSendResponse rsp;
+		try {
+			rsp = client.execute(req);
+			
+			JSONObject ret = JSONObject.fromObject(rsp.getBody());
+			
+			System.out.println("ret>>>>" + ret);
+			
+			if(ret.containsKey("error_response")){
+				success = false;
+				msg = ret.getJSONObject("error_response").getString("sub_msg");
+			}else if(ret.containsKey("alibaba_aliqin_fc_sms_num_send_response")){
+				
+				JSONObject result = ret.getJSONObject("alibaba_aliqin_fc_sms_num_send_response").getJSONObject("result");
+				
+				if(!result.getBoolean("success")){
+					msg = result.getString("msg");
+				}
+			}else{
+				success = false;
+				msg = ret.toString();
+			}
+		} catch (ApiException e) {
+			success = false;
+			msg = e.getErrMsg();
+		} catch (JSONException ex) {
+			success = false;
+			msg = ex.getMessage();
+		}
+
+		MessageResult retMessage = new MessageResult();
+		
+		retMessage.setMessage(msg);
+		retMessage.setResult(success);
+		
+		return retMessage;
+	}
+	
+	/**
+	 * 
+	 * @param phones 手机号,多个以英文逗号","隔开
+	 * @param signName 签名:目前仅支持"荆鹏云平台","速乐购"两种签名
+	 * @param smsTemplateCode 短信模版ID
+	 * @param json 短信模板变量,传参规则{"key":"value"},key的名字须和申请模板中的变量名一致,多个变量之间以逗号隔开。示例:针对模板“验证码${code},您正在进行${product}身份验证,打死不要告诉别人哦!”,传参时需传入{"code":"1234","product":"alidayu"}
+	 * @return
+	 */
+	public static MessageResult send(String phones, String signName, String smsTemplateCode, JSONObject json){
+		
+		boolean success = true;
+		String msg = "发送成功";
+		
+		TaobaoClient client = new DefaultTaobaoClient(APP_URL, APP_KEY, APP_SECRET);
+		AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
+		req.setSmsType(SMS_TYPE);
+		req.setSmsFreeSignName(signName);
+		if(json != null){
+			req.setSmsParamString(json.toString());
+		}
+		req.setRecNum(phones);
+		req.setSmsTemplateCode(smsTemplateCode);
+		AlibabaAliqinFcSmsNumSendResponse rsp;
+		try {
+			rsp = client.execute(req);
+			
+			JSONObject ret = JSONObject.fromObject(rsp.getBody());
+			
+			System.out.println("ret>>>>" + ret);
+			
+			if(ret.containsKey("error_response")){
+				success = false;
+				msg = ret.getJSONObject("error_response").getString("sub_msg");
+			}else if(ret.containsKey("alibaba_aliqin_fc_sms_num_send_response")){
+				
+				JSONObject result = ret.getJSONObject("alibaba_aliqin_fc_sms_num_send_response").getJSONObject("result");
+				
+				if(!result.getBoolean("success")){
+					msg = result.getString("msg");
+				}
+			}else{
+				success = false;
+				msg = ret.toString();
+			}
+		} catch (ApiException e) {
+			success = false;
+			msg = e.getErrMsg();
+		} catch (JSONException ex) {
+			success = false;
+			msg = ex.getMessage();
+		}
+
+		MessageResult retMessage = new MessageResult();
+		
+		retMessage.setMessage(msg);
+		retMessage.setResult(success);
+		
+		return retMessage;
+	}
+
+
+
+	public static String generateNumberString(int length) {
+		StringBuffer sb = new StringBuffer();
+		Random random = new Random();
+		for (int i = 0; i < length; i++) {
+			sb.append(NUMBERCHAR.charAt(random.nextInt(NUMBERCHAR.length())));
+		}
+		return sb.toString();
+	}
+}

+ 70 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/Sign.java

@@ -0,0 +1,70 @@
+package com.jpsoft.order.modules.common.utils;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Formatter;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+public class Sign {
+
+    public static Map<String, String> sign(String jsapi_ticket, String url) {
+        Map<String, String> ret = new HashMap<String, String>();
+        String nonce_str = create_nonce_str();
+        String timestamp = create_timestamp();
+        String string1;
+        String signature = "";
+
+        //注意这里参数名必须全部小写,且必须有序
+        string1 = "jsapi_ticket=" + jsapi_ticket +
+                  "&noncestr=" + nonce_str +
+                  "&timestamp=" + timestamp +
+                  "&url=" + url;
+        System.out.println(string1);
+
+        try
+        {
+            MessageDigest crypt = MessageDigest.getInstance("SHA-1");
+            crypt.reset();
+            crypt.update(string1.getBytes("UTF-8"));
+            signature = byteToHex(crypt.digest());
+        }
+        catch (NoSuchAlgorithmException e)
+        {
+            e.printStackTrace();
+        }
+        catch (UnsupportedEncodingException e)
+        {
+            e.printStackTrace();
+        }
+
+        ret.put("url", url);
+        ret.put("jsapi_ticket", jsapi_ticket);
+        ret.put("nonceStr", nonce_str);
+        ret.put("timestamp", timestamp);
+        ret.put("signature", signature);
+
+        return ret;
+    }
+
+    private static String byteToHex(final byte[] hash) {
+        Formatter formatter = new Formatter();
+        for (byte b : hash)
+        {
+            formatter.format("%02x", b);
+        }
+        String result = formatter.toString();
+        formatter.close();
+        return result;
+    }
+
+    private static String create_nonce_str() {
+        return UUID.randomUUID().toString();
+    }
+
+    private static String create_timestamp() {
+        return Long.toString(System.currentTimeMillis() / 1000);
+    }
+}

+ 161 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/StringUtils.java

@@ -0,0 +1,161 @@
+package com.jpsoft.order.modules.common.utils;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.text.MessageFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import java.util.Random;
+import java.util.UUID;
+
+/**
+ * 字符串工具类,继承lang3字符串工具类
+ * @author L.com
+ */
+public final class StringUtils extends org.apache.commons.lang3.StringUtils {
+
+	public static String encode(String str){
+		String encode=null;
+		try {
+			encode = URLEncoder.encode(str, "UTF-8");
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+		}
+		return encode;
+	}
+
+	/**
+	 * 获取UUID,去掉`-`的
+	 * @return {String}
+	 *
+	 */
+	public static String generateStr () {
+		return UUID.randomUUID().toString().replace("-", "");
+	}
+
+
+	/**
+	 * 要求外部订单号必须唯一。
+	 * @return {String}
+	 */
+	public synchronized static String getOutTradeNo() {
+		SimpleDateFormat format = new SimpleDateFormat("MMddHHmmss", Locale.getDefault());
+		Date date = new Date();
+		String key = format.format(date);
+		Integer ran = (int)((Math.random()*9+1)*100000);
+		key = key +ran.toString();
+	//	key = key.substring(0, 24);
+		return key;
+	}
+
+
+	/**
+	 * 审批编号生成。
+	 * @return {String}
+	 */
+	public synchronized static String getApprovalNo() {
+		SimpleDateFormat format = new SimpleDateFormat("MMddHHmmss", Locale.getDefault());
+		Date date = new Date();
+		String key = format.format(date);
+		Integer ran = (int)((Math.random()*9+1)*100000);
+		key = ran.toString() + key;
+		//	key = key.substring(0, 24);
+		return key;
+	}
+
+	/**
+	 * 字符串格式化
+	 *
+	 * use: format("my name is {0}, and i like {1}!", "L.cm", "java")
+	 *
+	 * int long use {0,number,#}
+	 *
+	 * @param s
+	 * @param args
+	 * @return {String}转换后的字符串
+	 */
+	public static String format(String s, Object... args) {
+		return MessageFormat.format(s, args);
+	}
+
+	/**
+	 * 替换某个字符
+	 * @param str
+	 * @param regex
+	 * @param args
+	 * @return {String}
+	 */
+	public static String replace(String str,String regex,String... args){
+		int length = args.length;
+		for (int i = 0; i < length; i++) {
+			str=str.replaceFirst(regex, args[i]);
+		}
+		return str;
+	}
+
+	/**
+	 * 清理字符串,清理出某些不可见字符
+	 * @param txt
+	 * @return {String}
+	 */
+	public static String cleanChars(String txt) {
+		return txt.replaceAll("[  	`·•�\\f\\t\\v]", "");
+	}
+
+	/**
+	 *  随机字符串
+	 */
+	private static final String INT_TEMP = "0123456789";
+	private static final String STR_TEMP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+	private static final String ALL_TEMP = INT_TEMP + STR_TEMP;
+
+	private static final Random RANDOM = new Random();
+
+	/**
+	 * 生成的随机数类型
+	 */
+	public enum RandomType {
+		/**
+		 * 整数
+		 */
+		INT,
+		/**
+		 * 字符串
+		 */
+		STRING,
+		/**
+		 * 所有类型
+		 */
+		ALL
+	}
+
+	/**
+	 * 随机数生成
+	 * @param count
+	 * @return {String}
+	 */
+	public static String random(int count, RandomType randomType) {
+		if (count == 0) {
+			return "";
+		}
+		if (count < 0) {
+			throw new IllegalArgumentException("Requested random string length " + count + " is less than 0.");
+		}
+		char[] buffer = new char[count];
+		for (int i = 0; i < count; i++) {
+			if (randomType.equals(RandomType.INT)) {
+				buffer[i] = INT_TEMP.charAt(RANDOM.nextInt(INT_TEMP.length()));
+			} else if (randomType.equals(RandomType.STRING)) {
+				buffer[i] = STR_TEMP.charAt(RANDOM.nextInt(STR_TEMP.length()));
+			}else {
+				buffer[i] = ALL_TEMP.charAt(RANDOM.nextInt(ALL_TEMP.length()));
+			}
+		}
+		return new String(buffer);
+	}
+
+	public static void main(String[] args) {
+		System.out.println(random(32, RandomType.INT));
+	}
+}

+ 93 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/TimeZonesUtil.java

@@ -0,0 +1,93 @@
+package com.jpsoft.order.modules.common.utils;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2020-4-1 13:14
+ */
+public class TimeZonesUtil {
+    public static String getUpperTimeZone(String timeZones){
+        String timeZoneStr = timeZones.substring(0,timeZones.lastIndexOf("-")+1);
+        String minStr = timeZones.substring(timeZones.lastIndexOf("-")+1,timeZones.length());
+        String s = minStr.replace("",".");
+        Double minDou = Double.valueOf(s.substring(1,s.length()-1));
+        Double timeZoneMinDou = minDou;
+        String resultTimeZoneMinStr = "";
+        /*String timZoneMinStr = String.valueOf(timeZoneMinDou*10);
+        String resultTimeZoneMinStr = timZoneMinStr.substring(0,timZoneMinStr.indexOf("."));
+        if ("0".equals(resultTimeZoneMinStr)){
+            resultTimeZoneMinStr = resultTimeZoneMinStr+"0";
+        }*/
+        if (timeZoneMinDou.compareTo(0.5) ==-1){
+            resultTimeZoneMinStr ="00";
+        }
+        if (timeZoneMinDou.compareTo(0.5) !=-1 && timeZoneMinDou.compareTo(1.0) ==-1){
+            resultTimeZoneMinStr = "05";
+        }
+        if (timeZoneMinDou.compareTo(1.0) !=-1 && timeZoneMinDou.compareTo(1.5) ==-1){
+            resultTimeZoneMinStr = "10";
+        }
+        if (timeZoneMinDou.compareTo(1.5) !=-1 && timeZoneMinDou.compareTo(2.0) ==-1){
+            resultTimeZoneMinStr = "15";
+        }
+        if (timeZoneMinDou.compareTo(2.0) !=-1 && timeZoneMinDou.compareTo(2.5) ==-1){
+            resultTimeZoneMinStr = "20";
+        }
+        if (timeZoneMinDou.compareTo(2.5) !=-1 && timeZoneMinDou.compareTo(3.0) ==-1){
+            resultTimeZoneMinStr = "25";
+        }
+        if (timeZoneMinDou.compareTo(3.0) !=-1 && timeZoneMinDou.compareTo(3.5) ==-1){
+            resultTimeZoneMinStr = "30";
+        }
+        if (timeZoneMinDou.compareTo(3.5) !=-1 && timeZoneMinDou.compareTo(4.0) ==-1){
+            resultTimeZoneMinStr = "35";
+        }
+        if (timeZoneMinDou.compareTo(4.0) !=-1 && timeZoneMinDou.compareTo(4.5) ==-1){
+            resultTimeZoneMinStr = "40";
+        }
+        if (timeZoneMinDou.compareTo(4.5) !=-1 && timeZoneMinDou.compareTo(5.0) ==-1){
+            resultTimeZoneMinStr = "45";
+        }
+        if (timeZoneMinDou.compareTo(5.0) !=-1 && timeZoneMinDou.compareTo(5.5) ==-1){
+            resultTimeZoneMinStr = "50";
+        }
+        if (timeZoneMinDou.compareTo(5.5) !=-1 && timeZoneMinDou.compareTo(6.0) ==-1){
+            resultTimeZoneMinStr = "55";
+        }
+
+        String resultTimeZone = timeZoneStr + resultTimeZoneMinStr;
+
+        return resultTimeZone;
+    }
+
+    public static String parseSecond(Long second){
+        int h= Math.toIntExact(second / 3600);
+        int m= Math.toIntExact((second % 3600) / 60);
+        int s= Math.toIntExact((second % 3600) % 60);
+
+
+        return h+"时"+m+"分"+s+"秒";
+    }
+
+    public static String friendlyTimeFormat(long time){
+        long sec = 1000;
+        long min = 60*sec;
+
+        StringBuilder sb = new StringBuilder();
+
+        if (time>min) {
+            sb.append(String.format("%d分",time/min));
+        }
+
+        long remainder = time % min;
+
+        if (remainder>sec){
+            sb.append(String.format("%d秒",remainder/sec));
+        }
+
+        remainder = remainder % sec;
+
+        sb.append(String.format("%d毫秒",remainder));
+
+        return sb.toString();
+    }
+}

+ 218 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/WechatMessageUtil.java

@@ -0,0 +1,218 @@
+package com.jpsoft.order.modules.common.utils;
+
+import com.jpsoft.order.modules.wechat.entity.AccessToken;
+import lombok.extern.slf4j.Slf4j;
+import net.sf.json.JSONObject;
+import org.apache.commons.lang3.StringUtils;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+@Slf4j
+public class WechatMessageUtil {
+    public static final String send_template = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN";
+
+    /**
+     * 微信发送模版
+     *
+     * @param sendData   发送数据
+     * @param templateId 模版Id
+     * @param openId     发送人
+     * @param url        详情跳转地址
+     * @return
+     */
+    public static boolean sendTemplate(JSONObject sendData,String tokenUrl, String appId, String appSecret, String templateId, String openId, String url) {
+        boolean result = false;
+
+        AccessToken accessToken = WeixinUtil.getCommonAccessToken(tokenUrl, appId, appSecret);
+
+        if (accessToken != null) {
+            //发送模版内容
+            String sendTemplateUrl = send_template.replace("ACCESS_TOKEN", accessToken.getToken());
+
+            JSONObject sendTemplateData = new JSONObject();
+
+            sendTemplateData.put("touser", openId);
+            sendTemplateData.put("template_id", templateId);
+            sendTemplateData.put("url", url);
+            sendTemplateData.put("data", sendData);
+
+            log.warn("模版发送Id>>>>" + templateId + ">>>模版发送数据>>>>>" + sendTemplateData.toString());
+
+            String sendTemplateRet = HttpConnectionUtil.requestByPost(sendTemplateUrl, sendTemplateData.toString());
+
+            log.warn("模版发送返回数据>>>>>" + sendTemplateRet);
+
+            if (StringUtils.isNotBlank(sendTemplateRet)) {
+                JSONObject sendTemplateJson = JSONObject.fromObject(sendTemplateRet);
+
+                if ("0".equals(sendTemplateJson.getString("errcode"))) {
+                    //发送成功
+                    result = true;
+                }
+            }
+        }
+
+        return result;
+    }
+
+    public static String sendNativeTemplate(String tokenUrl,String appId,String appSecret,String templateId, String openId,JSONObject sendData,String urlPath) {
+        String result = "";
+
+        try {
+            AccessToken accessToken = WeixinUtil.getCommonAccessToken(tokenUrl,appId, appSecret);
+
+            if (accessToken == null) {
+                throw new Exception("token无法获取");
+            }
+
+            //发送模版内容
+            String sendTemplateUrl = send_template.replace("ACCESS_TOKEN", accessToken.getToken());
+
+            JSONObject sendTemplateData = new JSONObject();
+
+            sendTemplateData.put("touser", openId);
+            sendTemplateData.put("template_id", templateId);
+            sendTemplateData.put("url", urlPath);
+            sendTemplateData.put("data", sendData);
+
+            URL url = new URL(sendTemplateUrl);
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+            conn.setRequestMethod("POST");
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+            conn.setUseCaches(false);
+            conn.setRequestProperty("Connection", "Keep-Alive");
+            conn.setRequestProperty("Charset", "UTF-8");
+
+            // 设置文件类型:
+            conn.setRequestProperty("Content-Type","application/json; charset=UTF-8");
+
+            // 设置接收类型否则返回415错误
+            //conn.setRequestProperty("accept","*/*")此处为暴力方法设置接受所有类型,以此来防范返回415;
+            conn.setRequestProperty("accept","application/json");
+            conn.setConnectTimeout(5000);
+            conn.setReadTimeout(5000);
+
+            String dataStr = sendTemplateData.toString();
+
+            log.warn("发送数据:" + dataStr);
+            // 往服务器里面发送数据
+            byte[] buffer = dataStr.getBytes("UTF-8");
+
+            // 设置文件长度
+            conn.setRequestProperty("Content-Length", String.valueOf(buffer.length));
+            OutputStream output = conn.getOutputStream();
+            output.write(buffer);
+            output.flush();
+            output.close();
+
+            if (conn.getResponseCode() == 200) {
+                BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream(),"UTF-8"));
+
+                StringBuilder sb = new StringBuilder();
+                String line = "";
+
+                while ((line = reader.readLine()) != null) {
+                    sb.append(line);
+                }
+
+                result = sb.toString();
+
+                log.warn("接收数据:" + result);
+
+                reader.close();
+            }
+        } catch (Exception ex) {
+            log.error(ex.getMessage(),ex);
+        }
+
+        return result;
+    }
+
+    public static String getContent(String content) {
+        String finallyContent = content;
+        String regex = "<p.*?>(.*?)</p>";
+        Pattern p = Pattern.compile(regex);
+        Matcher m = p.matcher(content);
+        while (m.find()) {
+            finallyContent = m.group(1);
+        }
+
+
+        return finallyContent;
+    }
+
+    /**
+     * 微信发送模版
+     * @return
+     */
+    public static boolean sendMessageTemplate(String userName,String content,
+                                           String sendRemark,
+                                           String sendDate,
+                                           String openId, String templateId,String tokenUrl, String appId, String appSecret) {
+        JSONObject sendData = new JSONObject();
+
+        JSONObject first = new JSONObject();
+        first.put("value", "审核结果通知");
+        first.put("color", "#FF0000");
+
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", userName);
+        keyword1.put("color", "#173177");
+
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", content);
+        keyword2.put("color", "#173177");
+
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", sendDate);
+        keyword3.put("color", "#173177");
+
+        JSONObject remark = new JSONObject();
+        remark.put("value", sendRemark);
+        remark.put("color", "#173177");
+
+        sendData.put("first", first);
+        sendData.put("keyword1", keyword1);
+        sendData.put("keyword2", keyword2);
+        sendData.put("keyword3", keyword3);
+        sendData.put("remark", remark);
+
+        //w8Zk_VQMFIEVSIBPZid7zSrvHmBdrgnqF76u8PLCZEs cs
+        boolean ret = sendTemplate(sendData,tokenUrl, appId, appSecret, templateId, openId, "");
+
+        return ret;
+    }
+
+
+    public static void main(String[] args) {
+		/*AccessToken at = WeixinUtil.getCommonAccessToken(APP_ID, APP_SECRET,"061iw9gy1sZ1dg09dqhy1ae3gy1iw9gq");
+
+		System.out.println(at.getOpenid());*/
+
+		/*for (int i = 0; i < 1; i++) {
+			doorMessage("1111", 2,"2018-09-22 09:00-12:00", 1, "2222222", "3333333", "oiFbN0p9jKphExeGIa3HtyL9HjqM");
+		}*/
+
+        //orderConfirmMessage("12312321312", 1111, DEFAULT_OPEN_ID);
+        //sendBillInfo("测试", "测sendNoticeMessage试", "荆鹏创业", "张三", new BigDecimal(1), "o64fbt6TTUcqLC_tyVJ60I5kzWVc", "1111", new Date());
+        //sendBillPayedMessage("测试", "荆鹏创业", "张三", new BigDecimal(1), "o64fbt6TTUcqLC_tyVJ60I5kzWVc", "11111", new Date());
+        //sendScanPayedMessage("测试", "荆鹏创业", "张三11111", new BigDecimal(1), "o64fbt6TTUcqLC_tyVJ60I5kzWVc", "11111", new Date());
+//sendNoticeMessage("测试", "sdfsdfasfasdfafasdfasdf", "oHjCawgwCGen5k1-hAsimdEX5lZo", "2222","9JKu9t9uTPHL1siIm7WatOJ1KXGolzEPlnmqIbckTUM","wx41ac6791b9dbcf52","3e3d47c5f132d4b47636a536d503fbd4");
+
+	/*	sendBillInfo("1栋-1单元-101",new BigDecimal("0.01"),"oOlFd1BUR6Fi2ayBWUeou81G8ZD4",
+				"物业费","小鹏物业","测试","9e52c923-2179-4526-a108-32becc9aa1d0","vVraOPl4OyNVWDGz6XYlJqRb7qGjjcyJdnVi5HWmFRI","wx41ac6791b9dbcf52","3e3d47c5f132d4b47636a536d503fbd4");*/
+
+        /*sendBillPayedMessage("1栋-1单元-101","物业费",new Date(),new BigDecimal("0.01"),"oOlFd1BUR6Fi2ayBWUeou81G8ZD4","33e7e5e6-5b38-45f5-9ccf-c7ef21978a5b","kbx5u70nzo7PklTVl4B1xvRffksrUtXxnDll8ggEKlo","wx41ac6791b9dbcf52","3e3d47c5f132d4b47636a536d503fbd4");*/
+
+        //sendAlarmNoticeMessage("周界入侵警报", "周界入侵,目标ID:1419,区域范围:(0.327,0.698)(0.674,0.936)(0.67,0.985)(0.352,0.973)", "oHjCawgwCGen5k1-hAsimdEX5lZo", "","8dpP8XM1XaiiIByXiuAeFIZeNjEow1AleG_h8O2xyVA","wx7e70eb62a8459869","909d17e353268da57c4f18cc09798049");
+        //sendNoticeMessage("测试", "sdfsdfasfasdfafasdfasdf", "oHjCawgwCGen5k1-hAsimdEX5lZo", "2222","vsw6sb9lMA3bcsE8MdeaGENvI1HSUy2ht9B8hS3jEzA","wx7e70eb62a8459869","909d17e353268da57c4f18cc09798049");
+//        sendTemperatureAlarmInfo("oLowyuOQ9ULF3LUGt6h3fTrsnbVE", "荆鹏软件_门房考勤机", "wx0b3c41a903053808", "43557bd62f77b0c3d6670e991872f0e7", "Mg9Ldk_kaoHAUwXFHEatrGugTlOz3yrMmMk7VoBca4M");
+//        getContent("<p>内容</p>");
+    }
+}

+ 327 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/WeixinUtil.java

@@ -0,0 +1,327 @@
+package com.jpsoft.order.modules.common.utils;
+
+import cn.hutool.core.date.DateTime;
+import com.jpsoft.order.modules.wechat.entity.AccessToken;
+import com.jpsoft.order.modules.wechat.vo.UserInfo;
+import net.sf.json.JSONArray;
+import net.sf.json.JSONException;
+import net.sf.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.stream.Collectors;
+
+/**
+ * 公众平台通用接口工具类
+ *
+ * @author lt
+ * @date 2013-08-09
+ */
+public class WeixinUtil {
+	private static Logger log = LoggerFactory.getLogger(WeixinUtil.class);
+
+	// 获取access_token的接口地址(GET) https://api.weixin.qq.com/cgi-bin/token 限2000(次/天)
+//	public final static String access_token_url = "http://ykt.xiaoxinda.com/weixin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
+//	public final static String access_token_url = "http://192.168.0.1:8080/weixin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
+
+	//获取微信的code
+	public static String code = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect";
+	public static String getCodeRequest(String appid, String url,String scope){
+        String result = null;
+        String url_encode = "";
+        try {
+			url_encode = java.net.URLEncoder.encode(url, "utf-8");
+		} catch (UnsupportedEncodingException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+        result  = code.replace("APPID", appid).replace("REDIRECT_URI",url_encode).replace("SCOPE", scope);
+        return result;
+    }
+
+	//通过code换取网页授权access_token
+	public static String accessTokenurl = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
+	public static AccessToken getAccessToken(String appid, String appsecret,String code) throws Exception {
+        AccessToken accessToken = null;
+        String formatUrl = accessTokenurl.replace("APPID", appid).replace("SECRET",appsecret).replace("CODE", code);
+        JSONObject json  = HttpConnectionUtil.httpRequest(formatUrl, "GET", null);
+        if (!json.isNullObject() && !json.isEmpty()) {
+			try {
+				accessToken = new AccessToken();
+				accessToken.setToken(json.getString("access_token"));
+				accessToken.setExpiresIn(json.getInt("expires_in"));
+				accessToken.setOpenid(json.getString("openid"));
+				accessToken.setScope(json.getString("scope"));
+			} catch (Exception e) {
+
+				// 获取token失败
+				log.error("获取token失败,返回结果result={}", json);
+				if (json.getString("errcode").equals("40163")){
+					throw new Exception("请重新扫码");
+
+				}
+
+			}
+		}
+        return accessToken;
+    }
+
+	public static String jsAccessTokenUrl = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type=jsapi";
+	public static String getJsAPI(String accessToken){
+		String formatUrl = jsAccessTokenUrl.replace("ACCESS_TOKEN", accessToken);
+        JSONObject json  = HttpConnectionUtil.httpRequest(formatUrl, "GET", null);
+
+        if (!json.isNullObject() && !json.isEmpty()) {
+			try {
+				return json.getString("ticket");
+			} catch (Exception e) {
+				// 获取token失败
+				log.error("获取jsAPI失败,返回结果result={}", json);
+			}
+		}
+
+        return null;
+	}
+
+	/**
+	 * 获取access_token
+	 *
+	 * @param appid 凭证
+	 * @param appsecret 密钥
+	 * @return
+	 */
+	public static AccessToken getCommonAccessToken(String tokenUrl,String appid, String appsecret) {
+		AccessToken accessToken = null;
+
+		String requestUrl = tokenUrl.replace("APPID", appid).replace("APPSECRET", appsecret);
+//			String commonAccessTokenUrl = "http://ykt.xiaoxinda.com/weixin/token"
+//			String requestUrl = commonAccessTokenUrl
+//					+ "?grant_type=client_credential"
+//					+ "&appid=" + appid
+//					+ "&secret=" + appsecret;
+		JSONObject jsonObject =HttpConnectionUtil.httpRequest(requestUrl, "GET", null);
+		// 如果请求成功
+		if (null != jsonObject) {
+			try {
+				accessToken = new AccessToken();
+				accessToken.setToken(jsonObject.getString("access_token"));
+				accessToken.setExpiresIn(jsonObject.getInt("expires_in"));
+				//accessToken.setOpenid(jsonObject.getString("openid"));
+			} catch (JSONException e) {
+				accessToken = null;
+				// 获取token失败
+				log.error("获取token失败 errcode:{} errmsg:{}", jsonObject.getInt("errcode"), jsonObject.getString("errmsg"));
+			}
+		}
+
+
+		return accessToken;
+	}
+
+	// 获取用户信息
+	public static String user_info_url = "https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN";
+	public static String subscribe_user_info_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN ";
+
+	public static UserInfo getUserInfo(String openid, String accessToken) {
+		// 拼装url
+		String url = user_info_url.replace("ACCESS_TOKEN", accessToken).replace("OPENID", openid);;
+
+		JSONObject jsonObject = HttpConnectionUtil.httpRequest(url, "GET", null);
+
+		UserInfo userInfo = null;
+		 if (null != jsonObject) {
+				try {
+					userInfo = new UserInfo();
+					userInfo.setOpenid(jsonObject.getString("openid").replaceAll("\"", ""));
+
+					userInfo.setNickname(jsonObject.getString("nickname").replaceAll("\"", ""));
+					userInfo.setCity(jsonObject.getString("city").replaceAll("\"", ""));
+					userInfo.setProvince(jsonObject.getString("province").replaceAll("\"", ""));
+					userInfo.setCountry(jsonObject.getString("country").replaceAll("\"", ""));
+					userInfo.setHeadimgurl(jsonObject.getString("headimgurl").replaceAll("\"", ""));
+				} catch (JSONException e) {
+					// 获取token失败
+					log.error("获取token失败 errcode:{} errmsg:{}", jsonObject.getInt("errcode"), jsonObject.getString("errmsg"));
+				}
+			}
+		return userInfo;
+	}
+
+	public static boolean checkSignature(String token,String signature, String timestamp, String nonce) {
+		String[] arr = new String[] { token, timestamp, nonce };
+
+		String content = Arrays.stream(arr)
+				.sorted(Comparator.naturalOrder())
+				.collect(Collectors.joining());
+
+		MessageDigest md = null;
+		String tmpStr = null;
+
+		try {
+			md = MessageDigest.getInstance("SHA-1");
+			// 将三个参数字符串拼接成一个字符串进行sha1加密
+			byte[] digest = md.digest(content.getBytes("UTF-8"));
+
+			StringBuffer hexstr = new StringBuffer();
+
+			String shaHex = "";
+
+			for (int i = 0; i < digest.length; i++) {
+				shaHex = Integer.toHexString(digest[i] & 0xFF);
+				if (shaHex.length() < 2) {
+					hexstr.append(0);
+				}
+				hexstr.append(shaHex);
+			}
+
+			tmpStr = hexstr.toString();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+		// 将sha1加密后的字符串可与signature对比,标识该请求来源于微信
+		return signature.equals(tmpStr);
+	}
+
+	public static cn.hutool.json.JSONObject xmlToJson(ServletInputStream inputStream) throws Exception {
+		cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject();
+
+		// 创建sax解析工厂
+		SAXParserFactory factory = SAXParserFactory.newInstance();
+		// 创建sax转换工具
+		SAXParser saxParser = factory.newSAXParser();
+
+		saxParser.parse(inputStream,new DefaultHandler(){
+			private String tagName;
+
+			@Override
+			public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+				tagName = qName;
+			}
+
+			@Override
+			public void endElement(String uri, String localName, String qName) throws SAXException {
+				tagName = null;
+			}
+
+			@Override
+			public void characters(char[] ch, int start, int length) throws SAXException {
+				if(tagName!=null){
+					String content = new String(ch,start,length);
+					jsonObject.put(tagName,content);
+				}
+			}
+		});
+
+		return jsonObject;
+	}
+	public static void replyTextMessage(HttpServletResponse response, String fromUserName, String toUserName, String content){
+		StringBuilder sb = new StringBuilder();
+
+		sb.append("<xml>");
+		sb.append("<ToUserName><![CDATA[" + toUserName + "]]></ToUserName>");
+		sb.append("<FromUserName><![CDATA["+ fromUserName + "]]></FromUserName>");
+		sb.append("<CreateTime>" + DateTime.now().getTime() + "</CreateTime>");
+		sb.append("<MsgType><![CDATA[text]]></MsgType>");
+		sb.append("<Content><![CDATA[" + content + "]]></Content>");
+		sb.append("</xml>");
+
+		try {
+			response.getWriter().print(sb.toString());
+			response.getWriter().close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+	public static void replyArticlesMessage(HttpServletResponse response, String fromUserName, String toUserName, String title,String description,String picurl,String url){
+		StringBuilder sb = new StringBuilder();
+		sb.append("<xml>");
+		sb.append("<ToUserName><![CDATA[" + toUserName + "]]></ToUserName>");
+		sb.append("<FromUserName><![CDATA["+ fromUserName + "]]></FromUserName>");
+		sb.append("<CreateTime>" + DateTime.now().getTime() + "</CreateTime>");
+		sb.append("<MsgType><![CDATA[news]]></MsgType>");
+		sb.append("<ArticleCount>" + 1 + "</ArticleCount>");
+		sb.append("<Articles>");
+		sb.append("<item>");
+		sb.append("<Title><![CDATA["+title+"]]></Title> ");
+		sb.append("<Description><![CDATA["+description+"]]></Description>");
+		sb.append("<PicUrl><![CDATA["+picurl+"]]></PicUrl>");
+		sb.append("<Url><![CDATA["+url+"]]></Url>");
+		sb.append("</item>");
+		sb.append("</Articles>");
+		sb.append("</xml>");
+
+		try {
+			response.getWriter().print(sb.toString());
+			response.getWriter().close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+
+	/**
+	 * 创建微信菜单
+	 * @param appid
+	 * @param appSecret
+	 * @return
+	 */
+	public static String createMenu(String tokenUrl,String appid,String appSecret){
+		AccessToken token = WeixinUtil.getCommonAccessToken(tokenUrl,appid, appSecret);
+
+		System.out.println(token.getToken());
+
+		JSONObject data = new JSONObject();
+		JSONArray buttonArray = new JSONArray();
+
+		JSONObject button1 = new JSONObject();
+		button1.put("type", "view");
+		button1.put("name", "疫情监管");
+		button1.put("url", "http://wisdomhousewechat.sudaonline.net/prevention/");
+		buttonArray.add(button1);
+
+		JSONObject button2 = new JSONObject();
+		button2.put("type","view");
+		button2.put("name","智慧物业");
+		button2.put("url","http://wisdomhousewechat.sudaonline.net/#/home/?id=1");
+		buttonArray.add(button2);
+
+		JSONObject button3 = new JSONObject();
+		button3.put("type","click");
+		button3.put("name","关于系统");
+		button3.put("key","文章");
+		buttonArray.add(button3);
+
+		data.put("button", buttonArray);
+		data.put("action_name", "QR_LIMIT_STR_SCENE");
+
+		JSONObject actionInfo = new JSONObject();
+		JSONObject scene = new JSONObject();
+
+		scene.put("scene_str", "6");
+
+		actionInfo.put("scene", scene);
+
+		data.put("action_info", actionInfo);
+		System.out.println(data.toString());
+		//创建菜单
+		String result = HttpConnectionUtil.getHttpContentByPost(" https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + token.getToken(), "utf-8", data.toString());
+
+		return result;
+	}
+
+
+}

+ 60 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/enterprise/AesException.java

@@ -0,0 +1,60 @@
+package com.jpsoft.order.modules.common.utils.enterprise;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2020-4-1 11:52
+ */
+public class AesException extends Exception{
+    public final static int OK = 0;
+    public final static int ValidateSignatureError = -40001;
+    public final static int ParseXmlError = -40002;
+    public final static int ComputeSignatureError = -40003;
+    public final static int IllegalAesKey = -40004;
+    public final static int ValidateCorpidError = -40005;
+    public final static int EncryptAESError = -40006;
+    public final static int DecryptAESError = -40007;
+    public final static int IllegalBuffer = -40008;
+    //public final static int EncodeBase64Error = -40009;
+    //public final static int DecodeBase64Error = -40010;
+    //public final static int GenReturnXmlError = -40011;
+
+    private int code;
+
+    private static String getMessage(int code) {
+        switch (code) {
+            case ValidateSignatureError:
+                return "签名验证错误";
+            case ParseXmlError:
+                return "xml解析失败";
+            case ComputeSignatureError:
+                return "sha加密生成签名失败";
+            case IllegalAesKey:
+                return "SymmetricKey非法";
+            case ValidateCorpidError:
+                return "corpid校验失败";
+            case EncryptAESError:
+                return "aes加密失败";
+            case DecryptAESError:
+                return "aes解密失败";
+            case IllegalBuffer:
+                return "解密后得到的buffer非法";
+//		case EncodeBase64Error:
+//			return "base64加密错误";
+//		case DecodeBase64Error:
+//			return "base64解密错误";
+//		case GenReturnXmlError:
+//			return "xml生成失败";
+            default:
+                return null; // cannot be
+        }
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    AesException(int code) {
+        super(getMessage(code));
+        this.code = code;
+    }
+}

+ 26 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/enterprise/ByteGroup.java

@@ -0,0 +1,26 @@
+package com.jpsoft.order.modules.common.utils.enterprise;
+
+import java.util.ArrayList;
+
+class ByteGroup {
+	ArrayList<Byte> byteContainer = new ArrayList<Byte>();
+
+	public byte[] toBytes() {
+		byte[] bytes = new byte[byteContainer.size()];
+		for (int i = 0; i < byteContainer.size(); i++) {
+			bytes[i] = byteContainer.get(i);
+		}
+		return bytes;
+	}
+
+	public ByteGroup addBytes(byte[] bytes) {
+		for (byte b : bytes) {
+			byteContainer.add(b);
+		}
+		return this;
+	}
+
+	public int size() {
+		return byteContainer.size();
+	}
+}

+ 67 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/enterprise/PKCS7Encoder.java

@@ -0,0 +1,67 @@
+/**
+ * 对公众平台发送给公众账号的消息加解密示例代码.
+ *
+ * @copyright Copyright (c) 1998-2014 Tencent Inc.
+ */
+
+// ------------------------------------------------------------------------
+
+package com.jpsoft.order.modules.common.utils.enterprise;
+
+import java.nio.charset.Charset;
+import java.util.Arrays;
+
+/**
+ * 提供基于PKCS7算法的加解密接口.
+ */
+class PKCS7Encoder {
+	static Charset CHARSET = Charset.forName("utf-8");
+	static int BLOCK_SIZE = 32;
+
+	/**
+	 * 获得对明文进行补位填充的字节.
+	 *
+	 * @param count 需要进行填充补位操作的明文字节个数
+	 * @return 补齐用的字节数组
+	 */
+	static byte[] encode(int count) {
+		// 计算需要填充的位数
+		int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE);
+		if (amountToPad == 0) {
+			amountToPad = BLOCK_SIZE;
+		}
+		// 获得补位所用的字符
+		char padChr = chr(amountToPad);
+		String tmp = new String();
+		for (int index = 0; index < amountToPad; index++) {
+			tmp += padChr;
+		}
+		return tmp.getBytes(CHARSET);
+	}
+
+	/**
+	 * 删除解密后明文的补位字符
+	 *
+	 * @param decrypted 解密后的明文
+	 * @return 删除补位字符后的明文
+	 */
+	static byte[] decode(byte[] decrypted) {
+		int pad = (int) decrypted[decrypted.length - 1];
+		if (pad < 1 || pad > 32) {
+			pad = 0;
+		}
+		return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad);
+	}
+
+	/**
+	 * 将数字转化成ASCII码对应的字符,用于对明文进行补码
+	 *
+	 * @param a 需要转化的数字
+	 * @return 转化得到的字符
+	 */
+	static char chr(int a) {
+		byte target = (byte) (a & 0xFF);
+		return (char) target;
+	}
+
+}

+ 61 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/enterprise/SHA1.java

@@ -0,0 +1,61 @@
+/**
+ * 对公众平台发送给公众账号的消息加解密示例代码.
+ *
+ * @copyright Copyright (c) 1998-2014 Tencent Inc.
+ */
+
+// ------------------------------------------------------------------------
+
+package com.jpsoft.order.modules.common.utils.enterprise;
+
+import java.security.MessageDigest;
+import java.util.Arrays;
+
+/**
+ * SHA1 class
+ *
+ * 计算公众平台的消息签名接口.
+ */
+class SHA1 {
+
+	/**
+	 * 用SHA1算法生成安全签名
+	 * @param token 票据
+	 * @param timestamp 时间戳
+	 * @param nonce 随机字符串
+	 * @param encrypt 密文
+	 * @return 安全签名
+	 * @throws AesException
+	 */
+	public static String getSHA1(String token, String timestamp, String nonce, String encrypt) throws AesException
+			  {
+		try {
+			String[] array = new String[] { token, timestamp, nonce, encrypt };
+			StringBuffer sb = new StringBuffer();
+			// 字符串排序
+			Arrays.sort(array);
+			for (int i = 0; i < 4; i++) {
+				sb.append(array[i]);
+			}
+			String str = sb.toString();
+			// SHA1签名生成
+			MessageDigest md = MessageDigest.getInstance("SHA-1");
+			md.update(str.getBytes());
+			byte[] digest = md.digest();
+
+			StringBuffer hexstr = new StringBuffer();
+			String shaHex = "";
+			for (int i = 0; i < digest.length; i++) {
+				shaHex = Integer.toHexString(digest[i] & 0xFF);
+				if (shaHex.length() < 2) {
+					hexstr.append(0);
+				}
+				hexstr.append(shaHex);
+			}
+			return hexstr.toString();
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw new AesException(AesException.ComputeSignatureError);
+		}
+	}
+}

+ 291 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/enterprise/WXBizMsgCrypt.java

@@ -0,0 +1,291 @@
+package com.jpsoft.order.modules.common.utils.enterprise; /**
+ * 对公众平台发送给公众账号的消息加解密示例代码.
+ *
+ * @copyright Copyright (c) 1998-2014 Tencent Inc.
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * 针对org.apache.commons.codec.binary.Base64,
+ * 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
+ * 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
+ */
+
+
+
+import org.apache.commons.codec.binary.Base64;
+
+import java.nio.charset.Charset;
+import java.util.Arrays;
+import java.util.Random;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+
+
+/**
+ * 提供接收和推送给公众平台消息的加解密接口(UTF8编码的字符串).
+ * <ol>
+ * 	<li>第三方回复加密消息给公众平台</li>
+ * 	<li>第三方收到公众平台发送的消息,验证消息的安全性,并对消息进行解密。</li>
+ * </ol>
+ * 说明:异常java.security.InvalidKeyException:illegal Key Size的解决方案
+ * <ol>
+ * 	<li>在官方网站下载JCE无限制权限策略文件(JDK7的下载地址:
+ *      http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html</li>
+ * 	<li>下载后解压,可以看到local_policy.jar和US_export_policy.jar以及readme.txt</li>
+ * 	<li>如果安装了JRE,将两个jar文件放到%JRE_HOME%\lib\security目录下覆盖原来的文件</li>
+ * 	<li>如果安装了JDK,将两个jar文件放到%JDK_HOME%\jre\lib\security目录下覆盖原来文件</li>
+ * </ol>
+ */
+public class WXBizMsgCrypt {
+    static Charset CHARSET = Charset.forName("utf-8");
+    Base64 base64 = new Base64();
+    byte[] aesKey;
+    String token;
+    String corpId;
+
+    /**
+     * 构造函数
+     * @param token 公众平台上,开发者设置的token
+     * @param encodingAesKey 公众平台上,开发者设置的EncodingAESKey
+     * @param corpId 企业的corpid
+     *
+     * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
+     */
+    public WXBizMsgCrypt(String token, String encodingAesKey, String corpId) throws AesException {
+        if (encodingAesKey.length() != 43) {
+            throw new AesException(AesException.IllegalAesKey);
+        }
+
+        this.token = token;
+        this.corpId = corpId;
+        aesKey = Base64.decodeBase64(encodingAesKey);
+    }
+
+    // 生成4个字节的网络字节序
+    byte[] getNetworkBytesOrder(int sourceNumber) {
+        byte[] orderBytes = new byte[4];
+        orderBytes[3] = (byte) (sourceNumber & 0xFF);
+        orderBytes[2] = (byte) (sourceNumber >> 8 & 0xFF);
+        orderBytes[1] = (byte) (sourceNumber >> 16 & 0xFF);
+        orderBytes[0] = (byte) (sourceNumber >> 24 & 0xFF);
+        return orderBytes;
+    }
+
+    // 还原4个字节的网络字节序
+    int recoverNetworkBytesOrder(byte[] orderBytes) {
+        int sourceNumber = 0;
+        for (int i = 0; i < 4; i++) {
+            sourceNumber <<= 8;
+            sourceNumber |= orderBytes[i] & 0xff;
+        }
+        return sourceNumber;
+    }
+
+    // 随机生成16位字符串
+    String getRandomStr() {
+        String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+        Random random = new Random();
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0; i < 16; i++) {
+            int number = random.nextInt(base.length());
+            sb.append(base.charAt(number));
+        }
+        return sb.toString();
+    }
+
+    /**
+     * 对明文进行加密.
+     *
+     * @param text 需要加密的明文
+     * @return 加密后base64编码的字符串
+     * @throws AesException aes加密失败
+     */
+    String encrypt(String randomStr, String text) throws AesException {
+        ByteGroup byteCollector = new ByteGroup();
+        byte[] randomStrBytes = randomStr.getBytes(CHARSET);
+        byte[] textBytes = text.getBytes(CHARSET);
+        byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length);
+        byte[] corpidBytes = corpId.getBytes(CHARSET);
+
+        // randomStr + networkBytesOrder + text + corpid
+        byteCollector.addBytes(randomStrBytes);
+        byteCollector.addBytes(networkBytesOrder);
+        byteCollector.addBytes(textBytes);
+        byteCollector.addBytes(corpidBytes);
+
+        // ... + pad: 使用自定义的填充方式对明文进行补位填充
+        byte[] padBytes = PKCS7Encoder.encode(byteCollector.size());
+        byteCollector.addBytes(padBytes);
+
+        // 获得最终的字节流, 未加密
+        byte[] unencrypted = byteCollector.toBytes();
+
+        try {
+            // 设置加密模式为AES的CBC模式
+            Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
+            SecretKeySpec keySpec = new SecretKeySpec(aesKey, "AES");
+            IvParameterSpec iv = new IvParameterSpec(aesKey, 0, 16);
+            cipher.init(Cipher.ENCRYPT_MODE, keySpec, iv);
+
+            // 加密
+            byte[] encrypted = cipher.doFinal(unencrypted);
+
+            // 使用BASE64对加密后的字符串进行编码
+            String base64Encrypted = base64.encodeToString(encrypted);
+
+            return base64Encrypted;
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new AesException(AesException.EncryptAESError);
+        }
+    }
+
+    /**
+     * 对密文进行解密.
+     *
+     * @param text 需要解密的密文
+     * @return 解密得到的明文
+     * @throws AesException aes解密失败
+     */
+    String decrypt(String text) throws AesException {
+        byte[] original;
+        try {
+            // 设置解密模式为AES的CBC模式
+            Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
+            SecretKeySpec key_spec = new SecretKeySpec(aesKey, "AES");
+            IvParameterSpec iv = new IvParameterSpec(Arrays.copyOfRange(aesKey, 0, 16));
+            cipher.init(Cipher.DECRYPT_MODE, key_spec, iv);
+
+            // 使用BASE64对密文进行解码
+            byte[] encrypted = Base64.decodeBase64(text);
+
+            // 解密
+            original = cipher.doFinal(encrypted);
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new AesException(AesException.DecryptAESError);
+        }
+
+        String xmlContent, from_corpid;
+        try {
+            // 去除补位字符
+            byte[] bytes = PKCS7Encoder.decode(original);
+
+            // 分离16位随机字符串,网络字节序和corpId
+            byte[] networkOrder = Arrays.copyOfRange(bytes, 16, 20);
+
+            int xmlLength = recoverNetworkBytesOrder(networkOrder);
+
+            xmlContent = new String(Arrays.copyOfRange(bytes, 20, 20 + xmlLength), CHARSET);
+            from_corpid = new String(Arrays.copyOfRange(bytes, 20 + xmlLength, bytes.length),
+                    CHARSET);
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new AesException(AesException.IllegalBuffer);
+        }
+
+        // corpid不相同的情况
+        if (!from_corpid.equals(corpId)) {
+            throw new AesException(AesException.ValidateCorpidError);
+        }
+        return xmlContent;
+
+    }
+
+    /**
+     * 将公众平台回复用户的消息加密打包.
+     * <ol>
+     * 	<li>对要发送的消息进行AES-CBC加密</li>
+     * 	<li>生成安全签名</li>
+     * 	<li>将消息密文和安全签名打包成xml格式</li>
+     * </ol>
+     *
+     * @param replyMsg 公众平台待回复用户的消息,xml格式的字符串
+     * @param timeStamp 时间戳,可以自己生成,也可以用URL参数的timestamp
+     * @param nonce 随机串,可以自己生成,也可以用URL参数的nonce
+     *
+     * @return 加密后的可以直接回复用户的密文,包括msg_signature, timestamp, nonce, encrypt的xml格式的字符串
+     * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
+     */
+    public String EncryptMsg(String replyMsg, String timeStamp, String nonce) throws AesException {
+        // 加密
+        String encrypt = encrypt(getRandomStr(), replyMsg);
+
+        // 生成安全签名
+        if (timeStamp == "") {
+            timeStamp = Long.toString(System.currentTimeMillis());
+        }
+
+        String signature = SHA1.getSHA1(token, timeStamp, nonce, encrypt);
+
+        // System.out.println("发送给平台的签名是: " + signature[1].toString());
+        // 生成发送的xml
+        String result = XMLParse.generate(encrypt, signature, timeStamp, nonce);
+        return result;
+    }
+
+    /**
+     * 检验消息的真实性,并且获取解密后的明文.
+     * <ol>
+     * 	<li>利用收到的密文生成安全签名,进行签名验证</li>
+     * 	<li>若验证通过,则提取xml中的加密消息</li>
+     * 	<li>对消息进行解密</li>
+     * </ol>
+     *
+     * @param msgSignature 签名串,对应URL参数的msg_signature
+     * @param timeStamp 时间戳,对应URL参数的timestamp
+     * @param nonce 随机串,对应URL参数的nonce
+     * @param postData 密文,对应POST请求的数据
+     *
+     * @return 解密后的原文
+     * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
+     */
+    public String DecryptMsg(String msgSignature, String timeStamp, String nonce, String postData)
+            throws AesException {
+
+        // 密钥,公众账号的app secret
+        // 提取密文
+        Object[] encrypt = XMLParse.extract(postData);
+
+        // 验证安全签名
+        String signature = SHA1.getSHA1(token, timeStamp, nonce, encrypt[1].toString());
+
+        // 和URL中的签名比较是否相等
+        // System.out.println("第三方收到URL中的签名:" + msg_sign);
+        // System.out.println("第三方校验签名:" + signature);
+        if (!signature.equals(msgSignature)) {
+            throw new AesException(AesException.ValidateSignatureError);
+        }
+
+        // 解密
+        String result = decrypt(encrypt[1].toString());
+        return result;
+    }
+
+    /**
+     * 验证URL
+     * @param msgSignature 签名串,对应URL参数的msg_signature
+     * @param timeStamp 时间戳,对应URL参数的timestamp
+     * @param nonce 随机串,对应URL参数的nonce
+     * @param echoStr 随机串,对应URL参数的echostr
+     *
+     * @return 解密之后的echostr
+     * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
+     */
+    public String VerifyURL(String msgSignature, String timeStamp, String nonce, String echoStr)
+            throws AesException {
+        String signature = SHA1.getSHA1(token, timeStamp, nonce, echoStr);
+
+        if (!signature.equals(msgSignature)) {
+            throw new AesException(AesException.ValidateSignatureError);
+        }
+
+        String result = decrypt(echoStr);
+        return result;
+    }
+
+}

+ 72 - 0
common/src/main/java/com/jpsoft/order/modules/common/utils/enterprise/XMLParse.java

@@ -0,0 +1,72 @@
+/**
+ * 对公众平台发送给公众账号的消息加解密示例代码.
+ *
+ * @copyright Copyright (c) 1998-2014 Tencent Inc.
+ */
+
+// ------------------------------------------------------------------------
+
+package com.jpsoft.order.modules.common.utils.enterprise;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+/**
+ * XMLParse class
+ *
+ * 提供提取消息格式中的密文及生成回复消息格式的接口.
+ */
+class XMLParse {
+
+	/**
+	 * 提取出xml数据包中的加密消息
+	 * @param xmltext 待提取的xml字符串
+	 * @return 提取出的加密消息字符串
+	 * @throws AesException
+	 */
+	public static Object[] extract(String xmltext) throws AesException     {
+		Object[] result = new Object[3];
+		try {
+			DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+			DocumentBuilder db = dbf.newDocumentBuilder();
+			StringReader sr = new StringReader(xmltext);
+			InputSource is = new InputSource(sr);
+			Document document = db.parse(is);
+
+			Element root = document.getDocumentElement();
+			NodeList nodelist1 = root.getElementsByTagName("Encrypt");
+			NodeList nodelist2 = root.getElementsByTagName("ToUserName");
+			result[0] = 0;
+			result[1] = nodelist1.item(0).getTextContent();
+			result[2] = nodelist2.item(0).getTextContent();
+			return result;
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw new AesException(AesException.ParseXmlError);
+		}
+	}
+
+	/**
+	 * 生成xml消息
+	 * @param encrypt 加密后的消息密文
+	 * @param signature 安全签名
+	 * @param timestamp 时间戳
+	 * @param nonce 随机字符串
+	 * @return 生成的xml字符串
+	 */
+	public static String generate(String encrypt, String signature, String timestamp, String nonce) {
+
+		String format = "<xml>\n" + "<Encrypt><![CDATA[%1$s]]></Encrypt>\n"
+				+ "<MsgSignature><![CDATA[%2$s]]></MsgSignature>\n"
+				+ "<TimeStamp>%3$s</TimeStamp>\n" + "<Nonce><![CDATA[%4$s]]></Nonce>\n" + "</xml>";
+		return String.format(format, encrypt, signature, timestamp, nonce);
+
+	}
+}

+ 32 - 0
common/src/main/java/com/jpsoft/order/modules/sys/dao/DataDictionaryDAO.java

@@ -0,0 +1,32 @@
+package com.jpsoft.order.modules.sys.dao;
+
+import com.jpsoft.order.modules.common.dto.Sort;
+import com.jpsoft.order.modules.sys.entity.DataDictionary;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+
+@Repository
+public interface DataDictionaryDAO {
+	int insert(DataDictionary entity);
+	int update(DataDictionary entity);
+	int exist(String id);
+	DataDictionary get(String id);
+	int delete(String id);
+	String getName(String id);
+	String getValue(String id);
+	List<DataDictionary> list();
+	List<DataDictionary> findByParentId(String parentId);
+	DataDictionary findByParentIdAndValue(String parentId,String value);
+	List<Map<String, Object>> queryChildren(String parentId);
+	List<DataDictionary> search(Map<String, Object> searchParams, List<Sort> sortList);
+
+	List<DataDictionary> findByCatalogName(String catalogName);
+
+	String findNameByCatalogNameAndValue(String catalogName,String value);
+	DataDictionary findByCatalogNameAndValue(String catalogName,String value);
+
+    DataDictionary findByName(String name);
+}

+ 21 - 0
common/src/main/java/com/jpsoft/order/modules/sys/dao/MenuDAO.java

@@ -0,0 +1,21 @@
+package com.jpsoft.order.modules.sys.dao;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.order.modules.sys.entity.Menu;
+import java.util.Map;
+import com.jpsoft.order.modules.common.dto.Sort;
+
+@Repository
+public interface MenuDAO {
+	int insert(Menu entity);
+	int update(Menu entity);
+	int exist(String id);
+	Menu get(String id);
+	int delete(String id);
+	List<Menu> list();
+	List<Menu> search(Map<String,Object> searchParams,List<Sort> sortList);
+    List<Menu> findAllocMenu(@Param("userId") String userId,@Param("parentId") String parentId);
+}

+ 21 - 0
common/src/main/java/com/jpsoft/order/modules/sys/dao/PermissionDAO.java

@@ -0,0 +1,21 @@
+package com.jpsoft.order.modules.sys.dao;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.order.modules.sys.entity.Permission;
+import java.util.Map;
+import com.jpsoft.order.modules.common.dto.Sort;
+
+@Repository
+public interface PermissionDAO {
+	int insert(Permission entity);
+	int update(Permission entity);
+	int exist(@Param("path") String path,@Param("method") String method);
+	Permission get(String id);
+	int delete(String id);
+	List<Permission> list();
+	List<Permission> search(Map<String,Object> searchParams,List<Sort> sortList);
+    int hasPermitted(@Param("userId") String userId,@Param("path") String path,@Param("method") String method);
+}

+ 18 - 0
common/src/main/java/com/jpsoft/order/modules/sys/dao/RoleDAO.java

@@ -0,0 +1,18 @@
+package com.jpsoft.order.modules.sys.dao;
+
+import java.util.List;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.order.modules.sys.entity.Role;
+import java.util.Map;
+import com.jpsoft.order.modules.common.dto.Sort;
+
+@Repository
+public interface RoleDAO {
+	int insert(Role entity);
+	int update(Role entity);
+	int exist(String id);
+	Role get(String id);
+	int delete(String id);
+	List<Role> list();
+	List<Role> search(Map<String,Object> searchParams,List<Sort> sortList);
+}

+ 22 - 0
common/src/main/java/com/jpsoft/order/modules/sys/dao/RoleMenuDAO.java

@@ -0,0 +1,22 @@
+package com.jpsoft.order.modules.sys.dao;
+
+import java.util.List;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.order.modules.sys.entity.RoleMenu;
+import java.util.Map;
+import com.jpsoft.order.modules.common.dto.Sort;
+
+@Repository
+public interface RoleMenuDAO {
+	int insert(RoleMenu entity);
+	int update(RoleMenu entity);
+	int exist(String id);
+	RoleMenu get(String id);
+	int delete(String id);
+	List<RoleMenu> list();
+	List<RoleMenu> search(Map<String,Object> searchParams,List<Sort> sortList);
+
+	List<RoleMenu> findByRoleId(String roleId);
+
+	int deleteByRoleId(String roleId);
+}

+ 20 - 0
common/src/main/java/com/jpsoft/order/modules/sys/dao/RolePermissionDAO.java

@@ -0,0 +1,20 @@
+package com.jpsoft.order.modules.sys.dao;
+
+import java.util.List;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.order.modules.sys.entity.RolePermission;
+import java.util.Map;
+import com.jpsoft.order.modules.common.dto.Sort;
+
+@Repository
+public interface RolePermissionDAO {
+	int insert(RolePermission entity);
+	int update(RolePermission entity);
+	int exist(String id);
+	RolePermission get(String id);
+	int delete(String id);
+	List<RolePermission> list();
+	List<RolePermission> search(Map<String,Object> searchParams,List<Sort> sortList);
+    List<RolePermission> findByRoleId(String roleId);
+	int deleteByRoleId(String roleId);
+}

+ 19 - 0
common/src/main/java/com/jpsoft/order/modules/sys/dao/SysLogDAO.java

@@ -0,0 +1,19 @@
+package com.jpsoft.order.modules.sys.dao;
+
+import com.jpsoft.order.modules.common.dto.Sort;
+import com.jpsoft.order.modules.sys.entity.SysLog;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@Repository
+public interface SysLogDAO {
+	int insert(SysLog entity);
+	int update(SysLog entity);
+	int exist(Long id);
+	SysLog get(Long id);
+	int delete(Long id);
+	List<SysLog> list();
+	List<SysLog> search(Map<String, Object> searchParams, List<Sort> sortList);
+}

+ 22 - 0
common/src/main/java/com/jpsoft/order/modules/sys/dao/UserDAO.java

@@ -0,0 +1,22 @@
+package com.jpsoft.order.modules.sys.dao;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.order.modules.sys.entity.User;
+import java.util.Map;
+import com.jpsoft.order.modules.common.dto.Sort;
+
+@Repository
+public interface UserDAO {
+	int insert(User entity);
+	int update(User entity);
+	int exist(String id);
+	User get(String id);
+	int delete(String id);
+	List<User> list();
+	List<User> search(Map<String,Object> searchParams,List<Sort> sortList);
+	User findByUserName(@Param("userName") String userName);
+    long hasRole(@Param("userId") String userId,@Param("roleName") String roleName);
+}

+ 24 - 0
common/src/main/java/com/jpsoft/order/modules/sys/dao/UserRoleDAO.java

@@ -0,0 +1,24 @@
+package com.jpsoft.order.modules.sys.dao;
+
+import java.util.List;
+
+import com.jpsoft.order.modules.sys.entity.Role;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.order.modules.sys.entity.UserRole;
+import java.util.Map;
+import com.jpsoft.order.modules.common.dto.Sort;
+
+@Repository
+public interface UserRoleDAO {
+	int insert(UserRole entity);
+	int update(UserRole entity);
+	int exist(String id);
+	UserRole get(String id);
+	int delete(String id);
+	List<UserRole> list();
+	List<UserRole> search(Map<String,Object> searchParams,List<Sort> sortList);
+    List<Role> findRoleByUserId(String userId);
+	List<String> findRoleNameByUserId(String userId);
+	int findCountByAIdAndRName(String userId,String roleName);
+	int deleteByUserId(String userId);
+}

+ 24 - 0
common/src/main/java/com/jpsoft/order/modules/sys/dto/RoleRelatedDTO.java

@@ -0,0 +1,24 @@
+package com.jpsoft.order.modules.sys.dto;
+
+import java.util.List;
+
+public class RoleRelatedDTO {
+    private String roleId;
+    private List<String> relatedList;
+
+    public String getRoleId() {
+        return roleId;
+    }
+
+    public void setRoleId(String roleId) {
+        this.roleId = roleId;
+    }
+
+    public List<String> getRelatedList() {
+        return relatedList;
+    }
+
+    public void setRelatedList(List<String> relatedList) {
+        this.relatedList = relatedList;
+    }
+}

+ 37 - 0
common/src/main/java/com/jpsoft/order/modules/sys/entity/DataDictionary.java

@@ -0,0 +1,37 @@
+package com.jpsoft.order.modules.sys.entity;
+
+import java.util.Date;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+  描述:sys_data_dictionary的实体类
+ */
+@Data
+public class DataDictionary {
+	/**
+	 * 学生相关证明
+	 */
+	public static final String STUDENT_RELATED_CERT_ID = "f63a5ca8-ec0e-4987-ac9c-a8787f6026c4";
+
+	private String id;
+	private String name;
+	private String value;
+	private Integer sortNo;
+	private String parentName;
+	private String parentId;
+	private String dataType;
+	private String createBy;
+	private Date createDate;
+	private String updateBy;
+	private Date updateDate;
+	private Boolean activated;
+	private Boolean delFlag;
+	@ApiModelProperty(value = "扩展字段1")
+	private String extended1;
+	@ApiModelProperty(value = "扩展字段2")
+	private String extended2;
+	@ApiModelProperty(value = "扩展字段3")
+	private String extended3;
+}

+ 199 - 0
common/src/main/java/com/jpsoft/order/modules/sys/entity/Menu.java

@@ -0,0 +1,199 @@
+package com.jpsoft.order.modules.sys.entity;
+
+import java.util.Date;
+import java.util.List;
+
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+/**
+  描述:sys_menu的实体类
+ */
+public class Menu {
+	private String id;
+	private String menuName;
+	private String parentId;
+	private Integer sortNo;
+	private String menuUrl;
+	private String menuType;
+	private Date createTime;
+	private String createBy;
+	private Date updateTime;
+	private String updateBy;
+	private Boolean delFlag;
+	private String parentName;
+	private List<Menu> children;
+	private String icon;
+
+		/**
+	 *获取菜单编号
+	 */
+	public String getId(){
+		return id;
+	}
+	
+	/**
+	 *设置菜单编号
+	 */
+	public void setId(String id){
+		this.id = id;
+	}
+		/**
+	 *获取菜单名称
+	 */
+	public String getMenuName(){
+		return menuName;
+	}
+	
+	/**
+	 *设置菜单名称
+	 */
+	public void setMenuName(String menuName){
+		this.menuName = menuName;
+	}
+		/**
+	 *获取上级菜单
+	 */
+	public String getParentId(){
+		return parentId;
+	}
+	
+	/**
+	 *设置上级菜单
+	 */
+	public void setParentId(String parentId){
+		this.parentId = parentId;
+	}
+		/**
+	 *获取排序号
+	 */
+	public Integer getSortNo(){
+		return sortNo;
+	}
+	
+	/**
+	 *设置排序号
+	 */
+	public void setSortNo(Integer sortNo){
+		this.sortNo = sortNo;
+	}
+		/**
+	 *获取菜单地址
+	 */
+	public String getMenuUrl(){
+		return menuUrl;
+	}
+	
+	/**
+	 *设置菜单地址
+	 */
+	public void setMenuUrl(String menuUrl){
+		this.menuUrl = menuUrl;
+	}
+		/**
+	 *获取菜单类型(1-后端、2-前端)
+	 */
+	public String getMenuType(){
+		return menuType;
+	}
+	
+	/**
+	 *设置菜单类型(1-后端、2-前端)
+	 */
+	public void setMenuType(String menuType){
+		this.menuType = menuType;
+	}
+		@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+		/**
+	 *获取
+	 */
+	public Date getCreateTime(){
+		return createTime;
+	}
+	
+	/**
+	 *设置
+	 */
+	public void setCreateTime(Date createTime){
+		this.createTime = createTime;
+	}
+		/**
+	 *获取
+	 */
+	public String getCreateBy(){
+		return createBy;
+	}
+	
+	/**
+	 *设置
+	 */
+	public void setCreateBy(String createBy){
+		this.createBy = createBy;
+	}
+		@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+		/**
+	 *获取
+	 */
+	public Date getUpdateTime(){
+		return updateTime;
+	}
+	
+	/**
+	 *设置
+	 */
+	public void setUpdateTime(Date updateTime){
+		this.updateTime = updateTime;
+	}
+		/**
+	 *获取
+	 */
+	public String getUpdateBy(){
+		return updateBy;
+	}
+	
+	/**
+	 *设置
+	 */
+	public void setUpdateBy(String updateBy){
+		this.updateBy = updateBy;
+	}
+		/**
+	 *获取
+	 */
+	public Boolean getDelFlag(){
+		return delFlag;
+	}
+	
+	/**
+	 *设置
+	 */
+	public void setDelFlag(Boolean delFlag){
+		this.delFlag = delFlag;
+	}
+
+	public String getParentName() {
+		return parentName;
+	}
+
+	public void setParentName(String parentName) {
+		this.parentName = parentName;
+	}
+
+	public List<Menu> getChildren() {
+		return children;
+	}
+
+	public void setChildren(List<Menu> children) {
+		this.children = children;
+	}
+
+	public String getIcon() {
+		return icon;
+	}
+
+	public void setIcon(String icon) {
+		this.icon = icon;
+	}
+}

+ 142 - 0
common/src/main/java/com/jpsoft/order/modules/sys/entity/Permission.java

@@ -0,0 +1,142 @@
+package com.jpsoft.order.modules.sys.entity;
+
+import java.util.Date;
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+/**
+ 描述:sys_permission的实体类
+ */
+public class Permission {
+	private String id;
+	private String path;
+	private String method;
+	private String summary;
+	private Boolean delFlag;
+	private String createBy;
+	private String updateBy;
+	private Date createTime;
+	private Date updateTime;
+
+	/**
+	 *获取主键
+	 */
+	public String getId(){
+		return id;
+	}
+
+	/**
+	 *设置主键
+	 */
+	public void setId(String id){
+		this.id = id;
+	}
+	/**
+	 *获取访问路径
+	 */
+	public String getPath(){
+		return path;
+	}
+
+	/**
+	 *设置访问路径
+	 */
+	public void setPath(String path){
+		this.path = path;
+	}
+	/**
+	 *获取访问方式
+	 */
+	public String getMethod(){
+		return method;
+	}
+
+	/**
+	 *设置访问方式
+	 */
+	public void setMethod(String method){
+		this.method = method;
+	}
+	/**
+	 *获取简介
+	 */
+	public String getSummary(){
+		return summary;
+	}
+
+	/**
+	 *设置简介
+	 */
+	public void setSummary(String summary){
+		this.summary = summary;
+	}
+	/**
+	 *获取是否删除
+	 */
+	public Boolean getDelFlag(){
+		return delFlag;
+	}
+
+	/**
+	 *设置是否删除
+	 */
+	public void setDelFlag(Boolean delFlag){
+		this.delFlag = delFlag;
+	}
+	/**
+	 *获取创建人
+	 */
+	public String getCreateBy(){
+		return createBy;
+	}
+
+	/**
+	 *设置创建人
+	 */
+	public void setCreateBy(String createBy){
+		this.createBy = createBy;
+	}
+	/**
+	 *获取更新人
+	 */
+	public String getUpdateBy(){
+		return updateBy;
+	}
+
+	/**
+	 *设置更新人
+	 */
+	public void setUpdateBy(String updateBy){
+		this.updateBy = updateBy;
+	}
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	/**
+	 *获取创建时间
+	 */
+	public Date getCreateTime(){
+		return createTime;
+	}
+
+	/**
+	 *设置创建时间
+	 */
+	public void setCreateTime(Date createTime){
+		this.createTime = createTime;
+	}
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	/**
+	 *获取更新时间
+	 */
+	public Date getUpdateTime(){
+		return updateTime;
+	}
+
+	/**
+	 *设置更新时间
+	 */
+	public void setUpdateTime(Date updateTime){
+		this.updateTime = updateTime;
+	}
+}

+ 129 - 0
common/src/main/java/com/jpsoft/order/modules/sys/entity/Role.java

@@ -0,0 +1,129 @@
+package com.jpsoft.order.modules.sys.entity;
+
+import java.util.Date;
+
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+/**
+  描述:sys_role的实体类
+ */
+public class Role {
+	private String id;
+	private String name;
+	private String description;
+	private Date createTime;
+	private Date updateTime;
+	private Boolean delFlag;
+	private String createBy;
+	private String updateBy;
+	
+		/**
+	 *获取角色编号
+	 */
+	public String getId(){
+		return id;
+	}
+	
+	/**
+	 *设置角色编号
+	 */
+	public void setId(String id){
+		this.id = id;
+	}
+		/**
+	 *获取角色名称
+	 */
+	public String getName(){
+		return name;
+	}
+	
+	/**
+	 *设置角色名称
+	 */
+	public void setName(String name){
+		this.name = name;
+	}
+		/**
+	 *获取角色描述
+	 */
+	public String getDescription(){
+		return description;
+	}
+	
+	/**
+	 *设置角色描述
+	 */
+	public void setDescription(String description){
+		this.description = description;
+	}
+		@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+		/**
+	 *获取创建时间
+	 */
+	public Date getCreateTime(){
+		return createTime;
+	}
+	
+	/**
+	 *设置创建时间
+	 */
+	public void setCreateTime(Date createTime){
+		this.createTime = createTime;
+	}
+		@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+		/**
+	 *获取更新时间
+	 */
+	public Date getUpdateTime(){
+		return updateTime;
+	}
+	
+	/**
+	 *设置更新时间
+	 */
+	public void setUpdateTime(Date updateTime){
+		this.updateTime = updateTime;
+	}
+		/**
+	 *获取删除标示
+	 */
+	public Boolean getDelFlag(){
+		return delFlag;
+	}
+	
+	/**
+	 *设置删除标示
+	 */
+	public void setDelFlag(Boolean delFlag){
+		this.delFlag = delFlag;
+	}
+		/**
+	 *获取创建人
+	 */
+	public String getCreateBy(){
+		return createBy;
+	}
+	
+	/**
+	 *设置创建人
+	 */
+	public void setCreateBy(String createBy){
+		this.createBy = createBy;
+	}
+		/**
+	 *获取更新人
+	 */
+	public String getUpdateBy(){
+		return updateBy;
+	}
+	
+	/**
+	 *设置更新人
+	 */
+	public void setUpdateBy(String updateBy){
+		this.updateBy = updateBy;
+	}
+}

+ 129 - 0
common/src/main/java/com/jpsoft/order/modules/sys/entity/RoleMenu.java

@@ -0,0 +1,129 @@
+package com.jpsoft.order.modules.sys.entity;
+
+import java.util.Date;
+
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+/**
+  描述:sys_role_menu的实体类
+ */
+public class RoleMenu {
+	private String id;
+	private String roleId;
+	private String menuId;
+	private Boolean delFlag;
+	private String createBy;
+	private Date createTime;
+	private String updateBy;
+	private Date updateTime;
+	
+		/**
+	 *获取
+	 */
+	public String getId(){
+		return id;
+	}
+	
+	/**
+	 *设置
+	 */
+	public void setId(String id){
+		this.id = id;
+	}
+		/**
+	 *获取
+	 */
+	public String getRoleId(){
+		return roleId;
+	}
+	
+	/**
+	 *设置
+	 */
+	public void setRoleId(String roleId){
+		this.roleId = roleId;
+	}
+		/**
+	 *获取
+	 */
+	public String getMenuId(){
+		return menuId;
+	}
+	
+	/**
+	 *设置
+	 */
+	public void setMenuId(String menuId){
+		this.menuId = menuId;
+	}
+		/**
+	 *获取是否删除
+	 */
+	public Boolean getDelFlag(){
+		return delFlag;
+	}
+	
+	/**
+	 *设置是否删除
+	 */
+	public void setDelFlag(Boolean delFlag){
+		this.delFlag = delFlag;
+	}
+		/**
+	 *获取创建人
+	 */
+	public String getCreateBy(){
+		return createBy;
+	}
+	
+	/**
+	 *设置创建人
+	 */
+	public void setCreateBy(String createBy){
+		this.createBy = createBy;
+	}
+		@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+		/**
+	 *获取创建时间
+	 */
+	public Date getCreateTime(){
+		return createTime;
+	}
+	
+	/**
+	 *设置创建时间
+	 */
+	public void setCreateTime(Date createTime){
+		this.createTime = createTime;
+	}
+		/**
+	 *获取更新人
+	 */
+	public String getUpdateBy(){
+		return updateBy;
+	}
+	
+	/**
+	 *设置更新人
+	 */
+	public void setUpdateBy(String updateBy){
+		this.updateBy = updateBy;
+	}
+		@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+		/**
+	 *获取更新时间
+	 */
+	public Date getUpdateTime(){
+		return updateTime;
+	}
+	
+	/**
+	 *设置更新时间
+	 */
+	public void setUpdateTime(Date updateTime){
+		this.updateTime = updateTime;
+	}
+}

+ 129 - 0
common/src/main/java/com/jpsoft/order/modules/sys/entity/RolePermission.java

@@ -0,0 +1,129 @@
+package com.jpsoft.order.modules.sys.entity;
+
+import java.util.Date;
+
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+/**
+  描述:sys_role_permission的实体类
+ */
+public class RolePermission {
+	private String id;
+	private String permId;
+	private String roleId;
+	private Boolean delFlag;
+	private String createBy;
+	private String updateBy;
+	private Date createTime;
+	private Date updateTime;
+	
+		/**
+	 *获取
+	 */
+	public String getId(){
+		return id;
+	}
+	
+	/**
+	 *设置
+	 */
+	public void setId(String id){
+		this.id = id;
+	}
+		/**
+	 *获取
+	 */
+	public String getPermId(){
+		return permId;
+	}
+	
+	/**
+	 *设置
+	 */
+	public void setPermId(String permId){
+		this.permId = permId;
+	}
+		/**
+	 *获取
+	 */
+	public String getRoleId(){
+		return roleId;
+	}
+	
+	/**
+	 *设置
+	 */
+	public void setRoleId(String roleId){
+		this.roleId = roleId;
+	}
+		/**
+	 *获取是否删除
+	 */
+	public Boolean getDelFlag(){
+		return delFlag;
+	}
+	
+	/**
+	 *设置是否删除
+	 */
+	public void setDelFlag(Boolean delFlag){
+		this.delFlag = delFlag;
+	}
+		/**
+	 *获取创建人
+	 */
+	public String getCreateBy(){
+		return createBy;
+	}
+	
+	/**
+	 *设置创建人
+	 */
+	public void setCreateBy(String createBy){
+		this.createBy = createBy;
+	}
+		/**
+	 *获取更新人
+	 */
+	public String getUpdateBy(){
+		return updateBy;
+	}
+	
+	/**
+	 *设置更新人
+	 */
+	public void setUpdateBy(String updateBy){
+		this.updateBy = updateBy;
+	}
+		@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+		/**
+	 *获取创建时间
+	 */
+	public Date getCreateTime(){
+		return createTime;
+	}
+	
+	/**
+	 *设置创建时间
+	 */
+	public void setCreateTime(Date createTime){
+		this.createTime = createTime;
+	}
+		@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+		/**
+	 *获取更新时间
+	 */
+	public Date getUpdateTime(){
+		return updateTime;
+	}
+	
+	/**
+	 *设置更新时间
+	 */
+	public void setUpdateTime(Date updateTime){
+		this.updateTime = updateTime;
+	}
+}

+ 37 - 0
common/src/main/java/com/jpsoft/order/modules/sys/entity/SysLog.java

@@ -0,0 +1,37 @@
+package com.jpsoft.order.modules.sys.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+  描述:sys_log的实体类
+ */
+@Data
+@ApiModel(value = "sys_log的实体类")
+public class SysLog {
+    @ApiModelProperty(value = "日志编号")
+	private Long id;
+    @ApiModelProperty(value = "客户端IP")
+	private String remoteIp;
+    @ApiModelProperty(value = "访问url")
+	private String url;
+    @ApiModelProperty(value = "提交参数")
+	private String data;
+    @ApiModelProperty(value = "用户编号")
+	private String userId;
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	@ApiModelProperty(value = "备注")
+	private String remark;
+	@ApiModelProperty(value = "耗时(毫秒)")
+	private Long elapse;
+	@ApiModelProperty(value = "入口")
+	private String pointcut;
+}

+ 36 - 0
common/src/main/java/com/jpsoft/order/modules/sys/entity/User.java

@@ -0,0 +1,36 @@
+package com.jpsoft.order.modules.sys.entity;
+
+import java.util.Date;
+import java.util.List;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+
+@Data
+@ApiModel(value = "sys_user的实体类")
+public class User {
+	private String id;
+	private String userName;
+	private String password;
+	private String realName;
+
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+	@ApiModelProperty(value = "创建时间")
+	private Date createTime;
+
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+	@ApiModelProperty(value = "更新时间")
+	private Date updateTime;
+	private Boolean delFlag;
+	private String createBy;
+	private String updateBy;
+	private List<String> roles;
+	private String schoolId;
+	private String schoolName;
+}

+ 129 - 0
common/src/main/java/com/jpsoft/order/modules/sys/entity/UserRole.java

@@ -0,0 +1,129 @@
+package com.jpsoft.order.modules.sys.entity;
+
+import java.util.Date;
+
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+/**
+  描述:sys_user_role的实体类
+ */
+public class UserRole {
+	private String id;
+	private String roleId;
+	private String userId;
+	private Boolean delFlag;
+	private String createBy;
+	private String updateBy;
+	private Date createTime;
+	private Date updateTime;
+	
+		/**
+	 *获取用户角色关联编号
+	 */
+	public String getId(){
+		return id;
+	}
+	
+	/**
+	 *设置用户角色关联编号
+	 */
+	public void setId(String id){
+		this.id = id;
+	}
+		/**
+	 *获取角色编号
+	 */
+	public String getRoleId(){
+		return roleId;
+	}
+	
+	/**
+	 *设置角色编号
+	 */
+	public void setRoleId(String roleId){
+		this.roleId = roleId;
+	}
+		/**
+	 *获取用户编号
+	 */
+	public String getUserId(){
+		return userId;
+	}
+	
+	/**
+	 *设置用户编号
+	 */
+	public void setUserId(String userId){
+		this.userId = userId;
+	}
+		/**
+	 *获取是否删除
+	 */
+	public Boolean getDelFlag(){
+		return delFlag;
+	}
+	
+	/**
+	 *设置是否删除
+	 */
+	public void setDelFlag(Boolean delFlag){
+		this.delFlag = delFlag;
+	}
+		/**
+	 *获取创建人
+	 */
+	public String getCreateBy(){
+		return createBy;
+	}
+	
+	/**
+	 *设置创建人
+	 */
+	public void setCreateBy(String createBy){
+		this.createBy = createBy;
+	}
+		/**
+	 *获取更新人
+	 */
+	public String getUpdateBy(){
+		return updateBy;
+	}
+	
+	/**
+	 *设置更新人
+	 */
+	public void setUpdateBy(String updateBy){
+		this.updateBy = updateBy;
+	}
+		@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+		/**
+	 *获取创建时间
+	 */
+	public Date getCreateTime(){
+		return createTime;
+	}
+	
+	/**
+	 *设置创建时间
+	 */
+	public void setCreateTime(Date createTime){
+		this.createTime = createTime;
+	}
+		@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+		/**
+	 *获取更新时间
+	 */
+	public Date getUpdateTime(){
+		return updateTime;
+	}
+	
+	/**
+	 *设置更新时间
+	 */
+	public void setUpdateTime(Date updateTime){
+		this.updateTime = updateTime;
+	}
+}

+ 27 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/DataDictionaryService.java

@@ -0,0 +1,27 @@
+package com.jpsoft.order.modules.sys.service;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.sys.entity.DataDictionary;
+import com.jpsoft.order.modules.common.dto.Sort;
+
+import java.util.List;
+import java.util.Map;
+
+public interface DataDictionaryService {
+	DataDictionary get(String id);
+	boolean exist(String id);
+	int insert(DataDictionary model);
+	int update(DataDictionary model);
+	int delete(String id);
+	String getName(String id);
+	String getValue(String id);
+	List<DataDictionary> list();
+	List<DataDictionary> findByParentId(String parentId);
+	DataDictionary findByParentIdAndValue(String parentId,String value);
+	List<Map<String, Object>> queryChildren(String parentId);
+	Page<DataDictionary> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, List<Sort> sortList);
+	List<DataDictionary> findByCatalogName(String catalogName);
+	String findNameByCatalogNameAndValue(String catalogName,String value);
+	DataDictionary findByCatalogNameAndValue(String catalogName,String value);
+    DataDictionary findByName(String name);
+}

+ 21 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/MenuService.java

@@ -0,0 +1,21 @@
+package com.jpsoft.order.modules.sys.service;
+
+import java.util.List;
+import java.util.Map;
+import com.jpsoft.order.modules.sys.entity.Menu;
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.common.dto.Sort;
+
+public interface MenuService {
+	Menu get(String id);
+	boolean exist(String id);
+	int insert(Menu model);
+	int update(Menu model);
+	int delete(String id);
+	List<Menu> list();
+	Page<Menu> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,List<Sort> sortList);
+
+    List<Menu> query(Map<String, Object> searchParams, int limit, List<Sort> sortList);
+
+    List<Menu> findAllocMenu(String subject, String parentId);
+}

+ 19 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/PermissionService.java

@@ -0,0 +1,19 @@
+package com.jpsoft.order.modules.sys.service;
+
+import java.util.List;
+import java.util.Map;
+import com.jpsoft.order.modules.sys.entity.Permission;
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.common.dto.Sort;
+
+public interface PermissionService {
+	Permission get(String id);
+	boolean exist(String path, String method);
+	int insert(Permission model);
+	int update(Permission model);
+	int delete(String id);
+	List<Permission> list();
+	Page<Permission> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,List<Sort> sortList);
+
+    boolean hasPermitted(String userId, String path, String method);
+}

+ 19 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/RoleMenuService.java

@@ -0,0 +1,19 @@
+package com.jpsoft.order.modules.sys.service;
+
+import java.util.List;
+import java.util.Map;
+import com.jpsoft.order.modules.sys.entity.RoleMenu;
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.common.dto.Sort;
+
+public interface RoleMenuService {
+	RoleMenu get(String id);
+	boolean exist(String id);
+	int insert(RoleMenu model);
+	int update(RoleMenu model);
+	int delete(String id);
+	List<RoleMenu> list();
+	Page<RoleMenu> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,List<Sort> sortList);
+    List<RoleMenu> findByRoleId(String roleId);
+	int deleteByRoleId(String roleId);
+}

+ 21 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/RolePermissionService.java

@@ -0,0 +1,21 @@
+package com.jpsoft.order.modules.sys.service;
+
+import java.util.List;
+import java.util.Map;
+import com.jpsoft.order.modules.sys.entity.RolePermission;
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.common.dto.Sort;
+
+public interface RolePermissionService {
+	RolePermission get(String id);
+	boolean exist(String id);
+	int insert(RolePermission model);
+	int update(RolePermission model);
+	int delete(String id);
+	List<RolePermission> list();
+	Page<RolePermission> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,List<Sort> sortList);
+
+    List<RolePermission> findByRoleId(String roleId);
+
+	int deleteByRoleId(String roleId);
+}

+ 17 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/RoleService.java

@@ -0,0 +1,17 @@
+package com.jpsoft.order.modules.sys.service;
+
+import java.util.List;
+import java.util.Map;
+import com.jpsoft.order.modules.sys.entity.Role;
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.common.dto.Sort;
+
+public interface RoleService {
+	Role get(String id);
+	boolean exist(String id);
+	int insert(Role model);
+	int update(Role model);
+	int delete(String id);
+	List<Role> list();
+	Page<Role> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,List<Sort> sortList);
+}

+ 18 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/SysLogService.java

@@ -0,0 +1,18 @@
+package com.jpsoft.order.modules.sys.service;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.common.dto.Sort;
+import com.jpsoft.order.modules.sys.entity.SysLog;
+
+import java.util.List;
+import java.util.Map;
+
+public interface SysLogService {
+	SysLog get(Long id);
+	boolean exist(Long id);
+	int insert(SysLog model);
+	int update(SysLog model);
+	int delete(Long id);
+	List<SysLog> list();
+	Page<SysLog> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, List<Sort> sortList);
+}

+ 23 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/UserRoleService.java

@@ -0,0 +1,23 @@
+package com.jpsoft.order.modules.sys.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.jpsoft.order.modules.sys.entity.Role;
+import com.jpsoft.order.modules.sys.entity.UserRole;
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.common.dto.Sort;
+
+public interface UserRoleService {
+	UserRole get(String id);
+	boolean exist(String id);
+	int insert(UserRole model);
+	int update(UserRole model);
+	int delete(String id);
+	List<UserRole> list();
+	Page<UserRole> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,List<Sort> sortList);
+    List<Role> findRoleByUserId(String userId);
+	List<String> findRoleNameByUserId(String userId);
+	int findCountByAIdAndRName(String userId,String roleName);
+	int deleteByUserId(String userId);
+}

+ 19 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/UserService.java

@@ -0,0 +1,19 @@
+package com.jpsoft.order.modules.sys.service;
+
+import java.util.List;
+import java.util.Map;
+import com.jpsoft.order.modules.sys.entity.User;
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.common.dto.Sort;
+
+public interface UserService {
+	User get(String id);
+	boolean exist(String id);
+	int insert(User model);
+	int update(User model);
+	int delete(String id);
+	List<User> list();
+	Page<User> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,List<Sort> sortList);
+	User findByUserName(String userName);
+	boolean hasRole(String userId, String roleName) ;
+}

+ 118 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/impl/DataDictionaryServiceImpl.java

@@ -0,0 +1,118 @@
+package com.jpsoft.order.modules.sys.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.jpsoft.order.modules.common.dto.Sort;
+import com.jpsoft.order.modules.sys.dao.DataDictionaryDAO;
+import com.jpsoft.order.modules.sys.entity.DataDictionary;
+import com.jpsoft.order.modules.sys.service.DataDictionaryService;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+@Transactional
+@Component(value="dataDictionaryService")
+public class DataDictionaryServiceImpl implements DataDictionaryService {
+	@Resource(name="dataDictionaryDAO")
+	private DataDictionaryDAO dataDictionaryDAO;
+
+	@Override
+	public DataDictionary get(String id) {
+		// TODO Auto-generated method stub
+		return dataDictionaryDAO.get(id);
+	}
+
+	@Override
+	public int insert(DataDictionary model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+
+		return dataDictionaryDAO.insert(model);
+	}
+
+	@Override
+	public int update(DataDictionary model) {
+		// TODO Auto-generated method stub
+		return dataDictionaryDAO.update(model);
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return dataDictionaryDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = dataDictionaryDAO.exist(id);
+
+		return count > 0 ? true : false;
+	}
+
+	@Override
+	public String getName(String id){
+		return dataDictionaryDAO.getName(id);
+	}
+	@Override
+	public String getValue(String id){
+		return dataDictionaryDAO.getValue(id);
+	}
+
+	@Override
+	public List<DataDictionary> findByParentId(String parentId){
+		return dataDictionaryDAO.findByParentId(parentId);
+	}
+
+	@Override
+	public DataDictionary findByParentIdAndValue(String parentId,String value){
+		return dataDictionaryDAO.findByParentIdAndValue(parentId,value);
+	}
+
+	@Override
+	public List<DataDictionary> list() {
+		// TODO Auto-generated method stub
+		return dataDictionaryDAO.list();
+	}
+
+	@Override
+	public List<Map<String, Object>> queryChildren(String parentId){
+		return dataDictionaryDAO.queryChildren(parentId);
+	}
+
+	@Override
+	public Page<DataDictionary> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,List<Sort> sortList) {
+		Page<DataDictionary> page = PageHelper.startPage(pageNumber,pageSize).doSelectPage(()->{
+			dataDictionaryDAO.search(searchParams,sortList);
+		});
+
+		return page;
+	}
+
+	@Override
+	public List<DataDictionary> findByCatalogName(String catalogName) {
+		return dataDictionaryDAO.findByCatalogName(catalogName);
+	}
+
+	@Override
+	public String findNameByCatalogNameAndValue(String catalogName,String value) {
+//		Map<String,Object> map = new HashMap<>();
+//		map.put("catalogName",catalogName);
+//		map.put("value",value);
+
+		return dataDictionaryDAO.findNameByCatalogNameAndValue(catalogName,value);
+	}
+
+	@Override
+	public DataDictionary findByCatalogNameAndValue(String catalogName,String value) {
+		return dataDictionaryDAO.findByCatalogNameAndValue(catalogName,value);
+	}
+
+	@Override
+	public DataDictionary findByName(String name) {
+		return dataDictionaryDAO.findByName(name);
+	}
+}

+ 83 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/impl/MenuServiceImpl.java

@@ -0,0 +1,83 @@
+package com.jpsoft.order.modules.sys.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Resource;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.order.modules.sys.dao.MenuDAO;
+import com.jpsoft.order.modules.sys.entity.Menu;
+import com.jpsoft.order.modules.sys.service.MenuService;
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="menuService")
+public class MenuServiceImpl implements MenuService {
+	@Resource(name="menuDAO")
+	private MenuDAO menuDAO;
+
+	@Override
+	public Menu get(String id) {
+		// TODO Auto-generated method stub
+		return menuDAO.get(id);
+	}
+
+	@Override
+	public int insert(Menu model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return menuDAO.insert(model);
+	}
+
+	@Override
+	public int update(Menu model) {
+		// TODO Auto-generated method stub
+		return menuDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return menuDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = menuDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<Menu> list() {
+		// TODO Auto-generated method stub
+		return menuDAO.list();
+	}
+		
+	@Override
+	public Page<Menu> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,List<Sort> sortList) {
+        Page<Menu> page = PageHelper.startPage(pageNumber,pageSize).doSelectPage(()->{
+            menuDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+
+	@Override
+	public List<Menu> query(Map<String, Object> searchParams, int limit, List<Sort> sortList) {
+		Page<Menu> page = PageHelper.startPage(1,limit,false).doSelectPage(()->{
+			menuDAO.search(searchParams,sortList);
+		});
+
+		return page.getResult();
+	}
+
+	@Override
+	public List<Menu> findAllocMenu(String subject, String parentId) {
+		return menuDAO.findAllocMenu(subject, parentId);
+	}
+}

+ 74 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/impl/PermissionServiceImpl.java

@@ -0,0 +1,74 @@
+package com.jpsoft.order.modules.sys.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Resource;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.order.modules.sys.dao.PermissionDAO;
+import com.jpsoft.order.modules.sys.entity.Permission;
+import com.jpsoft.order.modules.sys.service.PermissionService;
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="permissionService")
+public class PermissionServiceImpl implements PermissionService {
+	@Resource(name="permissionDAO")
+	private PermissionDAO permissionDAO;
+
+	@Override
+	public Permission get(String id) {
+		// TODO Auto-generated method stub
+		return permissionDAO.get(id);
+	}
+
+	@Override
+	public int insert(Permission model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return permissionDAO.insert(model);
+	}
+
+	@Override
+	public int update(Permission model) {
+		// TODO Auto-generated method stub
+		return permissionDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return permissionDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String path, String method) {
+		// TODO Auto-generated method stub
+		int count = permissionDAO.exist(path,method);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<Permission> list() {
+		// TODO Auto-generated method stub
+		return permissionDAO.list();
+	}
+		
+	@Override
+	public Page<Permission> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,List<Sort> sortList) {
+        Page<Permission> page = PageHelper.startPage(pageNumber,pageSize).doSelectPage(()->{
+            permissionDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+
+	@Override
+	public boolean hasPermitted(String userId, String path, String method) {
+		return permissionDAO.hasPermitted(userId,path,method)>0 ? true : false;
+	}
+}

+ 79 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/impl/RoleMenuServiceImpl.java

@@ -0,0 +1,79 @@
+package com.jpsoft.order.modules.sys.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Resource;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.order.modules.sys.dao.RoleMenuDAO;
+import com.jpsoft.order.modules.sys.entity.RoleMenu;
+import com.jpsoft.order.modules.sys.service.RoleMenuService;
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="roleMenuService")
+public class RoleMenuServiceImpl implements RoleMenuService {
+	@Resource(name="roleMenuDAO")
+	private RoleMenuDAO roleMenuDAO;
+
+	@Override
+	public RoleMenu get(String id) {
+		// TODO Auto-generated method stub
+		return roleMenuDAO.get(id);
+	}
+
+	@Override
+	public int insert(RoleMenu model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return roleMenuDAO.insert(model);
+	}
+
+	@Override
+	public int update(RoleMenu model) {
+		// TODO Auto-generated method stub
+		return roleMenuDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return roleMenuDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = roleMenuDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<RoleMenu> list() {
+		// TODO Auto-generated method stub
+		return roleMenuDAO.list();
+	}
+		
+	@Override
+	public Page<RoleMenu> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,List<Sort> sortList) {
+        Page<RoleMenu> page = PageHelper.startPage(pageNumber,pageSize).doSelectPage(()->{
+            roleMenuDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+
+	@Override
+	public List<RoleMenu> findByRoleId(String roleId) {
+		return roleMenuDAO.findByRoleId(roleId);
+	}
+
+	@Override
+	public int deleteByRoleId(String roleId) {
+		return roleMenuDAO.deleteByRoleId(roleId);
+	}
+}

+ 79 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/impl/RolePermissionServiceImpl.java

@@ -0,0 +1,79 @@
+package com.jpsoft.order.modules.sys.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Resource;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.order.modules.sys.dao.RolePermissionDAO;
+import com.jpsoft.order.modules.sys.entity.RolePermission;
+import com.jpsoft.order.modules.sys.service.RolePermissionService;
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="rolePermissionService")
+public class RolePermissionServiceImpl implements RolePermissionService {
+	@Resource(name="rolePermissionDAO")
+	private RolePermissionDAO rolePermissionDAO;
+
+	@Override
+	public RolePermission get(String id) {
+		// TODO Auto-generated method stub
+		return rolePermissionDAO.get(id);
+	}
+
+	@Override
+	public int insert(RolePermission model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return rolePermissionDAO.insert(model);
+	}
+
+	@Override
+	public int update(RolePermission model) {
+		// TODO Auto-generated method stub
+		return rolePermissionDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return rolePermissionDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = rolePermissionDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<RolePermission> list() {
+		// TODO Auto-generated method stub
+		return rolePermissionDAO.list();
+	}
+		
+	@Override
+	public Page<RolePermission> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,List<Sort> sortList) {
+        Page<RolePermission> page = PageHelper.startPage(pageNumber,pageSize).doSelectPage(()->{
+            rolePermissionDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+
+	@Override
+	public List<RolePermission> findByRoleId(String roleId) {
+		return rolePermissionDAO.findByRoleId(roleId);
+	}
+
+	@Override
+	public int deleteByRoleId(String roleId) {
+		return rolePermissionDAO.deleteByRoleId(roleId);
+	}
+}

+ 69 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/impl/RoleServiceImpl.java

@@ -0,0 +1,69 @@
+package com.jpsoft.order.modules.sys.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Resource;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.order.modules.sys.dao.RoleDAO;
+import com.jpsoft.order.modules.sys.entity.Role;
+import com.jpsoft.order.modules.sys.service.RoleService;
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="roleService")
+public class RoleServiceImpl implements RoleService {
+	@Resource(name="roleDAO")
+	private RoleDAO roleDAO;
+
+	@Override
+	public Role get(String id) {
+		// TODO Auto-generated method stub
+		return roleDAO.get(id);
+	}
+
+	@Override
+	public int insert(Role model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return roleDAO.insert(model);
+	}
+
+	@Override
+	public int update(Role model) {
+		// TODO Auto-generated method stub
+		return roleDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return roleDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = roleDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<Role> list() {
+		// TODO Auto-generated method stub
+		return roleDAO.list();
+	}
+		
+	@Override
+	public Page<Role> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,List<Sort> sortList) {
+        Page<Role> page = PageHelper.startPage(pageNumber,pageSize).doSelectPage(()->{
+            roleDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+}

+ 70 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/impl/SysLogServiceImpl.java

@@ -0,0 +1,70 @@
+package com.jpsoft.order.modules.sys.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.jpsoft.order.modules.common.dto.Sort;
+import com.jpsoft.order.modules.sys.dao.SysLogDAO;
+import com.jpsoft.order.modules.sys.entity.SysLog;
+import com.jpsoft.order.modules.sys.service.SysLogService;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+@Transactional
+@Component(value="sysLogService")
+public class SysLogServiceImpl implements SysLogService {
+	@Resource(name="sysLogDAO")
+	private SysLogDAO sysLogDAO;
+
+	@Override
+	public SysLog get(Long id) {
+		// TODO Auto-generated method stub
+		return sysLogDAO.get(id);
+	}
+
+	@Override
+	public int insert(SysLog model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return sysLogDAO.insert(model);
+	}
+
+	@Override
+	public int update(SysLog model) {
+		// TODO Auto-generated method stub
+		return sysLogDAO.update(model);		
+	}
+
+	@Override
+	public int delete(Long id) {
+		// TODO Auto-generated method stub
+		return sysLogDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(Long id) {
+		// TODO Auto-generated method stub
+		int count = sysLogDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<SysLog> list() {
+		// TODO Auto-generated method stub
+		return sysLogDAO.list();
+	}
+		
+	@Override
+	public Page<SysLog> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,List<Sort> sortList) {
+        Page<SysLog> page = PageHelper.startPage(pageNumber,pageSize).doSelectPage(()->{
+            sysLogDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+}

+ 91 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/impl/UserRoleServiceImpl.java

@@ -0,0 +1,91 @@
+package com.jpsoft.order.modules.sys.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Resource;
+
+import com.jpsoft.order.modules.sys.entity.Role;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.order.modules.sys.dao.UserRoleDAO;
+import com.jpsoft.order.modules.sys.entity.UserRole;
+import com.jpsoft.order.modules.sys.service.UserRoleService;
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="userRoleService")
+public class UserRoleServiceImpl implements UserRoleService {
+	@Resource(name="userRoleDAO")
+	private UserRoleDAO userRoleDAO;
+
+	@Override
+	public UserRole get(String id) {
+		// TODO Auto-generated method stub
+		return userRoleDAO.get(id);
+	}
+
+	@Override
+	public int insert(UserRole model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return userRoleDAO.insert(model);
+	}
+
+	@Override
+	public int update(UserRole model) {
+		// TODO Auto-generated method stub
+		return userRoleDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return userRoleDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = userRoleDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<UserRole> list() {
+		// TODO Auto-generated method stub
+		return userRoleDAO.list();
+	}
+		
+	@Override
+	public Page<UserRole> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,List<Sort> sortList) {
+        Page<UserRole> page = PageHelper.startPage(pageNumber,pageSize).doSelectPage(()->{
+            userRoleDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+
+	@Override
+	public List<Role> findRoleByUserId(String userId) {
+		return userRoleDAO.findRoleByUserId(userId);
+	}
+
+	@Override
+	public List<String> findRoleNameByUserId(String userId){
+		return userRoleDAO.findRoleNameByUserId(userId);
+	}
+
+	@Override
+	public int findCountByAIdAndRName(String userId,String roleName){
+		return userRoleDAO.findCountByAIdAndRName(userId,roleName);
+	}
+
+	@Override
+	public int deleteByUserId(String userId) {
+		return userRoleDAO.deleteByUserId(userId);
+	}
+}

+ 81 - 0
common/src/main/java/com/jpsoft/order/modules/sys/service/impl/UserServiceImpl.java

@@ -0,0 +1,81 @@
+package com.jpsoft.order.modules.sys.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Resource;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.order.modules.sys.dao.UserDAO;
+import com.jpsoft.order.modules.sys.entity.User;
+import com.jpsoft.order.modules.sys.service.UserService;
+import com.github.pagehelper.Page;
+import com.jpsoft.order.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="userService")
+public class UserServiceImpl implements UserService {
+	@Resource(name="userDAO")
+	private UserDAO userDAO;
+
+	@Override
+	public User get(String id) {
+		// TODO Auto-generated method stub
+		return userDAO.get(id);
+	}
+
+	@Override
+	public int insert(User model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return userDAO.insert(model);
+	}
+
+	@Override
+	public int update(User model) {
+		// TODO Auto-generated method stub
+		return userDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return userDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = userDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<User> list() {
+		// TODO Auto-generated method stub
+		return userDAO.list();
+	}
+		
+	@Override
+	public Page<User> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,List<Sort> sortList) {
+        Page<User> page = PageHelper.startPage(pageNumber,pageSize).doSelectPage(()->{
+            userDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+
+	@Override
+	public User findByUserName(String userName) {
+		return userDAO.findByUserName(userName);
+	}
+
+	@Override
+	public boolean hasRole(String userId, String roleName) {
+		long count = userDAO.hasRole(userId,roleName);
+
+		return count>0;
+	}
+}

+ 29 - 0
common/src/main/java/com/jpsoft/order/modules/wechat/entity/AccessToken.java

@@ -0,0 +1,29 @@
+package com.jpsoft.order.modules.wechat.entity;
+
+import lombok.Data;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2019-12-11 15:29
+ */
+@Data
+public class AccessToken {
+
+    /**
+     * 获取到的凭证
+     */
+    private String token;
+    /**
+     * 凭证有效时间,单位:秒
+     */
+    private int expiresIn;
+    /**
+     * 用户唯一标识
+     */
+    private String openid;
+
+    /**
+     * 类型
+     */
+    private String scope;
+}

+ 20 - 0
common/src/main/java/com/jpsoft/order/modules/wechat/vo/UserInfo.java

@@ -0,0 +1,20 @@
+package com.jpsoft.order.modules.wechat.vo;
+
+import lombok.Data;
+
+/**
+ * 微信通用接口凭证
+ * 
+ * @author lt
+ * @date 2013-08-08
+ */
+@Data
+public class UserInfo {
+	private String openid;
+	private String nickname;
+	private String city;
+	private String country;
+	private String province;
+	private String headimgurl;
+
+}

+ 213 - 0
common/src/main/resources/mapper/sys/DataDictionary.xml

@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.order.modules.sys.dao.DataDictionaryDAO">
+    <resultMap id="DataDictionaryMap" type="com.jpsoft.order.modules.sys.entity.DataDictionary">
+        <id property="id" column="id_"/>
+        <result property="name" column="name_"/>
+        <result property="value" column="value_"/>
+        <result property="sortNo" column="sort_no"/>
+        <result property="parentId" column="parent_id"/>
+        <result property="parentName" column="parent_name"/>
+        <result property="dataType" column="data_type"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createDate" column="create_date"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateDate" column="update_date"/>
+        <result property="activated" column="activated_"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="extended1" column="extended_1"/>
+        <result property="extended2" column="extended_2"/>
+        <result property="extended3" column="extended_3"/>
+
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.order.modules.sys.entity.DataDictionary">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
+		insert into sys_data_dictionary
+	    (id_,name_,value_,sort_no,parent_id,data_type,create_by,create_date,update_by,update_date,activated_,del_flag,
+	    extended_1,extended_2,extended_3)
+		values
+		(
+            #{id,jdbcType=VARCHAR}
+            ,#{name,jdbcType=VARCHAR}
+            ,#{value,jdbcType=VARCHAR}
+            ,#{sortNo,jdbcType= NUMERIC }
+            ,#{parentId,jdbcType=VARCHAR}
+            ,#{dataType,jdbcType= NUMERIC }
+            ,#{createBy,jdbcType=VARCHAR}
+            ,#{createDate,jdbcType= TIMESTAMP }
+            ,#{updateBy,jdbcType=VARCHAR}
+            ,#{updateDate,jdbcType= TIMESTAMP }
+            ,#{activated,jdbcType= NUMERIC }
+            ,#{delFlag,jdbcType= NUMERIC }
+            ,#{extended1,jdbcType=VARCHAR}
+            ,#{extended2,jdbcType=VARCHAR}
+            ,#{extended3,jdbcType=VARCHAR}
+		)
+	]]>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from sys_data_dictionary where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.order.modules.sys.entity.DataDictionary">
+        update sys_data_dictionary
+        <set>
+            <if test="name!=null">
+                name_=#{name,jdbcType=VARCHAR},
+            </if>
+            <if test="value!=null">
+                value_=#{value,jdbcType=VARCHAR},
+            </if>
+            <if test="sortNo!=null">
+                sort_no=#{sortNo,jdbcType= NUMERIC },
+            </if>
+            <if test="parentId!=null">
+                parent_id=#{parentId,jdbcType=VARCHAR},
+            </if>
+            <if test="dataType!=null">
+                data_type=#{dataType,jdbcType= NUMERIC },
+            </if>
+            <if test="createBy!=null">
+                create_by=#{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="createDate!=null">
+                create_date=#{createDate,jdbcType= TIMESTAMP },
+            </if>
+            <if test="updateBy!=null">
+                update_by=#{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateDate!=null">
+                update_date=#{updateDate,jdbcType= TIMESTAMP },
+            </if>
+            <if test="activated!=null">
+                activated_=#{activated,jdbcType= NUMERIC },
+            </if>
+            <if test="delFlag!=null">
+                del_flag=#{delFlag,jdbcType= NUMERIC },
+            </if>
+            <if test="extended1!=null">
+                extended_1=#{extended1,jdbcType= VARCHAR },
+            </if>
+            <if test="extended2!=null">
+                extended_2=#{extended2,jdbcType= VARCHAR },
+            </if>
+            <if test="extended3!=null">
+                extended_3=#{extended3,jdbcType= VARCHAR },
+            </if>
+
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="DataDictionaryMap">
+        select a.*,b.name_ as parent_name
+        from sys_data_dictionary a left join sys_data_dictionary b on a.parent_id = b.id_
+        where a.id_=#{0} and a.del_flag = 0
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from sys_data_dictionary where id_=#{0} and del_flag = 0
+    </select>
+    <select id="list" resultMap="DataDictionaryMap">
+        select * from sys_data_dictionary where del_flag = 0
+    </select>
+    <select id="findByParentId" parameterType="string" resultMap="DataDictionaryMap">
+        select *
+        from sys_data_dictionary a
+        where a.parent_id =#{parentId}
+        and a.del_flag = 0
+        order by a.sort_no asc
+    </select>
+    <select id="findByParentIdAndValue" resultMap="DataDictionaryMap">
+        select *
+        from sys_data_dictionary a
+        where a.parent_id =#{parentId} and a.value_=#{value} and a.del_flag = 0
+        order by a.sort_no asc
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="DataDictionaryMap">
+        <![CDATA[
+			SELECT
+				a.*,b.name_ AS parent_name
+			FROM
+				sys_data_dictionary a
+			LEFT JOIN sys_data_dictionary b ON a.parent_id = b.id_
+		]]>
+        <where>
+            a.del_flag = 0
+            <if test="searchParams.id != null">
+                and a.ID_ like #{searchParams.id}
+            </if>
+            <if test="searchParams.name != null">
+                and a.name_ like #{searchParams.name}
+            </if>
+            <if test="searchParams.excludeId != null">
+                <![CDATA[
+				and a.ID_ <> #{searchParams.excludeId}
+				]]>
+            </if>
+            <if test="searchParams.dataType != null">
+                and a.data_type = #{searchParams.dataType}
+            </if>
+            <if test="searchParams.parentId != null">
+                <![CDATA[
+				and a.parent_id = #{searchParams.parentId}
+				]]>
+            </if>
+
+        </where>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
+
+    <select id="queryChildren" resultType="java.util.HashMap" parameterType="string">
+        SELECT
+        a.id_ as id,a.name_ as name,a.value_ as value
+        FROM
+        sys_data_dictionary a where a.del_flag = 0
+        and data_type = 2
+        and a.parent_id = #{0}
+    </select>
+
+    <select id="getName" parameterType="string" resultType="string">
+        select a.name_ as name
+        from sys_data_dictionary a
+        where a.id_=#{0} and a.del_flag = 0
+    </select>
+    <select id="getValue" parameterType="string" resultType="string">
+        select a.value_ as value
+        from sys_data_dictionary a
+        where a.id_=#{0} and a.del_flag = 0
+    </select>
+    <select id="findByCatalogName" resultMap="DataDictionaryMap">
+        select a.*
+        from sys_data_dictionary a,sys_data_dictionary b
+        where a.parent_id =b.id_ and b.name_=#{0}
+        and a.del_flag = 0
+        order by a.sort_no asc
+    </select>
+    <select id="findNameByCatalogNameAndValue" parameterType="map" resultType="string">
+        select a.name_
+        from sys_data_dictionary a,sys_data_dictionary b
+        where a.parent_id =b.id_ and b.name_=#{catalogName}
+        and a.del_flag = 0
+        and a.value_=#{value}
+        order by a.sort_no asc
+        limit 1
+    </select>
+    <select id="findByCatalogNameAndValue" parameterType="map" resultMap="DataDictionaryMap">
+        select * from sys_data_dictionary a,sys_data_dictionary b
+        where a.parent_id =b.id_ and b.name_=#{catalogName}
+        and a.del_flag = 0
+        and a.value_=#{value}
+        order by a.sort_no asc
+        limit 1
+    </select>
+    <select id="findByName" resultMap="DataDictionaryMap">
+        select * from sys_data_dictionary where name_=#{0} limit 1;
+    </select>
+</mapper>

+ 143 - 0
common/src/main/resources/mapper/sys/Menu.xml

@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.order.modules.sys.dao.MenuDAO">
+    <resultMap id="MenuMap" type="com.jpsoft.order.modules.sys.entity.Menu">
+        <id property="id" column="id_"/>
+        <result property="menuName" column="menu_name"/>
+        <result property="parentId" column="parent_id"/>
+        <result property="parentName" column="parent_name"/>
+        <result property="sortNo" column="sort_no"/>
+        <result property="menuUrl" column="menu_url"/>
+        <result property="icon" column="icon_"/>
+        <result property="menuType" column="menu_type"/>
+        <result property="createTime" column="create_time"/>
+        <result property="createBy" column="create_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="delFlag" column="del_flag"/>
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.order.modules.sys.entity.Menu">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
+		insert into sys_menu
+	    (id_,menu_name,parent_id,sort_no,menu_url,menu_type,create_time,create_by,update_time,update_by,del_flag,icon_)
+		values
+		(
+            #{id,jdbcType=VARCHAR}
+            ,#{menuName,jdbcType=VARCHAR}
+            ,#{parentId,jdbcType=VARCHAR}
+            ,#{sortNo,jdbcType= NUMERIC }
+            ,#{menuUrl,jdbcType=VARCHAR}
+            ,#{menuType,jdbcType=VARCHAR}
+            ,#{createTime,jdbcType= TIMESTAMP }
+            ,#{createBy,jdbcType=VARCHAR}
+            ,#{updateTime,jdbcType= TIMESTAMP }
+            ,#{updateBy,jdbcType=VARCHAR}
+            ,#{delFlag,jdbcType= NUMERIC }
+            ,#{icon,jdbcType=VARCHAR}
+		)
+	]]>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from sys_menu where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.order.modules.sys.entity.Menu">
+        update sys_menu
+        <set>
+            <if test="menuName!=null">
+                menu_name=#{menuName,jdbcType=VARCHAR},
+            </if>
+            <if test="parentId!=null">
+                parent_id=#{parentId,jdbcType=VARCHAR},
+            </if>
+            <if test="sortNo!=null">
+                sort_no=#{sortNo,jdbcType= NUMERIC },
+            </if>
+            <if test="menuUrl!=null">
+                menu_url=#{menuUrl,jdbcType=VARCHAR},
+            </if>
+            <if test="menuType!=null">
+                menu_type=#{menuType,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime!=null">
+                create_time=#{createTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="createBy!=null">
+                create_by=#{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateTime!=null">
+                update_time=#{updateTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="updateBy!=null">
+                update_by=#{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="delFlag!=null">
+                del_flag=#{delFlag,jdbcType= NUMERIC },
+            </if>
+            <if test="icon!=null">
+                icon_=#{icon,jdbcType=VARCHAR},
+            </if>
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="MenuMap">
+        select a.*,b.menu_name as parent_name
+        from sys_menu a left join sys_menu b on a.parent_id = b.id_
+        where a.id_=#{0}
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from sys_menu where id_=#{0}
+    </select>
+    <select id="list" resultMap="MenuMap">
+        select * from sys_menu
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="MenuMap">
+        <![CDATA[
+			select a.*,b.menu_name as parent_name
+			from sys_menu a left join sys_menu b on a.parent_id = b.id_
+		]]>
+        where a.del_flag=0
+        <if test="searchParams.menuName != null">
+            and a.menu_name like #{searchParams.menuName}
+        </if>
+        <if test="searchParams.menuType != null">
+            and a.menu_type = #{searchParams.menuType}
+        </if>
+        <if test="searchParams.parentId != null">
+            and a.parent_id = #{searchParams.parentId}
+        </if>
+        <if test="searchParams.excludeId != null">
+            <![CDATA[
+                and a.id_ <> #{searchParams.excludeId}
+            ]]>
+        </if>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
+    <select id="findAllocMenu"  parameterType="string" resultMap="MenuMap">
+        select * from sys_menu m
+        where m.menu_type = 2
+        and m.del_flag=0
+        and m.id_ in(
+        select rm.menu_id from
+        sys_role_menu rm,sys_user_role ur
+        where ur.user_id=#{userId}
+        and ur.role_id = rm.role_id
+        and rm.menu_id = m.id_
+        )
+        <if test="parentId==null">
+            and (m.parent_id is null or m.parent_id='')
+        </if>
+        <if test="parentId!=null">
+            and m.parent_id = #{parentId}
+        </if>
+        order by m.sort_no asc
+    </select>
+</mapper>

+ 108 - 0
common/src/main/resources/mapper/sys/Permission.xml

@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.order.modules.sys.dao.PermissionDAO">
+    <resultMap id="PermissionMap" type="com.jpsoft.order.modules.sys.entity.Permission">
+        <id property="id" column="id_"/>
+        <result property="path" column="path_"/>
+        <result property="method" column="method_"/>
+        <result property="summary" column="summary_"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="createBy" column="create_by"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.order.modules.sys.entity.Permission">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
+		insert into sys_permission
+	    (id_,path_,method_,summary_,del_flag,create_by,update_by,create_time,update_time)
+		values
+		(
+            #{id,jdbcType=VARCHAR}
+            ,#{path,jdbcType=VARCHAR}
+            ,#{method,jdbcType=VARCHAR}
+            ,#{summary,jdbcType=VARCHAR}
+            ,#{delFlag,jdbcType= NUMERIC }
+            ,#{createBy,jdbcType=VARCHAR}
+            ,#{updateBy,jdbcType=VARCHAR}
+            ,#{createTime,jdbcType= TIMESTAMP }
+            ,#{updateTime,jdbcType= TIMESTAMP }
+		)
+	]]>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from sys_permission where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.order.modules.sys.entity.Permission">
+        update sys_permission
+        <set>
+            <if test="path!=null">
+                path_=#{path,jdbcType=VARCHAR},
+            </if>
+            <if test="method!=null">
+                method_=#{method,jdbcType=VARCHAR},
+            </if>
+            <if test="summary!=null">
+                summary_=#{summary,jdbcType=VARCHAR},
+            </if>
+            <if test="delFlag!=null">
+                del_flag=#{delFlag,jdbcType= NUMERIC },
+            </if>
+            <if test="createBy!=null">
+                create_by=#{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateBy!=null">
+                update_by=#{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime!=null">
+                create_time=#{createTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="updateTime!=null">
+                update_time=#{updateTime,jdbcType= TIMESTAMP },
+            </if>
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="PermissionMap">
+        select
+        id_,path_,method_,summary_,del_flag,create_by,update_by,create_time,update_time from sys_permission where
+        id_=#{0}
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from sys_permission where path_=#{path} and method_=#{method} and del_flag=0
+    </select>
+    <select id="list" resultMap="PermissionMap">
+        select * from sys_permission where del_flag=0
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="PermissionMap">
+        <![CDATA[
+			select * from sys_permission
+		]]>
+        where del_flag=0
+        <if test="searchParams.path != null">
+            and path_ like #{searchParams.path}
+        </if>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
+    <select id="hasPermitted" parameterType="string" resultType="int">
+        <![CDATA[
+            select count(*) from
+            sys_user u,sys_user_role ur,sys_role_permission rp,sys_permission p
+            where u.id_=#{userId}
+            and u.id_=ur.user_id
+            and ur.role_id = rp.role_id
+            and rp.perm_id = p.id_
+            and p.path_ = #{path}
+            and p.method_ = #{method}
+        ]]>
+    </select>
+</mapper>

+ 93 - 0
common/src/main/resources/mapper/sys/Role.xml

@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.order.modules.sys.dao.RoleDAO">
+    <resultMap id="RoleMap" type="com.jpsoft.order.modules.sys.entity.Role">
+        <id property="id" column="id_"/>
+        <result property="name" column="name_"/>
+        <result property="description" column="description_"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="createBy" column="create_by"/>
+        <result property="updateBy" column="update_by"/>
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.order.modules.sys.entity.Role">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
+		insert into sys_role
+	    (id_,name_,description_,create_time,update_time,del_flag,create_by,update_by)
+		values
+		(
+            #{id,jdbcType=VARCHAR}
+            ,#{name,jdbcType=VARCHAR}
+            ,#{description,jdbcType=VARCHAR}
+            ,#{createTime,jdbcType= TIMESTAMP }
+            ,#{updateTime,jdbcType= TIMESTAMP }
+            ,#{delFlag,jdbcType= NUMERIC }
+            ,#{createBy,jdbcType=VARCHAR}
+            ,#{updateBy,jdbcType=VARCHAR}
+		)
+	]]>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from sys_role where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.order.modules.sys.entity.Role">
+        update sys_role
+        <set>
+            <if test="name!=null">
+                name_=#{name,jdbcType=VARCHAR},
+            </if>
+            <if test="description!=null">
+                description_=#{description,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime!=null">
+                create_time=#{createTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="updateTime!=null">
+                update_time=#{updateTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="delFlag!=null">
+                del_flag=#{delFlag,jdbcType= NUMERIC },
+            </if>
+            <if test="createBy!=null">
+                create_by=#{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateBy!=null">
+                update_by=#{updateBy,jdbcType=VARCHAR},
+            </if>
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="RoleMap">
+        select
+        id_,name_,description_,create_time,update_time,del_flag,create_by,update_by from sys_role where id_=#{0}
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from sys_role where id_=#{0}
+    </select>
+    <select id="list" resultMap="RoleMap">
+        select * from sys_role  where del_flag=0 order by create_time asc
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="RoleMap">
+        <![CDATA[
+			select * from sys_role
+		]]>
+            where del_flag=0
+            <if test="searchParams.roleName != null">
+                and name_ like #{searchParams.roleName}
+            </if>
+            <if test="searchParams.roleDesc != null">
+                and description_ like #{searchParams.roleDesc}
+            </if>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
+</mapper>

+ 97 - 0
common/src/main/resources/mapper/sys/RoleMenu.xml

@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.order.modules.sys.dao.RoleMenuDAO">
+	<resultMap id="RoleMenuMap" type="com.jpsoft.order.modules.sys.entity.RoleMenu">
+		<id property="id" column="id_" />
+			<result property="roleId" column="role_id" />
+			<result property="menuId" column="menu_id" />
+			<result property="delFlag" column="del_flag" />
+			<result property="createBy" column="create_by" />
+			<result property="createTime" column="create_time" />
+			<result property="updateBy" column="update_by" />
+			<result property="updateTime" column="update_time" />
+			</resultMap>
+	<insert id="insert" parameterType="com.jpsoft.order.modules.sys.entity.RoleMenu">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into sys_role_menu
+	    (id_,role_id,menu_id,del_flag,create_by,create_time,update_by,update_time)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{roleId,jdbcType=VARCHAR}
+,#{menuId,jdbcType=VARCHAR}
+,#{delFlag,jdbcType= NUMERIC }
+,#{createBy,jdbcType=VARCHAR}
+,#{createTime,jdbcType= TIMESTAMP }
+,#{updateBy,jdbcType=VARCHAR}
+,#{updateTime,jdbcType= TIMESTAMP }
+		)
+	]]>
+	</insert>
+	<delete id="delete" parameterType="string">
+		delete from sys_role_menu where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<delete id="deleteByRoleId" parameterType="string">
+		delete from sys_role_menu where role_id=#{0}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.order.modules.sys.entity.RoleMenu">
+		update sys_role_menu
+		<set>
+				<if test="roleId!=null">
+		role_id=#{roleId,jdbcType=VARCHAR},
+		</if>
+				<if test="menuId!=null">
+		menu_id=#{menuId,jdbcType=VARCHAR},
+		</if>
+				<if test="delFlag!=null">
+		del_flag=#{delFlag,jdbcType= NUMERIC },
+		</if>
+				<if test="createBy!=null">
+		create_by=#{createBy,jdbcType=VARCHAR},
+		</if>
+				<if test="createTime!=null">
+		create_time=#{createTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="updateBy!=null">
+		update_by=#{updateBy,jdbcType=VARCHAR},
+		</if>
+				<if test="updateTime!=null">
+		update_time=#{updateTime,jdbcType= TIMESTAMP },
+		</if>
+		</set>
+	where id_=#{id}
+	</update>
+	<select id="get" parameterType="string" resultMap="RoleMenuMap">
+		select 
+id_,role_id,menu_id,del_flag,create_by,create_time,update_by,update_time		from sys_role_menu where id_=#{0}
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from sys_role_menu where id_=#{0}
+	</select>
+	<select id="list" resultMap="RoleMenuMap">
+		select * from sys_role_menu
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="RoleMenuMap">
+		<![CDATA[
+			select * from sys_role_menu
+		]]>
+		<where>
+			<if test="searchParams.id != null">
+				and ID_ like #{searchParams.id}
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList"  open="order by" separator=",">
+	        ${sort.name} ${sort.order}
+	 	</foreach>
+	</select>
+	<select id="findByRoleId" parameterType="string" resultMap="RoleMenuMap">
+		select * from sys_role_menu where role_id=#{0}
+	</select>
+</mapper>

+ 96 - 0
common/src/main/resources/mapper/sys/RolePermission.xml

@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.order.modules.sys.dao.RolePermissionDAO">
+	<resultMap id="RolePermissionMap" type="com.jpsoft.order.modules.sys.entity.RolePermission">
+		<id property="id" column="id_" />
+			<result property="permId" column="perm_id" />
+			<result property="roleId" column="role_id" />
+			<result property="delFlag" column="del_flag" />
+			<result property="createBy" column="create_by" />
+			<result property="updateBy" column="update_by" />
+			<result property="createTime" column="create_time" />
+			<result property="updateTime" column="update_time" />
+			</resultMap>
+	<insert id="insert" parameterType="com.jpsoft.order.modules.sys.entity.RolePermission">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into sys_role_permission
+	    (id_,perm_id,role_id,del_flag,create_by,update_by,create_time,update_time)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{permId,jdbcType=VARCHAR}
+,#{roleId,jdbcType=VARCHAR}
+,#{delFlag,jdbcType= NUMERIC }
+,#{createBy,jdbcType=VARCHAR}
+,#{updateBy,jdbcType=VARCHAR}
+,#{createTime,jdbcType= TIMESTAMP }
+,#{updateTime,jdbcType= TIMESTAMP }
+		)
+	]]>
+	</insert>
+	<delete id="delete" parameterType="string">
+		delete from sys_role_permission where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<delete id="deleteByRoleId" parameterType="string">
+		delete from sys_role_permission where role_id=#{0}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.order.modules.sys.entity.RolePermission">
+		update sys_role_permission
+		<set>
+				<if test="permId!=null">
+		perm_id=#{permId,jdbcType=VARCHAR},
+		</if>
+				<if test="roleId!=null">
+		role_id=#{roleId,jdbcType=VARCHAR},
+		</if>
+				<if test="delFlag!=null">
+		del_flag=#{delFlag,jdbcType= NUMERIC },
+		</if>
+				<if test="createBy!=null">
+		create_by=#{createBy,jdbcType=VARCHAR},
+		</if>
+				<if test="updateBy!=null">
+		update_by=#{updateBy,jdbcType=VARCHAR},
+		</if>
+				<if test="createTime!=null">
+		create_time=#{createTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="updateTime!=null">
+		update_time=#{updateTime,jdbcType= TIMESTAMP },
+		</if>
+		</set>
+	where id_=#{id}
+	</update>
+	<select id="get" parameterType="string" resultMap="RolePermissionMap">
+		select * from sys_role_permission where id_=#{0}
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from sys_role_permission where id_=#{0}
+	</select>
+	<select id="list" resultMap="RolePermissionMap">
+		select * from sys_role_permission
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="RolePermissionMap">
+		<![CDATA[
+			select * from sys_role_permission
+		]]>
+		<where>
+			<if test="searchParams.id != null">
+				and ID_ like #{searchParams.id}
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList"  open="order by" separator=",">
+	        ${sort.name} ${sort.order}
+	 	</foreach>
+	</select>
+	<select id="findByRoleId" parameterType="string" resultMap="RolePermissionMap">
+		select * from sys_role_permission where role_id=#{0}
+	</select>
+</mapper>

+ 111 - 0
common/src/main/resources/mapper/sys/SysLog.xml

@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.order.modules.sys.dao.SysLogDAO">
+    <resultMap id="SysLogMap" type="com.jpsoft.order.modules.sys.entity.SysLog">
+        <id property="id" column="id_"/>
+        <result property="remoteIp" column="remote_ip"/>
+        <result property="url" column="url_"/>
+        <result property="data" column="data_"/>
+        <result property="userId" column="user_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="remark" column="remark_"/>
+        <result property="elapse" column="elapse_"/>
+        <result property="pointcut" column="pointcut_"/>
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.order.modules.sys.entity.SysLog">
+        <selectKey resultType="long" keyColumn="id_" keyProperty="id">
+            SELECT LAST_INSERT_ID() AS id_
+        </selectKey>
+        <![CDATA[
+		insert into sys_log
+	    (remote_ip,url_,data_,user_id,create_time,remark_,elapse_,pointcut_)
+		values
+		(
+            #{remoteIp,jdbcType=VARCHAR}
+            ,#{url,jdbcType=VARCHAR}
+            ,#{data,jdbcType=VARCHAR}
+            ,#{userId,jdbcType=VARCHAR}
+            ,#{createTime,jdbcType= TIMESTAMP }
+            ,#{remark,jdbcType=VARCHAR}
+            ,#{elapse,jdbcType=NUMERIC}
+            ,#{pointcut,jdbcType=VARCHAR}
+		)
+	]]>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from sys_log where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.order.modules.sys.entity.SysLog">
+        update sys_log
+        <set>
+            <if test="remoteIp!=null">
+                remote_ip=#{remoteIp,jdbcType=VARCHAR},
+            </if>
+            <if test="url!=null">
+                url_=#{url,jdbcType=VARCHAR},
+            </if>
+            <if test="data!=null">
+                data_=#{data,jdbcType=VARCHAR},
+            </if>
+            <if test="userId!=null">
+                user_id=#{userId,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime!=null">
+                create_time=#{createTime,jdbcType= TIMESTAMP },
+            </if>
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="SysLogMap">
+        select * from sys_log where id_=#{0}
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from sys_log where id_=#{0}
+    </select>
+    <select id="list" resultMap="SysLogMap">
+        select * from sys_log
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="SysLogMap">
+        <![CDATA[
+			select * from sys_log
+		]]>
+        <where>
+            <if test="searchParams.userId != null">
+                and user_id = #{searchParams.userId}
+            </if>
+            <if test="searchParams.remoteIP != null">
+                and remote_ip like #{searchParams.remoteIP}
+            </if>
+            <if test="searchParams.url != null">
+                and url_ like #{searchParams.url}
+            </if>
+            <if test="searchParams.pointcut != null">
+                and pointcut_ like #{searchParams.pointcut}
+            </if>
+            <if test="searchParams.startTime != null">
+                and create_time >= #{searchParams.startTime}
+            </if>
+            <if test="searchParams.endTime != null">
+                <![CDATA[
+                    and create_time <= #{searchParams.endTime}
+                ]]>
+            </if>
+            <if test="searchParams.elapseMin != null">
+                and elapse_ >= #{searchParams.elapseMin}
+            </if>
+            <if test="searchParams.elapseMax != null">
+                <![CDATA[
+                    and elapse_ <= #{searchParams.elapseMax}
+                ]]>
+            </if>
+            <if test="searchParams.remark != null">
+                and remark_ like #{searchParams.remark}
+            </if>
+        </where>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
+</mapper>

+ 112 - 0
common/src/main/resources/mapper/sys/User.xml

@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.order.modules.sys.dao.UserDAO">
+    <resultMap id="UserMap" type="com.jpsoft.order.modules.sys.entity.User">
+        <id property="id" column="id_"/>
+        <result property="userName" column="user_name"/>
+        <result property="password" column="password_"/>
+        <result property="realName" column="real_name"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="createBy" column="create_by"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="schoolId" column="school_id"/>
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.order.modules.sys.entity.User">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
+		insert into sys_user
+	    (id_,user_name,password_,real_name,create_time,update_time,
+	    del_flag,create_by,update_by,school_id)
+		values
+		(
+            #{id,jdbcType=VARCHAR}
+            ,#{userName,jdbcType=VARCHAR}
+            ,#{password,jdbcType=VARCHAR}
+            ,#{realName,jdbcType=VARCHAR}
+            ,#{createTime,jdbcType= TIMESTAMP }
+            ,#{updateTime,jdbcType= TIMESTAMP }
+            ,#{delFlag,jdbcType= NUMERIC }
+            ,#{createBy,jdbcType=VARCHAR}
+            ,#{updateBy,jdbcType=VARCHAR}
+            ,#{schoolId,jdbcType=VARCHAR}
+		)
+	]]>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from sys_user where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.order.modules.sys.entity.User">
+        update sys_user
+        <set>
+            <if test="userName!=null">
+                user_name=#{userName,jdbcType=VARCHAR},
+            </if>
+            <if test="password!=null">
+                password_=#{password,jdbcType=VARCHAR},
+            </if>
+            <if test="realName!=null">
+                real_name=#{realName,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime!=null">
+                create_time=#{createTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="updateTime!=null">
+                update_time=#{updateTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="delFlag!=null">
+                del_flag=#{delFlag,jdbcType= NUMERIC },
+            </if>
+            <if test="createBy!=null">
+                create_by=#{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateBy!=null">
+                update_by=#{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="schoolId!=null">
+                school_id=#{schoolId,jdbcType=VARCHAR},
+            </if>
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="UserMap">
+        select * from sys_user where id_=#{0}
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from sys_user where id_=#{0}
+    </select>
+    <select id="list" resultMap="UserMap">
+        select * from sys_user
+    </select>
+    <select id="findByUserName" parameterType="string" resultMap="UserMap">
+        select * from sys_user where user_name=#{userName} and del_flag=0 limit 1
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="UserMap">
+        <![CDATA[
+			select a.*
+			from sys_user a
+			where a.del_flag = 0
+		]]>
+        <if test="searchParams.userName != null">
+            and a.user_name like #{searchParams.userName}
+        </if>
+        <if test="searchParams.realName != null">
+            and a.real_name like #{searchParams.realName}
+        </if>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
+    <select id="hasRole" parameterType="string" resultType="long">
+        select count(*) from sys_user_role ur,sys_role r
+        where ur.role_id = r.id_
+        and ur.user_id = #{userId} and r.name_=#{roleName}
+    </select>
+</mapper>

+ 117 - 0
common/src/main/resources/mapper/sys/UserRole.xml

@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.order.modules.sys.dao.UserRoleDAO">
+    <resultMap id="UserRoleMap" type="com.jpsoft.order.modules.sys.entity.UserRole">
+        <id property="id" column="id_"/>
+        <result property="roleId" column="role_id"/>
+        <result property="userId" column="user_id"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="createBy" column="create_by"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.order.modules.sys.entity.UserRole">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
+		insert into sys_user_role
+	    (id_,role_id,user_id,del_flag,create_by,update_by,create_time,update_time)
+		values
+		(
+            #{id,jdbcType=VARCHAR}
+            ,#{roleId,jdbcType=VARCHAR}
+            ,#{userId,jdbcType=VARCHAR}
+            ,#{delFlag,jdbcType= NUMERIC }
+            ,#{createBy,jdbcType=VARCHAR}
+            ,#{updateBy,jdbcType=VARCHAR}
+            ,#{createTime,jdbcType= TIMESTAMP }
+            ,#{updateTime,jdbcType= TIMESTAMP }
+		)
+	]]>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from sys_user_role where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <delete id="deleteByUserId" parameterType="string">
+        delete from sys_user_role where user_id=#{0}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.order.modules.sys.entity.UserRole">
+        update sys_user_role
+        <set>
+            <if test="roleId!=null">
+                role_id=#{roleId,jdbcType=VARCHAR},
+            </if>
+            <if test="userId!=null">
+                user_id=#{userId,jdbcType=VARCHAR},
+            </if>
+            <if test="delFlag!=null">
+                del_flag=#{delFlag,jdbcType= NUMERIC },
+            </if>
+            <if test="createBy!=null">
+                create_by=#{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateBy!=null">
+                update_by=#{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime!=null">
+                create_time=#{createTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="updateTime!=null">
+                update_time=#{updateTime,jdbcType= TIMESTAMP },
+            </if>
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="UserRoleMap">
+        select
+        id_,role_id,user_id,del_flag,create_by,update_by,create_time,update_time from sys_user_role where id_=#{0}
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from sys_user_role where id_=#{0}
+    </select>
+    <select id="list" resultMap="UserRoleMap">
+        select * from sys_user_role
+    </select>
+    <select id="findRoleByUserId" parameterType="string" resultMap="com.jpsoft.order.modules.sys.dao.RoleDAO.RoleMap">
+        select r.* from sys_user_role ur,sys_role r
+        where ur.role_id = r.id_
+        and ur.user_id = #{0}
+        order by ur.create_time asc
+    </select>
+    <select id="findRoleNameByUserId" parameterType="string" resultType="string">
+        select r.name_ from sys_user_role ur,sys_role r
+        where ur.role_id = r.id_
+        and ur.user_id = #{0}
+        order by ur.create_time asc
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="UserRoleMap">
+        <![CDATA[
+			select * from sys_user_role
+		]]>
+        <where>
+            <if test="searchParams.id != null">
+                and ID_ like #{searchParams.id}
+            </if>
+        </where>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
+    <select id="findCountByAIdAndRName" parameterType="string" resultType="int">
+        SELECT
+        count( a.id_ )
+        FROM
+        sys_user_role a,
+        sys_role b
+        WHERE
+        a.role_id = b.id_
+        AND a.user_id = #{userId}
+        AND b.name_ = #{roleName}
+    </select>
+</mapper>

+ 0 - 0
README.md → loggerPath_IS_UNDEFINED/logfile.log


+ 310 - 0
mvnw

@@ -0,0 +1,310 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven2 Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+#   JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+#   M2_HOME - location of maven2's installed home dir
+#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
+#     e.g. to debug Maven itself, use
+#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+  if [ -f /etc/mavenrc ] ; then
+    . /etc/mavenrc
+  fi
+
+  if [ -f "$HOME/.mavenrc" ] ; then
+    . "$HOME/.mavenrc"
+  fi
+
+fi
+
+# OS specific support.  $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+  CYGWIN*) cygwin=true ;;
+  MINGW*) mingw=true;;
+  Darwin*) darwin=true
+    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+    if [ -z "$JAVA_HOME" ]; then
+      if [ -x "/usr/libexec/java_home" ]; then
+        export JAVA_HOME="`/usr/libexec/java_home`"
+      else
+        export JAVA_HOME="/Library/Java/Home"
+      fi
+    fi
+    ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+  if [ -r /etc/gentoo-release ] ; then
+    JAVA_HOME=`java-config --jre-home`
+  fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+  ## resolve links - $0 may be a link to maven's home
+  PRG="$0"
+
+  # need this for relative symlinks
+  while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+      PRG="$link"
+    else
+      PRG="`dirname "$PRG"`/$link"
+    fi
+  done
+
+  saveddir=`pwd`
+
+  M2_HOME=`dirname "$PRG"`/..
+
+  # make it fully qualified
+  M2_HOME=`cd "$M2_HOME" && pwd`
+
+  cd "$saveddir"
+  # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME=`cygpath --unix "$M2_HOME"`
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+  [ -n "$CLASSPATH" ] &&
+    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME="`(cd "$M2_HOME"; pwd)`"
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+  javaExecutable="`which javac`"
+  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+    # readlink(1) is not available as standard on Solaris 10.
+    readLink=`which readlink`
+    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+      if $darwin ; then
+        javaHome="`dirname \"$javaExecutable\"`"
+        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+      else
+        javaExecutable="`readlink -f \"$javaExecutable\"`"
+      fi
+      javaHome="`dirname \"$javaExecutable\"`"
+      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+      JAVA_HOME="$javaHome"
+      export JAVA_HOME
+    fi
+  fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+  if [ -n "$JAVA_HOME"  ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+      # IBM's JDK on AIX uses strange locations for the executables
+      JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+      JAVACMD="$JAVA_HOME/bin/java"
+    fi
+  else
+    JAVACMD="`which java`"
+  fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+  echo "Error: JAVA_HOME is not defined correctly." >&2
+  echo "  We cannot execute $JAVACMD" >&2
+  exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+  echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+  if [ -z "$1" ]
+  then
+    echo "Path not specified to find_maven_basedir"
+    return 1
+  fi
+
+  basedir="$1"
+  wdir="$1"
+  while [ "$wdir" != '/' ] ; do
+    if [ -d "$wdir"/.mvn ] ; then
+      basedir=$wdir
+      break
+    fi
+    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+    if [ -d "${wdir}" ]; then
+      wdir=`cd "$wdir/.."; pwd`
+    fi
+    # end of workaround
+  done
+  echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+  if [ -f "$1" ]; then
+    echo "$(tr -s '\n' ' ' < "$1")"
+  fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+  exit 1;
+fi
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Found .mvn/wrapper/maven-wrapper.jar"
+    fi
+else
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
+    fi
+    if [ -n "$MVNW_REPOURL" ]; then
+      jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
+    else
+      jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
+    fi
+    while IFS="=" read key value; do
+      case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
+      esac
+    done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Downloading from: $jarUrl"
+    fi
+    wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
+    if $cygwin; then
+      wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
+    fi
+
+    if command -v wget > /dev/null; then
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Found wget ... using wget"
+        fi
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+            wget "$jarUrl" -O "$wrapperJarPath"
+        else
+            wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
+        fi
+    elif command -v curl > /dev/null; then
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Found curl ... using curl"
+        fi
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+            curl -o "$wrapperJarPath" "$jarUrl" -f
+        else
+            curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
+        fi
+        
+    else
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Falling back to using Java to download"
+        fi
+        javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+        # For Cygwin, switch paths to Windows format before running javac
+        if $cygwin; then
+          javaClass=`cygpath --path --windows "$javaClass"`
+        fi
+        if [ -e "$javaClass" ]; then
+            if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+                if [ "$MVNW_VERBOSE" = true ]; then
+                  echo " - Compiling MavenWrapperDownloader.java ..."
+                fi
+                # Compiling the Java class
+                ("$JAVA_HOME/bin/javac" "$javaClass")
+            fi
+            if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+                # Running the downloader
+                if [ "$MVNW_VERBOSE" = true ]; then
+                  echo " - Running MavenWrapperDownloader.java ..."
+                fi
+                ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
+            fi
+        fi
+    fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+if [ "$MVNW_VERBOSE" = true ]; then
+  echo $MAVEN_PROJECTBASEDIR
+fi
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME=`cygpath --path --windows "$M2_HOME"`
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+  [ -n "$CLASSPATH" ] &&
+    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+  $MAVEN_OPTS \
+  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 182 - 0
mvnw.cmd

@@ -0,0 +1,182 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements.  See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership.  The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License.  You may obtain a copy of the License at
+@REM
+@REM    https://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied.  See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven2 Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM     e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
+
+FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+    IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Found %WRAPPER_JAR%
+    )
+) else (
+    if not "%MVNW_REPOURL%" == "" (
+        SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
+    )
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Couldn't find %WRAPPER_JAR%, downloading it ...
+        echo Downloading from: %DOWNLOAD_URL%
+    )
+
+    powershell -Command "&{"^
+		"$webclient = new-object System.Net.WebClient;"^
+		"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+		"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+		"}"^
+		"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
+		"}"
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Finished downloading %WRAPPER_JAR%
+    )
+)
+@REM End of extension
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
+
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
+
+exit /B %ERROR_CODE%

+ 87 - 0
pom.xml

@@ -0,0 +1,87 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <modules>
+        <module>web</module>
+        <module>common</module>
+    </modules>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.2.1.RELEASE</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>com.jpsoft.order</groupId>
+    <artifactId>order-server</artifactId>
+    <version>1.0.0</version>
+    <name>order-server</name>
+    <packaging>pom</packaging>
+    <description>开发区网上入学系统</description>
+    <properties>
+        <java.version>1.8</java.version>
+        <lombok.version>1.16.12</lombok.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-devtools</artifactId>
+            <scope>runtime</scope>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.junit.vintage</groupId>
+                    <artifactId>junit-vintage-engine</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!--logging start-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-logging</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.lazyluke</groupId>
+            <artifactId>log4jdbc-remix</artifactId>
+            <version>0.2.7</version>
+        </dependency>
+        <!--logging end-->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>${lombok.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.0.6</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.16</version>
+                <configuration>
+                    <includes>
+                        <include>**/*TestForPack.java</include>
+                    </includes>
+                    <argLine>-Xmx256M</argLine>
+                </configuration>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.maven.surefire</groupId>
+                        <artifactId>surefire-junit47</artifactId>
+                        <version>2.16</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 33 - 0
web/.gitignore

@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**
+!**/src/test/**
+**/src/main/resources/application-dev.yml
+
+.mvn
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+
+### VS Code ###
+.vscode/

+ 186 - 0
web/pom.xml

@@ -0,0 +1,186 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.jpsoft.order</groupId>
+        <artifactId>order-server</artifactId>
+        <version>1.0.0</version>
+    </parent>
+    <groupId>com.jpsoft.order</groupId>
+    <artifactId>web</artifactId>
+    <version>1.0.0</version>
+    <name>web</name>
+    <packaging>war</packaging>
+    <description>开发区网上入学系统网站</description>
+    <properties>
+        <swagger2.version>2.7.0</swagger2.version>
+        <jwts.version>0.10.5</jwts.version>
+        <netty-all.version>4.1.6.Final</netty-all.version>
+        <fastjson.version>1.2.29</fastjson.version>
+        <alipay.version>4.8.10.ALL</alipay.version>
+        <ijpay.version>2.3.2</ijpay.version>
+        <poi.version>4.1.0</poi.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-thymeleaf</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>net.sourceforge.nekohtml</groupId>
+            <artifactId>nekohtml</artifactId>
+            <version>1.9.22</version>
+        </dependency>
+        <dependency>
+            <groupId>com.jpsoft.order</groupId>
+            <artifactId>common</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+            <version>${swagger2.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger-ui</artifactId>
+            <version>${swagger2.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+        </dependency>
+        <!--jwt start-->
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt-api</artifactId>
+            <version>0.10.5</version>
+        </dependency>
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt-impl</artifactId>
+            <version>${jwts.version}</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt-jackson</artifactId>
+            <version>${jwts.version}</version>
+            <scope>runtime</scope>
+        </dependency>
+        <!--jwt end-->
+        <!--支付相关 start-->
+        <dependency>
+            <groupId>com.github.javen205</groupId>
+            <artifactId>IJPay-All</artifactId>
+            <version>${ijpay.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.jfinal</groupId>
+            <artifactId>jfinal</artifactId>
+            <version>3.5</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alipay.sdk</groupId>
+            <artifactId>alipay-sdk-java</artifactId>
+            <version>${alipay.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.bouncycastle</groupId>
+                    <artifactId>bcprov-jdk15on</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!--支付相关 end-->
+        <dependency>
+            <groupId>joda-time</groupId>
+            <artifactId>joda-time</artifactId>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <fork>true</fork>
+                    <addResources>true</addResources>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    <profiles>
+        <profile>
+            <id>dev</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                </dependency>
+            </dependencies>
+            <properties>
+                <active.profile>dev</active.profile>
+            </properties>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+        </profile>
+        <profile>
+            <id>test</id>
+            <dependencies>
+                <dependency>
+                    <groupId>javax.servlet</groupId>
+                    <artifactId>javax.servlet-api</artifactId>
+                    <version>3.1.0</version>
+                    <scope>provided</scope>
+                </dependency>
+            </dependencies>
+            <properties>
+                <active.profile>test</active.profile>
+            </properties>
+        </profile>
+        <profile>
+            <id>production</id>
+            <properties>
+                <active.profile>production</active.profile>
+            </properties>
+            <dependencies>
+                <dependency>
+                    <groupId>javax.servlet</groupId>
+                    <artifactId>javax.servlet-api</artifactId>
+                    <version>3.1.0</version>
+                    <scope>provided</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+        <profile>
+            <id>docker</id>
+            <properties>
+                <active.profile>docker</active.profile>
+            </properties>
+            <dependencies>
+                <dependency>
+                    <groupId>javax.servlet</groupId>
+                    <artifactId>javax.servlet-api</artifactId>
+                    <version>3.1.0</version>
+                    <scope>provided</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+    </profiles>
+</project>

+ 25 - 0
web/src/main/java/com/jpsoft/order/OrderServerApplication.java

@@ -0,0 +1,25 @@
+package com.jpsoft.order;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@SpringBootApplication
+@EnableTransactionManagement
+@EnableAsync
+@MapperScan("com.jpsoft.order.**.dao")
+public class OrderServerApplication extends SpringBootServletInitializer {
+
+	public static void main(String[] args) {
+		SpringApplication.run(OrderServerApplication.class, args);
+	}
+
+	@Override
+	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
+		return builder.sources(OrderServerApplication.class);
+	}
+}

+ 59 - 0
web/src/main/java/com/jpsoft/order/advice/GlobalExceptionHandler.java

@@ -0,0 +1,59 @@
+package com.jpsoft.order.advice;
+
+import com.jpsoft.order.modules.common.dto.MessageResult;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+import org.springframework.web.servlet.NoHandlerFoundException;
+
+import javax.validation.ConstraintViolationException;
+import javax.validation.ValidationException;
+
+@Slf4j
+@RestControllerAdvice
+public class GlobalExceptionHandler {
+    @ExceptionHandler(MethodArgumentNotValidException.class)
+    public MessageResult<String> handleMethodArgumentNotValidException(MethodArgumentNotValidException ex) {
+        log.error(ex.getMessage(),ex);
+
+        String message = ex.getBindingResult().getFieldError().getDefaultMessage();
+
+        MessageResult<String> messageResult = new MessageResult(false,message,null,500);
+
+        return messageResult;
+    }
+
+    @ExceptionHandler(ValidationException.class)
+    public MessageResult<String> handleValidationException(ValidationException ex) {
+        log.error(ex.getMessage(),ex);
+
+        String message = ex.getMessage();
+
+        MessageResult<String> messageResult = new MessageResult(false,message,null,500);
+
+        return messageResult;
+    }
+
+    @ExceptionHandler(ConstraintViolationException.class)
+    public MessageResult<String> handleConstraintViolationException(ConstraintViolationException ex) {
+        log.error(ex.getMessage(),ex);
+
+        String message = ex.getMessage();
+
+        MessageResult<String> messageResult = new MessageResult(false,message,null,500);
+
+        return messageResult;
+    }
+
+    @ExceptionHandler(NoHandlerFoundException.class)
+    public MessageResult<String> handleNoHandlerFoundException(Exception ex) {
+        log.error(ex.getMessage(),ex);
+
+        String message = ex.getMessage();
+
+        MessageResult<String> messageResult = new MessageResult(false,message,null,500);
+
+        return messageResult;
+    }
+}

+ 166 - 0
web/src/main/java/com/jpsoft/order/advice/PermissionAdvice.java

@@ -0,0 +1,166 @@
+package com.jpsoft.order.advice;
+
+import com.jpsoft.order.modules.common.dto.MessageResult;
+import com.jpsoft.order.modules.common.utils.HttpUtil;
+import com.jpsoft.order.modules.sys.entity.SysLog;
+import com.jpsoft.order.modules.sys.service.PermissionService;
+import com.jpsoft.order.modules.sys.service.SysLogService;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import javax.servlet.http.HttpServletRequest;
+import java.lang.reflect.Method;
+import java.util.Date;
+
+@Aspect
+@Component
+public class PermissionAdvice {
+    private  Logger logger= LoggerFactory.getLogger("root");
+
+    @Autowired
+    private SysLogService sysLogService;
+
+    @Autowired
+    private PermissionService permissionService;
+
+    @Pointcut("(execution(public * com.jpsoft.campus..controller.*.*(..)))")
+    public void pointcut(){
+
+    }
+
+    @Around("pointcut()")
+    public Object around(ProceedingJoinPoint point) throws Throwable {
+        long start = System.currentTimeMillis();
+
+        String classType = point.getTarget().getClass().getName();
+        Class<?> clazz = Class.forName(classType);
+        String clazzName = clazz.getName();
+        String clazzSimpleName = clazz.getSimpleName();
+        String methodName = point.getSignature().getName();
+
+        // 通过正则表达式判断当前url是否符合
+        //PathMatcher matcher = new AntPathMatcher();
+
+        StringBuilder pathBuilder = new StringBuilder();
+
+        //查询类的RequestMapping注解
+        RequestMapping classMapping = clazz.getAnnotation(RequestMapping.class);
+
+        if(classMapping != null && classMapping.value().length>0){
+            pathBuilder.append(classMapping.value()[0]);
+        }
+
+        //查询方法的RequestMapping注解
+        MethodSignature methodSignature = (MethodSignature)point.getSignature();
+        Method method = methodSignature.getMethod();
+
+        RequestMapping methodMapping = method.getAnnotation(RequestMapping.class);
+
+        if(methodMapping != null && methodMapping.value().length>0){
+            String subPath = methodMapping.value()[0];
+
+            if(!subPath.startsWith("/")){
+                pathBuilder.append("/");
+            }
+
+            pathBuilder.append(subPath);
+        }
+
+        ServletRequestAttributes requestAttrs = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+
+        Object obj = null;
+        SysLog sysLog = new SysLog();
+
+        if(requestAttrs!=null) {
+            HttpServletRequest request = requestAttrs.getRequest();
+
+            sysLog.setRemoteIp(HttpUtil.getIpAddress(request));
+            sysLog.setUrl(request.getRequestURI());
+
+            logger.warn("访问地址:" + request.getRequestURL().toString());
+            logger.warn("path=" + pathBuilder.toString());
+
+            //1.这里获取到所有的参数值的数组
+            Object[] args = point.getArgs();
+            String[] parameterNames = methodSignature.getParameterNames();
+
+            StringBuilder argBuilder = new StringBuilder();
+
+            for (int i = 0;i<Math.min(args.length, parameterNames.length);i++) {
+                if (argBuilder.length()!=0){
+                    argBuilder.append("&");
+                }
+
+                if(args[i] != null) {
+                    String value = args[i].toString();
+                    value = value.length() > 100 ? value.substring(0, 100) : value;
+
+                    if (parameterNames[i].equals("password")){
+                        value = "******";
+                    }
+
+                    argBuilder.append(parameterNames[i] + "=" + value);
+                }
+            }
+
+            sysLog.setData(argBuilder.toString());
+
+            String userId = (String)request.getAttribute("subject");
+
+            boolean existed = permissionService.exist(pathBuilder.toString(), request.getMethod());
+
+            // 查询该url是否加入到权限控制中,如果是则查询当前用户是否能访问该url
+            if (existed) {
+                logger.warn(pathBuilder.toString() + "已加入权限控制");
+
+                boolean permitted = permissionService.hasPermitted(userId, pathBuilder.toString(), request.getMethod());
+                logger.warn("是否许可当前用户访问:" + permitted);
+
+                if(permitted){
+                    // 执行切入方法
+                    obj = point.proceed();
+                }
+                else{
+                    MessageResult<String> msgResult = new MessageResult<>();
+                    msgResult.setCode(401);
+                    msgResult.setResult(false);
+                    msgResult.setMessage(pathBuilder.toString() + "未授权当前用户访问!");
+
+                    obj = msgResult;
+                }
+            }
+            else{
+                logger.warn(pathBuilder.toString() + "未加入权限控制");
+
+                // 执行切入方法
+                obj = point.proceed();
+            }
+        }
+
+        long elapse = System.currentTimeMillis() - start;
+
+        System.out.println(classType);
+        logger.warn(String.format("调用类%s方法%s耗时%s毫秒",clazzSimpleName,methodName,elapse));
+
+        if(elapse>3000) {
+            //执行时间超过3秒则记录数据库
+            sysLog.setElapse(elapse);
+            sysLog.setPointcut(clazzSimpleName + "->" + methodName);
+            sysLog.setRemark("方法耗时统计");
+            sysLog.setCreateTime(new Date());
+
+            sysLogService.insert(sysLog);
+        }
+
+        return obj;
+    }
+}

+ 187 - 0
web/src/main/java/com/jpsoft/order/config/RedisConfig.java

@@ -0,0 +1,187 @@
+package com.jpsoft.order.config;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.cache.interceptor.KeyGenerator;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.cache.RedisCacheConfiguration;
+import org.springframework.data.redis.cache.RedisCacheManager;
+import org.springframework.data.redis.cache.RedisCacheWriter;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.*;
+import org.springframework.data.redis.serializer.*;
+
+import java.lang.reflect.Method;
+
+
+@Configuration
+@EnableCaching
+public class RedisConfig extends CachingConfigurerSupport {
+    public final static String WX_COMMON_ACCESS_TOKEN = "wx_common_accessToken";
+    public final static String JS_API_TICKET = "js_api_ticket";
+    public final static String PERSON_SELECT_COMPANY = "psc_";
+
+    /**
+     * 注入 RedisConnectionFactory,注意maven中要有redis.clients.jedis
+     */
+    @Autowired
+    RedisConnectionFactory redisConnectionFactory;
+
+    @Bean
+    public StringRedisTemplate getStringRedisTemplate() {
+        //调用redisTemplate.exist方法时,是用StringRedisTemplate
+        StringRedisTemplate stringRedisTemplate = new StringRedisTemplate();
+        initDomainRedisTemplate(stringRedisTemplate, redisConnectionFactory);
+
+        return stringRedisTemplate;
+    }
+
+    /**
+     * 实例化 RedisTemplate 对象
+     * @return
+     */
+    @Bean
+    public RedisTemplate<String, Object> getRedisTemplate() {
+        RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
+        initDomainRedisTemplate(redisTemplate, redisConnectionFactory);
+        return redisTemplate;
+    }
+
+    /**
+     * 设置数据存入 redis 的序列化方式
+     *
+     * @param redisTemplate
+     * @param factory
+     */
+    private void initDomainRedisTemplate(RedisTemplate redisTemplate, RedisConnectionFactory factory) {
+        redisTemplate.setKeySerializer(new StringRedisSerializer());
+        redisTemplate.setValueSerializer(valueSerializer());
+        redisTemplate.setHashKeySerializer(new StringRedisSerializer());
+        redisTemplate.setHashValueSerializer(valueSerializer());
+        redisTemplate.setConnectionFactory(factory);
+    }
+
+    @Bean
+    @Override
+    public KeyGenerator keyGenerator() {
+        return new KeyGenerator() {
+            @Override
+            public Object generate(Object target, Method method, Object... params) {
+                StringBuilder sb = new StringBuilder();
+                sb.append(target.getClass().getName());
+                sb.append(method.getName());
+                for (Object obj : params) {
+                    sb.append(obj.toString());
+                }
+
+                return sb.toString();
+            }
+        };
+    }
+
+    /**
+     * 实例化 HashOperations 对象,可以使用 Hash 类型操作
+     *
+     * @param redisTemplate
+     * @return
+     */
+    @Bean
+    public HashOperations<String, String, Object> hashOperations(RedisTemplate<String, Object> redisTemplate) {
+        return redisTemplate.opsForHash();
+    }
+
+    /**
+     * 实例化 ValueOperations 对象,可以使用 String 操作
+     *
+     * @param redisTemplate
+     * @return
+     */
+    @Bean
+    public ValueOperations<String, Object> valueOperations(RedisTemplate<String, Object> redisTemplate) {
+        return redisTemplate.opsForValue();
+    }
+
+    /**
+     * 实例化 ListOperations 对象,可以使用 List 操作
+     *
+     * @param redisTemplate
+     * @return
+     */
+    @Bean
+    public ListOperations<String, Object> listOperations(RedisTemplate<String, Object> redisTemplate) {
+        return redisTemplate.opsForList();
+    }
+
+    /**
+     * 实例化 SetOperations 对象,可以使用 Set 操作
+     *
+     * @param redisTemplate
+     * @return
+     */
+    @Bean
+    public SetOperations<String, Object> setOperations(RedisTemplate<String, Object> redisTemplate) {
+        return redisTemplate.opsForSet();
+    }
+
+    /**
+     * 实例化 ZSetOperations 对象,可以使用 ZSet 操作
+     *
+     * @param redisTemplate
+     * @return
+     */
+    @Bean
+    public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) {
+        return redisTemplate.opsForZSet();
+    }
+
+    @Bean
+    public RedisCacheManager redisCacheManager(RedisConnectionFactory redisConnectionFactory) {
+        RedisCacheWriter redisCacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(redisConnectionFactory);
+        RedisCacheConfiguration redisCacheConfiguration = RedisCacheConfiguration.defaultCacheConfig()
+                .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(valueSerializer()));
+        redisCacheConfiguration.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new StringRedisSerializer()));
+        return new RedisCacheManager(redisCacheWriter, redisCacheConfiguration);
+    }
+
+    /**
+     * 使用Jackson序列化器
+     * @return
+     */
+    private RedisSerializer<Object> valueSerializer() {
+        Jackson2JsonRedisSerializer<Object> serializer = new Jackson2JsonRedisSerializer<Object>(Object.class);
+        ObjectMapper objectMapper = new ObjectMapper();
+        objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
+        /**
+         * 这一句必须要,作用是序列化时将对象全类名一起保存下来
+         * 设置之后的序列化结果如下:
+         *  [
+         *   "com.dxy.cache.pojo.Dept",
+         *   {
+         *     "pid": 1,
+         *     "code": "11",
+         *     "name": "财务部1"
+         *   }
+         * ]
+         *
+         * 不设置的话,序列化结果如下,将无法反序列化
+         *
+         *  {
+         *     "pid": 1,
+         *     "code": "11",
+         *     "name": "财务部1"
+         *   }
+         */
+//                objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
+        //因为上面那句代码已经被标记成作废,因此用下面这个方法代替,仅仅测试了一下,不知道是否完全正确
+        objectMapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance,ObjectMapper.DefaultTyping.NON_FINAL);
+        serializer.setObjectMapper(objectMapper);
+
+        return serializer;
+    }
+}

+ 72 - 0
web/src/main/java/com/jpsoft/order/config/SwaggerConfig.java

@@ -0,0 +1,72 @@
+package com.jpsoft.order.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.*;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spi.service.contexts.SecurityContext;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Configuration
+@EnableSwagger2
+public class SwaggerConfig {
+    @Bean
+    public Docket createRestApi() {
+        return new Docket(DocumentationType.SWAGGER_2)
+                .apiInfo(apiInfo())
+                .select()
+                .apis(RequestHandlerSelectors.basePackage("com.jpsoft.order"))
+                .paths(PathSelectors.any())
+                .build()
+                //添加登录认证
+                .securitySchemes(securitySchemes())
+                .securityContexts(securityContexts());
+    }
+
+    private List<ApiKey> securitySchemes() {
+        //设置请求头信息
+        List<ApiKey> result = new ArrayList<>();
+        ApiKey apiKey = new ApiKey("Authorization", "Authorization", "header");
+        result.add(apiKey);
+        return result;
+    }
+
+    private List<SecurityContext> securityContexts() {
+        //设置需要登录认证的路径
+        List<SecurityContext> result = new ArrayList<>();
+        result.add(getContextByPath("/*"));
+        return result;
+    }
+
+    private SecurityContext getContextByPath(String pathRegex){
+        return SecurityContext.builder()
+                .securityReferences(defaultAuth())
+                .forPaths(PathSelectors.regex(pathRegex))
+                .build();
+    }
+
+    private List<SecurityReference> defaultAuth() {
+        List<SecurityReference> result = new ArrayList<>();
+        AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
+        AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
+        authorizationScopes[0] = authorizationScope;
+        result.add(new SecurityReference("Authorization", authorizationScopes));
+        return result;
+    }
+
+    private ApiInfo apiInfo() {
+        return new ApiInfoBuilder()
+                .title("后台接口文档")
+                .description("")
+                .termsOfServiceUrl("")
+                .version("1.0")
+                .build();
+    }
+}

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