wuweihao před 4 roky
revize
5e0c412295
87 změnil soubory, kde provedl 6036 přidání a 0 odebrání
  1. 47 0
      gis_application/pom.xml
  2. 13 0
      gis_application/src/main/java/com/gis/ManageApplication.java
  3. 13 0
      gis_application/src/main/java/com/gis/ServletInitializer.java
  4. 85 0
      gis_application/src/main/resources/application-dev.properties
  5. 93 0
      gis_application/src/main/resources/application-pro.properties
  6. 30 0
      gis_application/src/main/resources/application.properties
  7. 156 0
      gis_application/src/main/resources/logback-spring.xml
  8. 11 0
      gis_application/src/main/resources/static/shutdown.sh
  9. 29 0
      gis_application/src/main/resources/static/start.sh
  10. 151 0
      gis_common/pom.xml
  11. 59 0
      gis_common/src/main/java/com/gis/common/config/CommonInterceptor.java
  12. 93 0
      gis_common/src/main/java/com/gis/common/config/Swagger2.java
  13. 78 0
      gis_common/src/main/java/com/gis/common/config/WebMvcConfig.java
  14. 185 0
      gis_common/src/main/java/com/gis/common/constant/Command.java
  15. 65 0
      gis_common/src/main/java/com/gis/common/constant/ConfigConstant.java
  16. 35 0
      gis_common/src/main/java/com/gis/common/exception/BaseRuntimeException.java
  17. 34 0
      gis_common/src/main/java/com/gis/common/exception/JwtAuthenticationException.java
  18. 239 0
      gis_common/src/main/java/com/gis/common/util/AliyunOssUtil.java
  19. 167 0
      gis_common/src/main/java/com/gis/common/util/CmdUtils.java
  20. 41 0
      gis_common/src/main/java/com/gis/common/util/ExcelUtils.java
  21. 140 0
      gis_common/src/main/java/com/gis/common/util/FileUtils.java
  22. 359 0
      gis_common/src/main/java/com/gis/common/util/HttpUtils.java
  23. 194 0
      gis_common/src/main/java/com/gis/common/util/PasswordUtils.java
  24. 101 0
      gis_common/src/main/java/com/gis/common/util/Result.java
  25. 38 0
      gis_common/src/main/java/com/gis/common/util/ResultUtils.java
  26. 65 0
      gis_common/src/main/java/com/gis/common/util/StreamGobbler.java
  27. 22 0
      gis_domain/pom.xml
  28. 26 0
      gis_domain/src/main/java/com/gis/domain/dto/DeptDto.java
  29. 31 0
      gis_domain/src/main/java/com/gis/domain/dto/EffortDto.java
  30. 27 0
      gis_domain/src/main/java/com/gis/domain/dto/PageDateRequest.java
  31. 26 0
      gis_domain/src/main/java/com/gis/domain/dto/PageDto.java
  32. 38 0
      gis_domain/src/main/java/com/gis/domain/entity/BaseEntity.java
  33. 45 0
      gis_domain/src/main/java/com/gis/domain/entity/EffortEntity.java
  34. 45 0
      gis_domain/src/main/java/com/gis/domain/entity/ProductEntity.java
  35. 50 0
      gis_domain/src/main/java/com/gis/domain/entity/ProjectEntity.java
  36. 58 0
      gis_domain/src/main/java/com/gis/domain/entity/TaskEntity.java
  37. 34 0
      gis_domain/src/main/java/com/gis/domain/entity/TaskesTimateEntity.java
  38. 37 0
      gis_domain/src/main/java/com/gis/domain/entity/UserEntity.java
  39. 42 0
      gis_domain/src/main/java/com/gis/domain/entity/ZtBaseEntity.java
  40. 41 0
      gis_domain/src/main/java/com/gis/domain/vo/DeptEffortVo.java
  41. 53 0
      gis_domain/src/main/java/com/gis/domain/vo/EffortVo.java
  42. 21 0
      gis_mapper/pom.xml
  43. 15 0
      gis_mapper/src/main/java/com/gis/mapper/DeptMapper.java
  44. 27 0
      gis_mapper/src/main/java/com/gis/mapper/EffortMapper.java
  45. 25 0
      gis_mapper/src/main/java/com/gis/mapper/IBaseMapper.java
  46. 20 0
      gis_mapper/src/main/java/com/gis/mapper/MyBaseMapper.java
  47. 15 0
      gis_mapper/src/main/java/com/gis/mapper/ProductMapper.java
  48. 14 0
      gis_mapper/src/main/java/com/gis/mapper/ProjectMapper.java
  49. 29 0
      gis_mapper/src/main/java/com/gis/mapper/TaskMapper.java
  50. 63 0
      gis_mapper/src/main/java/com/gis/mapper/TaskesTimateMapper.java
  51. 14 0
      gis_mapper/src/main/java/com/gis/mapper/UserMapper.java
  52. 18 0
      gis_mapper/src/main/java/com/gis/mapper/ZtBaseMapper.java
  53. 36 0
      gis_mapper/src/main/java/com/gis/mapper/provider/DemProvider.java
  54. 53 0
      gis_mapper/src/main/java/com/gis/mapper/provider/TaskesTimateProvider.java
  55. 23 0
      gis_service/pom.xml
  56. 23 0
      gis_service/src/main/java/com/gis/service/EffortService.java
  57. 55 0
      gis_service/src/main/java/com/gis/service/EffortServiceImpl.java
  58. 47 0
      gis_service/src/main/java/com/gis/service/IBaseService.java
  59. 16 0
      gis_service/src/main/java/com/gis/service/ProductService.java
  60. 16 0
      gis_service/src/main/java/com/gis/service/ProjectService.java
  61. 27 0
      gis_service/src/main/java/com/gis/service/TaskService.java
  62. 31 0
      gis_service/src/main/java/com/gis/service/TaskesTimateService.java
  63. 16 0
      gis_service/src/main/java/com/gis/service/UserService.java
  64. 47 0
      gis_service/src/main/java/com/gis/service/ZtBaseService.java
  65. 186 0
      gis_service/src/main/java/com/gis/service/impl/IBaseServiceImpl.java
  66. 40 0
      gis_service/src/main/java/com/gis/service/impl/ProductServiceImpl.java
  67. 41 0
      gis_service/src/main/java/com/gis/service/impl/ProjectServiceImpl.java
  68. 63 0
      gis_service/src/main/java/com/gis/service/impl/TaskServiceImpl.java
  69. 171 0
      gis_service/src/main/java/com/gis/service/impl/TaskesTimateServiceImpl.java
  70. 40 0
      gis_service/src/main/java/com/gis/service/impl/UserServiceImpl.java
  71. 166 0
      gis_service/src/main/java/com/gis/service/impl/ZtBaseServiceImpl.java
  72. 27 0
      gis_web/pom.xml
  73. 13 0
      gis_web/src/main/java/com/gis/web/aop/WebControllerLog.java
  74. 122 0
      gis_web/src/main/java/com/gis/web/aop/WebLogAspect.java
  75. 71 0
      gis_web/src/main/java/com/gis/web/controller/BaseController.java
  76. 59 0
      gis_web/src/main/java/com/gis/web/controller/DeptController.java
  77. 144 0
      gis_web/src/main/java/com/gis/web/controller/ExceptionController.java
  78. 82 0
      gis_web/src/main/java/com/gis/web/controller/ProjectController.java
  79. 49 0
      gis_web/src/main/java/com/gis/web/controller/TaskController.java
  80. 39 0
      gis_web/src/main/java/com/gis/web/controller/UserController.java
  81. 159 0
      gis_web/src/main/java/com/gis/web/shiro/JWTFilter.java
  82. 23 0
      gis_web/src/main/java/com/gis/web/shiro/JWTToken.java
  83. 253 0
      gis_web/src/main/java/com/gis/web/shiro/JwtUtil.java
  84. 110 0
      gis_web/src/main/java/com/gis/web/shiro/MyRealm.java
  85. 114 0
      gis_web/src/main/java/com/gis/web/shiro/ShiroConfig.java
  86. 265 0
      pom.xml
  87. 52 0
      remark.md

+ 47 - 0
gis_application/pom.xml

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+
+
+    <parent>
+        <artifactId>zentao_age</artifactId>
+        <groupId>com.gis</groupId>
+        <version>1.0.0</version>
+    </parent>
+
+
+    <groupId>com.gis</groupId>
+    <artifactId>gis_application</artifactId>
+    <version>1.0.0</version>
+    <!--<packaging>war</packaging>-->
+    <packaging>jar</packaging>
+    <name>gis_application</name>
+    <description>项目入口</description>
+
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>com.gis</groupId>
+            <artifactId>gis_web</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+        <finalName>zentao_age</finalName>
+    </build>
+
+
+
+</project>

+ 13 - 0
gis_application/src/main/java/com/gis/ManageApplication.java

@@ -0,0 +1,13 @@
+package com.gis;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class ManageApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(ManageApplication.class, args);
+    }
+
+}

+ 13 - 0
gis_application/src/main/java/com/gis/ServletInitializer.java

@@ -0,0 +1,13 @@
+//package com.gis;
+//
+//import org.springframework.boot.builder.SpringApplicationBuilder;
+//import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+//
+//public class ServletInitializer extends SpringBootServletInitializer {
+//
+//    @Override
+//    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+//        return application.sources(ManageApplication.class);
+//    }
+//
+//}

+ 85 - 0
gis_application/src/main/resources/application-dev.properties

@@ -0,0 +1,85 @@
+
+#DB
+spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
+spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
+#spring.datasource.druid.url=jdbc:mysql://127.0.0.1:3307/zentaopro?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
+##spring.datasource.druid.url=jdbc:mysql://localhost:3306/${project.name}?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
+#spring.datasource.druid.username=zentao
+#spring.datasource.druid.password=123456
+
+spring.datasource.druid.url=jdbc:mysql://192.168.0.115:3309/zentao?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
+spring.datasource.druid.username=root
+spring.datasource.druid.password=123456
+
+
+# \u521D\u59CB\u8FDE\u63A5\u6570
+spring.datasource.druid.initial-size=5
+# \u6700\u5C0F\u8FDE\u63A5\u6C60\u6570\u91CF
+spring.datasource.druid.min-idle=10
+# \u6700\u5927\u8FDE\u63A5\u6C60\u6570\u91CF
+spring.datasource.druid.max-active=20
+# \u914D\u7F6E\u83B7\u53D6\u8FDE\u63A5\u7B49\u5F85\u8D85\u65F6\u7684\u65F6\u95F4
+spring.datasource.druid.max-wait=60000
+# \u914D\u7F6E\u95F4\u9694\u591A\u4E45\u624D\u8FDB\u884C\u4E00\u6B21\u68C0\u6D4B\uFF0C\u68C0\u6D4B\u9700\u8981\u5173\u95ED\u7684\u7A7A\u95F2\u8FDE\u63A5\uFF0C\u5355\u4F4D\u662F\u6BEB\u79D2
+spring.datasource.druid.time-between-eviction-runs-millis=60000
+# \u914D\u7F6E\u4E00\u4E2A\u8FDE\u63A5\u5728\u6C60\u4E2D\u6700\u5C0F\u751F\u5B58\u7684\u65F6\u95F4\uFF0C\u5355\u4F4D\u662F\u6BEB\u79D2
+spring.datasource.druid.min-evictable-idle-time-millis=30000
+# \u914D\u7F6E\u4E00\u4E2A\u8FDE\u63A5\u5728\u6C60\u4E2D\u6700\u5927\u751F\u5B58\u7684\u65F6\u95F4\uFF0C\u5355\u4F4D\u662F\u6BEB\u79D2
+spring.datasource.druid.max-evictable-idle-time-millis=90000
+# \u914D\u7F6E\u68C0\u6D4B\u8FDE\u63A5\u662F\u5426\u6709\u6548
+spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
+spring.datasource.druid.test-while-idle=true
+spring.datasource.druid.test-on-borrow=false
+spring.datasource.druid.test-on-return=false
+spring.datasource.druid.web-stat-filter.enabled=true
+spring.datasource.druid.stat-view-servlet.enabled=true
+
+
+# Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA4\u4E3A0\uFF09
+spring.redis.database=0
+spring.redis.host=127.0.0.1
+spring.redis.port=6379
+spring.redis.password=
+# \u8FDE\u63A5\u8D85\u65F6\u65F6\u95F4 \u5355\u4F4D ms\uFF08\u6BEB\u79D2\uFF09
+spring.redis.timeout=3000ms
+# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5\uFF0C\u9ED8\u8BA4\u503C\u4E5F\u662F8\u3002
+spring.redis.jedis.pool.max-idle=8
+#\u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5\uFF0C\u9ED8\u8BA4\u503C\u4E5F\u662F0\u3002
+spring.redis.jedis.pool.min-idle=0
+# \u5982\u679C\u8D4B\u503C\u4E3A-1\uFF0C\u5219\u8868\u793A\u4E0D\u9650\u5236\uFF1B\u5982\u679Cpool\u5DF2\u7ECF\u5206\u914D\u4E86maxActive\u4E2Ajedis\u5B9E\u4F8B\uFF0C\u5219\u6B64\u65F6pool\u7684\u72B6\u6001\u4E3Aexhausted(\u8017\u5C3D)\u3002
+spring.redis.jedis.pool.max-active=8
+# \u7B49\u5F85\u53EF\u7528\u8FDE\u63A5\u7684\u6700\u5927\u65F6\u95F4\uFF0C\u5355\u4F4D\u6BEB\u79D2\uFF0C\u9ED8\u8BA4\u503C\u4E3A-1\uFF0C\u8868\u793A\u6C38\u4E0D\u8D85\u65F6\u3002\u5982\u679C\u8D85\u8FC7\u7B49\u5F85\u65F6\u95F4\uFF0C\u5219\u76F4\u63A5\u629B\u51FAJedisConnectionException
+spring.redis.jedis.pool.max-wait=-1ms
+
+# oss info
+# \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u04BB\uFFFD\u38EC\u05BB\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u06B0\uFFFD\uFFFD\uFFFD\uFFFD\u01B5\u0137\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFDoss\uFFFD\uFFFD\uFFFD\uFFFD\u0427\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0637\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u00F2\uFFFD\uFFFD\uFFFD
+#oss.point=http://oss-cn-shenzhen-internal.aliyuncs.com
+oss.point=http://oss-cn-shenzhen.aliyuncs.com
+oss.key=LTAIUrvuHqj8pvry
+oss.secrecy=JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4
+oss.bucket=oss-xiaoan
+oss.type=oss
+oss.file.path=${project.name}/
+oss.domain=http://ossxiaoan.4dage.com/
+
+# swagger2
+swagger.package=com.gis.web.controller
+swagger.title=\u7985\u9053 dev \u7985\u9053\u7BA1\u7406\u540E\u53F0
+swagger.description=\u7985\u9053 dev \u7985\u9053\u7BA1\u7406\u540E\u53F0
+swagger.version=1.0
+
+
+#log
+logging.path=E:/javaProject/${project.name}_log
+logging.config=classpath:logback-spring.xml
+logging.level.com.gis=debug
+
+
+server.file.path=F:\\test\\ngin\\${project.name}_data\\
+server.url.prefix =data
+server.domain =http://192.168.0.135:${server.port}/${server.url.prefix}/
+
+
+
+
+

+ 93 - 0
gis_application/src/main/resources/application-pro.properties

@@ -0,0 +1,93 @@
+
+#DB
+spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
+spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
+#spring.datasource.druid.url=jdbc:mysql://localhost:3306/${project.name}?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
+#spring.datasource.druid.username=root
+#spring.datasource.druid.password=4dkankan4dage
+
+spring.datasource.druid.url=jdbc:mysql://127.0.0.1:3309/zentao?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
+#spring.datasource.druid.url=jdbc:mysql://192.168.0.115:3309/zentao?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
+spring.datasource.druid.username=root
+spring.datasource.druid.password=123456
+
+
+# \u521D\u59CB\u8FDE\u63A5\u6570
+spring.datasource.druid.initial-size=5
+# \u6700\u5C0F\u8FDE\u63A5\u6C60\u6570\u91CF
+spring.datasource.druid.min-idle=10
+# \u6700\u5927\u8FDE\u63A5\u6C60\u6570\u91CF
+spring.datasource.druid.max-active=20
+# \u914D\u7F6E\u83B7\u53D6\u8FDE\u63A5\u7B49\u5F85\u8D85\u65F6\u7684\u65F6\u95F4
+spring.datasource.druid.max-wait=60000
+# \u914D\u7F6E\u95F4\u9694\u591A\u4E45\u624D\u8FDB\u884C\u4E00\u6B21\u68C0\u6D4B\uFF0C\u68C0\u6D4B\u9700\u8981\u5173\u95ED\u7684\u7A7A\u95F2\u8FDE\u63A5\uFF0C\u5355\u4F4D\u662F\u6BEB\u79D2
+spring.datasource.druid.time-between-eviction-runs-millis=60000
+# \u914D\u7F6E\u4E00\u4E2A\u8FDE\u63A5\u5728\u6C60\u4E2D\u6700\u5C0F\u751F\u5B58\u7684\u65F6\u95F4\uFF0C\u5355\u4F4D\u662F\u6BEB\u79D2
+spring.datasource.druid.min-evictable-idle-time-millis=30000
+# \u914D\u7F6E\u4E00\u4E2A\u8FDE\u63A5\u5728\u6C60\u4E2D\u6700\u5927\u751F\u5B58\u7684\u65F6\u95F4\uFF0C\u5355\u4F4D\u662F\u6BEB\u79D2
+spring.datasource.druid.max-evictable-idle-time-millis=90000
+# \u914D\u7F6E\u68C0\u6D4B\u8FDE\u63A5\u662F\u5426\u6709\u6548
+spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
+spring.datasource.druid.test-while-idle=true
+spring.datasource.druid.test-on-borrow=false
+spring.datasource.druid.test-on-return=false
+spring.datasource.druid.web-stat-filter.enabled=true
+spring.datasource.druid.stat-view-servlet.enabled=true
+
+
+# Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA4\u4E3A0\uFF09
+spring.redis.database=0
+spring.redis.host=127.0.0.1
+spring.redis.port=6379
+spring.redis.password=
+# \u8FDE\u63A5\u8D85\u65F6\u65F6\u95F4 \u5355\u4F4D ms\uFF08\u6BEB\u79D2\uFF09
+spring.redis.timeout=3000ms
+# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5\uFF0C\u9ED8\u8BA4\u503C\u4E5F\u662F8\u3002
+spring.redis.jedis.pool.max-idle=8
+#\u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5\uFF0C\u9ED8\u8BA4\u503C\u4E5F\u662F0\u3002
+spring.redis.jedis.pool.min-idle=0
+# \u5982\u679C\u8D4B\u503C\u4E3A-1\uFF0C\u5219\u8868\u793A\u4E0D\u9650\u5236\uFF1B\u5982\u679Cpool\u5DF2\u7ECF\u5206\u914D\u4E86maxActive\u4E2Ajedis\u5B9E\u4F8B\uFF0C\u5219\u6B64\u65F6pool\u7684\u72B6\u6001\u4E3Aexhausted(\u8017\u5C3D)\u3002
+spring.redis.jedis.pool.max-active=8
+# \u7B49\u5F85\u53EF\u7528\u8FDE\u63A5\u7684\u6700\u5927\u65F6\u95F4\uFF0C\u5355\u4F4D\u6BEB\u79D2\uFF0C\u9ED8\u8BA4\u503C\u4E3A-1\uFF0C\u8868\u793A\u6C38\u4E0D\u8D85\u65F6\u3002\u5982\u679C\u8D85\u8FC7\u7B49\u5F85\u65F6\u95F4\uFF0C\u5219\u76F4\u63A5\u629B\u51FAJedisConnectionException
+spring.redis.jedis.pool.max-wait=-1ms
+
+
+# oss info
+# \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u04BB\uFFFD\u38EC\u05BB\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u06B0\uFFFD\uFFFD\uFFFD\uFFFD\u01B5\u0137\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFDoss\uFFFD\uFFFD\uFFFD\uFFFD\u0427\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0637\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u00F2\uFFFD\uFFFD\uFFFD
+oss.point=http://oss-cn-shenzhen-internal.aliyuncs.com
+oss.key=LTAIUrvuHqj8pvry
+oss.secrecy=JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4
+oss.bucket=oss-xiaoan
+oss.type=oss
+oss.file.path=${project.name}/
+oss.domain=http://ossxiaoan.4dage.com/
+
+# swagger2
+swagger.package=com.gis.web.controller
+swagger.title=\u7985\u9053 pro \u7985\u9053\u7BA1\u7406\u540E\u53F0
+swagger.description=\u7985\u9053 pro \u7985\u9053\u7BA1\u7406\u540E\u53F0
+swagger.version=1.0
+
+
+
+# \u9759\u6001\u8D44\u6E90\u662F\u901A\u8FC7nginx \u62FF\u5230
+server.file.path=/opt/tomcat/${project.name}_data/
+#server.url.prefix =data
+# 8086\u662Fnginx\u914D\u7F6E\u7684
+#http://192.168.0.115:8086/20210420_194624.xlsx
+server.domain =http://192.168.0.115:8086/
+
+
+
+#log
+logging.path=/root/user/${project.name}_log
+logging.config=classpath:logback-spring.xml
+logging.level.com.gis=debug
+
+
+
+
+
+
+
+

+ 30 - 0
gis_application/src/main/resources/application.properties

@@ -0,0 +1,30 @@
+server.port=8085
+
+spring.profiles.active=pro
+
+# \u9879\u76EE\u540D\u79F0
+project.name=zentao_age
+
+# \u8BBF\u95EE\u9759\u6001\u8D44\u6E90\u8BBE\u7F6E
+spring.resources.static-locations=classpath:templates/,classpath:static/,classpath:web/
+
+#\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F
+spring.servlet.multipart.enabled=true
+spring.servlet.multipart.max-file-size=2048MB
+spring.servlet.multipart.max-request-size=2048MB
+
+
+
+#\u914D\u7F6E\u81EA\u52A8\u8BC6\u522B\u5B57\u6BB5\u8F6C\u6362
+#mybatis.configuration.mapUnderscoreToCamelCase=true
+mybatis.configuration.map-underscore-to-camel-case=true
+mapper.identity=MYSQL
+mapper.mappers=tk.mybatis.mapper.common.Mapper
+#pager
+pagehelper.helper-dialect=mysql
+pagehelper.params=count=countSql
+pagehelper.reasonable=false
+pagehelper.support-methods-arguments=true
+
+
+

+ 156 - 0
gis_application/src/main/resources/logback-spring.xml

@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration scan="true" scanPeriod="60 seconds" debug="false">
+    <property name="LOG_MAX_HISTORY" value="180"/>
+    <springProperty scope="context" name="LOG_PATH" source="logging.path"/>
+
+    <!-- 控制台输出 -->
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
+            <pattern>${LOG_PATH}/%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
+            <!--<charset>utf-8</charset>-->
+        </encoder>
+    </appender>
+    <!-- 按照每天生成日志文件:主项目日志 -->
+    <appender name="file.all" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <!-- 追加日志到原文件结尾 -->
+        <Prudent>true</Prudent>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!--日志文件输出的文件名 -->
+            <FileNamePattern>${LOG_PATH}/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
+            <MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <!-- 除按日志记录之外,还配置了日志文件不能超过10M(默认),若超过10M,日志文件会以索引0开始, -->
+                <maxFileSize>10MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{500} - %msg%n</pattern>
+            <!--<charset>utf-8</charset>-->
+        </encoder>
+    </appender>
+
+    <!--info日志统一输出到这里-->
+    <appender name="file.info" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <Prudent>true</Prudent>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!--日志文件输出的文件名 每小时生成日志文件 -->
+            <FileNamePattern>${LOG_PATH}/%d{yyyy-MM-dd}/info/console-info.%d{yyyy-MM-dd-HH}.%i.log</FileNamePattern>
+            <MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <!-- 除按日志记录之外,还配置了日志文件不能超过10M(默认),若超过10M,日志文件会以索引0开始, -->
+                <maxFileSize>10MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度 %method 方法名  %L 行数 %msg:日志消息,%n是换行符-->
+            <pattern> %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{56}.%method:%L - %msg%n</pattern>
+            <!--<charset>utf-8</charset>-->
+        </encoder>
+        <!-- 此日志文件只记录info级别的 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>INFO</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!--错误日志统一输出到这里-->
+    <appender name="file.error" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <Prudent>true</Prudent>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!--日志文件输出的文件名-->
+            <FileNamePattern>${LOG_PATH}/%d{yyyy-MM-dd}/error/console-error.%d{yyyy-MM-dd-HH}.%i.log</FileNamePattern>
+            <!--日志文件保留天数-->
+            <MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <!-- 除按日志记录之外,还配置了日志文件不能超过10M(默认),若超过10M,日志文件会以索引0开始, -->
+                <maxFileSize>10MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度 %method 方法名  %L 行数 %msg:日志消息,%n是换行符-->
+            <pattern> %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{56}.%method:%L - %msg%n</pattern>
+            <!--<charset>utf-8</charset>-->
+        </encoder>
+        <!-- 此日志文件只记录error级别的 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>ERROR</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!--warn日志统一输出到这里-->
+    <appender name="file.warn" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <Prudent>true</Prudent>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!--日志文件输出的文件名 按小时生成日志-->
+            <FileNamePattern>${LOG_PATH}/%d{yyyy-MM-dd}/warn/console-warn.%d{yyyy-MM-dd-HH}.%i.log</FileNamePattern>
+            <!--日志文件保留天数-->
+            <MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <!-- 除按日志记录之外,还配置了日志文件不能超过10M(默认),若超过10M,日志文件会以索引0开始, -->
+                <maxFileSize>10MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度 %method 方法名  %L 行数 %msg:日志消息,%n是换行符-->
+            <pattern> %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{56}.%method:%L - %msg%n</pattern>
+            <!--<charset>utf-8</charset>-->
+        </encoder>
+        <!-- 此日志文件只记录warn级别的 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>WARN</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!--debug级别日志统一输出到这里-->
+    <appender name="file.debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <Prudent>true</Prudent>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!--日志文件输出的文件名 按小时生成日志-->
+            <FileNamePattern>${LOG_PATH}/%d{yyyy-MM-dd}/debug/console-debug.%d{yyyy-MM-dd-HH}.%i.log</FileNamePattern>
+            <!--日志文件保留天数-->
+            <MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
+            <!-- 除按日志记录之外,还配置了日志文件不能超过5M,若超过5M,日志文件会以索引0开始,命名日志文件,例如console-debug.2018-08-24-09.1.log -->
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>10MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度 %method 方法名  %L 行数 %msg:日志消息,%n是换行符-->
+            <pattern> %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{56}.%method:%L - %msg%n</pattern>
+            <!--<charset>utf-8</charset>-->
+        </encoder>
+        <!-- 此日志文件只记录debug级别的 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>DEBUG</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY </onMismatch>
+        </filter>
+    </appender>
+
+    <!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
+    <appender name="file.async" class="ch.qos.logback.classic.AsyncAppender">
+        <discardingThreshold>0</discardingThreshold>
+        <queueSize>256</queueSize>
+        <includeCallerData>true</includeCallerData>
+        <appender-ref ref="file.all" />
+    </appender>
+
+    <!--  日志输出级别 -->
+    <!-- TRACE\DEBUG\INFO\WARN\ERROR\FATAL\OFF -->
+    <root level="INFO">
+        <appender-ref ref="console" />
+        <appender-ref ref="file.async"/>
+        <appender-ref ref="file.error" />
+        <appender-ref ref="file.info" />
+        <appender-ref ref="file.debug" />
+        <appender-ref ref="file.warn" />
+    </root>
+
+</configuration>

+ 11 - 0
gis_application/src/main/resources/static/shutdown.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+RESOURCE_NAME=zentao_age.jar
+   tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
+
+if [ ${tpid} ]; then
+echo 'Kill Process!'
+kill -9 $tpid
+else
+echo 'Stop Success!'
+fi
+

+ 29 - 0
gis_application/src/main/resources/static/start.sh

@@ -0,0 +1,29 @@
+#!/bin/sh
+RESOURCE_NAME=zentao_age.jar
+tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
+if [ ${tpid} ]; then
+echo 'Stop Process...'
+kill -15 $tpid
+fi
+
+sleep 5
+
+tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
+
+if [ ${tpid} ]; then
+echo 'Kill Process!'
+kill -9 $tpid
+else
+echo 'Stop Success!'
+fi
+
+tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
+if [ ${tpid} ]; then
+    echo 'App is running.'
+else
+    echo 'App is NOT running.'
+fi
+rm -f tpid
+nohup java -jar ./$RESOURCE_NAME --spring.profiles.active=pro  &
+echo $! > tpid
+echo Start Success!

+ 151 - 0
gis_common/pom.xml

@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>zentao_age</artifactId>
+        <groupId>com.gis</groupId>
+        <version>1.0.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>gis_common</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+
+        <!--springboot-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <!-- JPA -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <!--springboot中的redis依赖-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+
+        <!-- rabbit MQ-->
+        <!--<dependency>-->
+            <!--<groupId>org.springframework.boot</groupId>-->
+            <!--<artifactId>spring-boot-starter-amqp</artifactId>-->
+        <!--</dependency>-->
+
+        <!-- lombok -->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+
+        <!-- fastjson -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+        </dependency>
+
+        <!-- mysql -->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+
+        <!--阿里数据库连接池 -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+        </dependency>
+
+
+        <!-- knife4j aip 包-->
+        <dependency>
+            <groupId>com.github.xiaoymin</groupId>
+            <artifactId>knife4j-spring-boot-starter</artifactId>
+        </dependency>
+
+        <!-- 工具类 -->
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+
+        <!-- shiro -->
+        <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-spring</artifactId>
+        </dependency>
+
+
+        <!-- jwt -->
+        <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>java-jwt</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt</artifactId>
+        </dependency>
+
+        <!--aliyun sdk-->
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-dysmsapi</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.aliyun.oss</groupId>
+            <artifactId>aliyun-sdk-oss</artifactId>
+        </dependency>
+
+
+        <!--tk.mybatis 依赖-->
+        <dependency>
+            <groupId>tk.mybatis</groupId>
+            <artifactId>mapper-spring-boot-starter</artifactId>
+        </dependency>
+
+
+        <!--分页插件-->
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+
+        <!--excel 依赖工具包, hutool需要用的-->
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+        </dependency>
+
+
+
+    </dependencies>
+
+
+</project>

+ 59 - 0
gis_common/src/main/java/com/gis/common/config/CommonInterceptor.java

@@ -0,0 +1,59 @@
+package com.gis.common.config;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.HandlerInterceptor;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Slf4j
+@Component
+public class CommonInterceptor implements HandlerInterceptor {
+
+//    @Value("${spring.profiles.active}")
+//    private String active;
+
+    @Override
+    public boolean preHandle(HttpServletRequest request,
+                             HttpServletResponse response, Object handler) throws Exception {
+        if(!request.getRequestURI().contains("/static/") && !request.getRequestURI().contains("/sendUserInfo")
+                && !request.getRequestURI().contains(".json") && !request.getRequestURI().contains(".png")
+                && !request.getRequestURI().contains(".html") && !request.getRequestURI().contains(".mp3")){
+//            log.warn("start : {}", request.getRequestURI());
+        }
+
+
+        // uat环境禁止访问api文档
+//        if (active.equals("uat")) {
+//            log.info("访问api文档拦截");
+//            return !request.getRequestURI().contains("doc.html");
+//        }
+
+        return true;
+    }
+
+    @Override
+    public void postHandle(HttpServletRequest request,
+                           HttpServletResponse response, Object handler,
+                           ModelAndView modelAndView) throws Exception {
+        request.setAttribute("ctx", request.getContextPath());
+    }
+
+    @Override
+    public void afterCompletion(HttpServletRequest request,
+                                HttpServletResponse response, Object handler, Exception ex)
+            throws Exception {
+        if(!request.getRequestURI().contains("/static/") && !request.getRequestURI().contains("/sendUserInfo")
+                && !request.getRequestURI().contains(".json") && !request.getRequestURI().contains(".png")
+                && !request.getRequestURI().contains(".html") && !request.getRequestURI().contains(".mp3")){
+//            log.warn("end : {}", request.getRequestURI());
+        }
+    }
+
+
+
+
+}

+ 93 - 0
gis_common/src/main/java/com/gis/common/config/Swagger2.java

@@ -0,0 +1,93 @@
+package com.gis.common.config;
+
+import com.gis.common.constant.ConfigConstant;
+import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
+import com.google.common.collect.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.ApiKey;
+import springfox.documentation.service.AuthorizationScope;
+import springfox.documentation.service.SecurityReference;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spi.service.contexts.SecurityContext;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by owen on 2020/2/18
+ *
+ * 集成Swagger有3步:
+ * 1.pom.xml添加依赖
+ * 2.添加Swagger2.class
+ * 3.Application.class 加上注解@EnableSwagger2 表示开启Swagger
+ * 4.http://localhost:8080/doc.html#/
+ *
+ * 2.9.2 不需要字启动类配置注解
+ */
+@Configuration
+@EnableSwagger2
+@EnableKnife4j
+public class Swagger2 {
+
+    @Autowired
+    ConfigConstant configConstant;
+
+    @Bean
+    public Docket createRestApi() {
+        return new Docket(DocumentationType.SWAGGER_2)
+                .apiInfo(apiInfo())
+                .select()
+                .apis(RequestHandlerSelectors.basePackage(configConstant.swaggerPackage))
+                .paths(PathSelectors.any())
+                .build()
+                //添加登录认证,可以使用token
+                .securityContexts(securityContexts())
+                .securitySchemes(securitySchemes())
+                ;
+    }
+
+    private ApiInfo apiInfo() {
+        return new ApiInfoBuilder()
+                .title(configConstant.swaggerTitle)
+                .description(configConstant.swaggerDescription)
+                .version(configConstant.swaggerVersion)
+                .build();
+    }
+
+    private List<ApiKey> securitySchemes() {
+        //设置请求头信息
+        List<ApiKey> result = new ArrayList<>();
+        ApiKey apiKey = new ApiKey("Authorization", "token", "header");
+        result.add(apiKey);
+        return result;
+
+    }
+
+
+    private List<SecurityContext> securityContexts() {
+
+        SecurityContext context = SecurityContext.builder()
+                .securityReferences(defaultAuth())
+                .build();
+
+        return Lists.newArrayList(context);
+
+    }
+
+    private List<SecurityReference> defaultAuth() {
+        List<SecurityReference> result = new ArrayList<>();
+        AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
+        AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
+        authorizationScopes[0] = authorizationScope;
+        result.add(new SecurityReference("Authorization", authorizationScopes));
+        return result;
+    }
+}

+ 78 - 0
gis_common/src/main/java/com/gis/common/config/WebMvcConfig.java

@@ -0,0 +1,78 @@
+package com.gis.common.config;
+
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.alibaba.fastjson.support.config.FastJsonConfig;
+import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.MediaType;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by owen on 2020/2/18 0018 12:01
+ */
+@Configuration
+public class WebMvcConfig implements WebMvcConfigurer {
+
+    @Autowired
+    private CommonInterceptor commonInterceptor;
+
+    /**
+     * 配置全局跨域
+     */
+    @Override
+    public void addCorsMappings(CorsRegistry registry) {
+        registry.addMapping("/**")
+                .allowedOrigins("*")
+                .allowCredentials(true)
+                .allowedMethods("GET", "POST", "DELETE", "PUT", "OPTIONS")
+                .maxAge(3600);
+    }
+
+
+    /**
+     * 添加拦截器
+     */
+    @Override
+    public void addInterceptors(InterceptorRegistry registry) {
+        registry.addInterceptor(commonInterceptor).addPathPatterns("/**");
+    }
+
+    /**
+     * fastJson相关设置
+     * Dto包含json,需要配置不然会异常
+     * @return
+     */
+    @Bean
+    public HttpMessageConverters customConverters() {
+
+        FastJsonHttpMessageConverter fastJson = new FastJsonHttpMessageConverter();
+        // 创建FastJson信息转换对象
+        FastJsonConfig fastJsonConfig = new FastJsonConfig();
+
+
+        // 设置全程返回时间
+        fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
+        // 设置返回值为null是时输出,不写的话,null 字段 不返回。也可以设置返回空串, 可以同时设置多个
+        fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty);
+
+        fastJson.setFastJsonConfig(fastJsonConfig);
+
+        //3、中文乱码解决方案
+        List<MediaType> mediaTypeList = new ArrayList<>();
+        mediaTypeList.add(MediaType.APPLICATION_JSON_UTF8);
+        mediaTypeList.add(MediaType.valueOf("text/html;charset=UTF-8"));
+
+        //4、将转换规则应用于转换对象
+        fastJson.setSupportedMediaTypes(mediaTypeList);
+
+        return new HttpMessageConverters(fastJson);
+    }
+}

+ 185 - 0
gis_common/src/main/java/com/gis/common/constant/Command.java

@@ -0,0 +1,185 @@
+package com.gis.common.constant;
+
+
+/**
+ * Created by Owen on 2019/11/1 0001 9:33
+ * Linxu 插件运行命令
+ */
+public class Command {
+
+//    public static String DOCKER_GDAL = "docker run --rm -v /root/gis/data:/root/gis/data osgeo/gdal:latest ";
+//    public static String DOCKER_CTB = "docker run --rm -v /root/gis/data:/root/gis/data tumgis/ctb-quantized-mesh:latest ";
+
+    public static String DOCKER_GDAL = "docker run --rm -v /mnt:/mnt osgeo/gdal:latest ";
+
+    public static String DOCKER_CTB = "docker run --rm -v /mnt:/mnt tumgis/ctb-quantized-mesh:latest ";
+
+    // docker 数据挂载目录
+    public static String DOCKER_BASE_DIR = "docker run --rm -v /mnt:/mnt ";
+
+    /**
+     * 输入目录:/root/gis/cesium/input/@fileName fileName:是目录名
+     * 输出目录:/root/gis/cesium/output/@fileName fileName:是目录名
+     */
+    public static String MODEL_SLICE_OSGB = DOCKER_BASE_DIR + "ubuntu:3dtile 3dtile -f osgb -i @inputFile -o @outputFile";
+
+    /**
+     * 矢量数据 坐标转换(普通转换,2000转wgs84)
+     * 输入文件:/root/gis/cesium/input/@fileName/@fileName.shp
+     * 输出文件:/root/gis/cesium/input/transform/@fileName/@fileName.shp
+     * 坐标参数:EPSG:4326
+     */
+    public static String VECTOR_TRANSFORM_GENERAL  = DOCKER_GDAL + "ogr2ogr -lco \"encoding=utf-8\" -t_srs EPSG:4326  @outputFile  @inputFile";
+
+
+
+    /**
+     * 矢量数据 严格坐标转换
+     * 有坐标参数,执行严格坐标转换(CGCS2000转wgs80)
+     * 坐标: @coord
+     * 输入文件:
+     * 输出文件:
+     */
+    public static String VECTOR_TRANSFORM_STRICT_WGS80  = DOCKER_GDAL + "ogr2ogr -lco \"encoding=utf-8\" -overwrite  -s_srs \"+proj=longlat +ellps=GRS80 +no_defs +towgs84=@coord\" -t_srs EPSG:4326 @outputFile @inputFile";
+
+    /**
+     * 矢量数据 严格坐标转换
+     * 有坐标参数,执行严格坐标转换(西安80转wgs84)
+     * 坐标: @coord
+     * 输入文件:
+     * 输出文件:
+     */
+    public static String VECTOR_TRANSFORM_STRICT_WGS84  = DOCKER_GDAL + "ogr2ogr -lco \"encoding=utf-8\" -overwrite  -s_srs \"+proj=tmerc +lat_0=0 +lon_0=114 +k=1 +x_0=38500000 +y_0=0 +ellps=IAU76 +units=m +no_defs +towgs84=@coord\" -t_srs EPSG:4326 @outputFile @inputFile";
+
+    /**
+     * 矢量数据切片 step1
+     * shp转geojson
+     * 输入文件:@inputFile
+     * 输出文件:@outputFile
+     *
+     */
+    public static String VECTOR_TO_GEOJSON  = DOCKER_GDAL + "ogr2ogr -f GeoJSON @outputFile @inputFile";
+
+
+    /**
+     * 矢量数据切片 step2
+     * 输入文件:@inputFile
+     * 输出文件:@outputFile
+     *
+     */
+//    public static String VECTOR_SLICE_TIPPECANOE = "tippecanoe -e @outputFile --extend-zooms-if-still-dropping -pC --force -z@layerMax -Z@layerMin @inputFile";
+    public static String VECTOR_SLICE_TIPPECANOE = DOCKER_BASE_DIR + "tippecanoe:latest tippecanoe -e @outputFile --extend-zooms-if-still-dropping -pC --force -z@layerMax -Z@layerMin @inputFile";
+
+    /**
+     * 矢量数据判断坐标
+     * 输入文件:@inputFile
+     */
+    public static String VECTOR_JUDGE_COORD = DOCKER_GDAL + "ogrinfo -ro -al -so @inputFile";
+
+
+    /**
+     * 矢量数据要素查询
+     * 精准查询
+     */
+    public static String VECTOR_WFS_ACCURATE = DOCKER_GDAL + "ogr2ogr -overwrite -fieldTypeToString Date -f geojson -where \"@fileName = '@value'\" @outputFile @inputFile";
+
+    /**
+     * 矢量数据要素查询
+     * 模糊查询
+     */
+    public static String VECTOR_WFS_LIKE = DOCKER_GDAL + "ogr2ogr -overwrite -fieldTypeToString Date -f geojson -where \"@fileName like '%@value%'\" @outputFile @inputFile";
+
+    /**
+     * 矢量数据要素查询
+     * 范围查询
+     */
+    public static String VECTOR_WFS_SCOPE = DOCKER_GDAL + "ogr2ogr -overwrite -fieldTypeToString Date -f geojson -spat @xMin @yMin @xMax @yMax @outputFile @inputFile";
+
+    /**
+     * 矢量数据要素查询
+     * 获取字段名称
+     */
+    public static String VECTOR_WFS_FIELD = DOCKER_GDAL + "ogrinfo -al -so @inputFile";
+
+    /**
+     * 栅格数据切片命令
+     */
+
+    public static String RASTER_SLICE_OSGEO  = DOCKER_GDAL + "python3 /usr/bin/gdal2tiles.py -p geodetic -d --zoom=@layerMin-@layerMax --processes=6 @inputFile @outputFile";
+
+    /**
+     * 栅格数据判断坐标
+     * 输入文件:@inputFile
+     *
+     * gdalsrsinfo -o proj4 /root/gis/cesium/input/owen_2.tif
+     */
+//    public static String RASTER_JUDGE_COORD = "gdalsrsinfo -o proj4 @inputFile";
+    public static String RASTER_JUDGE_COORD = DOCKER_GDAL + "gdalsrsinfo -o proj4 @inputFile";
+
+
+
+    /**
+     * 严格坐标转换,step:1
+     */
+    public static String RASTER_TRANSFORM_GDALWARP_STRICT_1  = DOCKER_GDAL + "gdalwarp -overwrite -ct \"+proj=pipeline +step +proj=tmerc +lat_0=0 +lon_0=114 +k=1 +x_0=38500000 +y_0=0 +ellps=IAU76 +units=m +no_defs +inv +step  +proj=cart +a=6378140 +b=6356755.288158 +step +proj=helmert +convention=coordinate_frame +x=@x +y=@y +z=@z +rx=@rx +ry=@ry +rz=@rz +s=1 +step +proj=cart +a=6378137 +b=6356752.314245 inv +step +proj=unitconvert +xy_in=rad +xy_out=deg\" @inputFile @outputFile";
+
+    /**
+     * 严格坐标转换,step:2
+     * 输入文件: /root/gis/cesium/input/transform/@fileName.tif
+     * 输出文件: /root/gis/cesium/input/transform_strict/@fileName.tif
+     */
+    public static String RASTER_TRANSFORM_GDALWARP_STRICT_2  = DOCKER_GDAL + "gdal_translate -a_srs EPSG:4326  @inputFile @outputFile";
+
+    // 解压到指定目录
+    public static String CMD_ZIP  = "cd @path && unzip -o @fileName.zip";
+
+    // 将生成的数据移动到服务器
+    public static String CMD_MV = "mv /root/gis/data/output/@fileName /root/gis/data/server";
+
+
+    /**
+     * 修改文件linux 写文件 0755 权限
+     */
+    public static String CMD_CHOMD_755 = "chmod 755 -R @path";
+
+
+    /**
+     * 地形数据打包
+     */
+    public static String DEM_BUILD = DOCKER_GDAL + "gdalbuildvrt @outputFile @inputFile";
+
+
+    /**
+     * 地形数据切片
+     */
+    public static String DEM_SLICE = DOCKER_CTB + "ctb-tile -f Mesh -C -N -o @outputFile @inputFile && " + DOCKER_CTB + "ctb-tile -f Mesh -C -N -l -o @outputFile @inputFile";
+
+
+    /**
+     * WGS84 转 CGCS2000坐标系
+     * 矢量数据 step1 step2
+     */
+    public static String convert_TRANSFORM_coord_vector_step1 = DOCKER_GDAL + "ogr2ogr -lco \"encoding=utf-8\" -s_srs epsg:4326 -t_srs \"+proj=longlat +ellps=GRS80 +towgs84=@coord +no_defs\" @outputFile @inputFile";
+
+    public static String convert_TRANSFORM_coord_vector_step2 = DOCKER_GDAL + "ogr2ogr -lco \"encoding=utf-8\"  -a_srs epsg:4490 @outputFile @inputFile";
+
+    /**
+     * WGS84 转 CGCS2000坐标系
+     * 栅格数据转换 step1 step2
+     */
+    public static String convert_TRANSFORM_coord_raster_step1 = DOCKER_GDAL + "gdalwarp -s_srs epsg:4326 -t_srs \"+proj=longlat +ellps=GRS80 +towgs84=@coord +no_defs\" @inputFile @outputFile ";
+
+    public static String convert_TRANSFORM_coord_raster_step2 = DOCKER_GDAL + "gdal_translate -a_srs epsg:4490 @inputFile @outputFile";
+
+    /**
+     * unzip -o /root/owen/unzip/owen1.zip -d /root/owen/unzip/
+     * -o:不必先询问用户,unzip执行后覆盖原有的文件
+     * -d<目录>:指定文件解压缩后所要存储的目录;
+     */
+    public final static String unzip = "unzip -o @inputFile -d @outputFile";
+
+    public final static String remove = "rm -rf @input";
+
+
+
+}

+ 65 - 0
gis_common/src/main/java/com/gis/common/constant/ConfigConstant.java

@@ -0,0 +1,65 @@
+package com.gis.common.constant;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by owen on 2020/12/31 0031 14:22
+ *
+ * 全局动态参数
+ */
+@Component
+public class ConfigConstant {
+
+
+    /** 服务器文件地址*/
+    @Value("${server.file.path}")
+    public  String serverBasePath;
+
+    /** 服务器域名*/
+    @Value("${server.domain}")
+    public  String serverDomain;
+
+
+
+    @Value("${project.name}")
+    public String projectName;
+
+    @Value("${oss.point}")
+    public  String ossPoint;
+
+    @Value("${oss.key}")
+    public  String ossKey;
+
+    @Value("${oss.secrecy}")
+    public  String ossSecrecy;
+
+    @Value("${oss.bucket}")
+    public  String ossBucket;
+
+    @Value("${oss.file.path}")
+    public  String ossBasePath;
+
+    @Value("${oss.domain}")
+    public  String ossDomain;
+
+
+    @Value("${swagger.package}")
+    public  String swaggerPackage;
+
+    @Value("${swagger.title}")
+    public  String swaggerTitle;
+
+    @Value("${swagger.description}")
+    public  String swaggerDescription;
+
+    @Value("${swagger.version}")
+    public  String swaggerVersion;
+
+
+
+
+
+
+
+}

+ 35 - 0
gis_common/src/main/java/com/gis/common/exception/BaseRuntimeException.java

@@ -0,0 +1,35 @@
+package com.gis.common.exception;
+
+public class BaseRuntimeException extends RuntimeException{
+
+    private static final long serialVersionUID = -1518945670203783450L;
+    private Integer code;
+    private String msg;
+
+    public BaseRuntimeException(String msg){
+        super(msg);
+        this.msg = msg;
+    }
+
+    public BaseRuntimeException(Integer code, String msg){
+        super(msg);
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public void setCode(Integer code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+}

+ 34 - 0
gis_common/src/main/java/com/gis/common/exception/JwtAuthenticationException.java

@@ -0,0 +1,34 @@
+package com.gis.common.exception;
+
+import org.apache.shiro.ShiroException;
+
+public class JwtAuthenticationException extends ShiroException {
+
+    private static final long serialVersionUID = 2899335020273674736L;
+
+    private int code;
+
+    private String msg;
+
+    public JwtAuthenticationException(int code, String msg){
+        super(msg);
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+}

+ 239 - 0
gis_common/src/main/java/com/gis/common/util/AliyunOssUtil.java

@@ -0,0 +1,239 @@
+package com.gis.common.util;
+
+import com.aliyun.oss.OSSClient;
+import com.aliyun.oss.model.OSSObject;
+import com.aliyun.oss.model.OSSObjectSummary;
+import com.aliyun.oss.model.ObjectListing;
+import com.aliyun.oss.model.PutObjectResult;
+import com.gis.common.constant.ConfigConstant;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 阿里云oss工具类
+ */
+@Slf4j
+@Component
+public class AliyunOssUtil {
+
+    @Autowired
+    ConfigConstant configConstant;
+
+
+    private OSSClient init(){
+        return new OSSClient(configConstant.ossPoint, configConstant.ossKey, configConstant.ossSecrecy);
+    }
+
+
+
+    public  void delete(String key) throws IOException {
+        OSSClient ossClient = init();
+        try {
+
+            // 2019-2-28 启动aliyun oss 空间
+            ossClient.deleteObject(configConstant.ossBucket, key);
+            ossClient.deleteObject(configConstant.ossBucket, key);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    //上传的数据是byte[],key是上传后的文件名
+    public void upload(byte[] data, String key) throws IOException {
+        OSSClient ossClient = init();
+        try {
+            // 2019-2-28 启动aliyun oss 空间
+            ossClient.putObject(configConstant.ossBucket, key, new ByteArrayInputStream(data));
+        } catch (Exception e) {
+            log.error(e.toString() + key);
+        }
+    }
+
+
+    public void upload(String filePath, String key) {
+        OSSClient ossClient = init();
+        try {
+            File file = new File(filePath);
+            if (!file.exists()) {
+                log.error("要上传的文件不存在:" + filePath);
+            }
+            ossClient.putObject(configConstant.ossBucket, key, new File(filePath));
+
+        } catch (Exception e) {
+            log.error(e.toString() + filePath);
+        }
+    }
+
+    public  void upload2(String filePath, String key) {
+        OSSClient ossClient = init();
+        try {
+
+            // 2019-2-28 启动aliyun oss 空间
+            ossClient.putObject(configConstant.ossBucket, key, new File(filePath));
+        } catch (Exception e) {
+            log.error(e.toString() + filePath);
+        }
+    }
+
+
+    /**
+     * 上传的数据是文件夹,参数是文件夹路径,key是上传后的文件名
+     *
+     * @param filepaths key : 原文件路径
+     *                  value: oss路径, oss会自动创建目录
+     */
+    public  void uploadMulFiles(Map<String, String> filepaths) {
+        if (filepaths == null) {
+            return;
+        }
+        log.info("开始批量上传到阿里云:" + new Date().toString());
+        if (filepaths.size() > 50) {
+            for (String filePath : filepaths.keySet()) {
+                upload2(filePath, filepaths.get(filePath));
+            }
+        } else {
+            for (String filePath : filepaths.keySet()) {
+                log.info("文件:" + filePath + "到阿里云:" + filepaths.get(filePath));
+                upload(filePath, filepaths.get(filePath));
+            }
+        }
+        log.info("批量上传阿里云完毕:" + new Date().toString());
+    }
+
+
+    /**
+     * 可以删除目录
+     *
+     * @param prefix 图片路径
+     * @return
+     */
+    public  int deleteFile(String prefix) {
+        OSSClient ossClient = init();
+        ObjectListing objectListing = ossClient.listObjects(configConstant.ossBucket, prefix);
+        List<OSSObjectSummary> sums = objectListing.getObjectSummaries();
+        try {
+            for (OSSObjectSummary s : sums) {
+                delete(s.getKey());
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return sums.size();
+    }
+
+    public  void main(String[] args) throws IOException {
+
+        HashMap<String, String> map = new HashMap<>();
+//		map.put("F:\\test\\aa.jpg", "kanfang/test/aa.jpg");
+        map.put("F:\\test\\oss\\floor.json", "kanfang/test/faa.json");
+        uploadMulFiles(map);
+
+//		deleteFile("kanfang/test/aa.jpg");
+
+    }
+
+
+
+
+    public  String upload5(String filePath, String key) {
+        OSSClient ossClient = init();
+        PutObjectResult result = null;
+        try {
+            File file = new File(filePath);
+            if (!file.exists()) {
+                log.error("要上传的文件不存在:" + filePath);
+            }
+
+
+            result = ossClient.putObject(configConstant.ossBucket, key, new File(filePath));
+
+        } catch (Exception e) {
+            log.error(e.toString() + filePath);
+        }
+
+        log.info(" getETag : " + result.getETag());
+        log.info("1 : " + result.toString());
+        log.info("2 : " + result.getRequestId());
+        log.info("3 : " + result.getClientCRC());
+        log.info("4 : " + result.getResponse());
+        log.info("5 : " + result.getServerCRC());
+        return result.getETag();
+    }
+
+
+    /**
+     * 通过文件名判断并获取OSS服务文件上传时文件的contentType
+     *
+     * @param fileName 文件名
+     * @return 文件的contentType
+     */
+    private static String getContentType(String fileName) {
+        log.info("getContentType:" + fileName);
+        // 文件的后缀名
+        String fileExtension = fileName.substring(fileName.lastIndexOf("."));
+        if (".bmp".equalsIgnoreCase(fileExtension)) {
+            return "image/bmp";
+        }
+        if (".gif".equalsIgnoreCase(fileExtension)) {
+            return "image/gif";
+        }
+        if (".jpeg".equalsIgnoreCase(fileExtension) || ".jpg".equalsIgnoreCase(fileExtension)
+                || ".png".equalsIgnoreCase(fileExtension)) {
+            return "image/jpeg";
+        }
+        if (".html".equalsIgnoreCase(fileExtension)) {
+            return "text/html";
+        }
+        if (".txt".equalsIgnoreCase(fileExtension)) {
+            return "text/plain";
+        }
+        if (".vsd".equalsIgnoreCase(fileExtension)) {
+            return "application/vnd.visio";
+        }
+        if (".ppt".equalsIgnoreCase(fileExtension) || "pptx".equalsIgnoreCase(fileExtension)) {
+            return "application/vnd.ms-powerpoint";
+        }
+        if (".doc".equalsIgnoreCase(fileExtension) || "docx".equalsIgnoreCase(fileExtension)) {
+            return "application/msword";
+        }
+        if (".xml".equalsIgnoreCase(fileExtension)) {
+            return "text/xml";
+        }
+        if (".pdf".equalsIgnoreCase(fileExtension)) {
+            return "application/pdf";
+        }
+        // 默认返回类型
+        return "image/jpeg";
+    }
+
+    /**
+     * 以流下载图片
+     *
+     * @param
+     * @return
+     * @Title: getInputStreamByFileUrl
+     * @Description: 根据文件路径获取InputStream流
+     * @return: InputStream
+     */
+    public  InputStream getInputStreamByFileUrl(String filePath) {
+        // ossObject包含文件所在的存储空间名称、文件名称、文件元信息以及一个输入流。
+        OSSClient ossClient = init();
+        OSSObject ossObject = ossClient.getObject(configConstant.ossBucket, filePath);
+        return ossObject.getObjectContent();
+    }
+
+
+
+
+
+}

+ 167 - 0
gis_common/src/main/java/com/gis/common/util/CmdUtils.java

@@ -0,0 +1,167 @@
+package com.gis.common.util;
+
+import cn.hutool.core.util.RuntimeUtil;
+import lombok.extern.log4j.Log4j2;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+/**
+ * Created by owen on 2021/1/4 0004 14:53
+ */
+@Log4j2
+public class CmdUtils {
+
+
+
+    /**
+     * 调用opencv 生成缩略图
+     * 100m的图java处理不了。目前使用算法部郭晨露的脚本
+     * @param cmd
+     * @return
+     * @throws IOException
+     * @throws InterruptedException
+     */
+    public static int cmdThumb(String cmd) throws IOException, InterruptedException {
+        Process exec = RuntimeUtil.exec(cmd);
+        log.info("run cmdThumb");
+
+        BufferedReader br = new BufferedReader(new InputStreamReader(exec.getInputStream()));
+        BufferedReader errorBuf = new BufferedReader(new InputStreamReader(exec.getErrorStream()));
+
+        String errorLine;
+        while ((errorLine = errorBuf.readLine()) != null) {
+            log.error("errorLine: {}", errorLine);
+        }
+
+        // success ,没有获取到信息
+        String line;
+        int i = 1;
+        while ((line = br.readLine()) != null) {
+
+            // 查看执行日志
+            if (i % 100 == 0) {
+                log.info("line, i=" + i +", " +line);
+            }
+
+            if (line.contains("done.")) {
+                log.info("line: {}", line);
+                log.info("cmdThumb完成 ");
+            }
+            i++;
+        }
+        log.info("执行总行数:" +i);
+
+        // 结束命令行
+        int isCmd = exec.waitFor();
+
+        // 关闭流
+        br.close();
+        errorBuf.close();
+
+        return isCmd;
+
+    }
+
+    /**
+     * 命令运行结果 1:失败, 0:成功
+     * @param cmd
+     * @return
+     * @throws IOException
+     * @throws InterruptedException
+     */
+    public static int cmdPano(String cmd) throws IOException, InterruptedException {
+        Process exec = RuntimeUtil.exec(cmd);
+        log.info("run cmdPano");
+
+        BufferedReader br = new BufferedReader(new InputStreamReader(exec.getInputStream()));
+        BufferedReader errorBuf = new BufferedReader(new InputStreamReader(exec.getErrorStream()));
+
+        String errorLine;
+        while ((errorLine = errorBuf.readLine()) != null) {
+            log.error("errorLine: {}", errorLine);
+        }
+
+        // success ,没有获取到信息
+        String line;
+        while ((line = br.readLine()) != null) {
+            log.debug("line: {}", line);
+            if (line.contains("done.")) {
+                log.info("line: {}", line);
+                log.info("cmdPano完成 ");
+            }
+        }
+
+        // 结束命令行
+        int isCmd = exec.waitFor();
+
+        // 关闭流
+        br.close();
+        errorBuf.close();
+
+        return isCmd;
+
+    }
+
+
+    /**
+     * 调用算法 xx.sh 脚本
+     * @param command
+     */
+    public static void callShell(String command){
+        try {
+            Process process = Runtime.getRuntime().exec(command);
+            StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), "ERROR");
+            errorGobbler.start();
+            StreamGobbler outGobbler = new StreamGobbler(process.getInputStream(), "STDOUT");
+            outGobbler.start();
+            process.waitFor();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    public static int cmdOss(String cmd) throws IOException, InterruptedException {
+        Process exec = RuntimeUtil.exec(cmd);
+        log.info("run cmdOss");
+
+        BufferedReader br = new BufferedReader(new InputStreamReader(exec.getInputStream()));
+        BufferedReader errorBuf = new BufferedReader(new InputStreamReader(exec.getErrorStream()));
+
+        String errorLine;
+        while ((errorLine = errorBuf.readLine()) != null) {
+            log.error("errorLine: {}", errorLine);
+        }
+
+        // success ,没有获取到信息
+        String line;
+        int i = 1;
+        while ((line = br.readLine()) != null) {
+            log.info("line: {}", line);
+
+            // 查看执行日志
+//            if (i % 100 == 0) {
+//                log.info("line, i=" + i +", " +line);
+//            }
+
+//            if (line.contains("done.")) {
+//                log.info("line: {}", line);
+//                log.info("cmdThumb完成 ");
+//            }
+            i++;
+        }
+        log.info("执行总行数:" +i);
+
+        // 结束命令行
+        int isCmd = exec.waitFor();
+
+        // 关闭流
+        br.close();
+        errorBuf.close();
+
+        return isCmd;
+
+    }
+}

+ 41 - 0
gis_common/src/main/java/com/gis/common/util/ExcelUtils.java

@@ -0,0 +1,41 @@
+package com.gis.common.util;
+
+import cn.hutool.poi.excel.ExcelUtil;
+import cn.hutool.poi.excel.ExcelWriter;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by owen on 2021/3/8 0008 15:50
+ */
+@Slf4j
+public class ExcelUtils {
+
+    /**
+     *
+     * @param rows 每行数据
+     * @param savePath 保存地址 xxx.xlsx
+     * @param rowTitle 标题
+     */
+    public static void createExcel(List rows, String savePath, Map<String, String> rowTitle) {
+        log.info("rows size: {}", rows.size());
+//        log.info("savePath: {}", savePath);
+        ExcelWriter writer = ExcelUtil.getWriter(savePath);
+
+        //自定义标题别名
+        if (rowTitle != null) {
+            for (Map.Entry<String, String> a : rowTitle.entrySet()) {
+                writer.addHeaderAlias(a.getKey(), a.getValue());
+            }
+        }
+
+        // 一次性写出内容,使用默认样式,强制输出标题
+        writer.write(rows, true);
+        // 关闭writer,释放内存
+        writer.close();
+        log.info("excel完成:" +  savePath);
+
+    }
+}

+ 140 - 0
gis_common/src/main/java/com/gis/common/util/FileUtils.java

@@ -0,0 +1,140 @@
+package com.gis.common.util;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.URLUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.junit.Test;
+import org.springframework.util.ResourceUtils;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.*;
+
+/**
+ * Created by owen on 2020/5/12 0012 17:21
+ */
+@Slf4j
+public class FileUtils {
+
+
+    /**
+     * 多文件上传
+     * savePath 路径(目录)
+     */
+    public static List<Map<String, String>> uploads(MultipartFile[] files, String savePath) throws IOException {
+        if (files == null) {
+            log.error("文件不能为空");
+            return null;
+        }
+
+        String time = DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS");
+        savePath = savePath + time + File.separator;
+//        FileUtil.mkdir(time);
+
+        ArrayList<Map<String, String>> list = new ArrayList<>();
+
+        String path;
+        int i = 0;
+        for (MultipartFile file : files) {
+            String fileName = file.getOriginalFilename();
+            String suffix = StringUtils.substringAfterLast(fileName, ".");
+            String newName = time + "_" + i + "."  +suffix;
+            path = savePath + newName;
+            FileUtil.writeFromStream(file.getInputStream(), path);
+
+            HashMap<String, String> fileInfo = new HashMap<>();
+            fileInfo.put("path", path);
+            fileInfo.put("name", fileName);
+            fileInfo.put("newName", newName);
+            fileInfo.put("dir", time);
+
+            list.add(fileInfo);
+            ++ i;
+        }
+
+        return list;
+
+    }
+
+
+    /**
+     * 重命名文件上传
+     * @param file
+     * @param savePath
+     * @return
+     * @throws IOException
+     */
+    public static String renameUpload(MultipartFile file, String savePath, String baseUrl)  {
+        if (file == null) {
+            log.error("文件不能为空");
+            return null;
+        }
+
+        String time = DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS");
+
+        String fileName = file.getOriginalFilename();
+
+
+
+        String suffix = StringUtils.substringAfterLast(fileName, ".");
+        String newName = time  + "."  +suffix;
+        savePath = savePath  + newName;
+
+        try {
+            FileUtil.writeFromStream(file.getInputStream(), savePath);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        String path = StringUtils.substringAfterLast(savePath, "cms_fdkanzhan_data"+ File.separator);
+
+        return baseUrl+"cms_fdkanzhan_data/" +path;
+
+    }
+
+
+    /**
+     * 根据路径写入文件,适合oss
+     * @param inPath 网络输入路径
+     * @param outPath 保存文件路径
+     * @throws IOException
+     */
+    public static void fielWrite(String inPath, String outPath) throws IOException {
+        InputStream in = URLUtil.getStream(new URL(inPath));
+        FileUtil.writeFromStream(in, outPath);
+    }
+
+
+    /**
+     * 获取文件资源路径
+     * 这方法,测试时是用当前类路径,当打包成jar包时时,会变成跟目录下。所以要把资源文件放入口类的资源文件夹
+     * @param filePath 文件路径
+     * @return
+     * @throws IOException
+     */
+    public static String getResourceUrl(String filePath) throws IOException {
+        String path = ResourceUtils.getURL("classpath:").getPath();
+        path = path + filePath;
+        return path;
+    }
+
+
+    @Test
+    public void test(){
+        String a = "F:\\test\\ngin\\cms_fdkanzhan_data\\img/20200903_181544452.jpg";
+        System.out.println(StringUtils.substringAfterLast(a, "cms_fdkanzhan_data"+ File.separator));
+    }
+
+    @Test
+    public void test2(){
+        String a = "F:\\test\\ngin\\cms_fdkanzhan_data\\img/20200903_181544452.jpg";
+        System.out.println(StringUtils.substringBeforeLast(a, "cms_fdkanzhan_data"+ File.separator));
+        System.out.println(StringUtils.substringBefore(a, "cms_fdkanzhan_data"+ File.separator));
+        System.out.println(StringUtils.substringBetween(a, "cms_fdkanzhan_data"+ File.separator));
+    }
+}

+ 359 - 0
gis_common/src/main/java/com/gis/common/util/HttpUtils.java

@@ -0,0 +1,359 @@
+package com.gis.common.util;
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicNameValuePair;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class HttpUtils {
+
+    protected static final Logger LOGGER = LoggerFactory.getLogger(HttpUtils.class);
+
+    /**
+     * get
+     *
+     * @param host
+     * @param path
+     * @param headers
+     * @param querys
+     * @return
+     * @throws Exception
+     */
+    public static HttpResponse doGet(String host, String path,
+                                     Map<String, String> headers,
+                                     Map<String, String> querys)
+            throws Exception {
+        HttpClient httpClient = wrapClient(host);
+
+        HttpGet request = new HttpGet(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            request.addHeader(e.getKey(), e.getValue());
+        }
+
+        return httpClient.execute(request);
+    }
+
+    /**
+     * post form
+     *
+     * @param host
+     * @param path
+     * @param headers
+     * @param querys
+     * @param bodys
+     * @return
+     * @throws Exception
+     */
+    public static HttpResponse doPost(String host, String path, Map<String, String> headers,
+                                      Map<String, String> querys,
+                                      Map<String, String> bodys)
+            throws Exception {
+        HttpClient httpClient = wrapClient(host);
+
+        HttpPost request = new HttpPost(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (bodys != null) {
+            List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
+
+            for (String key : bodys.keySet()) {
+                nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
+            }
+            UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
+            formEntity.setContentType("application/x-www-form-urlencoded;charset=UTF-8");
+            request.setEntity(formEntity);
+        }
+
+        return httpClient.execute(request);
+    }
+
+    /**
+     * 2021-02-23
+     * post 有请求头,有headers
+     *
+     * @param host
+     * @param path
+     * @param headers
+     * @param querys
+     * @param body
+     * @return
+     * @throws Exception
+     */
+    public static HttpResponse doPost(String host, String path, Map<String, String> headers, Map<String, String> querys, JSONObject body)
+            throws Exception {
+        HttpClient httpClient = wrapClient(host);
+
+        HttpPost request = new HttpPost(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            request.addHeader(e.getKey(), e.getValue());
+        }
+
+        // 请求体
+        if (body != null) {
+            StringEntity stringEntity = new StringEntity(body.toJSONString(), "utf-8");
+            stringEntity.setContentType("application/json;charset=UTF-8");
+            request.setEntity(stringEntity);
+        }
+        return httpClient.execute(request);
+    }
+
+
+    /**
+     * 2021-02-23
+     * post 有请求头,有headers
+     *
+     * @param headers
+     * @param body
+     * @param api
+     * @return
+     * @throws Exception
+     */
+    public static HttpResponse doPost(String api, Map<String, String> headers, JSONObject body)
+            throws Exception {
+        HttpClient httpClient = new DefaultHttpClient();
+        LOGGER.info("url : " + api);
+        HttpPost request = new HttpPost(api);
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            request.addHeader(e.getKey(), e.getValue());
+        }
+
+        // 请求体
+        if (body != null) {
+            StringEntity stringEntity = new StringEntity(body.toJSONString(), "utf-8");
+            stringEntity.setContentType("application/json;charset=UTF-8");
+            request.setEntity(stringEntity);
+        }
+        return httpClient.execute(request);
+    }
+
+
+    public static HttpResponse doPost(String host, String path, Map<String, String> headers, Map<String, String> querys)
+            throws Exception {
+        HttpClient httpClient = wrapClient(host);
+
+        HttpPost request = new HttpPost(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            request.addHeader(e.getKey(), e.getValue());
+        }
+
+        return httpClient.execute(request);
+    }
+
+    /**
+     * Post stream
+     *
+     * @param host
+     * @param path
+     * @param headers
+     * @param querys
+     * @param body
+     * @return
+     * @throws Exception
+     */
+    public static HttpResponse doPost(String host, String path,
+                                      Map<String, String> headers,
+                                      Map<String, String> querys,
+                                      byte[] body)
+            throws Exception {
+        HttpClient httpClient = wrapClient(host);
+
+        HttpPost request = new HttpPost(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (body != null) {
+            request.setEntity(new ByteArrayEntity(body));
+        }
+
+        return httpClient.execute(request);
+    }
+
+    /**
+     * Put String
+     *
+     * @param host
+     * @param path
+     * @param method
+     * @param headers
+     * @param querys
+     * @param body
+     * @return
+     * @throws Exception
+     */
+    public static HttpResponse doPut(String host, String path, String method, Map<String, String> headers,
+                                     Map<String, String> querys,
+                                     String body)
+            throws Exception {
+        HttpClient httpClient = wrapClient(host);
+
+        HttpPut request = new HttpPut(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (StringUtils.isNotBlank(body)) {
+            request.setEntity(new StringEntity(body, "utf-8"));
+        }
+
+        return httpClient.execute(request);
+    }
+
+    /**
+     * Put stream
+     *
+     * @param host
+     * @param path
+     * @param method
+     * @param headers
+     * @param querys
+     * @param body
+     * @return
+     * @throws Exception
+     */
+    public static HttpResponse doPut(String host, String path, String method,
+                                     Map<String, String> headers,
+                                     Map<String, String> querys,
+                                     byte[] body)
+            throws Exception {
+        HttpClient httpClient = wrapClient(host);
+
+        HttpPut request = new HttpPut(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (body != null) {
+            request.setEntity(new ByteArrayEntity(body));
+        }
+
+        return httpClient.execute(request);
+    }
+
+    /**
+     * Delete
+     *
+     * @param host
+     * @param path
+     * @param method
+     * @param headers
+     * @param querys
+     * @return
+     * @throws Exception
+     */
+    public static HttpResponse doDelete(String host, String path, String method,
+                                        Map<String, String> headers,
+                                        Map<String, String> querys)
+            throws Exception {
+        HttpClient httpClient = wrapClient(host);
+
+        HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+            request.addHeader(e.getKey(), e.getValue());
+        }
+
+        return httpClient.execute(request);
+    }
+
+    public static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
+        StringBuilder sbUrl = new StringBuilder();
+        sbUrl.append(host);
+        if (!StringUtils.isBlank(path)) {
+            sbUrl.append(path);
+        }
+        LOGGER.info("request api: " + sbUrl.toString());
+        if (null != querys) {
+            StringBuilder sbQuery = new StringBuilder();
+            for (Map.Entry<String, String> query : querys.entrySet()) {
+                if (0 < sbQuery.length()) {
+                    sbQuery.append("&");
+                }
+                if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
+                    sbQuery.append(query.getValue());
+                }
+                if (!StringUtils.isBlank(query.getKey())) {
+                    sbQuery.append(query.getKey());
+                    if (!StringUtils.isBlank(query.getValue())) {
+                        sbQuery.append("=");
+                        sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
+                    }
+                }
+            }
+            if (0 < sbQuery.length()) {
+                sbUrl.append("?").append(sbQuery);
+            }
+        }
+
+        return sbUrl.toString();
+    }
+
+    private static HttpClient wrapClient(String host) {
+        HttpClient httpClient = new DefaultHttpClient();
+        if (host.startsWith("https://")) {
+            sslClient(httpClient);
+        }
+        return httpClient;
+    }
+
+    private static void sslClient(HttpClient httpClient) {
+        try {
+            SSLContext ctx = SSLContext.getInstance("TLS");
+            X509TrustManager tm = new X509TrustManager() {
+                public X509Certificate[] getAcceptedIssuers() {
+                    return null;
+                }
+
+                public void checkClientTrusted(X509Certificate[] xcs, String str) {
+
+                }
+
+                public void checkServerTrusted(X509Certificate[] xcs, String str) {
+
+                }
+            };
+            ctx.init(null, new TrustManager[]{tm}, null);
+            SSLSocketFactory ssf = new SSLSocketFactory(ctx);
+            ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+            ClientConnectionManager ccm = httpClient.getConnectionManager();
+            SchemeRegistry registry = ccm.getSchemeRegistry();
+            registry.register(new Scheme("https", 443, ssf));
+        } catch (KeyManagementException ex) {
+            throw new RuntimeException(ex);
+        } catch (NoSuchAlgorithmException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+
+
+}

+ 194 - 0
gis_common/src/main/java/com/gis/common/util/PasswordUtils.java

@@ -0,0 +1,194 @@
+package com.gis.common.util;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.PBEKeySpec;
+import javax.crypto.spec.PBEParameterSpec;
+import java.security.Key;
+import java.security.SecureRandom;
+
+public class PasswordUtils {
+
+
+    /**
+     * JAVA6支持以下任意一种算法 PBEWITHMD5ANDDES PBEWITHMD5ANDTRIPLEDES
+     * PBEWITHSHAANDDESEDE PBEWITHSHA1ANDRC2_40 PBKDF2WITHHMACSHA1
+     * */
+
+    /**
+     * 定义使用的算法为:PBEWITHMD5andDES算法
+     */
+    public static final String ALGORITHM = "PBEWithMD5AndDES";//加密算法
+    public static final String Salt = "63293188";//密钥
+
+    /**
+     * 定义迭代次数为1000次
+     */
+    private static final int ITERATIONCOUNT = 1000;
+
+    /**
+     * 获取加密算法中使用的盐值,解密中使用的盐值必须与加密中使用的相同才能完成操作. 盐长度必须为8字节
+     *
+     * @return byte[] 盐值
+     */
+    public static byte[] getSalt() throws Exception {
+        // 实例化安全随机数
+        SecureRandom random = new SecureRandom();
+        // 产出盐
+        return random.generateSeed(8);
+    }
+
+    public static byte[] getStaticSalt() {
+        // 产出盐
+        return Salt.getBytes();
+    }
+
+    /**
+     * 根据PBE密码生成一把密钥
+     *
+     * @param password 生成密钥时所使用的密码
+     * @return Key PBE算法密钥
+     */
+    private static Key getPBEKey(String password) {
+        // 实例化使用的算法
+        SecretKeyFactory keyFactory;
+        SecretKey secretKey = null;
+        try {
+            keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
+            // 设置PBE密钥参数
+            PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray());
+            // 生成密钥
+            secretKey = keyFactory.generateSecret(keySpec);
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+        return secretKey;
+    }
+
+    /**
+     * 加密明文字符串
+     *
+     * @param plaintext 待加密的明文字符串
+     * @param password  生成密钥时所使用的密码
+     * @param salt      盐值
+     * @return 加密后的密文字符串
+     * @throws Exception
+     */
+    public static String encrypt(String plaintext, String password, byte[] salt) {
+
+        Key key = getPBEKey(password);
+        byte[] encipheredData = null;
+        PBEParameterSpec parameterSpec = new PBEParameterSpec(salt, ITERATIONCOUNT);
+        try {
+            Cipher cipher = Cipher.getInstance(ALGORITHM);
+
+            cipher.init(Cipher.ENCRYPT_MODE, key, parameterSpec);
+
+            encipheredData = cipher.doFinal(plaintext.getBytes());
+        } catch (Exception e) {
+        }
+        return bytesToHexString(encipheredData);
+    }
+
+    /**
+     * 解密密文字符串
+     *
+     * @param ciphertext 待解密的密文字符串
+     * @param password   生成密钥时所使用的密码(如需解密,该参数需要与加密时使用的一致)
+     * @param salt       盐值(如需解密,该参数需要与加密时使用的一致)
+     * @return 解密后的明文字符串
+     * @throws Exception
+     */
+    public static Boolean decrypt(String ciphertext, String password, byte[] salt) {
+
+        Key key = getPBEKey(password);
+        byte[] passDec = null;
+        PBEParameterSpec parameterSpec = new PBEParameterSpec(getStaticSalt(), ITERATIONCOUNT);
+        try {
+            Cipher cipher = Cipher.getInstance(ALGORITHM);
+
+            cipher.init(Cipher.DECRYPT_MODE, key, parameterSpec);
+
+            passDec = cipher.doFinal(hexStringToBytes(ciphertext));
+            return true;
+        } catch (Exception e) {
+            // TODO: handle exception
+            return false;
+        }
+//        return new String(passDec);
+    }
+
+    /**
+     * 将字节数组转换为十六进制字符串
+     *
+     * @param src 字节数组
+     * @return
+     */
+    public static String bytesToHexString(byte[] src) {
+        StringBuilder stringBuilder = new StringBuilder("");
+        if (src == null || src.length <= 0) {
+            return null;
+        }
+        for (int i = 0; i < src.length; i++) {
+            int v = src[i] & 0xFF;
+            String hv = Integer.toHexString(v);
+            if (hv.length() < 2) {
+                stringBuilder.append(0);
+            }
+            stringBuilder.append(hv);
+        }
+        return stringBuilder.toString();
+    }
+
+    /**
+     * 将十六进制字符串转换为字节数组
+     *
+     * @param hexString 十六进制字符串
+     * @return
+     */
+    public static byte[] hexStringToBytes(String hexString) {
+        if (hexString == null || hexString.equals("")) {
+            return null;
+        }
+        hexString = hexString.toUpperCase();
+        int length = hexString.length() / 2;
+        char[] hexChars = hexString.toCharArray();
+        byte[] d = new byte[length];
+        for (int i = 0; i < length; i++) {
+            int pos = i * 2;
+            d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
+        }
+        return d;
+    }
+
+    private static byte charToByte(char c) {
+        return (byte) "0123456789ABCDEF".indexOf(c);
+    }
+
+    public static void main(String[] args) {
+
+        String userName = "hao";
+        String password = "123456";
+
+        try {
+            byte[] salt = PasswordUtils.getStaticSalt();
+            String ciphertext = PasswordUtils.encrypt(userName, password, salt);
+            System.out.println("密文:" + ciphertext);
+            Boolean plaintext = PasswordUtils.decrypt(ciphertext, password, salt);
+            System.out.println("明文" + plaintext);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+
+
+
+
+
+    }
+
+
+}

+ 101 - 0
gis_common/src/main/java/com/gis/common/util/Result.java

@@ -0,0 +1,101 @@
+package com.gis.common.util;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * 通用返回类
+ *
+ * @author
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Result<T> implements Serializable {
+    private static final long serialVersionUID = -1491499610244557029L;
+    public static final String SUCCESS_MSG = "操作成功";
+    public static int CODE_SUCCESS = 0;
+    public static int CODE_FAILURE = -1;
+    public static String[] NOOP = new String[]{};
+
+    /**
+     * 处理状态:0: 成功, 1: 失败
+     */
+    @ApiModelProperty(value = "处理状态:0: 成功, 1: 失败", name = "code")
+    private int code;
+    /**
+     * 消息
+     */
+    @ApiModelProperty(value = "消息", name = "msg")
+    private String msg;
+    /**
+     * 返回数据
+     */
+    @ApiModelProperty(value = "返回数据", name = "data")
+    private T data;
+    /**
+     * 处理成功,并返回数据
+     *
+     * @param data 数据对象
+     * @return data
+     */
+    public static Result success(Object data) {
+        return new Result(CODE_SUCCESS, SUCCESS_MSG, data);
+    }
+    /**
+     * 处理成功
+     *
+     * @return data
+     */
+    public static Result success() {
+        return new Result(CODE_SUCCESS, SUCCESS_MSG, NOOP);
+    }
+    /**
+     * 处理成功
+     *
+     * @param msg 消息
+     * @return data
+     */
+    public static Result success(String msg) {
+        return new Result(CODE_SUCCESS, msg, NOOP);
+    }
+    /**
+     * 处理成功
+     *
+     * @param msg  消息
+     * @param data 数据对象
+     * @return data
+     */
+    public static Result success(String msg, Object data) {
+        return new Result(CODE_SUCCESS, msg, data);
+    }
+    /**
+     * 处理失败,并返回数据(一般为错误信息)
+     *
+     * @param code 错误代码
+     * @param msg  消息
+     * @return data
+     */
+    public static Result failure(int code, String msg) {
+        return new Result(code, msg, NOOP);
+    }
+    /**
+     * 处理失败
+     *
+     * @param msg 消息
+     * @return data
+     */
+    public static Result failure(String msg) {
+        return failure(CODE_FAILURE, msg);
+    }
+
+    @Override
+    public String toString() {
+        return "JsonResult [code=" + code + ", msg=" + msg + ", data="
+                + data + "]";
+    }
+}

+ 38 - 0
gis_common/src/main/java/com/gis/common/util/ResultUtils.java

@@ -0,0 +1,38 @@
+package com.gis.common.util;
+
+import cn.hutool.http.HttpUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * Created by owen on 2021/3/3 0003 11:18
+ */
+@Slf4j
+public class ResultUtils {
+
+    public static  Result doGet(String api) {
+        log.info("api: {}", api);
+        String strResult = HttpUtil.get(api);
+//        log.info("strResult: {}", strResult);
+        if (StringUtils.isBlank(strResult)){
+            log.info("请求失败,请检查api");
+            return Result.failure("请求失败,请检查api");
+        }
+        JSONObject result = JSON.parseObject(strResult);
+        String status = result.getString("status");
+        if ("success".equals(status)) {
+            log.info("请求成功");
+            String data = result.getString("data");
+            JSONObject resultJson = JSON.parseObject(data);
+            log.info("data: {}", resultJson);
+            return Result.success(resultJson);
+        } else {
+            log.error("请求有误");
+//            result.getString("")
+            return Result.success();
+        }
+
+    }
+}

+ 65 - 0
gis_common/src/main/java/com/gis/common/util/StreamGobbler.java

@@ -0,0 +1,65 @@
+package com.gis.common.util;
+
+import java.io.*;
+
+public class StreamGobbler extends Thread {
+
+	InputStream is;  
+    String type;  
+    OutputStream os;  
+
+    public StreamGobbler(InputStream is, String type) {  
+        this(is, type, null);  
+    }  
+
+    StreamGobbler(InputStream is, String type, OutputStream redirect) {  
+        this.is = is;  
+        this.type = type;  
+        this.os = redirect;  
+    }  
+
+    public void run() {  
+        InputStreamReader isr = null;  
+        BufferedReader br = null;  
+        PrintWriter pw = null;  
+        try {  
+            if (os != null)  
+                pw = new PrintWriter(os);  
+
+            isr = new InputStreamReader(is);  
+            br = new BufferedReader(isr);  
+            String line=null;
+            int i = 1;
+            while ( (line = br.readLine()) != null) {  
+                if (pw != null)  
+                    pw.println(line);
+                if (i%200 == 0) {
+                    System.out.println(type + "i: i" + i + ">" + line);
+                }
+                i++;
+            }  
+
+            if (pw != null)  
+                pw.flush();  
+        } catch (IOException ioe) {  
+            ioe.printStackTrace();    
+        } finally{  
+            try {  
+            	if(pw!=null)
+            	{
+            		 pw.close();  
+            	}
+            	if(br!=null)
+            	{
+            		br.close();  
+            	}
+            	if(isr!=null)
+            	{
+            		isr.close();  
+            	}
+            } catch (IOException e) {  
+                e.printStackTrace();  
+            }  
+        }  
+    }  
+}

+ 22 - 0
gis_domain/pom.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>zentao_age</artifactId>
+        <groupId>com.gis</groupId>
+        <version>1.0.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>gis_domain</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.gis</groupId>
+            <artifactId>gis_common</artifactId>
+        </dependency>
+    </dependencies>
+
+</project>

+ 26 - 0
gis_domain/src/main/java/com/gis/domain/dto/DeptDto.java

@@ -0,0 +1,26 @@
+package com.gis.domain.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+
+/**
+ * Created by owen on 2021/4/20 0026 12:13
+ */
+@Data
+public class DeptDto {
+
+
+
+    @NotBlank(message = "日期不能为空")
+    @ApiModelProperty(value = "日期,yyyy-MM-dd", required = true)
+    private String date;
+
+    @NotBlank(message = "部门id不能为空")
+    @ApiModelProperty(value = "部门id", required = true)
+    private String deptId;
+
+
+}

+ 31 - 0
gis_domain/src/main/java/com/gis/domain/dto/EffortDto.java

@@ -0,0 +1,31 @@
+package com.gis.domain.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * Created by owen on 2021/3/5 0026 12:13
+ * 工时表(windows版用这个,生产环境不用这个表统计)
+ */
+@Data
+public class EffortDto  {
+
+    @ApiModelProperty(value = "账号")
+    private String account;
+
+    @ApiModelProperty(value = "项目id")
+    private String project;
+
+    @ApiModelProperty(value = "日期,yyyy-MM-dd", required = true)
+    private String date;
+
+    @ApiModelProperty(value = "部门id")
+    private String deptId;
+
+
+
+
+
+
+}

+ 27 - 0
gis_domain/src/main/java/com/gis/domain/dto/PageDateRequest.java

@@ -0,0 +1,27 @@
+package com.gis.domain.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * Created by Owen on 2019/10/28 0028 12:24
+ * 有时间
+ */
+@Data
+public class PageDateRequest extends PageDto {
+
+    /**
+     * 开始时间
+     * 需要用字符串接收
+     */
+    @ApiModelProperty(value = "开始时间", name = "startTime")
+    private String startTime;
+
+
+    @ApiModelProperty(value = "结束时间", name = "endTime")
+    private String endTime;
+
+
+
+}

+ 26 - 0
gis_domain/src/main/java/com/gis/domain/dto/PageDto.java

@@ -0,0 +1,26 @@
+package com.gis.domain.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * Created by Owen on 2019/10/28 0028 12:24
+ */
+@Data
+public class PageDto {
+
+
+    @ApiModelProperty(value = "起始页码,默认0为第一页", name = "pageNum")
+    private Integer pageNum;
+
+    @ApiModelProperty(value = "每页数量", name = "pageSize")
+    private Integer pageSize;
+
+    @ApiModelProperty(value = "搜索条件", name = "searchKey")
+    private String searchKey;
+
+
+
+
+}

+ 38 - 0
gis_domain/src/main/java/com/gis/domain/entity/BaseEntity.java

@@ -0,0 +1,38 @@
+package com.gis.domain.entity;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.*;
+import java.util.Date;
+
+@Data
+@MappedSuperclass
+public abstract class BaseEntity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    @ApiModelProperty(value = "对象ID")
+    private Long id;
+
+    @ApiModelProperty(value = "创建时间")
+    @Temporal(TemporalType.TIMESTAMP)
+    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    @ApiModelProperty(value = "修改时间")
+    @Temporal(TemporalType.TIMESTAMP)
+    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /**
+     * 用来批量操作的
+     * A: 激活  I:禁用
+     */
+    @JsonIgnore
+    @JSONField(serialize = false)
+    private Integer isDelete;
+}

+ 45 - 0
gis_domain/src/main/java/com/gis/domain/entity/EffortEntity.java

@@ -0,0 +1,45 @@
+package com.gis.domain.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by owen on 2021/3/5 0026 12:13
+ * 工时表(windows版用这个,生产环境不用这个表统计)
+ */
+@Data
+@Entity
+@Table(name = "zt_effort")
+public class EffortEntity extends ZtBaseEntity implements Serializable {
+
+
+    private static final long serialVersionUID = 5918996331398765975L;
+
+    @ApiModelProperty(value = "账号")
+    private String account;
+
+    @ApiModelProperty(value = "消耗时间")
+    private String consumed;
+
+//    @Column(name = "project")
+    @ApiModelProperty(value = "项目id")
+    private Integer project;
+
+    @ApiModelProperty(value = "日期")
+    private Date date;
+
+//    @Transient
+//    @ApiModelProperty(value = "总工时")
+//    private Integer sum;
+
+
+
+
+}

+ 45 - 0
gis_domain/src/main/java/com/gis/domain/entity/ProductEntity.java

@@ -0,0 +1,45 @@
+package com.gis.domain.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by owen on 2021/3/5 0026 12:13
+ * 产品表
+ */
+@Data
+@Entity
+@Table(name = "zt_product")
+public class ProductEntity extends ZtBaseEntity implements Serializable {
+
+
+    private static final long serialVersionUID = 6633188291392010635L;
+
+
+    @ApiModelProperty(value = "产品编码")
+    private Integer code;
+
+    @ApiModelProperty(value = "项目名称")
+    private String name;
+    @Column(name = "createdDate")
+    @ApiModelProperty(value = "创建日期")
+    private Date createdDate;
+
+
+    @ApiModelProperty(value = "状态:normal")
+    private String status;
+
+    @Column(name = "createdBy") // 指定字段就不会自动转下换线
+    @ApiModelProperty(value = "创建人")
+    private String createdBy;
+
+
+
+
+}

+ 50 - 0
gis_domain/src/main/java/com/gis/domain/entity/ProjectEntity.java

@@ -0,0 +1,50 @@
+package com.gis.domain.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.sql.Date;
+
+/**
+ * Created by owen on 2021/3/5 0026 12:13
+ * 项目表
+ */
+@Data
+@Entity
+@Table(name = "zt_project")
+public class ProjectEntity extends ZtBaseEntity implements Serializable {
+    private static final long serialVersionUID = 6525982455586117481L;
+
+
+
+    @ApiModelProperty(value = "项目名称")
+    private String name;
+
+    @ApiModelProperty(value = "项目号")
+    private String code;
+
+    @ApiModelProperty(value = "开始日期,yyyy-MM-dd")
+    private String begin;
+
+    @ApiModelProperty(value = "结束日期,yyyy-MM-dd")
+    private String end;
+
+    @ApiModelProperty(value = "需要工时,单位:天")
+    private Integer days;
+
+
+    @ApiModelProperty(value = "状态:wait")
+    private String status;
+
+    @Column(name = "openedBy") // 指定字段就不会自动转下换线
+    @ApiModelProperty(value = "创建人")
+    private String openedBy;
+
+
+
+
+}

+ 58 - 0
gis_domain/src/main/java/com/gis/domain/entity/TaskEntity.java

@@ -0,0 +1,58 @@
+package com.gis.domain.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import java.io.Serializable;
+
+/**
+ * Created by owen on 2021/3/5 0026 12:13
+ * 任务表
+ */
+@Data
+@Entity
+@Table(name = "zt_task")
+public class TaskEntity extends ZtBaseEntity implements Serializable {
+
+
+    private static final long serialVersionUID = 6633188291392010635L;
+
+
+    @ApiModelProperty(value = "任务名称")
+    private String name;
+
+//    @Column(name = "project")
+    @ApiModelProperty(value = "项目id")
+    private Integer project;
+
+    @ApiModelProperty(value = "任务类型")
+    private String type;
+
+    @ApiModelProperty(value = "计划耗时")
+    private String estimate;
+
+    @ApiModelProperty(value = "已消费时间")
+    private String consumed;
+
+    @ApiModelProperty(value = "状态")
+    private String status;
+
+    @Column(name = "openedBy")
+    @ApiModelProperty(value = "创建人")
+    private String openedBy;
+
+    @Column(name = "assignedTo")
+    @ApiModelProperty(value = "任务执行者")
+    private String assignedTo;
+
+
+
+
+
+
+
+
+}

+ 34 - 0
gis_domain/src/main/java/com/gis/domain/entity/TaskesTimateEntity.java

@@ -0,0 +1,34 @@
+package com.gis.domain.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by owen on 2021/3/5 0026 12:13
+ * 工时表
+ */
+@Data
+@Entity
+@Table(name = "zt_taskestimate")
+public class TaskesTimateEntity extends ZtBaseEntity implements Serializable {
+
+
+    private static final long serialVersionUID = -7443465755442516963L;
+    @ApiModelProperty(value = "账号")
+    private String account;
+
+    @ApiModelProperty(value = "消耗时间")
+    private String consumed;
+
+    @ApiModelProperty(value = "任务id")
+    private Integer task;
+
+    @ApiModelProperty(value = "日期")
+    private Date date;
+
+}

+ 37 - 0
gis_domain/src/main/java/com/gis/domain/entity/UserEntity.java

@@ -0,0 +1,37 @@
+package com.gis.domain.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by owen on 2021/3/5 0026 12:13
+ * 产品表
+ */
+@Data
+@Entity
+@Table(name = "zt_user")
+public class UserEntity extends ZtBaseEntity implements Serializable {
+
+
+    private static final long serialVersionUID = 6633188291392010635L;
+
+
+    @ApiModelProperty(value = "账号")
+    private String account;
+
+    @ApiModelProperty(value = "真实姓名")
+    private String realname;
+
+    @ApiModelProperty(value = "部门")
+    private Integer dept;
+
+
+
+
+}

+ 42 - 0
gis_domain/src/main/java/com/gis/domain/entity/ZtBaseEntity.java

@@ -0,0 +1,42 @@
+package com.gis.domain.entity;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.*;
+import java.util.Date;
+
+@Data
+@MappedSuperclass
+public abstract class ZtBaseEntity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    @ApiModelProperty(value = "对象ID")
+    private Long id;
+
+    @JSONField(serialize = false)
+    @ApiModelProperty(value = "是否删除,0:正常, 1:删除")
+    private Integer deleted;
+
+//    @ApiModelProperty(value = "创建时间")
+//    @Temporal(TemporalType.TIMESTAMP)
+//    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
+//    private Date createTime;
+//
+//    @ApiModelProperty(value = "修改时间")
+//    @Temporal(TemporalType.TIMESTAMP)
+//    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
+//    private Date updateTime;
+//
+//    /**
+//     * 用来批量操作的
+//     * A: 激活  I:禁用
+//     */
+//    @JsonIgnore
+//    @JSONField(serialize = false)
+//    private Integer isDelete;
+}

+ 41 - 0
gis_domain/src/main/java/com/gis/domain/vo/DeptEffortVo.java

@@ -0,0 +1,41 @@
+package com.gis.domain.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by owen on 2021/3/5 0026 12:13
+ * 工时表(windows版用这个,生产环境不用这个表统计)
+ */
+@Data
+public class DeptEffortVo implements Serializable {
+
+
+    private static final long serialVersionUID = 6265805965200890355L;
+    @ApiModelProperty(value = "账号")
+    private String account;
+
+    @ApiModelProperty(value = "真实姓名")
+    private String realname;
+
+    @ApiModelProperty(value = "消耗时间, 单位是天")
+    private String consumed;
+
+    @ApiModelProperty(value = "日期")
+    private Date date;
+
+//    @ApiModelProperty(value = "部门id")
+//    private String deptId;
+
+    @ApiModelProperty(value = "部门名称")
+    private String deptName;
+
+
+
+
+
+
+}

+ 53 - 0
gis_domain/src/main/java/com/gis/domain/vo/EffortVo.java

@@ -0,0 +1,53 @@
+package com.gis.domain.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by owen on 2021/3/5 0026 12:13
+ * 工时表(windows版用这个,生产环境不用这个表统计)
+ */
+@Data
+public class EffortVo  implements Serializable {
+
+
+    private static final long serialVersionUID = 6265805965200890355L;
+    @ApiModelProperty(value = "账号")
+    private String account;
+
+    @ApiModelProperty(value = "真实姓名")
+    private String realname;
+
+    @ApiModelProperty(value = "消耗时间, 单位是天")
+    private String consumed;
+
+    @ApiModelProperty(value = "项目id")
+    private Integer project;
+
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
+
+    @ApiModelProperty(value = "项目号")
+    private String code;
+
+    @ApiModelProperty(value = "日期")
+    private Date date;
+
+    @ApiModelProperty(value = "任务号")
+    private String task;
+
+    @ApiModelProperty(value = "部门id")
+    private String deptId;
+
+    @ApiModelProperty(value = "部门名称")
+    private String deptName;
+
+
+
+
+
+
+}

+ 21 - 0
gis_mapper/pom.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>zentao_age</artifactId>
+        <groupId>com.gis</groupId>
+        <version>1.0.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>gis_mapper</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.gis</groupId>
+            <artifactId>gis_domain</artifactId>
+        </dependency>
+    </dependencies>
+</project>

+ 15 - 0
gis_mapper/src/main/java/com/gis/mapper/DeptMapper.java

@@ -0,0 +1,15 @@
+package com.gis.mapper;
+
+
+import com.gis.domain.entity.UserEntity;
+import com.gis.mapper.ZtBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
+
+
+@Component
+@Mapper
+public interface DeptMapper extends ZtBaseMapper<UserEntity, Long> {
+
+
+}

+ 27 - 0
gis_mapper/src/main/java/com/gis/mapper/EffortMapper.java

@@ -0,0 +1,27 @@
+package com.gis.mapper;
+
+
+import com.gis.domain.entity.EffortEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+
+@Component
+@Mapper
+public interface EffortMapper extends ZtBaseMapper<EffortEntity, Long> {
+
+
+    @Select("select id, project , date, account, consumed from zt_effort where deleted = '0' and project = #{projectId} and account = #{account}")
+    List<EffortEntity> findEffortByProjectIdAndAccount(String projectId, String account);
+
+    // 按月份查询 date: yyyy-MM-dd
+    @Select("SELECT * FROM zt_effort WHERE deleted = '0' AND  project = #{projectId} and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT(#{date} , '%Y%m' )")
+    List<EffortEntity> findEffortByMonth(String projectId, String date);
+
+    // 按月份统计每个人的总工时 date: yyyy-MM-dd
+    @Select("SELECT id,project,date,account, SUM(consumed) as consumed FROM zt_effort WHERE deleted = '0' AND  project = #{projectId} and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT(#{date} , '%Y%m' ) GROUP BY account ")
+    List<EffortEntity> sumEffortByMonth(String projectId, String date);
+}

+ 25 - 0
gis_mapper/src/main/java/com/gis/mapper/IBaseMapper.java

@@ -0,0 +1,25 @@
+package com.gis.mapper;
+
+import com.gis.domain.entity.BaseEntity;
+import com.gis.domain.entity.TaskEntity;
+import org.apache.ibatis.annotations.Select;
+import org.hibernate.mapping.Map;
+import tk.mybatis.mapper.common.BaseMapper;
+import tk.mybatis.mapper.common.ConditionMapper;
+import tk.mybatis.mapper.common.IdsMapper;
+import tk.mybatis.mapper.common.special.InsertListMapper;
+
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by owen on 2020/2/18 0018 11:27
+ */
+
+public interface IBaseMapper<T extends BaseEntity, ID extends Serializable> extends BaseMapper<T>,
+        ConditionMapper<T>, IdsMapper<T>, InsertListMapper<T> {
+
+
+
+}

+ 20 - 0
gis_mapper/src/main/java/com/gis/mapper/MyBaseMapper.java

@@ -0,0 +1,20 @@
+package com.gis.mapper;
+
+
+import com.gis.domain.entity.UserEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+
+@Component
+@Mapper
+public interface MyBaseMapper extends ZtBaseMapper<UserEntity, Long> {
+
+    @Select("select id, name from zt_dept")
+    List<Map<String, String>> getDept();
+
+}

+ 15 - 0
gis_mapper/src/main/java/com/gis/mapper/ProductMapper.java

@@ -0,0 +1,15 @@
+package com.gis.mapper;
+
+
+import com.gis.domain.entity.ProductEntity;
+import com.gis.domain.entity.ProjectEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
+
+
+@Component
+@Mapper
+public interface ProductMapper extends ZtBaseMapper<ProductEntity, Long> {
+
+
+}

+ 14 - 0
gis_mapper/src/main/java/com/gis/mapper/ProjectMapper.java

@@ -0,0 +1,14 @@
+package com.gis.mapper;
+
+
+import com.gis.domain.entity.ProjectEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
+
+
+@Component
+@Mapper
+public interface ProjectMapper extends ZtBaseMapper<ProjectEntity, Long> {
+
+
+}

+ 29 - 0
gis_mapper/src/main/java/com/gis/mapper/TaskMapper.java

@@ -0,0 +1,29 @@
+package com.gis.mapper;
+
+
+import com.gis.common.util.Result;
+import com.gis.domain.entity.EffortEntity;
+import com.gis.domain.entity.TaskEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+
+@Component
+@Mapper
+public interface TaskMapper extends ZtBaseMapper<TaskEntity, Long> {
+
+
+    @Select("select * from zt_task where deleted = '0' and assignedTo = #{account}")
+    List<TaskEntity> myTask(String account);
+
+    // 分组查询
+    @Select("select id, project ,assignedTo from zt_task where deleted = '0' and project = #{projectId} group by assignedTo")
+    List<TaskEntity> findAccountByProjectId(String projectId);
+
+    // 按月份统计每个人的总工时 date: yyyy-MM-dd
+    @Select("SELECT id,project,date,account, SUM(consumed) as consumed FROM zt_effort WHERE deleted = '0' AND  project = #{projectId} and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT(#{date} , '%Y%m' ) GROUP BY account ")
+    List<EffortEntity> sumEffortByMonth(String projectId, String date);
+}

+ 63 - 0
gis_mapper/src/main/java/com/gis/mapper/TaskesTimateMapper.java

@@ -0,0 +1,63 @@
+package com.gis.mapper;
+
+
+import com.gis.domain.dto.DeptDto;
+import com.gis.domain.dto.EffortDto;
+import com.gis.domain.entity.EffortEntity;
+import com.gis.domain.entity.TaskesTimateEntity;
+import com.gis.domain.vo.DeptEffortVo;
+import com.gis.domain.vo.EffortVo;
+import com.gis.mapper.provider.TaskesTimateProvider;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.SelectProvider;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+
+@Component
+@Mapper
+public interface TaskesTimateMapper extends ZtBaseMapper<TaskesTimateEntity, Long> {
+
+
+    @Select("select id, project , date, account, consumed from zt_effort where deleted = '0' and project = #{projectId} and account = #{account}")
+    List<EffortEntity> findEffortByProjectIdAndAccount(String projectId, String account);
+
+    // 按月份查询 date: yyyy-MM-dd
+    @Select("SELECT * FROM zt_effort WHERE deleted = '0' AND  project = #{projectId} and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT(#{date} , '%Y%m' )")
+    List<EffortEntity> findEffortByMonth(String projectId, String date);
+
+    // 按月份统计每个人的总工时 date: yyyy-MM-dd, 连表查询,如果效率慢,就用in
+
+    /**
+     * 工时单位:天, 保留两位小数
+     */
+    @Select("SELECT a.* , b.project, ROUND(SUM(a.consumed/8),2) as consumed,c.code, c.name as projectName, d.realname as realname " +
+            "FROM zt_taskestimate a left join zt_task b on b.id = a.task left join zt_project c on c.id=b.project left join zt_user d  on d.account = a.account " +
+            "WHERE b.deleted = '0' AND  b.project = #{projectId} and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT(#{date} , '%Y%m' ) GROUP BY a.account ")
+    List<EffortVo> sumEffortByMonth(String projectId, String date);
+
+    // 查询当月所有项目每个人的总工时
+    @Select("SELECT a.id, a.account, a.task , b.project, ROUND(SUM(a.consumed/8),2) as consumed,c.code, c.name as projectName, d.realname as realname " +
+            "FROM zt_taskestimate a left join zt_task b on b.id = a.task left join zt_project c on c.id=b.project left join zt_user d  on d.account = a.account " +
+            "WHERE b.deleted = '0' AND DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT(#{date} , '%Y%m' ) GROUP BY a.account, b.project order by c.id, a.account ")
+    List<EffortVo> allProjectEffortByMonth(String date);
+
+    @SelectProvider(type = TaskesTimateProvider.class, method = "search")
+    List<EffortVo> effortByMonth(DeptDto param);
+
+    /**
+     * 统计部门每月工时
+     * @param deptId 部门id
+     * @param date 日期 : yyyy-MM-dd
+     * @return
+     */
+    @Select("select f.account, f.date, ROUND(sum(f.consumed),2) as consumed, f.realname , f.deptName from " +
+            " (select a.*,b.project,c.name as projectName,c.code,d.realname as realname,e.name as deptName from zt_taskestimate a " +
+            "left join zt_task b on b.id = a.task left join zt_project c on c.id=b.project " +
+            "left join zt_user d  on d.account = a.account left join zt_dept e on d.dept = e.id " +
+            "where  b.deleted = '0' AND DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT(#{date} , '%Y%m' ) AND e.id = #{deptId}) as f " +
+            "group by f.account, f.date")
+    List<DeptEffortVo> deptEffortByMonth(String deptId, String date);
+}

+ 14 - 0
gis_mapper/src/main/java/com/gis/mapper/UserMapper.java

@@ -0,0 +1,14 @@
+package com.gis.mapper;
+
+
+import com.gis.domain.entity.UserEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
+
+
+@Component
+@Mapper
+public interface UserMapper extends ZtBaseMapper<UserEntity, Long> {
+
+
+}

+ 18 - 0
gis_mapper/src/main/java/com/gis/mapper/ZtBaseMapper.java

@@ -0,0 +1,18 @@
+package com.gis.mapper;
+
+import com.gis.domain.entity.BaseEntity;
+import com.gis.domain.entity.ZtBaseEntity;
+import tk.mybatis.mapper.common.BaseMapper;
+import tk.mybatis.mapper.common.ConditionMapper;
+import tk.mybatis.mapper.common.IdsMapper;
+import tk.mybatis.mapper.common.special.InsertListMapper;
+
+import java.io.Serializable;
+
+/**
+ * Created by owen on 2020/2/18 0018 11:27
+ */
+
+public interface ZtBaseMapper<T extends ZtBaseEntity, ID extends Serializable> extends BaseMapper<T>,
+        ConditionMapper<T>, IdsMapper<T>, InsertListMapper<T> {
+}

+ 36 - 0
gis_mapper/src/main/java/com/gis/mapper/provider/DemProvider.java

@@ -0,0 +1,36 @@
+package com.gis.mapper.provider;
+
+import com.gis.domain.dto.PageDto;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * Created by owen on 2021/2/26 0026 16:33
+ */
+@Slf4j
+public class DemProvider {
+
+    public String search(PageDto param){
+        StringBuffer sql = new StringBuffer("select * from tb_dem where is_delete = 0");
+
+//        if(!StringUtils.isAllBlank(userId)){
+//            sql.append(" and ( user_id = '").append(userId).append("' )");
+//        }
+
+        String searchKey = param.getSearchKey();
+        if(!StringUtils.isAllBlank(searchKey)){
+            sql.append(" and ( name like '%").append(searchKey).append("%' )");
+        }
+
+//        String type = param.getType();
+//        if(!StringUtils.isAllBlank(type)){
+//            sql.append(" and ( type = '").append(type).append("' )");
+//        }
+
+        sql.append(" order by create_time desc");
+
+        log.info("sql: {}", sql.toString());
+        return sql.toString();
+    }
+
+}

+ 53 - 0
gis_mapper/src/main/java/com/gis/mapper/provider/TaskesTimateProvider.java

@@ -0,0 +1,53 @@
+package com.gis.mapper.provider;
+
+import com.gis.domain.dto.DeptDto;
+import com.gis.domain.dto.EffortDto;
+import com.gis.domain.dto.PageDto;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * Created by owen on 2021/2/26 0026 16:33
+ */
+@Slf4j
+public class TaskesTimateProvider {
+
+    public String search(DeptDto param){
+        StringBuffer sql = new StringBuffer("select a.*,b.project,c.name as projectName,c.code,d.realname as realname, e.id as deptId, e.name as deptName " +
+                "from zt_taskestimate a left join zt_task b on b.id = a.task left join zt_project c on c.id=b.project " +
+                "left join zt_user d  on d.account = a.account left join zt_dept e on d.dept = e.id " +
+                "where b.deleted = '0' ");
+
+
+
+//        String account = param.getAccount();
+//        if(StringUtils.isNotBlank(account)){
+//            sql.append(" AND a.account = '").append(account).append("'");
+//        }
+//
+//        String project = param.getProject();
+//        if(StringUtils.isNotBlank(project)){
+//            sql.append(" and b.project = '").append(project).append("'");
+//        }
+
+
+        String deptId = param.getDeptId();
+        if(StringUtils.isNotBlank(deptId)){
+            sql.append(" and e.id = '").append(deptId).append("'");
+        }
+
+        String date = param.getDate();
+        if(StringUtils.isNotBlank(date)){
+            // DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT('2021-03-1' , '%Y%m' )
+            sql.append(" AND DATE_FORMAT (date, '%Y%m') = DATE_FORMAT( '").append(date).append("', '%Y%m' )");
+        }
+
+
+
+        sql.append(" order by a.account asc");
+
+        log.info("sql: {}", sql.toString());
+        return sql.toString();
+    }
+
+}

+ 23 - 0
gis_service/pom.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>zentao_age</artifactId>
+        <groupId>com.gis</groupId>
+        <version>1.0.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>gis_service</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.gis</groupId>
+            <artifactId>gis_mapper</artifactId>
+        </dependency>
+    </dependencies>
+
+
+</project>

+ 23 - 0
gis_service/src/main/java/com/gis/service/EffortService.java

@@ -0,0 +1,23 @@
+package com.gis.service;
+
+
+import com.gis.common.util.Result;
+import com.gis.domain.dto.PageDto;
+import com.gis.domain.entity.EffortEntity;
+import com.gis.domain.entity.TaskEntity;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:14
+ */
+public interface EffortService extends IBaseService<EffortEntity, Long> {
+
+
+    Result<EffortEntity> search(PageDto param);
+
+    Result<EffortEntity> findEffortByProjectIdAndAccount(String projectId, String account);
+
+    Result<EffortEntity> findEffortByMonth(String projectId, String month);
+
+    Result<EffortEntity> sumEffortByMonth(String projectId, String date);
+}

+ 55 - 0
gis_service/src/main/java/com/gis/service/EffortServiceImpl.java

@@ -0,0 +1,55 @@
+package com.gis.service;
+
+import com.gis.common.constant.ConfigConstant;
+import com.gis.common.util.Result;
+import com.gis.domain.dto.PageDto;
+import com.gis.domain.entity.EffortEntity;
+import com.gis.mapper.EffortMapper;
+import com.gis.mapper.ZtBaseMapper;
+import com.gis.service.impl.ZtBaseServiceImpl;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:16
+ */
+@Slf4j
+@Service
+public class EffortServiceImpl extends ZtBaseServiceImpl<EffortEntity, Long> implements EffortService {
+
+    @Autowired
+    private EffortMapper entityMapper;
+
+    @Override
+    public ZtBaseMapper<EffortEntity, Long> getBaseMapper() {
+        return this.entityMapper;
+    }
+
+
+
+
+    @Override
+    public Result<EffortEntity> search(PageDto param) {
+        startPage(param);
+        return Result.success(new PageInfo<>(this.findAll()));
+    }
+
+    @Override
+    public Result<EffortEntity> findEffortByProjectIdAndAccount(String projectId, String account) {
+        return Result.success(entityMapper.findEffortByProjectIdAndAccount(projectId, account));
+    }
+
+    @Override
+    public Result<EffortEntity> findEffortByMonth(String projectId, String date) {
+
+        return Result.success(entityMapper.findEffortByMonth(projectId, date));
+    }
+
+    @Override
+    public Result<EffortEntity> sumEffortByMonth(String projectId, String date) {
+        return Result.success(entityMapper.sumEffortByMonth(projectId, date));
+    }
+}

+ 47 - 0
gis_service/src/main/java/com/gis/service/IBaseService.java

@@ -0,0 +1,47 @@
+package com.gis.service;
+
+import com.github.pagehelper.PageInfo;
+import tk.mybatis.mapper.entity.Condition;
+
+import java.io.Serializable;
+import java.util.List;
+
+public interface IBaseService<T, ID extends Serializable> {
+
+    public abstract T findById(ID id);
+
+    public abstract T findOne(T entity);
+
+    public abstract List<T> findByIds(String ids);
+
+    public abstract long count();
+
+    public abstract boolean exists(ID id);
+
+    public abstract int save(T entity);
+
+    public abstract int update(T entity);
+
+    public abstract int updateAll(T entity);
+
+    public abstract int deleteById(ID id);
+
+    public abstract int deleteByIds(String ids);
+
+    public abstract int delete(T entity);
+
+    public abstract List<T> findAll(Condition condition, String orderBy);
+
+    public abstract List<T> findAll(Condition condition);
+
+    public abstract List<T> findAll();
+
+    public abstract PageInfo<T> findAll(int pageNum, int pageSize);
+
+    public abstract PageInfo<T> findAll(int pageNum, int pageSize, String orderBy);
+
+    public abstract PageInfo<T> findAll(Condition condition, int pageNum, int pageSize);
+
+    public abstract PageInfo<T> findAll(Condition condition, int pageNum, int pageSize, String orderBy);
+
+}

+ 16 - 0
gis_service/src/main/java/com/gis/service/ProductService.java

@@ -0,0 +1,16 @@
+package com.gis.service;
+
+
+import com.gis.common.util.Result;
+import com.gis.domain.entity.ProductEntity;
+import com.gis.domain.dto.PageDto;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:14
+ */
+public interface ProductService extends IBaseService<ProductEntity, Long> {
+
+
+    Result<ProductEntity> search(PageDto param);
+}

+ 16 - 0
gis_service/src/main/java/com/gis/service/ProjectService.java

@@ -0,0 +1,16 @@
+package com.gis.service;
+
+
+import com.gis.common.util.Result;
+import com.gis.domain.entity.ProjectEntity;
+import com.gis.domain.dto.PageDto;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:14
+ */
+public interface ProjectService extends IBaseService<ProjectEntity, Long> {
+
+
+    Result<ProjectEntity> search(PageDto param);
+}

+ 27 - 0
gis_service/src/main/java/com/gis/service/TaskService.java

@@ -0,0 +1,27 @@
+package com.gis.service;
+
+
+import com.gis.common.util.Result;
+import com.gis.domain.dto.EffortDto;
+import com.gis.domain.entity.EffortEntity;
+import com.gis.domain.entity.TaskEntity;
+import com.gis.domain.dto.PageDto;
+import com.gis.domain.vo.EffortVo;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:14
+ */
+public interface TaskService extends IBaseService<TaskEntity, Long> {
+
+
+    Result<TaskEntity> search(PageDto param);
+
+    Result<TaskEntity> myTask(String account);
+
+    Result<TaskEntity> findAccountByProjectId(String projectId);
+
+    Result<EffortVo> sumEffortByMonth(String projectId, String date);
+
+
+}

+ 31 - 0
gis_service/src/main/java/com/gis/service/TaskesTimateService.java

@@ -0,0 +1,31 @@
+package com.gis.service;
+
+
+import com.gis.common.util.Result;
+import com.gis.domain.dto.DeptDto;
+import com.gis.domain.dto.EffortDto;
+import com.gis.domain.dto.PageDto;
+import com.gis.domain.entity.TaskesTimateEntity;
+import com.gis.domain.entity.UserEntity;
+import com.gis.domain.vo.DeptEffortVo;
+import com.gis.domain.vo.EffortVo;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:14
+ */
+public interface TaskesTimateService extends IBaseService<TaskesTimateEntity, Long> {
+
+
+    Result<EffortVo> search(PageDto param);
+
+    Result<EffortVo> allProjectEffortByMonthExcel(String date);
+
+//    Result<EffortVo> sumEffortByMonthExcel(String projectId, String date);
+
+    Result<EffortVo> effortByMonthExcel(DeptDto param);
+
+    Result<DeptEffortVo> deptEffortByMonthExcel(DeptDto param);
+
+
+}

+ 16 - 0
gis_service/src/main/java/com/gis/service/UserService.java

@@ -0,0 +1,16 @@
+package com.gis.service;
+
+
+import com.gis.common.util.Result;
+import com.gis.domain.entity.UserEntity;
+import com.gis.domain.dto.PageDto;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:14
+ */
+public interface UserService extends IBaseService<UserEntity, Long> {
+
+
+    Result<UserEntity> search(PageDto param);
+}

+ 47 - 0
gis_service/src/main/java/com/gis/service/ZtBaseService.java

@@ -0,0 +1,47 @@
+package com.gis.service;
+
+import com.github.pagehelper.PageInfo;
+import tk.mybatis.mapper.entity.Condition;
+
+import java.io.Serializable;
+import java.util.List;
+
+public interface ZtBaseService<T, ID extends Serializable> {
+
+    public abstract T findById(ID id);
+
+    public abstract T findOne(T entity);
+
+    public abstract List<T> findByIds(String ids);
+
+    public abstract long count();
+
+    public abstract boolean exists(ID id);
+
+    public abstract int save(T entity);
+
+    public abstract int update(T entity);
+
+    public abstract int updateAll(T entity);
+
+    public abstract int deleteById(ID id);
+
+    public abstract int deleteByIds(String ids);
+
+    public abstract int delete(T entity);
+
+    public abstract List<T> findAll(Condition condition, String orderBy);
+
+    public abstract List<T> findAll(Condition condition);
+
+    public abstract List<T> findAll();
+
+    public abstract PageInfo<T> findAll(int pageNum, int pageSize);
+
+    public abstract PageInfo<T> findAll(int pageNum, int pageSize, String orderBy);
+
+    public abstract PageInfo<T> findAll(Condition condition, int pageNum, int pageSize);
+
+    public abstract PageInfo<T> findAll(Condition condition, int pageNum, int pageSize, String orderBy);
+
+}

+ 186 - 0
gis_service/src/main/java/com/gis/service/impl/IBaseServiceImpl.java

@@ -0,0 +1,186 @@
+package com.gis.service.impl;
+
+import com.gis.domain.dto.PageDto;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.gis.mapper.IBaseMapper;
+import com.gis.domain.entity.BaseEntity;
+import com.gis.service.IBaseService;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+import tk.mybatis.mapper.entity.Condition;
+
+import java.io.Serializable;
+import java.lang.reflect.ParameterizedType;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by owen on 2020/2/18 0018 11:22
+ */
+@Transactional
+public abstract class IBaseServiceImpl<T extends BaseEntity, ID extends Serializable> implements IBaseService<T, ID> {
+
+    public abstract IBaseMapper<T, ID> getBaseMapper();
+
+    private Class<T> entityClass;
+
+    public IBaseServiceImpl(){
+        ParameterizedType pt = (ParameterizedType) this.getClass().getGenericSuperclass();
+        entityClass = (Class<T>) pt.getActualTypeArguments()[0];
+    }
+
+    @Override
+    public T findById(ID id){
+        Condition condition = new Condition(entityClass);
+        condition.createCriteria().andEqualTo("id", id);
+        condition.and().andEqualTo("isDelete", 0);
+        List<T> ts = getBaseMapper().selectByCondition(condition);
+        if (ts != null && ts.size() > 0){
+            return ts.get(0);
+        }else{
+            return null;
+        }
+    }
+
+    @Override
+    public T findOne(T entity){
+        entity.setIsDelete(0);
+        return getBaseMapper().selectOne(entity);
+    }
+
+    @Override
+    public List<T> findAll(){
+        Condition condition = new Condition(entityClass);
+        condition.createCriteria().andEqualTo("isDelete", 0);
+        return getBaseMapper().selectByCondition(condition);
+    }
+
+    /**
+     * 根据主键字符串进行查询,类中只有存在一个带有@Id注解的字段
+     *
+     * @param ids 如 "1,2,3,4"
+     * @return
+     */
+    @Override
+    public List<T> findByIds(String ids){
+        return getBaseMapper().selectByIds(ids);
+    }
+
+    @Override
+    public long count(){
+        List<T> all = this.findAll();
+        if (all != null && all.size() > 0){
+            return all.size();
+        }
+        return 0;
+    }
+
+    @Override
+    public boolean exists(ID id){
+        return getBaseMapper().existsWithPrimaryKey(id);
+    }
+
+    @Override
+    public int save(T entity) {
+        //migration之后要删掉判断
+        if (entity.getCreateTime() == null){
+            entity.setCreateTime(new Date());
+        }
+        if (entity.getUpdateTime() == null){
+            entity.setUpdateTime(new Date());
+        }
+        entity.setIsDelete(0);
+        return getBaseMapper().insertSelective(entity);
+    }
+
+    @Override
+    public int update(T entity) {
+        //migration之后要删掉判断
+        if (entity.getUpdateTime() == null){
+            entity.setUpdateTime(new Date());
+        }
+        return getBaseMapper().updateByPrimaryKeySelective(entity);
+    }
+
+    @Override
+    public int updateAll(T entity) {
+        //migration之后要删掉判断
+        if (entity.getUpdateTime() == null){
+            entity.setUpdateTime(new Date());
+        }
+        return getBaseMapper().updateByPrimaryKey(entity);
+    }
+
+    @Override
+    public int deleteById(ID id) {
+        return getBaseMapper().deleteByPrimaryKey(id);
+    }
+
+    @Override
+    public int deleteByIds(String ids){
+        return getBaseMapper().deleteByIds(ids);
+    }
+
+    @Override
+    public int delete(T entity){
+        return getBaseMapper().delete(entity);
+    }
+
+    public List<T> findAll(Condition condition){
+        condition.and().andEqualTo("isDelete", 0);
+        return getBaseMapper().selectByCondition(condition);
+    }
+
+    public List<T> findAll(Condition condition, String orderBy){
+        condition.and().andEqualTo("isDelete", 0);
+        if (!StringUtils.isEmpty(orderBy)){
+            PageHelper.orderBy(orderBy);
+        }
+        return getBaseMapper().selectByCondition(condition);
+    }
+
+    public PageInfo<T> findAll(int pageNum, int pageSize){
+        PageHelper.startPage(pageNum, pageSize);
+        return new PageInfo<>(this.findAll());
+    }
+
+    public PageInfo<T> findAll(int pageNum, int pageSize, String orderBy){
+        PageHelper.startPage(pageNum, pageSize);
+        if (!StringUtils.isEmpty(orderBy)){
+            PageHelper.orderBy(orderBy);
+        }
+        return new PageInfo<>(this.findAll());
+    }
+
+    public PageInfo<T> findAll(Condition condition, int pageNum, int pageSize){
+        PageHelper.startPage(pageNum, pageSize);
+        return new PageInfo<>(this.findAll(condition));
+    }
+
+    public PageInfo<T> findAll(Condition condition, int pageNum, int pageSize, String orderBy){
+        PageHelper.startPage(pageNum, pageSize);
+        if (!StringUtils.isEmpty(orderBy)){
+            PageHelper.orderBy(orderBy);
+        }
+        return new PageInfo<>(this.findAll(condition));
+    }
+
+    /**
+     * 设置请求分页数据
+     */
+    public void startPage(PageDto param){
+        Integer pageNum = param.getPageNum();
+        Integer pageSize = param.getPageSize();
+        if (pageNum == null || pageNum <= 0) {
+            pageNum = 0;
+        }
+
+        if (pageSize == null || pageSize <= 0) {
+            pageSize = 10;
+        }
+
+        PageHelper.startPage(pageNum, pageSize);
+
+    }
+}

+ 40 - 0
gis_service/src/main/java/com/gis/service/impl/ProductServiceImpl.java

@@ -0,0 +1,40 @@
+package com.gis.service.impl;
+
+import com.gis.common.constant.ConfigConstant;
+import com.gis.common.util.Result;
+import com.gis.domain.entity.ProductEntity;
+import com.gis.domain.dto.PageDto;
+import com.gis.mapper.ProductMapper;
+import com.gis.mapper.ZtBaseMapper;
+import com.gis.service.ProductService;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:16
+ */
+@Slf4j
+@Service
+public class ProductServiceImpl extends ZtBaseServiceImpl<ProductEntity, Long> implements ProductService {
+
+    @Autowired
+    private ProductMapper entityMapper;
+
+    @Override
+    public ZtBaseMapper<ProductEntity, Long> getBaseMapper() {
+        return this.entityMapper;
+    }
+
+    @Autowired
+    ConfigConstant configConstant;
+
+
+    @Override
+    public Result<ProductEntity> search(PageDto param) {
+        startPage(param);
+        return Result.success(new PageInfo<>(this.findAll()));
+    }
+}

+ 41 - 0
gis_service/src/main/java/com/gis/service/impl/ProjectServiceImpl.java

@@ -0,0 +1,41 @@
+package com.gis.service.impl;
+
+import com.gis.common.constant.ConfigConstant;
+import com.gis.common.util.Result;
+import com.gis.domain.entity.ProjectEntity;
+import com.gis.domain.dto.PageDto;
+import com.gis.mapper.ProjectMapper;
+import com.gis.mapper.ZtBaseMapper;
+import com.gis.service.ProjectService;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:16
+ */
+@Slf4j
+@Service
+public class ProjectServiceImpl extends ZtBaseServiceImpl<ProjectEntity, Long> implements ProjectService {
+
+    @Autowired
+    private ProjectMapper entityMapper;
+
+    @Override
+    public ZtBaseMapper<ProjectEntity, Long> getBaseMapper() {
+        return this.entityMapper;
+    }
+
+    @Autowired
+    ConfigConstant configConstant;
+
+
+    @Override
+    public Result<ProjectEntity> search(PageDto param) {
+        startPage(param);
+        return Result.success(new PageInfo<>(this.findAll()));
+    }
+
+}

+ 63 - 0
gis_service/src/main/java/com/gis/service/impl/TaskServiceImpl.java

@@ -0,0 +1,63 @@
+package com.gis.service.impl;
+
+import com.gis.common.constant.ConfigConstant;
+import com.gis.common.util.Result;
+import com.gis.domain.dto.EffortDto;
+import com.gis.domain.entity.TaskEntity;
+import com.gis.domain.dto.PageDto;
+import com.gis.domain.vo.EffortVo;
+import com.gis.mapper.TaskMapper;
+import com.gis.mapper.TaskesTimateMapper;
+import com.gis.mapper.ZtBaseMapper;
+import com.gis.service.TaskService;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * Created by owen on 2020/3/11 0011 16:16
+ */
+@Slf4j
+@Service
+public class TaskServiceImpl extends ZtBaseServiceImpl<TaskEntity, Long> implements TaskService {
+
+    @Autowired
+    private TaskMapper entityMapper;
+
+    @Autowired
+    private TaskesTimateMapper taskesTimateMapper;
+
+    @Override
+    public ZtBaseMapper<TaskEntity, Long> getBaseMapper() {
+        return this.entityMapper;
+    }
+
+    @Autowired
+    ConfigConstant configConstant;
+
+
+    @Override
+    public Result<TaskEntity> search(PageDto param) {
+        startPage(param);
+        return Result.success(new PageInfo<>(this.findAll()));
+    }
+
+    @Override
+    public Result<TaskEntity> myTask(String account) {
+        return Result.success(entityMapper.myTask(account));
+    }
+
+    @Override
+    public Result<TaskEntity> findAccountByProjectId(String projectId) {
+        return Result.success(entityMapper.findAccountByProjectId(projectId));
+    }
+
+    @Override
+    public Result<EffortVo> sumEffortByMonth(String projectId, String date) {
+        return Result.success(taskesTimateMapper.sumEffortByMonth(projectId, date));
+    }
+
+
+
+}

+ 171 - 0
gis_service/src/main/java/com/gis/service/impl/TaskesTimateServiceImpl.java

@@ -0,0 +1,171 @@
+package com.gis.service.impl;
+
+import cn.hutool.core.date.DateUtil;
+import com.gis.common.constant.ConfigConstant;
+import com.gis.common.util.ExcelUtils;
+import com.gis.common.util.Result;
+import com.gis.domain.dto.DeptDto;
+import com.gis.domain.dto.EffortDto;
+import com.gis.domain.dto.PageDto;
+import com.gis.domain.entity.TaskesTimateEntity;
+import com.gis.domain.vo.DeptEffortVo;
+import com.gis.domain.vo.EffortVo;
+import com.gis.mapper.TaskesTimateMapper;
+import com.gis.mapper.ZtBaseMapper;
+import com.gis.service.TaskesTimateService;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:16
+ */
+@Slf4j
+@Service
+public class TaskesTimateServiceImpl extends ZtBaseServiceImpl<TaskesTimateEntity, Long> implements TaskesTimateService {
+
+    @Autowired
+    private TaskesTimateMapper entityMapper;
+
+    @Override
+    public ZtBaseMapper<TaskesTimateEntity, Long> getBaseMapper() {
+        return this.entityMapper;
+    }
+
+    @Autowired
+    ConfigConstant configConstant;
+
+
+    @Override
+    public Result<EffortVo> search(PageDto param) {
+        startPage(param);
+        return Result.success(new PageInfo<>(this.findAll()));
+    }
+
+    @Override
+    public Result<EffortVo> allProjectEffortByMonthExcel(String date) {
+
+        long start = System.currentTimeMillis();
+        List<EffortVo> effortVos = entityMapper.allProjectEffortByMonth(date);
+        long end = System.currentTimeMillis();
+        log.info("sql耗时: {}s", (end-start)/1000);
+        String time = DateUtil.format(new Date(), "yyyyMMdd_HHmmss");
+        String savePath = configConstant.serverBasePath + time + ".xlsx";
+        HashMap<String, String> rowTitle = new HashMap<>();
+
+        rowTitle.put("date", "日期");
+        rowTitle.put("project", "项目id");
+        rowTitle.put("code", "项目号");
+        rowTitle.put("projectName", "项目名称");
+        rowTitle.put("account", "账号");
+        rowTitle.put("realname", "姓名");
+        rowTitle.put("consumed", "消耗时间(单位:天)");
+        ExcelUtils.createExcel(effortVos, savePath, rowTitle);
+
+        String domain = configConstant.serverDomain + time + ".xlsx";
+        log.info("url: {}", domain);
+
+        HashMap<String, Object> result = new HashMap<>();
+        result.put("size", effortVos.size());
+        result.put("domain", domain);
+        return Result.success(domain);
+    }
+
+
+//    @Override
+//    public Result<EffortVo> sumEffortByMonthExcel(String projectId, String date) {
+//        long start = System.currentTimeMillis();
+//        List<EffortVo> effortVos = entityMapper.sumEffortByMonth(projectId, date);
+//        long end = System.currentTimeMillis();
+//        log.info("sql耗时: {}s", (end-start)/1000);
+//        String time = DateUtil.format(new Date(), "yyyyMMdd_HHmmss");
+//        String savePath = configConstant.serverBasePath + time + ".xlsx";
+//        HashMap<String, String> rowTitle = new HashMap<>();
+//
+//        rowTitle.put("date", "日期");
+//        rowTitle.put("project", "项目id");
+//        rowTitle.put("code", "项目号");
+//        rowTitle.put("projectName", "项目名称");
+//        rowTitle.put("account", "账号");
+//        rowTitle.put("realname", "姓名");
+//        rowTitle.put("consumed", "消耗时间(单位:天)");
+//        ExcelUtils.createExcel(effortVos, savePath, rowTitle);
+//
+//        HashMap<String, Object> result = new HashMap<>();
+//        result.put("size", effortVos.size());
+//        result.put("path", savePath);
+//
+//        return Result.success(result);
+//    }
+
+    @Override
+    public Result<EffortVo> effortByMonthExcel(DeptDto param) {
+        long start = System.currentTimeMillis();
+        List<EffortVo> effortVos = entityMapper.effortByMonth(param);
+
+        long end = System.currentTimeMillis();
+        String time = DateUtil.format(new Date(), "yyyyMMdd_HHmmss");
+        String savePath = configConstant.serverBasePath + time + ".xlsx";
+        HashMap<String, String> rowTitle = new HashMap<>();
+
+        rowTitle.put("date", "日期");
+        rowTitle.put("task", "任务号");
+        rowTitle.put("project", "项目id");
+        rowTitle.put("code", "项目号");
+        rowTitle.put("projectName", "项目名称");
+        rowTitle.put("account", "账号");
+        rowTitle.put("realname", "姓名");
+        rowTitle.put("consumed", "消耗时间(单位:小时)");
+        rowTitle.put("deptId", "部门Id");
+        rowTitle.put("deptName", "部门名称");
+        ExcelUtils.createExcel(effortVos, savePath, rowTitle);
+
+        log.info("sql耗时: {}s", (end-start)/1000);
+
+        String domain = configConstant.serverDomain + time + ".xlsx";
+
+        HashMap<String, Object> result = new HashMap<>();
+        result.put("size", effortVos.size());
+        result.put("path", domain);
+
+        return  Result.success(result);
+    }
+
+    @Override
+    public Result<DeptEffortVo> deptEffortByMonthExcel(DeptDto param) {
+        long start = System.currentTimeMillis();
+        List<DeptEffortVo> effortVos = entityMapper.deptEffortByMonth(param.getDeptId(), param.getDate());
+
+
+        String time = DateUtil.format(new Date(), "yyyyMMdd_HHmmss");
+        String savePath = configConstant.serverBasePath + time + ".xlsx";
+        HashMap<String, String> rowTitle = new HashMap<>();
+
+        rowTitle.put("date", "日期");
+        rowTitle.put("account", "账号");
+        rowTitle.put("realname", "姓名");
+        rowTitle.put("consumed", "消耗时间(单位:小时)");
+        rowTitle.put("deptId", "部门Id");
+        rowTitle.put("deptName", "部门名称");
+        ExcelUtils.createExcel(effortVos, savePath, rowTitle);
+
+        long end = System.currentTimeMillis();
+        log.info("耗时: {}s", (end-start)/1000);
+
+        String domain = configConstant.serverDomain + time + ".xlsx";
+
+        HashMap<String, Object> result = new HashMap<>();
+        result.put("size", effortVos.size());
+        result.put("path", domain);
+
+        return  Result.success(result);
+    }
+
+
+}

+ 40 - 0
gis_service/src/main/java/com/gis/service/impl/UserServiceImpl.java

@@ -0,0 +1,40 @@
+package com.gis.service.impl;
+
+import com.gis.common.constant.ConfigConstant;
+import com.gis.common.util.Result;
+import com.gis.domain.entity.UserEntity;
+import com.gis.domain.dto.PageDto;
+import com.gis.mapper.UserMapper;
+import com.gis.mapper.ZtBaseMapper;
+import com.gis.service.UserService;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * Created by owen on 2020/3/11 0011 16:16
+ */
+@Slf4j
+@Service
+public class UserServiceImpl extends ZtBaseServiceImpl<UserEntity, Long> implements UserService {
+
+    @Autowired
+    private UserMapper entityMapper;
+
+    @Override
+    public ZtBaseMapper<UserEntity, Long> getBaseMapper() {
+        return this.entityMapper;
+    }
+
+    @Autowired
+    ConfigConstant configConstant;
+
+
+    @Override
+    public Result<UserEntity> search(PageDto param) {
+        startPage(param);
+        return Result.success(new PageInfo<>(this.findAll()));
+    }
+}

+ 166 - 0
gis_service/src/main/java/com/gis/service/impl/ZtBaseServiceImpl.java

@@ -0,0 +1,166 @@
+package com.gis.service.impl;
+
+import com.gis.domain.entity.ZtBaseEntity;
+import com.gis.domain.dto.PageDto;
+import com.gis.mapper.ZtBaseMapper;
+import com.gis.service.ZtBaseService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+import tk.mybatis.mapper.entity.Condition;
+
+import java.io.Serializable;
+import java.lang.reflect.ParameterizedType;
+import java.util.List;
+
+/**
+ * Created by owen on 2020/2/18 0018 11:22
+ */
+@Transactional
+public abstract class ZtBaseServiceImpl<T extends ZtBaseEntity, ID extends Serializable> implements ZtBaseService<T, ID> {
+
+    public abstract ZtBaseMapper<T, ID> getBaseMapper();
+
+    private Class<T> entityClass;
+
+    public ZtBaseServiceImpl(){
+        ParameterizedType pt = (ParameterizedType) this.getClass().getGenericSuperclass();
+        entityClass = (Class<T>) pt.getActualTypeArguments()[0];
+    }
+
+    @Override
+    public T findById(ID id){
+        Condition condition = new Condition(entityClass);
+        condition.createCriteria().andEqualTo("id", id);
+        List<T> ts = getBaseMapper().selectByCondition(condition);
+        if (ts != null && ts.size() > 0){
+            return ts.get(0);
+        }else{
+            return null;
+        }
+    }
+
+    @Override
+    public T findOne(T entity){
+        return getBaseMapper().selectOne(entity);
+    }
+
+    @Override
+    public List<T> findAll(){
+        Condition condition = new Condition(entityClass);
+        return getBaseMapper().selectByCondition(condition);
+    }
+
+    /**
+     * 根据主键字符串进行查询,类中只有存在一个带有@Id注解的字段
+     *
+     * @param ids 如 "1,2,3,4"
+     * @return
+     */
+    @Override
+    public List<T> findByIds(String ids){
+        return getBaseMapper().selectByIds(ids);
+    }
+
+    @Override
+    public long count(){
+        List<T> all = this.findAll();
+        if (all != null && all.size() > 0){
+            return all.size();
+        }
+        return 0;
+    }
+
+    @Override
+    public boolean exists(ID id){
+        return getBaseMapper().existsWithPrimaryKey(id);
+    }
+
+    @Override
+    public int save(T entity) {
+
+        return getBaseMapper().insertSelective(entity);
+    }
+
+    @Override
+    public int update(T entity) {
+
+        return getBaseMapper().updateByPrimaryKeySelective(entity);
+    }
+
+    @Override
+    public int updateAll(T entity) {
+        return getBaseMapper().updateByPrimaryKey(entity);
+    }
+
+    @Override
+    public int deleteById(ID id) {
+        return getBaseMapper().deleteByPrimaryKey(id);
+    }
+
+    @Override
+    public int deleteByIds(String ids){
+        return getBaseMapper().deleteByIds(ids);
+    }
+
+    @Override
+    public int delete(T entity){
+        return getBaseMapper().delete(entity);
+    }
+
+    public List<T> findAll(Condition condition){
+        return getBaseMapper().selectByCondition(condition);
+    }
+
+    public List<T> findAll(Condition condition, String orderBy){
+        if (!StringUtils.isEmpty(orderBy)){
+            PageHelper.orderBy(orderBy);
+        }
+        return getBaseMapper().selectByCondition(condition);
+    }
+
+    public PageInfo<T> findAll(int pageNum, int pageSize){
+        PageHelper.startPage(pageNum, pageSize);
+        return new PageInfo<>(this.findAll());
+    }
+
+    public PageInfo<T> findAll(int pageNum, int pageSize, String orderBy){
+        PageHelper.startPage(pageNum, pageSize);
+        if (!StringUtils.isEmpty(orderBy)){
+            PageHelper.orderBy(orderBy);
+        }
+        return new PageInfo<>(this.findAll());
+    }
+
+    public PageInfo<T> findAll(Condition condition, int pageNum, int pageSize){
+        PageHelper.startPage(pageNum, pageSize);
+        return new PageInfo<>(this.findAll(condition));
+    }
+
+    public PageInfo<T> findAll(Condition condition, int pageNum, int pageSize, String orderBy){
+        PageHelper.startPage(pageNum, pageSize);
+        if (!StringUtils.isEmpty(orderBy)){
+            PageHelper.orderBy(orderBy);
+        }
+        return new PageInfo<>(this.findAll(condition));
+    }
+
+    /**
+     * 设置请求分页数据
+     */
+    public void startPage(PageDto param){
+        Integer pageNum = param.getPageNum();
+        Integer pageSize = param.getPageSize();
+        if (pageNum == null || pageNum <= 0) {
+            pageNum = 0;
+        }
+
+        if (pageSize == null || pageSize <= 0) {
+            pageSize = 10;
+        }
+
+        PageHelper.startPage(pageNum, pageSize);
+
+    }
+}

+ 27 - 0
gis_web/pom.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>zentao_age</artifactId>
+        <groupId>com.gis</groupId>
+        <version>1.0.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>gis_web</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.gis</groupId>
+            <artifactId>gis_service</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+    </dependencies>
+
+
+</project>

+ 13 - 0
gis_web/src/main/java/com/gis/web/aop/WebControllerLog.java

@@ -0,0 +1,13 @@
+package com.gis.web.aop;
+
+import java.lang.annotation.*;
+
+/**
+ * Created by Hb_zzZ on 2020/2/27.
+ */
+@Target({ElementType.PARAMETER, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface WebControllerLog {
+    String description() default "";
+}

+ 122 - 0
gis_web/src/main/java/com/gis/web/aop/WebLogAspect.java

@@ -0,0 +1,122 @@
+package com.gis.web.aop;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.http.HttpServletRequest;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Created by owen on 2020/2/25 0025 9:24
+ *
+ * 日志aop
+ */
+@Slf4j
+@Aspect
+@Component
+public class WebLogAspect {
+
+    @Autowired
+    private HttpServletRequest request;
+
+//    @Autowired
+//    private LogService logService;
+
+    @Pointcut("execution(* com.gis.web.controller.*.*(..))")//切入点描述 这个是controller包的切入点
+    public void controllerLog(){}//签名,可以理解成这个切入点的一个名称
+
+    @Before("controllerLog()") //在切入点的方法run之前要干的
+    public void logBeforeController(JoinPoint joinPoint) throws Exception {
+
+        // 获取token
+        String token = request.getHeader("token");
+//        Long userId = null;
+//        if (token != null) {
+//            userId = JwtUtil.getUserId(token);
+//        }
+
+        // 记录下请求内容
+        log.warn("start : {}" , request.getRequestURI());
+        log.info("request Method : {}" , request.getMethod());
+        log.info("request IP : {}" , request.getRemoteAddr());
+        log.info("request Args : {}" , Arrays.toString(joinPoint.getArgs()));
+
+        // token为空,直接返回
+        if (StringUtils.isBlank(token)) {
+            return;
+        }
+
+//        Object[] args = joinPoint.getArgs();
+//        if (args.length > 0) {
+//            log.info("request Args : {}" , Arrays.toString(args));
+//        }
+
+        String description = getControllerLogDescription(joinPoint);
+
+//        if (!StringUtils.isAllBlank(description)) {
+//            log.info("request description : {}", description);
+//            // 保存数据库
+//            List<String> detail = getDetail(description);
+//            logService.save(new LogEntity(userId, detail.get(0), detail.get(1)));
+//        }
+
+        //下面这个getSignature().getDeclaringTypeName()是获取包+类名的   然后后面的joinPoint.getSignature.getName()获取了方法名
+        log.info("request Class_Method : {}" , joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName());
+
+
+
+    }
+
+
+    //使用@AfterReturning在切入点return内容之后切入内容(可以用来对处理返回值做一些加工处理)
+    @AfterReturning(returning = "ret", pointcut = "controllerLog()")
+    public void doAfterReturning(Object ret) throws Throwable {
+        // 处理完请求,返回内容
+//        log.info("响应RESPONSE : " + ret.toString());
+        log.warn("end : {}", request.getRequestURI());
+    }
+
+    /**
+     * 获取注解中对方法的描述信息 用于Controller层注解
+     *
+     * @param joinPoint
+     *            切点
+     * @return 方法描述
+     * @throws Exception
+     */
+    public static String getControllerLogDescription(JoinPoint joinPoint) throws Exception {
+        String targetName = joinPoint.getTarget().getClass().getName();
+        String methodName = joinPoint.getSignature().getName();
+        Object[] arguments = joinPoint.getArgs();
+        Class targetClass = Class.forName(targetName);
+        Method[] methods = targetClass.getMethods();
+        String description = "";
+        for (Method method : methods) {
+            if (method.getName().equals(methodName)) {
+                Class[] clazzs = method.getParameterTypes();
+                if (clazzs.length == arguments.length) {
+                    WebControllerLog annotation = method.getAnnotation(WebControllerLog.class);
+                    if (annotation != null) {
+                        description = annotation.description();
+                        break;
+                    }
+                }
+            }
+        }
+        return description;
+    }
+
+    private static List<String> getDetail(String str){
+        String[] split = str.split("-");
+        return Arrays.asList(split);
+    }
+}

+ 71 - 0
gis_web/src/main/java/com/gis/web/controller/BaseController.java

@@ -0,0 +1,71 @@
+package com.gis.web.controller;
+
+import com.gis.web.shiro.JwtUtil;
+import com.github.pagehelper.PageHelper;
+
+import com.gis.domain.dto.PageDto;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * Created by owen on 2020/2/20 0020 15:20
+ */
+public class BaseController {
+
+    @Autowired
+    protected HttpServletRequest request;
+
+
+
+
+
+    /** 获取用户名*/
+    String getTokenUserName(){
+        String token = getToken();
+        return JwtUtil.getUsername(token);
+    }
+
+    /** 获取用户id*/
+    Long getTokenUserId(){
+        return JwtUtil.getUserId(getToken());
+    }
+
+    /** 获取用户角色*/
+//    String getTokenUserRole(){
+//        return JwtUtil.getUserRole(getToken());
+//    }
+
+    /** 获取用户管理者*/
+    Boolean getTokenUserManager(){
+        return JwtUtil.getUserManager(getToken());
+    }
+
+
+    /** 获取header token */
+    String getToken(){
+        return request.getHeader("token");
+    }
+
+
+    /**
+     * 设置请求分页数据
+     */
+    void startPage(PageDto param){
+        Integer pageNum = param.getPageNum();
+        Integer pageSize = param.getPageSize();
+        if (pageNum == null) {
+            pageNum = 1;
+        }
+
+        if (pageSize == null) {
+            pageSize = 10;
+        }
+
+        PageHelper.startPage(pageNum, pageSize);
+
+    }
+
+
+
+}

+ 59 - 0
gis_web/src/main/java/com/gis/web/controller/DeptController.java

@@ -0,0 +1,59 @@
+package com.gis.web.controller;
+
+import com.gis.common.util.Result;
+import com.gis.domain.dto.DeptDto;
+import com.gis.domain.dto.EffortDto;
+import com.gis.domain.dto.PageDto;
+import com.gis.domain.entity.UserEntity;
+import com.gis.domain.vo.DeptEffortVo;
+import com.gis.domain.vo.EffortVo;
+import com.gis.mapper.MyBaseMapper;
+import com.gis.service.TaskesTimateService;
+import com.gis.service.UserService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+
+/**
+ * Created by owen on 2021/2/26 0026 11:57
+ *
+ */
+
+@Api(tags = "部门使用")
+@Slf4j
+@RequestMapping("api/dept")
+@RestController
+public class DeptController extends BaseController {
+
+    @Autowired
+    MyBaseMapper myBaseMapper;
+
+    @Autowired
+    TaskesTimateService taskesTimateService;
+
+    @ApiOperation("部门列表")
+    @GetMapping(value = "list")
+    public Result list() {
+        return Result.success(myBaseMapper.getDept());
+    }
+
+    @ApiOperation(value = "按部门id获取月统计(date:当月日期:yyyy-MM-dd)")
+    @PostMapping(value = "deptEffortByMonth")
+    public Result<DeptEffortVo> deptEffortByMonth(@Valid @RequestBody DeptDto param) {
+        return taskesTimateService.deptEffortByMonthExcel(param);
+    }
+
+
+    @ApiOperation(value = "按部门id获取月详情(date:当月日期:yyyy-MM-dd)", notes = "多参数查询工时")
+    @PostMapping(value = "effortByMonth")
+    public Result<EffortVo> effortByMonth(@RequestBody DeptDto param) {
+        return taskesTimateService.effortByMonthExcel(param);
+    }
+
+
+}

+ 144 - 0
gis_web/src/main/java/com/gis/web/controller/ExceptionController.java

@@ -0,0 +1,144 @@
+package com.gis.web.controller;
+
+import com.gis.common.exception.BaseRuntimeException;
+import com.gis.common.util.Result;
+import lombok.extern.log4j.Log4j2;
+import org.apache.shiro.ShiroException;
+import org.apache.shiro.authz.UnauthorizedException;
+import org.springframework.dao.DuplicateKeyException;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+import org.springframework.web.servlet.NoHandlerFoundException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.ConstraintViolationException;
+import javax.validation.ValidationException;
+
+/**
+ * 统一捕捉异常,自定义返回参数
+ * 这里只可以捕获controller层的异常。
+ */
+@Log4j2
+@RestControllerAdvice
+public class ExceptionController {
+
+    // 捕捉shiro的异常
+    @ResponseStatus(HttpStatus.UNAUTHORIZED)
+    @ExceptionHandler(ShiroException.class)
+    public Result handle401(ShiroException e) {
+//        return Result.failure(5001, e.getMessage());
+        log.error("没有授权1");
+        return Result.failure(5001, "没有授权");
+    }
+
+
+
+    /**
+     * 捕捉UnauthorizedException
+     *
+     * 权限不够,会抛这个异常
+     */
+    @ResponseStatus(HttpStatus.UNAUTHORIZED)
+    @ExceptionHandler(UnauthorizedException.class)
+    public Result handle401() {
+        log.error("没有授权2");
+        return Result.failure(5001, "没有授权");
+    }
+
+    // 捕捉其他所有异常
+    @ExceptionHandler(Exception.class)
+    @ResponseStatus(HttpStatus.BAD_REQUEST)
+    public Result globalException(HttpServletRequest request, Throwable ex) {
+        return Result.failure(getStatus(request).value(), ex.getMessage());
+    }
+
+
+    private HttpStatus getStatus(HttpServletRequest request) {
+        Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
+        if (statusCode == null) {
+            return HttpStatus.INTERNAL_SERVER_ERROR;
+        }
+        return HttpStatus.valueOf(statusCode);
+    }
+
+    @ResponseBody
+    @ExceptionHandler(BaseRuntimeException.class)
+    @ResponseStatus(HttpStatus.OK)
+    public Result runtimeExceptionHandler(HttpServletRequest request, BaseRuntimeException e) {
+        log.error(request.getRequestURI() + ":" + e.getMsg());
+//        return Result.failure(e.getCode() == null ? Result.CODE_FAILURE : e.getCode(), e.getMsg());
+        return Result.failure(e.getCode(), e.getMsg());
+    }
+
+    /**
+     * 方法参数校验
+     *
+     * 注解验证异常
+     */
+    @ExceptionHandler(MethodArgumentNotValidException.class)
+    public Result handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
+        return Result.failure(60001, e.getBindingResult().getFieldError().getDefaultMessage());
+    }
+
+    /**
+     * ValidationException
+     */
+    @ExceptionHandler(ValidationException.class)
+    public Result handleValidationException(ValidationException e) {
+        log.error(e.getMessage(), e);
+        return Result.failure(60002, e.getCause().getMessage());
+    }
+
+    /**
+     * ConstraintViolationException
+     */
+    @ExceptionHandler(ConstraintViolationException.class)
+    public Result handleConstraintViolationException(ConstraintViolationException e) {
+        log.error(e.getMessage(), e);
+        return Result.failure(60003, e.getMessage());
+    }
+
+    @ExceptionHandler(NoHandlerFoundException.class)
+    public Result handlerNoFoundException(Exception e) {
+        log.error(e.getMessage(), e);
+        return Result.failure(60004, "路径不存在,请检查路径是否正确");
+    }
+
+
+
+
+    @ExceptionHandler(NullPointerException.class)
+    public Result handlerNullPointerException(Exception e) {
+        log.error(e.getMessage(), e);
+        return Result.failure(60005, "空指针异常");
+    }
+
+//    @ExceptionHandler(BuilderException.class)
+//    public Result handlerBuilderException(Exception e) {
+//        log.error(e.getMessage(), e);
+//        return Result.failure(60006, "SQL mybatis 异常");
+//    }
+
+
+    /**
+     * 防止表单重复提交
+     * 需要结合数据库某个字段设置唯一字段使用
+     *
+     * 例如userName
+     *
+     * 也可以结合redis使用
+     */
+    @ExceptionHandler(DuplicateKeyException.class)
+    public Result handleDuplicateKeyException(DuplicateKeyException e) {
+        log.error(e.getMessage(), e);
+        return Result.failure(60005, "数据重复,请检查后提交");
+    }
+
+
+
+}
+

+ 82 - 0
gis_web/src/main/java/com/gis/web/controller/ProjectController.java

@@ -0,0 +1,82 @@
+package com.gis.web.controller;
+
+import com.gis.common.util.Result;
+import com.gis.domain.dto.DeptDto;
+import com.gis.domain.dto.EffortDto;
+import com.gis.domain.entity.EffortEntity;
+import com.gis.domain.entity.ProjectEntity;
+import com.gis.domain.dto.PageDto;
+import com.gis.domain.entity.TaskEntity;
+import com.gis.domain.vo.EffortVo;
+import com.gis.service.EffortService;
+import com.gis.service.ProjectService;
+import com.gis.service.TaskService;
+import com.gis.service.TaskesTimateService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * Created by owen on 2021/2/26 0026 11:57
+ *
+ */
+
+@Api(tags = "财务使用")
+@Slf4j
+@RequestMapping("api/project")
+@RestController
+public class ProjectController extends BaseController {
+
+    @Autowired
+    ProjectService projectService;
+
+    @Autowired
+    TaskService taskService;
+
+    @Autowired
+    TaskesTimateService taskesTimateService;
+
+
+
+
+//    @ApiOperation("查询项目参与人")
+//    @GetMapping(value = "findAccount/{projectId}")
+//    public Result<TaskEntity> findAccountByProjectId(@PathVariable String projectId) {
+//        return taskService.findAccountByProjectId(projectId);
+//    }
+
+
+
+//    @ApiOperation("按月份统计每个人在项目中的总工时(date:当月日期:yyyy-MM-dd)")
+//    @GetMapping(value = "sumEffortByMonth/{projectId}/{date}")
+//    public Result<EffortVo> sumEffortByMonth(@PathVariable String projectId, @PathVariable String date) {
+//        return taskService.sumEffortByMonth(projectId, date);
+//    }
+
+
+    @ApiOperation(value = "月详情(date:当月日期:yyyy-MM-dd)")
+    @GetMapping(value = "effortByMonth/{date}")
+    public Result<EffortVo> effortByMonth(@PathVariable String date) {
+        DeptDto param = new DeptDto();
+        param.setDate(date);
+        return taskesTimateService.effortByMonthExcel(param);
+    }
+
+
+//    @ApiOperation("(excel)按月份统计每个项目每个人的总工时(date:当月日期:yyyy-MM-dd)")
+//    @GetMapping(value = "excel/{projectId}/{date}")
+//    public Result<EffortVo> sumEffortByMonthExcel(@PathVariable String projectId, @PathVariable String date) {
+//        return taskesTimateService.sumEffortByMonthExcel(projectId, date);
+//    }
+
+
+    @ApiOperation("月总计(date:当月日期:yyyy-MM-dd)")
+    @GetMapping(value = "excel/{date}")
+    public Result<EffortVo> allProjectEffortByMonthExcel(@PathVariable String date) {
+        return taskesTimateService.allProjectEffortByMonthExcel(date);
+    }
+
+}

+ 49 - 0
gis_web/src/main/java/com/gis/web/controller/TaskController.java

@@ -0,0 +1,49 @@
+package com.gis.web.controller;
+
+import com.gis.common.util.Result;
+import com.gis.domain.entity.TaskEntity;
+import com.gis.domain.dto.PageDto;
+import com.gis.service.TaskService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import jdk.nashorn.internal.ir.annotations.Ignore;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+
+/**
+ * Created by owen on 2021/2/26 0026 11:57
+ *
+ */
+@ApiIgnore
+@Api(tags = "任务管理")
+@Slf4j
+@RequestMapping("api/task")
+@RestController
+public class TaskController extends BaseController {
+
+    @Autowired
+    TaskService taskService;
+
+
+
+    @ApiOperation("列表")
+    @PostMapping(value = "list")
+    public Result<TaskEntity> list(@RequestBody PageDto param) {
+        return taskService.search(param);
+    }
+
+
+    @ApiOperation("我的任务")
+    @GetMapping(value = "myTask/{account}")
+    public Result<TaskEntity> myTask(@PathVariable String account) {
+        return taskService.myTask(account);
+    }
+
+
+
+
+
+}

+ 39 - 0
gis_web/src/main/java/com/gis/web/controller/UserController.java

@@ -0,0 +1,39 @@
+package com.gis.web.controller;
+
+import com.gis.common.util.Result;
+import com.gis.domain.entity.UserEntity;
+import com.gis.domain.dto.PageDto;
+import com.gis.service.UserService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import jdk.nashorn.internal.ir.annotations.Ignore;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+
+/**
+ * Created by owen on 2021/2/26 0026 11:57
+ *
+ */
+@ApiIgnore
+@Api(tags = "用户管理")
+@Slf4j
+@RequestMapping("api/user")
+@RestController
+public class UserController extends BaseController {
+
+    @Autowired
+    UserService userService;
+
+
+
+    @ApiOperation("列表")
+    @PostMapping(value = "list")
+    public Result<UserEntity> list(@RequestBody PageDto param) {
+        return userService.search(param);
+    }
+
+
+}

+ 159 - 0
gis_web/src/main/java/com/gis/web/shiro/JWTFilter.java

@@ -0,0 +1,159 @@
+//package com.gis.web.shiro;
+//
+//import com.alibaba.fastjson.JSONObject;
+//import com.gis.common.exception.JwtAuthenticationException;
+//import lombok.extern.log4j.Log4j2;
+//import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
+//import org.springframework.http.HttpStatus;
+//import org.springframework.web.bind.annotation.RequestMethod;
+//
+//import javax.servlet.ServletOutputStream;
+//import javax.servlet.ServletRequest;
+//import javax.servlet.ServletResponse;
+//import javax.servlet.http.HttpServletRequest;
+//import javax.servlet.http.HttpServletResponse;
+//import java.io.IOException;
+//import java.io.PrintWriter;
+//
+//
+///**
+// * 自定义拦截规则
+// */
+//@Log4j2
+//public class JWTFilter extends BasicHttpAuthenticationFilter {
+//
+//
+//
+//    /**
+//     * 判断用户是否想要登入。
+//     * 检测header里面是否包含Authorization字段即可
+//     *
+//     * return false:直接不校验就可以访问api
+//     */
+////    @Override
+////    protected boolean isLoginAttempt(ServletRequest request, ServletResponse response) {
+////        HttpServletRequest req = (HttpServletRequest) request;
+//////        String authorization = req.getHeader("Authorization");
+////        String authorization = req.getHeader("token");
+////
+////        if (StringUtils.isEmpty(authorization)) {
+////            log.error("Authorization is null");
+////        }
+////
+////        return true;
+////
+////    }
+//
+//
+//
+//    /**
+//     * 执行登录验证
+//     */
+//    @Override
+//    protected boolean executeLogin(ServletRequest request, ServletResponse response) {
+//        HttpServletRequest httpServletRequest = (HttpServletRequest) request;
+//        String authorization = httpServletRequest.getHeader("token");
+//        JWTToken token = new JWTToken(authorization);
+//
+//        // 提交给realm进行登入,如果错误他会抛出异常并被捕获
+//        getSubject(request, response).login(token);
+//
+//        // 如果没有抛出异常则代表登入成功,返回true
+//        return true;
+//    }
+//
+//    /**
+//     * 这里我们详细说明下为什么最终返回的都是true,即允许访问
+//     * 例如我们提供一个地址 GET /article
+//     * 登入用户和游客看到的内容是不同的
+//     * 如果在这里返回了false,请求会被直接拦截,用户看不到任何东西
+//     * 所以我们在这里返回true,Controller中可以通过 subject.isAuthenticated() 来判断用户是否登入
+//     * 如果有些资源只有登入用户才能访问,我们只需要在方法上面加上 @RequiresAuthentication 注解即可
+//     * 但是这样做有一个缺点,就是不能够对GET,POST等请求进行分别过滤鉴权(因为我们重写了官方的方法),但实际上对应用影响不大
+//     *
+//     * owen:
+//     *  return false ,表示全局拦截,必须登录才可以访问接口,除非配置了免拦截
+//     *  "" @RequiresAuthentication 现在不需要配置这个注解来免登录
+//     *
+//     */
+//    @Override
+//    protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
+//        try {
+//            executeLogin(request, response);
+//        } catch (Exception e) {
+//            /**
+//             * 这个异常需要自己写,全局捕获不了
+//             * 认证出现异常,传递错误信息msg
+//             */
+//            exceptionMsg(e, response);
+//        }
+//        // return false 前端没有响应,接收不到异常
+//        return true;
+//
+//
+//    }
+//
+//    /**
+//     * 对跨域提供支持
+//     * 只对需要token验证的有效,不需要验证的还是需要用注解处理一下
+//     *
+//     */
+//    @Override
+//    protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
+//        HttpServletRequest httpServletRequest = (HttpServletRequest) request;
+//        HttpServletResponse httpServletResponse = (HttpServletResponse) response;
+//        httpServletResponse.setHeader("Access-control-Allow-Origin", httpServletRequest.getHeader("Origin"));
+//        httpServletResponse.setHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS,PUT,DELETE");
+//        httpServletResponse.setHeader("Access-Control-Allow-Headers", httpServletRequest.getHeader("Access-Control-Request-Headers"));
+//        // 跨域时会首先发送一个option请求,这里我们给option请求直接返回正常状态
+//        if (httpServletRequest.getMethod().equals(RequestMethod.OPTIONS.name())) {
+//            httpServletResponse.setStatus(HttpStatus.OK.value());
+//            return false;
+//        }
+//        return super.preHandle(request, response);
+//    }
+//
+//
+//    /**
+//     * 无需转发,直接返回Response信息
+//     *
+//     */
+//    private void writeResponse(ServletResponse response, JSONObject msg) {
+//        response.setCharacterEncoding("UTF-8");
+//        response.setContentType("application/json; charset=utf-8");
+//        ServletOutputStream outputStream = null;
+//        try {
+//            outputStream = response.getOutputStream();
+//        } catch (IOException e) {
+//            e.printStackTrace();
+//        }
+//        assert outputStream != null;
+//        PrintWriter printWriter = new PrintWriter(outputStream, true);
+//        printWriter.write(msg.toString());//直接将json输出到页面
+//        printWriter.flush();
+//        printWriter.close();
+//
+//    }
+//
+//    /**
+//     * 封装异常信息
+//     */
+//    private void exceptionMsg(Exception e, ServletResponse response) {
+//        // 认证出现异常,传递错误信息msg
+//        String msg = e.getMessage();
+//        // 获取应用异常(该Cause是导致抛出此throwable(异常)的throwable(异常))
+//        Throwable throwable = e.getCause();
+//        JSONObject jsonObject = new JSONObject();
+//        if (throwable instanceof JwtAuthenticationException) {
+//            jsonObject.put("code", ((JwtAuthenticationException) throwable).getCode());
+//            jsonObject.put("msg", ((JwtAuthenticationException) throwable).getMsg());
+//        } else {
+//            log.error(msg);
+//            jsonObject.put("code", 5002);
+//            jsonObject.put("msg", "token invalid");
+//        }
+//        // 直接返回Response信息
+//        this.writeResponse(response, jsonObject);
+//
+//    }
+//}

+ 23 - 0
gis_web/src/main/java/com/gis/web/shiro/JWTToken.java

@@ -0,0 +1,23 @@
+package com.gis.web.shiro;
+
+import org.apache.shiro.authc.AuthenticationToken;
+
+public class JWTToken implements AuthenticationToken {
+
+    // 密钥
+    private String token;
+
+    public JWTToken(String token) {
+        this.token = token;
+    }
+
+    @Override
+    public Object getPrincipal() {
+        return token;
+    }
+
+    @Override
+    public Object getCredentials() {
+        return token;
+    }
+}

+ 253 - 0
gis_web/src/main/java/com/gis/web/shiro/JwtUtil.java

@@ -0,0 +1,253 @@
+package com.gis.web.shiro;
+
+import com.auth0.jwt.JWT;
+import com.auth0.jwt.interfaces.Claim;
+import com.auth0.jwt.interfaces.DecodedJWT;
+import com.gis.common.exception.BaseRuntimeException;
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.JwtBuilder;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
+import lombok.extern.log4j.Log4j2;
+import org.junit.Test;
+import org.springframework.util.Assert;
+
+import java.util.*;
+
+@Log4j2
+public class JwtUtil {
+
+    //生成签名的时候使用的秘钥secret
+    private static final String SECRET = "XX#$%()(#*!()!KL<><MQLMNQNQJQK&sdfkjsdrow32234545fdf>?N<:{LWPW";
+
+    /**
+     * 用户登录成功后生成Jwt
+     * 使用Hs256算法  私匙使用用户密码
+     *
+     * @param ttlMillis jwt过期时间
+     * @param userName  用户名
+     * @return
+     */
+    public static String createJWT(long ttlMillis, String userName) {
+        //指定签名的时候使用的签名算法,也就是header那部分,jjwt已经将这部分内容封装好了。
+        SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
+
+        //生成JWT的时间
+        long nowMillis = System.currentTimeMillis();
+        Date now = new Date(nowMillis);
+
+        //创建payload的私有声明(根据特定的业务需要添加,如果要拿这个做验证,一般是需要和jwt的接收方提前沟通好验证方式的)
+        Map<String, Object> claims = new HashMap<String, Object>();
+        claims.put("userName", userName);
+
+        //下面就是在为payload添加各种标准声明和私有声明了
+        //这里其实就是new一个JwtBuilder,设置jwt的body
+        JwtBuilder builder = Jwts.builder()
+                //如果有私有声明,一定要先设置这个自己创建的私有的声明,这个是给builder的claim赋值,一旦写在标准的声明赋值之后,就是覆盖了那些标准的声明的
+                .setClaims(claims)
+                //设置jti(JWT ID):是JWT的唯一标识,根据业务需要,这个可以设置为一个不重复的值,主要用来作为一次性token,从而回避重放攻击。
+                .setId(UUID.randomUUID().toString())
+                //iat: jwt的签发时间
+                .setIssuedAt(now)
+                //代表这个JWT的主体,即它的所有人,这个是一个json格式的字符串,可以存放什么userid,roldid之类的,作为什么用户的唯一标志。
+                .setSubject(userName)
+                //设置签名使用的签名算法和签名使用的秘钥
+                .signWith(signatureAlgorithm, SECRET);
+
+        if (ttlMillis >= 0) {
+            long expMillis = nowMillis + ttlMillis;
+            Date exp = new Date(expMillis);
+            //设置过期时间
+            builder.setExpiration(exp);
+        }/*else{
+            //设置过期时间半小时
+            DateTime expDate = new DateTime().plusMinutes(30);
+            builder.setExpiration(expDate.toDate());
+        }*/
+        return builder.compact();
+    }
+
+
+    /**
+     * Token的解密
+     *
+     * @param token 加密后的token
+     * @return
+     */
+    public static Claims parseJWT(String token) {
+        //得到DefaultJwtParser
+        Claims claims = Jwts.parser()
+                //设置签名的秘钥
+                .setSigningKey(SECRET)
+                //设置需要解析的jwt
+                .parseClaimsJws(token).getBody();
+        return claims;
+    }
+
+    public static String getTokenStringValueByKey(String token, String key) {
+        DecodedJWT jwt = JWT.decode(token);
+        Claim value = jwt.getClaim(key);
+
+        if (value == null) {
+            log.error("token key is null");
+            throw new BaseRuntimeException(5001, "token invalid");
+        }
+        return value.asString();
+    }
+
+
+    /**
+     * 校验token
+     * 在这里可以使用官方的校验,我这里校验的是token中携带的密码于数据库一致的话就校验通过
+     *
+     * @param token
+     * @param userName
+     * @return
+     */
+    public static Boolean isVerify(String token, String userName) {
+
+        //得到DefaultJwtParser
+        Claims claims = Jwts.parser()
+                //设置签名的秘钥
+                .setSigningKey(SECRET)
+                //设置需要解析的jwt
+                .parseClaimsJws(token).getBody();
+
+        return claims.get("userName").equals(userName);
+    }
+
+    /**
+     * 获得token中的信息无需secret解密也能获得
+     *
+     * @return token中包含的用户名
+     */
+    public static String getUsername(String token) {
+        DecodedJWT jwt = JWT.decode(token);
+        Claim userName = jwt.getClaim("userName");
+        Assert.notNull(userName, "token userName is null ");
+        return userName.asString();
+    }
+
+
+    public static List getUserRole(String token) {
+        DecodedJWT jwt = JWT.decode(token);
+        Claim role = jwt.getClaim("role");
+        Assert.notNull(role, "token role is null ");
+        return role.as(List.class);
+    }
+
+
+    public static String createJWT(long ttlMillis, Map<String, Object> paramMap) {
+        //指定签名的时候使用的签名算法,也就是header那部分,jjwt已经将这部分内容封装好了。
+        SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
+
+        String userName = paramMap.get("userName").toString();
+
+        //生成JWT的时间
+        long nowMillis = System.currentTimeMillis();
+        Date now = new Date(nowMillis);
+
+        //创建payload的私有声明(根据特定的业务需要添加,如果要拿这个做验证,一般是需要和jwt的接收方提前沟通好验证方式的)
+        Map<String, Object> claims = new HashMap<String, Object>();
+        claims.put("userName", userName);
+        claims.put("id", paramMap.get("id"));
+        claims.put("role", paramMap.get("role"));
+        claims.put("manager", paramMap.get("manager"));
+
+        //下面就是在为payload添加各种标准声明和私有声明了
+        //这里其实就是new一个JwtBuilder,设置jwt的body
+        JwtBuilder builder = Jwts.builder()
+                //如果有私有声明,一定要先设置这个自己创建的私有的声明,这个是给builder的claim赋值,一旦写在标准的声明赋值之后,就是覆盖了那些标准的声明的
+                .setClaims(claims)
+                //设置jti(JWT ID):是JWT的唯一标识,根据业务需要,这个可以设置为一个不重复的值,主要用来作为一次性token,从而回避重放攻击。
+                .setId(UUID.randomUUID().toString())
+                //iat: jwt的签发时间
+                .setIssuedAt(now)
+                //代表这个JWT的主体,即它的所有人,这个是一个json格式的字符串,可以存放什么userid,roldid之类的,作为什么用户的唯一标志。
+                .setSubject(userName)
+                //设置签名使用的签名算法和签名使用的秘钥
+                .signWith(signatureAlgorithm, SECRET);
+
+        if (ttlMillis >= 0) {
+            long expMillis = nowMillis + ttlMillis;
+            Date exp = new Date(expMillis);
+            //设置过期时间
+            builder.setExpiration(exp);
+        }/*else{
+            //设置过期时间半小时
+            DateTime expDate = new DateTime().plusMinutes(30);
+            builder.setExpiration(expDate.toDate());
+        }*/
+        return builder.compact();
+    }
+
+    /**
+     * 获取用户id
+     */
+    public static Long getUserId(String token) {
+        DecodedJWT jwt = JWT.decode(token);
+        Claim id = jwt.getClaim("id");
+        Assert.notNull(id, "token id is null ");
+        return id.asLong();
+    }
+
+
+    /**
+     * 管理者 ,0:是, 1:否
+     */
+    public static Boolean getUserManager(String token) {
+        DecodedJWT jwt = JWT.decode(token);
+        Claim id = jwt.getClaim("manager");
+        Assert.notNull(id, "token manager is null ");
+        Integer integer = id.asInt();
+        return integer == 0;
+    }
+
+    public static void main(String[] args) {
+//        test3();
+//        test2();
+        long nowMillis = System.currentTimeMillis();
+        System.out.println(nowMillis);
+        Date exp = new Date(nowMillis);
+        System.out.println(exp);
+    }
+
+    public static void test2() {
+        String token = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsInJvbGUiOlsiYWRtaW4iLCJyb290Il0sImlkIjoxLCJ1c2VyTmFtZSI6ImFkbWluIiwiaWF0IjoxNTgzODA5MzkzLCJqdGkiOiJkNjZiZTFkYi00MTQ0LTQxMTYtYTNlNi01ZDBjNjhlNTI3ODAifQ.-4AdsVP2RwmPS2grtO4aC8ov9PwkilzaGdThGetBJok";
+        System.out.println(getUserRole(token));
+
+    }
+
+    public static void test3() {
+        HashMap<String, Object> map = new HashMap<>();
+
+        ArrayList<Object> list = new ArrayList<>();
+        list.add("admin");
+        list.add("root");
+
+        map.put("userName", "admin");
+        map.put("id", Long.valueOf("1"));
+        map.put("role", list);
+
+        String token = createJWT(-1, map);
+        System.out.println(token);
+
+        Boolean isVerify = isVerify(token, "admin");
+        System.out.println(isVerify);
+
+    }
+
+    private static void testList() {
+        ArrayList<Object> list = new ArrayList<>();
+        list.add("admin");
+        list.add("root");
+    }
+
+    @Test
+    public void test1(){
+        String token = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsInJvbGUiOm51bGwsIm1hbmFnZXIiOm51bGwsImlkIjoxLCJ1c2VyTmFtZSI6ImFkbWluIiwiaWF0IjoxNTkwNzIzMDg3LCJqdGkiOiJmMzk5ODg1NC0xYTU3LTQzNmYtYmEwMC04MmVkNDZlOWJlMWYifQ.G6Or9DmW32_Q3pKGB1WCrTZgpRWQhUnZ1043gggEj1M";
+        String username = getUsername(token);
+        System.out.println(username);
+    }
+
+}

+ 110 - 0
gis_web/src/main/java/com/gis/web/shiro/MyRealm.java

@@ -0,0 +1,110 @@
+//package com.gis.web.shiro;
+//
+//import com.gis.common.exception.JwtAuthenticationException;
+//import com.gis.domain.entity.SysUserEntity;
+////import com.gis.service.SysUserService;
+//import lombok.extern.log4j.Log4j2;
+//import org.apache.commons.lang3.StringUtils;
+//import org.apache.shiro.authc.AuthenticationException;
+//import org.apache.shiro.authc.AuthenticationInfo;
+//import org.apache.shiro.authc.AuthenticationToken;
+//import org.apache.shiro.authc.SimpleAuthenticationInfo;
+//import org.apache.shiro.authz.AuthorizationInfo;
+//import org.apache.shiro.authz.SimpleAuthorizationInfo;
+//import org.apache.shiro.realm.AuthorizingRealm;
+//import org.apache.shiro.subject.PrincipalCollection;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.data.redis.core.RedisTemplate;
+//import org.springframework.stereotype.Service;
+//
+///**
+// * 配置不校验的话,是不会走这个方法的
+// */
+//@Log4j2
+//@Service
+//public class MyRealm extends AuthorizingRealm {
+//
+//
+//
+//    @Autowired
+//    private RedisTemplate<String, String> redisTemplate;
+//
+//    @Autowired
+////    private SysUserService userService;
+//
+//
+//
+//    /**
+//     * 大坑!,必须重写此方法,不然Shiro会报错
+//     */
+//    @Override
+//    public boolean supports(AuthenticationToken token) {
+//        return token instanceof JWTToken;
+//    }
+//
+//
+//
+//
+//    /**
+//     * 只有当需要检测用户权限的时候才会调用此方法,例如checkRole,checkPermission之类的
+//     *
+//     * principals: 是token
+//     */
+//    @Override
+//    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
+//        String username = JwtUtil.getUsername(principals.toString());
+//
+////        SysUserEntity dbUserEntity = userService.findByUserName(username);
+//
+//        SimpleAuthorizationInfo simpleAuthorizationInfo = new SimpleAuthorizationInfo();
+//
+//
+//        // 设置角色、权限
+////        simpleAuthorizationInfo.addRole(dbUserEntity.getRole());
+//        return simpleAuthorizationInfo;
+//    }
+//
+//
+//    /**
+//     * 默认使用此方法进行用户名正确与否验证,错误抛出异常即可。
+//     */
+//    @Override
+//    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken auth) throws AuthenticationException {
+//        String token = (String) auth.getCredentials();
+//
+//        if (StringUtils.isBlank(token)) {
+//            log.error("header token is null ");
+//            throw new JwtAuthenticationException(5001, "header token is null");
+//        }
+//
+//
+//        // 解密获得username,用于和数据库进行对比
+//        String username = JwtUtil.getUsername(token);
+//        if (username == null) {
+//            log.error("error token username");
+//            throw new JwtAuthenticationException(5001, "token invalid");
+//        }
+//
+////        SysUserEntity userEntity = userService.findByUserName(username);
+////        if (userEntity == null) {
+////            log.error("error token userEntity");
+////            throw new JwtAuthenticationException(5001, "User didn't existed!");
+////        }
+//
+//        // 校验请求token是否跟redis token一致
+////        String redisToken = redisTemplate.opsForValue().get(TypeCode.REDIS_TOKEN + token);
+////        if (!token.equals(redisToken)) {
+////            log.error("redis token is null");
+////            throw new JwtAuthenticationException(5001, "redis token is null");
+////
+////        }
+//
+//
+////        if (! JwtUtil.isVerify(token, username)) {
+////            log.error("error token username or password");
+////            throw new JwtAuthenticationException(5001, "token invalid");
+////        }
+//
+//        return new SimpleAuthenticationInfo(token, token, "my_realm");
+//    }
+//}

+ 114 - 0
gis_web/src/main/java/com/gis/web/shiro/ShiroConfig.java

@@ -0,0 +1,114 @@
+//package com.gis.web.shiro;
+//
+//import lombok.extern.log4j.Log4j2;
+//import org.apache.shiro.mgt.DefaultSessionStorageEvaluator;
+//import org.apache.shiro.mgt.DefaultSubjectDAO;
+//import org.apache.shiro.spring.LifecycleBeanPostProcessor;
+//import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
+//import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
+//import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
+//import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.context.annotation.DependsOn;
+//
+//import javax.servlet.Filter;
+//import java.util.HashMap;
+//import java.util.Map;
+//
+//@Log4j2
+//@Configuration
+//public class ShiroConfig {
+//
+//    @Bean("securityManager")
+//    public DefaultWebSecurityManager getManager(MyRealm realm) {
+//        DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
+//        // 使用自己的realm
+//        manager.setRealm(realm);
+//
+//        /*
+//         * 关闭shiro自带的session,详情见文档
+//         * http://shiro.apache.org/session-management.html#SessionManagement-StatelessApplications%28Sessionless%29
+//         */
+//        DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
+//        DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator();
+//        defaultSessionStorageEvaluator.setSessionStorageEnabled(false);
+//        subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator);
+//        manager.setSubjectDAO(subjectDAO);
+//
+//        return manager;
+//    }
+//
+//    @Bean("shiroFilter")
+//    public ShiroFilterFactoryBean factory(DefaultWebSecurityManager securityManager) {
+//        ShiroFilterFactoryBean factoryBean = new ShiroFilterFactoryBean();
+//
+//        // 添加自己的过滤器并且取名为jwt
+//        Map<String, Filter> filterMap = new HashMap<>();
+//        filterMap.put("jwt", new JWTFilter());
+//
+//
+//
+//
+//        factoryBean.setFilters(filterMap);
+//
+//        factoryBean.setSecurityManager(securityManager);
+//        factoryBean.setUnauthorizedUrl("/401");
+//
+//        /*
+//         * 自定义url规则
+//         * http://shiro.apache.org/web.html#urls-
+//         */
+//        Map<String, String> filterRuleMap = new HashMap<>();
+//
+//        // 不拦截
+//        filterRuleMap.put("/login", "anon");
+//        filterRuleMap.put("/logout", "anon");
+//        filterRuleMap.put("/admin", "anon");
+//        filterRuleMap.put("/admin/login", "anon");
+//        filterRuleMap.put("/test/**", "anon");
+//
+//
+//        // swagger 不拦截
+//        filterRuleMap.put("/swagger-resources/**", "anon");
+//        filterRuleMap.put("/webjars/**", "anon");
+//        filterRuleMap.put("/v2/**", "anon");
+//        filterRuleMap.put("/swagger-ui.html/**", "anon");
+//
+//
+//        // 所有请求通过我们自己的JWT Filter
+//        filterRuleMap.put("/manage/**", "jwt");
+//
+//
+//        // 访问401和404页面不通过我们的Filter
+//        filterRuleMap.put("/401", "anon");
+//        factoryBean.setFilterChainDefinitionMap(filterRuleMap);
+//        return factoryBean;
+//    }
+//
+//    /**
+//     * 下面的代码是添加注解支持
+//     */
+//    @Bean
+//    @DependsOn("lifecycleBeanPostProcessor")
+//    public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
+//        DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
+//        // 强制使用cglib,防止重复代理和可能引起代理出错的问题
+//        // https://zhuanlan.zhihu.com/p/29161098
+//        defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
+//        return defaultAdvisorAutoProxyCreator;
+//    }
+//
+//    @Bean
+//    public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
+//        return new LifecycleBeanPostProcessor();
+//    }
+//
+//    @Bean
+//    public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) {
+//        AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
+//        advisor.setSecurityManager(securityManager);
+//        return advisor;
+//    }
+//
+//}

+ 265 - 0
pom.xml

@@ -0,0 +1,265 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <!-- museum parent-->
+    <groupId>com.gis</groupId>
+    <artifactId>zentao_age</artifactId>
+    <packaging>pom</packaging>
+    <version>1.0.0</version>
+
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.1.0.RELEASE</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+
+    <modules>
+        <module>gis_common</module>
+        <module>gis_web</module>
+        <module>gis_domain</module>
+        <module>gis_service</module>
+        <module>gis_mapper</module>
+        <module>gis_application</module>
+    </modules>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <java.version>1.8</java.version>
+        <spring.boot.version>2.1.0.RELEASE</spring.boot.version>
+        <gis.version>1.0.0</gis.version>
+        <fastjson.version>1.2.51</fastjson.version>
+        <druid.version>1.1.14</druid.version>
+        <hutool.version>5.3.3</hutool.version>
+        <lombok.version>1.18.2</lombok.version>
+        <lang3.version>3.7</lang3.version>
+        <mysql.version>8.0.15</mysql.version>
+        <shiro.version>1.4.0</shiro.version>
+        <jwt.version>3.2.0</jwt.version>
+        <jjwt.version>0.6.0</jjwt.version>
+        <aliyun.core.version>4.0.3</aliyun.core.version>
+        <aliyun.dysmsapi.version>1.1.0</aliyun.dysmsapi.version>
+        <aliyun.oss.version>2.5.0</aliyun.oss.version>
+        <tk.mybatis.version>2.0.2</tk.mybatis.version>
+        <tk.mapper.version>4.0.3</tk.mapper.version>
+        <pagehelper.version>1.2.5</pagehelper.version>
+        <knife4j.version>2.0.2</knife4j.version>
+        <junit.version>4.12</junit.version>
+
+        <poi.version>3.17</poi.version>
+
+    </properties>
+
+
+    <!--dependencyManagement用于管理依赖版本号, 必须写版本号,不然依赖不上-->
+    <dependencyManagement>
+        <dependencies>
+
+            <!--模块版本管理-->
+            <dependency>
+                <groupId>com.gis</groupId>
+                <artifactId>gis_application</artifactId>
+                <version>${gis.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.gis</groupId>
+                <artifactId>gis_common</artifactId>
+                <version>${gis.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.gis</groupId>
+                <artifactId>gis_domain</artifactId>
+                <version>${gis.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.gis</groupId>
+                <artifactId>gis_service</artifactId>
+                <version>${gis.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.gis</groupId>
+                <artifactId>gis_mapper</artifactId>
+                <version>${gis.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.gis</groupId>
+                <artifactId>gis_web</artifactId>
+                <version>${gis.version}</version>
+            </dependency>
+
+
+            <!-- springboot -->
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-starter-data-jpa</artifactId>
+                <version>${spring.boot.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-starter-web</artifactId>
+                <version>${spring.boot.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-starter-test</artifactId>
+                <scope>test</scope>
+                <version>${spring.boot.version}</version>
+            </dependency>
+
+            <!--springboot中的redis依赖-->
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-starter-data-redis</artifactId>
+                <version>${spring.boot.version}</version>
+            </dependency>
+
+            <!--rabbit MQ-->
+            <!--<dependency>-->
+                <!--<groupId>org.springframework.boot</groupId>-->
+                <!--<artifactId>spring-boot-starter-amqp</artifactId>-->
+                <!--<version>${spring.boot.version}</version>-->
+            <!--</dependency>-->
+
+            <!-- lombok -->
+            <dependency>
+                <groupId>org.projectlombok</groupId>
+                <artifactId>lombok</artifactId>
+                <version>${lombok.version}</version>
+            </dependency>
+
+            <!-- fastjson -->
+            <dependency>
+                <groupId>com.alibaba</groupId>
+                <artifactId>fastjson</artifactId>
+                <version>${fastjson.version}</version>
+            </dependency>
+
+            <!--阿里数据库连接池 -->
+            <dependency>
+                <groupId>com.alibaba</groupId>
+                <artifactId>druid-spring-boot-starter</artifactId>
+                <version>${druid.version}</version>
+            </dependency>
+
+            <!-- mysql -->
+            <dependency>
+                <groupId>mysql</groupId>
+                <artifactId>mysql-connector-java</artifactId>
+                <version>${mysql.version}</version>
+            </dependency>
+
+            <!-- 工具类 -->
+            <dependency>
+                <groupId>cn.hutool</groupId>
+                <artifactId>hutool-all</artifactId>
+                <version>${hutool.version}</version>
+            </dependency>
+
+            <!-- StringUtils -->
+            <dependency>
+                <groupId>org.apache.commons</groupId>
+                <artifactId>commons-lang3</artifactId>
+                <version>${lang3.version}</version>
+            </dependency>
+
+            <!-- knife4j aip 包-->
+            <dependency>
+                <groupId>com.github.xiaoymin</groupId>
+                <artifactId>knife4j-spring-boot-starter</artifactId>
+                <version>${knife4j.version}</version>
+            </dependency>
+
+            <!-- shiro -->
+            <dependency>
+                <groupId>org.apache.shiro</groupId>
+                <artifactId>shiro-spring</artifactId>
+                <version>${shiro.version}</version>
+            </dependency>
+
+
+            <!-- jwt -->
+            <dependency>
+                <groupId>com.auth0</groupId>
+                <artifactId>java-jwt</artifactId>
+                <version>${jwt.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>io.jsonwebtoken</groupId>
+                <artifactId>jjwt</artifactId>
+                <version>${jjwt.version}</version>
+            </dependency>
+
+            <!--aliyun sdk-->
+            <dependency>
+                <groupId>com.aliyun</groupId>
+                <artifactId>aliyun-java-sdk-core</artifactId>
+                <version>${aliyun.core.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.aliyun</groupId>
+                <artifactId>aliyun-java-sdk-dysmsapi</artifactId>
+                <version>${aliyun.dysmsapi.version}</version>
+            </dependency>
+
+            <!--aliyun oss-->
+            <dependency>
+                <groupId>com.aliyun.oss</groupId>
+                <artifactId>aliyun-sdk-oss</artifactId>
+                <version>${aliyun.oss.version}</version>
+            </dependency>
+
+            <!--tk.mybatis 依赖-->
+            <dependency>
+                <groupId>tk.mybatis</groupId>
+                <artifactId>mapper-spring-boot-starter</artifactId>
+                <version>${tk.mybatis.version}</version>
+                <!-- tk.mybatis 跟springboot jap 包冲突-->
+                <exclusions>
+                    <exclusion>
+                        <groupId>javax.persistence</groupId>
+                        <artifactId>persistence-api</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+
+
+            <!--分页插件-->
+            <dependency>
+                <groupId>com.github.pagehelper</groupId>
+                <artifactId>pagehelper-spring-boot-starter</artifactId>
+                <version>${pagehelper.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>junit</groupId>
+                <artifactId>junit</artifactId>
+                <version>${junit.version}</version>
+            </dependency>
+
+            <!--excel 依赖工具包, hutool需要用的-->
+            <dependency>
+                <groupId>org.apache.poi</groupId>
+                <artifactId>poi-ooxml</artifactId>
+                <version>${poi.version}</version>
+            </dependency>
+
+
+
+        </dependencies>
+    </dependencyManagement>
+
+
+</project>

+ 52 - 0
remark.md

@@ -0,0 +1,52 @@
+# 2021-03-3 禅道工时
+
+# dev
+    doc http://127.0.0.1:8004/doc.html
+
+
+
+# 参考
+    https://blog.csdn.net/watermelonbig/article/details/81217085
+    
+    官方开发文档 (有留言,等待答复)
+    https://devel.easycorp.cn/book/extension/api-intro-43.html#first
+    
+    查看任务详情
+    http://192.168.0.115:8181/zentao/task-view-4171.html
+    
+    
+# 注意事项
+    1. 不用随意升级禅道版本,测试使用windows版本的数据库工时表是用zt_effort, 生产环境使用的是zt_taskestimate
+    2. 升级后导致开发统计工时的系统不兼容    
+    
+    
+# sql
+
+    # 该任务耗时详情
+    select * FROM zt_taskestimate WHERE task='3656';
+   
+    # 当月该项目个人工时
+    select b.* from zt_taskestimate b left join zt_task a on a.id = b.task where a.project = '13' and b.account = 'linjunbo' and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT('2021-03-1' , '%Y%m' ) 
+    
+    # 个人在当月所有项目的工时详情
+    select a.*,b.project,c.name as projectName,c.code,d.realname as realname from zt_taskestimate a left join zt_task b on b.id = a.task left join zt_project c on c.id=b.project left join zt_user d  on d.account = a.account where a.account = 'dengdexian' and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT('2021-03-1' , '%Y%m' )
+        
+    # 单个项目查询每个人的工时
+    select b.*,a.project,d.realname, c.`name`, SUM(b.consumed) from zt_taskestimate b left join zt_task a on a.id = b.task left join zt_project c on c.id=a.project  left join zt_user d  on d.account = b.account where a.project = '128' and DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT('2021-03-1' , '%Y%m' ) GROUP BY account;    
+    
+    # 所有项目按日期查询
+    SELECT a.id, a.account, a.task , b.project, ROUND(SUM(a.consumed/8),2) as consumed,c.code, c.name as projectName, d.realname as realname 
+                FROM zt_taskestimate a left join zt_task b on b.id = a.task left join zt_project c on c.id=b.project left join zt_user d  on d.account = a.account 
+                WHERE b.deleted = '0' AND DATE_FORMAT( date, '%Y%m' ) = DATE_FORMAT('2021-03-1' , '%Y%m' ) GROUP BY a.account, b.project order by c.id, a.account;
+                
+## 日志
+   2021-03-24
+    目前只部署在本地,没有部署到服务器 http://127.0.0.1:8004/doc.html     
+    
+    
+## pro
+    2020-04-20
+   部署在这个服务器: 192.168.0.115
+   只有马瑞有权限
+   文件端口映射到8016端口
+   地址:/opt/tomcat/zentao_age_8085