Browse Source

数据备案

tianwu.sun 10 months ago
commit
d59b4472e7
100 changed files with 8989 additions and 0 deletions
  1. 63 0
      .gitignore
  2. 409 0
      pom.xml
  3. BIN
      src/lib/iwallca-client-0.0.2-SNAPSHOT.jar
  4. 26 0
      src/main/java/com/bootdo/CicApplication.java
  5. 82 0
      src/main/java/com/bootdo/activiti/config/ActivitiConfig.java
  6. 8 0
      src/main/java/com/bootdo/activiti/config/ActivitiConstant.java
  7. 260 0
      src/main/java/com/bootdo/activiti/controller/ModelController.java
  8. 164 0
      src/main/java/com/bootdo/activiti/controller/ProcessController.java
  9. 136 0
      src/main/java/com/bootdo/activiti/controller/SalaryController.java
  10. 107 0
      src/main/java/com/bootdo/activiti/controller/TaskController.java
  11. 31 0
      src/main/java/com/bootdo/activiti/dao/SalaryDao.java
  12. 251 0
      src/main/java/com/bootdo/activiti/domain/ActivitiDO.java
  13. 373 0
      src/main/java/com/bootdo/activiti/domain/SalaryDO.java
  14. 47 0
      src/main/java/com/bootdo/activiti/domain/TaskDO.java
  15. 35 0
      src/main/java/com/bootdo/activiti/domain/Variable.java
  16. 23 0
      src/main/java/com/bootdo/activiti/service/ActTaskService.java
  17. 16 0
      src/main/java/com/bootdo/activiti/service/ProcessService.java
  18. 30 0
      src/main/java/com/bootdo/activiti/service/SalaryService.java
  19. 279 0
      src/main/java/com/bootdo/activiti/service/impl/ActTaskServiceImpl.java
  20. 82 0
      src/main/java/com/bootdo/activiti/service/impl/ProcessServiceImpl.java
  21. 69 0
      src/main/java/com/bootdo/activiti/service/impl/SalaryServiceImpl.java
  22. 41 0
      src/main/java/com/bootdo/activiti/utils/ActivitiUtils.java
  23. 56 0
      src/main/java/com/bootdo/activiti/vo/DeploymentResponse.java
  24. 45 0
      src/main/java/com/bootdo/activiti/vo/ProcessVO.java
  25. 103 0
      src/main/java/com/bootdo/activiti/vo/TaskVO.java
  26. 59 0
      src/main/java/com/bootdo/blog/controller/BlogController.java
  27. 165 0
      src/main/java/com/bootdo/blog/controller/ContentController.java
  28. 81 0
      src/main/java/com/bootdo/blog/dao/ContentDao.java
  29. 295 0
      src/main/java/com/bootdo/blog/domain/ContentDO.java
  30. 79 0
      src/main/java/com/bootdo/blog/service/ContentService.java
  31. 89 0
      src/main/java/com/bootdo/blog/service/impl/ContentServiceImpl.java
  32. 12 0
      src/main/java/com/bootdo/common/annotation/Log.java
  33. 104 0
      src/main/java/com/bootdo/common/aspect/LogAspect.java
  34. 61 0
      src/main/java/com/bootdo/common/aspect/WebLogAspect.java
  35. 50 0
      src/main/java/com/bootdo/common/config/ApplicationContextRegister.java
  36. 69 0
      src/main/java/com/bootdo/common/config/BootdoConfig.java
  37. 24 0
      src/main/java/com/bootdo/common/config/Constant.java
  38. 40 0
      src/main/java/com/bootdo/common/config/DateConverConfig.java
  39. 145 0
      src/main/java/com/bootdo/common/config/DruidDBConfig.java
  40. 50 0
      src/main/java/com/bootdo/common/config/QuartzConfigration.java
  41. 13 0
      src/main/java/com/bootdo/common/config/SecuityConfig.java
  42. 23 0
      src/main/java/com/bootdo/common/config/SpringAsyncConfig.java
  43. 22 0
      src/main/java/com/bootdo/common/config/SpringBootSampleApplication.java
  44. 156 0
      src/main/java/com/bootdo/common/config/ThirdPartSsoConfig.java
  45. 17 0
      src/main/java/com/bootdo/common/config/WebConfigurer.java
  46. 21 0
      src/main/java/com/bootdo/common/controller/BaseController.java
  47. 176 0
      src/main/java/com/bootdo/common/controller/DictController.java
  48. 164 0
      src/main/java/com/bootdo/common/controller/FileController.java
  49. 97 0
      src/main/java/com/bootdo/common/controller/GeneratorController.java
  50. 144 0
      src/main/java/com/bootdo/common/controller/JobController.java
  51. 61 0
      src/main/java/com/bootdo/common/controller/LogController.java
  52. 36 0
      src/main/java/com/bootdo/common/dao/DictDao.java
  53. 32 0
      src/main/java/com/bootdo/common/dao/FileDao.java
  54. 23 0
      src/main/java/com/bootdo/common/dao/GeneratorMapper.java
  55. 32 0
      src/main/java/com/bootdo/common/dao/LogDao.java
  56. 32 0
      src/main/java/com/bootdo/common/dao/TaskDao.java
  57. 93 0
      src/main/java/com/bootdo/common/domain/ColumnDO.java
  58. 221 0
      src/main/java/com/bootdo/common/domain/DictDO.java
  59. 104 0
      src/main/java/com/bootdo/common/domain/FileDO.java
  60. 112 0
      src/main/java/com/bootdo/common/domain/LogDO.java
  61. 86 0
      src/main/java/com/bootdo/common/domain/PageDO.java
  62. 135 0
      src/main/java/com/bootdo/common/domain/ScheduleJob.java
  63. 86 0
      src/main/java/com/bootdo/common/domain/TableDO.java
  64. 258 0
      src/main/java/com/bootdo/common/domain/TaskDO.java
  65. 151 0
      src/main/java/com/bootdo/common/domain/Tree.java
  66. 51 0
      src/main/java/com/bootdo/common/exception/BDException.java
  67. 87 0
      src/main/java/com/bootdo/common/exception/BDExceptionHandler.java
  68. 66 0
      src/main/java/com/bootdo/common/exception/MainsiteErrorController.java
  69. 31 0
      src/main/java/com/bootdo/common/listenner/ScheduleJobInitListener.java
  70. 21 0
      src/main/java/com/bootdo/common/quartz/factory/JobFactory.java
  71. 227 0
      src/main/java/com/bootdo/common/quartz/utils/QuartzManager.java
  72. 194 0
      src/main/java/com/bootdo/common/redis/shiro/RedisCache.java
  73. 77 0
      src/main/java/com/bootdo/common/redis/shiro/RedisCacheManager.java
  74. 228 0
      src/main/java/com/bootdo/common/redis/shiro/RedisManager.java
  75. 139 0
      src/main/java/com/bootdo/common/redis/shiro/RedisSessionDAO.java
  76. 89 0
      src/main/java/com/bootdo/common/redis/shiro/SerializeUtils.java
  77. 65 0
      src/main/java/com/bootdo/common/service/DictService.java
  78. 37 0
      src/main/java/com/bootdo/common/service/FileService.java
  79. 22 0
      src/main/java/com/bootdo/common/service/GeneratorService.java
  80. 38 0
      src/main/java/com/bootdo/common/service/JobService.java
  81. 16 0
      src/main/java/com/bootdo/common/service/LogService.java
  82. 116 0
      src/main/java/com/bootdo/common/service/impl/DictServiceImpl.java
  83. 73 0
      src/main/java/com/bootdo/common/service/impl/FileServiceImpl.java
  84. 44 0
      src/main/java/com/bootdo/common/service/impl/GeneratorServiceImpl.java
  85. 123 0
      src/main/java/com/bootdo/common/service/impl/JobServiceImpl.java
  86. 60 0
      src/main/java/com/bootdo/common/service/impl/LogServiceImpl.java
  87. 48 0
      src/main/java/com/bootdo/common/task/Job.java
  88. 25 0
      src/main/java/com/bootdo/common/task/WelcomeJob.java
  89. 52 0
      src/main/java/com/bootdo/common/utils/BDException.java
  90. 5 0
      src/main/java/com/bootdo/common/utils/Base64Utils.java
  91. 89 0
      src/main/java/com/bootdo/common/utils/BuildTree.java
  92. 73 0
      src/main/java/com/bootdo/common/utils/CustomCellWriteUtil.java
  93. 91 0
      src/main/java/com/bootdo/common/utils/DateUtils.java
  94. 88 0
      src/main/java/com/bootdo/common/utils/EhcacheUtil.java
  95. 12 0
      src/main/java/com/bootdo/common/utils/ExceptionUtils.java
  96. 55 0
      src/main/java/com/bootdo/common/utils/FileType.java
  97. 37 0
      src/main/java/com/bootdo/common/utils/FileUtil.java
  98. 244 0
      src/main/java/com/bootdo/common/utils/GenUtils.java
  99. 12 0
      src/main/java/com/bootdo/common/utils/HttpContextUtils.java
  100. 0 0
      src/main/java/com/bootdo/common/utils/HttpDeleteThread.java

+ 63 - 0
.gitignore

@@ -0,0 +1,63 @@
+# Created by .ignore support plugin (hsz.mobi)
+### Maven template
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+
+# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
+!/.mvn/wrapper/maven-wrapper.jar
+### JetBrains template
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+.idea/
+
+# User-specific stuff:
+
+
+# Sensitive or high-churn files:
+
+# Gradle:
+
+
+# CMake
+cmake-build-debug/
+cmake-build-release/
+
+# Mongo Explorer plugin:
+.idea/**/mongoSettings.xml
+
+## File-based project format:
+*.iml
+*.iws
+
+## Plugin-specific files:
+
+# IntelliJ
+out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+/bootdo.iml
+
+# log
+applog

+ 409 - 0
pom.xml

@@ -0,0 +1,409 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>com.bootdo</groupId>
+    <artifactId>cic-data-reportin</artifactId>
+    <version>2.0.0</version>
+    <packaging>jar</packaging>
+
+    <name>cic-data-reportin</name>
+    <description>Demo project for Spring Boot</description>
+
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.0.3.RELEASE</version>
+        <relativePath/>
+    </parent>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <java.version>1.8</java.version>
+        <mybatisplus-spring-boot-starter.version>1.0.4</mybatisplus-spring-boot-starter.version>
+        <velocity.version>1.7</velocity.version>
+        <activiti.version>5.22.0</activiti.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+        </dependency>
+        <!--web -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-thymeleaf</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>net.sourceforge.nekohtml</groupId>
+            <artifactId>nekohtml</artifactId>
+        </dependency>
+        <!--mybatis -->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis</groupId>
+            <artifactId>mybatis</artifactId>
+            <version>3.4.4</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>1.1.1</version>
+        </dependency>
+        <!--druid -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid</artifactId>
+            <version>1.0.28</version>
+        </dependency>
+        <!--commons -->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.6</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-configuration</groupId>
+            <artifactId>commons-configuration</artifactId>
+            <version>1.10</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.5</version>
+        </dependency>
+        <!--shiro -->
+        <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-core</artifactId>
+            <version>1.3.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-spring</artifactId>
+            <version>1.3.2</version>
+        </dependency>
+        <!-- shiro ehcache -->
+        <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-ehcache</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>net.sf.ehcache</groupId>
+                    <artifactId>ehcache-core</artifactId>
+                </exclusion>
+            </exclusions>
+            <version>1.4.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.github.theborakompanioni</groupId>
+            <artifactId>thymeleaf-extras-shiro</artifactId>
+            <version>2.0.0</version>
+        </dependency>
+        <!-- utils -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.31</version>
+        </dependency>
+        <!--velocity代码生成使用模板 -->
+        <dependency>
+            <groupId>org.apache.velocity</groupId>
+            <artifactId>velocity</artifactId>
+            <version>1.7</version>
+        </dependency>
+        <!-- ehchache -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-cache</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>net.sf.ehcache</groupId>
+            <artifactId>ehcache</artifactId>
+        </dependency>
+        <!--<dependency>-->
+        <!--<groupId>org.springframework.boot</groupId>-->
+        <!--<artifactId>spring-boot-starter-data-redis</artifactId>-->
+        <!--</dependency>-->
+        <!-- quartz -->
+        <!--<dependency>-->
+        <!--<groupId>org.springframework.boot</groupId>-->
+        <!--<artifactId>spring-boot-starter-cache</artifactId>-->
+        <!--</dependency>-->
+
+        <!--<dependency>-->
+        <!--<groupId>net.sf.ehcache</groupId>-->
+        <!--<artifactId>ehcache</artifactId>-->
+        <!--</dependency>-->
+
+
+        <dependency>
+            <groupId>org.quartz-scheduler</groupId>
+            <artifactId>quartz</artifactId>
+            <version>2.2.1</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>slf4j-api</artifactId>
+                    <groupId>org.slf4j</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!-- SpringWebSocket依赖 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-websocket</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context-support</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-devtools</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <!--activiti-->
+        <dependency>
+            <groupId>org.activiti</groupId>
+            <artifactId>activiti-engine</artifactId>
+            <version>${activiti.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.activiti</groupId>
+            <artifactId>activiti-spring</artifactId>
+            <version>${activiti.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.activiti</groupId>
+            <artifactId>activiti-modeler</artifactId>
+            <version>${activiti.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.activiti</groupId>
+            <artifactId>activiti-diagram-rest</artifactId>
+            <version>${activiti.version}</version>
+        </dependency>
+
+        <!--swagger2-->
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+            <version>2.6.1</version>
+        </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger-ui</artifactId>
+            <version>2.6.1</version>
+        </dependency>
+
+        <!-- 添加redis支持-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>redis.clients</groupId>
+            <artifactId>jedis</artifactId>
+            <version>2.9.0</version>
+        </dependency>
+
+
+        <!-- xss过滤组件 -->
+        <dependency>
+            <groupId>org.jsoup</groupId>
+            <artifactId>jsoup</artifactId>
+            <version>1.9.2</version>
+        </dependency>
+
+        <!--war包部署需要-->
+        <!--<dependency>-->
+        <!--<groupId>org.springframework.boot</groupId>-->
+        <!--<artifactId>spring-boot-starter-web</artifactId>-->
+        <!--&lt;!&ndash; 移除嵌入式tomcat插件 &ndash;&gt;-->
+        <!--<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.netflix.feign</groupId>
+            <artifactId>feign-core</artifactId>
+            <version>8.18.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.netflix.feign</groupId>
+            <artifactId>feign-jackson</artifactId>
+            <version>8.18.0</version>
+        </dependency>
+
+        <!--        <dependency>-->
+        <!--            <groupId>org.springframework.cloud</groupId>-->
+        <!--            <artifactId>spring-cloud-starter-openfeign</artifactId>-->
+        <!--            <version>2.1.2.RELEASE</version>-->
+        <!--        </dependency>-->
+
+        <!--        <dependency>-->
+        <!--            <groupId>org.apache.poi</groupId>-->
+        <!--            <artifactId>poi</artifactId>-->
+        <!--            <version>4.0.1</version>-->
+        <!--        </dependency>-->
+        <!--        <dependency>-->
+        <!--            <groupId>org.apache.poi</groupId>-->
+        <!--            <artifactId>poi-ooxml</artifactId>-->
+        <!--            <version>4.0.1</version>-->
+        <!--        </dependency>-->
+
+        <!-- easyexcel相关依赖 -->
+<!--        <dependency>-->
+<!--            <groupId>com.alibaba</groupId>-->
+<!--            <artifactId>easyexcel</artifactId>-->
+<!--            <version>1.1.2-beta5</version>-->
+<!--        </dependency>-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+            <version>2.2.10</version>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>1.18.12</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+            <version>3.17</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>3.17</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>ooxml-schemas</artifactId>
+            <version>1.4</version>
+        </dependency>
+        <!--国密
+        <dependency>
+            <groupId>com.iwall.gmsec</groupId>
+            <artifactId>GMSec</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>-->
+        <dependency>
+            <groupId>org.bouncycastle</groupId>
+            <artifactId>bcprov-jdk15on</artifactId>
+            <version>1.64</version>
+        </dependency>
+        <dependency>
+            <groupId>org.bouncycastle</groupId>
+            <artifactId>bcpkix-jdk15on</artifactId>
+            <version>1.64</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>okhttp</artifactId>
+            <version>3.6.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.whvcse</groupId>
+            <artifactId>easy-captcha</artifactId>
+            <version>1.6.2</version>
+        </dependency>
+
+        <!--配置文件警告去除-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-configuration-processor</artifactId>
+            <optional>true</optional>
+        </dependency>
+
+        <!--http common-->
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpcore</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+        </dependency>
+
+        <!--iwall 证书sdk-->
+        <dependency>
+            <groupId>cn.com.iwall</groupId>
+            <artifactId>iwallca-client</artifactId>
+            <version>0.0.2-SNAPSHOT</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/src/lib/iwallca-client-0.0.2-SNAPSHOT.jar</systemPath>
+        </dependency>
+
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <executable>true</executable>
+                    <includeSystemScope>true</includeSystemScope>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    <!--<repositories>-->
+    <!--<repository>-->
+    <!--<id>public</id>-->
+    <!--<name>aliyun nexus</name>-->
+    <!--<url>http://maven.aliyun.com/nexus/content/groups/public/</url>-->
+    <!--<releases>-->
+    <!--<enabled>true</enabled>-->
+    <!--</releases>-->
+    <!--</repository>-->
+    <!--</repositories>-->
+    <!--<pluginRepositories>-->
+    <!--<pluginRepository>-->
+    <!--<id>public</id>-->
+    <!--<name>aliyun nexus</name>-->
+    <!--<url>http://maven.aliyun.com/nexus/content/groups/public/</url>-->
+    <!--<releases>-->
+    <!--<enabled>true</enabled>-->
+    <!--</releases>-->
+    <!--<snapshots>-->
+    <!--<enabled>false</enabled>-->
+    <!--</snapshots>-->
+    <!--</pluginRepository>-->
+    <!--</pluginRepositories>-->
+</project>

BIN
src/lib/iwallca-client-0.0.2-SNAPSHOT.jar


+ 26 - 0
src/main/java/com/bootdo/CicApplication.java

@@ -0,0 +1,26 @@
+package com.bootdo;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.servlet.ServletComponentScan;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@EnableTransactionManagement
+@ServletComponentScan
+@MapperScan("com.bootdo.*.dao")
+@SpringBootApplication(exclude = {org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class})
+@EnableCaching
+@EnableAsync
+public class CicApplication {
+
+
+    public static void main(String[] args) {
+        SpringApplication.run(CicApplication.class, args);
+        System.out.println(
+            "ヾ(◍°∇°◍)ノ゙    cic启动成功      ヾ(◍°∇°◍)ノ゙\n");
+    }
+
+}

+ 82 - 0
src/main/java/com/bootdo/activiti/config/ActivitiConfig.java

@@ -0,0 +1,82 @@
+package com.bootdo.activiti.config;
+
+import org.activiti.engine.*;
+import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
+import org.activiti.spring.ProcessEngineFactoryBean;
+import org.activiti.spring.SpringProcessEngineConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.transaction.PlatformTransactionManager;
+
+import javax.sql.DataSource;
+@Configuration
+public class ActivitiConfig {
+    //流程配置,与spring整合采用SpringProcessEngineConfiguration这个实现
+    @Bean
+    public ProcessEngineConfiguration processEngineConfiguration(DataSource dataSource, PlatformTransactionManager transactionManager){
+        SpringProcessEngineConfiguration processEngineConfiguration = new SpringProcessEngineConfiguration();
+        processEngineConfiguration.setDataSource(dataSource);
+        processEngineConfiguration.setDatabaseSchemaUpdate("true");
+        processEngineConfiguration.setDatabaseType("mysql");
+
+        processEngineConfiguration.setTransactionManager(transactionManager);
+
+        //流程图字体
+        processEngineConfiguration.setActivityFontName("宋体");
+        processEngineConfiguration.setAnnotationFontName("宋体");
+        processEngineConfiguration.setLabelFontName("宋体");
+
+        return processEngineConfiguration;
+    }
+
+    //流程引擎,与spring整合使用factoryBean
+    @Bean
+    public ProcessEngineFactoryBean processEngine(ProcessEngineConfiguration processEngineConfiguration){
+        ProcessEngineFactoryBean processEngineFactoryBean = new ProcessEngineFactoryBean();
+        processEngineFactoryBean.setProcessEngineConfiguration((ProcessEngineConfigurationImpl) processEngineConfiguration);
+        return processEngineFactoryBean;
+    }
+
+    //八大接口
+    @Bean
+    public RepositoryService repositoryService(ProcessEngine processEngine){
+        return processEngine.getRepositoryService();
+    }
+
+    @Bean
+    public RuntimeService runtimeService(ProcessEngine processEngine){
+        return processEngine.getRuntimeService();
+    }
+
+    @Bean
+    public TaskService taskService(ProcessEngine processEngine){
+        return processEngine.getTaskService();
+    }
+
+    @Bean
+    public HistoryService historyService(ProcessEngine processEngine){
+        return processEngine.getHistoryService();
+    }
+
+    @Bean
+    public FormService formService(ProcessEngine processEngine){
+        return processEngine.getFormService();
+    }
+
+    @Bean
+    public IdentityService identityService(ProcessEngine processEngine){
+        return processEngine.getIdentityService();
+    }
+
+    @Bean
+    public ManagementService managementService(ProcessEngine processEngine){
+        return processEngine.getManagementService();
+    }
+
+    @Bean
+    public DynamicBpmnService dynamicBpmnService(ProcessEngine processEngine){
+        return processEngine.getDynamicBpmnService();
+    }
+
+    //八大接口 end
+}

+ 8 - 0
src/main/java/com/bootdo/activiti/config/ActivitiConstant.java

@@ -0,0 +1,8 @@
+package com.bootdo.activiti.config;
+
+/**
+
+ */
+public class ActivitiConstant {
+    public static final String[] ACTIVITI_SALARY = new String[]{"salary","salary"};
+}

+ 260 - 0
src/main/java/com/bootdo/activiti/controller/ModelController.java

@@ -0,0 +1,260 @@
+package com.bootdo.activiti.controller;
+
+import com.bootdo.common.config.Constant;
+import com.bootdo.common.controller.BaseController;
+import com.bootdo.common.utils.PageUtils;
+import com.bootdo.common.utils.R;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.activiti.bpmn.converter.BpmnXMLConverter;
+import org.activiti.bpmn.model.BpmnModel;
+import org.activiti.editor.constants.ModelDataJsonConstants;
+import org.activiti.editor.language.json.converter.BpmnJsonConverter;
+import org.activiti.engine.ActivitiException;
+import org.activiti.engine.RepositoryService;
+import org.activiti.engine.repository.Deployment;
+import org.activiti.engine.repository.Model;
+import org.activiti.rest.editor.model.ModelEditorJsonRestResource;
+import org.apache.batik.transcoder.TranscoderInput;
+import org.apache.batik.transcoder.TranscoderOutput;
+import org.apache.batik.transcoder.image.PNGTranscoder;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.util.List;
+
+import static org.activiti.editor.constants.ModelDataJsonConstants.*;
+
+/**
+ * @author bootdo 1992lcg@163.com
+ */
+@RequestMapping("/activiti")
+@RestController
+public class ModelController extends BaseController{
+    protected static final Logger LOGGER = LoggerFactory.getLogger(ModelEditorJsonRestResource.class);
+
+    @Autowired
+    private RepositoryService repositoryService;
+
+    @Autowired
+    private ObjectMapper objectMapper;
+
+    @GetMapping("/model")
+    ModelAndView model() {
+        return new ModelAndView("act/model/model");
+    }
+
+    @GetMapping("/model/list")
+    PageUtils list(int offset, int limit) {
+        List<Model> list = repositoryService.createModelQuery().listPage(offset
+                , limit);
+        int total = (int) repositoryService.createModelQuery().count();
+        PageUtils pageUtil = new PageUtils(list, total);
+        return pageUtil;
+    }
+
+    @RequestMapping("/model/add")
+    public void newModel(HttpServletResponse response) throws UnsupportedEncodingException {
+
+        //初始化一个空模型
+        Model model = repositoryService.newModel();
+        //设置一些默认信息
+        String name = "new-process";
+        String description = "";
+        int revision = 1;
+        String key = "process";
+
+        ObjectNode modelNode = objectMapper.createObjectNode();
+        modelNode.put(ModelDataJsonConstants.MODEL_NAME, name);
+        modelNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, description);
+        modelNode.put(ModelDataJsonConstants.MODEL_REVISION, revision);
+
+        model.setName(name);
+        model.setKey(key);
+        model.setMetaInfo(modelNode.toString());
+
+        repositoryService.saveModel(model);
+        String id = model.getId();
+
+        //完善ModelEditorSource
+        ObjectNode editorNode = objectMapper.createObjectNode();
+        editorNode.put("id", "canvas");
+        editorNode.put("resourceId", "canvas");
+        ObjectNode stencilSetNode = objectMapper.createObjectNode();
+        stencilSetNode.put("namespace",
+                "http://b3mn.org/stencilset/bpmn2.0#");
+        editorNode.put("stencilset", stencilSetNode);
+        repositoryService.addModelEditorSource(id, editorNode.toString().getBytes("utf-8"));
+        try {
+            response.sendRedirect("/modeler.html?modelId=" + id);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @GetMapping(value = "/model/{modelId}/json")
+    public ObjectNode getEditorJson(@PathVariable String modelId) {
+        ObjectNode modelNode = null;
+        Model model = repositoryService.getModel(modelId);
+        if (model != null) {
+            try {
+                if (StringUtils.isNotEmpty(model.getMetaInfo())) {
+                    modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
+                } else {
+                    modelNode = objectMapper.createObjectNode();
+                    modelNode.put(MODEL_NAME, model.getName());
+                }
+                modelNode.put(MODEL_ID, model.getId());
+                ObjectNode editorJsonNode = (ObjectNode) objectMapper.readTree(
+                        new String(repositoryService.getModelEditorSource(model.getId()), "utf-8"));
+                modelNode.put("model", editorJsonNode);
+
+            } catch (Exception e) {
+                LOGGER.error("Error creating model JSON", e);
+                throw new ActivitiException("Error creating model JSON", e);
+            }
+        }
+        return modelNode;
+    }
+
+    @RequestMapping(value = "/editor/stencilset", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
+    public String getStencilset() {
+        InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");
+        try {
+            return IOUtils.toString(stencilsetStream, "utf-8");
+        } catch (Exception e) {
+            throw new ActivitiException("Error while loading stencil set", e);
+        }
+    }
+
+    @GetMapping("/model/edit/{id}")
+    public void edit(HttpServletResponse response, @PathVariable("id") String id) {
+        try {
+            response.sendRedirect("/modeler.html?modelId=" + id);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @DeleteMapping("/model/{id}")
+    public R remove(@PathVariable("id") String id) {
+        if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+            return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+        }
+        repositoryService.deleteModel(id);
+        return R.ok();
+    }
+
+    @PostMapping("/model/deploy/{id}")
+    public R deploy(@PathVariable("id") String id) throws Exception {
+        if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+            return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+        }
+        //获取模型
+        Model modelData = repositoryService.getModel(id);
+        byte[] bytes = repositoryService.getModelEditorSource(modelData.getId());
+
+        if (bytes == null) {
+            return R.error("模型数据为空,请先设计流程并成功保存,再进行发布。");
+        }
+
+        JsonNode modelNode = new ObjectMapper().readTree(bytes);
+
+        BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode);
+        if (model.getProcesses().size() == 0) {
+            return R.error("数据模型不符要求,请至少设计一条主线流程。");
+        }
+        byte[] bpmnBytes = new BpmnXMLConverter().convertToXML(model);
+
+        //发布流程
+        String processName = modelData.getName() + ".bpmn20.xml";
+        Deployment deployment = repositoryService.createDeployment()
+                .name(modelData.getName())
+                .addString(processName, new String(bpmnBytes, "UTF-8"))
+                .deploy();
+        modelData.setDeploymentId(deployment.getId());
+        repositoryService.saveModel(modelData);
+
+        return R.ok();
+    }
+
+    @PostMapping("/model/batchRemove")
+    public R batchRemove(@RequestParam("ids[]") String[] ids) {
+        if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+            return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+        }
+        for (String id : ids) {
+            repositoryService.deleteModel(id);
+        }
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/model/{modelId}/save", method = RequestMethod.PUT)
+    @ResponseStatus(value = HttpStatus.OK)
+    public void saveModel(@PathVariable String modelId
+            , String name, String description
+            , String json_xml, String svg_xml) {
+        try {
+
+            Model model = repositoryService.getModel(modelId);
+
+            ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
+
+            modelJson.put(MODEL_NAME, name);
+            modelJson.put(MODEL_DESCRIPTION, description);
+            model.setMetaInfo(modelJson.toString());
+            model.setName(name);
+
+            repositoryService.saveModel(model);
+
+            repositoryService.addModelEditorSource(model.getId(), json_xml.getBytes("utf-8"));
+
+            InputStream svgStream = new ByteArrayInputStream(svg_xml.getBytes("utf-8"));
+            TranscoderInput input = new TranscoderInput(svgStream);
+
+            PNGTranscoder transcoder = new PNGTranscoder();
+            // Setup output
+            ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+            TranscoderOutput output = new TranscoderOutput(outStream);
+
+            // Do the transformation
+            transcoder.transcode(input, output);
+            final byte[] result = outStream.toByteArray();
+            repositoryService.addModelEditorSourceExtra(model.getId(), result);
+            outStream.close();
+
+        } catch (Exception e) {
+            LOGGER.error("Error saving model", e);
+            throw new ActivitiException("Error saving model", e);
+        }
+    }
+
+    @GetMapping("/model/export/{id}")
+    public void exportToXml(@PathVariable("id") String id, HttpServletResponse response) {
+        try {
+            org.activiti.engine.repository.Model modelData = repositoryService.getModel(id);
+            BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
+            JsonNode editorNode = new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
+            BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
+            BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
+            byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);
+
+            ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
+            IOUtils.copy(in, response.getOutputStream());
+            String filename = bpmnModel.getMainProcess().getId() + ".bpmn20.xml";
+            response.setHeader("Content-Disposition", "attachment; filename=" + filename);
+            response.flushBuffer();
+        } catch (Exception e) {
+            throw new ActivitiException("导出model的xml文件失败,模型ID=" + id, e);
+        }
+    }
+}

+ 164 - 0
src/main/java/com/bootdo/activiti/controller/ProcessController.java

@@ -0,0 +1,164 @@
+package com.bootdo.activiti.controller;
+
+import com.bootdo.activiti.service.ProcessService;
+import com.bootdo.activiti.vo.ProcessVO;
+import com.bootdo.common.config.Constant;
+import com.bootdo.common.controller.BaseController;
+import com.bootdo.common.utils.PageUtils;
+import com.bootdo.common.utils.R;
+import org.activiti.engine.ActivitiException;
+import org.activiti.engine.RepositoryService;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.repository.Deployment;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.apache.commons.io.FilenameUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.stream.XMLStreamException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.ZipInputStream;
+
+@RequestMapping("activiti/process")
+@RestController
+public class ProcessController extends BaseController{
+
+    @Autowired
+    private RepositoryService repositoryService;
+
+    @Autowired
+    private ProcessService processService;
+
+    @Autowired
+    private RuntimeService runtimeService;
+
+    @GetMapping
+    ModelAndView process() {
+        return new ModelAndView("act/process/process");
+    }
+
+    @GetMapping("list")
+    PageUtils list(int offset, int limit) {
+        List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
+                .listPage(offset, limit);
+        int count = (int) repositoryService.createProcessDefinitionQuery().count();
+        List<Object> list = new ArrayList<>();
+        for(ProcessDefinition processDefinition: processDefinitions){
+            list.add(new ProcessVO(processDefinition));
+        }
+        PageUtils pageUtils = new PageUtils(list, count);
+        return pageUtils;
+    }
+
+    @GetMapping("/add")
+    public ModelAndView add() {
+        return new ModelAndView("act/process/add");
+    }
+
+    @PostMapping("/save")
+    @Transactional(readOnly = false)
+    public R deploy(String exportDir, String category, MultipartFile file) {
+        if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+            return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+        }
+        String message = "";
+        String fileName = file.getOriginalFilename();
+        try {
+            InputStream fileInputStream = file.getInputStream();
+            Deployment deployment = null;
+            String extension = FilenameUtils.getExtension(fileName);
+            if (extension.equals("zip") || extension.equals("bar")) {
+                ZipInputStream zip = new ZipInputStream(fileInputStream);
+                deployment = repositoryService.createDeployment().addZipInputStream(zip).deploy();
+            } else if (extension.equals("png")) {
+                deployment = repositoryService.createDeployment().addInputStream(fileName, fileInputStream).deploy();
+            } else if (fileName.indexOf("bpmn20.xml") != -1) {
+                deployment = repositoryService.createDeployment().addInputStream(fileName, fileInputStream).deploy();
+            } else if (extension.equals("bpmn")) { // bpmn扩展名特殊处理,转换为bpmn20.xml
+                String baseName = FilenameUtils.getBaseName(fileName);
+                deployment = repositoryService.createDeployment().addInputStream(baseName + ".bpmn20.xml", fileInputStream).deploy();
+            } else {
+                message = "不支持的文件类型:" + extension;
+            }
+
+            List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();
+
+            // 设置流程分类
+            for (ProcessDefinition processDefinition : list) {
+//					ActUtils.exportDiagramToFile(repositoryService, processDefinition, exportDir);
+                repositoryService.setProcessDefinitionCategory(processDefinition.getId(), category);
+                message += "部署成功,流程ID=" + processDefinition.getId() + "<br/>";
+            }
+
+            if (list.size() == 0) {
+                message = "部署失败,没有流程。";
+            }
+
+        } catch (Exception e) {
+            throw new ActivitiException("部署失败!", e);
+        }
+        return R.ok(message);
+    }
+
+    /**
+     * 将部署的流程转换为模型
+     *
+     * @param procDefId
+     * @param redirectAttributes
+     * @return
+     * @throws UnsupportedEncodingException
+     * @throws XMLStreamException
+     */
+    @RequestMapping(value = "/convertToModel/{procDefId}")
+    public R convertToModel(@PathVariable("procDefId") String procDefId, RedirectAttributes redirectAttributes) throws UnsupportedEncodingException, XMLStreamException {
+        if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+            return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+        }
+        org.activiti.engine.repository.Model modelData = null;
+        try {
+            modelData = processService.convertToModel(procDefId);
+            return R.ok( "转换模型成功,模型ID=" + modelData.getId());
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.ok( "转换模型失败");
+        }
+
+    }
+
+    @RequestMapping(value = "/resource/read/{xml}/{id}")
+    public void resourceRead(@PathVariable("xml") String resType, @PathVariable("id") String id, HttpServletResponse response) throws Exception {
+        InputStream resourceAsStream = processService.resourceRead(id,resType);
+        byte[] b = new byte[1024];
+        int len = -1;
+        while ((len = resourceAsStream.read(b, 0, 1024)) != -1) {
+            response.getOutputStream().write(b, 0, len);
+        }
+    }
+
+    @PostMapping("/remove")
+    public R remove(String id){
+        if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+            return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+        }
+        repositoryService.deleteDeployment(id,true);
+        return R.ok();
+    }
+    @PostMapping("/batchRemove")
+    public R batchRemove(@RequestParam("ids[]") String[] ids) {
+        if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+            return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+        }
+        for (String id : ids) {
+            repositoryService.deleteDeployment(id,true);
+        }
+        return R.ok();
+    }
+}

+ 136 - 0
src/main/java/com/bootdo/activiti/controller/SalaryController.java

@@ -0,0 +1,136 @@
+package com.bootdo.activiti.controller;
+
+import com.bootdo.activiti.domain.SalaryDO;
+import com.bootdo.activiti.service.SalaryService;
+import com.bootdo.activiti.utils.ActivitiUtils;
+import com.bootdo.common.config.Constant;
+import com.bootdo.common.controller.BaseController;
+import com.bootdo.common.utils.PageUtils;
+import com.bootdo.common.utils.Query;
+import com.bootdo.common.utils.R;
+import com.bootdo.common.utils.ShiroUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 审批流程测试表
+ *
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-11-25 13:33:16
+ */
+
+@Controller
+@RequestMapping("/act/salary")
+public class SalaryController extends BaseController{
+    @Autowired
+    private SalaryService salaryService;
+    @Autowired
+    ActivitiUtils activitiUtils;
+
+    @GetMapping()
+    String Salary() {
+        return "activiti/salary/salary";
+    }
+
+    @ResponseBody
+    @GetMapping("/list")
+    public PageUtils list(@RequestParam Map<String, Object> params) {
+        Query query = new Query(params);
+        List<SalaryDO> salaryList = salaryService.list(query);
+        int total = salaryService.count(query);
+        PageUtils pageUtils = new PageUtils(salaryList, total);
+        return pageUtils;
+    }
+
+    @GetMapping("/form")
+    String add() {
+        return "act/salary/add";
+    }
+
+    @GetMapping("/form/{taskId}")
+    String edit(@PathVariable("taskId") String taskId, Model model) {
+        SalaryDO salary = salaryService.get(activitiUtils.getBusinessKeyByTaskId(taskId));
+        salary.setTaskId(taskId);
+        model.addAttribute("salary", salary);
+        return "act/salary/edit";
+    }
+
+    /**
+     * 保存
+     */
+    @ResponseBody
+    @PostMapping("/save")
+    public R saveOrUpdate(SalaryDO salary) {
+        if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+            return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+        }
+        salary.setCreateDate(new Date());
+        salary.setUpdateDate(new Date());
+        salary.setCreateBy(ShiroUtils.getUserId().toString());
+        salary.setUpdateBy(ShiroUtils.getUserId().toString());
+        salary.setDelFlag("1");
+        if (salaryService.save(salary) > 0) {
+            return R.ok();
+        }
+        return R.error();
+    }
+
+    /**
+     * 修改
+     */
+    @ResponseBody
+    @RequestMapping("/update")
+    public R update(SalaryDO salary) {
+        if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+            return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+        }
+        String taskKey = activitiUtils.getTaskByTaskId(salary.getTaskId()).getTaskDefinitionKey();
+        if ("audit2".equals(taskKey)) {
+            salary.setHrText(salary.getTaskComment());
+        } else if ("audit3".equals(taskKey)) {
+            salary.setLeadText(salary.getTaskComment());
+        } else if ("audit4".equals(taskKey)) {
+            salary.setMainLeadText(salary.getTaskComment());
+        } else if("apply_end".equals(salary.getTaskComment())){
+            //流程完成,兑现
+        }
+        salaryService.update(salary);
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @PostMapping("/remove")
+    @ResponseBody
+    public R remove(String id) {
+        if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+            return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+        }
+        if (salaryService.remove(id) > 0) {
+            return R.ok();
+        }
+        return R.error();
+    }
+
+    /**
+     * 删除
+     */
+    @PostMapping("/batchRemove")
+    @ResponseBody
+    public R remove(@RequestParam("ids[]") String[] ids) {
+        if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+            return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+        }
+        salaryService.batchRemove(ids);
+        return R.ok();
+    }
+
+}

+ 107 - 0
src/main/java/com/bootdo/activiti/controller/TaskController.java

@@ -0,0 +1,107 @@
+package com.bootdo.activiti.controller;
+
+import com.bootdo.activiti.service.ActTaskService;
+import com.bootdo.activiti.vo.ProcessVO;
+import com.bootdo.activiti.vo.TaskVO;
+import com.bootdo.common.utils.PageUtils;
+import org.activiti.engine.FormService;
+import org.activiti.engine.RepositoryService;
+import org.activiti.engine.TaskService;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.task.Task;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+
+ */
+@RequestMapping("activiti/task")
+@RestController
+public class TaskController {
+    @Autowired
+    RepositoryService repositoryService;
+    @Autowired
+    FormService formService;
+    @Autowired
+    TaskService taskService;
+    @Autowired
+    ActTaskService actTaskService;
+    @GetMapping("goto")
+    public ModelAndView gotoTask(){
+        return new ModelAndView("act/task/gotoTask");
+    }
+
+    @GetMapping("/gotoList")
+    PageUtils list(int offset, int limit) {
+        List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
+                .listPage(offset, limit);
+        int count = (int) repositoryService.createProcessDefinitionQuery().count();
+        List<Object> list = new ArrayList<>();
+        for(ProcessDefinition processDefinition: processDefinitions){
+            list.add(new ProcessVO(processDefinition));
+        }
+
+        PageUtils pageUtils = new PageUtils(list, count);
+        return pageUtils;
+    }
+
+    @GetMapping("/form/{procDefId}")
+    public void startForm(@PathVariable("procDefId") String procDefId  ,HttpServletResponse response) throws IOException {
+        String formKey = actTaskService.getFormKey(procDefId, null);
+        response.sendRedirect(formKey);
+    }
+
+    @GetMapping("/form/{procDefId}/{taskId}")
+    public void form(@PathVariable("procDefId") String procDefId,@PathVariable("taskId") String taskId ,HttpServletResponse response) throws IOException {
+        // 获取流程XML上的表单KEY
+
+        String formKey = actTaskService.getFormKey(procDefId, taskId);
+
+
+        response.sendRedirect(formKey+"/"+taskId);
+    }
+
+    @GetMapping("/todo")
+    ModelAndView todo(){
+        return new ModelAndView("act/task/todoTask");
+    }
+
+    @GetMapping("/todoList")
+    List<TaskVO> todoList(){
+        List<Task> tasks = taskService.createTaskQuery().taskAssignee("admin").list();
+        List<TaskVO> taskVOS =  new ArrayList<>();
+        for(Task task : tasks){
+            TaskVO taskVO = new TaskVO(task);
+            taskVOS.add(taskVO);
+        }
+        return taskVOS;
+    }
+
+
+    /**
+     * 读取带跟踪的图片
+     */
+    @RequestMapping(value = "/trace/photo/{procDefId}/{execId}")
+    public void tracePhoto(@PathVariable("procDefId") String procDefId, @PathVariable("execId") String execId, HttpServletResponse response) throws Exception {
+        InputStream imageStream = actTaskService.tracePhoto(procDefId, execId);
+
+        // 输出资源内容到相应对象
+        byte[] b = new byte[1024];
+        int len;
+        while ((len = imageStream.read(b, 0, 1024)) != -1) {
+            response.getOutputStream().write(b, 0, len);
+        }
+    }
+
+
+}

+ 31 - 0
src/main/java/com/bootdo/activiti/dao/SalaryDao.java

@@ -0,0 +1,31 @@
+package com.bootdo.activiti.dao;
+
+import com.bootdo.activiti.domain.SalaryDO;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 审批流程测试表
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-11-25 13:28:58
+ */
+@Mapper
+public interface SalaryDao {
+
+	SalaryDO get(String id);
+	
+	List<SalaryDO> list(Map<String, Object> map);
+	
+	int count(Map<String, Object> map);
+	
+	int save(SalaryDO salary);
+	
+	int update(SalaryDO salary);
+	
+	int remove(String id);
+	
+	int batchRemove(String[] ids);
+}

+ 251 - 0
src/main/java/com/bootdo/activiti/domain/ActivitiDO.java

@@ -0,0 +1,251 @@
+package com.bootdo.activiti.domain;
+
+import org.activiti.engine.history.HistoricActivityInstance;
+import org.activiti.engine.history.HistoricTaskInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ *
+ */
+public class ActivitiDO {
+    private String taskId; 		// 任务编号
+    private String taskName; 	// 任务名称
+    private String taskDefKey; 	// 任务定义Key(任务环节标识)
+
+    private String procInsId; 	// 流程实例ID
+    private String procDefId; 	// 流程定义ID
+    private String procDefKey; 	// 流程定义Key(流程定义标识)
+
+    private String businessTable;	// 业务绑定Table
+    private String businessId;		// 业务绑定ID
+
+    private String title; 		// 任务标题
+
+    private String status; 		// 任务状态(todo/claim/finish)
+
+    private String procExecUrl; 	// 流程执行(办理)RUL
+    private String comment; 	// 任务意见
+    private String flag; 		// 意见状态
+
+    private Task task; 			// 任务对象
+    private ProcessDefinition procDef; 	// 流程定义对象
+    private ProcessInstance procIns;	// 流程实例对象
+    private HistoricTaskInstance histTask; // 历史任务
+    private HistoricActivityInstance histIns;	//历史活动任务
+
+    private String assignee; // 任务执行人编号
+    private String assigneeName; // 任务执行人名称
+
+    private Variable vars; 		// 流程变量
+    private Variable taskVars; 	// 流程任务变量
+
+    private Date beginDate;	// 开始查询日期
+    private Date endDate;	// 结束查询日期
+
+    private List<ActivitiDO> list; // 任务列表
+
+    public String getTaskId() {
+        return taskId;
+    }
+
+    public void setTaskId(String taskId) {
+        this.taskId = taskId;
+    }
+
+    public String getTaskName() {
+        return taskName;
+    }
+
+    public void setTaskName(String taskName) {
+        this.taskName = taskName;
+    }
+
+    public String getTaskDefKey() {
+        return taskDefKey;
+    }
+
+    public void setTaskDefKey(String taskDefKey) {
+        this.taskDefKey = taskDefKey;
+    }
+
+    public String getProcInsId() {
+        return procInsId;
+    }
+
+    public void setProcInsId(String procInsId) {
+        this.procInsId = procInsId;
+    }
+
+    public String getProcDefId() {
+        return procDefId;
+    }
+
+    public void setProcDefId(String procDefId) {
+        this.procDefId = procDefId;
+    }
+
+    public String getProcDefKey() {
+        return procDefKey;
+    }
+
+    public void setProcDefKey(String procDefKey) {
+        this.procDefKey = procDefKey;
+    }
+
+    public String getBusinessTable() {
+        return businessTable;
+    }
+
+    public void setBusinessTable(String businessTable) {
+        this.businessTable = businessTable;
+    }
+
+    public String getBusinessId() {
+        return businessId;
+    }
+
+    public void setBusinessId(String businessId) {
+        this.businessId = businessId;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getProcExecUrl() {
+        return procExecUrl;
+    }
+
+    public void setProcExecUrl(String procExecUrl) {
+        this.procExecUrl = procExecUrl;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+
+    public String getFlag() {
+        return flag;
+    }
+
+    public void setFlag(String flag) {
+        this.flag = flag;
+    }
+
+    public Task getTask() {
+        return task;
+    }
+
+    public void setTask(Task task) {
+        this.task = task;
+    }
+
+    public ProcessDefinition getProcDef() {
+        return procDef;
+    }
+
+    public void setProcDef(ProcessDefinition procDef) {
+        this.procDef = procDef;
+    }
+
+    public ProcessInstance getProcIns() {
+        return procIns;
+    }
+
+    public void setProcIns(ProcessInstance procIns) {
+        this.procIns = procIns;
+    }
+
+    public HistoricTaskInstance getHistTask() {
+        return histTask;
+    }
+
+    public void setHistTask(HistoricTaskInstance histTask) {
+        this.histTask = histTask;
+    }
+
+    public HistoricActivityInstance getHistIns() {
+        return histIns;
+    }
+
+    public void setHistIns(HistoricActivityInstance histIns) {
+        this.histIns = histIns;
+    }
+
+    public String getAssignee() {
+        return assignee;
+    }
+
+    public void setAssignee(String assignee) {
+        this.assignee = assignee;
+    }
+
+    public String getAssigneeName() {
+        return assigneeName;
+    }
+
+    public void setAssigneeName(String assigneeName) {
+        this.assigneeName = assigneeName;
+    }
+
+    public Variable getVars() {
+        return vars;
+    }
+
+    public void setVars(Variable vars) {
+        this.vars = vars;
+    }
+
+    public Variable getTaskVars() {
+        return taskVars;
+    }
+
+    public void setTaskVars(Variable taskVars) {
+        this.taskVars = taskVars;
+    }
+
+    public Date getBeginDate() {
+        return beginDate;
+    }
+
+    public void setBeginDate(Date beginDate) {
+        this.beginDate = beginDate;
+    }
+
+    public Date getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(Date endDate) {
+        this.endDate = endDate;
+    }
+
+    public List<ActivitiDO> getList() {
+        return list;
+    }
+
+    public void setList(List<ActivitiDO> list) {
+        this.list = list;
+    }
+}

+ 373 - 0
src/main/java/com/bootdo/activiti/domain/SalaryDO.java

@@ -0,0 +1,373 @@
+package com.bootdo.activiti.domain;
+
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+
+/**
+ * 审批流程测试表
+ * 
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-11-25 13:28:58
+ */
+public class SalaryDO extends  TaskDO implements Serializable  {
+	private static final long serialVersionUID = 1L;
+	
+	//编号
+	private String id;
+	//流程实例ID
+	private String procInsId;
+	//变动用户
+	private String userId;
+	//归属部门
+	private String officeId;
+	//岗位
+	private String post;
+	//性别
+	private String age;
+	//学历
+	private String edu;
+	//调整原因
+	private String content;
+	//现行标准 薪酬档级
+	private String olda;
+	//现行标准 月工资额
+	private String oldb;
+	//现行标准 年薪总额
+	private String oldc;
+	//调整后标准 薪酬档级
+	private String newa;
+	//调整后标准 月工资额
+	private String newb;
+	//调整后标准 年薪总额
+	private String newc;
+	//月增资
+	private String addNum;
+	//执行时间
+	private String exeDate;
+	//人力资源部门意见
+	private String hrText;
+	//分管领导意见
+	private String leadText;
+	//集团主要领导意见
+	private String mainLeadText;
+	//创建者
+	private String createBy;
+	//创建时间
+	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	private Date createDate;
+	//更新者
+	private String updateBy;
+	//更新时间
+	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	private Date updateDate;
+	//备注信息
+	private String remarks;
+	//删除标记
+	private String delFlag;
+
+	/**
+	 * 设置:编号
+	 */
+	public void setId(String id) {
+		this.id = id;
+	}
+	/**
+	 * 获取:编号
+	 */
+	public String getId() {
+		return id;
+	}
+	/**
+	 * 设置:流程实例ID
+	 */
+	public void setProcInsId(String procInsId) {
+		this.procInsId = procInsId;
+	}
+	/**
+	 * 获取:流程实例ID
+	 */
+	public String getProcInsId() {
+		return procInsId;
+	}
+	/**
+	 * 设置:变动用户
+	 */
+	public void setUserId(String userId) {
+		this.userId = userId;
+	}
+	/**
+	 * 获取:变动用户
+	 */
+	public String getUserId() {
+		return userId;
+	}
+	/**
+	 * 设置:归属部门
+	 */
+	public void setOfficeId(String officeId) {
+		this.officeId = officeId;
+	}
+	/**
+	 * 获取:归属部门
+	 */
+	public String getOfficeId() {
+		return officeId;
+	}
+	/**
+	 * 设置:岗位
+	 */
+	public void setPost(String post) {
+		this.post = post;
+	}
+	/**
+	 * 获取:岗位
+	 */
+	public String getPost() {
+		return post;
+	}
+	/**
+	 * 设置:性别
+	 */
+	public void setAge(String age) {
+		this.age = age;
+	}
+	/**
+	 * 获取:性别
+	 */
+	public String getAge() {
+		return age;
+	}
+	/**
+	 * 设置:学历
+	 */
+	public void setEdu(String edu) {
+		this.edu = edu;
+	}
+	/**
+	 * 获取:学历
+	 */
+	public String getEdu() {
+		return edu;
+	}
+	/**
+	 * 设置:调整原因
+	 */
+	public void setContent(String content) {
+		this.content = content;
+	}
+	/**
+	 * 获取:调整原因
+	 */
+	public String getContent() {
+		return content;
+	}
+	/**
+	 * 设置:现行标准 薪酬档级
+	 */
+	public void setOlda(String olda) {
+		this.olda = olda;
+	}
+	/**
+	 * 获取:现行标准 薪酬档级
+	 */
+	public String getOlda() {
+		return olda;
+	}
+	/**
+	 * 设置:现行标准 月工资额
+	 */
+	public void setOldb(String oldb) {
+		this.oldb = oldb;
+	}
+	/**
+	 * 获取:现行标准 月工资额
+	 */
+	public String getOldb() {
+		return oldb;
+	}
+	/**
+	 * 设置:现行标准 年薪总额
+	 */
+	public void setOldc(String oldc) {
+		this.oldc = oldc;
+	}
+	/**
+	 * 获取:现行标准 年薪总额
+	 */
+	public String getOldc() {
+		return oldc;
+	}
+	/**
+	 * 设置:调整后标准 薪酬档级
+	 */
+	public void setNewa(String newa) {
+		this.newa = newa;
+	}
+	/**
+	 * 获取:调整后标准 薪酬档级
+	 */
+	public String getNewa() {
+		return newa;
+	}
+	/**
+	 * 设置:调整后标准 月工资额
+	 */
+	public void setNewb(String newb) {
+		this.newb = newb;
+	}
+	/**
+	 * 获取:调整后标准 月工资额
+	 */
+	public String getNewb() {
+		return newb;
+	}
+	/**
+	 * 设置:调整后标准 年薪总额
+	 */
+	public void setNewc(String newc) {
+		this.newc = newc;
+	}
+	/**
+	 * 获取:调整后标准 年薪总额
+	 */
+	public String getNewc() {
+		return newc;
+	}
+	/**
+	 * 设置:月增资
+	 */
+	public void setAddNum(String addNum) {
+		this.addNum = addNum;
+	}
+	/**
+	 * 获取:月增资
+	 */
+	public String getAddNum() {
+		return addNum;
+	}
+	/**
+	 * 设置:执行时间
+	 */
+	public void setExeDate(String exeDate) {
+		this.exeDate = exeDate;
+	}
+	/**
+	 * 获取:执行时间
+	 */
+	public String getExeDate() {
+		return exeDate;
+	}
+	/**
+	 * 设置:人力资源部门意见
+	 */
+	public void setHrText(String hrText) {
+		this.hrText = hrText;
+	}
+	/**
+	 * 获取:人力资源部门意见
+	 */
+	public String getHrText() {
+		return hrText;
+	}
+	/**
+	 * 设置:分管领导意见
+	 */
+	public void setLeadText(String leadText) {
+		this.leadText = leadText;
+	}
+	/**
+	 * 获取:分管领导意见
+	 */
+	public String getLeadText() {
+		return leadText;
+	}
+	/**
+	 * 设置:集团主要领导意见
+	 */
+	public void setMainLeadText(String mainLeadText) {
+		this.mainLeadText = mainLeadText;
+	}
+	/**
+	 * 获取:集团主要领导意见
+	 */
+	public String getMainLeadText() {
+		return mainLeadText;
+	}
+	/**
+	 * 设置:创建者
+	 */
+	public void setCreateBy(String createBy) {
+		this.createBy = createBy;
+	}
+	/**
+	 * 获取:创建者
+	 */
+	public String getCreateBy() {
+		return createBy;
+	}
+	/**
+	 * 设置:创建时间
+	 */
+	public void setCreateDate(Date createDate) {
+		this.createDate = createDate;
+	}
+	/**
+	 * 获取:创建时间
+	 */
+	public Date getCreateDate() {
+		return createDate;
+	}
+	/**
+	 * 设置:更新者
+	 */
+	public void setUpdateBy(String updateBy) {
+		this.updateBy = updateBy;
+	}
+	/**
+	 * 获取:更新者
+	 */
+	public String getUpdateBy() {
+		return updateBy;
+	}
+	/**
+	 * 设置:更新时间
+	 */
+	public void setUpdateDate(Date updateDate) {
+		this.updateDate = updateDate;
+	}
+	/**
+	 * 获取:更新时间
+	 */
+	public Date getUpdateDate() {
+		return updateDate;
+	}
+	/**
+	 * 设置:备注信息
+	 */
+	public void setRemarks(String remarks) {
+		this.remarks = remarks;
+	}
+	/**
+	 * 获取:备注信息
+	 */
+	public String getRemarks() {
+		return remarks;
+	}
+	/**
+	 * 设置:删除标记
+	 */
+	public void setDelFlag(String delFlag) {
+		this.delFlag = delFlag;
+	}
+	/**
+	 * 获取:删除标记
+	 */
+	public String getDelFlag() {
+		return delFlag;
+	}
+}

+ 47 - 0
src/main/java/com/bootdo/activiti/domain/TaskDO.java

@@ -0,0 +1,47 @@
+package com.bootdo.activiti.domain;
+
+import java.util.Map;
+
+/**
+ * @author bootdo 1992lcg@163.com
+ */
+public class TaskDO {
+    private  String taskId;
+    private String taskComment;
+    private String taskPass;
+    private Map<String,Object> vars;
+
+    public String getTaskId() {
+        return taskId;
+    }
+
+    public void setTaskId(String taskId) {
+        this.taskId = taskId;
+    }
+
+    public String getTaskComment() {
+        return taskComment;
+    }
+
+    public void setTaskComment(String taskComment) {
+        this.taskComment = taskComment;
+    }
+
+    public String getTaskPass() {
+        return taskPass;
+    }
+
+    public void setTaskPass(String taskPass) {
+        this.taskPass = taskPass;
+    }
+
+    public Map<String, Object> getVars() {
+        return vars;
+    }
+
+    public void setVars(Map<String, Object> vars) {
+        this.vars = vars;
+    }
+
+
+}

+ 35 - 0
src/main/java/com/bootdo/activiti/domain/Variable.java

@@ -0,0 +1,35 @@
+package com.bootdo.activiti.domain;
+
+
+/**
+ */
+public class Variable {
+
+    private String keys;
+    private String values;
+    private String types;
+
+    public String getKeys() {
+        return keys;
+    }
+
+    public void setKeys(String keys) {
+        this.keys = keys;
+    }
+
+    public String getValues() {
+        return values;
+    }
+
+    public void setValues(String values) {
+        this.values = values;
+    }
+
+    public String getTypes() {
+        return types;
+    }
+
+    public void setTypes(String types) {
+        this.types = types;
+    }
+}

+ 23 - 0
src/main/java/com/bootdo/activiti/service/ActTaskService.java

@@ -0,0 +1,23 @@
+package com.bootdo.activiti.service;
+
+import com.bootdo.activiti.domain.ActivitiDO;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
+
+/**
+ */
+public interface ActTaskService {
+    List<ActivitiDO> listTodo(ActivitiDO act);
+
+    void complete(String taskId, String procInsId, String comment, String title, Map<String, Object> vars);
+
+    void complete(String taskId,Map<String,Object> vars);
+
+    String startProcess(String procDefKey, String businessTable, String businessId, String title, Map<String, Object> vars);
+
+    String getFormKey(String procDefId, String taskDefKey);
+
+    InputStream tracePhoto(String processDefinitionId, String executionId);
+}

+ 16 - 0
src/main/java/com/bootdo/activiti/service/ProcessService.java

@@ -0,0 +1,16 @@
+package com.bootdo.activiti.service;
+
+import org.activiti.engine.repository.Model;
+import org.springframework.stereotype.Service;
+
+import java.io.InputStream;
+
+/**
+
+ */
+@Service
+public interface ProcessService {
+    Model convertToModel(String procDefId) throws Exception;
+
+    InputStream resourceRead(String id, String resType) throws Exception;
+}

+ 30 - 0
src/main/java/com/bootdo/activiti/service/SalaryService.java

@@ -0,0 +1,30 @@
+package com.bootdo.activiti.service;
+
+import com.bootdo.activiti.domain.SalaryDO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 审批流程测试表
+ * 
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-11-25 13:33:16
+ */
+public interface SalaryService {
+	
+	SalaryDO get(String id);
+	
+	List<SalaryDO> list(Map<String, Object> map);
+	
+	int count(Map<String, Object> map);
+	
+	int save(SalaryDO salary);
+	
+	int update(SalaryDO salary);
+	
+	int remove(String id);
+	
+	int batchRemove(String[] ids);
+}

+ 279 - 0
src/main/java/com/bootdo/activiti/service/impl/ActTaskServiceImpl.java

@@ -0,0 +1,279 @@
+package com.bootdo.activiti.service.impl;
+
+import com.bootdo.activiti.domain.ActivitiDO;
+import com.bootdo.activiti.service.ActTaskService;
+import com.bootdo.common.utils.ShiroUtils;
+import com.bootdo.common.utils.StringUtils;
+import org.activiti.bpmn.model.BpmnModel;
+import org.activiti.engine.*;
+import org.activiti.engine.history.HistoricActivityInstance;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.impl.RepositoryServiceImpl;
+import org.activiti.engine.impl.context.Context;
+import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
+import org.activiti.engine.impl.pvm.PvmTransition;
+import org.activiti.engine.impl.pvm.process.ActivityImpl;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+import org.activiti.image.ProcessDiagramGenerator;
+import org.activiti.spring.ProcessEngineFactoryBean;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ */
+@Service
+public class ActTaskServiceImpl implements ActTaskService {
+    @Autowired
+    TaskService taskService;
+    @Autowired
+    IdentityService identityService;
+    @Autowired
+    RuntimeService runtimeService;
+    @Autowired
+    FormService formService;
+
+    @Autowired
+    RepositoryService repositoryService;
+
+    @Autowired
+    private ProcessEngineFactoryBean processEngineFactory;
+
+    @Autowired
+    private ProcessEngine processEngine;
+
+    @Autowired
+    private HistoryService historyService;
+
+    @Override
+    public List<ActivitiDO> listTodo(ActivitiDO act) {
+        String userId = String.valueOf(ShiroUtils.getUserId());
+        List<ActivitiDO> result = new ArrayList<ActivitiDO>();
+        return result;
+    }
+
+    /**
+     * 提交任务, 并保存意见
+     *
+     * @param taskId    任务ID
+     * @param procInsId 流程实例ID,如果为空,则不保存任务提交意见
+     * @param comment   任务提交意见的内容
+     * @param title     流程标题,显示在待办任务标题
+     * @param vars      任务变量
+     */
+    @Override
+    public void complete(String taskId, String procInsId, String comment, String title, Map<String, Object> vars) {
+        // 添加意见
+        if (StringUtils.isNotBlank(procInsId) && StringUtils.isNotBlank(comment)) {
+            taskService.addComment(taskId, procInsId, comment);
+        }
+
+        // 设置流程变量
+        if (vars == null) {
+            vars = new HashMap<>();
+        }
+
+        // 设置流程标题
+        if (StringUtils.isNotBlank(title)) {
+            vars.put("title", title);
+        }
+
+        // 提交任务
+        taskService.complete(taskId, vars);
+    }
+
+    @Override
+    public void complete(String taskId, Map<String, Object> vars) {
+        // 2.1根据人物ID查询流程实力ID
+        Task task = taskService.createTaskQuery()
+                .taskId(taskId).singleResult();
+        // 获取流程实例ID
+        String processInstance = task.getProcessInstanceId();
+        // 2.2根据流程实例ID,人物ID,评论的消息,保存教师或者学术对与该学生申请的评论信息
+//        taskService.addComment(taskId,
+//                processInstance, "");
+//        Map<String,Object> vars = new HashMap<>();
+//        vars.put("pass",  "1" );
+//        vars.put("title","");
+        taskService.complete(taskId, vars);
+    }
+
+    /**
+     * 启动流程
+     *
+     * @param procDefKey    流程定义KEY
+     * @param businessTable 业务表表名
+     * @param businessId    业务表编号
+     * @param title         流程标题,显示在待办任务标题
+     * @param vars          流程变量
+     * @return 流程实例ID
+     */
+    @Override
+    public String startProcess(String procDefKey, String businessTable, String businessId, String title, Map<String, Object> vars) {
+        String userId = ShiroUtils.getUser().getUsername();//ObjectUtils.toString(UserUtils.getUser().getId())
+
+        // 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
+        identityService.setAuthenticatedUserId(userId);
+
+        // 设置流程变量
+        if (vars == null) {
+            vars = new HashMap();
+        }
+
+        // 设置流程标题
+        if (StringUtils.isNotBlank(title)) {
+            vars.put("title", title);
+        }
+
+        // 启动流程
+        ProcessInstance procIns = runtimeService.startProcessInstanceByKey(procDefKey, businessId, vars);
+
+        return null;
+    }
+
+    /**
+     * 获取流程表单(首先获取任务节点表单KEY,如果没有则取流程开始节点表单KEY)
+     *
+     * @return
+     */
+    @Override
+    public String getFormKey(String procDefId, String taskDefKey) {
+        String formKey = "";
+        if (StringUtils.isNotBlank(procDefId)) {
+            if (StringUtils.isNotBlank(taskDefKey)) {
+                try {
+                    formKey = formService.getTaskFormKey(procDefId, taskDefKey);
+                } catch (Exception e) {
+                    formKey = "";
+                }
+            }
+            if (StringUtils.isBlank(formKey)) {
+                formKey = formService.getStartFormKey(procDefId);
+            }
+            if (StringUtils.isBlank(formKey)) {
+                formKey = "/404";
+            }
+        }
+        return formKey;
+    }
+
+    @Override
+    public InputStream tracePhoto(String xx, String pProcessInstanceId) {
+////		ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(executionId).singleResult();
+//        BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
+//
+//        List<String> activeActivityIds = new ArrayList();
+//        if (runtimeService.createExecutionQuery().executionId(executionId).count() > 0){
+//            activeActivityIds = runtimeService.getActiveActivityIds(executionId);
+//        }
+//
+//        // 不使用spring请使用下面的两行代码
+//        // ProcessEngineImpl defaultProcessEngine = (ProcessEngineImpl)ProcessEngines.getDefaultProcessEngine();
+//        // Context.setProcessEngineConfiguration(defaultProcessEngine.getProcessEngineConfiguration());
+//
+//        // 使用spring注入引擎请使用下面的这行代码
+//        Context.setProcessEngineConfiguration(processEngineFactory.getProcessEngineConfiguration());
+////		return ProcessDiagramGenerator.generateDiagram(bpmnModel, "png", activeActivityIds);
+//        return processEngine.getProcessEngineConfiguration().getProcessDiagramGenerator()
+//                .generateDiagram(bpmnModel, "png", activeActivityIds);
+
+        //  获取历史流程实例
+        HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
+                .processInstanceId(pProcessInstanceId).singleResult();
+
+        if (historicProcessInstance != null) {
+            // 获取流程定义
+            ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
+                    .getDeployedProcessDefinition(historicProcessInstance.getProcessDefinitionId());
+
+            // 获取流程历史中已执行节点,并按照节点在流程中执行先后顺序排序
+            List<HistoricActivityInstance> historicActivityInstanceList = historyService.createHistoricActivityInstanceQuery()
+                    .processInstanceId(pProcessInstanceId).orderByHistoricActivityInstanceId().asc().list();
+
+            // 已执行的节点ID集合
+            List<String> executedActivityIdList = new ArrayList<String>();
+            int index = 1;
+            //获取已经执行的节点ID
+            for (HistoricActivityInstance activityInstance : historicActivityInstanceList) {
+                executedActivityIdList.add(activityInstance.getActivityId());
+                index++;
+            }
+
+            // 已执行的线集合
+            List<String> flowIds = new ArrayList<String>();
+            // 获取流程走过的线
+            flowIds = getHighLightedFlows(processDefinition, historicActivityInstanceList);
+
+
+            BpmnModel bpmnModel = repositoryService
+                    .getBpmnModel(historicProcessInstance.getProcessDefinitionId());
+            // 获取流程图图像字符流
+            ProcessDiagramGenerator pec = processEngine.getProcessEngineConfiguration().getProcessDiagramGenerator();
+            //配置字体
+
+            InputStream imageStream = pec.generateDiagram(bpmnModel, "png", executedActivityIdList, flowIds, "宋体", "微软雅黑", "黑体", null, 2.0);
+            return imageStream;
+        }
+        return null;
+    }
+
+
+    /**
+     * 获取需要高亮的线
+     * @param processDefinitionEntity
+     * @param historicActivityInstances
+     * @return
+     */
+    private List<String> getHighLightedFlows(
+            ProcessDefinitionEntity processDefinitionEntity,
+            List<HistoricActivityInstance> historicActivityInstances) {
+        List<String> highFlows = new ArrayList<String>();// 用以保存高亮的线flowId
+        for (int i = 0; i < historicActivityInstances.size() - 1; i++) {// 对历史流程节点进行遍历
+            ActivityImpl activityImpl = processDefinitionEntity
+                    .findActivity(historicActivityInstances.get(i)
+                            .getActivityId());// 得到节点定义的详细信息
+            List<ActivityImpl> sameStartTimeNodes = new ArrayList<ActivityImpl>();// 用以保存后需开始时间相同的节点
+            ActivityImpl sameActivityImpl1 = processDefinitionEntity
+                    .findActivity(historicActivityInstances.get(i + 1)
+                            .getActivityId());
+            // 将后面第一个节点放在时间相同节点的集合里
+            sameStartTimeNodes.add(sameActivityImpl1);
+            for (int j = i + 1; j < historicActivityInstances.size() - 1; j++) {
+                HistoricActivityInstance activityImpl1 = historicActivityInstances
+                        .get(j);// 后续第一个节点
+                HistoricActivityInstance activityImpl2 = historicActivityInstances
+                        .get(j + 1);// 后续第二个节点
+                if (activityImpl1.getStartTime().equals(
+                        activityImpl2.getStartTime())) {
+                    // 如果第一个节点和第二个节点开始时间相同保存
+                    ActivityImpl sameActivityImpl2 = processDefinitionEntity
+                            .findActivity(activityImpl2.getActivityId());
+                    sameStartTimeNodes.add(sameActivityImpl2);
+                } else {
+                    // 有不相同跳出循环
+                    break;
+                }
+            }
+            List<PvmTransition> pvmTransitions = activityImpl
+                    .getOutgoingTransitions();// 取出节点的所有出去的线
+            for (PvmTransition pvmTransition : pvmTransitions) {
+                // 对所有的线进行遍历
+                ActivityImpl pvmActivityImpl = (ActivityImpl) pvmTransition
+                        .getDestination();
+                // 如果取出的线的目标节点存在时间相同的节点里,保存该线的id,进行高亮显示
+                if (sameStartTimeNodes.contains(pvmActivityImpl)) {
+                    highFlows.add(pvmTransition.getId());
+                }
+            }
+        }
+        return highFlows;
+    }
+
+}
+

+ 82 - 0
src/main/java/com/bootdo/activiti/service/impl/ProcessServiceImpl.java

@@ -0,0 +1,82 @@
+package com.bootdo.activiti.service.impl;
+
+import com.bootdo.activiti.service.ProcessService;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.activiti.bpmn.converter.BpmnXMLConverter;
+import org.activiti.bpmn.model.BpmnModel;
+import org.activiti.editor.constants.ModelDataJsonConstants;
+import org.activiti.editor.language.json.converter.BpmnJsonConverter;
+import org.activiti.engine.RepositoryService;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.repository.Model;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+/**
+
+ */
+@Service
+public class ProcessServiceImpl implements ProcessService {
+    @Autowired
+    RepositoryService repositoryService;
+    @Autowired
+    RuntimeService runtimeService;
+
+    @Override
+    public Model convertToModel(String procDefId) throws Exception {
+
+        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId).singleResult();
+        InputStream bpmnStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(),
+                processDefinition.getResourceName());
+        XMLInputFactory xif = XMLInputFactory.newInstance();
+        InputStreamReader in = new InputStreamReader(bpmnStream, "UTF-8");
+        XMLStreamReader xtr = xif.createXMLStreamReader(in);
+        BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);
+
+        BpmnJsonConverter converter = new BpmnJsonConverter();
+        ObjectNode modelNode = converter.convertToJson(bpmnModel);
+        org.activiti.engine.repository.Model modelData = repositoryService.newModel();
+        modelData.setKey(processDefinition.getKey());
+        modelData.setName(processDefinition.getResourceName());
+        modelData.setCategory(processDefinition.getCategory());//.getDeploymentId());
+        modelData.setDeploymentId(processDefinition.getDeploymentId());
+        modelData.setVersion(Integer.parseInt(String.valueOf(repositoryService.createModelQuery().modelKey(modelData.getKey()).count() + 1)));
+
+        ObjectNode modelObjectNode = new ObjectMapper().createObjectNode();
+        modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, processDefinition.getName());
+        modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, modelData.getVersion());
+        modelObjectNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, processDefinition.getDescription());
+        modelData.setMetaInfo(modelObjectNode.toString());
+
+        repositoryService.saveModel(modelData);
+
+        repositoryService.addModelEditorSource(modelData.getId(), modelNode.toString().getBytes("utf-8"));
+
+        return modelData;
+    }
+
+    @Override
+    public InputStream resourceRead(String id, String resType) throws Exception {
+
+
+        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult();
+
+
+        String resourceName = "";
+        if (resType.equals("image")) {
+            resourceName = processDefinition.getDiagramResourceName();
+        } else if (resType.equals("xml")) {
+            resourceName = processDefinition.getResourceName();
+        }
+
+        InputStream resourceAsStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), resourceName);
+        return resourceAsStream;
+    }
+}

+ 69 - 0
src/main/java/com/bootdo/activiti/service/impl/SalaryServiceImpl.java

@@ -0,0 +1,69 @@
+package com.bootdo.activiti.service.impl;
+
+import com.bootdo.activiti.config.ActivitiConstant;
+import com.bootdo.common.utils.StringUtils;
+import org.activiti.engine.TaskService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import com.bootdo.activiti.dao.SalaryDao;
+import com.bootdo.activiti.domain.SalaryDO;
+import com.bootdo.activiti.service.SalaryService;
+import org.springframework.transaction.annotation.Transactional;
+
+
+@Service
+public class SalaryServiceImpl implements SalaryService {
+	@Autowired
+	private SalaryDao salaryDao;
+	@Autowired
+	private ActTaskServiceImpl actTaskService;
+	
+	@Override
+	public SalaryDO get(String id){
+		return salaryDao.get(id);
+	}
+	
+	@Override
+	public List<SalaryDO> list(Map<String, Object> map){
+		return salaryDao.list(map);
+	}
+	
+	@Override
+	public int count(Map<String, Object> map){
+		return salaryDao.count(map);
+	}
+
+	@Transactional(rollbackFor=Exception.class)
+	@Override
+	public int save(SalaryDO salary){
+			salary.setId(UUID.randomUUID().toString().replace("-",""));
+			actTaskService.startProcess(ActivitiConstant.ACTIVITI_SALARY[0],ActivitiConstant.ACTIVITI_SALARY[1],salary.getId(),salary.getContent(),new HashMap<>());
+			return salaryDao.save(salary);
+	}
+	@Transactional(rollbackFor=Exception.class)
+	@Override
+	public int update(SalaryDO salary){
+		Map<String,Object> vars = new HashMap<>(16);
+		vars.put("pass",  salary.getTaskPass() );
+		vars.put("title","");
+		actTaskService.complete(salary.getTaskId(),vars);
+		return salaryDao.update(salary);
+	}
+	
+	@Override
+	public int remove(String id){
+		return salaryDao.remove(id);
+	}
+	
+	@Override
+	public int batchRemove(String[] ids){
+		return salaryDao.batchRemove(ids);
+	}
+	
+}

+ 41 - 0
src/main/java/com/bootdo/activiti/utils/ActivitiUtils.java

@@ -0,0 +1,41 @@
+package com.bootdo.activiti.utils;
+
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.TaskService;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+
+ */
+@Component
+public class ActivitiUtils {
+    /**
+     * 根据taskId查找businessKey
+     */
+    @Autowired
+    TaskService taskService;
+    @Autowired
+    RuntimeService runtimeService;
+    public String getBusinessKeyByTaskId(String taskId){
+        Task task = taskService
+                .createTaskQuery()
+                .taskId(taskId)
+                .singleResult();
+        ProcessInstance pi = runtimeService
+                .createProcessInstanceQuery()
+                .processInstanceId(task.getProcessInstanceId())
+                .singleResult();
+        return pi.getBusinessKey();
+    }
+
+    public Task getTaskByTaskId(String taskId){
+        Task task = taskService
+                .createTaskQuery()
+                .taskId(taskId)
+                .singleResult();
+        return task;
+    }
+}

+ 56 - 0
src/main/java/com/bootdo/activiti/vo/DeploymentResponse.java

@@ -0,0 +1,56 @@
+package com.bootdo.activiti.vo;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import org.activiti.engine.repository.Deployment;
+import org.activiti.rest.common.util.DateToStringSerializer;
+
+import java.util.Date;
+
+public class DeploymentResponse {
+
+  private String id;
+  private String name;
+  @JsonSerialize(using = DateToStringSerializer.class, as=Date.class)
+  private Date deploymentTime;
+  private String category;
+  private String tenantId;
+  
+  public DeploymentResponse(Deployment deployment) {
+    setId(deployment.getId());
+    setName(deployment.getName());
+    setDeploymentTime(deployment.getDeploymentTime());
+    setCategory(deployment.getCategory());
+    setTenantId(deployment.getTenantId());
+  }
+  
+  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  Date getDeploymentTime() {
+    return deploymentTime;
+  }
+  public void setDeploymentTime( Date deploymentTime) {
+    this.deploymentTime = deploymentTime;
+  }
+  public String getCategory() {
+    return category;
+  }
+  public void setCategory(String category) {
+    this.category = category;
+  }
+  public void setTenantId(String tenantId) {
+      this.tenantId = tenantId;
+  }
+  public String getTenantId() {
+	  return tenantId;
+  }
+}

+ 45 - 0
src/main/java/com/bootdo/activiti/vo/ProcessVO.java

@@ -0,0 +1,45 @@
+package com.bootdo.activiti.vo;
+
+import org.activiti.engine.repository.Deployment;
+import org.activiti.engine.repository.ProcessDefinition;
+
+public class ProcessVO {
+    private String id;
+    private String name;
+    private String deploymentId;
+
+    public ProcessVO(Deployment processDefinition) {
+        this.setId(processDefinition.getId());
+        this.name = processDefinition.getName();
+    }
+
+    public ProcessVO(ProcessDefinition processDefinition) {
+        this.setId(processDefinition.getId());
+        this.name = processDefinition.getName();
+        this.deploymentId = processDefinition.getDeploymentId();
+    }
+
+    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 getDeploymentId() {
+        return deploymentId;
+    }
+
+    public void setDeploymentId(String deploymentId) {
+        this.deploymentId = deploymentId;
+    }
+}

+ 103 - 0
src/main/java/com/bootdo/activiti/vo/TaskVO.java

@@ -0,0 +1,103 @@
+package com.bootdo.activiti.vo;
+
+import org.activiti.engine.task.Task;
+
+/**
+
+ */
+public class TaskVO  {
+
+    public TaskVO(Task task){
+
+        this.setId(task.getId());
+        this.setKey(task.getTaskDefinitionKey());
+        this.setName(task.getName());
+        this.setDescription(task.getDescription());
+        this.setAssignee(task.getAssignee());
+        this.setFormKey(task.getFormKey());
+        this.setProcessId(task.getProcessInstanceId());
+        this.setProcessDefinitionId(task.getProcessDefinitionId());
+        this.setExecutionId(task.getExecutionId());
+    }
+    private  String id;
+    private String name;
+    private String key;
+    private String description;
+    private  String formKey;
+    private  String assignee;
+    private String processId;
+    private String processDefinitionId;
+    private String executionId;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getKey() {
+        return key;
+    }
+
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    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;
+    }
+
+    public String getFormKey() {
+        return formKey;
+    }
+
+    public void setFormKey(String formKey) {
+        this.formKey = formKey;
+    }
+
+    public String getAssignee() {
+        return assignee;
+    }
+
+    public void setAssignee(String assignee) {
+        this.assignee = assignee;
+    }
+
+    public String getProcessId() {
+        return processId;
+    }
+
+    public void setProcessId(String processId) {
+        this.processId = processId;
+    }
+
+    public String getProcessDefinitionId() {
+        return processDefinitionId;
+    }
+
+    public void setProcessDefinitionId(String processDefinitionId) {
+        this.processDefinitionId = processDefinitionId;
+    }
+
+    public String getExecutionId() {
+        return executionId;
+    }
+
+    public void setExecutionId(String executionId) {
+        this.executionId = executionId;
+    }
+}

+ 59 - 0
src/main/java/com/bootdo/blog/controller/BlogController.java

@@ -0,0 +1,59 @@
+package com.bootdo.blog.controller;
+
+import com.bootdo.blog.domain.ContentDO;
+import com.bootdo.blog.service.ContentService;
+import com.bootdo.common.utils.DateUtils;
+import com.bootdo.common.utils.PageUtils;
+import com.bootdo.common.utils.Query;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author bootdo 1992lcg@163.com
+ */
+@RequestMapping("/blog")
+@Controller
+public class BlogController {
+	@Autowired
+    private ContentService bContentService;
+
+	@GetMapping()
+	String blog() {
+		return "blog/index/main";
+	}
+
+	@ResponseBody
+	@GetMapping("/open/list")
+	public PageUtils opentList(@RequestParam Map<String, Object> params) {
+		Query query = new Query(params);
+		List<ContentDO> bContentList = bContentService.list(query);
+		int total = bContentService.count(query);
+		PageUtils pageUtils = new PageUtils(bContentList, total);
+		return pageUtils;
+	}
+
+	@GetMapping("/open/post/{cid}")
+	String post(@PathVariable("cid") Long cid, Model model) {
+		ContentDO bContentDO = bContentService.get(cid);
+		model.addAttribute("bContent", bContentDO);
+		model.addAttribute("gtmModified", DateUtils.format(bContentDO.getGtmModified()));
+		return "blog/index/post";
+	}
+	@GetMapping("/open/page/{categories}")
+	String about(@PathVariable("categories") String categories, Model model) {
+		Map<String, Object> map = new HashMap<>(16);
+		map.put("categories", categories);
+		ContentDO bContentDO =null;
+		if(bContentService.list(map).size()>0){
+			 bContentDO = bContentService.list(map).get(0);
+		}
+		model.addAttribute("bContent", bContentDO);
+		return "blog/index/post";
+	}
+}

+ 165 - 0
src/main/java/com/bootdo/blog/controller/ContentController.java

@@ -0,0 +1,165 @@
+package com.bootdo.blog.controller;
+
+import com.bootdo.blog.domain.ContentDO;
+import com.bootdo.blog.service.ContentService;
+import com.bootdo.common.annotation.Log;
+import com.bootdo.common.config.Constant;
+import com.bootdo.common.controller.BaseController;
+import com.bootdo.common.utils.PageUtils;
+import com.bootdo.common.utils.Query;
+import com.bootdo.common.utils.R;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 文章内容
+ * 
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-09-09 10:03:34
+ */
+@Controller
+@RequestMapping("/blog/bContent")
+public class ContentController extends BaseController {
+	@Autowired
+	ContentService bContentService;
+
+	@Log("访问门户信息")
+	@GetMapping()
+	@RequiresPermissions("blog:bContent:bContent")
+	String bContent() {
+		return "blog/bContent/bContent";
+	}
+
+	@Log("访问门户轮播信息")
+	@GetMapping("/carousel")
+	@RequiresPermissions("blog:bContent:carousel")
+	String bContent2() {
+		return "blog/bContent2/bContent";
+	}
+
+	@ResponseBody
+	@GetMapping("/list")
+	@RequiresPermissions(value = {"blog:bContent:bContent", "blog:bContent:carousel"}, logical = Logical.OR)
+	public PageUtils list(@RequestParam Map<String, Object> params) {
+		Query query = new Query(params);
+		List<ContentDO> bContentList = bContentService.list(query);
+		int total = bContentService.count(query);
+		PageUtils pageUtils = new PageUtils(bContentList, total);
+		return pageUtils;
+	}
+
+	@GetMapping("/add")
+	@RequiresPermissions("blog:bContent:add")
+	String add() {
+		return "blog/bContent/add";
+	}
+
+	@GetMapping("/carousel/add")
+	@RequiresPermissions("blog:carousel:add")
+	String add2() {
+		return "blog/bContent2/add";
+	}
+
+	@GetMapping("/edit/{cid}")
+	@RequiresPermissions("blog:bContent:edit")
+	String edit(@PathVariable("cid") Long cid, Model model) {
+		ContentDO bContentDO = bContentService.get(cid);
+		model.addAttribute("bContent", bContentDO);
+		return "blog/bContent/edit";
+	}
+
+	@GetMapping("/carousel/edit/{cid}")
+	@RequiresPermissions("blog:carousel:edit")
+	String edit2(@PathVariable("cid") Long cid, Model model) {
+		ContentDO bContentDO = bContentService.get(cid);
+		model.addAttribute("bContent", bContentDO);
+		return "blog/bContent2/edit";
+	}
+
+	/**
+	 * 保存
+	 */
+	@ResponseBody
+	@RequiresPermissions(value = {"blog:bContent:add", "blog:carousel:add"}, logical = Logical.OR)
+	@PostMapping("/save")
+	public R save(ContentDO bContent) {
+		if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+			return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+		}
+		if (bContent.getAllowComment() == null) {
+			bContent.setAllowComment(0);
+		}
+		if (bContent.getAllowFeed() == null) {
+			bContent.setAllowFeed(0);
+		}
+		if(null==bContent.getType()) {
+			bContent.setType("article");
+		}
+		bContent.setGtmCreate(new Date());
+		bContent.setGtmModified(new Date());
+		int count;
+		if (bContent.getCid() == null || "".equals(bContent.getCid())) {
+			count = bContentService.save(bContent);
+		} else {
+			count = bContentService.update(bContent);
+		}
+		if (count > 0) {
+			return R.ok().put("cid", bContent.getCid());
+		}
+		return R.error();
+	}
+
+	/**
+	 * 修改
+	 */
+	@RequiresPermissions(value = {"blog:bContent:edit", "blog:carousel:edit"}, logical = Logical.OR)
+	@ResponseBody
+	@RequestMapping("/update")
+	public R update( ContentDO bContent) {
+		if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+			return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+		}
+		bContent.setGtmCreate(new Date());
+		bContentService.update(bContent);
+		return R.ok();
+	}
+
+	/**
+	 * 删除
+	 */
+	@RequiresPermissions(value = {"blog:bContent:remove", "blog:carousel:remove"}, logical = Logical.OR)
+	@PostMapping("/remove")
+	@ResponseBody
+	public R remove(Long id) {
+		if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+			return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+		}
+		if (bContentService.remove(id) > 0) {
+			return R.ok();
+		}
+		return R.error();
+	}
+
+	/**
+	 * 删除
+	 */
+	@RequiresPermissions(value = {"blog:bContent:batchRemove", "blog:carousel:batchRemove"}, logical = Logical.OR)
+	@PostMapping("/batchRemove")
+	@ResponseBody
+	public R remove(@RequestParam("ids[]") Long[] cids) {
+		if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+			return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+		}
+		bContentService.batchRemove(cids);
+		return R.ok();
+	}
+}

+ 81 - 0
src/main/java/com/bootdo/blog/dao/ContentDao.java

@@ -0,0 +1,81 @@
+package com.bootdo.blog.dao;
+
+import com.bootdo.blog.domain.ContentDO;
+
+import java.util.List;
+import java.util.Map;
+
+import com.bootdo.portal.vo.IndexCarouselVO;
+import com.bootdo.portal.vo.NameAndCountVO;
+import com.bootdo.portal.vo.PoliciesAndRegulationsVO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 文章内容
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-10-03 16:17:48
+ */
+@Mapper
+public interface ContentDao {
+
+	ContentDO get(Long cid);
+	
+	List<ContentDO> list(Map<String,Object> map);
+
+    int count(Map<String, Object> map);
+
+    int save(ContentDO content);
+
+    int update(ContentDO content);
+
+    int remove(Long cid);
+
+    int batchRemove(Long[] cids);
+
+    /**
+     * 获取首页轮播图列表
+     *
+     * @return
+     */
+    List<IndexCarouselVO> getCarousel();
+
+    /**
+     * 根据位置获取文章数据列表
+     *
+     * @param position
+     * @return
+     */
+    List<IndexCarouselVO> getArticleByTags(@Param("position") Integer position);
+
+    /**
+     * 获取 上报数据最多的企业前四
+     *
+     * @return
+     */
+    List<NameAndCountVO> getPopularEnterprise();
+
+    /**
+     * 热门行业统计
+     *
+     * @return
+     */
+    List<NameAndCountVO> getPopularIndustry();
+
+    /**
+     * 门户获取政策法规列表
+     *
+     * @param parameter
+     * @return
+     */
+    List<PoliciesAndRegulationsVO> portalPoliciesRegulations(Map<String, Object> parameter);
+
+    /**
+     * 门户获取政策法规总数量
+     *
+     * @param parameter
+     * @return
+     */
+    Long portalPoliciesRegulationsCount(Map<String, Object> parameter);
+}

+ 295 - 0
src/main/java/com/bootdo/blog/domain/ContentDO.java

@@ -0,0 +1,295 @@
+package com.bootdo.blog.domain;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+
+/**
+ * 文章内容
+ * 
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-09-22 13:16:10
+ */
+public class ContentDO implements Serializable {
+	private static final long serialVersionUID = 1L;
+	
+	//
+	private Long cid;
+	//标题
+	private String title;
+	//
+	private String slug;
+	//创建人id
+	private Long created;
+	//最近修改人id
+	private Long modified;
+	//内容
+	private String content;
+	//类型
+	private String type;
+	//标签
+	private String tags;
+	//分类
+	private String categories;
+	//
+	private Integer hits;
+	//评论数量
+	private Integer commentsNum;
+	//开启评论
+	private Integer allowComment;
+	//允许ping
+	private Integer allowPing;
+	//允许反馈
+	private Integer allowFeed;
+	//状态
+	private Integer status;
+	//作者
+	private String author;
+	//创建时间
+	private Date gtmCreate;
+	//修改时间
+	private Date gtmModified;
+
+	/**
+	 * 设置:
+	 */
+	public void setCid(Long cid) {
+		this.cid = cid;
+	}
+	/**
+	 * 获取:
+	 */
+	public Long getCid() {
+		return cid;
+	}
+	/**
+	 * 设置:标题
+	 */
+	public void setTitle(String title) {
+		this.title = title;
+	}
+	/**
+	 * 获取:标题
+	 */
+	public String getTitle() {
+		return title;
+	}
+	/**
+	 * 设置:
+	 */
+	public void setSlug(String slug) {
+		this.slug = slug;
+	}
+	/**
+	 * 获取:
+	 */
+	public String getSlug() {
+		return slug;
+	}
+	/**
+	 * 设置:创建人id
+	 */
+	public void setCreated(Long created) {
+		this.created = created;
+	}
+	/**
+	 * 获取:创建人id
+	 */
+	public Long getCreated() {
+		return created;
+	}
+	/**
+	 * 设置:最近修改人id
+	 */
+	public void setModified(Long modified) {
+		this.modified = modified;
+	}
+	/**
+	 * 获取:最近修改人id
+	 */
+	public Long getModified() {
+		return modified;
+	}
+	/**
+	 * 设置:内容
+	 */
+	public void setContent(String content) {
+		this.content = content;
+	}
+	/**
+	 * 获取:内容
+	 */
+	public String getContent() {
+		return content;
+	}
+	/**
+	 * 设置:类型
+	 */
+	public void setType(String type) {
+		this.type = type;
+	}
+	/**
+	 * 获取:类型
+	 */
+	public String getType() {
+		return type;
+	}
+	/**
+	 * 设置:标签
+	 */
+	public void setTags(String tags) {
+		this.tags = tags;
+	}
+	/**
+	 * 获取:标签
+	 */
+	public String getTags() {
+		return tags;
+	}
+	/**
+	 * 设置:分类
+	 */
+	public void setCategories(String categories) {
+		this.categories = categories;
+	}
+	/**
+	 * 获取:分类
+	 */
+	public String getCategories() {
+		return categories;
+	}
+	/**
+	 * 设置:
+	 */
+	public void setHits(Integer hits) {
+		this.hits = hits;
+	}
+	/**
+	 * 获取:
+	 */
+	public Integer getHits() {
+		return hits;
+	}
+	/**
+	 * 设置:评论数量
+	 */
+	public void setCommentsNum(Integer commentsNum) {
+		this.commentsNum = commentsNum;
+	}
+	/**
+	 * 获取:评论数量
+	 */
+	public Integer getCommentsNum() {
+		return commentsNum;
+	}
+	/**
+	 * 设置:开启评论
+	 */
+	public void setAllowComment(Integer allowComment) {
+		this.allowComment = allowComment;
+	}
+	/**
+	 * 获取:开启评论
+	 */
+	public Integer getAllowComment() {
+		return allowComment;
+	}
+	/**
+	 * 设置:允许ping
+	 */
+	public void setAllowPing(Integer allowPing) {
+		this.allowPing = allowPing;
+	}
+	/**
+	 * 获取:允许ping
+	 */
+	public Integer getAllowPing() {
+		return allowPing;
+	}
+	/**
+	 * 设置:允许反馈
+	 */
+	public void setAllowFeed(Integer allowFeed) {
+		this.allowFeed = allowFeed;
+	}
+	/**
+	 * 获取:允许反馈
+	 */
+	public Integer getAllowFeed() {
+		return allowFeed;
+	}
+	/**
+	 * 设置:状态
+	 */
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+	/**
+	 * 获取:状态
+	 */
+	public Integer getStatus() {
+		return status;
+	}
+	/**
+	 * 设置:作者
+	 */
+	public void setAuthor(String author) {
+		this.author = author;
+	}
+	/**
+	 * 获取:作者
+	 */
+	public String getAuthor() {
+		return author;
+	}
+	/**
+	 * 设置:创建时间
+	 */
+	public void setGtmCreate(Date gtmCreate) {
+		this.gtmCreate = gtmCreate;
+	}
+	/**
+	 * 获取:创建时间
+	 */
+	public Date getGtmCreate() {
+		return gtmCreate;
+	}
+	/**
+	 * 设置:修改时间
+	 */
+	public void setGtmModified(Date gtmModified) {
+		this.gtmModified = gtmModified;
+	}
+	/**
+	 * 获取:修改时间
+	 */
+	public Date getGtmModified() {
+		return gtmModified;
+	}
+
+	@Override
+	public String toString() {
+		return "ContentDO{" +
+				"cid=" + cid +
+				", title='" + title + '\'' +
+				", slug='" + slug + '\'' +
+				", created=" + created +
+				", modified=" + modified +
+				", content='" + content + '\'' +
+				", type='" + type + '\'' +
+				", tags='" + tags + '\'' +
+				", categories='" + categories + '\'' +
+				", hits=" + hits +
+				", commentsNum=" + commentsNum +
+				", allowComment=" + allowComment +
+				", allowPing=" + allowPing +
+				", allowFeed=" + allowFeed +
+				", status=" + status +
+				", author='" + author + '\'' +
+				", gtmCreate=" + gtmCreate +
+				", gtmModified=" + gtmModified +
+				'}';
+	}
+}

+ 79 - 0
src/main/java/com/bootdo/blog/service/ContentService.java

@@ -0,0 +1,79 @@
+package com.bootdo.blog.service;
+
+import com.bootdo.blog.domain.ContentDO;
+import com.bootdo.portal.vo.IndexCarouselVO;
+import com.bootdo.portal.vo.NameAndCountVO;
+import com.bootdo.portal.vo.PoliciesAndRegulationsVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 文章内容
+ * 
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-09-09 10:03:34
+ */
+public interface ContentService {
+	
+	ContentDO get(Long cid);
+	
+	List<ContentDO> list(Map<String, Object> map);
+
+    int count(Map<String, Object> map);
+
+    int save(ContentDO bContent);
+
+    int update(ContentDO bContent);
+
+    int remove(Long cid);
+
+    int batchRemove(Long[] cids);
+
+    /**
+     * 获取首页轮播数据
+     *
+     * @return
+     */
+    List<IndexCarouselVO> getCarousel();
+
+    /**
+     * 根据位置获取文章数据列表
+     *
+     * @param position
+     * @return
+     */
+    List<IndexCarouselVO> getArticleByTags(Integer position);
+
+    /**
+     * 获取 上报数据最多的企业前四
+     *
+     * @return
+     */
+    List<NameAndCountVO> getPopularEnterprise();
+
+
+    /**
+     * 统计热门行业数据列表
+     *
+     * @return
+     */
+    List<NameAndCountVO> getPopularIndustry();
+
+    /**
+     * 门户获取政策法规列表
+     *
+     * @param parameter
+     * @return
+     */
+    List<PoliciesAndRegulationsVO> portalPoliciesRegulations(Map<String, Object> parameter);
+
+    /**
+     * 门户获取政策法规总数量
+     *
+     * @param parameter
+     * @return
+     */
+    Long portalPoliciesRegulationsCount(Map<String, Object> parameter);
+}

+ 89 - 0
src/main/java/com/bootdo/blog/service/impl/ContentServiceImpl.java

@@ -0,0 +1,89 @@
+package com.bootdo.blog.service.impl;
+
+import com.bootdo.portal.vo.IndexCarouselVO;
+import com.bootdo.portal.vo.NameAndCountVO;
+import com.bootdo.portal.vo.PoliciesAndRegulationsVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.bootdo.blog.dao.ContentDao;
+import com.bootdo.blog.domain.ContentDO;
+import com.bootdo.blog.service.ContentService;
+
+
+
+@Service
+public class ContentServiceImpl implements ContentService {
+	@Autowired
+	private ContentDao bContentMapper;
+	
+	@Override
+	public ContentDO get(Long cid){
+		return bContentMapper.get(cid);
+	}
+	
+	@Override
+	public List<ContentDO> list(Map<String, Object> map){
+		return bContentMapper.list(map);
+	}
+	
+	@Override
+	public int count(Map<String, Object> map){
+		return bContentMapper.count(map);
+	}
+	
+	@Override
+	public int save(ContentDO bContent){
+		return bContentMapper.save(bContent);
+	}
+	
+	@Override
+	public int update(ContentDO bContent){
+		return bContentMapper.update(bContent);
+	}
+
+    @Override
+    public int remove(Long cid) {
+        return bContentMapper.remove(cid);
+    }
+
+    @Override
+    public int batchRemove(Long[] cids) {
+        return bContentMapper.batchRemove(cids);
+    }
+
+    @Override
+    public List<IndexCarouselVO> getCarousel() {
+
+        return bContentMapper.getCarousel();
+    }
+
+    @Override
+    public List<IndexCarouselVO> getArticleByTags(Integer position) {
+        return bContentMapper.getArticleByTags(position);
+    }
+
+    @Override
+    public List<NameAndCountVO> getPopularEnterprise() {
+        return bContentMapper.getPopularEnterprise();
+    }
+
+    @Override
+    public List<NameAndCountVO> getPopularIndustry() {
+        return bContentMapper.getPopularIndustry();
+    }
+
+    @Override
+    public List<PoliciesAndRegulationsVO> portalPoliciesRegulations(Map<String, Object> parameter) {
+        return bContentMapper.portalPoliciesRegulations(parameter);
+    }
+
+    @Override
+    public Long portalPoliciesRegulationsCount(Map<String, Object> parameter) {
+        return bContentMapper.portalPoliciesRegulationsCount(parameter);
+    }
+
+}

+ 12 - 0
src/main/java/com/bootdo/common/annotation/Log.java

@@ -0,0 +1,12 @@
+package com.bootdo.common.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.lang.annotation.RetentionPolicy;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Log {
+	String value() default "";
+}

+ 104 - 0
src/main/java/com/bootdo/common/aspect/LogAspect.java

@@ -0,0 +1,104 @@
+package com.bootdo.common.aspect;
+
+import java.lang.reflect.Method;
+import java.util.Date;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import javax.servlet.http.HttpServletRequest;
+
+import com.bootdo.common.service.LogService;
+import com.bootdo.system.domain.UserToken;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+
+import com.bootdo.common.annotation.Log;
+import com.bootdo.common.dao.LogDao;
+import com.bootdo.common.domain.LogDO;
+import com.bootdo.common.utils.HttpContextUtils;
+import com.bootdo.common.utils.IPUtils;
+import com.bootdo.common.utils.JSONUtils;
+import com.bootdo.common.utils.ShiroUtils;
+import com.bootdo.system.domain.UserDO;
+
+@Aspect
+@Component
+public class LogAspect {
+    private static final Logger logger = LoggerFactory.getLogger(LogAspect.class);
+
+    @Autowired
+    LogService logService;
+
+
+    @Pointcut("@annotation(com.bootdo.common.annotation.Log)")
+    public void logPointCut() {
+    }
+
+    @Around("logPointCut()")
+    public Object around(ProceedingJoinPoint point) throws Throwable {
+        long beginTime = System.currentTimeMillis();
+        // 执行方法
+        Object result = point.proceed();
+        // 执行时长(毫秒)
+        long time = System.currentTimeMillis() - beginTime;
+        //异步保存日志
+        saveLog(point, time);
+        return result;
+    }
+
+    void saveLog(ProceedingJoinPoint joinPoint, long time) throws InterruptedException {
+        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
+        Method method = signature.getMethod();
+        LogDO sysLog = new LogDO();
+        Log syslog = method.getAnnotation(Log.class);
+        if (syslog != null) {
+            // 注解上的描述
+            sysLog.setOperation(syslog.value());
+        }
+        // 请求的方法名
+        String className = joinPoint.getTarget().getClass().getName();
+        String methodName = signature.getName();
+        sysLog.setMethod(className + "." + methodName + "()");
+        // 请求的参数
+        Object[] args = joinPoint.getArgs();
+        try {
+            String params = JSONUtils.beanToJson(args[0]).substring(0, 4999);
+            sysLog.setParams(params);
+        } catch (Exception e) {
+
+        }
+        // 获取request
+        HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
+        // 设置IP地址
+        sysLog.setIp(IPUtils.getIpAddr(request));
+        // 用户名
+        UserDO currUser = ShiroUtils.getUser();
+        if (null == currUser) {
+            if (null != sysLog.getParams()) {
+                sysLog.setUserId(-1L);
+                sysLog.setUsername(sysLog.getParams());
+            } else {
+                sysLog.setUserId(-1L);
+                sysLog.setUsername("获取用户信息为空");
+            }
+        } else {
+            sysLog.setUserId(ShiroUtils.getUserId());
+            sysLog.setUsername(ShiroUtils.getUser().getUsername());
+        }
+        sysLog.setTime((int) time);
+        // 系统当前时间
+        Date date = new Date();
+        sysLog.setGmtCreate(date);
+        // 保存系统日志
+        logService.save(sysLog);
+    }
+}

+ 61 - 0
src/main/java/com/bootdo/common/aspect/WebLogAspect.java

@@ -0,0 +1,61 @@
+package com.bootdo.common.aspect;
+
+import com.bootdo.common.utils.HttpContextUtils;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.*;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import sun.net.util.IPAddressUtil;
+
+import javax.servlet.http.HttpServletRequest;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+
+@Aspect
+@Component
+public class WebLogAspect {
+
+    private static final Logger logger = LoggerFactory.getLogger(WebLogAspect.class);
+
+    @Pointcut("execution( * com.bootdo..controller.*.*(..))")//两个..代表所有子目录,最后括号里的两个..代表所有参数
+    public void logPointCut() {
+    }
+
+
+    @Before("logPointCut()")
+    public void doBefore(JoinPoint joinPoint) throws Throwable {
+        // 接收到请求,记录请求内容
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = attributes.getRequest();
+
+        // 记录下请求内容
+        //logger.info("请求地址 : " + request.getRequestURL().toString());
+        //logger.info("HTTP METHOD : " + request.getMethod());
+        // 获取真实的ip地址
+        //logger.info("IP : " + IPAddressUtil.getClientIpAddress(request));
+        logger.info("CLASS_METHOD : " + joinPoint.getSignature().getDeclaringTypeName() + "."
+                + joinPoint.getSignature().getName());
+        logger.info("参数 : " + Arrays.toString(joinPoint.getArgs()));
+//        loggger.info("参数 : " + joinPoint.getArgs());
+
+    }
+
+    @AfterReturning(returning = "ret", pointcut = "logPointCut()")// returning的值和doAfterReturning的参数名一致
+    public void doAfterReturning(Object ret) throws Throwable {
+        // 处理完请求,返回内容(返回值太复杂时,打印的是物理存储空间的地址)
+        //logger.debug("返回值 : " + ret);
+    }
+
+    @Around("logPointCut()")
+    public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
+        long startTime = System.currentTimeMillis();
+        Object ob = pjp.proceed();// ob 为方法的返回值
+        //logger.info("耗时 : " + (System.currentTimeMillis() - startTime));
+        return ob;
+    }
+}

+ 50 - 0
src/main/java/com/bootdo/common/config/ApplicationContextRegister.java

@@ -0,0 +1,50 @@
+package com.bootdo.common.config;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+/**
+ *
+ * @author chen
+ * @date 2017/9/4
+ * <p>
+ * Email 122741482@qq.com
+ * <p>
+ * Describe:
+ */
+@Component
+public class ApplicationContextRegister implements ApplicationContextAware {
+    private static Logger logger = LoggerFactory.getLogger(ApplicationContextRegister.class);
+    private static ApplicationContext APPLICATION_CONTEXT;
+    /**
+     * 设置spring上下文
+     * @param applicationContext spring上下文
+     * @throws BeansException
+     * */
+    @Override  public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+        logger.debug("ApplicationContext registed-->{}", applicationContext);
+        APPLICATION_CONTEXT = applicationContext;
+    }
+
+    /**
+     * 获取容器
+     * @return
+     */
+    public static ApplicationContext getApplicationContext() {
+        return APPLICATION_CONTEXT;
+    }
+
+    /**
+     * 获取容器对象
+     * @param type
+     * @param <T>
+     * @return
+     */
+    public static <T> T getBean(Class<T> type) {
+        return APPLICATION_CONTEXT.getBean(type);
+    }
+}

+ 69 - 0
src/main/java/com/bootdo/common/config/BootdoConfig.java

@@ -0,0 +1,69 @@
+package com.bootdo.common.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Component
+@ConfigurationProperties(prefix="bootdo")
+public class BootdoConfig {
+	//上传路径
+	private String uploadPath;
+
+	private String encPrival;
+
+	private String crtPrival;
+
+	private String licensePath;
+
+	private String username;
+
+	private String password;
+
+	public String getUploadPath() {
+		return uploadPath;
+	}
+
+	public void setUploadPath(String uploadPath) {
+		this.uploadPath = uploadPath;
+	}
+
+	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 getEncPrival() {
+		return encPrival;
+	}
+
+	public String getLicensePath() {
+		return licensePath;
+	}
+
+	public void setLicensePath(String licensePath) {
+		this.licensePath = licensePath;
+	}
+
+	public void setEncPrival(String encPrival) {
+		this.encPrival = encPrival;
+	}
+
+	public String getCrtPrival() {
+		return crtPrival;
+	}
+
+	public void setCrtPrival(String crtPrival) {
+		this.crtPrival = crtPrival;
+	}
+}

+ 24 - 0
src/main/java/com/bootdo/common/config/Constant.java

@@ -0,0 +1,24 @@
+package com.bootdo.common.config;
+
+public class Constant {
+    //演示系统账户
+    public static String DEMO_ACCOUNT = "test";
+    //自动去除表前缀
+    public static String AUTO_REOMVE_PRE = "true";
+    //停止计划任务
+    public static String STATUS_RUNNING_STOP = "stop";
+    //开启计划任务
+    public static String STATUS_RUNNING_START = "start";
+    //通知公告阅读状态-未读
+    public static String OA_NOTIFY_READ_NO = "0";
+    //通知公告阅读状态-已读
+    public static int OA_NOTIFY_READ_YES = 1;
+    //部门根节点id
+    public static Long DEPT_ROOT_ID = 0l;
+    //缓存方式
+    public static String CACHE_TYPE_REDIS ="redis";
+
+    public static String LOG_ERROR = "error";
+
+    
+}

+ 40 - 0
src/main/java/com/bootdo/common/config/DateConverConfig.java

@@ -0,0 +1,40 @@
+package com.bootdo.common.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.convert.converter.Converter;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.zip.DataFormatException;
+
+/**
+ * @author gaoyuzhe
+ * @date 2017/12/14.
+ */
+@Configuration
+public class DateConverConfig {
+    @Bean
+    public Converter<String, Date> stringDateConvert() {
+        return new Converter<String, Date>() {
+            @Override
+            public Date convert(String source) {
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                Date date = null;
+                try {
+                    date = sdf.parse((String) source);
+                } catch (Exception e) {
+                    SimpleDateFormat sdfday = new SimpleDateFormat("yyyy-MM-dd");
+                    try {
+                        date = sdfday.parse((String) source);
+                    } catch (ParseException e1) {
+                        e1.printStackTrace();
+                    }
+                }
+                return date;
+            }
+        };
+    }
+
+}

+ 145 - 0
src/main/java/com/bootdo/common/config/DruidDBConfig.java

@@ -0,0 +1,145 @@
+package com.bootdo.common.config;
+import com.alibaba.druid.pool.DruidDataSource;
+import com.alibaba.druid.support.http.StatViewServlet;
+import com.alibaba.druid.support.http.WebStatFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.boot.web.servlet.ServletRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by PrimaryKey on 17/2/4.
+ */
+@SuppressWarnings("AlibabaRemoveCommentedCode")
+@Configuration
+public class DruidDBConfig {
+    private Logger logger = LoggerFactory.getLogger(DruidDBConfig.class);
+    @Value("${spring.datasource.url}")
+    private String dbUrl;
+
+    @Value("${spring.datasource.username}")
+    private String username;
+
+    @Value("${spring.datasource.password}")
+    private String password;
+
+    @Value("${spring.datasource.driverClassName}")
+    private String driverClassName;
+
+    @Value("${spring.datasource.initialSize}")
+    private int initialSize;
+
+    @Value("${spring.datasource.minIdle}")
+    private int minIdle;
+
+    @Value("${spring.datasource.maxActive}")
+    private int maxActive;
+
+    @Value("${spring.datasource.maxWait}")
+    private int maxWait;
+
+    @Value("${spring.datasource.timeBetweenEvictionRunsMillis}")
+    private int timeBetweenEvictionRunsMillis;
+
+    @Value("${spring.datasource.minEvictableIdleTimeMillis}")
+    private int minEvictableIdleTimeMillis;
+
+    @Value("${spring.datasource.validationQuery}")
+    private String validationQuery;
+
+    @Value("${spring.datasource.testWhileIdle}")
+    private boolean testWhileIdle;
+
+    @Value("${spring.datasource.testOnBorrow}")
+    private boolean testOnBorrow;
+
+    @Value("${spring.datasource.testOnReturn}")
+    private boolean testOnReturn;
+
+    @Value("${spring.datasource.poolPreparedStatements}")
+    private boolean poolPreparedStatements;
+
+    @Value("${spring.datasource.maxPoolPreparedStatementPerConnectionSize}")
+    private int maxPoolPreparedStatementPerConnectionSize;
+
+    @Value("${spring.datasource.filters}")
+    private String filters;
+
+    @Value("{spring.datasource.connectionProperties}")
+    private String connectionProperties;
+
+    @Bean(initMethod = "init", destroyMethod = "close")   //声明其为Bean实例
+    @Primary  //在同样的DataSource中,首先使用被标注的DataSource
+    public DataSource dataSource() {
+        DruidDataSource datasource = new DruidDataSource();
+
+        datasource.setUrl(this.dbUrl);
+        datasource.setUsername(username);
+        datasource.setPassword(password);
+        datasource.setDriverClassName(driverClassName);
+
+        //configuration
+        datasource.setInitialSize(initialSize);
+        datasource.setMinIdle(minIdle);
+        datasource.setMaxActive(maxActive);
+        datasource.setMaxWait(maxWait);
+        datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
+        datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
+        datasource.setValidationQuery(validationQuery);
+        datasource.setTestWhileIdle(testWhileIdle);
+        datasource.setTestOnBorrow(testOnBorrow);
+        datasource.setTestOnReturn(testOnReturn);
+        datasource.setPoolPreparedStatements(poolPreparedStatements);
+        datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
+        try {
+            datasource.setFilters(filters);
+        } catch (SQLException e) {
+            logger.error("druid configuration initialization filter", e);
+        }
+        datasource.setConnectionProperties(connectionProperties);
+
+        return datasource;
+    }
+
+    @Bean
+    public ServletRegistrationBean druidServlet() {
+        ServletRegistrationBean reg = new ServletRegistrationBean();
+        reg.setServlet(new StatViewServlet());
+        reg.addUrlMappings("/druid/*");
+        //reg.addUrlMappings("loginUsername","admin");
+        //reg.addUrlMappings("loginPassword","123456");
+        //reg.addInitParameter("allow", ""); //白名单
+        //reg.addInitParameter("loginUsername","admin");
+        //reg.addInitParameter("loginPassword","123456");
+        Map<String,String> initParams=new HashMap<>();
+        initParams.put("loginUsername","admin");
+        initParams.put("loginPassword","123456");
+        initParams.put("allow","");//默认允许所有访问
+        //initParams.put("deny","192.168.1.7");//
+        reg.setInitParameters(initParams);
+
+        return reg;
+    }
+
+    @Bean public FilterRegistrationBean filterRegistrationBean() {
+        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
+        filterRegistrationBean.setFilter(new WebStatFilter());
+        filterRegistrationBean.addUrlPatterns("/*");
+        filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");
+        filterRegistrationBean.addInitParameter("profileEnable", "true");
+        filterRegistrationBean.addInitParameter("principalCookieName","USER_COOKIE");
+        filterRegistrationBean.addInitParameter("principalSessionName","USER_SESSION");
+        filterRegistrationBean.addInitParameter("DruidWebStatFilter","/*");
+        return filterRegistrationBean;
+    }
+}
+

+ 50 - 0
src/main/java/com/bootdo/common/config/QuartzConfigration.java

@@ -0,0 +1,50 @@
+package com.bootdo.common.config;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.quartz.Scheduler;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.config.PropertiesFactoryBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.scheduling.quartz.SchedulerFactoryBean;
+
+import com.bootdo.common.quartz.factory.JobFactory;
+
+@Configuration
+public class QuartzConfigration {
+
+	@Autowired
+	JobFactory jobFactory;
+
+
+	@Bean
+	public SchedulerFactoryBean schedulerFactoryBean() {
+		SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
+		try {
+			schedulerFactoryBean.setOverwriteExistingJobs(true);
+			schedulerFactoryBean.setQuartzProperties(quartzProperties());
+			schedulerFactoryBean.setJobFactory(jobFactory);
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return schedulerFactoryBean;
+	}
+
+	// 指定quartz.properties
+	@Bean
+	public Properties quartzProperties() throws IOException {
+		PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
+		propertiesFactoryBean.setLocation(new ClassPathResource("/config/quartz.properties"));
+		propertiesFactoryBean.afterPropertiesSet();
+		return propertiesFactoryBean.getObject();
+	}
+
+	// 创建schedule
+	@Bean(name = "scheduler")
+	public Scheduler scheduler() {
+		return schedulerFactoryBean().getScheduler();
+	}
+}

+ 13 - 0
src/main/java/com/bootdo/common/config/SecuityConfig.java

@@ -0,0 +1,13 @@
+package com.bootdo.common.config;
+
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.context.annotation.Configuration;
+
+@EnableAutoConfiguration(exclude = {
+        org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
+})
+@Configuration
+public class SecuityConfig {
+
+
+}

+ 23 - 0
src/main/java/com/bootdo/common/config/SpringAsyncConfig.java

@@ -0,0 +1,23 @@
+package com.bootdo.common.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.task.AsyncTaskExecutor;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.RejectedExecutionHandler;
+import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+@Configuration
+@EnableAsync
+public class SpringAsyncConfig {
+//    @Bean
+//    public AsyncTaskExecutor taskExecutor() {
+//        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+//        executor.setMaxPoolSize(10);
+//        return executor;
+//    }
+}

+ 22 - 0
src/main/java/com/bootdo/common/config/SpringBootSampleApplication.java

@@ -0,0 +1,22 @@
+//package com.bootdo.common.config;
+//
+//import com.bootdo.BootdoApplication;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//import org.springframework.boot.builder.SpringApplicationBuilder;
+//import org.springframework.boot.web.support.SpringBootServletInitializer;
+//
+///**
+// * war包部署需要
+// * 修改启动类,继承 SpringBootServletInitializer 并重写 configure 方法
+// */
+//public class SpringBootSampleApplication extends SpringBootServletInitializer{
+//
+//    private static final Logger logger = LoggerFactory.getLogger(SpringBootSampleApplication.class);
+//
+//    @Override
+//    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
+//        return builder.sources(this.getClass());
+//    }
+//
+//}

+ 156 - 0
src/main/java/com/bootdo/common/config/ThirdPartSsoConfig.java

@@ -0,0 +1,156 @@
+package com.bootdo.common.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * 第三方sso参数配置
+ *
+ * @author Mr.xiBel
+ */
+@Component
+@ConfigurationProperties(prefix = "third-part-sso")
+public class ThirdPartSsoConfig {
+
+	/**
+	 * 开关
+	 */
+	private Boolean switchFlag;
+
+	/**
+	 * 是否直接获取用户名 将跳过通过token再次去获取用户详情
+	 * 不获取用户详情时, 直接使用获取token信息中的user_info
+	 */
+	private Boolean directlyUsername;
+
+	/**
+	 * 客户端的id 提前配置与配置一致
+	 */
+	private String clientId;
+
+	/**
+	 * 客户端秘钥,提前配置与配置一致
+	 */
+	private String clientSecret;
+
+	/**
+	 * 跳转的目标的url,提前配置,与配置一致
+	 */
+	private String systemRedirectUrl;
+
+	/**
+	 * 第三方系统sso地址
+	 */
+	private String ssoRedirectUrl;
+
+	/**
+	 * 4.2 根据code获取token地址
+	 */
+	private String tokenUrl;
+
+	/**
+	 * 4.3 根据token获取用户详情地址
+	 */
+	private String userUrl;
+
+	/**
+	 * 登出地址
+	 */
+	private String LoginoutUrl;
+
+	/**
+	 * 推送过来的用户默认的部门id
+	 */
+	private Long pushDeptId;
+
+
+	public String getLoginoutUrl() {
+		return LoginoutUrl;
+	}
+
+	public void setLoginoutUrl(String loginoutUrl) {
+		LoginoutUrl = loginoutUrl;
+	}
+
+	public Boolean getSwitchFlag() {
+		return switchFlag;
+	}
+
+	public void setSwitchFlag(Boolean switchFlag) {
+		this.switchFlag = switchFlag;
+	}
+
+	public String getClientId() {
+		return clientId;
+	}
+
+	public void setClientId(String clientId) {
+		this.clientId = clientId;
+	}
+
+	public String getClientSecret() {
+		return clientSecret;
+	}
+
+	public void setClientSecret(String clientSecret) {
+		this.clientSecret = clientSecret;
+	}
+
+	public String getSystemRedirectUrl() {
+		return systemRedirectUrl;
+	}
+
+	public void setSystemRedirectUrl(String systemRedirectUrl) {
+		this.systemRedirectUrl = systemRedirectUrl;
+	}
+
+	public String getTokenUrl() {
+		return tokenUrl;
+	}
+
+	/**
+	 * 获取完整 TokenUrl
+	 *
+	 * @param code
+	 * @return
+	 */
+	public String getTokenUrl(String code) {
+		return String.format(tokenUrl, clientId, clientSecret, systemRedirectUrl, code);
+	}
+
+	public void setTokenUrl(String tokenUrl) {
+		this.tokenUrl = tokenUrl;
+	}
+
+	public String getUserUrl() {
+		return userUrl;
+	}
+
+	public void setUserUrl(String userUrl) {
+		this.userUrl = userUrl;
+	}
+
+	public Boolean getDirectlyUsername() {
+		return directlyUsername;
+	}
+
+	public void setDirectlyUsername(Boolean directlyUsername) {
+		this.directlyUsername = directlyUsername;
+	}
+
+	public String getSsoRedirectUrl() {
+		return ssoRedirectUrl;
+	}
+
+	public void setSsoRedirectUrl(String ssoRedirectUrl) {
+		this.ssoRedirectUrl = ssoRedirectUrl;
+	}
+
+	public Long getPushDeptId() {
+		return pushDeptId;
+	}
+
+	public void setPushDeptId(Long pushDeptId) {
+		this.pushDeptId = pushDeptId;
+	}
+}

+ 17 - 0
src/main/java/com/bootdo/common/config/WebConfigurer.java

@@ -0,0 +1,17 @@
+package com.bootdo.common.config;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+@Component
+class WebConfigurer extends WebMvcConfigurerAdapter {
+	@Autowired
+	BootdoConfig bootdoConfig;
+	@Override
+	public void addResourceHandlers(ResourceHandlerRegistry registry) {
+		registry.addResourceHandler("/files/**").addResourceLocations("file:///"+bootdoConfig.getUploadPath());
+	}
+
+}

+ 21 - 0
src/main/java/com/bootdo/common/controller/BaseController.java

@@ -0,0 +1,21 @@
+package com.bootdo.common.controller;
+
+import com.bootdo.system.domain.UserToken;
+import org.springframework.stereotype.Controller;
+import com.bootdo.common.utils.ShiroUtils;
+import com.bootdo.system.domain.UserDO;
+
+@Controller
+public class BaseController {
+	public UserDO getUser() {
+		return ShiroUtils.getUser();
+	}
+
+	public Long getUserId() {
+		return getUser().getUserId();
+	}
+
+	public String getUsername() {
+		return getUser().getUsername();
+	}
+}

+ 176 - 0
src/main/java/com/bootdo/common/controller/DictController.java

@@ -0,0 +1,176 @@
+package com.bootdo.common.controller;
+
+import com.bootdo.common.annotation.Log;
+import com.bootdo.common.domain.DictDO;
+import com.bootdo.common.service.DictService;
+import com.bootdo.common.utils.PageUtils;
+import com.bootdo.common.utils.Query;
+import com.bootdo.common.utils.R;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 字典表
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-09-29 18:28:07
+ */
+
+@Controller
+@RequestMapping("/common/dict")
+public class DictController extends BaseController {
+	@Autowired
+	private DictService dictService;
+
+	@Log("访问数据字典")
+	@GetMapping()
+	@RequiresPermissions("common:dict:dict")
+	String dict() {
+		return "common/dict/dict";
+	}
+
+	@ResponseBody
+	@GetMapping("/list")
+	@RequiresPermissions("common:dict:dict")
+	public PageUtils list(@RequestParam Map<String, Object> params) {
+		// 查询列表数据
+		Query query = new Query(params);
+		List<DictDO> dictList = dictService.list(query);
+		int total = dictService.count(query);
+		PageUtils pageUtils = new PageUtils(dictList, total);
+		return pageUtils;
+	}
+
+	@GetMapping("/add")
+	@RequiresPermissions("common:dict:add")
+	String add() {
+		return "common/dict/add";
+	}
+
+	@GetMapping("/edit/{id}")
+	@RequiresPermissions("common:dict:edit")
+	String edit(@PathVariable("id") Long id, Model model) {
+		DictDO dict = dictService.get(id);
+		model.addAttribute("dict", dict);
+		return "common/dict/edit";
+	}
+
+	/**
+	 * 保存
+	 */
+	@ResponseBody
+	@PostMapping("/save")
+	@RequiresPermissions("common:dict:add")
+	public R save(DictDO dict) {
+		if (dictService.save(dict) > 0) {
+			return R.ok();
+		}
+		return R.error();
+	}
+
+	/**
+	 * 修改
+	 */
+	@ResponseBody
+	@RequestMapping("/update")
+	@RequiresPermissions("common:dict:edit")
+	public R update(DictDO dict) {
+		dictService.update(dict);
+		return R.ok();
+	}
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ResponseBody
+	@RequiresPermissions("common:dict:remove")
+	public R remove(Long id) {
+		if (dictService.remove(id) > 0) {
+			return R.ok();
+		}
+		return R.error();
+	}
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/batchRemove")
+	@ResponseBody
+	@RequiresPermissions("common:dict:batchRemove")
+	public R remove(@RequestParam("ids[]") Long[] ids) {
+		dictService.batchRemove(ids);
+		return R.ok();
+	}
+
+	@GetMapping("/type")
+	@ResponseBody
+	public List<DictDO> listType() {
+		return dictService.listType();
+	};
+
+	// 类别已经指定增加
+	@GetMapping("/add/{type}/{description}")
+	@RequiresPermissions("common:dict:add")
+	String addD(Model model, @PathVariable("type") String type, @PathVariable("description") String description) {
+		model.addAttribute("type", type);
+		model.addAttribute("description", description);
+		return "common/dict/add";
+	}
+
+	@ResponseBody
+	@GetMapping("/list/{type}")
+	public List<DictDO> listByType(@PathVariable("type") String type) {
+		// 查询列表数据
+		Map<String, Object> map = new HashMap<>(16);
+		map.put("type", type);
+		List<DictDO> dictList = dictService.list(map);
+		return dictList;
+	}
+
+	@ResponseBody
+	@GetMapping("/list/{type}/{parentId}")
+	public List<DictDO> listByTypeParentID(@PathVariable("type") String type,@PathVariable("parentId") String parentId) {
+		// 查询列表数据
+		Map<String, Object> map = new HashMap<>(16);
+		map.put("type", type);
+		map.put("parentId", parentId);
+		List<DictDO> dictList = dictService.list(map);
+		return dictList;
+	}
+
+	@ResponseBody
+	@GetMapping("/listCity")
+	public List<DictDO> listCity() {
+		// 查询列表数据
+		Map<String, Object> map = new HashMap<>(16);
+		String province = getUser().getProvince();
+		map.put("description", province);//描述
+		List<DictDO> dictList = dictService.list(map);
+		return dictList;
+	}
+
+	/**
+	 * 所属行业
+	 *
+	 * @return
+	 */
+	@ResponseBody
+	@GetMapping("/industry_type")
+	public List<DictDO> industryType() {
+		// 查询列表数据
+		Map<String, Object> map = new HashMap<>(16);
+		//描述
+		map.put("description", "所属行业");
+		List<DictDO> dictList = dictService.list(map);
+		return dictList;
+	}
+
+}

+ 164 - 0
src/main/java/com/bootdo/common/controller/FileController.java

@@ -0,0 +1,164 @@
+package com.bootdo.common.controller;
+
+import com.bootdo.common.annotation.Log;
+import com.bootdo.common.config.BootdoConfig;
+import com.bootdo.common.domain.FileDO;
+import com.bootdo.common.service.FileService;
+import com.bootdo.common.utils.*;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 文件上传
+ * 
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-09-19 16:02:20
+ */
+@Controller
+@RequestMapping("/common/sysFile")
+public class FileController extends BaseController {
+
+	@Autowired
+	private FileService sysFileService;
+
+	@Autowired
+	private BootdoConfig bootdoConfig;
+
+	@Log("访问文件管理")
+	@GetMapping()
+	@RequiresPermissions("common:sysFile:sysFile")
+	String sysFile(Model model) {
+		Map<String, Object> params = new HashMap<>(16);
+		return "common/file/file";
+	}
+
+	@ResponseBody
+	@GetMapping("/list")
+	@RequiresPermissions("common:sysFile:sysFile")
+	public PageUtils list(@RequestParam Map<String, Object> params) {
+		// 查询列表数据
+		Query query = new Query(params);
+		List<FileDO> sysFileList = sysFileService.list(query);
+		int total = sysFileService.count(query);
+		PageUtils pageUtils = new PageUtils(sysFileList, total);
+		return pageUtils;
+	}
+
+	@GetMapping("/add")
+	// @RequiresPermissions("common:bComments")
+	String add() {
+		return "common/sysFile/add";
+	}
+
+	@GetMapping("/edit")
+	// @RequiresPermissions("common:bComments")
+	String edit(Long id, Model model) {
+		FileDO sysFile = sysFileService.get(id);
+		model.addAttribute("sysFile", sysFile);
+		return "common/sysFile/edit";
+	}
+
+	/**
+	 * 信息
+	 */
+	@RequestMapping("/info/{id}")
+	@RequiresPermissions("common:info")
+	public R info(@PathVariable("id") Long id) {
+		FileDO sysFile = sysFileService.get(id);
+		return R.ok().put("sysFile", sysFile);
+	}
+
+	/**
+	 * 保存
+	 */
+	@ResponseBody
+	@PostMapping("/save")
+	@RequiresPermissions("common:save")
+	public R save(FileDO sysFile) {
+		if (sysFileService.save(sysFile) > 0) {
+			return R.ok();
+		}
+		return R.error();
+	}
+
+	/**
+	 * 修改
+	 */
+	@RequestMapping("/update")
+	@RequiresPermissions("common:update")
+	public R update(@RequestBody FileDO sysFile) {
+		sysFileService.update(sysFile);
+
+		return R.ok();
+	}
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ResponseBody
+	// @RequiresPermissions("common:remove")
+	public R remove(Long id, HttpServletRequest request) {
+		if ("test".equals(getUsername())) {
+			return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+		}
+		String fileName = bootdoConfig.getUploadPath() + sysFileService.get(id).getUrl().replace("/files/", "");
+		if (sysFileService.remove(id) > 0) {
+			boolean b = FileUtil.deleteFile(fileName);
+			if (!b) {
+				return R.error("数据库记录删除成功,文件删除失败");
+			}
+			return R.ok();
+		} else {
+			return R.error();
+		}
+	}
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/batchRemove")
+	@ResponseBody
+	@RequiresPermissions("common:remove")
+	public R remove(@RequestParam("ids[]") Long[] ids) {
+		if ("test".equals(getUsername())) {
+			return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+		}
+		sysFileService.batchRemove(ids);
+		return R.ok();
+	}
+
+	@ResponseBody
+	@PostMapping("/upload")
+	R upload(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
+		if ("test".equals(getUsername())) {
+			return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+		}
+		String fileName = file.getOriginalFilename();
+		fileName = FileUtil.renameToUUID(fileName);
+		FileDO sysFile = new FileDO(FileType.fileType(fileName), "/files/" + fileName, new Date());
+		try {
+			FileUtil.uploadFile(file.getBytes(), bootdoConfig.getUploadPath(), fileName);
+		} catch (Exception e) {
+			return R.error();
+		}
+
+		if (sysFileService.save(sysFile) > 0) {
+			return R.ok().put("fileName",sysFile.getUrl());
+		}
+		return R.error();
+	}
+
+
+}

+ 97 - 0
src/main/java/com/bootdo/common/controller/GeneratorController.java

@@ -0,0 +1,97 @@
+package com.bootdo.common.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.bootdo.common.service.GeneratorService;
+import com.bootdo.common.utils.GenUtils;
+import com.bootdo.common.utils.R;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.io.IOUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RequestMapping("/common/generator")
+@Controller
+public class GeneratorController {
+	String prefix = "common/generator";
+	@Autowired
+	GeneratorService generatorService;
+
+	@GetMapping()
+	String generator() {
+		return prefix + "/list";
+	}
+
+	@ResponseBody
+	@GetMapping("/list")
+	List<Map<String, Object>> list() {
+		List<Map<String, Object>> list = generatorService.list();
+		return list;
+	};
+
+	@RequestMapping("/code/{tableName}")
+	public void code(HttpServletRequest request, HttpServletResponse response,
+			@PathVariable("tableName") String tableName) throws IOException {
+		String[] tableNames = new String[] { tableName };
+		byte[] data = generatorService.generatorCode(tableNames);
+		response.reset();
+		response.setHeader("Content-Disposition", "attachment; filename=\"cic.zip\"");
+		response.addHeader("Content-Length", "" + data.length);
+		response.setContentType("application/octet-stream; charset=UTF-8");
+
+		IOUtils.write(data, response.getOutputStream());
+	}
+
+	@RequestMapping("/batchCode")
+	public void batchCode(HttpServletRequest request, HttpServletResponse response, String tables) throws IOException {
+		String[] tableNames = new String[] {};
+		tableNames = JSON.parseArray(tables).toArray(tableNames);
+		byte[] data = generatorService.generatorCode(tableNames);
+		response.reset();
+		response.setHeader("Content-Disposition", "attachment; filename=\"cic.zip\"");
+		response.addHeader("Content-Length", "" + data.length);
+		response.setContentType("application/octet-stream; charset=UTF-8");
+
+		IOUtils.write(data, response.getOutputStream());
+	}
+
+	@GetMapping("/edit")
+	public String edit(Model model) {
+		Configuration conf = GenUtils.getConfig();
+		Map<String, Object> property = new HashMap<>(16);
+		property.put("author", conf.getProperty("author"));
+		property.put("email", conf.getProperty("email"));
+		property.put("package", conf.getProperty("package"));
+		property.put("autoRemovePre", conf.getProperty("autoRemovePre"));
+		property.put("tablePrefix", conf.getProperty("tablePrefix"));
+		model.addAttribute("property", property);
+		return prefix + "/edit";
+	}
+
+	@ResponseBody
+	@PostMapping("/update")
+	R update(@RequestParam Map<String, Object> map) {
+		try {
+			PropertiesConfiguration conf = new PropertiesConfiguration("generator.properties");
+			conf.setProperty("author", map.get("author"));
+			conf.setProperty("email", map.get("email"));
+			conf.setProperty("package", map.get("package"));
+			conf.setProperty("autoRemovePre", map.get("autoRemovePre"));
+			conf.setProperty("tablePrefix", map.get("tablePrefix"));
+			conf.save();
+		} catch (ConfigurationException e) {
+			return R.error("保存配置文件出错");
+		}
+		return R.ok();
+	}
+}

+ 144 - 0
src/main/java/com/bootdo/common/controller/JobController.java

@@ -0,0 +1,144 @@
+package com.bootdo.common.controller;
+
+import com.bootdo.common.config.Constant;
+import com.bootdo.common.domain.TaskDO;
+import com.bootdo.common.service.JobService;
+import com.bootdo.common.utils.PageUtils;
+import com.bootdo.common.utils.Query;
+import com.bootdo.common.utils.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-09-26 20:53:48
+ */
+@Controller
+@RequestMapping("/common/job")
+public class JobController extends BaseController{
+	@Autowired
+	private JobService taskScheduleJobService;
+
+	@GetMapping()
+	String taskScheduleJob() {
+		return "common/job/job";
+	}
+
+	@ResponseBody
+	@GetMapping("/list")
+	public PageUtils list(@RequestParam Map<String, Object> params) {
+		// 查询列表数据
+		Query query = new Query(params);
+		List<TaskDO> taskScheduleJobList = taskScheduleJobService.list(query);
+		int total = taskScheduleJobService.count(query);
+		PageUtils pageUtils = new PageUtils(taskScheduleJobList, total);
+		return pageUtils;
+	}
+
+	@GetMapping("/add")
+	String add() {
+		return "common/job/add";
+	}
+
+	@GetMapping("/edit/{id}")
+	String edit(@PathVariable("id") Long id, Model model) {
+		TaskDO job = taskScheduleJobService.get(id);
+		model.addAttribute("job", job);
+		return "common/job/edit";
+	}
+
+	/**
+	 * 信息
+	 */
+	@RequestMapping("/info/{id}")
+	public R info(@PathVariable("id") Long id) {
+		TaskDO taskScheduleJob = taskScheduleJobService.get(id);
+		return R.ok().put("taskScheduleJob", taskScheduleJob);
+	}
+
+	/**
+	 * 保存
+	 */
+	@ResponseBody
+	@PostMapping("/save")
+	public R save(TaskDO taskScheduleJob) {
+		if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+			return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+		}
+		if (taskScheduleJobService.save(taskScheduleJob) > 0) {
+			return R.ok();
+		}
+		return R.error();
+	}
+
+	/**
+	 * 修改
+	 */
+	@ResponseBody
+	@PostMapping("/update")
+	public R update(TaskDO taskScheduleJob) {
+		if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+			return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+		}
+		taskScheduleJobService.update(taskScheduleJob);
+		return R.ok();
+	}
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ResponseBody
+	public R remove(Long id) {
+		if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+			return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+		}
+		if (taskScheduleJobService.remove(id) > 0) {
+			return R.ok();
+		}
+		return R.error();
+	}
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/batchRemove")
+	@ResponseBody
+	public R remove(@RequestParam("ids[]") Long[] ids) {
+		if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+			return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+		}
+		taskScheduleJobService.batchRemove(ids);
+
+		return R.ok();
+	}
+
+	@PostMapping(value = "/changeJobStatus")
+	@ResponseBody
+	public R changeJobStatus(Long id,String cmd ) {
+		if (Constant.DEMO_ACCOUNT.equals(getUsername())) {
+			return R.error(1, "演示系统不允许修改,完整体验请部署程序");
+		}
+		String label = "停止";
+		if ("start".equals(cmd)) {
+			label = "启动";
+		} else {
+			label = "停止";
+		}
+		try {
+			taskScheduleJobService.changeStatus(id, cmd);
+			return R.ok("任务" + label + "成功");
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return R.ok("任务" + label + "失败");
+	}
+
+}

+ 61 - 0
src/main/java/com/bootdo/common/controller/LogController.java

@@ -0,0 +1,61 @@
+package com.bootdo.common.controller;
+
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+import com.bootdo.common.annotation.Log;
+import com.bootdo.common.domain.LogDO;
+import com.bootdo.common.domain.PageDO;
+import com.bootdo.common.service.LogService;
+import com.bootdo.common.utils.Query;
+import com.bootdo.common.utils.R;
+
+@RequestMapping("/common/log")
+@Controller
+public class LogController {
+    @Autowired
+    LogService logService;
+    String prefix = "common/log";
+
+    @Log("访问系统日志")
+    @GetMapping()
+    String log() {
+        return prefix + "/log";
+    }
+
+    @GetMapping("/logView")
+    @Log("访问系统日志")
+    String logView() {
+        return prefix + "/logView";
+    }
+
+    @ResponseBody
+    @GetMapping("/list")
+    PageDO<LogDO> list(@RequestParam Map<String, Object> params) {
+        Query query = new Query(params);
+        PageDO<LogDO> page = logService.queryList(query);
+        return page;
+    }
+
+    @ResponseBody
+    @PostMapping("/remove")
+    R remove(Long id) {
+        if (logService.remove(id) > 0) {
+            return R.ok();
+        }
+        return R.error();
+    }
+
+    @ResponseBody
+    @PostMapping("/batchRemove")
+    R batchRemove(@RequestParam("ids[]") Long[] ids) {
+        int r = logService.batchRemove(ids);
+        if (r > 0) {
+            return R.ok();
+        }
+        return R.error();
+    }
+}

+ 36 - 0
src/main/java/com/bootdo/common/dao/DictDao.java

@@ -0,0 +1,36 @@
+package com.bootdo.common.dao;
+
+import com.bootdo.common.domain.DictDO;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 字典表
+ * 
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-10-03 15:45:42
+ */
+@Mapper
+public interface DictDao {
+
+	DictDO get(Long id);
+
+	List<DictDO> list(Map<String, Object> map);
+
+	int count(Map<String, Object> map);
+
+	int save(DictDO dict);
+
+	int update(DictDO dict);
+
+	int remove(Long id);
+
+	int batchRemove(Long[] ids);
+
+	List<DictDO> listType();
+
+	DictDO getProvinceByNameAndDescription(Map<String, Object> param);
+}

+ 32 - 0
src/main/java/com/bootdo/common/dao/FileDao.java

@@ -0,0 +1,32 @@
+package com.bootdo.common.dao;
+
+import com.bootdo.common.domain.FileDO;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 文件上传
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-10-03 15:45:42
+ */
+@Mapper
+public interface FileDao {
+
+	FileDO get(Long id);
+	
+	List<FileDO> list(Map<String,Object> map);
+	
+	int count(Map<String,Object> map);
+	
+	int save(FileDO file);
+	
+	int update(FileDO file);
+	
+	int remove(Long id);
+	
+	int batchRemove(Long[] ids);
+}

+ 23 - 0
src/main/java/com/bootdo/common/dao/GeneratorMapper.java

@@ -0,0 +1,23 @@
+package com.bootdo.common.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ibatis.annotations.Select;
+
+public interface GeneratorMapper {
+	@Select("select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables"
+			+ " where table_schema = (select database()) order by create_time desc")
+	List<Map<String, Object>> list();
+
+	@Select("select count(*) from information_schema.tables where table_schema = (select database())")
+	int count(Map<String, Object> map);
+
+	@Select("select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables \r\n"
+			+ "	where table_schema = (select database()) and table_name = #{tableName}")
+	Map<String, String> get(String tableName);
+
+	@Select("select column_name columnName, data_type dataType, column_comment columnComment, column_key columnKey, extra from information_schema.columns\r\n"
+			+ " where table_name = #{tableName} and table_schema = (select database()) order by ordinal_position")
+	List<Map<String, String>> listColumns(String tableName);
+}

+ 32 - 0
src/main/java/com/bootdo/common/dao/LogDao.java

@@ -0,0 +1,32 @@
+package com.bootdo.common.dao;
+
+import com.bootdo.common.domain.LogDO;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 系统日志
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-10-03 15:45:42
+ */
+@Mapper
+public interface LogDao {
+
+	LogDO get(Long id);
+	
+	List<LogDO> list(Map<String,Object> map);
+	
+	int count(Map<String,Object> map);
+	
+	int save(LogDO log);
+	
+	int update(LogDO log);
+	
+	int remove(Long id);
+	
+	int batchRemove(Long[] ids);
+}

+ 32 - 0
src/main/java/com/bootdo/common/dao/TaskDao.java

@@ -0,0 +1,32 @@
+package com.bootdo.common.dao;
+
+import com.bootdo.common.domain.TaskDO;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-10-03 15:45:42
+ */
+@Mapper
+public interface TaskDao {
+
+	TaskDO get(Long id);
+	
+	List<TaskDO> list(Map<String,Object> map);
+	
+	int count(Map<String,Object> map);
+	
+	int save(TaskDO task);
+	
+	int update(TaskDO task);
+	
+	int remove(Long id);
+	
+	int batchRemove(Long[] ids);
+}

+ 93 - 0
src/main/java/com/bootdo/common/domain/ColumnDO.java

@@ -0,0 +1,93 @@
+package com.bootdo.common.domain;
+
+/**
+ * 列的属性
+ * 
+ * 
+ */
+public class ColumnDO {
+	// 列名
+	private String columnName;
+	// 列名类型
+	private String dataType;
+	// 列名备注
+	private String comments;
+
+	// 属性名称(第一个字母大写),如:user_name => UserName
+	private String attrName;
+	// 属性名称(第一个字母小写),如:user_name => userName
+	private String attrname;
+	// 属性类型
+	private String attrType;
+	// auto_increment
+	private String extra;
+
+	public String getColumnName() {
+		return columnName;
+	}
+
+	public void setColumnName(String columnName) {
+		this.columnName = columnName;
+	}
+
+	public String getDataType() {
+		return dataType;
+	}
+
+	public void setDataType(String dataType) {
+		this.dataType = dataType;
+	}
+
+	public String getComments() {
+		return comments;
+	}
+
+	public void setComments(String comments) {
+		this.comments = comments;
+	}
+
+	public String getAttrname() {
+		return attrname;
+	}
+
+	public void setAttrname(String attrname) {
+		this.attrname = attrname;
+	}
+
+	public String getAttrName() {
+		return attrName;
+	}
+
+	public void setAttrName(String attrName) {
+		this.attrName = attrName;
+	}
+
+	public String getAttrType() {
+		return attrType;
+	}
+
+	public void setAttrType(String attrType) {
+		this.attrType = attrType;
+	}
+
+	public String getExtra() {
+		return extra;
+	}
+
+	public void setExtra(String extra) {
+		this.extra = extra;
+	}
+
+	@Override
+	public String toString() {
+		return "ColumnDO{" +
+				"columnName='" + columnName + '\'' +
+				", dataType='" + dataType + '\'' +
+				", comments='" + comments + '\'' +
+				", attrName='" + attrName + '\'' +
+				", attrname='" + attrname + '\'' +
+				", attrType='" + attrType + '\'' +
+				", extra='" + extra + '\'' +
+				'}';
+	}
+}

+ 221 - 0
src/main/java/com/bootdo/common/domain/DictDO.java

@@ -0,0 +1,221 @@
+package com.bootdo.common.domain;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+
+
+/**
+ * 字典表
+ * 
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-09-29 18:28:07
+ */
+public class DictDO implements Serializable {
+	private static final long serialVersionUID = 1L;
+	
+	//编号
+	private Long id;
+	//标签名
+	private String name;
+	//数据值
+	private String value;
+	//类型
+	private String type;
+	//描述
+	private String description;
+	//排序(升序)
+	private BigDecimal sort;
+	//父级编号
+	private Long parentId;
+	//创建者
+	private Integer createBy;
+	//创建时间
+	private Date createDate;
+	//更新者
+	private Long updateBy;
+	//更新时间
+	private Date updateDate;
+	//备注信息
+	private String remarks;
+	//删除标记
+	private String delFlag;
+
+	/**
+	 * 设置:编号
+	 */
+	public void setId(Long id) {
+		this.id = id;
+	}
+	/**
+	 * 获取:编号
+	 */
+	public Long getId() {
+		return id;
+	}
+	/**
+	 * 设置:标签名
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+	/**
+	 * 获取:标签名
+	 */
+	public String getName() {
+		return name;
+	}
+	/**
+	 * 设置:数据值
+	 */
+	public void setValue(String value) {
+		this.value = value;
+	}
+	/**
+	 * 获取:数据值
+	 */
+	public String getValue() {
+		return value;
+	}
+	/**
+	 * 设置:类型
+	 */
+	public void setType(String type) {
+		this.type = type;
+	}
+	/**
+	 * 获取:类型
+	 */
+	public String getType() {
+		return type;
+	}
+	/**
+	 * 设置:描述
+	 */
+	public void setDescription(String description) {
+		this.description = description;
+	}
+	/**
+	 * 获取:描述
+	 */
+	public String getDescription() {
+		return description;
+	}
+	/**
+	 * 设置:排序(升序)
+	 */
+	public void setSort(BigDecimal sort) {
+		this.sort = sort;
+	}
+	/**
+	 * 获取:排序(升序)
+	 */
+	public BigDecimal getSort() {
+		return sort;
+	}
+	/**
+	 * 设置:父级编号
+	 */
+	public void setParentId(Long parentId) {
+		this.parentId = parentId;
+	}
+	/**
+	 * 获取:父级编号
+	 */
+	public Long getParentId() {
+		return parentId;
+	}
+	/**
+	 * 设置:创建者
+	 */
+	public void setCreateBy(Integer createBy) {
+		this.createBy = createBy;
+	}
+	/**
+	 * 获取:创建者
+	 */
+	public Integer getCreateBy() {
+		return createBy;
+	}
+	/**
+	 * 设置:创建时间
+	 */
+	public void setCreateDate(Date createDate) {
+		this.createDate = createDate;
+	}
+	/**
+	 * 获取:创建时间
+	 */
+	public Date getCreateDate() {
+		return createDate;
+	}
+	/**
+	 * 设置:更新者
+	 */
+	public void setUpdateBy(Long updateBy) {
+		this.updateBy = updateBy;
+	}
+	/**
+	 * 获取:更新者
+	 */
+	public Long getUpdateBy() {
+		return updateBy;
+	}
+	/**
+	 * 设置:更新时间
+	 */
+	public void setUpdateDate(Date updateDate) {
+		this.updateDate = updateDate;
+	}
+	/**
+	 * 获取:更新时间
+	 */
+	public Date getUpdateDate() {
+		return updateDate;
+	}
+	/**
+	 * 设置:备注信息
+	 */
+	public void setRemarks(String remarks) {
+		this.remarks = remarks;
+	}
+	/**
+	 * 获取:备注信息
+	 */
+	public String getRemarks() {
+		return remarks;
+	}
+	/**
+	 * 设置:删除标记
+	 */
+	public void setDelFlag(String delFlag) {
+		this.delFlag = delFlag;
+	}
+	/**
+	 * 获取:删除标记
+	 */
+	public String getDelFlag() {
+		return delFlag;
+	}
+
+	@Override
+	public String toString() {
+		return "DictDO{" +
+				"id=" + id +
+				", name='" + name + '\'' +
+				", value='" + value + '\'' +
+				", type='" + type + '\'' +
+				", description='" + description + '\'' +
+				", sort=" + sort +
+				", parentId=" + parentId +
+				", createBy=" + createBy +
+				", createDate=" + createDate +
+				", updateBy=" + updateBy +
+				", updateDate=" + updateDate +
+				", remarks='" + remarks + '\'' +
+				", delFlag='" + delFlag + '\'' +
+				'}';
+	}
+}

+ 104 - 0
src/main/java/com/bootdo/common/domain/FileDO.java

@@ -0,0 +1,104 @@
+package com.bootdo.common.domain;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 文件上传
+ *
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-09-19 16:02:20
+ */
+public class FileDO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    //
+    private Long id;
+    // 文件类型
+    private Integer type;
+    // URL地址
+    private String url;
+    // 创建时间
+    private Date createDate;
+
+
+    public FileDO() {
+        super();
+    }
+
+
+    public FileDO(Integer type, String url, Date createDate) {
+        super();
+        this.type = type;
+        this.url = url;
+        this.createDate = createDate;
+    }
+
+
+    /**
+     * 设置:
+     */
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取:
+     */
+    public Long getId() {
+        return id;
+    }
+
+    /**
+     * 设置:文件类型
+     */
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    /**
+     * 获取:文件类型
+     */
+    public Integer getType() {
+        return type;
+    }
+
+    /**
+     * 设置:URL地址
+     */
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    /**
+     * 获取:URL地址
+     */
+    public String getUrl() {
+        return url;
+    }
+
+    /**
+     * 设置:创建时间
+     */
+    public void setCreateDate(Date createDate) {
+        this.createDate = createDate;
+    }
+
+    /**
+     * 获取:创建时间
+     */
+    public Date getCreateDate() {
+        return createDate;
+    }
+
+    @Override
+    public String toString() {
+        return "FileDO{" +
+                "id=" + id +
+                ", type=" + type +
+                ", url='" + url + '\'' +
+                ", createDate=" + createDate +
+                '}';
+    }
+}

+ 112 - 0
src/main/java/com/bootdo/common/domain/LogDO.java

@@ -0,0 +1,112 @@
+package com.bootdo.common.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+public class LogDO {
+	private Long id;
+
+	private Long userId;
+
+	private String username;
+
+	private String operation;
+
+	private Integer time;
+
+	private String method;
+
+	private String params;
+
+	private String ip;
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+	private Date gmtCreate;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Long userId) {
+		this.userId = userId;
+	}
+
+	public String getUsername() {
+		return username;
+	}
+
+	public void setUsername(String username) {
+		this.username = username == null ? null : username.trim();
+	}
+
+	public String getOperation() {
+		return operation;
+	}
+
+	public void setOperation(String operation) {
+		this.operation = operation == null ? null : operation.trim();
+	}
+
+	public Integer getTime() {
+		return time;
+	}
+
+	public void setTime(Integer time) {
+		this.time = time;
+	}
+
+	public String getMethod() {
+		return method;
+	}
+
+	public void setMethod(String method) {
+		this.method = method == null ? null : method.trim();
+	}
+
+	public String getParams() {
+		return params;
+	}
+
+	public void setParams(String params) {
+		this.params = params == null ? null : params.trim();
+	}
+
+	public String getIp() {
+		return ip;
+	}
+
+	public void setIp(String ip) {
+		this.ip = ip == null ? null : ip.trim();
+	}
+
+	public Date getGmtCreate() {
+		return gmtCreate;
+	}
+
+	public void setGmtCreate(Date gmtCreate) {
+		this.gmtCreate = gmtCreate;
+	}
+
+	@Override
+	public String toString() {
+		return "LogDO{" +
+				"id=" + id +
+				", userId=" + userId +
+				", username='" + username + '\'' +
+				", operation='" + operation + '\'' +
+				", time=" + time +
+				", method='" + method + '\'' +
+				", params='" + params + '\'' +
+				", ip='" + ip + '\'' +
+				", gmtCreate=" + gmtCreate +
+				'}';
+	}
+}

+ 86 - 0
src/main/java/com/bootdo/common/domain/PageDO.java

@@ -0,0 +1,86 @@
+package com.bootdo.common.domain;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class PageDO<T> {
+
+	private int offset;
+	private int limit;
+	private int total;
+	private Map<String, Object> params;
+	private String param;
+	private List<T> rows;
+
+	public PageDO() {
+		super();
+		this.offset = 0;
+		this.limit = 10;
+		this.total = 1;
+		this.params = new HashMap<>();
+		this.param = "";
+		this.rows = new ArrayList<>();
+	}
+
+	public int getOffset() {
+		return offset;
+	}
+
+	public void setOffset(int offset) {
+		this.offset = offset;
+	}
+
+	public int getLimit() {
+		return limit;
+	}
+
+	public void setLimit(int limit) {
+		this.limit = limit;
+	}
+
+	public int getTotal() {
+		return total;
+	}
+
+	public void setTotal(int total) {
+		this.total = total;
+	}
+
+	public Map<String, Object> getParams() {
+		return params;
+	}
+
+	public void setParams(Map<String, Object> params) {
+		this.params = params;
+	}
+
+	public List<T> getRows() {
+		return rows;
+	}
+
+	public void setRows(List<T> rows) {
+		this.rows = rows;
+	}
+
+	public String getParam() {
+		return param;
+	}
+
+	public void setParam(String param) {
+		this.param = param;
+	}
+
+	@Override
+	public String toString() {
+		return "PageDO{" +
+				"offset=" + offset +
+				", limit=" + limit +
+				", total=" + total +
+				", params=" + params +
+				", param='" + param + '\'' +
+				", rows=" + rows +
+				'}';
+	}
+}

+ 135 - 0
src/main/java/com/bootdo/common/domain/ScheduleJob.java

@@ -0,0 +1,135 @@
+package com.bootdo.common.domain;
+
+import java.io.Serializable;
+
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+@SuppressWarnings("serial")
+public class ScheduleJob implements Serializable ,Job {
+
+	public static final String STATUS_RUNNING = "1";
+	public static final String STATUS_NOT_RUNNING = "0";
+	public static final String CONCURRENT_IS = "1";
+	public static final String CONCURRENT_NOT = "0";
+
+	/**
+	 * 任务名称
+	 */
+	private String jobName;
+	/**
+	 * 任务分组
+	 */
+	private String jobGroup;
+	/**
+	 * 任务状态 是否启动任务
+	 */
+	private String jobStatus;
+	/**
+	 * cron表达式
+	 */
+	private String cronExpression;
+	/**
+	 * 描述
+	 */
+	private String description;
+	/**
+	 * 任务执行时调用哪个类的方法 包名+类名
+	 */
+	private String beanClass;
+	/**
+	 * 任务是否有状态
+	 */
+	private String isConcurrent;
+
+	/**
+	 * Spring bean
+	 */
+	private String springBean;
+
+	/**
+	 * 任务调用的方法名
+	 */
+	private String methodName;
+
+	public String getJobName() {
+		return jobName;
+	}
+
+	public void setJobName(String jobName) {
+		this.jobName = jobName;
+	}
+
+	public String getJobGroup() {
+		return jobGroup;
+	}
+
+	public void setJobGroup(String jobGroup) {
+		this.jobGroup = jobGroup;
+	}
+
+	public String getJobStatus() {
+		return jobStatus;
+	}
+
+	public void setJobStatus(String jobStatus) {
+		this.jobStatus = jobStatus;
+	}
+
+	public String getCronExpression() {
+		return cronExpression;
+	}
+
+	public void setCronExpression(String cronExpression) {
+		this.cronExpression = cronExpression;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	public String getBeanClass() {
+		return beanClass;
+	}
+
+	public void setBeanClass(String beanClass) {
+		this.beanClass = beanClass;
+	}
+
+	public String getIsConcurrent() {
+		return isConcurrent;
+	}
+
+	public void setIsConcurrent(String isConcurrent) {
+		this.isConcurrent = isConcurrent;
+	}
+
+	public String getMethodName() {
+		return methodName;
+	}
+
+	public void setMethodName(String methodName) {
+		this.methodName = methodName;
+	}
+
+	public String getSpringBean() {
+		return springBean;
+	}
+
+	public void setSpringBean(String springBean) {
+		this.springBean = springBean;
+	}
+
+	@Override
+	public void execute(JobExecutionContext context) throws JobExecutionException {
+		// TODO Auto-generated method stub
+		
+	}
+
+
+}

+ 86 - 0
src/main/java/com/bootdo/common/domain/TableDO.java

@@ -0,0 +1,86 @@
+package com.bootdo.common.domain;
+
+import java.util.List;
+
+/**
+ * 表数据
+ *
+ * @author chenshun
+ * @email sunlightcs@gmail.com
+ * @date 2016年12月20日 上午12:02:55
+ */
+public class TableDO {
+    //表的名称
+    private String tableName;
+    //表的备注
+    private String comments;
+    //表的主键
+    private ColumnDO pk;
+    //表的列名(不包含主键)
+    private List<ColumnDO> columns;
+
+    //类名(第一个字母大写),如:sys_user => SysUser
+    private String className;
+    //类名(第一个字母小写),如:sys_user => sysUser
+    private String classname;
+
+    public String getTableName() {
+        return tableName;
+    }
+
+    public void setTableName(String tableName) {
+        this.tableName = tableName;
+    }
+
+    public String getComments() {
+        return comments;
+    }
+
+    public void setComments(String comments) {
+        this.comments = comments;
+    }
+
+    public ColumnDO getPk() {
+        return pk;
+    }
+
+    public void setPk(ColumnDO pk) {
+        this.pk = pk;
+    }
+
+    public List<ColumnDO> getColumns() {
+        return columns;
+    }
+
+    public void setColumns(List<ColumnDO> columns) {
+        this.columns = columns;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+
+    public String getClassname() {
+        return classname;
+    }
+
+    public void setClassname(String classname) {
+        this.classname = classname;
+    }
+
+    @Override
+    public String toString() {
+        return "TableDO{" +
+                "tableName='" + tableName + '\'' +
+                ", comments='" + comments + '\'' +
+                ", pk=" + pk +
+                ", columns=" + columns +
+                ", className='" + className + '\'' +
+                ", classname='" + classname + '\'' +
+                '}';
+    }
+}

+ 258 - 0
src/main/java/com/bootdo/common/domain/TaskDO.java

@@ -0,0 +1,258 @@
+package com.bootdo.common.domain;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-09-25 15:09:21
+ */
+public class TaskDO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    //
+    private Long id;
+    // cron表达式
+    private String cronExpression;
+    // 任务调用的方法名
+    private String methodName;
+    // 任务是否有状态
+    private String isConcurrent;
+    // 任务描述
+    private String description;
+    // 更新者
+    private String updateBy;
+    // 任务执行时调用哪个类的方法 包名+类名
+    private String beanClass;
+    // 创建时间
+    private Date createDate;
+    // 任务状态
+    private String jobStatus;
+    // 任务分组
+    private String jobGroup;
+    // 更新时间
+    private Date updateDate;
+    // 创建者
+    private String createBy;
+    // Spring bean
+    private String springBean;
+    // 任务名
+    private String jobName;
+
+    /**
+     * 设置:
+     */
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取:
+     */
+    public Long getId() {
+        return id;
+    }
+
+    /**
+     * 设置:cron表达式
+     */
+    public void setCronExpression(String cronExpression) {
+        this.cronExpression = cronExpression;
+    }
+
+    /**
+     * 获取:cron表达式
+     */
+    public String getCronExpression() {
+        return cronExpression;
+    }
+
+    /**
+     * 设置:任务调用的方法名
+     */
+    public void setMethodName(String methodName) {
+        this.methodName = methodName;
+    }
+
+    /**
+     * 获取:任务调用的方法名
+     */
+    public String getMethodName() {
+        return methodName;
+    }
+
+    /**
+     * 设置:任务是否有状态
+     */
+    public void setIsConcurrent(String isConcurrent) {
+        this.isConcurrent = isConcurrent;
+    }
+
+    /**
+     * 获取:任务是否有状态
+     */
+    public String getIsConcurrent() {
+        return isConcurrent;
+    }
+
+    /**
+     * 设置:任务描述
+     */
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * 获取:任务描述
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * 设置:更新者
+     */
+    public void setUpdateBy(String updateBy) {
+        this.updateBy = updateBy;
+    }
+
+    /**
+     * 获取:更新者
+     */
+    public String getUpdateBy() {
+        return updateBy;
+    }
+
+    /**
+     * 设置:任务执行时调用哪个类的方法 包名+类名
+     */
+    public void setBeanClass(String beanClass) {
+        this.beanClass = beanClass;
+    }
+
+    /**
+     * 获取:任务执行时调用哪个类的方法 包名+类名
+     */
+    public String getBeanClass() {
+        return beanClass;
+    }
+
+    /**
+     * 设置:创建时间
+     */
+    public void setCreateDate(Date createDate) {
+        this.createDate = createDate;
+    }
+
+    /**
+     * 获取:创建时间
+     */
+    public Date getCreateDate() {
+        return createDate;
+    }
+
+    /**
+     * 设置:任务状态
+     */
+    public void setJobStatus(String jobStatus) {
+        this.jobStatus = jobStatus;
+    }
+
+    /**
+     * 获取:任务状态
+     */
+    public String getJobStatus() {
+        return jobStatus;
+    }
+
+    /**
+     * 设置:任务分组
+     */
+    public void setJobGroup(String jobGroup) {
+        this.jobGroup = jobGroup;
+    }
+
+    /**
+     * 获取:任务分组
+     */
+    public String getJobGroup() {
+        return jobGroup;
+    }
+
+    /**
+     * 设置:更新时间
+     */
+    public void setUpdateDate(Date updateDate) {
+        this.updateDate = updateDate;
+    }
+
+    /**
+     * 获取:更新时间
+     */
+    public Date getUpdateDate() {
+        return updateDate;
+    }
+
+    /**
+     * 设置:创建者
+     */
+    public void setCreateBy(String createBy) {
+        this.createBy = createBy;
+    }
+
+    /**
+     * 获取:创建者
+     */
+    public String getCreateBy() {
+        return createBy;
+    }
+
+    /**
+     * 设置:Spring bean
+     */
+    public void setSpringBean(String springBean) {
+        this.springBean = springBean;
+    }
+
+    /**
+     * 获取:Spring bean
+     */
+    public String getSpringBean() {
+        return springBean;
+    }
+
+    /**
+     * 设置:任务名
+     */
+    public void setJobName(String jobName) {
+        this.jobName = jobName;
+    }
+
+    /**
+     * 获取:任务名
+     */
+    public String getJobName() {
+        return jobName;
+    }
+
+    @Override
+    public String toString() {
+        return "TaskDO{" +
+                "id=" + id +
+                ", cronExpression='" + cronExpression + '\'' +
+                ", methodName='" + methodName + '\'' +
+                ", isConcurrent='" + isConcurrent + '\'' +
+                ", description='" + description + '\'' +
+                ", updateBy='" + updateBy + '\'' +
+                ", beanClass='" + beanClass + '\'' +
+                ", createDate=" + createDate +
+                ", jobStatus='" + jobStatus + '\'' +
+                ", jobGroup='" + jobGroup + '\'' +
+                ", updateDate=" + updateDate +
+                ", createBy='" + createBy + '\'' +
+                ", springBean='" + springBean + '\'' +
+                ", jobName='" + jobName + '\'' +
+                '}';
+    }
+}

+ 151 - 0
src/main/java/com/bootdo/common/domain/Tree.java

@@ -0,0 +1,151 @@
+package com.bootdo.common.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.alibaba.fastjson.JSON;
+
+/**
+ * tree TODO <br>
+ * 
+ * @author kangxu2 2017-1-7
+ * 
+ */
+public class Tree<T> {
+	/**
+	 * 节点ID
+	 */
+	private String id;
+	/**
+	 * 显示节点文本
+	 */
+	private String text;
+	/**
+	 * 节点状态,open closed
+	 */
+	private Map<String, Object> state;
+	/**
+	 * 节点是否被选中 true false
+	 */
+	private boolean checked = false;
+	/**
+	 * 节点属性
+	 */
+	private Map<String, Object> attributes;
+
+	/**
+	 * 节点的子节点
+	 */
+	private List<Tree<T>> children = new ArrayList<Tree<T>>();
+
+	/**
+	 * 父ID
+	 */
+	private String parentId;
+	/**
+	 * 是否有父节点
+	 */
+	private boolean hasParent = false;
+	/**
+	 * 是否有子节点
+	 */
+	private boolean hasChildren = false;
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public String getText() {
+		return text;
+	}
+
+	public void setText(String text) {
+		this.text = text;
+	}
+
+	public Map<String, Object> getState() {
+		return state;
+	}
+
+	public void setState(Map<String, Object> state) {
+		this.state = state;
+	}
+
+	public boolean isChecked() {
+		return checked;
+	}
+
+	public void setChecked(boolean checked) {
+		this.checked = checked;
+	}
+
+	public Map<String, Object> getAttributes() {
+		return attributes;
+	}
+
+	public void setAttributes(Map<String, Object> attributes) {
+		this.attributes = attributes;
+	}
+
+	public List<Tree<T>> getChildren() {
+		return children;
+	}
+
+	public void setChildren(List<Tree<T>> children) {
+		this.children = children;
+	}
+
+	public boolean isHasParent() {
+		return hasParent;
+	}
+
+	public void setHasParent(boolean isParent) {
+		this.hasParent = isParent;
+	}
+
+	public boolean isHasChildren() {
+		return hasChildren;
+	}
+
+	public void setChildren(boolean isChildren) {
+		this.hasChildren = isChildren;
+	}
+
+	public String getParentId() {
+		return parentId;
+	}
+
+	public void setParentId(String parentId) {
+		this.parentId = parentId;
+	}
+
+	public Tree(String id, String text, Map<String, Object> state, boolean checked, Map<String, Object> attributes,
+			List<Tree<T>> children, boolean isParent, boolean isChildren, String parentID) {
+		super();
+		this.id = id;
+		this.text = text;
+		this.state = state;
+		this.checked = checked;
+		this.attributes = attributes;
+		this.children = children;
+		this.hasParent = isParent;
+		this.hasChildren = isChildren;
+		this.parentId = parentID;
+	}
+
+	public Tree() {
+		super();
+	}
+
+	@Override
+	public String toString() {
+
+		return JSON.toJSONString(this);
+	}
+
+}

+ 51 - 0
src/main/java/com/bootdo/common/exception/BDException.java

@@ -0,0 +1,51 @@
+package com.bootdo.common.exception;
+
+/**
+ * 自定义异常
+ */
+public class BDException extends RuntimeException {
+	private static final long serialVersionUID = 1L;
+	
+    private String msg;
+    private int code = 500;
+    
+    public BDException(String msg) {
+		super(msg);
+		this.msg = msg;
+	}
+	
+	public BDException(String msg, Throwable e) {
+		super(msg, e);
+		this.msg = msg;
+	}
+	
+	public BDException(String msg, int code) {
+		super(msg);
+		this.msg = msg;
+		this.code = code;
+	}
+	
+	public BDException(String msg, int code, Throwable e) {
+		super(msg, e);
+		this.msg = msg;
+		this.code = code;
+	}
+
+	public String getMsg() {
+		return msg;
+	}
+
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+
+	public int getCode() {
+		return code;
+	}
+
+	public void setCode(int code) {
+		this.code = code;
+	}
+	
+	
+}

+ 87 - 0
src/main/java/com/bootdo/common/exception/BDExceptionHandler.java

@@ -0,0 +1,87 @@
+package com.bootdo.common.exception;
+
+import com.bootdo.common.config.Constant;
+import com.bootdo.common.domain.LogDO;
+import com.bootdo.common.service.LogService;
+import com.bootdo.common.utils.ExceptionUtils;
+import com.bootdo.common.utils.HttpServletUtils;
+import com.bootdo.common.utils.R;
+import com.bootdo.common.utils.ShiroUtils;
+import com.bootdo.system.domain.UserDO;
+import org.apache.shiro.authz.AuthorizationException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DuplicateKeyException;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Date;
+
+/**
+ * 异常处理器
+ */
+@RestControllerAdvice
+public class BDExceptionHandler {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+    @Autowired
+    LogService logService;
+//
+//    /**
+//     * 自定义异常
+//     */
+//    @ExceptionHandler(BDException.class)
+//    public R handleBDException(BDException e) {
+//        logger.error(e.getMessage(), e);
+//        R r = new R();
+//        r.put("code", e.getCode());
+//        r.put("msg", e.getMessage());
+//        return r;
+//    }
+//
+//    @ExceptionHandler(DuplicateKeyException.class)
+//    public R handleDuplicateKeyException(DuplicateKeyException e) {
+//        logger.error(e.getMessage(), e);
+//        return R.error("数据库中已存在该记录");
+//    }
+//
+//    @ExceptionHandler(org.springframework.web.servlet.NoHandlerFoundException.class)
+//    public R noHandlerFoundException(org.springframework.web.servlet.NoHandlerFoundException e) {
+//        logger.error(e.getMessage(), e);
+//        return R.error(404, "没找找到页面");
+//    }
+
+    @ExceptionHandler(AuthorizationException.class)
+    public Object handleAuthorizationException(AuthorizationException e, HttpServletRequest request) {
+        logger.error(e.getMessage(), e);
+        if (HttpServletUtils.jsAjax(request)) {
+            return R.error(403, "未授权");
+        }
+        return new ModelAndView("error/403");
+    }
+
+
+    @ExceptionHandler({Exception.class})
+    public Object handleException(Exception e, HttpServletRequest request) {
+        LogDO logDO = new LogDO();
+        logDO.setGmtCreate(new Date());
+        logDO.setOperation(Constant.LOG_ERROR);
+        logDO.setMethod(request.getRequestURL().toString());
+        logDO.setParams(e.toString());
+        UserDO current = ShiroUtils.getUser();
+        if(null!=current){
+            logDO.setUserId(current.getUserId());
+            logDO.setUsername(current.getUsername());
+        }
+        logService.save(logDO);
+        logger.error(e.getMessage(), e);
+        if (HttpServletUtils.jsAjax(request)) {
+            return R.error(500, "服务器错误,请联系管理员");
+        }
+        return new ModelAndView("error/500");
+    }
+}

+ 66 - 0
src/main/java/com/bootdo/common/exception/MainsiteErrorController.java

@@ -0,0 +1,66 @@
+package com.bootdo.common.exception;
+
+
+import com.bootdo.common.utils.R;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.web.servlet.error.ErrorAttributes;
+import org.springframework.boot.web.servlet.error.ErrorController;
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+
+@RestController
+public class MainsiteErrorController implements ErrorController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+    private static final String ERROR_PATH = "/error";
+
+    @Autowired
+    ErrorAttributes errorAttributes;
+
+    @RequestMapping(
+            value = {ERROR_PATH},
+            produces = {"text/html"}
+    )
+    public ModelAndView errorHtml(HttpServletRequest request, HttpServletResponse response) {
+        int code = response.getStatus();
+        if (404 == code) {
+            return new ModelAndView("error/404");
+        } else if (403 == code) {
+            return new ModelAndView("error/403");
+        } else if (401 == code) {
+            return new ModelAndView("login");
+        } else {
+            return new ModelAndView("error/500");
+        }
+
+    }
+
+    @RequestMapping(value = ERROR_PATH)
+    public R handleError(HttpServletRequest request, HttpServletResponse response) {
+        response.setStatus(200);
+        int code = response.getStatus();
+        if (404 == code) {
+            return R.error(404, "未找到资源");
+        } else if (403 == code) {
+            return R.error(403, "没有访问权限");
+        } else if (401 == code) {
+            return R.error(403, "登录过期");
+        } else {
+            return R.error(500, "服务器错误");
+        }
+    }
+
+    @Override
+    public String getErrorPath() {
+        // TODO Auto-generated method stub
+        return ERROR_PATH;
+    }
+}

+ 31 - 0
src/main/java/com/bootdo/common/listenner/ScheduleJobInitListener.java

@@ -0,0 +1,31 @@
+package com.bootdo.common.listenner;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+import com.bootdo.common.quartz.utils.QuartzManager;
+import com.bootdo.common.service.JobService;
+
+@Component
+@Order(value = 1)
+public class ScheduleJobInitListener implements CommandLineRunner {
+
+	@Autowired
+	JobService scheduleJobService;
+
+	@Autowired
+	QuartzManager quartzManager;
+
+	@Override
+	public void run(String... arg0) throws Exception {
+		try {
+			scheduleJobService.initSchedule();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+	}
+
+}

+ 21 - 0
src/main/java/com/bootdo/common/quartz/factory/JobFactory.java

@@ -0,0 +1,21 @@
+package com.bootdo.common.quartz.factory;
+
+import org.quartz.spi.TriggerFiredBundle;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
+import org.springframework.scheduling.quartz.AdaptableJobFactory;
+import org.springframework.stereotype.Component;
+@Component
+public class JobFactory extends AdaptableJobFactory {
+    @Autowired
+    private AutowireCapableBeanFactory capableBeanFactory;
+
+    @Override
+    protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
+        //调用父类的方法
+        Object jobInstance = super.createJobInstance(bundle);
+        //进行注入
+        capableBeanFactory.autowireBean(jobInstance);
+        return jobInstance;
+    }
+}

+ 227 - 0
src/main/java/com/bootdo/common/quartz/utils/QuartzManager.java

@@ -0,0 +1,227 @@
+package com.bootdo.common.quartz.utils;
+
+import com.bootdo.common.domain.ScheduleJob;
+import org.quartz.*;
+import org.quartz.DateBuilder.IntervalUnit;
+import org.quartz.impl.matchers.GroupMatcher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+/**
+ * 
+ * 
+ * @title: QuartzManager.java
+ * @description: 计划任务管理
+ *
+ */
+@Service
+public class QuartzManager {
+	public final Logger log = LoggerFactory.getLogger(QuartzManager.class);
+	// private SchedulerFactoryBean schedulerFactoryBean
+	// =SpringContextHolder.getBean(SchedulerFactoryBean.class);
+	// @Autowired
+	// @Qualifier("schedulerFactoryBean")
+	// private SchedulerFactoryBean schedulerFactoryBean;
+	@Autowired
+	private Scheduler scheduler;
+
+	/**
+	 * 添加任务
+	 * 
+	 * @param scheduleJob
+	 * @throws SchedulerException
+	 */
+	
+	public void addJob(ScheduleJob job) {
+		try {
+			// 创建jobDetail实例,绑定Job实现类
+			// 指明job的名称,所在组的名称,以及绑定job类
+
+			Class<? extends Job> jobClass = (Class<? extends Job>) (Class.forName(job.getBeanClass()).newInstance()
+					.getClass());
+			JobDetail jobDetail = JobBuilder.newJob(jobClass).withIdentity(job.getJobName(), job.getJobGroup())// 任务名称和组构成任务key
+					.build();
+			// 定义调度触发规则
+			// 使用cornTrigger规则
+			Trigger trigger = TriggerBuilder.newTrigger().withIdentity(job.getJobName(), job.getJobGroup())// 触发器key
+					.startAt(DateBuilder.futureDate(1, IntervalUnit.SECOND))
+					.withSchedule(CronScheduleBuilder.cronSchedule(job.getCronExpression())).startNow().build();
+			// 把作业和触发器注册到任务调度中
+			scheduler.scheduleJob(jobDetail, trigger);
+			// 启动
+			if (!scheduler.isShutdown()) {
+				scheduler.start();
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+//	public void addJob(ScheduleJob job) throws SchedulerException {
+//		if (job == null || !ScheduleJob.STATUS_RUNNING.equals(job.getJobStatus())) {
+//			return;
+//		}
+//
+//		TriggerKey triggerKey = TriggerKey.triggerKey(job.getJobName(), job.getJobGroup());
+//
+//		CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey);
+//
+//		// 不存在,创建一个
+//
+//		if (null == trigger) {
+//			Class<? extends Job> clazz = ScheduleJob.CONCURRENT_IS.equals(job.getIsConcurrent())
+//					? QuartzJobFactory.class
+//					: QuartzJobFactoryDisallowConcurrentExecution.class;
+//
+//			JobDetail jobDetail = JobBuilder.newJob(clazz).withIdentity(job.getJobName(), job.getJobGroup()).build();
+//
+//			jobDetail.getJobDataMap().put("scheduleJob", job);
+//
+//			CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression());
+//
+//			trigger = TriggerBuilder.newTrigger().withIdentity(job.getJobName(), job.getJobGroup())
+//					.withSchedule(scheduleBuilder).build();
+//
+//			scheduler.scheduleJob(jobDetail, trigger);
+//		} else {
+//			// Trigger已存在,那么更新相应的定时设置
+//
+//			CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression());
+//
+//			// 按新的cronExpression表达式重新构建trigger
+//
+//			trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build();
+//
+//			// 按新的trigger重新设置job执行
+//
+//			scheduler.rescheduleJob(triggerKey, trigger);
+//		}
+//	}
+
+	/**
+	 * 获取所有计划中的任务列表
+	 * 
+	 * @return
+	 * @throws SchedulerException
+	 */
+	public List<ScheduleJob> getAllJob() throws SchedulerException {
+		GroupMatcher<JobKey> matcher = GroupMatcher.anyJobGroup();
+		Set<JobKey> jobKeys = scheduler.getJobKeys(matcher);
+		List<ScheduleJob> jobList = new ArrayList<ScheduleJob>();
+		for (JobKey jobKey : jobKeys) {
+			List<? extends Trigger> triggers = scheduler.getTriggersOfJob(jobKey);
+			for (Trigger trigger : triggers) {
+				ScheduleJob job = new ScheduleJob();
+				job.setJobName(jobKey.getName());
+				job.setJobGroup(jobKey.getGroup());
+				job.setDescription("触发器:" + trigger.getKey());
+				Trigger.TriggerState triggerState = scheduler.getTriggerState(trigger.getKey());
+				job.setJobStatus(triggerState.name());
+				if (trigger instanceof CronTrigger) {
+					CronTrigger cronTrigger = (CronTrigger) trigger;
+					String cronExpression = cronTrigger.getCronExpression();
+					job.setCronExpression(cronExpression);
+				}
+				jobList.add(job);
+			}
+		}
+		return jobList;
+	}
+
+	/**
+	 * 所有正在运行的job
+	 * 
+	 * @return
+	 * @throws SchedulerException
+	 */
+	public List<ScheduleJob> getRunningJob() throws SchedulerException {
+		List<JobExecutionContext> executingJobs = scheduler.getCurrentlyExecutingJobs();
+		List<ScheduleJob> jobList = new ArrayList<ScheduleJob>(executingJobs.size());
+		for (JobExecutionContext executingJob : executingJobs) {
+			ScheduleJob job = new ScheduleJob();
+			JobDetail jobDetail = executingJob.getJobDetail();
+			JobKey jobKey = jobDetail.getKey();
+			Trigger trigger = executingJob.getTrigger();
+			job.setJobName(jobKey.getName());
+			job.setJobGroup(jobKey.getGroup());
+			job.setDescription("触发器:" + trigger.getKey());
+			Trigger.TriggerState triggerState = scheduler.getTriggerState(trigger.getKey());
+			job.setJobStatus(triggerState.name());
+			if (trigger instanceof CronTrigger) {
+				CronTrigger cronTrigger = (CronTrigger) trigger;
+				String cronExpression = cronTrigger.getCronExpression();
+				job.setCronExpression(cronExpression);
+			}
+			jobList.add(job);
+		}
+		return jobList;
+	}
+
+	/**
+	 * 暂停一个job
+	 * 
+	 * @param scheduleJob
+	 * @throws SchedulerException
+	 */
+	public void pauseJob(ScheduleJob scheduleJob) throws SchedulerException {
+		JobKey jobKey = JobKey.jobKey(scheduleJob.getJobName(), scheduleJob.getJobGroup());
+		scheduler.pauseJob(jobKey);
+	}
+
+	/**
+	 * 恢复一个job
+	 * 
+	 * @param scheduleJob
+	 * @throws SchedulerException
+	 */
+	public void resumeJob(ScheduleJob scheduleJob) throws SchedulerException {
+		JobKey jobKey = JobKey.jobKey(scheduleJob.getJobName(), scheduleJob.getJobGroup());
+		scheduler.resumeJob(jobKey);
+	}
+
+	/**
+	 * 删除一个job
+	 * 
+	 * @param scheduleJob
+	 * @throws SchedulerException
+	 */
+	public void deleteJob(ScheduleJob scheduleJob) throws SchedulerException {
+		JobKey jobKey = JobKey.jobKey(scheduleJob.getJobName(), scheduleJob.getJobGroup());
+		scheduler.deleteJob(jobKey);
+
+	}
+
+	/**
+	 * 立即执行job
+	 * 
+	 * @param scheduleJob
+	 * @throws SchedulerException
+	 */
+	public void runAJobNow(ScheduleJob scheduleJob) throws SchedulerException {
+		JobKey jobKey = JobKey.jobKey(scheduleJob.getJobName(), scheduleJob.getJobGroup());
+		scheduler.triggerJob(jobKey);
+	}
+
+	/**
+	 * 更新job时间表达式
+	 * 
+	 * @param scheduleJob
+	 * @throws SchedulerException
+	 */
+	public void updateJobCron(ScheduleJob scheduleJob) throws SchedulerException {
+
+		TriggerKey triggerKey = TriggerKey.triggerKey(scheduleJob.getJobName(), scheduleJob.getJobGroup());
+
+		CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey);
+
+		CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression());
+
+		trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build();
+
+		scheduler.rescheduleJob(triggerKey, trigger);
+	}
+}

+ 194 - 0
src/main/java/com/bootdo/common/redis/shiro/RedisCache.java

@@ -0,0 +1,194 @@
+package com.bootdo.common.redis.shiro;
+
+/**
+ * @author bootdo 1992lcg@163.com
+ * @version V1.0
+ */
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.shiro.cache.Cache;
+import org.apache.shiro.cache.CacheException;
+import org.apache.shiro.util.CollectionUtils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RedisCache<K, V> implements Cache<K, V> {
+
+    private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    /**
+     * The wrapped Jedis instance.
+     */
+    private RedisManager cache;
+
+    /**
+     * The Redis key prefix for the sessions
+     */
+    private String keyPrefix = "shiro_redis_session:";
+
+    /**
+     * Returns the Redis session keys
+     * prefix.
+     * @return The prefix
+     */
+    public String getKeyPrefix() {
+        return keyPrefix;
+    }
+
+    /**
+     * Sets the Redis sessions key
+     * prefix.
+     * @param keyPrefix The prefix
+     */
+    public void setKeyPrefix(String keyPrefix) {
+        this.keyPrefix = keyPrefix;
+    }
+
+    /**
+     * 通过一个JedisManager实例构造RedisCache
+     */
+    public RedisCache(RedisManager cache){
+        if (cache == null) {
+            throw new IllegalArgumentException("Cache argument cannot be null.");
+        }
+        this.cache = cache;
+    }
+
+    /**
+     * Constructs a cache instance with the specified
+     * Redis manager and using a custom key prefix.
+     * @param cache The cache manager instance
+     * @param prefix The Redis key prefix
+     */
+    public RedisCache(RedisManager cache,
+                      String prefix){
+
+        this( cache );
+
+        // set the prefix
+        this.keyPrefix = prefix;
+    }
+
+    /**
+     * 获得byte[]型的key
+     * @param key
+     * @return
+     */
+    private byte[] getByteKey(K key){
+        if(key instanceof String){
+            String preKey = this.keyPrefix + key;
+            return preKey.getBytes();
+        }else{
+            return SerializeUtils.serialize(key);
+        }
+    }
+
+    @Override
+    public V get(K key) throws CacheException {
+        logger.debug("根据key从Redis中获取对象 key [" + key + "]");
+        try {
+            if (key == null) {
+                return null;
+            }else{
+                byte[] rawValue = cache.get(getByteKey(key));
+                @SuppressWarnings("unchecked")
+                V value = (V)SerializeUtils.deserialize(rawValue);
+                return value;
+            }
+        } catch (Throwable t) {
+            throw new CacheException(t);
+        }
+
+    }
+
+    @Override
+    public V put(K key, V value) throws CacheException {
+        logger.debug("根据key从存储 key [" + key + "]");
+        try {
+            cache.set(getByteKey(key), SerializeUtils.serialize(value));
+            return value;
+        } catch (Throwable t) {
+            throw new CacheException(t);
+        }
+    }
+
+    @Override
+    public V remove(K key) throws CacheException {
+        logger.debug("从redis中删除 key [" + key + "]");
+        try {
+            V previous = get(key);
+            cache.del(getByteKey(key));
+            return previous;
+        } catch (Throwable t) {
+            throw new CacheException(t);
+        }
+    }
+
+    @Override
+    public void clear() throws CacheException {
+        logger.debug("从redis中删除所有元素");
+        try {
+            cache.flushDB();
+        } catch (Throwable t) {
+            throw new CacheException(t);
+        }
+    }
+
+    @Override
+    public int size() {
+        try {
+            Long longSize = new Long(cache.dbSize());
+            return longSize.intValue();
+        } catch (Throwable t) {
+            throw new CacheException(t);
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public Set<K> keys() {
+        try {
+            Set<byte[]> keys = cache.keys(this.keyPrefix + "*");
+            if (CollectionUtils.isEmpty(keys)) {
+                return Collections.emptySet();
+            }else{
+                Set<K> newKeys = new HashSet<K>();
+                for(byte[] key:keys){
+                    newKeys.add((K)key);
+                }
+                return newKeys;
+            }
+        } catch (Throwable t) {
+            throw new CacheException(t);
+        }
+    }
+
+    @Override
+    public Collection<V> values() {
+        try {
+            Set<byte[]> keys = cache.keys(this.keyPrefix + "*");
+            if (!CollectionUtils.isEmpty(keys)) {
+                List<V> values = new ArrayList<V>(keys.size());
+                for (byte[] key : keys) {
+                    @SuppressWarnings("unchecked")
+                    V value = get((K)key);
+                    if (value != null) {
+                        values.add(value);
+                    }
+                }
+                return Collections.unmodifiableList(values);
+            } else {
+                return Collections.emptyList();
+            }
+        } catch (Throwable t) {
+            throw new CacheException(t);
+        }
+    }
+
+}

+ 77 - 0
src/main/java/com/bootdo/common/redis/shiro/RedisCacheManager.java

@@ -0,0 +1,77 @@
+package com.bootdo.common.redis.shiro;
+
+/**
+ * @author bootdo 1992lcg@163.com
+ * @version V1.0
+ */
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.shiro.cache.Cache;
+import org.apache.shiro.cache.CacheException;
+import org.apache.shiro.cache.CacheManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RedisCacheManager implements CacheManager {
+
+    private static final Logger logger = LoggerFactory
+            .getLogger(RedisCacheManager.class);
+
+    // fast lookup by name map
+    private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<String, Cache>();
+
+    private RedisManager redisManager;
+
+    /**
+     * The Redis key prefix for caches
+     */
+    private String keyPrefix = "shiro_redis_cache:";
+
+    /**
+     * Returns the Redis session keys
+     * prefix.
+     * @return The prefix
+     */
+    public String getKeyPrefix() {
+        return keyPrefix;
+    }
+
+    /**
+     * Sets the Redis sessions key
+     * prefix.
+     * @param keyPrefix The prefix
+     */
+    public void setKeyPrefix(String keyPrefix) {
+        this.keyPrefix = keyPrefix;
+    }
+
+    @Override
+    public <K, V> Cache<K, V> getCache(String name) throws CacheException {
+        logger.debug("获取名称为: " + name + " 的RedisCache实例");
+
+        Cache c = caches.get(name);
+
+        if (c == null) {
+
+            // initialize the Redis manager instance
+            redisManager.init();
+
+            // create a new cache instance
+            c = new RedisCache<K, V>(redisManager, keyPrefix);
+
+            // add it to the cache collection
+            caches.put(name, c);
+        }
+        return c;
+    }
+
+    public RedisManager getRedisManager() {
+        return redisManager;
+    }
+
+    public void setRedisManager(RedisManager redisManager) {
+        this.redisManager = redisManager;
+    }
+
+}

+ 228 - 0
src/main/java/com/bootdo/common/redis/shiro/RedisManager.java

@@ -0,0 +1,228 @@
+package com.bootdo.common.redis.shiro;
+
+/**
+ * @author bootdo 1992lcg@163.com
+ * @version V1.0
+ */
+
+import java.util.Set;
+
+import org.springframework.beans.factory.annotation.Value;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.JedisPool;
+import redis.clients.jedis.JedisPoolConfig;
+
+/**
+ *
+ */
+public class RedisManager {
+
+    @Value("${spring.redis.host}")
+    private String host = "127.0.0.1";
+
+    @Value("${spring.redis.port}")
+    private int port = 6379;
+
+    // 0 - never expire
+    private int expire = 0;
+
+    //timeout for jedis try to connect to redis server, not expire time! In milliseconds
+    @Value("${spring.redis.timeout}")
+    private int timeout = 0;
+
+    @Value("${spring.redis.password}")
+    private String password = "";
+
+    private static JedisPool jedisPool = null;
+
+    public RedisManager() {
+
+    }
+
+    /**
+     * 初始化方法
+     */
+    public void init() {
+        if (jedisPool == null) {
+            if (password != null && !"".equals(password)) {
+                jedisPool = new JedisPool(new JedisPoolConfig(), host, port, timeout, password);
+            } else if (timeout != 0) {
+                jedisPool = new JedisPool(new JedisPoolConfig(), host, port, timeout);
+            } else {
+                jedisPool = new JedisPool(new JedisPoolConfig(), host, port);
+            }
+
+        }
+    }
+
+    /**
+     * get value from redis
+     *
+     * @param key
+     * @return
+     */
+    public byte[] get(byte[] key) {
+        byte[] value = null;
+        Jedis jedis = jedisPool.getResource();
+        try {
+            value = jedis.get(key);
+        } finally {
+            if (jedis != null) {
+                jedis.close();
+            }
+        }
+        return value;
+    }
+
+    /**
+     * set
+     *
+     * @param key
+     * @param value
+     * @return
+     */
+    public byte[] set(byte[] key, byte[] value) {
+        Jedis jedis = jedisPool.getResource();
+        try {
+            jedis.set(key, value);
+            if (this.expire != 0) {
+                jedis.expire(key, this.expire);
+            }
+        } finally {
+            if (jedis != null) {
+                jedis.close();
+            }
+        }
+        return value;
+    }
+
+    /**
+     * set
+     *
+     * @param key
+     * @param value
+     * @param expire
+     * @return
+     */
+    public byte[] set(byte[] key, byte[] value, int expire) {
+        Jedis jedis = jedisPool.getResource();
+        try {
+            jedis.set(key, value);
+            if (expire != 0) {
+                jedis.expire(key, expire);
+            }
+        } finally {
+            if (jedis != null) {
+                jedis.close();
+            }
+        }
+        return value;
+    }
+
+    /**
+     * del
+     *
+     * @param key
+     */
+    public void del(byte[] key) {
+        Jedis jedis = jedisPool.getResource();
+        try {
+            jedis.del(key);
+        } finally {
+            if (jedis != null) {
+                jedis.close();
+            }
+        }
+    }
+
+    /**
+     * flush
+     */
+    public void flushDB() {
+        Jedis jedis = jedisPool.getResource();
+        try {
+            jedis.flushDB();
+        } finally {
+            if (jedis != null) {
+                jedis.close();
+            }
+        }
+    }
+
+    /**
+     * size
+     */
+    public Long dbSize() {
+        Long dbSize = 0L;
+        Jedis jedis = jedisPool.getResource();
+        try {
+            dbSize = jedis.dbSize();
+        } finally {
+            if (jedis != null) {
+                jedis.close();
+            }
+        }
+        return dbSize;
+    }
+
+    /**
+     * keys
+     *
+     * @param regex
+     * @return
+     */
+    public Set<byte[]> keys(String pattern) {
+        Set<byte[]> keys = null;
+        Jedis jedis = jedisPool.getResource();
+        try {
+            keys = jedis.keys(pattern.getBytes());
+        } finally {
+            if (jedis != null) {
+                jedis.close();
+            }
+        }
+        return keys;
+    }
+
+    public String getHost() {
+        return host;
+    }
+
+    public void setHost(String host) {
+        this.host = host;
+    }
+
+    public int getPort() {
+        return port;
+    }
+
+    public void setPort(int port) {
+        this.port = port;
+    }
+
+    public int getExpire() {
+        return expire;
+    }
+
+    public void setExpire(int expire) {
+        this.expire = expire;
+    }
+
+    public int getTimeout() {
+        return timeout;
+    }
+
+    public void setTimeout(int timeout) {
+        this.timeout = timeout;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+
+}

+ 139 - 0
src/main/java/com/bootdo/common/redis/shiro/RedisSessionDAO.java

@@ -0,0 +1,139 @@
+package com.bootdo.common.redis.shiro;
+
+import org.apache.shiro.session.Session;
+import org.apache.shiro.session.UnknownSessionException;
+import org.apache.shiro.session.mgt.eis.AbstractSessionDAO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author bootdo 1992lcg@163.com
+ * @version V1.0
+ */
+public class RedisSessionDAO extends AbstractSessionDAO {
+
+    private static Logger logger = LoggerFactory.getLogger(RedisSessionDAO.class);
+    /**
+     * shiro-redis的session对象前缀
+     */
+    private RedisManager redisManager;
+
+    /**
+     * The Redis key prefix for the sessions
+     */
+    private String keyPrefix = "shiro_redis_session:";
+
+    @Override
+    public void update(Session session) throws UnknownSessionException {
+        this.saveSession(session);
+    }
+
+    /**
+     * save session
+     * @param session
+     * @throws UnknownSessionException
+     */
+    private void saveSession(Session session) throws UnknownSessionException{
+        if(session == null || session.getId() == null){
+            logger.error("session or session id is null");
+            return;
+        }
+
+        byte[] key = getByteKey(session.getId());
+        byte[] value = SerializeUtils.serialize(session);
+        session.setTimeout(redisManager.getExpire()*1000);
+        this.redisManager.set(key, value, redisManager.getExpire());
+    }
+
+    @Override
+    public void delete(Session session) {
+        if(session == null || session.getId() == null){
+            logger.error("session or session id is null");
+            return;
+        }
+        redisManager.del(this.getByteKey(session.getId()));
+
+    }
+
+    @Override
+    public Collection<Session> getActiveSessions() {
+        Set<Session> sessions = new HashSet<Session>();
+
+        Set<byte[]> keys = redisManager.keys(this.keyPrefix + "*");
+        if(keys != null && keys.size()>0){
+            for(byte[] key:keys){
+                Session s = (Session)SerializeUtils.deserialize(redisManager.get(key));
+                sessions.add(s);
+            }
+        }
+
+        return sessions;
+    }
+
+    @Override
+    protected Serializable doCreate(Session session) {
+        Serializable sessionId = this.generateSessionId(session);
+        this.assignSessionId(session, sessionId);
+        this.saveSession(session);
+        return sessionId;
+    }
+
+    @Override
+    protected Session doReadSession(Serializable sessionId) {
+        if(sessionId == null){
+            logger.error("session id is null");
+            return null;
+        }
+
+        Session s = (Session)SerializeUtils.deserialize(redisManager.get(this.getByteKey(sessionId)));
+        return s;
+    }
+
+    /**
+     * 获得byte[]型的key
+     * @param key
+     * @return
+     */
+    private byte[] getByteKey(Serializable sessionId){
+        String preKey = this.keyPrefix + sessionId;
+        return preKey.getBytes();
+    }
+
+    public RedisManager getRedisManager() {
+        return redisManager;
+    }
+
+    public void setRedisManager(RedisManager redisManager) {
+        this.redisManager = redisManager;
+
+        /**
+         * 初始化redisManager
+         */
+        this.redisManager.init();
+    }
+
+    /**
+     * Returns the Redis session keys
+     * prefix.
+     * @return The prefix
+     */
+    public String getKeyPrefix() {
+        return keyPrefix;
+    }
+
+    /**
+     * Sets the Redis sessions key
+     * prefix.
+     * @param keyPrefix The prefix
+     */
+    public void setKeyPrefix(String keyPrefix) {
+        this.keyPrefix = keyPrefix;
+    }
+
+
+}

+ 89 - 0
src/main/java/com/bootdo/common/redis/shiro/SerializeUtils.java

@@ -0,0 +1,89 @@
+package com.bootdo.common.redis.shiro;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author bootdo 1992lcg@163.com
+ * @version V1.0
+ */
+public class SerializeUtils {
+
+    private static Logger logger = LoggerFactory.getLogger(SerializeUtils.class);
+
+    /**
+     * 反序列化
+     * @param bytes
+     * @return
+     */
+    public static Object deserialize(byte[] bytes) {
+
+        Object result = null;
+
+        if (isEmpty(bytes)) {
+            return null;
+        }
+
+        try {
+            ByteArrayInputStream byteStream = new ByteArrayInputStream(bytes);
+            try {
+                ObjectInputStream objectInputStream = new ObjectInputStream(byteStream);
+                try {
+                    result = objectInputStream.readObject();
+                }
+                catch (ClassNotFoundException ex) {
+                    throw new Exception("Failed to deserialize object type", ex);
+                }
+            }
+            catch (Throwable ex) {
+                throw new Exception("Failed to deserialize", ex);
+            }
+        } catch (Exception e) {
+            logger.error("Failed to deserialize",e);
+        }
+        return result;
+    }
+
+    public static boolean isEmpty(byte[] data) {
+        return (data == null || data.length == 0);
+    }
+
+    /**
+     * 序列化
+     * @param object
+     * @return
+     */
+    public static byte[] serialize(Object object) {
+
+        byte[] result = null;
+
+        if (object == null) {
+            return new byte[0];
+        }
+        try {
+            ByteArrayOutputStream byteStream = new ByteArrayOutputStream(128);
+            try  {
+                if (!(object instanceof Serializable)) {
+                    throw new IllegalArgumentException(SerializeUtils.class.getSimpleName() + " requires a Serializable payload " +
+                            "but received an object of type [" + object.getClass().getName() + "]");
+                }
+                ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteStream);
+                objectOutputStream.writeObject(object);
+                objectOutputStream.flush();
+                result =  byteStream.toByteArray();
+            }
+            catch (Throwable ex) {
+                throw new Exception("Failed to serialize", ex);
+            }
+        } catch (Exception ex) {
+            logger.error("Failed to serialize",ex);
+        }
+        return result;
+    }
+}

+ 65 - 0
src/main/java/com/bootdo/common/service/DictService.java

@@ -0,0 +1,65 @@
+package com.bootdo.common.service;
+
+import com.bootdo.common.domain.DictDO;
+import com.bootdo.system.domain.UserDO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 字典表
+ * 
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-09-29 18:28:07
+ */
+public interface DictService {
+	
+	DictDO get(Long id);
+	
+	List<DictDO> list(Map<String, Object> map);
+	
+	int count(Map<String, Object> map);
+	
+	int save(DictDO dict);
+	
+	int update(DictDO dict);
+	
+	int remove(Long id);
+	
+	int batchRemove(Long[] ids);
+
+	List<DictDO> listType();
+	
+	String getName(String type,String value);
+
+	/**
+	 * 获取爱好列表
+	 * @return
+     * @param userDO
+	 */
+	List<DictDO> getHobbyList(UserDO userDO);
+
+	/**
+	 * 获取性别列表
+ 	 * @return
+     */
+    List<DictDO> getSexList();
+
+    /**
+     * 根据type获取数据
+     *
+     * @param map
+     * @return
+     */
+    List<DictDO> listByType(String type);
+
+    /**
+     * 根据名称模糊 描述准确获取
+     *
+     * @param province
+     * @param description
+     * @return
+     */
+    DictDO getProvinceByNameAndDescription(String province, String description);
+}

+ 37 - 0
src/main/java/com/bootdo/common/service/FileService.java

@@ -0,0 +1,37 @@
+package com.bootdo.common.service;
+
+import com.bootdo.common.domain.FileDO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 文件上传
+ * 
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-09-19 16:02:20
+ */
+public interface FileService {
+	
+	FileDO get(Long id);
+	
+	List<FileDO> list(Map<String, Object> map);
+	
+	int count(Map<String, Object> map);
+	
+	int save(FileDO sysFile);
+	
+	int update(FileDO sysFile);
+	
+	int remove(Long id);
+	
+	int batchRemove(Long[] ids);
+
+	/**
+	 * 判断一个文件是否存在
+	 * @param url FileDO中存的路径
+	 * @return
+	 */
+    Boolean isExist(String url);
+}

+ 22 - 0
src/main/java/com/bootdo/common/service/GeneratorService.java

@@ -0,0 +1,22 @@
+/**
+ * 
+ */
+package com.bootdo.common.service;
+
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.stereotype.Service;
+
+/**
+ * @author 1992lcg@163.com
+ * @Time 2017年9月6日
+ * @description
+ * 
+ */
+@Service
+public interface GeneratorService {
+	List<Map<String, Object>> list();
+
+	byte[] generatorCode(String[] tableNames);
+}

+ 38 - 0
src/main/java/com/bootdo/common/service/JobService.java

@@ -0,0 +1,38 @@
+package com.bootdo.common.service;
+
+import com.bootdo.common.domain.TaskDO;
+
+import java.util.List;
+import java.util.Map;
+
+import org.quartz.SchedulerException;
+
+/**
+ * 
+ * 
+ * @author chglee
+ * @email 1992lcg@163.com
+ * @date 2017-09-26 20:53:48
+ */
+public interface JobService {
+	
+	TaskDO get(Long id);
+	
+	List<TaskDO> list(Map<String, Object> map);
+	
+	int count(Map<String, Object> map);
+	
+	int save(TaskDO taskScheduleJob);
+	
+	int update(TaskDO taskScheduleJob);
+	
+	int remove(Long id);
+	
+	int batchRemove(Long[] ids);
+
+	void initSchedule() throws SchedulerException;
+
+	void changeStatus(Long jobId, String cmd) throws SchedulerException;
+
+	void updateCron(Long jobId) throws SchedulerException;
+}

+ 16 - 0
src/main/java/com/bootdo/common/service/LogService.java

@@ -0,0 +1,16 @@
+package com.bootdo.common.service;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+import com.bootdo.common.domain.LogDO;
+import com.bootdo.common.domain.PageDO;
+import com.bootdo.common.utils.Query;
+@Service
+public interface LogService {
+	void save(LogDO logDO);
+	PageDO<LogDO> queryList(Query query);
+	int remove(Long id);
+	int batchRemove(Long[] ids);
+}

+ 116 - 0
src/main/java/com/bootdo/common/service/impl/DictServiceImpl.java

@@ -0,0 +1,116 @@
+package com.bootdo.common.service.impl;
+
+import com.bootdo.common.dao.DictDao;
+import com.bootdo.common.domain.DictDO;
+import com.bootdo.common.service.DictService;
+import com.bootdo.common.utils.StringUtils;
+import com.bootdo.system.domain.UserDO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+
+@Service
+public class DictServiceImpl implements DictService {
+    @Autowired
+    private DictDao dictDao;
+
+    @Override
+    public DictDO get(Long id) {
+        return dictDao.get(id);
+    }
+
+    @Override
+    public List<DictDO> list(Map<String, Object> map) {
+        return dictDao.list(map);
+    }
+
+    @Override
+    public int count(Map<String, Object> map) {
+        return dictDao.count(map);
+    }
+
+    @Override
+    public int save(DictDO dict) {
+        return dictDao.save(dict);
+    }
+
+    @Override
+    public int update(DictDO dict) {
+        return dictDao.update(dict);
+    }
+
+    @Override
+    public int remove(Long id) {
+        return dictDao.remove(id);
+    }
+
+    @Override
+    public int batchRemove(Long[] ids) {
+        return dictDao.batchRemove(ids);
+    }
+
+    @Override
+
+    public List<DictDO> listType() {
+        return dictDao.listType();
+    }
+
+    @Override
+    public String getName(String type, String value) {
+        Map<String, Object> param = new HashMap<String, Object>(16);
+        param.put("type", type);
+        param.put("value", value);
+        String rString = dictDao.list(param).get(0).getName();
+        return rString;
+    }
+
+    @Override
+    public List<DictDO> getHobbyList(UserDO userDO) {
+        Map<String, Object> param = new HashMap<>(16);
+        param.put("type", "hobby");
+        List<DictDO> hobbyList = dictDao.list(param);
+
+        if (StringUtils.isNotEmpty(userDO.getHobby())) {
+            String userHobbys[] = userDO.getHobby().split(";");
+            for (String userHobby : userHobbys) {
+                for (DictDO hobby : hobbyList) {
+                    if (!Objects.equals(userHobby, hobby.getId().toString())) {
+                        continue;
+                    }
+                    hobby.setRemarks("true");
+                    break;
+                }
+            }
+        }
+
+        return hobbyList;
+    }
+
+    @Override
+    public List<DictDO> getSexList() {
+        Map<String, Object> param = new HashMap<>(16);
+        param.put("type", "sex");
+        return dictDao.list(param);
+    }
+
+    @Override
+    public List<DictDO> listByType(String type) {
+        Map<String, Object> param = new HashMap<>(16);
+        param.put("type", type);
+        return dictDao.list(param);
+    }
+
+    @Override
+    public DictDO getProvinceByNameAndDescription(String name, String description) {
+        Map<String, Object> param = new HashMap<>(16);
+        param.put("name", name);
+        param.put("description", description);
+        return dictDao.getProvinceByNameAndDescription(param);
+    }
+
+}

+ 73 - 0
src/main/java/com/bootdo/common/service/impl/FileServiceImpl.java

@@ -0,0 +1,73 @@
+package com.bootdo.common.service.impl;
+
+import com.bootdo.common.config.BootdoConfig;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
+import com.bootdo.common.dao.FileDao;
+import com.bootdo.common.domain.FileDO;
+import com.bootdo.common.service.FileService;
+import org.springframework.util.Assert;
+import org.springframework.util.StringUtils;
+
+
+@Service
+public class FileServiceImpl implements FileService {
+	@Autowired
+	private FileDao sysFileMapper;
+
+	@Autowired
+	private BootdoConfig bootdoConfig;
+	@Override
+	public FileDO get(Long id){
+		return sysFileMapper.get(id);
+	}
+	
+	@Override
+	public List<FileDO> list(Map<String, Object> map){
+		return sysFileMapper.list(map);
+	}
+	
+	@Override
+	public int count(Map<String, Object> map){
+		return sysFileMapper.count(map);
+	}
+	
+	@Override
+	public int save(FileDO sysFile){
+		return sysFileMapper.save(sysFile);
+	}
+	
+	@Override
+	public int update(FileDO sysFile){
+		return sysFileMapper.update(sysFile);
+	}
+	
+	@Override
+	public int remove(Long id){
+		return sysFileMapper.remove(id);
+	}
+	
+	@Override
+	public int batchRemove(Long[] ids){
+		return sysFileMapper.batchRemove(ids);
+	}
+
+    @Override
+    public Boolean isExist(String url) {
+		Boolean isExist = false;
+		if (!StringUtils.isEmpty(url)) {
+			String filePath = url.replace("/files/", "");
+			filePath = bootdoConfig.getUploadPath() + filePath;
+			File file = new File(filePath);
+			if (file.exists()) {
+				isExist = true;
+			}
+		}
+		return isExist;
+	}
+	}

+ 44 - 0
src/main/java/com/bootdo/common/service/impl/GeneratorServiceImpl.java

@@ -0,0 +1,44 @@
+package com.bootdo.common.service.impl;
+
+import java.io.ByteArrayOutputStream;
+import java.util.List;
+import java.util.Map;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.commons.io.IOUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.bootdo.common.dao.GeneratorMapper;
+import com.bootdo.common.service.GeneratorService;
+import com.bootdo.common.utils.GenUtils;
+
+
+@Service
+public class GeneratorServiceImpl implements GeneratorService {
+	@Autowired
+	GeneratorMapper generatorMapper;
+
+	@Override
+	public List<Map<String, Object>> list() {
+		List<Map<String, Object>> list = generatorMapper.list();
+		return list;
+	}
+
+	@Override
+	public byte[] generatorCode(String[] tableNames) {
+		ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+		ZipOutputStream zip = new ZipOutputStream(outputStream);
+		for(String tableName : tableNames){
+			//查询表信息
+			Map<String, String> table = generatorMapper.get(tableName);
+			//查询列信息
+			List<Map<String, String>> columns = generatorMapper.listColumns(tableName);
+			//生成代码
+			GenUtils.generatorCode(table, columns, zip);
+		}
+		IOUtils.closeQuietly(zip);
+		return outputStream.toByteArray();
+	}
+
+}

+ 123 - 0
src/main/java/com/bootdo/common/service/impl/JobServiceImpl.java

@@ -0,0 +1,123 @@
+package com.bootdo.common.service.impl;
+
+import com.bootdo.common.config.Constant;
+import com.bootdo.common.dao.TaskDao;
+import com.bootdo.common.domain.ScheduleJob;
+import com.bootdo.common.domain.TaskDO;
+import com.bootdo.common.quartz.utils.QuartzManager;
+import com.bootdo.common.service.JobService;
+import com.bootdo.common.utils.ScheduleJobUtils;
+import org.quartz.SchedulerException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class JobServiceImpl implements JobService {
+
+	@Autowired
+	private TaskDao taskScheduleJobMapper;
+
+	@Autowired
+	QuartzManager quartzManager;
+
+	@Override
+	public TaskDO get(Long id) {
+		return taskScheduleJobMapper.get(id);
+	}
+
+	@Override
+	public List<TaskDO> list(Map<String, Object> map) {
+		return taskScheduleJobMapper.list(map);
+	}
+
+	@Override
+	public int count(Map<String, Object> map) {
+		return taskScheduleJobMapper.count(map);
+	}
+
+	@Override
+	public int save(TaskDO taskScheduleJob) {
+		return taskScheduleJobMapper.save(taskScheduleJob);
+	}
+
+	@Override
+	public int update(TaskDO taskScheduleJob) {
+		return taskScheduleJobMapper.update(taskScheduleJob);
+	}
+
+	@Override
+	public int remove(Long id) {
+		try {
+			TaskDO scheduleJob = get(id);
+			quartzManager.deleteJob(ScheduleJobUtils.entityToData(scheduleJob));
+			return taskScheduleJobMapper.remove(id);
+		} catch (SchedulerException e) {
+			e.printStackTrace();
+			return 0;
+		}
+
+	}
+
+	@Override
+	public int batchRemove(Long[] ids) {
+		for (Long id : ids) {
+			try {
+				TaskDO scheduleJob = get(id);
+				quartzManager.deleteJob(ScheduleJobUtils.entityToData(scheduleJob));
+			} catch (SchedulerException e) {
+				e.printStackTrace();
+				return 0;
+			}
+		}
+		return taskScheduleJobMapper.batchRemove(ids);
+	}
+
+	@Override
+	public void initSchedule() throws SchedulerException {
+		// 这里获取任务信息数据
+		List<TaskDO> jobList = taskScheduleJobMapper.list(new HashMap<String, Object>(16));
+		for (TaskDO scheduleJob : jobList) {
+			if ("1".equals(scheduleJob.getJobStatus())) {
+				ScheduleJob job = ScheduleJobUtils.entityToData(scheduleJob);
+				quartzManager.addJob(job);
+			}
+
+		}
+	}
+
+	@Override
+	public void changeStatus(Long jobId, String cmd) throws SchedulerException {
+		TaskDO scheduleJob = get(jobId);
+		if (scheduleJob == null) {
+			return;
+		}
+		if (Constant.STATUS_RUNNING_STOP.equals(cmd)) {
+			quartzManager.deleteJob(ScheduleJobUtils.entityToData(scheduleJob));
+			scheduleJob.setJobStatus(ScheduleJob.STATUS_NOT_RUNNING);
+		} else {
+			if (!Constant.STATUS_RUNNING_START.equals(cmd)) {
+			} else {
+                scheduleJob.setJobStatus(ScheduleJob.STATUS_RUNNING);
+                quartzManager.addJob(ScheduleJobUtils.entityToData(scheduleJob));
+            }
+		}
+		update(scheduleJob);
+	}
+
+	@Override
+	public void updateCron(Long jobId) throws SchedulerException {
+		TaskDO scheduleJob = get(jobId);
+		if (scheduleJob == null) {
+			return;
+		}
+		if (ScheduleJob.STATUS_RUNNING.equals(scheduleJob.getJobStatus())) {
+			quartzManager.updateJobCron(ScheduleJobUtils.entityToData(scheduleJob));
+		}
+		update(scheduleJob);
+	}
+
+}

+ 60 - 0
src/main/java/com/bootdo/common/service/impl/LogServiceImpl.java

@@ -0,0 +1,60 @@
+package com.bootdo.common.service.impl;
+
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import com.bootdo.common.dao.LogDao;
+import com.bootdo.common.domain.LogDO;
+import com.bootdo.common.domain.PageDO;
+import com.bootdo.common.service.LogService;
+import com.bootdo.common.utils.Query;
+import com.bootdo.common.utils.ShiroUtils;
+import com.bootdo.system.domain.UserDO;
+
+@Service
+public class LogServiceImpl implements LogService {
+
+    private static Logger log = LoggerFactory.getLogger(LogServiceImpl.class);
+    @Autowired
+    LogDao logMapper;
+
+    @Async
+    @Override
+    public void save(LogDO logDO) {
+        logMapper.save(logDO);
+    }
+
+    @Override
+    public PageDO<LogDO> queryList(Query query) {
+        UserDO currUser = ShiroUtils.getUser();
+        log.info("currUser:" + currUser.toString());
+        if (!"6".equals(currUser.getDeptId().toString())) {
+            log.info("地方主管部门 工信部");
+            query.put("userId", String.valueOf(ShiroUtils.getUserId()));
+        } else {
+            log.info("工信部 管理员");
+        }
+        int total = logMapper.count(query);
+        List<LogDO> logs = logMapper.list(query);
+        PageDO<LogDO> page = new PageDO<>();
+        page.setTotal(total);
+        page.setRows(logs);
+        return page;
+    }
+
+    @Override
+    public int remove(Long id) {
+        int count = logMapper.remove(id);
+        return count;
+    }
+
+    @Override
+    public int batchRemove(Long[] ids) {
+        return logMapper.batchRemove(ids);
+    }
+}

+ 48 - 0
src/main/java/com/bootdo/common/task/Job.java

@@ -0,0 +1,48 @@
+package com.bootdo.common.task;
+
+import com.bootdo.common.utils.MD5;
+import com.bootdo.system.domain.SearchDO;
+import com.bootdo.system.service.SearchService;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.messaging.simp.SimpMessagingTemplate;
+import org.springframework.stereotype.Component;
+
+@Component
+public class Job implements org.quartz.Job {
+
+    @Autowired
+    private SearchService searchService;
+
+    @Override
+    public void execute(JobExecutionContext arg0) throws JobExecutionException {
+        // 设备名称
+        String deviceName = "冰箱";
+        // mac地址
+        String mac = "90:C0:0E:17:16:EH";
+        // 序列号
+        String Sn = "232313";
+
+        String uniqe = MD5.getMd5String(deviceName + mac + Sn);
+
+        String uniqeInfo = "732F309B61316A70DAE435095885EEFD";
+        System.out.println("uniqe:" + uniqe + ",uniqeInfo:" + uniqeInfo);
+        System.out.println("测试");
+
+        SearchDO search = new SearchDO();
+        search.setDeviceName(deviceName);
+        search.setDeviceMac(mac);
+        search.setDeviceSn(Sn);
+        search.setLoadUniqe(uniqeInfo);
+        search.setNewUniqe(uniqe);
+        if(uniqeInfo.equals(uniqe)){
+            search.setResult("success");
+        }else{
+            search.setResult("fail");
+        }
+
+        searchService.save(search);
+    }
+
+}

+ 25 - 0
src/main/java/com/bootdo/common/task/WelcomeJob.java

@@ -0,0 +1,25 @@
+package com.bootdo.common.task;
+
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.messaging.simp.SimpMessagingTemplate;
+import org.springframework.stereotype.Component;
+
+import com.bootdo.oa.domain.Response;
+
+import java.security.Principal;
+
+@Component
+public class WelcomeJob implements Job{
+	@Autowired
+	SimpMessagingTemplate template;
+
+    @Override
+    public void execute(JobExecutionContext arg0) throws JobExecutionException {
+    	//template.convertAndSend("/topic/getResponse", new Response("欢迎体验bootdo,这是一个任务计划,使用了websocket和quzrtz技术,可以在计划列表中取消,欢迎您加入qq群交流学习!" ));
+    //
+    }
+
+}

+ 52 - 0
src/main/java/com/bootdo/common/utils/BDException.java

@@ -0,0 +1,52 @@
+package com.bootdo.common.utils;
+
+/**
+ * 自定义异常
+ * 
+ */
+public class BDException extends RuntimeException {
+	private static final long serialVersionUID = 1L;
+	
+    private String msg;
+    private int code = 500;
+    
+    public BDException(String msg) {
+		super(msg);
+		this.msg = msg;
+	}
+	
+	public BDException(String msg, Throwable e) {
+		super(msg, e);
+		this.msg = msg;
+	}
+	
+	public BDException(String msg, int code) {
+		super(msg);
+		this.msg = msg;
+		this.code = code;
+	}
+	
+	public BDException(String msg, int code, Throwable e) {
+		super(msg, e);
+		this.msg = msg;
+		this.code = code;
+	}
+
+	public String getMsg() {
+		return msg;
+	}
+
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+
+	public int getCode() {
+		return code;
+	}
+
+	public void setCode(int code) {
+		this.code = code;
+	}
+	
+	
+}

+ 5 - 0
src/main/java/com/bootdo/common/utils/Base64Utils.java

@@ -0,0 +1,5 @@
+package com.bootdo.common.utils;
+
+public class Base64Utils {
+	
+}

+ 89 - 0
src/main/java/com/bootdo/common/utils/BuildTree.java

@@ -0,0 +1,89 @@
+package com.bootdo.common.utils;
+
+import com.bootdo.common.domain.Tree;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class BuildTree {
+
+	public static <T> Tree<T> build(List<Tree<T>> nodes) {
+
+		if (nodes == null) {
+			return null;
+		}
+		List<Tree<T>> topNodes = new ArrayList<Tree<T>>();
+
+		for (Tree<T> children : nodes) {
+
+			String pid = children.getParentId();
+			if (pid == null || "0".equals(pid)) {
+				topNodes.add(children);
+
+				continue;
+			}
+
+			for (Tree<T> parent : nodes) {
+				String id = parent.getId();
+				if (id != null && id.equals(pid)) {
+					parent.getChildren().add(children);
+					children.setHasParent(true);
+					parent.setChildren(true);
+					continue;
+				}
+			}
+
+		}
+
+		Tree<T> root = new Tree<T>();
+		if (topNodes.size() == 1) {
+			root = topNodes.get(0);
+		} else {
+			root.setId("-1");
+			root.setParentId("");
+			root.setHasParent(false);
+			root.setChildren(true);
+			root.setChecked(true);
+			root.setChildren(topNodes);
+			root.setText("顶级节点");
+			Map<String, Object> state = new HashMap<>(16);
+			state.put("opened", true);
+			root.setState(state);
+		}
+
+		return root;
+	}
+
+	public static <T> List<Tree<T>> buildList(List<Tree<T>> nodes, String idParam) {
+		if (nodes == null) {
+			return null;
+		}
+		List<Tree<T>> topNodes = new ArrayList<Tree<T>>();
+
+		for (Tree<T> children : nodes) {
+
+			String pid = children.getParentId();
+			if (pid == null || idParam.equals(pid)) {
+				topNodes.add(children);
+
+				continue;
+			}
+
+			for (Tree<T> parent : nodes) {
+				String id = parent.getId();
+				if (id != null && id.equals(pid)) {
+					parent.getChildren().add(children);
+					children.setHasParent(true);
+					parent.setChildren(true);
+
+					continue;
+				}
+			}
+
+		}
+		return topNodes;
+	}
+
+}

+ 73 - 0
src/main/java/com/bootdo/common/utils/CustomCellWriteUtil.java

@@ -0,0 +1,73 @@
+package com.bootdo.common.utils;
+
+import com.alibaba.excel.enums.CellDataTypeEnum;
+import com.alibaba.excel.metadata.CellData;
+import com.alibaba.excel.metadata.Head;
+import com.alibaba.excel.util.CollectionUtils;
+import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
+import com.alibaba.excel.write.style.column.AbstractColumnWidthStyleStrategy;
+import org.apache.poi.ss.usermodel.Cell;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @description: 自适应列宽
+ * @author xhl
+ * @date 2022/9/5 10:09
+ * @version 1.0
+ */
+public class CustomCellWriteUtil extends AbstractColumnWidthStyleStrategy {
+    private static final int MAX_COLUMN_WIDTH = 255;
+    private Map<Integer, Map<Integer, Integer>> CACHE = new HashMap(8);
+
+    public CustomCellWriteUtil() {
+    }
+
+    protected void setColumnWidth(WriteSheetHolder writeSheetHolder, List<CellData> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
+        boolean needSetWidth = isHead || !CollectionUtils.isEmpty(cellDataList);
+        if (needSetWidth) {
+            Map<Integer, Integer> maxColumnWidthMap = (Map) CACHE.get(writeSheetHolder.getSheetNo());
+            if (maxColumnWidthMap == null) {
+                maxColumnWidthMap = new HashMap(16);
+                CACHE.put(writeSheetHolder.getSheetNo(), maxColumnWidthMap);
+            }
+
+            Integer columnWidth = this.dataLength(cellDataList, cell, isHead);
+            if (columnWidth >= 0) {
+                if (columnWidth > 255) {
+                    columnWidth = 255;
+                }
+                Integer maxColumnWidth = (Integer) ((Map) maxColumnWidthMap).get(cell.getColumnIndex());
+                if (maxColumnWidth == null || columnWidth > maxColumnWidth) {
+                    ((Map) maxColumnWidthMap).put(cell.getColumnIndex(), columnWidth);
+                    writeSheetHolder.getSheet().setColumnWidth(cell.getColumnIndex(), 7250);
+                }
+            }
+        }
+    }
+
+    private Integer dataLength(List<CellData> cellDataList, Cell cell, Boolean isHead) {
+        if (isHead) {
+            return cell.getStringCellValue().getBytes().length;
+        } else {
+            CellData cellData = (CellData) cellDataList.get(0);
+            CellDataTypeEnum type = cellData.getType();
+            if (type == null) {
+                return -1;
+            } else {
+                switch (type) {
+                    case STRING:
+                        return cellData.getStringValue().getBytes().length;
+                    case BOOLEAN:
+                        return cellData.getBooleanValue().toString().getBytes().length;
+                    case NUMBER:
+                        return cellData.getNumberValue().toString().getBytes().length;
+                    default:
+                        return -1;
+                }
+            }
+        }
+    }
+}

+ 91 - 0
src/main/java/com/bootdo/common/utils/DateUtils.java

@@ -0,0 +1,91 @@
+package com.bootdo.common.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * 日期处理
+ */
+public class DateUtils {
+    private final static Logger logger = LoggerFactory.getLogger(DateUtils.class);
+    /**
+     * 时间格式(yyyy-MM-dd)
+     */
+    public final static String DATE_PATTERN = "yyyy-MM-dd";
+    /**
+     * 时间格式(yyyy-MM-dd HH:mm:ss)
+     */
+    public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
+
+    public static String format(Date date) {
+        return format(date, DATE_PATTERN);
+    }
+
+    public static String format(Date date, String pattern) {
+        if (date != null) {
+            SimpleDateFormat df = new SimpleDateFormat(pattern);
+            return df.format(date);
+        }
+        return null;
+    }
+
+    /**
+     * 计算距离现在多久,非精确
+     *
+     * @param date
+     * @return
+     */
+    public static String getTimeBefore(Date date) {
+        Date now = new Date();
+        long l = now.getTime() - date.getTime();
+        long day = l / (24 * 60 * 60 * 1000);
+        long hour = (l / (60 * 60 * 1000) - day * 24);
+        long min = ((l / (60 * 1000)) - day * 24 * 60 - hour * 60);
+        long s = (l / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
+        String r = "";
+        if (day > 0) {
+            r += day + "天";
+        } else if (hour > 0) {
+            r += hour + "小时";
+        } else if (min > 0) {
+            r += min + "分";
+        } else if (s > 0) {
+            r += s + "秒";
+        }
+        r += "前";
+        return r;
+    }
+
+    /**
+     * 计算距离现在多久,精确
+     *
+     * @param date
+     * @return
+     */
+    public static String getTimeBeforeAccurate(Date date) {
+        Date now = new Date();
+        long l = now.getTime() - date.getTime();
+        long day = l / (24 * 60 * 60 * 1000);
+        long hour = (l / (60 * 60 * 1000) - day * 24);
+        long min = ((l / (60 * 1000)) - day * 24 * 60 - hour * 60);
+        long s = (l / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
+        String r = "";
+        if (day > 0) {
+            r += day + "天";
+        }
+        if (hour > 0) {
+            r += hour + "小时";
+        }
+        if (min > 0) {
+            r += min + "分";
+        }
+        if (s > 0) {
+            r += s + "秒";
+        }
+        r += "前";
+        return r;
+    }
+}

+ 88 - 0
src/main/java/com/bootdo/common/utils/EhcacheUtil.java

@@ -0,0 +1,88 @@
+package com.bootdo.common.utils;
+
+import com.bootdo.data.entity.TfInfoEnterprise;
+import com.bootdo.portal.common.CommonConstants;
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Element;
+import org.apache.poi.ss.formula.functions.T;
+
+import java.net.URL;
+
+/**
+ * 缓存操作工具
+ *
+ * @author Mr.xiBel
+ * @date 2022/5/11
+ **/
+
+public class EhcacheUtil {
+
+    private static final String path = "/ehcache.xml";
+
+    private final CacheManager manager;
+
+    private static EhcacheUtil ehCache;
+
+    private EhcacheUtil(String path) {
+        URL url = getClass().getResource(path);
+        manager = CacheManager.create(url);
+    }
+
+    public static EhcacheUtil getInstance() {
+        if (ehCache == null) {
+            ehCache = new EhcacheUtil(path);
+        }
+        return ehCache;
+    }
+
+    public void put(String cacheName, String key, Object value) {
+        Cache cache = manager.getCache(cacheName);
+        Element element = new Element(key, value);
+        cache.put(element);
+    }
+
+    public Object get(String cacheName, String key) {
+        Cache cache = manager.getCache(cacheName);
+        Element element = cache.get(key);
+        return element == null ? null : element.getObjectValue();
+    }
+
+    public Cache get(String cacheName) {
+        return manager.getCache(cacheName);
+    }
+
+    public void remove(String cacheName, String key) {
+        Cache cache = manager.getCache(cacheName);
+        cache.remove(key);
+    }
+
+    /**
+     * 设置token 用户信息
+     *
+     * @param token
+     * @param clzss
+     */
+    public void putTokenUser(String token, Object clzss) {
+        EhcacheUtil.getInstance().put(CommonConstants.CACHE_PORTAL_USER, token, clzss);
+    }
+
+    /**
+     * 删除已登陆用户uid
+     *
+     * @param token
+     */
+    public void removeTokenUser(String token) {
+        EhcacheUtil.getInstance().remove(CommonConstants.CACHE_PORTAL_USER, token);
+    }
+
+    /**
+     * 获取用户信息
+     *
+     * @param token
+     * @return
+     */
+    public TfInfoEnterprise getUserByToken(String token) {
+        return (TfInfoEnterprise) EhcacheUtil.getInstance().get(CommonConstants.CACHE_PORTAL_USER, token);
+    }
+}

+ 12 - 0
src/main/java/com/bootdo/common/utils/ExceptionUtils.java

@@ -0,0 +1,12 @@
+package com.bootdo.common.utils;
+
+public class ExceptionUtils {
+    public static String getExceptionAllinformation(Exception ex) {
+        String sOut = "";
+        StackTraceElement[] trace = ex.getStackTrace();
+        for (StackTraceElement s : trace) {
+            sOut += "\tat " + s + "\r\n";
+        }
+        return sOut;
+    }
+}

+ 55 - 0
src/main/java/com/bootdo/common/utils/FileType.java

@@ -0,0 +1,55 @@
+package com.bootdo.common.utils;
+
+/* author:zss
+ * 日期:2017年3月31日
+ * 功能:根据文件名称判断类型
+ * 接受参数类型:String 
+ * 返回参数类型:String
+ * 备注:文件类型不完善,有需要的自行添加
+ */
+public class FileType {
+	public static int fileType(String fileName) {
+		if (fileName == null) {
+			fileName = "文件名为空!";
+			return 500;
+
+		} else {
+			// 获取文件后缀名并转化为写,用于后续比较
+			String fileType = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()).toLowerCase();
+			// 创建图片类型数组0
+			String[] img = { "bmp", "jpg", "jpeg", "png", "tiff", "gif", "pcx", "tga", "exif", "fpx", "svg", "psd",
+					"cdr", "pcd", "dxf", "ufo", "eps", "ai", "raw", "wmf" };
+			for (int i = 0; i < img.length; i++) {
+				if (img[i].equals(fileType)) {
+					return 0;
+				}
+			}
+
+			// 创建文档类型数组1
+			String[] document = { "txt", "doc", "docx", "xls", "htm", "html", "jsp", "rtf", "wpd", "pdf", "ppt" };
+			for (int i = 0; i < document.length; i++) {
+				if (document[i].equals(fileType)) {
+					return 1;
+				}
+			}
+			// 创建视频类型数组2
+			String[] video = { "mp4", "avi", "mov", "wmv", "asf", "navi", "3gp", "mkv", "f4v", "rmvb", "webm" };
+			for (int i = 0; i < video.length; i++) {
+				if (video[i].equals(fileType)) {
+					return 2;
+				}
+			}
+			// 创建音乐类型数组3
+			String[] music = { "mp3", "wma", "wav", "mod", "ra", "cd", "md", "asf", "aac", "vqf", "ape", "mid", "ogg",
+					"m4a", "vqf" };
+			for (int i = 0; i < music.length; i++) {
+				if (music[i].equals(fileType)) {
+					return 3;
+				}
+			}
+
+		}
+		//4
+		return 99;
+	}
+}

+ 37 - 0
src/main/java/com/bootdo/common/utils/FileUtil.java

@@ -0,0 +1,37 @@
+package com.bootdo.common.utils;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.UUID;
+
+public class FileUtil {
+
+	public static void uploadFile(byte[] file, String filePath, String fileName) throws Exception {
+		File targetFile = new File(filePath);
+		if (!targetFile.exists()) {
+			targetFile.mkdirs();
+		}
+		FileOutputStream out = new FileOutputStream(filePath + fileName);
+		out.write(file);
+		out.flush();
+		out.close();
+	}
+
+	public static boolean deleteFile(String fileName) {
+		File file = new File(fileName);
+		// 如果文件路径所对应的文件存在,并且是一个文件,则直接删除
+		if (file.exists() && file.isFile()) {
+			if (file.delete()) {
+				return true;
+			} else {
+				return false;
+			}
+		} else {
+			return false;
+		}
+	}
+
+	public static String renameToUUID(String fileName) {
+		return UUID.randomUUID() + "." + fileName.substring(fileName.lastIndexOf(".") + 1);
+	}
+}

+ 244 - 0
src/main/java/com/bootdo/common/utils/GenUtils.java

@@ -0,0 +1,244 @@
+package com.bootdo.common.utils;
+
+
+import com.bootdo.common.config.Constant;
+import com.bootdo.common.domain.ColumnDO;
+import com.bootdo.common.domain.TableDO;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.WordUtils;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * 代码生成器   工具类
+ */
+public class GenUtils {
+
+
+    public static List<String> getTemplates() {
+        List<String> templates = new ArrayList<String>();
+        templates.add("templates/common/generator/domain.java.vm");
+        templates.add("templates/common/generator/Dao.java.vm");
+        //templates.add("templates/common/generator/Mapper.java.vm");
+        templates.add("templates/common/generator/Mapper.xml.vm");
+        templates.add("templates/common/generator/Service.java.vm");
+        templates.add("templates/common/generator/ServiceImpl.java.vm");
+        templates.add("templates/common/generator/Controller.java.vm");
+        templates.add("templates/common/generator/list.html.vm");
+        templates.add("templates/common/generator/add.html.vm");
+        templates.add("templates/common/generator/edit.html.vm");
+        templates.add("templates/common/generator/list.js.vm");
+        templates.add("templates/common/generator/add.js.vm");
+        templates.add("templates/common/generator/edit.js.vm");
+        //templates.add("templates/common/generator/menu.sql.vm");
+        return templates;
+    }
+
+    /**
+     * 生成代码
+     */
+
+
+    public static void generatorCode(Map<String, String> table,
+                                     List<Map<String, String>> columns, ZipOutputStream zip) {
+        //配置信息
+        Configuration config = getConfig();
+        //表信息
+        TableDO tableDO = new TableDO();
+        tableDO.setTableName(table.get("tableName"));
+        tableDO.setComments(table.get("tableComment"));
+        //表名转换成Java类名
+        String className = tableToJava(tableDO.getTableName(), config.getString("tablePrefix"), config.getString("autoRemovePre"));
+        tableDO.setClassName(className);
+        tableDO.setClassname(StringUtils.uncapitalize(className));
+
+        //列信息
+        List<ColumnDO> columsList = new ArrayList<>();
+        for (Map<String, String> column : columns) {
+            ColumnDO columnDO = new ColumnDO();
+            columnDO.setColumnName(column.get("columnName"));
+            columnDO.setDataType(column.get("dataType"));
+            columnDO.setComments(column.get("columnComment"));
+            columnDO.setExtra(column.get("extra"));
+
+            //列名转换成Java属性名
+            String attrName = columnToJava(columnDO.getColumnName());
+            columnDO.setAttrName(attrName);
+            columnDO.setAttrname(StringUtils.uncapitalize(attrName));
+
+            //列的数据类型,转换成Java类型
+            String attrType = config.getString(columnDO.getDataType(), "unknowType");
+            columnDO.setAttrType(attrType);
+
+            //是否主键
+            if ("PRI".equalsIgnoreCase(column.get("columnKey")) && tableDO.getPk() == null) {
+                tableDO.setPk(columnDO);
+            }
+
+            columsList.add(columnDO);
+        }
+        tableDO.setColumns(columsList);
+
+        //没主键,则第一个字段为主键
+        if (tableDO.getPk() == null) {
+            tableDO.setPk(tableDO.getColumns().get(0));
+        }
+
+        //设置velocity资源加载器
+        Properties prop = new Properties();
+        prop.put("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
+        Velocity.init(prop);
+
+        //封装模板数据
+        Map<String, Object> map = new HashMap<>(16);
+        map.put("tableName", tableDO.getTableName());
+        map.put("comments", tableDO.getComments());
+        map.put("pk", tableDO.getPk());
+        map.put("className", tableDO.getClassName());
+        map.put("classname", tableDO.getClassname());
+        map.put("pathName", config.getString("package").substring(config.getString("package").lastIndexOf(".") + 1));
+        map.put("columns", tableDO.getColumns());
+        map.put("package", config.getString("package"));
+        map.put("author", config.getString("author"));
+        map.put("email", config.getString("email"));
+        map.put("datetime", DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN));
+        VelocityContext context = new VelocityContext(map);
+
+        //获取模板列表
+        List<String> templates = getTemplates();
+        for (String template : templates) {
+            //渲染模板
+            StringWriter sw = new StringWriter();
+            Template tpl = Velocity.getTemplate(template, "UTF-8");
+            tpl.merge(context, sw);
+
+            try {
+                //添加到zip
+                zip.putNextEntry(new ZipEntry(getFileName(template, tableDO.getClassname(), tableDO.getClassName(), config.getString("package").substring(config.getString("package").lastIndexOf(".") + 1))));
+                IOUtils.write(sw.toString(), zip, "UTF-8");
+                IOUtils.closeQuietly(sw);
+                zip.closeEntry();
+            } catch (IOException e) {
+                throw new BDException("渲染模板失败,表名:" + tableDO.getTableName(), e);
+            }
+        }
+    }
+
+
+    /**
+     * 列名转换成Java属性名
+     */
+    public static String columnToJava(String columnName) {
+        return WordUtils.capitalizeFully(columnName, new char[]{'_'}).replace("_", "");
+    }
+
+    /**
+     * 表名转换成Java类名
+     */
+    public static String tableToJava(String tableName, String tablePrefix, String autoRemovePre) {
+        if (Constant.AUTO_REOMVE_PRE.equals(autoRemovePre)) {
+            tableName = tableName.substring(tableName.indexOf("_") + 1);
+        }
+        if (StringUtils.isNotBlank(tablePrefix)) {
+            tableName = tableName.replace(tablePrefix, "");
+        }
+
+        return columnToJava(tableName);
+    }
+
+    /**
+     * 获取配置信息
+     */
+    public static Configuration getConfig() {
+        try {
+            return new PropertiesConfiguration("generator.properties");
+        } catch (ConfigurationException e) {
+            throw new BDException("获取配置文件失败,", e);
+        }
+    }
+
+    /**
+     * 获取文件名
+     */
+    public static String getFileName(String template, String classname, String className, String packageName) {
+        String packagePath = "main" + File.separator + "java" + File.separator;
+        //String modulesname=config.getString("packageName");
+        if (StringUtils.isNotBlank(packageName)) {
+            packagePath += packageName.replace(".", File.separator) + File.separator;
+        }
+
+        if (template.contains("domain.java.vm")) {
+            return packagePath + "domain" + File.separator + className + "DO.java";
+        }
+
+        if (template.contains("Dao.java.vm")) {
+            return packagePath + "dao" + File.separator + className + "Dao.java";
+        }
+
+//		if(template.contains("Mapper.java.vm")){
+//			return packagePath + "dao" + File.separator + className + "Mapper.java";
+//		}
+
+        if (template.contains("Service.java.vm")) {
+            return packagePath + "service" + File.separator + className + "Service.java";
+        }
+
+        if (template.contains("ServiceImpl.java.vm")) {
+            return packagePath + "service" + File.separator + "impl" + File.separator + className + "ServiceImpl.java";
+        }
+
+        if (template.contains("Controller.java.vm")) {
+            return packagePath + "controller" + File.separator + className + "Controller.java";
+        }
+
+        if (template.contains("Mapper.xml.vm")) {
+            return "main" + File.separator + "resources" + File.separator + "mapper" + File.separator + packageName + File.separator + className + "Mapper.xml";
+        }
+
+        if (template.contains("list.html.vm")) {
+            return "main" + File.separator + "resources" + File.separator + "templates" + File.separator
+                    + packageName + File.separator + classname + File.separator + classname + ".html";
+            //				+ "modules" + File.separator + "generator" + File.separator + className.toLowerCase() + ".html";
+        }
+        if (template.contains("add.html.vm")) {
+            return "main" + File.separator + "resources" + File.separator + "templates" + File.separator
+                    + packageName + File.separator + classname + File.separator + "add.html";
+        }
+        if (template.contains("edit.html.vm")) {
+            return "main" + File.separator + "resources" + File.separator + "templates" + File.separator
+                    + packageName + File.separator + classname + File.separator + "edit.html";
+        }
+
+        if (template.contains("list.js.vm")) {
+            return "main" + File.separator + "resources" + File.separator + "static" + File.separator + "js" + File.separator
+                    + "appjs" + File.separator + packageName + File.separator + classname + File.separator + classname + ".js";
+            //		+ "modules" + File.separator + "generator" + File.separator + className.toLowerCase() + ".js";
+        }
+        if (template.contains("add.js.vm")) {
+            return "main" + File.separator + "resources" + File.separator + "static" + File.separator + "js" + File.separator
+                    + "appjs" + File.separator + packageName + File.separator + classname + File.separator + "add.js";
+        }
+        if (template.contains("edit.js.vm")) {
+            return "main" + File.separator + "resources" + File.separator + "static" + File.separator + "js" + File.separator
+                    + "appjs" + File.separator + packageName + File.separator + classname + File.separator + "edit.js";
+        }
+
+//		if(template.contains("menu.sql.vm")){
+//			return className.toLowerCase() + "_menu.sql";
+//		}
+
+        return null;
+    }
+}

+ 12 - 0
src/main/java/com/bootdo/common/utils/HttpContextUtils.java

@@ -0,0 +1,12 @@
+package com.bootdo.common.utils;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+public class HttpContextUtils {
+	public static HttpServletRequest getHttpServletRequest() {
+		return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
+	}
+}

+ 0 - 0
src/main/java/com/bootdo/common/utils/HttpDeleteThread.java


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