fllmoyu 4 سال پیش
کامیت
461c29d53a
100فایلهای تغییر یافته به همراه10022 افزوده شده و 0 حذف شده
  1. 33 0
      .gitignore
  2. 249 0
      common/pom.xml
  3. 17 0
      common/src/main/java/com/jpsoft/enterprise/config/OSSConfig.java
  4. 23 0
      common/src/main/java/com/jpsoft/enterprise/config/WxConfig.java
  5. 83 0
      common/src/main/java/com/jpsoft/enterprise/config/WxJpsoftConfig.java
  6. 50 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/dto/MessageResult.java
  7. 32 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/dto/Sort.java
  8. 21 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/service/BaseService.java
  9. 105 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/service/IRedisService.java
  10. 37 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/service/impl/RedisServiceImpl.java
  11. 135 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/AESUtil.java
  12. 73 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/AliyunLiveUtil.java
  13. 95 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/BASE64DecodedMultipartFile.java
  14. 273 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/Base64.java
  15. 198 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/CheckIdCard.java
  16. 76 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/DES3.java
  17. 197 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/GPSUtil.java
  18. 135 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/Generator/AbstractCaptchaA.java
  19. 29 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/Generator/AbstractGeneratorA.java
  20. 39 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/Generator/CaptchaUtilA.java
  21. 55 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/Generator/CircleCaptchaA.java
  22. 31 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/Generator/RandomGeneratorA.java
  23. 422 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/HttpConnectionUtil.java
  24. 60 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/HttpUtil.java
  25. 37 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/IdCardUtils.java
  26. 51 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/JwtUtil.java
  27. 32 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/JwtUtil2.java
  28. 24 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/MyX509TrustManager.java
  29. 201 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/NewWordUtils.java
  30. 348 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/OSSUtil.java
  31. 428 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/POIUtils.java
  32. 84 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/PojoUtils.java
  33. 162 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/SMSUtil.java
  34. 70 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/Sign.java
  35. 182 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/StringUtils.java
  36. 440 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/WechatMessageUtil.java
  37. 317 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/WeixinUtil.java
  38. 60 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/enterprise/AesException.java
  39. 26 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/enterprise/ByteGroup.java
  40. 67 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/enterprise/PKCS7Encoder.java
  41. 61 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/enterprise/SHA1.java
  42. 289 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/enterprise/WXBizMsgCrypt.java
  43. 71 0
      common/src/main/java/com/jpsoft/enterprise/modules/common/utils/enterprise/XMLParse.java
  44. 28 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/dao/DataDictionaryDAO.java
  45. 21 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/dao/MenuDAO.java
  46. 21 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/dao/PermissionDAO.java
  47. 19 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/dao/RoleDAO.java
  48. 23 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/dao/RoleMenuDAO.java
  49. 21 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/dao/RolePermissionDAO.java
  50. 19 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/dao/SysLogDAO.java
  51. 25 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/dao/UserDAO.java
  52. 22 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/dao/UserRoleDAO.java
  53. 24 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/dto/RoleRelatedDTO.java
  54. 203 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/entity/DataDictionary.java
  55. 199 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/entity/Menu.java
  56. 143 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/entity/Permission.java
  57. 129 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/entity/Role.java
  58. 129 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/entity/RoleMenu.java
  59. 129 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/entity/RolePermission.java
  60. 37 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/entity/SysLog.java
  61. 187 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/entity/User.java
  62. 129 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/entity/UserRole.java
  63. 27 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/DataDictionaryService.java
  64. 22 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/MenuService.java
  65. 20 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/PermissionService.java
  66. 20 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/RoleMenuService.java
  67. 22 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/RolePermissionService.java
  68. 17 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/RoleService.java
  69. 18 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/SysLogService.java
  70. 21 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/UserRoleService.java
  71. 23 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/UserService.java
  72. 117 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/impl/DataDictionaryServiceImpl.java
  73. 84 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/impl/MenuServiceImpl.java
  74. 75 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/impl/PermissionServiceImpl.java
  75. 80 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/impl/RoleMenuServiceImpl.java
  76. 80 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/impl/RolePermissionServiceImpl.java
  77. 70 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/impl/RoleServiceImpl.java
  78. 70 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/impl/SysLogServiceImpl.java
  79. 81 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/impl/UserRoleServiceImpl.java
  80. 97 0
      common/src/main/java/com/jpsoft/enterprise/modules/sys/service/impl/UserServiceImpl.java
  81. 23 0
      common/src/main/java/com/jpsoft/enterprise/modules/wechat/dao/ReplyMessageDAO.java
  82. 29 0
      common/src/main/java/com/jpsoft/enterprise/modules/wechat/entity/AccessToken.java
  83. 51 0
      common/src/main/java/com/jpsoft/enterprise/modules/wechat/entity/ReplyMessage.java
  84. 19 0
      common/src/main/java/com/jpsoft/enterprise/modules/wechat/service/ReplyMessageService.java
  85. 75 0
      common/src/main/java/com/jpsoft/enterprise/modules/wechat/service/impl/ReplyMessageServiceImpl.java
  86. 20 0
      common/src/main/java/com/jpsoft/enterprise/modules/wechat/vo/UserInfo.java
  87. 177 0
      common/src/main/resources/mapper/sys/DataDictionary.xml
  88. 143 0
      common/src/main/resources/mapper/sys/Menu.xml
  89. 108 0
      common/src/main/resources/mapper/sys/Permission.xml
  90. 93 0
      common/src/main/resources/mapper/sys/Role.xml
  91. 97 0
      common/src/main/resources/mapper/sys/RoleMenu.xml
  92. 96 0
      common/src/main/resources/mapper/sys/RolePermission.xml
  93. 111 0
      common/src/main/resources/mapper/sys/SysLog.xml
  94. 145 0
      common/src/main/resources/mapper/sys/User.xml
  95. 100 0
      common/src/main/resources/mapper/sys/UserRole.xml
  96. 97 0
      common/src/main/resources/mapper/wechat/ReplyMessage.xml
  97. 310 0
      mvnw
  98. 182 0
      mvnw.cmd
  99. 91 0
      pom.xml
  100. 185 0
      web/pom.xml

+ 33 - 0
.gitignore

@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### 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/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/

+ 249 - 0
common/pom.xml

@@ -0,0 +1,249 @@
+<?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>parent</artifactId>
+        <groupId>com.jpsoft.enterprise</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>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>
+        <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 -->
+
+        <!-- aliyun live start -->
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-live</artifactId>
+            <version>3.7.5</version>
+        </dependency>
+        <!-- aliyun live 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>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>
+
+        <dependency>
+            <groupId>com.github.javen205</groupId>
+            <artifactId>IJPay-All</artifactId>
+            <version>${ijpay.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alipay.sdk</groupId>
+            <artifactId>alipay-sdk-java</artifactId>
+            <version>${alipay.version}</version>
+        </dependency>
+
+        <!-- hibernate validator-->
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-validator</artifactId>
+            <version>5.2.0.Final</version>
+        </dependency>
+    </dependencies>
+
+
+</project>

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

@@ -0,0 +1,17 @@
+package com.jpsoft.enterprise.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;
+}

+ 23 - 0
common/src/main/java/com/jpsoft/enterprise/config/WxConfig.java

@@ -0,0 +1,23 @@
+package com.jpsoft.enterprise.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2020-3-21 13:42
+ */
+@Component
+@ConfigurationProperties(prefix = "wx.pay")
+@Data
+public class WxConfig {
+    private String appId;
+    private String appSecret;
+    private String token;
+    private String tokenUrl;
+    private String createQrCodeUrl;
+    private String showQrCodeUrl;
+    private String contentType;
+    private String portalUrl;
+}

+ 83 - 0
common/src/main/java/com/jpsoft/enterprise/config/WxJpsoftConfig.java

@@ -0,0 +1,83 @@
+package com.jpsoft.enterprise.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2019-11-26 9:35
+ */
+
+@Data
+@ConfigurationProperties(prefix = "wx.jpsoft")
+@Component
+public class WxJpsoftConfig {
+
+    /**
+     * 设置微信公众号或者小程序等的appid
+     */
+    private String appId;
+
+    /**
+     * 设置微信公众号或者小程序等的appSecret
+     */
+    private String appSecret;
+
+    /**
+     * 微信支付商户号
+     */
+    private String mchId;
+
+    /**
+     * 微信支付商户密钥
+     */
+    private String mchKey;
+
+    /**
+     * 服务商模式下的子商户公众账号ID,普通模式请不要配置,请在配置文件中将对应项删除
+     */
+    private String subAppId;
+
+    /**
+     * 服务商模式下的子商户号,普通模式请不要配置,最好是请在配置文件中将对应项删除
+     */
+    private String subMchId;
+
+    /**
+     * apiclient_cert.p12文件的绝对路径,或者如果放在项目中,请以classpath:开头指定
+     */
+    private String keyPath;
+
+    /**
+     * 回调地址
+     */
+    private String notifyUrl;
+
+    /**
+     * 退款回调
+     */
+    private String refundUrl;
+
+    /**
+     * 发起ip
+     */
+    private String ip;
+
+    /**
+     * 商品描述
+     */
+    private String body;
+
+    /**
+     * 证书地址
+     */
+    private String certPath;
+
+    private String temporaryUrl;
+
+    /**
+     * 跳转页面具体标识
+     */
+    private String urlKey;
+}

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

@@ -0,0 +1,50 @@
+package com.jpsoft.enterprise.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;
+	}
+}

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

@@ -0,0 +1,32 @@
+package com.jpsoft.enterprise.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/enterprise/modules/common/service/BaseService.java

@@ -0,0 +1,21 @@
+package com.jpsoft.enterprise.modules.common.service;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.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/enterprise/modules/common/service/IRedisService.java

@@ -0,0 +1,105 @@
+package com.jpsoft.enterprise.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/enterprise/modules/common/service/impl/RedisServiceImpl.java

@@ -0,0 +1,37 @@
+package com.jpsoft.enterprise.modules.common.service.impl;
+
+import com.jpsoft.enterprise.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_ENTERPRISE_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;
+
+    }
+}

+ 135 - 0
common/src/main/java/com/jpsoft/enterprise/modules/common/utils/AESUtil.java

@@ -0,0 +1,135 @@
+package com.jpsoft.enterprise.modules.common.utils;
+
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.UnsupportedEncodingException;
+import java.security.Security;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class AESUtil{
+    private static final String KEY_ALGORITHM = "AES";
+    private static final String DEFAULT_CIPHER_ALGORITHM = "AES/CBC/PKCS7Padding";//默认的加密算法
+    /**
+     * mysql默认取秘钥的ascii编码前16位
+     */
+    public static String MYSQL_ENC_KEY = "jpsoft8121234888";
+
+
+    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);
+    }*/
+}

+ 73 - 0
common/src/main/java/com/jpsoft/enterprise/modules/common/utils/AliyunLiveUtil.java

@@ -0,0 +1,73 @@
+package com.jpsoft.enterprise.modules.common.utils;
+
+import cn.hutool.crypto.digest.MD5;
+import com.aliyuncs.DefaultAcsClient;
+import com.aliyuncs.IAcsClient;
+import com.aliyuncs.exceptions.ClientException;
+import com.aliyuncs.live.model.v20161101.DescribeLiveStreamsOnlineListRequest;
+import com.aliyuncs.live.model.v20161101.DescribeLiveStreamsOnlineListResponse;
+import com.aliyuncs.profile.DefaultProfile;
+import com.aliyuncs.profile.IClientProfile;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Slf4j
+public class AliyunLiveUtil {
+    public static String generateSignedUrl(String uri,String fileName,long expiredTime,String privateKey){
+        String rand = "0";
+        String uid = "0";
+
+        String md5hash = MD5.create().digestHex(fileName + "-" + expiredTime + "-" + rand + "-" + uid + "-" + privateKey);
+
+        String signedUrl = uri + fileName + "?auth_key=" + expiredTime + "-" + rand + "-" + uid + "-" + md5hash;
+
+        return signedUrl;
+    }
+
+    public static List<DescribeLiveStreamsOnlineListResponse.LiveStreamOnlineInfo> queryPushStreamOnlineList(String regionId,
+                                                                                                             String accessKeyId,String secret,
+                                                                                                             String domainName,String appName,
+                                                                                                             String streamName){
+        List<DescribeLiveStreamsOnlineListResponse.LiveStreamOnlineInfo> list = null;
+
+        IClientProfile profile = DefaultProfile.getProfile(
+                regionId,            // 地域ID
+                accessKeyId,        // 您的AccessKey ID
+                secret);  // 您的AccessKey Secret
+
+        IAcsClient client = new DefaultAcsClient(profile);
+
+        DescribeLiveStreamsOnlineListRequest request = new DescribeLiveStreamsOnlineListRequest();
+
+        // 您的加速域名。
+        request.setDomainName(domainName);
+
+        // 应用名称。AppName 不支持通配符(*)查询,且不支持模糊查询。
+        request.setAppName(appName);
+
+        // 流名称。StreamName不支持通配符(*)查询,但支持模糊查询 。
+        request.setStreamName(streamName);
+
+        // 流类型。取值范围:all, raw, trans
+        request.setStreamType("all");
+
+        // 指定是否模糊匹配流名称。取值:fuzzy:模糊匹配;strict:精准匹配。
+        request.setQueryType("fuzzy");
+
+        try {
+            DescribeLiveStreamsOnlineListResponse response = client.getAcsResponse(request);
+            list = response.getOnlineInfo();
+        } catch (ClientException ex) {
+            log.error(ex.getMessage(), ex);
+        }
+
+        if (list==null){
+            //如果为空访问一个空队列
+            list = new ArrayList<>();
+        }
+
+        return list;
+    }
+}

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

@@ -0,0 +1,95 @@
+package com.jpsoft.enterprise.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;
+        }
+    }
+
+
+}

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

@@ -0,0 +1,273 @@
+package com.jpsoft.enterprise.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/enterprise/modules/common/utils/CheckIdCard.java

@@ -0,0 +1,198 @@
+package com.jpsoft.enterprise.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/enterprise/modules/common/utils/DES3.java

@@ -0,0 +1,76 @@
+package com.jpsoft.enterprise.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();
+		}
+	}*/
+}

+ 197 - 0
common/src/main/java/com/jpsoft/enterprise/modules/common/utils/GPSUtil.java

@@ -0,0 +1,197 @@
+package com.jpsoft.enterprise.modules.common.utils;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLConnection;
+import java.text.DecimalFormat;
+
+public class GPSUtil {
+    public static double pi = 3.1415926535897932384626;
+    public static double x_pi = 3.14159265358979324 * 3000.0 / 180.0;
+    public static double a = 6378245.0;
+    public static double ee = 0.00669342162296594323;
+
+    public static double transformLat(double x, double y) {
+        double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y
+                + 0.2 * Math.sqrt(Math.abs(x));
+        ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
+        ret += (20.0 * Math.sin(y * pi) + 40.0 * Math.sin(y / 3.0 * pi)) * 2.0 / 3.0;
+        ret += (160.0 * Math.sin(y / 12.0 * pi) + 320 * Math.sin(y * pi / 30.0)) * 2.0 / 3.0;
+        return ret;
+    }
+
+    public static double transformLon(double x, double y) {
+        double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1
+                * Math.sqrt(Math.abs(x));
+        ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
+        ret += (20.0 * Math.sin(x * pi) + 40.0 * Math.sin(x / 3.0 * pi)) * 2.0 / 3.0;
+        ret += (150.0 * Math.sin(x / 12.0 * pi) + 300.0 * Math.sin(x / 30.0
+                * pi)) * 2.0 / 3.0;
+        return ret;
+    }
+    public static double[] transform(double lat, double lon) {
+        if (outOfChina(lat, lon)) {
+            return new double[]{lat,lon};
+        }
+        double dLat = transformLat(lon - 105.0, lat - 35.0);
+        double dLon = transformLon(lon - 105.0, lat - 35.0);
+        double radLat = lat / 180.0 * pi;
+        double magic = Math.sin(radLat);
+        magic = 1 - ee * magic * magic;
+        double sqrtMagic = Math.sqrt(magic);
+        dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
+        dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
+        double mgLat = lat + dLat;
+        double mgLon = lon + dLon;
+        return new double[]{mgLat,mgLon};
+    }
+    public static boolean outOfChina(double lat, double lon) {
+        if (lon < 72.004 || lon > 137.8347)
+            return true;
+        if (lat < 0.8293 || lat > 55.8271)
+            return true;
+        return false;
+    }
+    /**
+     * 84 to 火星坐标系 (GCJ-02) World Geodetic System ==> Mars Geodetic System
+     *
+     * @param lat
+     * @param lon
+     * @return
+     */
+    public static double[] gps84_To_Gcj02(double lat, double lon) {
+        if (outOfChina(lat, lon)) {
+            return new double[]{lat,lon};
+        }
+        double dLat = transformLat(lon - 105.0, lat - 35.0);
+        double dLon = transformLon(lon - 105.0, lat - 35.0);
+        double radLat = lat / 180.0 * pi;
+        double magic = Math.sin(radLat);
+        magic = 1 - ee * magic * magic;
+        double sqrtMagic = Math.sqrt(magic);
+        dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
+        dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
+        double mgLat = lat + dLat;
+        double mgLon = lon + dLon;
+        return new double[]{mgLat, mgLon};
+    }
+
+    /**
+     * * 火星坐标系 (GCJ-02) to 84 * * @param lon * @param lat * @return
+     * */
+    public static double[] gcj02_To_Gps84(double lat, double lon) {
+        double[] gps = transform(lat, lon);
+        double lontitude = lon * 2 - gps[1];
+        double latitude = lat * 2 - gps[0];
+        return new double[]{latitude, lontitude};
+    }
+    /**
+     * 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 将 GCJ-02 坐标转换成 BD-09 坐标
+     *
+     * @param lat
+     * @param lon
+     */
+    public static double[] gcj02_To_Bd09(double lat, double lon) {
+        double x = lon, y = lat;
+        double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
+        double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
+        double tempLon = z * Math.cos(theta) + 0.0065;
+        double tempLat = z * Math.sin(theta) + 0.006;
+        double[] gps = {tempLat,tempLon};
+        return gps;
+    }
+
+    /**
+     * * 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 * * 将 BD-09 坐标转换成GCJ-02 坐标 * * @param
+     * bd_lat * @param bd_lon * @return
+     */
+    public static double[] bd09_To_Gcj02(double lat, double lon) {
+        double x = lon - 0.0065, y = lat - 0.006;
+        double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
+        double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
+        double tempLon = z * Math.cos(theta);
+        double tempLat = z * Math.sin(theta);
+        double[] gps = {tempLat,tempLon};
+        return gps;
+    }
+
+    /**将gps84转为bd09
+     * @param lat
+     * @param lon
+     * @return
+     */
+    public static double[] gps84_To_bd09(double lat,double lon){
+        double[] gcj02 = gps84_To_Gcj02(lat,lon);
+        double[] bd09 = gcj02_To_Bd09(gcj02[0],gcj02[1]);
+        return bd09;
+    }
+    public static double[] bd09_To_gps84(double lat,double lon){
+        double[] gcj02 = bd09_To_Gcj02(lat, lon);
+        double[] gps84 = gcj02_To_Gps84(gcj02[0], gcj02[1]);
+        //保留小数点后六位
+        gps84[0] = retain6(gps84[0]);
+        gps84[1] = retain6(gps84[1]);
+        return gps84;
+    }
+
+    /**保留小数点后六位
+     * @param num
+     * @return
+     */
+    private static double retain6(double num){
+        String result = String .format("%.6f", num);
+        return Double.valueOf(result);
+    }
+
+    public static String regeo(String longitude,String latitude,String key) {
+        StringBuffer json = new StringBuffer();
+
+        //09abadb2e35fc61fd84042c518e9aebf
+        try {
+            URL u = new URL(String.format("https://restapi.amap.com/v3/geocode/regeo?location=%s,%s&key=%s",
+                    longitude,latitude,key));
+
+            URLConnection yc = u.openConnection();
+            //读取返回的数据
+            BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream(),"UTF-8"));
+            String inputline = null;
+
+            while((inputline=in.readLine())!=null){
+                json.append(inputline);
+            }
+
+            in.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        String jsonStr = json.toString();
+
+        System.out.println(jsonStr);
+
+        JSONObject jsonObject = JSONObject.parseObject(jsonStr);
+
+        JSONObject regeocode = jsonObject.getJSONObject("regeocode");
+
+        //判断输入的位置点是否存在
+        if(regeocode!=null) {
+            return regeocode.getString("formatted_address");
+        }
+        else {
+            return null;
+        }
+    }
+
+    /*public static void main(String[] args) {
+        //112.270696,30.309306
+        //112.270920,30.308930
+        double[] points = GPSUtil.gps84_To_Gcj02(30.308930F,112.270920F);
+
+        DecimalFormat df = new DecimalFormat("#.######");
+
+        System.out.println(df.format(points[1]) + "," + df.format(points[0]));
+    }*/
+}

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

@@ -0,0 +1,135 @@
+package com.jpsoft.enterprise.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/enterprise/modules/common/utils/Generator/AbstractGeneratorA.java

@@ -0,0 +1,29 @@
+package com.jpsoft.enterprise.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/enterprise/modules/common/utils/Generator/CaptchaUtilA.java

@@ -0,0 +1,39 @@
+package com.jpsoft.enterprise.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/enterprise/modules/common/utils/Generator/CircleCaptchaA.java

@@ -0,0 +1,55 @@
+package com.jpsoft.enterprise.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/enterprise/modules/common/utils/Generator/RandomGeneratorA.java

@@ -0,0 +1,31 @@
+package com.jpsoft.enterprise.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;
+        }
+    }
+

+ 422 - 0
common/src/main/java/com/jpsoft/enterprise/modules/common/utils/HttpConnectionUtil.java

@@ -0,0 +1,422 @@
+package com.jpsoft.enterprise.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);
+			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;
+	}
+
+	public static InputStream downloadStream(String requestUrl){
+		InputStream inputStream = null;
+
+		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);
+			httpUrlConn.setRequestMethod("GET");
+			httpUrlConn.connect();
+
+			inputStream = httpUrlConn.getInputStream();
+		}
+		catch (Exception ex){
+			System.out.println(ex.getMessage());
+		}
+
+		return inputStream;
+	}
+
+}

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

@@ -0,0 +1,60 @@
+package com.jpsoft.enterprise.modules.common.utils;
+
+import lombok.extern.slf4j.Slf4j;
+
+import javax.servlet.http.HttpServletRequest;
+
+@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;
+    }
+}

+ 37 - 0
common/src/main/java/com/jpsoft/enterprise/modules/common/utils/IdCardUtils.java

@@ -0,0 +1,37 @@
+package com.jpsoft.enterprise.modules.common.utils;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+
+@Slf4j
+public class IdCardUtils {
+    public static String decrypt(String idCard){
+        String data = idCard;
+
+        if (StringUtils.isNotBlank(idCard) && idCard.length() > 18) {
+            try {
+                data = AESUtil.decrypt(idCard, AESUtil.MYSQL_ENC_KEY);
+            } catch (Exception ex) {
+               log.error(ex.getMessage(),ex);
+            }
+        }
+
+        return data;
+    }
+
+    public static String encrypt(String idCard) {
+        String result = idCard;
+
+
+        //身份证加密
+       /* try {
+            if(StringUtils.isNotBlank(idCard) && idCard.length()<=18){
+                result = AESUtil.encrypt(idCard.trim(), AESUtil.MYSQL_ENC_KEY);
+            }
+        } catch (Exception ex) {
+            log.error(ex.getMessage(),ex);
+        }*/
+
+        return result;
+    }
+}

+ 51 - 0
common/src/main/java/com/jpsoft/enterprise/modules/common/utils/JwtUtil.java

@@ -0,0 +1,51 @@
+package com.jpsoft.enterprise.modules.common.utils;
+
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.security.Keys;
+
+import java.security.Key;
+import java.util.Base64;
+import java.util.Date;
+
+public class JwtUtil {
+    public static String createToken(String jwtSecret, String subject, Date expiration) {
+        //token有效时间天
+        byte[] privateKey = Base64.getDecoder().decode(jwtSecret);
+
+        Key key = Keys.hmacShaKeyFor(privateKey);
+
+        String token = Jwts.builder()
+                    .setSubject(subject)
+                //设置自定义claims后,setSubject值将失效
+//               .setClaims(extraInfo)
+                    .signWith(key)
+                    .setExpiration(expiration)
+                    .compact();
+
+        return "Bearer " + token;
+    }
+
+    public static String decodeToken(String jwtSecret,String token) throws Exception{
+        String prefix = "Bearer ";
+
+        if (token==null || token.length() < prefix.length()){
+            throw new Exception("未传递令牌或未带前缀Bearer!");
+        }
+
+        token = token.substring(prefix.length());
+
+        byte[] privateKey = Base64.getDecoder().decode(jwtSecret);
+
+        Key key = Keys.hmacShaKeyFor(privateKey);
+
+        Claims claims = Jwts.parser()
+                .setSigningKey(key)
+                .parseClaimsJws(token)
+                .getBody();
+
+        String subject = claims.getSubject();
+
+        return subject;
+    }
+}

+ 32 - 0
common/src/main/java/com/jpsoft/enterprise/modules/common/utils/JwtUtil2.java

@@ -0,0 +1,32 @@
+package com.jpsoft.enterprise.modules.common.utils;
+
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.security.Keys;
+
+import java.security.Key;
+import java.util.Base64;
+import java.util.Date;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2020-11-2 13:55
+ */
+public class JwtUtil2 {
+
+    public static String createToken(String jwtSecret, String subject, Date expiration) {
+        //token有效时间天
+        byte[] privateKey = Base64.getDecoder().decode(jwtSecret);
+
+        Key key = Keys.hmacShaKeyFor(privateKey);
+
+        String token = Jwts.builder()
+                .setSubject(subject)
+                //设置自定义claims后,setSubject值将失效
+//               .setClaims(extraInfo)
+                .signWith(key)
+                .setExpiration(expiration)
+                .compact();
+
+        return "Bearer " + token;
+    }
+}

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

@@ -0,0 +1,24 @@
+package com.jpsoft.enterprise.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;
+	}
+}

+ 201 - 0
common/src/main/java/com/jpsoft/enterprise/modules/common/utils/NewWordUtils.java

@@ -0,0 +1,201 @@
+package com.jpsoft.enterprise.modules.common.utils;
+
+import com.jpsoft.enterprise.config.OSSConfig;
+import org.apache.poi.xwpf.usermodel.*;
+import org.springframework.core.io.ClassPathResource;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * word生成
+ * @author sz
+ */
+public class NewWordUtils {
+	/**
+	 * 根据模板生成新word文档
+	 * 判断表格是需要替换还是需要插入,判断逻辑有$为替换,表格无$为插入
+	 * @param inputUrl 模板存放地址
+	 * @param textMap 需要替换的信息集合
+	 * @param tableList 需要插入的表格信息集合
+	 * @return 成功返回true,失败返回false
+	 */
+	public static String changWord(String inputUrl, OSSConfig ossConfig, Map<String, String> textMap, List<String[]> tableList) {
+		String downloadUrl = "";
+		try {
+			//获取docx解析对象
+			ClassPathResource resource = new ClassPathResource(inputUrl);
+			//XWPFDocument document = new XWPFDocument(POIXMLDocument.openPackage(inputUrl));
+			XWPFDocument document = new XWPFDocument(resource.getInputStream());
+			//解析替换文本段落对象
+			changeText(document, textMap);
+			//解析替换表格对象
+			changeTable(document, textMap, tableList);
+
+			//生成新的word
+			ByteArrayOutputStream baos = new ByteArrayOutputStream();//二进制OutputStream
+			document.write(baos);//文档写入流
+			ByteArrayInputStream input = new ByteArrayInputStream(baos.toByteArray());
+
+			Date dt = new Date();
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+			String str = "请假单" + sdf.format(dt) + ".docx";
+
+			downloadUrl = OSSUtil.upload(ossConfig,"import",str,input);
+//            FileOutputStream stream = new FileOutputStream(file);
+//            document.write(stream);
+			//stream.close();
+
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		return downloadUrl;
+
+	}
+
+
+	/**
+	 * 替换段落文本
+	 * @param document docx解析对象
+	 * @param textMap 需要替换的信息集合
+	 */
+	public static void changeText(XWPFDocument document, Map<String, String> textMap){
+		//获取段落集合
+		List<XWPFParagraph> paragraphs = document.getParagraphs();
+
+		for (XWPFParagraph paragraph : paragraphs) {
+			//判断此段落时候需要进行替换
+			String text = paragraph.getText();
+			if(checkText(text)){
+				List<XWPFRun> runs = paragraph.getRuns();
+				for (XWPFRun run : runs) {
+					//替换模板原来位置
+					run.setText(changeValue(run.toString(), textMap),0);
+				}
+			}
+		}
+
+	}
+
+	/**
+	 * 替换表格对象方法
+	 * @param document docx解析对象
+	 * @param textMap 需要替换的信息集合
+	 * @param tableList 需要插入的表格信息集合
+	 */
+	public static void changeTable(XWPFDocument document, Map<String, String> textMap,
+								   List<String[]> tableList){
+		//获取表格对象集合
+		List<XWPFTable> tables = document.getTables();
+		for (int i = 0; i < tables.size(); i++) {
+			//只处理行数大于等于2的表格,且不循环表头
+			XWPFTable table = tables.get(i);
+			if(table.getRows().size()>1){
+				//判断表格是需要替换还是需要插入,判断逻辑有$为替换,表格无$为插入
+				if(checkText(table.getText())){
+					List<XWPFTableRow> rows = table.getRows();
+					//遍历表格,并替换模板
+					eachTable(rows, textMap);
+				}else{
+//                  System.out.println("插入"+table.getText());
+					insertTable(table, tableList);
+				}
+			}
+		}
+	}
+
+
+
+
+
+	/**
+	 * 遍历表格
+	 * @param rows 表格行对象
+	 * @param textMap 需要替换的信息集合
+	 */
+	public static void eachTable(List<XWPFTableRow> rows ,Map<String, String> textMap){
+		for (XWPFTableRow row : rows) {
+			List<XWPFTableCell> cells = row.getTableCells();
+			for (XWPFTableCell cell : cells) {
+				//判断单元格是否需要替换
+				if(checkText(cell.getText())){
+					List<XWPFParagraph> paragraphs = cell.getParagraphs();
+					for (XWPFParagraph paragraph : paragraphs) {
+						List<XWPFRun> runs = paragraph.getRuns();
+						for (XWPFRun run : runs) {
+							run.setText(changeValue(run.toString(), textMap),0);
+						}
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * 为表格插入数据,行数不够添加新行
+	 * @param table 需要插入数据的表格
+	 * @param tableList 插入数据集合
+	 */
+	public static void insertTable(XWPFTable table, List<String[]> tableList){
+		//创建行,根据需要插入的数据添加新行,不处理表头
+		for(int i = 1; i < tableList.size(); i++){
+			XWPFTableRow row =table.createRow();
+		}
+		//遍历表格插入数据
+		List<XWPFTableRow> rows = table.getRows();
+		for(int i = 1; i < rows.size(); i++){
+			XWPFTableRow newRow = table.getRow(i);
+			List<XWPFTableCell> cells = newRow.getTableCells();
+			for(int j = 0; j < cells.size(); j++){
+				XWPFTableCell cell = cells.get(j);
+				cell.setText(tableList.get(i-1)[j]);
+			}
+		}
+
+	}
+
+
+
+	/**
+	 * 判断文本中时候包含$
+	 * @param text 文本
+	 * @return 包含返回true,不包含返回false
+	 */
+	public static boolean checkText(String text){
+		boolean check  =  false;
+		if(text.indexOf("$")!= -1){
+			check = true;
+		}
+		return check;
+
+	}
+
+	/**
+	 * 匹配传入信息集合与模板
+	 * @param value 模板需要替换的区域
+	 * @param textMap 传入信息集合
+	 * @return 模板需要替换区域信息集合对应值
+	 */
+	public static String changeValue(String value, Map<String, String> textMap){
+		Set<Map.Entry<String, String>> textSets = textMap.entrySet();
+		for (Map.Entry<String, String> textSet : textSets) {
+			//匹配模板与替换值 格式${key}
+			String key = "${"+textSet.getKey()+"}";
+			if(value.indexOf(key)!= -1){
+				value = textSet.getValue();
+			}
+		}
+		//模板未匹配到区域替换为空
+		if(checkText(value)){
+			value = "";
+		}
+		return value;
+	}
+}

+ 348 - 0
common/src/main/java/com/jpsoft/enterprise/modules/common/utils/OSSUtil.java

@@ -0,0 +1,348 @@
+package com.jpsoft.enterprise.modules.common.utils;
+
+import cn.hutool.core.codec.Base64Encoder;
+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.enterprise.config.OSSConfig;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+
+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.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) {
+        Date now = new Date();
+
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(now);
+
+        String savePath = ossConfig.getObjectPre();
+
+        if (!subFolder.startsWith("/")) {
+            savePath += "/";
+        }
+
+        savePath += subFolder;
+
+        //增加一级uuid目录
+        savePath = savePath + "/" + cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + UUID.randomUUID().toString() + "/";
+
+        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;
+        String retFileUrl = savePath + fileName;
+
+        // 上传文件流
+        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 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();
+                }
+            }
+        }
+    }
+}

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

@@ -0,0 +1,428 @@
+package com.jpsoft.enterprise.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/enterprise/modules/common/utils/PojoUtils.java

@@ -0,0 +1,84 @@
+package com.jpsoft.enterprise.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;
+    }
+}

+ 162 - 0
common/src/main/java/com/jpsoft/enterprise/modules/common/utils/SMSUtil.java

@@ -0,0 +1,162 @@
+package com.jpsoft.enterprise.modules.common.utils;
+
+import com.jpsoft.enterprise.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();
+	}
+
+	/*public static void main(String[] args) {
+		JSONObject verifyCodeJSON = new JSONObject();
+		verifyCodeJSON.put("code", "66666");
+
+		SMSUtil.send("17261745051", "SMS_49390047", verifyCodeJSON.toString());
+	}*/
+}

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

@@ -0,0 +1,70 @@
+package com.jpsoft.enterprise.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);
+    }
+}

+ 182 - 0
common/src/main/java/com/jpsoft/enterprise/modules/common/utils/StringUtils.java

@@ -0,0 +1,182 @@
+package com.jpsoft.enterprise.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 String strValue(Object object,String defaultValue) {
+		if (object!=null){
+			return String.valueOf(object);
+		}
+		else{
+			return defaultValue;
+		}
+	}
+
+	public static String toUnicode(String str) {
+		char[] chars = str.toCharArray();
+
+		StringBuilder sb = new StringBuilder();
+
+		for (int i = 0; i < chars.length; i++) {
+			sb.append(Integer.toString(chars[i], 16));
+		}
+
+		return sb.toString();
+	}
+
+	/*public static void main(String[] args) {
+		System.out.println(random(32, RandomType.INT));
+	}*/
+}

+ 440 - 0
common/src/main/java/com/jpsoft/enterprise/modules/common/utils/WechatMessageUtil.java

@@ -0,0 +1,440 @@
+package com.jpsoft.enterprise.modules.common.utils;
+
+import com.jpsoft.enterprise.modules.wechat.entity.AccessToken;
+import lombok.extern.slf4j.Slf4j;
+import net.sf.json.JSONObject;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.math.BigDecimal;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+@Slf4j
+@Service
+public class WechatMessageUtil {
+    public static final String send_template = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN";
+
+    private static final String TEMPLATE_REDIRECT_PRE_URL = "http://wuyeopenlocktest-wecat.sudaonline.net";
+
+    private static final String TEMPERATURE_ALARM_PRE_URL = "http://wisdomhousewechat.sudaonline.net/prevention/addetail_fll.html?id=";
+
+    public static boolean sendBillInfo(String fullName, BigDecimal amount, String openId,
+                                       String detailAmount, String propertyName, String billRemark, String billDetailId, String billTemplateId, 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", fullName);
+        keyword1.put("color", "#173177");
+
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", "¥" + amount.setScale(2) + "元");
+        keyword2.put("color", "#173177");
+
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", detailAmount);
+        keyword3.put("color", "#173177");
+
+
+        String remarkStr = "账单来源:" + propertyName;
+
+        if (StringUtils.isNotBlank(billRemark)) {
+            remarkStr = remarkStr + "\n备注:" + billRemark + "";
+        }
+
+        JSONObject remark = new JSONObject();
+        remark.put("value", remarkStr);
+        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, appId, appSecret, billTemplateId, openId, TEMPLATE_REDIRECT_PRE_URL + "/billDetail/" + billDetailId + "payTime=0&payType=bill");
+
+        return ret;
+    }
+
+    //
+    public static boolean sendBillPayedMessage(String fullName, String feeName, Date createTime, BigDecimal amount, String openId, String billDetailId, String payedTemplateId, 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", fullName);
+        keyword1.put("color", "#173177");
+
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", feeName);
+        keyword2.put("color", "#173177");
+
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", sdf.format(createTime));
+        keyword3.put("color", "#173177");
+
+        JSONObject keyword4 = new JSONObject();
+
+        keyword4.put("value", "¥" + amount.setScale(2) + "元");
+        keyword4.put("color", "#173177");
+
+
+        String remarkStr = "感谢您的支持,点击查看缴费详情";
+
+        JSONObject remark = new JSONObject();
+        remark.put("value", remarkStr);
+        remark.put("color", "#173177");
+
+        sendData.put("first", first);
+        sendData.put("keyword1", keyword1);
+        sendData.put("keyword2", keyword2);
+        sendData.put("keyword3", keyword3);
+        sendData.put("keyword4", keyword4);
+        sendData.put("remark", remark);
+
+        //w8Zk_VQMFIEVSIBPZid7zSrvHmBdrgnqF76u8PLCZEs cs
+        boolean ret = sendTemplate(sendData, appId, appSecret, payedTemplateId, openId, TEMPLATE_REDIRECT_PRE_URL + "/billDetail/" + billDetailId + "payTime=1&payType=bill");
+
+        return ret;
+    }
+
+    //
+    public static boolean sendScanPayedMessage(String fullName, String feeName, Date createTime, BigDecimal amount, String openId, String independentPayId, String payedTemplateId, 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", fullName);
+        keyword1.put("color", "#173177");
+
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", feeName);
+        keyword2.put("color", "#173177");
+
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", sdf.format(createTime));
+        keyword3.put("color", "#173177");
+
+        JSONObject keyword4 = new JSONObject();
+
+        keyword4.put("value", "¥" + amount.setScale(2) + "元");
+        keyword4.put("color", "#173177");
+
+
+        String remarkStr = "感谢您的支持,点击查看缴费详情";
+
+        JSONObject remark = new JSONObject();
+        remark.put("value", remarkStr);
+        remark.put("color", "#173177");
+
+        sendData.put("first", first);
+        sendData.put("keyword1", keyword1);
+        sendData.put("keyword2", keyword2);
+        sendData.put("keyword3", keyword3);
+        sendData.put("keyword4", keyword4);
+        sendData.put("remark", remark);
+
+        boolean ret = sendTemplate(sendData, appId, appSecret, payedTemplateId, openId, TEMPLATE_REDIRECT_PRE_URL + "/billDetail/" + independentPayId + "payTime=1&payType=wechat");
+
+        return ret;
+    }
+
+    /**
+     * 发送通知信息
+     *
+     * @param noticeName     通知名称名称
+     * @param noticeDetailId 通知详情ID
+     * @param openId         发送人
+     * @return
+     */
+    public static boolean sendNoticeMessage(String noticeName, String content, String openId, String noticeDetailId, String noticeTemplateId, String appId, String appSecret) {
+
+
+        JSONObject sendData = new JSONObject();
+        String finallyContent = getContent(content);
+        JSONObject first = new JSONObject();
+        first.put("value", "您好,园区通知如下:");
+        first.put("color", "#173177");
+
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", noticeName);
+        keyword1.put("color", "#173177");
+
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", sdf.format(new Date()));
+        keyword2.put("color", "#173177");
+
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", finallyContent);
+        keyword3.put("color", "#173177");
+
+        JSONObject remark = new JSONObject();
+        remark.put("value", "点击查看详情");
+        remark.put("color", "#173177");
+
+        sendData.put("first", first);
+        sendData.put("keyword1", keyword1);
+        sendData.put("keyword2", keyword2);
+        sendData.put("keyword3", keyword3);
+        sendData.put("remark", remark);
+
+        //noticeDetailId
+        boolean ret = sendTemplate(sendData, appId, appSecret, noticeTemplateId, openId, TEMPLATE_REDIRECT_PRE_URL + "/#/noticeInfo/" + noticeDetailId);
+
+        return ret;
+    }
+
+    /**
+     * 发送物业管理通知信息
+     *
+     * @param noticeName     通知名称
+     * @param noticeDetailId 通知详情ID
+     * @param openId         发送人
+     * @return
+     */
+    public static boolean sendPropertyNoticeMessage(String noticeName, String content, String openId, String noticeDetailId, String noticeTemplateId, String appId, String appSecret) {
+
+
+        JSONObject sendData = new JSONObject();
+        String finallyContent = getContent(content);
+        JSONObject first = new JSONObject();
+        first.put("value", "您好,物业管理通知如下:");
+        first.put("color", "#173177");
+
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", noticeName);
+        keyword1.put("color", "#173177");
+
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", sdf.format(new Date()));
+        keyword2.put("color", "#173177");
+
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", finallyContent);
+        keyword3.put("color", "#173177");
+
+        JSONObject remark = new JSONObject();
+        remark.put("value", "点击查看详情");
+        remark.put("color", "#173177");
+
+        sendData.put("first", first);
+        sendData.put("keyword1", keyword1);
+        sendData.put("keyword2", keyword2);
+        sendData.put("keyword3", keyword3);
+        sendData.put("remark", remark);
+
+        //noticeDetailId
+        boolean ret = sendTemplate(sendData, appId, appSecret, noticeTemplateId, openId, TEMPERATURE_ALARM_PRE_URL + "/#/noticeInfo/" + noticeDetailId);
+
+        return ret;
+    }
+
+    /**
+     * 发送警告通知信息
+     *
+     * @param noticeName     通知名称
+     * @param noticeDetailId 通知详情ID
+     * @param openId         发送人
+     * @return
+     */
+    public static boolean sendAlarmNoticeMessage(String noticeName, String content, Date createTime, String openId, String noticeDetailId, String noticeTemplateId, String appId, String appSecret) {
+
+
+        JSONObject sendData = new JSONObject();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+        String finallyContent = getContent(content);
+        JSONObject first = new JSONObject();
+        first.put("value", "您好,入侵警告通知如下:");
+        first.put("color", "#173177");
+
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", sdf.format(createTime));
+        keyword1.put("color", "#173177");
+
+
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", finallyContent);
+        keyword2.put("color", "#173177");
+
+        JSONObject remark = new JSONObject();
+        remark.put("value", "请尽快查看");
+        remark.put("color", "#173177");
+
+        sendData.put("first", first);
+        sendData.put("keyword1", keyword1);
+        sendData.put("keyword2", keyword2);
+        //sendData.put("remark", remark);
+
+        //noticeDetailId
+        boolean ret = sendTemplate(sendData, appId, appSecret, noticeTemplateId, openId, "");
+
+        return ret;
+    }
+
+    /**
+     * 微信发送模版
+     *
+     * @param sendData   发送数据
+     * @param templateId 模版Id
+     * @param openId     发送人
+     * @param url        详情跳转地址
+     * @return
+     */
+    public static boolean sendTemplate(JSONObject sendData, String appId, String appSecret, String templateId, String openId, String url) {
+        boolean result = false;
+
+        AccessToken accessToken = WeixinUtil.getAccessToken(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 appId,String appSecret,String templateId, String openId,JSONObject sendData,String urlPath) {
+        String result = "";
+
+        try {
+            AccessToken accessToken = WeixinUtil.getAccessToken(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;
+    }
+
+
+
+}

+ 317 - 0
common/src/main/java/com/jpsoft/enterprise/modules/common/utils/WeixinUtil.java

@@ -0,0 +1,317 @@
+package com.jpsoft.enterprise.modules.common.utils;
+
+import cn.hutool.core.date.DateTime;
+import com.jpsoft.enterprise.modules.wechat.entity.AccessToken;
+import com.jpsoft.enterprise.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) 限200(次/天),可以在配置文件中修改
+	public static String access_token_url = "https://api.weixin.qq.com/cgi-bin/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 getAccessToken(String appid, String appsecret) {
+		AccessToken accessToken = null;
+
+		String requestUrl = access_token_url.replace("APPID", appid).replace("APPSECRET", 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 appid,String appSecret){
+		AccessToken token = WeixinUtil.getAccessToken(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/enterprise/modules/common/utils/enterprise/AesException.java

@@ -0,0 +1,60 @@
+package com.jpsoft.enterprise.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/enterprise/modules/common/utils/enterprise/ByteGroup.java

@@ -0,0 +1,26 @@
+package com.jpsoft.enterprise.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/enterprise/modules/common/utils/enterprise/PKCS7Encoder.java

@@ -0,0 +1,67 @@
+/**
+ * 对公众平台发送给公众账号的消息加解密示例代码.
+ *
+ * @copyright Copyright (c) 1998-2014 Tencent Inc.
+ */
+
+// ------------------------------------------------------------------------
+
+package com.jpsoft.enterprise.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/enterprise/modules/common/utils/enterprise/SHA1.java

@@ -0,0 +1,61 @@
+/**
+ * 对公众平台发送给公众账号的消息加解密示例代码.
+ *
+ * @copyright Copyright (c) 1998-2014 Tencent Inc.
+ */
+
+// ------------------------------------------------------------------------
+
+package com.jpsoft.enterprise.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);
+		}
+	}
+}

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

@@ -0,0 +1,289 @@
+package com.jpsoft.enterprise.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 javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.Charset;
+import java.util.Arrays;
+import java.util.Random;
+
+
+/**
+ * 提供接收和推送给公众平台消息的加解密接口(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;
+    }
+
+}

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

@@ -0,0 +1,71 @@
+/**
+ * 对公众平台发送给公众账号的消息加解密示例代码.
+ *
+ * @copyright Copyright (c) 1998-2014 Tencent Inc.
+ */
+
+// ------------------------------------------------------------------------
+
+package com.jpsoft.enterprise.modules.common.utils.enterprise;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.StringReader;
+
+/**
+ * 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);
+
+	}
+}

+ 28 - 0
common/src/main/java/com/jpsoft/enterprise/modules/sys/dao/DataDictionaryDAO.java

@@ -0,0 +1,28 @@
+package com.jpsoft.enterprise.modules.sys.dao;
+
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.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();
+	String findParentId(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);
+}

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

@@ -0,0 +1,21 @@
+package com.jpsoft.enterprise.modules.sys.dao;
+
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.entity.Menu;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@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/enterprise/modules/sys/dao/PermissionDAO.java

@@ -0,0 +1,21 @@
+package com.jpsoft.enterprise.modules.sys.dao;
+
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.entity.Permission;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@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);
+}

+ 19 - 0
common/src/main/java/com/jpsoft/enterprise/modules/sys/dao/RoleDAO.java

@@ -0,0 +1,19 @@
+package com.jpsoft.enterprise.modules.sys.dao;
+
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.entity.Role;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@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);
+}

+ 23 - 0
common/src/main/java/com/jpsoft/enterprise/modules/sys/dao/RoleMenuDAO.java

@@ -0,0 +1,23 @@
+package com.jpsoft.enterprise.modules.sys.dao;
+
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.entity.RoleMenu;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@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);
+}

+ 21 - 0
common/src/main/java/com/jpsoft/enterprise/modules/sys/dao/RolePermissionDAO.java

@@ -0,0 +1,21 @@
+package com.jpsoft.enterprise.modules.sys.dao;
+
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.entity.RolePermission;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@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/enterprise/modules/sys/dao/SysLogDAO.java

@@ -0,0 +1,19 @@
+package com.jpsoft.enterprise.modules.sys.dao;
+
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.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);
+}

+ 25 - 0
common/src/main/java/com/jpsoft/enterprise/modules/sys/dao/UserDAO.java

@@ -0,0 +1,25 @@
+package com.jpsoft.enterprise.modules.sys.dao;
+
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.entity.User;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@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> findByCompanyId(String companyId);
+	List<User> findByCompanyList(@Param("searchParams") Map<String, Object> searchParams, @Param("sortList") List<Sort> sortList);
+	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);
+    User findByOpenId(String openId);
+}

+ 22 - 0
common/src/main/java/com/jpsoft/enterprise/modules/sys/dao/UserRoleDAO.java

@@ -0,0 +1,22 @@
+package com.jpsoft.enterprise.modules.sys.dao;
+
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.entity.Role;
+import com.jpsoft.enterprise.modules.sys.entity.UserRole;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@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);
+	int deleteByUserId(String userId);
+}

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

@@ -0,0 +1,24 @@
+package com.jpsoft.enterprise.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;
+    }
+}

+ 203 - 0
common/src/main/java/com/jpsoft/enterprise/modules/sys/entity/DataDictionary.java

@@ -0,0 +1,203 @@
+package com.jpsoft.enterprise.modules.sys.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+  描述:sys_data_dictionary的实体类
+ */
+public class DataDictionary {
+	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;
+	/*private List<DataDictionary> children;*/
+		/**
+	 *获取编号
+	 */
+	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 getValue(){
+		return value;
+	}
+
+	/**
+	 *设置数值
+	 */
+	public void setValue(String value){
+		this.value = value;
+	}
+		/**
+	 *获取显示序号
+	 */
+	public Integer getSortNo(){
+		return sortNo;
+	}
+
+	/**
+	 *设置显示序号
+	 */
+	public void setSortNo(Integer sortNo){
+		this.sortNo = sortNo;
+	}
+		/**
+	 *获取所属目录
+	 */
+	public String getParentId(){
+		return parentId;
+	}
+
+	/**
+	 *设置所属目录
+	 */
+	public void setParentId(String parentId){
+		this.parentId = parentId;
+	}
+		/**
+	 *获取1-字典目录,2-数据
+	 */
+	public String getDataType(){
+		return dataType;
+	}
+
+	/**
+	 *设置1-字典目录,2-数据
+	 */
+	public void setDataType(String dataType){
+		this.dataType = dataType;
+	}
+		/**
+	 *获取
+	 */
+	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 getCreateDate(){
+		return createDate;
+	}
+
+	/**
+	 *设置
+	 */
+	public void setCreateDate(Date createDate){
+		this.createDate = createDate;
+	}
+		/**
+	 *获取
+	 */
+	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 getUpdateDate(){
+		return updateDate;
+	}
+
+	/**
+	 *设置
+	 */
+	public void setUpdateDate(Date updateDate){
+		this.updateDate = updateDate;
+	}
+		/**
+	 *获取
+	 */
+	public Boolean getActivated(){
+		return activated;
+	}
+
+	/**
+	 *设置
+	 */
+	public void setActivated(Boolean activated){
+		this.activated = activated;
+	}
+
+	/**
+	 *获取
+	 */
+	public Boolean getDelFlag(){
+		return delFlag;
+	}
+
+	/**
+	 *设置
+	 */
+	public void setDelFlag(Boolean delFlag){
+		this.delFlag = delFlag;
+	}
+
+	/*public List<DataDictionary> getChildren() {
+		return children;
+	}
+
+	public void setChildren(List<DataDictionary> children) {
+		this.children = children;
+	}*/
+
+	public String getParentName() {
+		return parentName;
+	}
+
+	public void setParentName(String parentName) {
+		this.parentName = parentName;
+	}
+}

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

@@ -0,0 +1,199 @@
+package com.jpsoft.enterprise.modules.sys.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+  描述: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;
+	}
+}

+ 143 - 0
common/src/main/java/com/jpsoft/enterprise/modules/sys/entity/Permission.java

@@ -0,0 +1,143 @@
+package com.jpsoft.enterprise.modules.sys.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ 描述: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/enterprise/modules/sys/entity/Role.java

@@ -0,0 +1,129 @@
+package com.jpsoft.enterprise.modules.sys.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+  描述: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/enterprise/modules/sys/entity/RoleMenu.java

@@ -0,0 +1,129 @@
+package com.jpsoft.enterprise.modules.sys.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+  描述: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/enterprise/modules/sys/entity/RolePermission.java

@@ -0,0 +1,129 @@
+package com.jpsoft.enterprise.modules.sys.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+  描述: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/enterprise/modules/sys/entity/SysLog.java

@@ -0,0 +1,37 @@
+package com.jpsoft.enterprise.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;
+}

+ 187 - 0
common/src/main/java/com/jpsoft/enterprise/modules/sys/entity/User.java

@@ -0,0 +1,187 @@
+package com.jpsoft.enterprise.modules.sys.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+  描述:sys_user的实体类
+ */
+public class User {
+	private String id;
+	private String companyId;
+	private String companyName;
+	private String userName;
+	private String password;
+	private String realName;
+	private Date createTime;
+	private Date updateTime;
+	private Boolean delFlag;
+	private String createBy;
+	private String updateBy;
+	private List<String> roles;
+	private String openId;
+
+		/**
+	 *获取用户编号
+	 */
+	public String getId(){
+		return id;
+	}
+
+	/**
+	 *设置用户编号
+	 */
+	public void setId(String id){
+		this.id = id;
+	}
+		/**
+	 *获取用户名
+	 */
+	public String getUserName(){
+		return userName;
+	}
+
+	/**
+	 *设置用户名
+	 */
+	public void setUserName(String userName){
+		this.userName = userName;
+	}
+		/**
+	 *获取密码
+	 */
+	public String getPassword(){
+		return password;
+	}
+
+	/**
+	 *设置密码
+	 */
+	public void setPassword(String password){
+		this.password = password;
+	}
+		/**
+	 *获取真实名称
+	 */
+	public String getRealName(){
+		return realName;
+	}
+
+	/**
+	 *设置真实名称
+	 */
+	public void setRealName(String realName){
+		this.realName = realName;
+	}
+
+	@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;
+	}
+
+	public List<String> getRoles() {
+		return roles;
+	}
+
+	public void setRoles(List<String> roles) {
+		this.roles = roles;
+	}
+
+	/**
+	 *设置企业名称
+	 */
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+
+	/**
+	 *设置企业名称
+	 */
+	public String getCompanyName() {
+		return companyName;
+	}
+
+	public void setCompanyName(String companyName) {
+		this.companyName = companyName;
+	}
+
+	public String getOpenId() {
+		return openId;
+	}
+
+	public void setOpenId(String openId) {
+		this.openId = openId;
+	}
+}

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

@@ -0,0 +1,129 @@
+package com.jpsoft.enterprise.modules.sys.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+  描述: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/enterprise/modules/sys/service/DataDictionaryService.java

@@ -0,0 +1,27 @@
+package com.jpsoft.enterprise.modules.sys.service;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.entity.DataDictionary;
+
+
+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();
+	String findParentId(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);
+
+    Map<String, DataDictionary> findMapByCatalogName(String catalogName);
+}

+ 22 - 0
common/src/main/java/com/jpsoft/enterprise/modules/sys/service/MenuService.java

@@ -0,0 +1,22 @@
+package com.jpsoft.enterprise.modules.sys.service;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.entity.Menu;
+
+import java.util.List;
+import java.util.Map;
+
+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);
+}

+ 20 - 0
common/src/main/java/com/jpsoft/enterprise/modules/sys/service/PermissionService.java

@@ -0,0 +1,20 @@
+package com.jpsoft.enterprise.modules.sys.service;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.entity.Permission;
+
+import java.util.List;
+import java.util.Map;
+
+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);
+}

+ 20 - 0
common/src/main/java/com/jpsoft/enterprise/modules/sys/service/RoleMenuService.java

@@ -0,0 +1,20 @@
+package com.jpsoft.enterprise.modules.sys.service;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.entity.RoleMenu;
+
+import java.util.List;
+import java.util.Map;
+
+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);
+}

+ 22 - 0
common/src/main/java/com/jpsoft/enterprise/modules/sys/service/RolePermissionService.java

@@ -0,0 +1,22 @@
+package com.jpsoft.enterprise.modules.sys.service;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.entity.RolePermission;
+
+import java.util.List;
+import java.util.Map;
+
+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/enterprise/modules/sys/service/RoleService.java

@@ -0,0 +1,17 @@
+package com.jpsoft.enterprise.modules.sys.service;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.entity.Role;
+import java.util.List;
+import java.util.Map;
+
+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/enterprise/modules/sys/service/SysLogService.java

@@ -0,0 +1,18 @@
+package com.jpsoft.enterprise.modules.sys.service;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.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);
+}

+ 21 - 0
common/src/main/java/com/jpsoft/enterprise/modules/sys/service/UserRoleService.java

@@ -0,0 +1,21 @@
+package com.jpsoft.enterprise.modules.sys.service;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.entity.Role;
+import com.jpsoft.enterprise.modules.sys.entity.UserRole;
+
+import java.util.List;
+import java.util.Map;
+
+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);
+	int deleteByUserId(String userId);
+}

+ 23 - 0
common/src/main/java/com/jpsoft/enterprise/modules/sys/service/UserService.java

@@ -0,0 +1,23 @@
+package com.jpsoft.enterprise.modules.sys.service;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.entity.User;
+
+import java.util.List;
+import java.util.Map;
+
+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();
+	List<User> findByCompanyId(String companyId);
+	List<User> findByCompanyList(Map<String, Object> searchParams, List<Sort> sortList);
+	Page<User> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, List<Sort> sortList);
+	User findByUserName(String userName);
+	boolean hasRole(String userId, String roleName) ;
+    User findByOpenId(String openId);
+}

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

@@ -0,0 +1,117 @@
+package com.jpsoft.enterprise.modules.sys.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.dao.DataDictionaryDAO;
+import com.jpsoft.enterprise.modules.sys.entity.DataDictionary;
+import com.jpsoft.enterprise.modules.sys.service.DataDictionaryService;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+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 String findParentId(String parentId,String value){
+		return dataDictionaryDAO.findParentId(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 Map<String, DataDictionary> findMapByCatalogName(String catalogName) {
+		Map<String,DataDictionary> ddMap = new HashMap<>();
+
+		List<DataDictionary> ddList = dataDictionaryDAO.findByCatalogName(catalogName);
+
+		for (DataDictionary dd : ddList) {
+			ddMap.put(dd.getValue(),dd);
+		}
+
+		return ddMap;
+	}
+}

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

@@ -0,0 +1,84 @@
+package com.jpsoft.enterprise.modules.sys.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.jpsoft.enterprise.modules.sys.dao.MenuDAO;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.entity.Menu;
+import com.jpsoft.enterprise.modules.sys.service.MenuService;
+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="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);
+	}
+}

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

@@ -0,0 +1,75 @@
+package com.jpsoft.enterprise.modules.sys.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.dao.PermissionDAO;
+import com.jpsoft.enterprise.modules.sys.entity.Permission;
+import com.jpsoft.enterprise.modules.sys.service.PermissionService;
+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="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;
+	}
+}

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

@@ -0,0 +1,80 @@
+package com.jpsoft.enterprise.modules.sys.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.dao.RoleMenuDAO;
+import com.jpsoft.enterprise.modules.sys.entity.RoleMenu;
+import com.jpsoft.enterprise.modules.sys.service.RoleMenuService;
+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="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);
+	}
+}

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

@@ -0,0 +1,80 @@
+package com.jpsoft.enterprise.modules.sys.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.dao.RolePermissionDAO;
+import com.jpsoft.enterprise.modules.sys.entity.RolePermission;
+import com.jpsoft.enterprise.modules.sys.service.RolePermissionService;
+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="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);
+	}
+}

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

@@ -0,0 +1,70 @@
+package com.jpsoft.enterprise.modules.sys.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.dao.RoleDAO;
+import com.jpsoft.enterprise.modules.sys.entity.Role;
+import com.jpsoft.enterprise.modules.sys.service.RoleService;
+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="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/enterprise/modules/sys/service/impl/SysLogServiceImpl.java

@@ -0,0 +1,70 @@
+package com.jpsoft.enterprise.modules.sys.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.dao.SysLogDAO;
+import com.jpsoft.enterprise.modules.sys.entity.SysLog;
+import com.jpsoft.enterprise.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;
+	}
+}

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

@@ -0,0 +1,81 @@
+package com.jpsoft.enterprise.modules.sys.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.dao.UserRoleDAO;
+import com.jpsoft.enterprise.modules.sys.entity.Role;
+import com.jpsoft.enterprise.modules.sys.entity.UserRole;
+import com.jpsoft.enterprise.modules.sys.service.UserRoleService;
+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="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 int deleteByUserId(String userId) {
+		return userRoleDAO.deleteByUserId(userId);
+	}
+}

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

@@ -0,0 +1,97 @@
+package com.jpsoft.enterprise.modules.sys.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.dao.UserDAO;
+import com.jpsoft.enterprise.modules.sys.entity.User;
+import com.jpsoft.enterprise.modules.sys.service.UserService;
+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="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 List<User> findByCompanyId(String companyId){
+		return userDAO.findByCompanyId(companyId);
+	}
+
+	@Override
+	public List<User> findByCompanyList(Map<String,Object> searchParams,List<Sort> sortList){
+		return userDAO.findByCompanyList(searchParams,sortList);
+	}
+
+	@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;
+	}
+
+	@Override
+	public User findByOpenId(String openId) {
+		return userDAO.findByOpenId(openId);
+	}
+}

+ 23 - 0
common/src/main/java/com/jpsoft/enterprise/modules/wechat/dao/ReplyMessageDAO.java

@@ -0,0 +1,23 @@
+package com.jpsoft.enterprise.modules.wechat.dao;
+
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.wechat.entity.ReplyMessage;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@Repository
+public interface ReplyMessageDAO {
+	int insert(ReplyMessage entity);
+	int update(ReplyMessage entity);
+	int exist(String id);
+	ReplyMessage get(String id);
+	int delete(String id);
+	List<ReplyMessage> list();
+	List<ReplyMessage> search(Map<String, Object> searchParams, List<Sort> sortList);
+    ReplyMessage findByEvent(@Param("event") String event);
+
+
+}

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

@@ -0,0 +1,29 @@
+package com.jpsoft.enterprise.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;
+}

+ 51 - 0
common/src/main/java/com/jpsoft/enterprise/modules/wechat/entity/ReplyMessage.java

@@ -0,0 +1,51 @@
+package com.jpsoft.enterprise.modules.wechat.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;
+
+/**
+  描述:wechat_reply_message的实体类
+ */
+@Data
+@ApiModel(value = "wechat_reply_message的实体类")
+public class ReplyMessage {
+	/**
+	 *编号
+	 */
+        @ApiModelProperty(value = "编号")
+	private String id;
+	/**
+	 *事件
+	 */
+        @ApiModelProperty(value = "事件")
+	private String event;
+	/**
+	 *回复消息
+	 */
+        @ApiModelProperty(value = "回复消息")
+	private String message;
+	/**
+	 *回调地址
+	 */
+        @ApiModelProperty(value = "回调地址")
+	private String callbackUrl;
+	/**
+	 *创建时间
+	 */
+    	@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;
+}

+ 19 - 0
common/src/main/java/com/jpsoft/enterprise/modules/wechat/service/ReplyMessageService.java

@@ -0,0 +1,19 @@
+package com.jpsoft.enterprise.modules.wechat.service;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.wechat.entity.ReplyMessage;
+
+import java.util.List;
+import java.util.Map;
+
+public interface ReplyMessageService {
+	ReplyMessage get(String id);
+	boolean exist(String id);
+	int insert(ReplyMessage model);
+	int update(ReplyMessage model);
+	int delete(String id);
+	List<ReplyMessage> list();
+	Page<ReplyMessage> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
+	ReplyMessage findByEvent(String event);
+}

+ 75 - 0
common/src/main/java/com/jpsoft/enterprise/modules/wechat/service/impl/ReplyMessageServiceImpl.java

@@ -0,0 +1,75 @@
+package com.jpsoft.enterprise.modules.wechat.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.wechat.dao.ReplyMessageDAO;
+import com.jpsoft.enterprise.modules.wechat.entity.ReplyMessage;
+import com.jpsoft.enterprise.modules.wechat.service.ReplyMessageService;
+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="replyMessageService")
+public class ReplyMessageServiceImpl implements ReplyMessageService {
+	@Resource(name="replyMessageDAO")
+	private ReplyMessageDAO replyMessageDAO;
+
+	@Override
+	public ReplyMessage get(String id) {
+		// TODO Auto-generated method stub
+		return replyMessageDAO.get(id);
+	}
+
+	@Override
+	public int insert(ReplyMessage model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+
+		return replyMessageDAO.insert(model);
+	}
+
+	@Override
+	public int update(ReplyMessage model) {
+		// TODO Auto-generated method stub
+		return replyMessageDAO.update(model);
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return replyMessageDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = replyMessageDAO.exist(id);
+
+		return count > 0 ? true : false;
+	}
+
+	@Override
+	public List<ReplyMessage> list() {
+		// TODO Auto-generated method stub
+		return replyMessageDAO.list();
+	}
+
+	@Override
+	public Page<ReplyMessage> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
+        Page<ReplyMessage> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+            replyMessageDAO.search(searchParams,sortList);
+        });
+
+        return page;
+	}
+
+	@Override
+	public ReplyMessage findByEvent(String event) {
+		return replyMessageDAO.findByEvent(event);
+	}
+}

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

@@ -0,0 +1,20 @@
+package com.jpsoft.enterprise.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;
+
+}

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

@@ -0,0 +1,177 @@
+<?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.enterprise.modules.sys.dao.DataDictionaryDAO">
+    <resultMap id="DataDictionaryMap" type="com.jpsoft.enterprise.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"/>
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.enterprise.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)
+		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 }
+		)
+	]]>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from sys_data_dictionary where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.enterprise.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>
+        </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="findParentId" parameterType="string" resultType="string">
+        select a.name_ as name
+        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>
+</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.enterprise.modules.sys.dao.MenuDAO">
+    <resultMap id="MenuMap" type="com.jpsoft.enterprise.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.enterprise.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.enterprise.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.enterprise.modules.sys.dao.PermissionDAO">
+    <resultMap id="PermissionMap" type="com.jpsoft.enterprise.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.enterprise.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.enterprise.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">
+        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}
+        <if test="method != null">
+            and p.method_ = #{method}
+        </if>
+    </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.enterprise.modules.sys.dao.RoleDAO">
+    <resultMap id="RoleMap" type="com.jpsoft.enterprise.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.enterprise.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.enterprise.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.enterprise.modules.sys.dao.RoleMenuDAO">
+	<resultMap id="RoleMenuMap" type="com.jpsoft.enterprise.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.enterprise.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.enterprise.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.enterprise.modules.sys.dao.RolePermissionDAO">
+	<resultMap id="RolePermissionMap" type="com.jpsoft.enterprise.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.enterprise.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.enterprise.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.enterprise.modules.sys.dao.SysLogDAO">
+    <resultMap id="SysLogMap" type="com.jpsoft.enterprise.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.enterprise.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.enterprise.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>

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

@@ -0,0 +1,145 @@
+<?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.enterprise.modules.sys.dao.UserDAO">
+    <resultMap id="UserMap" type="com.jpsoft.enterprise.modules.sys.entity.User">
+        <id property="id" column="id_"/>
+        <result property="userName" column="user_name"/>
+        <result property="companyId" column="company_id" />
+        <result property="companyName" column="company_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="openId" column="open_id"/>
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.enterprise.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_,company_id,user_name,password_,real_name,create_time,update_time,
+	    del_flag,create_by,update_by,open_id)
+		values
+		(
+            #{id,jdbcType=VARCHAR}
+            ,#{companyId,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}
+            ,#{openId,jdbcType=VARCHAR}
+		)
+	]]>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from sys_user where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.enterprise.modules.sys.entity.User">
+        update sys_user
+        <set>
+            <if test="userName!=null">
+                user_name=#{userName,jdbcType=VARCHAR},
+            </if>
+            <if test="companyId!=null">
+                company_id=#{companyId,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="openId!=null">
+                open_id=#{openId,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="findByCompanyId" parameterType="string" resultMap="UserMap">
+        select * from sys_user where company_id = #{0} and  del_flag = 0
+    </select>
+
+    <select id="findByCompanyList" resultMap="UserMap">
+        select * from sys_user
+        <where>
+            del_flag = 0
+            <if test="searchParams.companyList!=null">
+                <foreach collection="searchParams.companyList" index="index" item="item" open="and company_id in("
+                         separator="," close=")">
+                    #{item.id}
+                </foreach>
+            </if>
+        </where>
+    </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.*,b.name_ as company_name
+			from sys_user a LEFT JOIN base_company_info b ON a.company_id = b.id_
+			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>
+        <if test="searchParams.companyId != null">
+            and a.company_id = #{searchParams.companyId}
+        </if>
+        <if test="searchParams.roleId != null">
+            and a.id_ in (select c.user_id from sys_user_role c where c.role_id = #{searchParams.roleId})
+        </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>
+    <select id="findByOpenId" resultMap="UserMap">
+        select * from sys_user
+        where open_id=#{0} and del_flag=0
+        limit 1
+    </select>
+</mapper>

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

@@ -0,0 +1,100 @@
+<?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.enterprise.modules.sys.dao.UserRoleDAO">
+    <resultMap id="UserRoleMap" type="com.jpsoft.enterprise.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.enterprise.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.enterprise.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.enterprise.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="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>
+</mapper>

+ 97 - 0
common/src/main/resources/mapper/wechat/ReplyMessage.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.enterprise.modules.wechat.dao.ReplyMessageDAO">
+    <sql id="Base_Column_List">
+    id_,
+    event_,
+    message_,
+    callback_url,
+    create_time,
+    update_time
+</sql>
+    <resultMap id="ReplyMessageMap" type="com.jpsoft.enterprise.modules.wechat.entity.ReplyMessage">
+		<id property="id" column="id_" />
+			<result property="event" column="event_" />
+			<result property="message" column="message_" />
+			<result property="callbackUrl" column="callback_url" />
+			<result property="createTime" column="create_time" />
+			<result property="updateTime" column="update_time" />
+			</resultMap>
+	<insert id="insert" parameterType="com.jpsoft.enterprise.modules.wechat.entity.ReplyMessage">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into wechat_reply_message
+	    (id_,event_,message_,callback_url,create_time,update_time)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{event,jdbcType=VARCHAR}
+,#{message,jdbcType=VARCHAR}
+,#{callbackUrl,jdbcType=VARCHAR}
+,#{createTime,jdbcType= TIMESTAMP }
+,#{updateTime,jdbcType= TIMESTAMP }
+		)
+	]]>
+	</insert>
+	<delete id="delete" parameterType="string">
+		delete from wechat_reply_message where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.enterprise.modules.wechat.entity.ReplyMessage">
+		update wechat_reply_message
+		<set>
+				<if test="event!=null">
+		event_=#{event,jdbcType=VARCHAR},
+		</if>
+				<if test="message!=null">
+		message_=#{message,jdbcType=VARCHAR},
+		</if>
+				<if test="callbackUrl!=null">
+		callback_url=#{callbackUrl,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="ReplyMessageMap">
+		select
+id_,event_,message_,callback_url,create_time,update_time		from wechat_reply_message where id_=#{0}
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from wechat_reply_message where id_=#{0}
+	</select>
+	<select id="list" resultMap="ReplyMessageMap">
+		select * from wechat_reply_message
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="ReplyMessageMap">
+		<![CDATA[
+			select * from wechat_reply_message
+		]]>
+		<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>
+
+<!--auto generated by MybatisCodeHelper on 2020-03-23-->
+    <select id="findByEvent" resultMap="ReplyMessageMap">
+        select
+        <include refid="Base_Column_List"/>
+        from wechat_reply_message
+        where event_=#{event}
+    </select>
+</mapper>

+ 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.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven 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.6/maven-wrapper-0.5.6.jar"
+    else
+      jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.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 Maven 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 keystroke 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.6/maven-wrapper-0.5.6.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.6/maven-wrapper-0.5.6.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%

+ 91 - 0
pom.xml

@@ -0,0 +1,91 @@
+<?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>
+    <packaging>pom</packaging>
+    <modules>
+        <module>common</module>
+		<module>web</module>
+	</modules>
+    <parent>
+		<groupId>org.springframework.boot</groupId>
+		<artifactId>spring-boot-starter-parent</artifactId>
+		<version>2.4.1</version>
+		<relativePath/> <!-- lookup parent from repository -->
+	</parent>
+	<groupId>com.jpsoft.enterprise</groupId>
+	<artifactId>parent</artifactId>
+	<version>1.0.0</version>
+	<name>enterprise-federation</name>
+	<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>

+ 185 - 0
web/pom.xml

@@ -0,0 +1,185 @@
+<?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>parent</artifactId>
+        <groupId>com.jpsoft.enterprise</groupId>
+        <version>1.0.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>com.jpsoft.enterprise</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>
+        <lombok.version>1.18.12</lombok.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.enterprise</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>
+        <!--整合Knife4j-->
+        <dependency>
+            <groupId>com.github.xiaoymin</groupId>
+            <artifactId>knife4j-spring-boot-starter</artifactId>
+            <version>2.0.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+        </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>
+                    <artifactId>bcprov-jdk15on</artifactId>
+                    <groupId>org.bouncycastle</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!--支付相关 end-->
+    </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>
+    </profiles>
+
+</project>

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است