浏览代码

feat:项目初始化

yangliu 4 月之前
父节点
当前提交
91f922760e
共有 100 个文件被更改,包括 9697 次插入81 次删除
  1. 75 0
      .gitignore
  2. 36 0
      README.en.md
  3. 27 81
      README.md
  4. 274 0
      pom.xml
  5. 59 0
      src/main/java/com/admin/alarm_event/AlarmEvent.java
  6. 95 0
      src/main/java/com/admin/areaBase/Base.java
  7. 130 0
      src/main/java/com/admin/dev/DevControler.java
  8. 65 0
      src/main/java/com/admin/dev/DevService.java
  9. 107 0
      src/main/java/com/admin/dev/DevVO.java
  10. 158 0
      src/main/java/com/admin/dicitem/DicitemController.java
  11. 84 0
      src/main/java/com/admin/dicitem/DicitemService.java
  12. 50 0
      src/main/java/com/admin/dicitem/DicitemVO.java
  13. 53 0
      src/main/java/com/admin/floorPlan/FloorPlanVO.java
  14. 130 0
      src/main/java/com/admin/fxjl/FxjlController.java
  15. 82 0
      src/main/java/com/admin/fxjl/FxjlService.java
  16. 54 0
      src/main/java/com/admin/fxjl/FxjlVO.java
  17. 16 0
      src/main/java/com/admin/group/GroupProVO.java
  18. 67 0
      src/main/java/com/admin/group/GroupService.java
  19. 67 0
      src/main/java/com/admin/group/GroupVO.java
  20. 71 0
      src/main/java/com/admin/groupShare/GroupShareService.java
  21. 62 0
      src/main/java/com/admin/groupShare/GroupShareVO.java
  22. 130 0
      src/main/java/com/admin/hy/HyController.java
  23. 82 0
      src/main/java/com/admin/hy/HyService.java
  24. 49 0
      src/main/java/com/admin/hy/HyVO.java
  25. 130 0
      src/main/java/com/admin/lbt/LbtController.java
  26. 82 0
      src/main/java/com/admin/lbt/LbtService.java
  27. 47 0
      src/main/java/com/admin/lbt/LbtVO.java
  28. 58 0
      src/main/java/com/admin/map/GroupDevMapVO.java
  29. 250 0
      src/main/java/com/admin/menu/MenuController.java
  30. 84 0
      src/main/java/com/admin/menu/MenuService.java
  31. 60 0
      src/main/java/com/admin/menu/MenuVO.java
  32. 129 0
      src/main/java/com/admin/oprLog/OprLogController.java
  33. 84 0
      src/main/java/com/admin/oprLog/OprLogService.java
  34. 49 0
      src/main/java/com/admin/oprLog/OprLogVO.java
  35. 168 0
      src/main/java/com/admin/org/OrgController.java
  36. 84 0
      src/main/java/com/admin/org/OrgService.java
  37. 55 0
      src/main/java/com/admin/org/OrgVO.java
  38. 129 0
      src/main/java/com/admin/parameter/ParameterController.java
  39. 84 0
      src/main/java/com/admin/parameter/ParameterService.java
  40. 47 0
      src/main/java/com/admin/parameter/ParameterVO.java
  41. 130 0
      src/main/java/com/admin/role/RoleController.java
  42. 84 0
      src/main/java/com/admin/role/RoleService.java
  43. 51 0
      src/main/java/com/admin/role/RoleVO.java
  44. 289 0
      src/main/java/com/admin/sb/SbController.java
  45. 82 0
      src/main/java/com/admin/sb/SbService.java
  46. 72 0
      src/main/java/com/admin/sb/SbVO.java
  47. 130 0
      src/main/java/com/admin/sbgj/SbgjController.java
  48. 82 0
      src/main/java/com/admin/sbgj/SbgjService.java
  49. 55 0
      src/main/java/com/admin/sbgj/SbgjVO.java
  50. 195 0
      src/main/java/com/admin/user/UserController.java
  51. 114 0
      src/main/java/com/admin/user/UserService.java
  52. 67 0
      src/main/java/com/admin/user/UserVO.java
  53. 51 0
      src/main/java/com/admin/user_role/UserRoleVO.java
  54. 90 0
      src/main/java/com/api/index/ApiIndexController.java
  55. 18 0
      src/main/java/com/h5/index/H5IndexController.java
  56. 23 0
      src/main/java/com/pub/config/ActivitiUserDetailService.java
  57. 36 0
      src/main/java/com/pub/config/CorsCfg.java
  58. 33 0
      src/main/java/com/pub/config/CustomInterceptorConfig.java
  59. 25 0
      src/main/java/com/pub/config/RabbitConfig.java
  60. 29 0
      src/main/java/com/pub/config/RedisConfig.java
  61. 62 0
      src/main/java/com/pub/config/SwaggerConfig.java
  62. 49 0
      src/main/java/com/pub/config/TransactionAdviceConfig.java
  63. 39 0
      src/main/java/com/pub/constant/Constants.java
  64. 106 0
      src/main/java/com/pub/env/Environment.java
  65. 13 0
      src/main/java/com/pub/excel/WriteExcelInterface.java
  66. 14 0
      src/main/java/com/pub/exception/BusinessException.java
  67. 15 0
      src/main/java/com/pub/field/Fields.java
  68. 104 0
      src/main/java/com/pub/foreignKey/ForeignKeyController.java
  69. 58 0
      src/main/java/com/pub/gencode/ColumnInfo.java
  70. 303 0
      src/main/java/com/pub/gencode/GenCode.java
  71. 26 0
      src/main/java/com/pub/gencode/HtmlEditTr.java
  72. 36 0
      src/main/java/com/pub/gencode/HtmlListColumn.java
  73. 37 0
      src/main/java/com/pub/gencode/VoColumn.java
  74. 82 0
      src/main/java/com/pub/index/IndexController.java
  75. 97 0
      src/main/java/com/pub/interceptor/CustomInterceptor.java
  76. 1508 0
      src/main/java/com/pub/jdbc/BaseDAO.java
  77. 17 0
      src/main/java/com/pub/jdbc/BaseSQLParam.java
  78. 10 0
      src/main/java/com/pub/jdbc/CascadeMetadata.java
  79. 44 0
      src/main/java/com/pub/jdbc/CommonVO.java
  80. 135 0
      src/main/java/com/pub/jdbc/SuperVO.java
  81. 167 0
      src/main/java/com/pub/job/UpdateJob.java
  82. 196 0
      src/main/java/com/pub/listener/SpringContext.java
  83. 70 0
      src/main/java/com/pub/log/Log.java
  84. 55 0
      src/main/java/com/pub/page/Page.java
  85. 17 0
      src/main/java/com/pub/page/PageRecord.java
  86. 31 0
      src/main/java/com/pub/page/TotalRecord.java
  87. 45 0
      src/main/java/com/pub/queue/SQLQueue.java
  88. 39 0
      src/main/java/com/pub/system/SystemCache.java
  89. 28 0
      src/main/java/com/pub/system/SystemController.java
  90. 272 0
      src/main/java/com/pub/upload/FileUploadController.java
  91. 81 0
      src/main/java/com/pub/util/AESUtil.java
  92. 206 0
      src/main/java/com/pub/util/BeanUtil.java
  93. 34 0
      src/main/java/com/pub/util/ByteUtil.java
  94. 104 0
      src/main/java/com/pub/util/CommandUtil.java
  95. 33 0
      src/main/java/com/pub/util/ContentUtil.java
  96. 17 0
      src/main/java/com/pub/util/CoordinateUtil.java
  97. 34 0
      src/main/java/com/pub/util/DateUtil.java
  98. 111 0
      src/main/java/com/pub/util/ElasticUtil.java
  99. 112 0
      src/main/java/com/pub/util/ExcelUtil.java
  100. 71 0
      src/main/java/com/pub/util/ForeignKeyUtil.java

+ 75 - 0
.gitignore

@@ -0,0 +1,75 @@
+# IntelliJ IDEA
+.idea/
+*.iml
+
+# 运行时产生的文件
+*.class
+*.log
+*.jar
+*.war
+*.ear
+*.class
+*.log
+*.swp
+*.swo
+*.bak
+
+# Maven 构建
+target/
+*.log
+
+# Gradle 构建
+.gradle/
+build/
+
+# 编译的文件
+*.class
+*.exe
+*.dll
+*.so
+*.dylib
+
+# 依赖和构建工具
+/.mvn/
+!/src/main/resources/
+*.class
+
+# 代码覆盖率工具(如 JaCoCo 等)
+*.exec
+*.gcov
+
+# 配置文件
+*.iml
+*.ipr
+*.iws
+
+# OS 系统文件
+.DS_Store
+Thumbs.db
+
+# IntelliJ IDEA / JetBrains
+.idea
+*.iml
+
+# Log files
+*.log
+
+# 默认构建路径
+out/
+
+# 配置 IDE 相关的文件
+.idea/*
+.idea/workspace.xml
+.idea/tasks.xml
+.idea/dictionaries
+.idea/vcs.xml
+.idea/modules.xml
+.idea/.name
+.idea/.idea/remoteRepositories.xml
+
+# Gradle 或 Maven 插件下载的文件
+.gradle/
+
+# 避免将 `.mvn` 或 `.idea` 文件夹误提交到 Git
+.mvn/
+.idea/

+ 36 - 0
README.en.md

@@ -0,0 +1,36 @@
+# 健康雷达后台接口
+
+#### Description
+{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
+
+#### Software Architecture
+Software architecture description
+
+#### Installation
+
+1.  xxxx
+2.  xxxx
+3.  xxxx
+
+#### Instructions
+
+1.  xxxx
+2.  xxxx
+3.  xxxx
+
+#### Contribution
+
+1.  Fork the repository
+2.  Create Feat_xxx branch
+3.  Commit your code
+4.  Create Pull Request
+
+
+#### Gitee Feature
+
+1.  You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
+2.  Gitee blog [blog.gitee.com](https://blog.gitee.com)
+3.  Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
+4.  The most valuable open source project [GVP](https://gitee.com/gvp)
+5.  The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
+6.  The most popular members  [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

+ 27 - 81
README.md

@@ -1,93 +1,39 @@
-# jkldhtjk
+# 健康雷达后台接口
 
+#### 介绍
+{**以下是 Gitee 平台说明,您可以替换此简介**
+Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台
+无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
 
+#### 软件架构
+软件架构说明
 
-## Getting started
 
-To make it easy for you to get started with GitLab, here's a list of recommended next steps.
+#### 安装教程
 
-Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
+1.  xxxx
+2.  xxxx
+3.  xxxx
 
-## Add your files
+#### 使用说明
 
-- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
-- [ ] [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command:
+1.  xxxx
+2.  xxxx
+3.  xxxx
 
-```
-cd existing_repo
-git remote add origin http://43.137.10.199:81/hfln/jkldhtjk.git
-git branch -M main
-git push -uf origin main
-```
+#### 参与贡献
 
-## Integrate with your tools
+1.  Fork 本仓库
+2.  新建 Feat_xxx 分支
+3.  提交代码
+4.  新建 Pull Request
 
-- [ ] [Set up project integrations](http://43.137.10.199:81/hfln/jkldhtjk/-/settings/integrations)
 
-## Collaborate with your team
+#### 特技
 
-- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
-- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
-- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
-- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
-- [ ] [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
-
-## Test and Deploy
-
-Use the built-in continuous integration in GitLab.
-
-- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/)
-- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
-- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
-- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
-- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
-
-***
-
-# Editing this README
-
-When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
-
-## Suggestions for a good README
-
-Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
-
-## Name
-Choose a self-explaining name for your project.
-
-## Description
-Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
-
-## Badges
-On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
-
-## Visuals
-Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
-
-## Installation
-Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
-
-## Usage
-Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
-
-## Support
-Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
-
-## Roadmap
-If you have ideas for releases in the future, it is a good idea to list them in the README.
-
-## Contributing
-State if you are open to contributions and what your requirements are for accepting them.
-
-For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
-
-You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
-
-## Authors and acknowledgment
-Show your appreciation to those who have contributed to the project.
-
-## License
-For open source projects, say how it is licensed.
-
-## Project status
-If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
+1.  使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
+2.  Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
+3.  你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
+4.  [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
+5.  Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
+6.  Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

+ 274 - 0
pom.xml

@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>war</packaging>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.4.0</version>
+        <relativePath /> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>com.ahqlj</groupId>
+    <artifactId>FrameWork</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>FrameWork</name>
+    <description>FrameWork project for Spring Boot</description>
+
+    <properties>
+        <java.version>1.8</java.version>
+        <swagger.version>2.7.0</swagger.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.8.9</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.2.2</version>
+        </dependency>
+        <dependency>
+            <groupId>com.github.binarywang</groupId>
+            <artifactId>weixin-java-mp</artifactId>
+            <version>4.5.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+<!--        <dependency>-->
+<!--            <groupId>org.springframework.boot</groupId>-->
+<!--            <artifactId>spring-boot-starter-tomcat</artifactId>-->
+<!--            <scope>provided</scope>-->
+<!--        </dependency>-->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-jdbc</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.oracle.database.jdbc</groupId>
+            <artifactId>ojdbc8</artifactId>
+            <version>21.8.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.58</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+            <version>3.17</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>3.17</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.8</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>core</artifactId>
+            <version>3.4.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-amqp</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-beanutils</groupId>
+            <artifactId>commons-beanutils</artifactId>
+            <version>1.9.4</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.9.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+
+        <!-- wechatpay -->
+        <dependency>
+            <groupId>com.github.wechatpay-apiv3</groupId>
+            <artifactId>wechatpay-apache-httpclient</artifactId>
+            <version>0.3.0</version>
+        </dependency>
+        <!-- wechatpay -->
+
+        <!-- alipay -->
+        <dependency>
+            <groupId>com.alipay.sdk</groupId>
+            <artifactId>alipay-sdk-java</artifactId>
+            <version>4.38.111.ALL</version>
+        </dependency>
+        <!-- alipay -->
+
+        <dependency>
+            <groupId>javax.mail</groupId>
+            <artifactId>mail</artifactId>
+            <version>1.4.7</version>
+        </dependency>
+        <!-- <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-spring-boot-starter</artifactId>
+            <version>7.1.0.M6</version> </dependency> <dependency> <groupId>org.activiti</groupId>
+            <artifactId>activiti-image-generator</artifactId> <version>7.1.0.M6</version>
+            </dependency> -->
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+            <version>${swagger.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger-ui</artifactId>
+            <version>${swagger.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>1.18.20</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.2.8</version>
+        </dependency>
+
+        <!-- Kepserver -->
+        <dependency>
+            <groupId>org.eclipse.milo</groupId>
+            <artifactId>sdk-client</artifactId>
+            <version>0.6.3</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>23.0</version>
+        </dependency>
+        <!-- Kepserver -->
+
+        <dependency>
+            <groupId>joda-time</groupId>
+            <artifactId>joda-time</artifactId>
+            <version>2.10.2</version>
+        </dependency>
+
+        <!-- dingtalk -->
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>dingtalk</artifactId>
+            <version>1.3.75</version>
+        </dependency>
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>alibaba-dingtalk-service-sdk</artifactId>
+            <version>2.0.0</version>
+        </dependency>
+        <!-- dingtalk -->
+
+
+        <dependency>
+            <groupId>com.tencentcloudapi</groupId>
+            <artifactId>tencentcloud-sdk-java</artifactId>
+            <version>3.1.1190</version>
+        </dependency>
+
+        <!-- elastic -->
+        <dependency>
+            <groupId>co.elastic.clients</groupId>
+            <artifactId>elasticsearch-java</artifactId>
+            <version>8.1.2</version>
+        </dependency>
+        <dependency>
+            <groupId>jakarta.json</groupId>
+            <artifactId>jakarta.json-api</artifactId>
+            <version>2.0.1</version>
+        </dependency>
+        <!-- elastic -->
+
+        <!-- freemarker -->
+        <dependency>
+            <groupId>org.freemarker</groupId>
+            <artifactId>freemarker</artifactId>
+            <version>2.3.32</version>
+        </dependency>
+        <!-- freemarker -->
+
+        <!-- image-combiner -->
+        <dependency>
+            <groupId>com.freewayso</groupId>
+            <artifactId>image-combiner</artifactId>
+            <version>2.6.5</version>
+        </dependency>
+        <!-- image-combiner -->
+
+        <!-- MQTT -->
+        <dependency>
+            <groupId>org.springframework.integration</groupId>
+            <artifactId>spring-integration-mqtt</artifactId>
+        </dependency>
+        <!-- image-combiner -->
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                    <encoding>UTF-8</encoding>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.springframework.cloud</groupId>
+                <artifactId>spring-cloud-dependencies</artifactId>
+                <version>2020.0.0</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+</project>

+ 59 - 0
src/main/java/com/admin/alarm_event/AlarmEvent.java

@@ -0,0 +1,59 @@
+package com.admin.alarm_event;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.pub.jdbc.CascadeMetadata;
+import com.pub.jdbc.SuperVO;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.sql.Timestamp;
+
+@Data
+public class AlarmEvent extends SuperVO {
+    @ApiModelProperty(value = "id")
+    private Integer id;
+
+    @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") // 设置输出格式
+    private Timestamp create_time;
+
+    @ApiModelProperty(value = "删除标志")
+    private Integer delete_tag;
+
+    @ApiModelProperty(value = "删除时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") // 设置输出格式
+    private Timestamp delete_time;
+
+    @ApiModelProperty(value = "姿态")
+    private Integer pose;
+
+    @ApiModelProperty(value = "目标点位")
+    private String target_points;
+
+    @ApiModelProperty(value = "事件")
+    private String event;
+
+    @ApiModelProperty(value = "事件描述")
+    private String desc;
+
+    @ApiModelProperty(value = "是否处理")
+    private Integer is_handle;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+    @Override
+    public String getTableName() {
+        return "alarm_event";
+    }
+
+    @Override
+    public CascadeMetadata[] getChildCascadeMetadata() {
+        return null;
+    }
+
+    @Override
+    public String getPKFieldName() {
+        return "id";
+    }
+}

+ 95 - 0
src/main/java/com/admin/areaBase/Base.java

@@ -0,0 +1,95 @@
+package com.admin.areaBase;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.pub.jdbc.BaseDAO;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+
+import org.springframework.util.StringUtils;
+public class Base {
+    private int x_cm_start;
+    private int x_cm_stop;
+    private int y_cm_start;
+    private int y_cm_stop;
+    private int track_presence;
+    private int exclude_falling;
+
+    // 默认构造函数
+    public Base() {}
+
+    // 带参数的构造函数
+    public Base(int x_cm_start, int x_cm_stop, int y_cm_start, int y_cm_stop,
+                int track_presence, int exclude_falling) {
+        this.x_cm_start = x_cm_start;
+        this.x_cm_stop = x_cm_stop;
+        this.y_cm_start = y_cm_start;
+        this.y_cm_stop = y_cm_stop;
+        this.track_presence = track_presence;
+        this.exclude_falling = exclude_falling;
+
+    }
+
+    // Getter 和 Setter 方法
+    public double getX_cm_start() {
+        return x_cm_start;
+    }
+
+    public void setX_cm_start(int x_cm_start) {
+        this.x_cm_start = x_cm_start;
+    }
+
+    public double getX_cm_stop() {
+        return x_cm_stop;
+    }
+
+    public void setX_cm_stop(int x_cm_stop) {
+        this.x_cm_stop = x_cm_stop;
+    }
+
+    public double getY_cm_start() {
+        return y_cm_start;
+    }
+
+    public void setY_cm_start(int y_cm_start) {
+        this.y_cm_start = y_cm_start;
+    }
+
+    public double getY_cm_stop() {
+        return y_cm_stop;
+    }
+
+    public void setY_cm_stop(int y_cm_stop) {
+        this.y_cm_stop = y_cm_stop;
+    }
+
+    public double getTrack_presence() {
+        return track_presence;
+    }
+
+    public void setTrack_presence(int track_presence) {
+        this.track_presence = track_presence;
+    }
+
+    public int getExclude_falling() {
+        return exclude_falling;
+    }
+
+    public void setExclude_falling(int exclude_falling) {
+        this.exclude_falling = exclude_falling;
+    }
+
+    // toString 方法,方便打印对象
+    @Override
+    public String toString() {
+        return "Base{" +
+                "x_cm_start='" + x_cm_start + '\'' +
+                ", x_cm_stop='" + x_cm_stop + '\'' +
+                ", y_cm_start='" + y_cm_start + '\'' +
+                ", y_cm_stop='" + y_cm_stop + '\'' +
+                ", track_presence=" + track_presence +
+                ", exclude_falling=" + exclude_falling +
+                '}';
+    }
+}
+

+ 130 - 0
src/main/java/com/admin/dev/DevControler.java

@@ -0,0 +1,130 @@
+package com.admin.dev;
+
+import org.eclipse.paho.client.mqttv3.internal.wire.MqttAck;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.alibaba.fastjson.JSONObject;
+import com.pub.log.Log;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+import com.pub.util.MqttUtil;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.annotations.ApiIgnore;
+
+@Controller
+@RequestMapping("/dev")
+@Api(tags = "设备接口")
+public class DevControler {
+	
+	@Autowired
+	private DevService devService;
+	
+	/**
+	 * 根据DevID获得数据
+	 * @param vo
+	 * @return
+	 */
+	@ResponseBody
+	@GetMapping("/getDevByDevID")
+	@ApiOperation(value = "查询设备详情")
+	@ApiImplicitParams({
+		@ApiImplicitParam(name = "dev_id", value ="", dataType = "String", paramType = "query")
+	})
+	public R getDevByDevID(@ApiIgnore DevVO vo) {
+		R r =JSONUtil.getSuccessMsg(null);
+		DevVO dev =devService.getDevByDevID(vo);
+		r.data.put("dev", dev);
+		return r;
+	}
+	
+	/**
+	 * 获取列表数据
+	 * @param page
+	 * @param vo
+	 * @return
+	 */
+	@ResponseBody
+	@GetMapping("/queryDevList")
+	@ApiImplicitParams({
+		@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query"),
+        @ApiImplicitParam(name = "page", value = "页码", dataType = "int", required = true, paramType = "query"),
+        @ApiImplicitParam(name = "rows", value = "每页条数", dataType = "int", required = true, paramType = "query"),
+        @ApiImplicitParam(name = "sort", value = "排序字段", dataType = "String", paramType = "query"),
+        @ApiImplicitParam(name = "order", value = "排序方式", dataType = "String", paramType = "query"),
+	})
+	public R queryDevList(@ApiIgnore Page page,@ApiIgnore DevVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		StringBuffer condition =new StringBuffer();
+		if (vo.getDev_id()==null) {
+			condition.append(" and delete_tag =0");
+		}
+		else {
+			condition.append(" and delete_tag =0 and dev_id ='"+vo.getDev_id()+"' ");
+		}
+		PageRecord<DevVO> pr =devService.queryDevList(page, condition);
+		r.data.put("pr", pr);
+		return r;
+	}
+	
+	/**
+	 * 新增或编辑时进行保存
+	 * @param vo
+	 * @return
+	 */
+	@ResponseBody
+	@PostMapping("/saveOrUpdate")
+	@ApiOperation(value = "保存或更新设备")
+	@ApiImplicitParam(name = "设备实体对象", value = "对应表:tbl_dev", required = true, dataType = "DevVO")
+	public R saveOrUpdate(@ApiIgnore @RequestBody DevVO vo) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		JSONObject msg = new JSONObject();
+		msg.put("dev_id", vo.getDev_id());
+		try {
+			devService.saveOrUpdate(vo);
+			MqttUtil.pub("/mps/add_device", msg.toJSONString());
+		}catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+	
+	/**
+	 * 批量删除数据
+	 * @param openid
+	 * @return
+	 */
+	@ResponseBody
+	@GetMapping("/delete") 
+	@ApiOperation(value = "删除设备")
+	@ApiImplicitParams({
+		@ApiImplicitParam(name ="dev_id",value = "dev_id",dataType = "String", required = true, paramType = "query")
+	})
+	public R delete(String dev_id) {
+		R map =JSONUtil.getSuccessMsg(null);
+		JSONObject msg = new JSONObject();
+		msg.put("dev_id", dev_id);
+		try {
+			devService.delete(dev_id);
+			MqttUtil.pub("/mps/del_device", msg.toJSONString());
+		} catch (Exception e) {
+			
+			Log.error(e);
+			map =JSONUtil.getErrorMsg(e);
+		}
+		return map;
+	}
+}

+ 65 - 0
src/main/java/com/admin/dev/DevService.java

@@ -0,0 +1,65 @@
+package com.admin.dev;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.pub.jdbc.BaseDAO;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+
+import org.springframework.util.StringUtils;
+
+@Service
+public class DevService {
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	/**
+	 * 分页查询数据
+	 * @param page
+	 * @param condition
+	 * @return
+	 */
+	public PageRecord<DevVO> queryDevList(Page page, StringBuffer condition){
+		if(StringUtils.isEmpty(page.getSort())){
+			page.setSort("create_time");
+			page.setOrder("desc");
+		}
+		return baseDAO.queryAllPaginateByCondition(DevVO.class, condition.toString(), page.getRows(), page.getPage(), page.getSort()+" "+page.getOrder());
+	}
+	
+	/**
+	 * 根据DevID查询数据
+	 * @param vo
+	 * @return
+	 */
+	public DevVO getDevByDevID(DevVO vo){
+		return baseDAO.queryByKey(DevVO.class, "dev_id",vo.getDev_id());
+	}
+	
+	/**
+	 * 新增或编辑时进行保存
+	 * @param vo
+	 */
+	public void saveOrUpdate(DevVO vo) {
+		if(getDevByDevID(vo) != null) {
+			baseDAO.updateSQL("update dev_info set delete_tag =0,dev_name ='"+vo.getDev_name()+"',dev_type ='"+vo.getDev_type()+"' where dev_id ='"+
+			vo.getDev_id()+"'");
+		}
+		else {
+			vo.setDelete_tag(0);
+			baseDAO.insertAll(vo);
+		}
+	}
+	
+	/**
+	 * 批量删除数据
+	 * @param openid
+	 */
+	public void delete(String dev_id) {
+		String[] dev_ids =dev_id.split(",");
+		for(int index =0;index<dev_ids.length;index++) {
+			baseDAO.updateSQL("update dev_info set user_openid =null where dev_id ='"+dev_ids[index]+"'");
+			baseDAO.deleteByKey(DevVO.class, "dev_id", dev_ids[index]);
+		}
+	}
+}

+ 107 - 0
src/main/java/com/admin/dev/DevVO.java

@@ -0,0 +1,107 @@
+package com.admin.dev;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import com.pub.jdbc.CascadeMetadata;
+import com.pub.jdbc.SuperVO;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class DevVO extends SuperVO {
+    @ApiModelProperty(value = "id")
+    private int id;
+    @ApiModelProperty(value = "设备ID")
+    private String dev_id;
+    @ApiModelProperty(value = "用户openid")
+    private String user_openid;
+    @ApiModelProperty(value = "设备名称")
+    private String dev_name;
+    @ApiModelProperty(value = "设备型号")
+    private String dev_type;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.zzz", timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
+    private Timestamp create_time;
+    @ApiModelProperty(value = "删除标记")
+    private int delete_tag;
+    @ApiModelProperty(value = "删除时间")
+    private Timestamp delete_time;
+    @ApiModelProperty(value = "更新时间")
+    private Timestamp update_time;
+    @ApiModelProperty(value = "在线")
+    private Integer online;
+    @ApiModelProperty(value = "设备报警")
+    private Integer dev_warn;
+    @ApiModelProperty(value = "软件版本号")
+    private String software;
+    @ApiModelProperty(value = "硬件版本号")
+    private String hardware;
+    @ApiModelProperty(value = "WIFI名称")
+    private String ssid;
+    @ApiModelProperty(value = "WIFI密码")
+    private String password;
+    @ApiModelProperty(value = "IP地址")
+    private String ip;
+    @ApiModelProperty(value = "安装方式")
+    private String mount_plain;
+    @ApiModelProperty(value = "start_x")
+    private BigDecimal start_x;
+    @ApiModelProperty(value = "start_y")
+    private BigDecimal start_y;
+    @ApiModelProperty(value = "start_z")
+    private BigDecimal start_z;
+    @ApiModelProperty(value = "stop_x")
+    private BigDecimal stop_x;
+    @ApiModelProperty(value = "stop_y")
+    private BigDecimal stop_y;
+    @ApiModelProperty(value = "stop_z")
+    private BigDecimal stop_z;
+    @ApiModelProperty(value = "长度")
+    private BigDecimal length;
+    @ApiModelProperty(value = "宽度")
+    private BigDecimal width;
+    @ApiModelProperty(value = "高度")
+    private BigDecimal height;
+    @ApiModelProperty(value = "target_points")
+    private String target_points;
+    @ApiModelProperty(value = "获取target时间")
+    private Timestamp signal_time;
+    @ApiModelProperty(value = "北向夹角")
+    private float north_angle;
+    @ApiModelProperty(value = "安装坐标x")
+    private float x;
+    @ApiModelProperty(value = "安装坐标y")
+    private float y;
+    @ApiModelProperty(value = "指示灯开关")
+    private int status_light;
+
+    /**
+     * 获得表名
+     */
+    @Override
+    public String getTableName() {
+        return "dev_info";
+    }
+
+    /**
+     * 获得关联子表的CascadeMetadata,没有直接null
+     */
+    @Override
+    public CascadeMetadata[] getChildCascadeMetadata() {
+        return null;
+    }
+
+    public String getDevID() {
+        return "dev_id";
+    }
+
+    @Override
+    public String getPKFieldName() {
+        return "id";
+    }
+
+}

+ 158 - 0
src/main/java/com/admin/dicitem/DicitemController.java

@@ -0,0 +1,158 @@
+package com.admin.dicitem;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import com.admin.menu.MenuVO;
+import com.pub.jdbc.BaseDAO;
+import com.pub.log.Log;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+import com.pub.util.SQLUtil;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.annotations.ApiIgnore;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2022-12-09 17:29:18
+ */
+@Controller
+@RequestMapping("/dicitem")
+@Api(tags = "数据字典接口")
+public class DicitemController {
+
+	@Autowired
+	private DicitemService dicitemService;
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	
+	
+	/**
+	 * 根据ID获得数据
+	 *@author znn
+	 *@date 2022-12-09 17:29:18
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/getDicitemById")
+	@ApiOperation(value = "查询数据字典详情")
+    @ApiImplicitParams({
+    	@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query")
+    })
+	public R getDicitemById(@ApiIgnore DicitemVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		DicitemVO dicitem = dicitemService.getDicitemById(vo);
+		r.data.put("dicitem", dicitem);
+		return r;
+	}
+	
+	/**
+	 * 获得列表数据
+	 *@author znn
+	 *@date 2022-12-09 17:29:18
+	 *@param page
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/queryDicitemList")
+	@ApiOperation(value = "查询数据字典列表")
+	public R queryDicitemList() {
+		R r = JSONUtil.getSuccessMsg(null);
+		List<DicitemVO> dics = baseDAO.queryByCondition(DicitemVO.class, null, " px asc,create_time desc ");
+		List<DicitemVO> rootDics = new ArrayList<>();
+		List<DicitemVO> childDics = new ArrayList<>();
+		for (DicitemVO org : dics) {
+			if (StringUtils.isEmpty(org.getParent_id())) {
+				rootDics.add(org);
+			}else {
+				childDics.add(org);
+			}
+		}
+		rootDics.stream()
+                .map(item -> {
+                    item.setChildren(getChildren(item, childDics));
+                    return item;
+                })
+                .collect(Collectors.toList());
+		r.data.put("tree_data", rootDics);
+		return r;
+	}
+	
+	public List<DicitemVO> getChildren(DicitemVO root, List<DicitemVO> all) {
+        List<DicitemVO> children = all.stream()
+                .filter(item -> item.getParent_id().equals(root.getId()))
+                .map((item) -> {
+                    item.setChildren(getChildren(item, all));
+                    return item;
+                }).collect(Collectors.toList());
+        return children;
+    }
+	
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2022-12-09 17:29:18
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@PostMapping("/saveOrUpdate")
+	@ApiOperation(value = "保存或更新数据字典")
+	@ApiImplicitParam(name = "数据字典实体对象", value = "对应表:tbl_dicitem", required = true, dataType = "DicitemVO")
+	public R saveOrUpdate(@ApiIgnore @RequestBody DicitemVO vo) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			dicitemService.saveOrUpdate(vo);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2022-12-09 17:29:18
+	 *@param id
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/delete")
+	@ApiOperation(value = "删除数据字典")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "id", value = "主键(多个以,号分隔)", dataType = "String", required = true, paramType = "query")
+    })
+	public R delete(String id) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			dicitemService.delete(id);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+}

+ 84 - 0
src/main/java/com/admin/dicitem/DicitemService.java

@@ -0,0 +1,84 @@
+package com.admin.dicitem;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.pub.jdbc.BaseDAO;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import org.springframework.util.StringUtils;
+import java.sql.Timestamp;
+import com.pub.env.Environment;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2022-12-09 17:29:18
+ */
+@Service
+public class DicitemService {
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	/**
+	 * 分页查询数据
+	 *@author znn
+	 *@date 2022-12-09 17:29:18
+	 *@param page
+	 *@param condtion
+	 *@description
+	 */
+	public PageRecord<DicitemVO> queryDicitemList(Page page, StringBuffer condition) {
+		if(StringUtils.isEmpty(page.getSort())){
+			page.setSort("create_time");
+			page.setOrder("desc");
+		}
+		return baseDAO.queryPaginateByCondition(DicitemVO.class, condition.toString(), page.getRows(), page.getPage(),page.getSort()+" "+page.getOrder());
+	}
+
+	/**
+	 * 根据ID查询数据
+	 *@author znn
+	 *@date 2022-12-09 17:29:18
+	 *@param vo
+	 *@description
+	 */
+	public DicitemVO getDicitemById(DicitemVO vo) {
+		return baseDAO.queryByPK(vo.getClass(), vo.getPrimaryKey());
+	}
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2022-12-09 17:29:18
+	 *@param vo
+	 *@description
+	 */
+	public void saveOrUpdate(DicitemVO vo) {
+		if (!StringUtils.isEmpty(vo.getPrimaryKey())) {
+			vo.setUpdate_time(new Timestamp(System.currentTimeMillis()));
+			vo.setUpdator(Environment.getUser().getId());
+			baseDAO.update(vo);
+		} else {
+			baseDAO.insert(vo);
+		}
+	}
+	
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2022-12-09 17:29:18
+	 *@param id
+	 *@description
+	 */
+	public void delete(String id) {
+		String[] ids = id.split(",");
+		DicitemVO[] vos = new DicitemVO[ids.length];
+		for (int index = 0; index < vos.length; ++index) {
+			DicitemVO vo = new DicitemVO();
+			vo.setPrimaryKey(ids[index]);
+			vos[index] = vo;
+		}
+		baseDAO.deleteArray(vos);
+	}
+}

+ 50 - 0
src/main/java/com/admin/dicitem/DicitemVO.java

@@ -0,0 +1,50 @@
+package com.admin.dicitem;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.pub.jdbc.CascadeMetadata;
+import com.pub.jdbc.CommonVO;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * @author znn
+ * @date 2022-12-09 17:29:18
+ */
+@Data
+public class DicitemVO extends CommonVO {
+	
+	/**
+	 * 字段列表(开发工具生成的字段和数据库字段一致)
+	 */
+	@ApiModelProperty(value="字典详细名称")
+	private String name;
+	@ApiModelProperty(value="字典主表主键")
+	private String parent_id;
+	@ApiModelProperty(value="排序")
+	private Integer px;
+	
+	
+	
+	
+	private List<DicitemVO> children = new ArrayList<>();
+	
+	/**
+	 * 获得表名
+	 */
+	@Override
+	public String getTableName() {
+		return "tbl_dicitem";
+	}
+	
+	/**
+	 * 获得关联子表的CascadeMetadata,没有直接null
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		return null;
+	}
+}

+ 53 - 0
src/main/java/com/admin/floorPlan/FloorPlanVO.java

@@ -0,0 +1,53 @@
+package com.admin.floorPlan;
+
+import java.sql.Timestamp;
+
+import com.pub.jdbc.CascadeMetadata;
+import com.pub.jdbc.SuperVO;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class FloorPlanVO extends SuperVO {
+	
+	/**
+	 * 字段列表(开发工具生成的字段和数据库字段一致)
+	 */
+	@ApiModelProperty(value="id")
+	private int id;
+	@ApiModelProperty(value="创建时间")
+	private Timestamp create_time;
+	@ApiModelProperty(value="删除标记")
+	private int delete_tag;
+	@ApiModelProperty(value="删除时间")
+	private Timestamp delete_time;
+	@ApiModelProperty(value="更新时间")
+	private Timestamp update_time;
+	@ApiModelProperty(value="群组uuid")
+	private String group_uuid;
+	@ApiModelProperty(value="户型图地址")
+	private String floorplan_addr;
+	
+	/**
+	 * 获得表名
+	 */
+	@Override
+	public String getTableName() {
+		return "group_floorplan";
+	}
+	
+	/**
+	 * 获得关联子表的CascadeMetadata,没有直接null
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		return null;
+	}
+	
+	@Override
+	public String getPKFieldName() {
+		return "id";
+	}
+
+}

+ 130 - 0
src/main/java/com/admin/fxjl/FxjlController.java

@@ -0,0 +1,130 @@
+package com.admin.fxjl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import com.pub.log.Log;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+import com.pub.util.SQLUtil;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.annotations.ApiIgnore;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2024-08-16 15:06:42
+ */
+@Controller
+@RequestMapping("/fxjl")
+@Api(tags = "分享记录接口")
+public class FxjlController {
+
+	@Autowired
+	private FxjlService fxjlService;
+	
+	/**
+	 * 根据ID获得数据
+	 *@author znn
+	 *@date 2024-08-16 15:06:42
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/getFxjlById")
+	@ApiOperation(value = "查询分享记录详情")
+    @ApiImplicitParams({
+    	@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query")
+    })
+	public R getFxjlById(@ApiIgnore FxjlVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		FxjlVO fxjl = fxjlService.getFxjlById(vo);
+		r.data.put("fxjl", fxjl);
+		return r;
+	}
+	
+	/**
+	 * 获得列表数据
+	 *@author znn
+	 *@date 2024-08-16 15:06:42
+	 *@param page
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/queryFxjlList")
+	@ApiOperation(value = "查询分享记录列表")
+    @ApiImplicitParams({
+    	@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query"),
+        @ApiImplicitParam(name = "page", value = "页码", dataType = "int", required = true, paramType = "query"),
+        @ApiImplicitParam(name = "rows", value = "每页条数", dataType = "int", required = true, paramType = "query"),
+        @ApiImplicitParam(name = "sort", value = "排序字段", dataType = "String", paramType = "query"),
+        @ApiImplicitParam(name = "order", value = "排序方式", dataType = "String", paramType = "query"),
+    })
+	public R queryFxjlList(@ApiIgnore Page page,@ApiIgnore FxjlVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		StringBuffer condition = SQLUtil.getCondition(vo);
+		PageRecord<FxjlVO> pr = fxjlService.queryFxjlList(page, condition);
+		r.data.put("pr", pr);
+		return r;
+	}
+	
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2024-08-16 15:06:42
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@PostMapping("/saveOrUpdate")
+	@ApiOperation(value = "保存或更新分享记录")
+	@ApiImplicitParam(name = "分享记录实体对象", value = "对应表:tbl_fxjl", required = true, dataType = "FxjlVO")
+	public R saveOrUpdate(@ApiIgnore @RequestBody FxjlVO vo) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			fxjlService.saveOrUpdate(vo);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2024-08-16 15:06:42
+	 *@param id
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/delete")
+	@ApiOperation(value = "删除分享记录")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "id", value = "主键(多个以,号分隔)", dataType = "String", required = true, paramType = "query")
+    })
+	public R delete(String id) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			fxjlService.delete(id);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+}

+ 82 - 0
src/main/java/com/admin/fxjl/FxjlService.java

@@ -0,0 +1,82 @@
+package com.admin.fxjl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.pub.jdbc.BaseDAO;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import org.springframework.util.StringUtils;
+import java.sql.Timestamp;
+import com.pub.env.Environment;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2024-08-16 15:06:42
+ */
+@Service
+public class FxjlService {
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	/**
+	 * 分页查询数据
+	 *@author znn
+	 *@date 2024-08-16 15:06:42
+	 *@param page
+	 *@param condtion
+	 *@description
+	 */
+	public PageRecord<FxjlVO> queryFxjlList(Page page, StringBuffer condition) {
+		if(StringUtils.isEmpty(page.getSort())){
+			page.setSort("create_time");
+			page.setOrder("desc");
+		}
+		return baseDAO.queryPaginateByCondition(FxjlVO.class, condition.toString(), page.getRows(), page.getPage(),page.getSort()+" "+page.getOrder());
+	}
+
+	/**
+	 * 根据ID查询数据
+	 *@author znn
+	 *@date 2024-08-16 15:06:42
+	 *@param vo
+	 *@description
+	 */
+	public FxjlVO getFxjlById(FxjlVO vo) {
+		return baseDAO.queryByPK(vo.getClass(), vo.getPrimaryKey());
+	}
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2024-08-16 15:06:42
+	 *@param vo
+	 *@description
+	 */
+	public void saveOrUpdate(FxjlVO vo) {
+		if (!StringUtils.isEmpty(vo.getPrimaryKey())) {
+			baseDAO.update(vo);
+		} else {
+			baseDAO.insert(vo);
+		}
+	}
+	
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2024-08-16 15:06:42
+	 *@param id
+	 *@description
+	 */
+	public void delete(String id) {
+		String[] ids = id.split(",");
+		FxjlVO[] vos = new FxjlVO[ids.length];
+		for (int index = 0; index < vos.length; ++index) {
+			FxjlVO vo = new FxjlVO();
+			vo.setPrimaryKey(ids[index]);
+			vos[index] = vo;
+		}
+		baseDAO.deleteArray(vos);
+	}
+}

+ 54 - 0
src/main/java/com/admin/fxjl/FxjlVO.java

@@ -0,0 +1,54 @@
+package com.admin.fxjl;
+
+import com.pub.jdbc.CommonVO;
+import com.pub.jdbc.CascadeMetadata;
+import java.sql.Timestamp;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Time;
+import java.math.BigDecimal;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * @author znn
+ * @date 2024-08-16 15:06:42
+ */
+@Data
+public class FxjlVO extends CommonVO {
+	
+	/**
+	 * 字段列表(开发工具生成的字段和数据库字段一致)
+	 */
+	@ApiModelProperty(value="设备")
+	private String sb_id;
+	@ApiModelProperty(value="分享人")
+	private String fxr;
+	@ApiModelProperty(value="被分享人")
+	private String bfxr;
+	@ApiModelProperty(value="确认状态")
+	private Integer qrzt;
+	
+	private String mc;
+	private String bh;
+	private String sjhm;
+	
+	/**
+	 * 获得表名
+	 */
+	@Override
+	public String getTableName() {
+		return "tbl_fxjl";
+	}
+	
+	/**
+	 * 获得关联子表的CascadeMetadata,没有直接null
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		return null;
+	}
+}

+ 16 - 0
src/main/java/com/admin/group/GroupProVO.java

@@ -0,0 +1,16 @@
+package com.admin.group;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class GroupProVO{
+	@ApiModelProperty(value="group")
+	private GroupVO group;
+	@ApiModelProperty(value="total")
+	private int total;
+	@ApiModelProperty(value="online")
+	private int online;
+	@ApiModelProperty(value="warn")
+	private int warn;
+}

+ 67 - 0
src/main/java/com/admin/group/GroupService.java

@@ -0,0 +1,67 @@
+package com.admin.group;
+
+import java.util.UUID;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import com.pub.jdbc.BaseDAO;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+
+@Service
+public class GroupService {
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	/**
+	 * 分页查询数据
+	 * @param page
+	 * @param condition
+	 * @return
+	 */
+	public PageRecord<GroupVO> queryGroupList(Page page, StringBuffer condition){
+		if(StringUtils.isEmpty(page.getSort())){
+			page.setSort("create_time");
+			page.setOrder("desc");
+		}
+		return baseDAO.queryAllPaginateByCondition(GroupVO.class, condition.toString(), page.getRows(), page.getPage(), page.getSort()+" "+page.getOrder());
+	}
+	
+	/**
+	 * 根据GroupUUID查询数据
+	 * @param vo
+	 * @return
+	 */
+	public GroupVO getGroupByUUID(GroupVO vo){
+		return baseDAO.queryByKey(GroupVO.class, "group_uuid",vo.getGroup_uuid());
+	}
+	
+	
+	/**
+	 * 新增或编辑时进行保存
+	 * @param vo
+	 */
+	public void saveOrUpdate(GroupVO vo) {
+		// 更新
+		if(getGroupByUUID(vo) != null) {
+			baseDAO.updateSQL("update dev_group set delete_tag =0,group_name ='"+vo.getGroup_name()+"' where group_uuid ='"+
+			vo.getGroup_uuid()+"'");
+		}
+		// 新增
+		else {
+			vo.setGroup_uuid((UUID.randomUUID()).toString());
+			vo.setDelete_tag(0);
+			baseDAO.insertAll(vo);
+		}
+	}
+	
+	/**
+	 * 删除数据
+	 * @param openid
+	 */
+	public void delete(String group_uuid) {
+		baseDAO.deleteByKey(GroupVO.class,"group_uuid" , group_uuid);
+	}
+}

+ 67 - 0
src/main/java/com/admin/group/GroupVO.java

@@ -0,0 +1,67 @@
+package com.admin.group;
+
+import java.sql.Timestamp;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.pub.jdbc.CascadeMetadata;
+import com.pub.jdbc.SuperVO;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class GroupVO extends SuperVO{
+
+	/**
+	 * 字段列表(开发工具生成的字段和数据库字段一致)
+	 */
+	@ApiModelProperty(value="id")
+	private int id;
+	@ApiModelProperty(value="GroupUUID")
+	private String group_uuid;
+	@ApiModelProperty(value="用户openid")
+	private String user_openid;
+	@ApiModelProperty(value="设备名称")
+	private String group_name;
+	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss.zzz",timezone = "GMT+8")
+	@ApiModelProperty(value="创建时间")
+	private Timestamp create_time;
+	@ApiModelProperty(value="删除标记")
+	private int delete_tag;
+	@ApiModelProperty(value="删除时间")
+	private Timestamp delete_time;
+	@ApiModelProperty(value="更新时间")
+	private Timestamp update_time;
+//	@ApiModelProperty(value="设备列表")
+//	private String dev_list;
+	@ApiModelProperty(value="北向夹角")
+	private double north_angle;
+	@ApiModelProperty(value="长度")
+	private double length;
+	@ApiModelProperty(value="宽度")
+	private double width;
+	
+	
+	
+	
+	/**
+	 * 获得表名
+	 */
+	@Override
+	public String getTableName() {
+		return "dev_group";
+	}
+	
+	/**
+	 * 获得关联子表的CascadeMetadata,没有直接null
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		return null;
+	}
+	
+	@Override
+	public String getPKFieldName() {
+		return "id";
+	}
+}

+ 71 - 0
src/main/java/com/admin/groupShare/GroupShareService.java

@@ -0,0 +1,71 @@
+package com.admin.groupShare;
+
+import java.util.UUID;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.StringUtils;
+
+import com.admin.group.GroupVO;
+import com.pub.jdbc.BaseDAO;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+
+public class GroupShareService {
+
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	/**
+	 * 分页查询数据
+	 * @param page
+	 * @param condition
+	 * @return
+	 */
+	public PageRecord<GroupShareVO> queryGroupShareList(Page page, StringBuffer condition){
+		if(StringUtils.isEmpty(page.getSort())){
+			page.setSort("create_time");
+			page.setOrder("desc");
+		}
+		return baseDAO.queryAllPaginateByCondition(GroupShareVO.class, condition.toString(), page.getRows(), page.getPage(), page.getSort()+" "+page.getOrder());
+	}
+	
+	/**
+	 * 根据uuid查询数据
+	 * @param vo
+	 * @return
+	 */
+	public GroupShareVO getGroupShareByUUID(GroupShareVO vo){
+		if(vo.getUuid()!=null) {
+			return baseDAO.queryByKey(GroupShareVO.class, "uuid",vo.getUuid());
+		}
+		else {
+			return null;
+		}
+		
+	}
+	
+	/**
+	 * 新增或编辑时进行保存
+	 * @param vo
+	 */
+	public void saveOrUpdate(GroupShareVO vo) {
+		// 更新
+		if(getGroupShareByUUID(vo) != null) {
+			baseDAO.updateSQL("update group_share set delete_tag =0,state ="+vo.getState()+" where uuid ='"+vo.getUuid()+"'");
+		}
+		// 新增
+		else {
+			vo.setUuid((UUID.randomUUID()).toString());
+			vo.setDelete_tag(0);
+			baseDAO.insertAll(vo);
+		}
+	}
+	
+	/**
+	 * 删除数据
+	 * @param openid
+	 */
+	public void delete(String uuid) {
+		baseDAO.deleteByKey(GroupVO.class,"uuid" , uuid);
+	}
+}

+ 62 - 0
src/main/java/com/admin/groupShare/GroupShareVO.java

@@ -0,0 +1,62 @@
+package com.admin.groupShare;
+
+import java.sql.Timestamp;
+
+import com.pub.jdbc.CascadeMetadata;
+import com.pub.jdbc.SuperVO;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class GroupShareVO extends SuperVO{
+
+	/**
+	 * 字段列表(开发工具生成的字段和数据库字段一致)
+	 */
+	@ApiModelProperty(value="id")
+	private int id;
+	@ApiModelProperty(value="uuid")
+	private String uuid;
+	@ApiModelProperty(value="创建时间")
+	private Timestamp create_time;
+	@ApiModelProperty(value="删除标记")
+	private int delete_tag;
+	@ApiModelProperty(value="删除时间")
+	private Timestamp delete_time;
+	@ApiModelProperty(value="更新时间")
+	private Timestamp update_time;
+	@ApiModelProperty(value="群组uuid")
+	private String group_uuid;
+	@ApiModelProperty(value = "分享人")
+	private String sharer;
+	@ApiModelProperty(value = "分享人手机号")
+	private String sharer_phone;
+	@ApiModelProperty(value = "被分享人")
+	private String shared;
+	@ApiModelProperty(value = "被分享人手机号")
+	private String shared_phone;
+	@ApiModelProperty(value = "状态")
+	private int state;
+	
+	/**
+	 * 获得表名
+	 */
+	@Override
+	public String getTableName() {
+		return "group_share";
+	}
+	
+	/**
+	 * 获得关联子表的CascadeMetadata,没有直接null
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		return null;
+	}
+	
+	@Override
+	public String getPKFieldName() {
+		return "id";
+	}
+}

+ 130 - 0
src/main/java/com/admin/hy/HyController.java

@@ -0,0 +1,130 @@
+package com.admin.hy;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import com.pub.log.Log;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+import com.pub.util.SQLUtil;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.annotations.ApiIgnore;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2024-08-16 15:07:17
+ */
+@Controller
+@RequestMapping("/hy")
+@Api(tags = "会员接口")
+public class HyController {
+
+	@Autowired
+	private HyService hyService;
+	
+	/**
+	 * 根据ID获得数据
+	 *@author znn
+	 *@date 2024-08-16 15:07:17
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/getHyById")
+	@ApiOperation(value = "查询会员详情")
+    @ApiImplicitParams({
+    	@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query")
+    })
+	public R getHyById(@ApiIgnore HyVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		HyVO hy = hyService.getHyById(vo);
+		r.data.put("hy", hy);
+		return r;
+	}
+	
+	/**
+	 * 获得列表数据
+	 *@author znn
+	 *@date 2024-08-16 15:07:17
+	 *@param page
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/queryHyList")
+	@ApiOperation(value = "查询会员列表")
+    @ApiImplicitParams({
+    	@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query"),
+        @ApiImplicitParam(name = "page", value = "页码", dataType = "int", required = true, paramType = "query"),
+        @ApiImplicitParam(name = "rows", value = "每页条数", dataType = "int", required = true, paramType = "query"),
+        @ApiImplicitParam(name = "sort", value = "排序字段", dataType = "String", paramType = "query"),
+        @ApiImplicitParam(name = "order", value = "排序方式", dataType = "String", paramType = "query"),
+    })
+	public R queryHyList(@ApiIgnore Page page,@ApiIgnore HyVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		StringBuffer condition = SQLUtil.getCondition(vo);
+		PageRecord<HyVO> pr = hyService.queryHyList(page, condition);
+		r.data.put("pr", pr);
+		return r;
+	}
+	
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2024-08-16 15:07:17
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@PostMapping("/saveOrUpdate")
+	@ApiOperation(value = "保存或更新会员")
+	@ApiImplicitParam(name = "会员实体对象", value = "对应表:tbl_hy", required = true, dataType = "HyVO")
+	public R saveOrUpdate(@ApiIgnore @RequestBody HyVO vo) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			hyService.saveOrUpdate(vo);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2024-08-16 15:07:17
+	 *@param id
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/delete")
+	@ApiOperation(value = "删除会员")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "id", value = "主键(多个以,号分隔)", dataType = "String", required = true, paramType = "query")
+    })
+	public R delete(String id) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			hyService.delete(id);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+}

+ 82 - 0
src/main/java/com/admin/hy/HyService.java

@@ -0,0 +1,82 @@
+package com.admin.hy;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.pub.jdbc.BaseDAO;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import org.springframework.util.StringUtils;
+import java.sql.Timestamp;
+import com.pub.env.Environment;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2024-08-16 15:07:17
+ */
+@Service
+public class HyService {
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	/**
+	 * 分页查询数据
+	 *@author znn
+	 *@date 2024-08-16 15:07:17
+	 *@param page
+	 *@param condtion
+	 *@description
+	 */
+	public PageRecord<HyVO> queryHyList(Page page, StringBuffer condition) {
+		if(StringUtils.isEmpty(page.getSort())){
+			page.setSort("create_time");
+			page.setOrder("desc");
+		}
+		return baseDAO.queryPaginateByCondition(HyVO.class, condition.toString(), page.getRows(), page.getPage(),page.getSort()+" "+page.getOrder());
+	}
+
+	/**
+	 * 根据ID查询数据
+	 *@author znn
+	 *@date 2024-08-16 15:07:17
+	 *@param vo
+	 *@description
+	 */
+	public HyVO getHyById(HyVO vo) {
+		return baseDAO.queryByPK(vo.getClass(), vo.getPrimaryKey());
+	}
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2024-08-16 15:07:17
+	 *@param vo
+	 *@description
+	 */
+	public void saveOrUpdate(HyVO vo) {
+		if (!StringUtils.isEmpty(vo.getPrimaryKey())) {
+			baseDAO.update(vo);
+		} else {
+			baseDAO.insert(vo);
+		}
+	}
+	
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2024-08-16 15:07:17
+	 *@param id
+	 *@description
+	 */
+	public void delete(String id) {
+		String[] ids = id.split(",");
+		HyVO[] vos = new HyVO[ids.length];
+		for (int index = 0; index < vos.length; ++index) {
+			HyVO vo = new HyVO();
+			vo.setPrimaryKey(ids[index]);
+			vos[index] = vo;
+		}
+		baseDAO.deleteArray(vos);
+	}
+}

+ 49 - 0
src/main/java/com/admin/hy/HyVO.java

@@ -0,0 +1,49 @@
+package com.admin.hy;
+
+import com.pub.jdbc.CommonVO;
+import com.pub.jdbc.CascadeMetadata;
+import java.sql.Timestamp;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Time;
+import java.math.BigDecimal;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * @author znn
+ * @date 2024-08-16 15:07:17
+ */
+@Data
+public class HyVO extends CommonVO {
+	
+	/**
+	 * 字段列表(开发工具生成的字段和数据库字段一致)
+	 */
+	@ApiModelProperty(value="微信用户")
+	private String openid;
+	@ApiModelProperty(value="手机号码")
+	private String sjhm;
+	@ApiModelProperty(value="密码")
+	private String mm;
+	
+	
+	/**
+	 * 获得表名
+	 */
+	@Override
+	public String getTableName() {
+		return "tbl_hy";
+	}
+	
+	/**
+	 * 获得关联子表的CascadeMetadata,没有直接null
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		return null;
+	}
+}

+ 130 - 0
src/main/java/com/admin/lbt/LbtController.java

@@ -0,0 +1,130 @@
+package com.admin.lbt;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import com.pub.log.Log;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+import com.pub.util.SQLUtil;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.annotations.ApiIgnore;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2024-08-16 15:37:30
+ */
+@Controller
+@RequestMapping("/lbt")
+@Api(tags = "轮播图接口")
+public class LbtController {
+
+	@Autowired
+	private LbtService lbtService;
+	
+	/**
+	 * 根据ID获得数据
+	 *@author znn
+	 *@date 2024-08-16 15:37:30
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/getLbtById")
+	@ApiOperation(value = "查询轮播图详情")
+    @ApiImplicitParams({
+    	@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query")
+    })
+	public R getLbtById(@ApiIgnore LbtVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		LbtVO lbt = lbtService.getLbtById(vo);
+		r.data.put("lbt", lbt);
+		return r;
+	}
+	
+	/**
+	 * 获得列表数据
+	 *@author znn
+	 *@date 2024-08-16 15:37:30
+	 *@param page
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/queryLbtList")
+	@ApiOperation(value = "查询轮播图列表")
+    @ApiImplicitParams({
+    	@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query"),
+        @ApiImplicitParam(name = "page", value = "页码", dataType = "int", required = true, paramType = "query"),
+        @ApiImplicitParam(name = "rows", value = "每页条数", dataType = "int", required = true, paramType = "query"),
+        @ApiImplicitParam(name = "sort", value = "排序字段", dataType = "String", paramType = "query"),
+        @ApiImplicitParam(name = "order", value = "排序方式", dataType = "String", paramType = "query"),
+    })
+	public R queryLbtList(@ApiIgnore Page page,@ApiIgnore LbtVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		StringBuffer condition = SQLUtil.getCondition(vo);
+		PageRecord<LbtVO> pr = lbtService.queryLbtList(page, condition);
+		r.data.put("pr", pr);
+		return r;
+	}
+	
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2024-08-16 15:37:30
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@PostMapping("/saveOrUpdate")
+	@ApiOperation(value = "保存或更新轮播图")
+	@ApiImplicitParam(name = "轮播图实体对象", value = "对应表:tbl_lbt", required = true, dataType = "LbtVO")
+	public R saveOrUpdate(@ApiIgnore @RequestBody LbtVO vo) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			lbtService.saveOrUpdate(vo);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2024-08-16 15:37:30
+	 *@param id
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/delete")
+	@ApiOperation(value = "删除轮播图")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "id", value = "主键(多个以,号分隔)", dataType = "String", required = true, paramType = "query")
+    })
+	public R delete(String id) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			lbtService.delete(id);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+}

+ 82 - 0
src/main/java/com/admin/lbt/LbtService.java

@@ -0,0 +1,82 @@
+package com.admin.lbt;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.pub.jdbc.BaseDAO;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import org.springframework.util.StringUtils;
+import java.sql.Timestamp;
+import com.pub.env.Environment;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2024-08-16 15:37:30
+ */
+@Service
+public class LbtService {
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	/**
+	 * 分页查询数据
+	 *@author znn
+	 *@date 2024-08-16 15:37:30
+	 *@param page
+	 *@param condtion
+	 *@description
+	 */
+	public PageRecord<LbtVO> queryLbtList(Page page, StringBuffer condition) {
+		if(StringUtils.isEmpty(page.getSort())){
+			page.setSort("create_time");
+			page.setOrder("desc");
+		}
+		return baseDAO.queryPaginateByCondition(LbtVO.class, condition.toString(), page.getRows(), page.getPage(),page.getSort()+" "+page.getOrder());
+	}
+
+	/**
+	 * 根据ID查询数据
+	 *@author znn
+	 *@date 2024-08-16 15:37:30
+	 *@param vo
+	 *@description
+	 */
+	public LbtVO getLbtById(LbtVO vo) {
+		return baseDAO.queryByPK(vo.getClass(), vo.getPrimaryKey());
+	}
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2024-08-16 15:37:30
+	 *@param vo
+	 *@description
+	 */
+	public void saveOrUpdate(LbtVO vo) {
+		if (!StringUtils.isEmpty(vo.getPrimaryKey())) {
+			baseDAO.update(vo);
+		} else {
+			baseDAO.insert(vo);
+		}
+	}
+	
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2024-08-16 15:37:30
+	 *@param id
+	 *@description
+	 */
+	public void delete(String id) {
+		String[] ids = id.split(",");
+		LbtVO[] vos = new LbtVO[ids.length];
+		for (int index = 0; index < vos.length; ++index) {
+			LbtVO vo = new LbtVO();
+			vo.setPrimaryKey(ids[index]);
+			vos[index] = vo;
+		}
+		baseDAO.deleteArray(vos);
+	}
+}

+ 47 - 0
src/main/java/com/admin/lbt/LbtVO.java

@@ -0,0 +1,47 @@
+package com.admin.lbt;
+
+import com.pub.jdbc.CommonVO;
+import com.pub.jdbc.CascadeMetadata;
+import java.sql.Timestamp;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Time;
+import java.math.BigDecimal;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * @author znn
+ * @date 2024-08-16 15:37:30
+ */
+@Data
+public class LbtVO extends CommonVO {
+	
+	/**
+	 * 字段列表(开发工具生成的字段和数据库字段一致)
+	 */
+	@ApiModelProperty(value="轮播图")
+	private String lbt;
+	@ApiModelProperty(value="跳转地址")
+	private String tzdz;
+	
+	
+	/**
+	 * 获得表名
+	 */
+	@Override
+	public String getTableName() {
+		return "tbl_lbt";
+	}
+	
+	/**
+	 * 获得关联子表的CascadeMetadata,没有直接null
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		return null;
+	}
+}

+ 58 - 0
src/main/java/com/admin/map/GroupDevMapVO.java

@@ -0,0 +1,58 @@
+package com.admin.map;
+
+import java.sql.Timestamp;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.pub.jdbc.CascadeMetadata;
+import com.pub.jdbc.SuperVO;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class GroupDevMapVO extends SuperVO{
+
+	/**
+	 * 字段列表(开发工具生成的字段和数据库字段一致)
+	 */
+	@ApiModelProperty(value="id")
+	private int id;
+	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss.zzz",timezone = "GMT+8")
+	@ApiModelProperty(value="创建时间")
+	private Timestamp create_time;
+	@ApiModelProperty(value="删除标记")
+	private int delete_tag;
+	@ApiModelProperty(value="删除时间")
+	private Timestamp delete_time;
+	@ApiModelProperty(value="更新时间")
+	private Timestamp update_time;
+	@ApiModelProperty(value="dev_group_index")
+	private int dev_group_index;
+	@ApiModelProperty(value="群组uuid")
+	private String group_uuid;
+	@ApiModelProperty(value="dev_info_index")
+	private int dev_info_index;
+	@ApiModelProperty(value="dev_id")
+	private String dev_id;
+	
+	/**
+	 * 获得表名
+	 */
+	@Override
+	public String getTableName() {
+		return "group_dev_map";
+	}
+	
+	/**
+	 * 获得关联子表的CascadeMetadata,没有直接null
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		return null;
+	}
+	
+	@Override
+	public String getPKFieldName() {
+		return "id";
+	}
+}

+ 250 - 0
src/main/java/com/admin/menu/MenuController.java

@@ -0,0 +1,250 @@
+package com.admin.menu;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.admin.role.RoleVO;
+import com.pub.constant.Constants;
+import com.pub.env.Environment;
+import com.pub.jdbc.BaseDAO;
+import com.pub.log.Log;
+import com.pub.page.Page;
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.annotations.ApiIgnore;
+
+/**
+ * 开发工具生成
+ * 
+ * @author znn
+ * @date 2022-12-09 17:39:15
+ */
+@Controller
+@RequestMapping("/menu")
+@Api(tags = "栏目菜单接口")
+public class MenuController {
+
+	@Autowired
+	private MenuService menuService;
+	@Autowired
+	private BaseDAO baseDAO;
+
+	/**
+	 * 根据ID获得数据
+	 * 
+	 * @author znn
+	 * @date 2022-12-09 17:39:15
+	 * @param vo
+	 * @description
+	 */
+	@ResponseBody
+	@GetMapping("/getMenuById")
+	@ApiOperation(value = "查询栏目菜单详情")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query") })
+	public R getMenuById(@ApiIgnore MenuVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		MenuVO menu = menuService.getMenuById(vo);
+		r.data.put("menu", menu);
+		return r;
+	}
+
+	/**
+	 * 获得列表数据
+	 * 
+	 * @author znn
+	 * @date 2022-12-09 17:39:15
+	 * @param page
+	 * @param vo
+	 * @description
+	 */
+	@ResponseBody
+	@GetMapping("/queryMenuList")
+	@ApiOperation(value = "查询栏目菜单列表")
+	public R queryMenuList() {
+		R r = JSONUtil.getSuccessMsg(null);
+		List<MenuVO> menus = new ArrayList<>();
+		if (Environment.isRoot()) {
+			menus = baseDAO.queryByCondition(MenuVO.class, null, " sort asc,create_time desc ");
+		} else {
+			List<RoleVO> roles = baseDAO.queryByCondition(RoleVO.class,
+					" and id in (select role_id from tbl_user_role where ifnull(dr,0)=0 and user_id='"
+							+ Environment.getUser().getId() + "') ",
+					null);
+			StringBuffer roleBuf = new StringBuffer();
+			for (RoleVO v : roles) {
+				roleBuf.append(v.getCdqx());
+			}
+			if (roleBuf.length() > 0) {
+				menus = baseDAO.queryByCondition(MenuVO.class,
+						" and id in ('" + roleBuf.substring(0, roleBuf.length() - 1).replaceAll(",", "','") + "') ",
+						" sort asc,create_time desc ");
+			}
+		}
+
+		for (MenuVO m : menus) {
+			if (StringUtils.isNotEmpty(m.getIcon())) {
+				m.setIcon(Constants.DOMAIN + Environment.COMMON_FILE_UPLOAD_PATH + m.getIcon());
+			}
+		}
+		List<MenuVO> rootMenus = new ArrayList<>();
+		List<MenuVO> childMenus = new ArrayList<>();
+		for (MenuVO org : menus) {
+			if (StringUtils.isEmpty(org.getParent_id())) {
+				rootMenus.add(org);
+			} else {
+				childMenus.add(org);
+			}
+		}
+		rootMenus.stream().map(item -> {
+			item.setChildren(getChildren(item, childMenus));
+			return item;
+		}).collect(Collectors.toList());
+		r.data.put("tree_data", rootMenus);
+		return r;
+	}
+	
+	
+	@ResponseBody
+	@GetMapping("/queryAbleMenuList")
+	@ApiOperation(value = "查询栏目菜单列表")
+	public R queryAbleMenuList() {
+		R r = JSONUtil.getSuccessMsg(null);
+		List<MenuVO> menus = new ArrayList<>();
+		if (Environment.isRoot()) {
+			menus = baseDAO.queryByCondition(MenuVO.class, " and is_display='1' ", " sort asc,create_time desc ");
+		} else {
+			List<RoleVO> roles = baseDAO.queryByCondition(RoleVO.class,
+					" and id in (select role_id from tbl_user_role where ifnull(dr,0)=0 and user_id='"
+							+ Environment.getUser().getId() + "') ",
+					null);
+			StringBuffer roleBuf = new StringBuffer();
+			for (RoleVO v : roles) {
+				roleBuf.append(v.getCdqx());
+			}
+			if (roleBuf.length() > 0) {
+				menus = baseDAO.queryByCondition(MenuVO.class,
+						"  and is_display='1'  and id in ('" + roleBuf.substring(0, roleBuf.length() - 1).replaceAll(",", "','") + "') ",
+						" sort asc,create_time desc ");
+			}
+		}
+
+		for (MenuVO m : menus) {
+			if (StringUtils.isNotEmpty(m.getIcon())) {
+				m.setIcon(Constants.DOMAIN + Environment.COMMON_FILE_UPLOAD_PATH + m.getIcon());
+			}
+		}
+		List<MenuVO> rootMenus = new ArrayList<>();
+		List<MenuVO> childMenus = new ArrayList<>();
+		for (MenuVO org : menus) {
+			if (StringUtils.isEmpty(org.getParent_id())) {
+				rootMenus.add(org);
+			} else {
+				childMenus.add(org);
+			}
+		}
+		rootMenus.stream().map(item -> {
+			item.setChildren(getChildren(item, childMenus));
+			return item;
+		}).collect(Collectors.toList());
+		r.data.put("tree_data", rootMenus);
+		return r;
+	}
+
+	public List<MenuVO> getChildren(MenuVO root, List<MenuVO> all) {
+		List<MenuVO> children = all.stream().filter(item -> item.getParent_id().equals(root.getId())).map((item) -> {
+			item.setChildren(getChildren(item, all));
+			return item;
+		}).collect(Collectors.toList());
+		return children;
+	}
+
+	@ResponseBody
+	@RequestMapping("/queryAllPageList")
+	public R queryAllPageList() {
+		R r = JSONUtil.getSuccessMsg(null);
+		List<MenuVO> menus = new ArrayList<>();
+		if (Environment.isRoot()) {
+			menus = baseDAO.queryByCondition(MenuVO.class, "  and ifnull(inner_url,'') !='' and is_display='1' ", null);
+		} else {
+			List<RoleVO> roles = baseDAO.queryByCondition(RoleVO.class,
+					" and id in (select role_id from tbl_user_role where ifnull(dr,0)=0 and user_id='"
+							+ Environment.getUser().getId() + "') ",
+					null);
+			StringBuffer roleBuf = new StringBuffer();
+			for (RoleVO v : roles) {
+				roleBuf.append(v.getCdqx());
+			}
+			if (roleBuf.length() > 0) {
+				menus = baseDAO.queryByCondition(MenuVO.class,
+						" and id in ('" + roleBuf.substring(0, roleBuf.length() - 1).replaceAll(",", "','")
+								+ "')  and ifnull(inner_url,'') !='' and is_display='1' ",
+						null);
+			}
+		}
+		r.data.put("pages", menus);
+		return r;
+	}
+
+	/**
+	 * 新增或编辑时进行保存
+	 * 
+	 * @author znn
+	 * @date 2022-12-09 17:39:15
+	 * @param vo
+	 * @description
+	 */
+	@ResponseBody
+	@PostMapping("/saveOrUpdate")
+	@ApiOperation(value = "保存或更新栏目菜单")
+	@ApiImplicitParam(name = "栏目菜单实体对象", value = "对应表:tbl_menu", required = true, dataType = "MenuVO")
+	public R saveOrUpdate(@ApiIgnore @RequestBody MenuVO vo) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			menuService.saveOrUpdate(vo);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+
+	/**
+	 * 批量删除数据
+	 * 
+	 * @author znn
+	 * @date 2022-12-09 17:39:15
+	 * @param id
+	 * @description
+	 */
+	@ResponseBody
+	@GetMapping("/delete")
+	@ApiOperation(value = "删除栏目菜单")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "id", value = "主键(多个以,号分隔)", dataType = "String", required = true, paramType = "query") })
+	public R delete(String id) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			menuService.delete(id);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+}

+ 84 - 0
src/main/java/com/admin/menu/MenuService.java

@@ -0,0 +1,84 @@
+package com.admin.menu;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.pub.jdbc.BaseDAO;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import org.springframework.util.StringUtils;
+import java.sql.Timestamp;
+import com.pub.env.Environment;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2022-12-09 17:39:15
+ */
+@Service
+public class MenuService {
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	/**
+	 * 分页查询数据
+	 *@author znn
+	 *@date 2022-12-09 17:39:15
+	 *@param page
+	 *@param condtion
+	 *@description
+	 */
+	public PageRecord<MenuVO> queryMenuList(Page page, StringBuffer condition) {
+		if(StringUtils.isEmpty(page.getSort())){
+			page.setSort("create_time");
+			page.setOrder("desc");
+		}
+		return baseDAO.queryPaginateByCondition(MenuVO.class, condition.toString(), page.getRows(), page.getPage(),page.getSort()+" "+page.getOrder());
+	}
+
+	/**
+	 * 根据ID查询数据
+	 *@author znn
+	 *@date 2022-12-09 17:39:15
+	 *@param vo
+	 *@description
+	 */
+	public MenuVO getMenuById(MenuVO vo) {
+		return baseDAO.queryByPK(vo.getClass(), vo.getPrimaryKey());
+	}
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2022-12-09 17:39:15
+	 *@param vo
+	 *@description
+	 */
+	public void saveOrUpdate(MenuVO vo) {
+		if (!StringUtils.isEmpty(vo.getPrimaryKey())) {
+			vo.setUpdate_time(new Timestamp(System.currentTimeMillis()));
+			vo.setUpdator(Environment.getUser().getId());
+			baseDAO.update(vo);
+		} else {
+			baseDAO.insert(vo);
+		}
+	}
+	
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2022-12-09 17:39:15
+	 *@param id
+	 *@description
+	 */
+	public void delete(String id) {
+		String[] ids = id.split(",");
+		MenuVO[] vos = new MenuVO[ids.length];
+		for (int index = 0; index < vos.length; ++index) {
+			MenuVO vo = new MenuVO();
+			vo.setPrimaryKey(ids[index]);
+			vos[index] = vo;
+		}
+		baseDAO.deleteArray(vos);
+	}
+}

+ 60 - 0
src/main/java/com/admin/menu/MenuVO.java

@@ -0,0 +1,60 @@
+package com.admin.menu;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.pub.jdbc.CascadeMetadata;
+import com.pub.jdbc.CommonVO;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * @author znn
+ * @date 2022-12-09 17:39:15
+ */
+@Data
+public class MenuVO extends CommonVO {
+	
+	/**
+	 * 字段列表(开发工具生成的字段和数据库字段一致)
+	 */
+	@ApiModelProperty(value="名称")
+	private String name;
+	@ApiModelProperty(value="排序")
+	private Integer sort;
+	@ApiModelProperty(value="父节点ID")
+	private String parent_id;
+	@ApiModelProperty(value="路由地址")
+	private String inner_url;
+	@ApiModelProperty(value="页面地址")
+	private String page_url;
+	@ApiModelProperty(value="是否显示")
+	private String is_display;
+	@ApiModelProperty(value="工作流的key")
+	private String process_key;
+	@ApiModelProperty(value="图标")
+	private String icon;
+	
+	
+	
+	
+	private List<MenuVO> children = new ArrayList<>();
+	
+	/**
+	 * 获得表名
+	 */
+	@Override
+	public String getTableName() {
+		return "tbl_menu";
+	}
+	
+	/**
+	 * 获得关联子表的CascadeMetadata,没有直接null
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		return null;
+	}
+}

+ 129 - 0
src/main/java/com/admin/oprLog/OprLogController.java

@@ -0,0 +1,129 @@
+package com.admin.oprLog;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import com.pub.log.Log;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+import com.pub.util.SQLUtil;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.annotations.ApiIgnore;
+
+/**
+ * 开发工具生成
+ * 
+ * @author znn
+ * @date 2022-12-09 17:29:50
+ */
+@Controller
+@RequestMapping("/oprLog")
+@Api(tags = "操作日志接口")
+public class OprLogController {
+
+	@Autowired
+	private OprLogService oprLogService;
+
+	/**
+	 * 根据ID获得数据
+	 * 
+	 * @author znn
+	 * @date 2022-12-09 17:29:50
+	 * @param vo
+	 * @description
+	 */
+	@ResponseBody
+	@GetMapping("/getOprLogById")
+	@ApiOperation(value = "查询操作日志详情")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query") })
+	public R getOprLogById(@ApiIgnore OprLogVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		OprLogVO oprLog = oprLogService.getOprLogById(vo);
+		r.data.put("oprLog", oprLog);
+		return r;
+	}
+
+	/**
+	 * 获得列表数据
+	 * 
+	 * @author znn
+	 * @date 2022-12-09 17:29:50
+	 * @param page
+	 * @param vo
+	 * @description
+	 */
+	@ResponseBody
+	@GetMapping("/queryOprLogList")
+	@ApiOperation(value = "查询操作日志列表")
+	@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query"),
+			@ApiImplicitParam(name = "page", value = "页码", dataType = "int", required = true, paramType = "query"),
+			@ApiImplicitParam(name = "rows", value = "每页条数", dataType = "int", required = true, paramType = "query"),
+			@ApiImplicitParam(name = "sort", value = "排序字段", dataType = "String", paramType = "query"),
+			@ApiImplicitParam(name = "order", value = "排序方式", dataType = "String", paramType = "query"), })
+	public R queryOprLogList(@ApiIgnore Page page, @ApiIgnore OprLogVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		StringBuffer condition = SQLUtil.getCondition(vo);
+		PageRecord<OprLogVO> pr = oprLogService.queryOprLogList(page, condition);
+		r.data.put("pr", pr);
+		return r;
+	}
+
+	/**
+	 * 新增或编辑时进行保存
+	 * 
+	 * @author znn
+	 * @date 2022-12-09 17:29:50
+	 * @param vo
+	 * @description
+	 */
+	@ResponseBody
+	@PostMapping("/saveOrUpdate")
+	@ApiOperation(value = "保存或更新操作日志")
+	@ApiImplicitParam(name = "操作日志实体对象", value = "对应表:tbl_opr_log", required = true, dataType = "OprLogVO")
+	public R saveOrUpdate(@ApiIgnore @RequestBody OprLogVO vo) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			oprLogService.saveOrUpdate(vo);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+
+	/**
+	 * 批量删除数据
+	 * 
+	 * @author znn
+	 * @date 2022-12-09 17:29:50
+	 * @param id
+	 * @description
+	 */
+	@ResponseBody
+	@GetMapping("/delete")
+	@ApiOperation(value = "删除操作日志")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "id", value = "主键(多个以,号分隔)", dataType = "String", required = true, paramType = "query") })
+	public R delete(String id) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			oprLogService.delete(id);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+}

+ 84 - 0
src/main/java/com/admin/oprLog/OprLogService.java

@@ -0,0 +1,84 @@
+package com.admin.oprLog;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.pub.jdbc.BaseDAO;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import org.springframework.util.StringUtils;
+import java.sql.Timestamp;
+import com.pub.env.Environment;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2022-12-09 17:29:50
+ */
+@Service
+public class OprLogService {
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	/**
+	 * 分页查询数据
+	 *@author znn
+	 *@date 2022-12-09 17:29:50
+	 *@param page
+	 *@param condtion
+	 *@description
+	 */
+	public PageRecord<OprLogVO> queryOprLogList(Page page, StringBuffer condition) {
+		if(StringUtils.isEmpty(page.getSort())){
+			page.setSort("create_time");
+			page.setOrder("desc");
+		}
+		return baseDAO.queryPaginateByCondition(OprLogVO.class, condition.toString(), page.getRows(), page.getPage(),page.getSort()+" "+page.getOrder());
+	}
+
+	/**
+	 * 根据ID查询数据
+	 *@author znn
+	 *@date 2022-12-09 17:29:50
+	 *@param vo
+	 *@description
+	 */
+	public OprLogVO getOprLogById(OprLogVO vo) {
+		return baseDAO.queryByPK(vo.getClass(), vo.getPrimaryKey());
+	}
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2022-12-09 17:29:50
+	 *@param vo
+	 *@description
+	 */
+	public void saveOrUpdate(OprLogVO vo) {
+		if (!StringUtils.isEmpty(vo.getPrimaryKey())) {
+			vo.setUpdate_time(new Timestamp(System.currentTimeMillis()));
+			vo.setUpdator(Environment.getUser().getId());
+			baseDAO.update(vo);
+		} else {
+			baseDAO.insert(vo);
+		}
+	}
+	
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2022-12-09 17:29:50
+	 *@param id
+	 *@description
+	 */
+	public void delete(String id) {
+		String[] ids = id.split(",");
+		OprLogVO[] vos = new OprLogVO[ids.length];
+		for (int index = 0; index < vos.length; ++index) {
+			OprLogVO vo = new OprLogVO();
+			vo.setPrimaryKey(ids[index]);
+			vos[index] = vo;
+		}
+		baseDAO.deleteArray(vos);
+	}
+}

+ 49 - 0
src/main/java/com/admin/oprLog/OprLogVO.java

@@ -0,0 +1,49 @@
+package com.admin.oprLog;
+
+import com.pub.jdbc.CommonVO;
+import com.pub.jdbc.CascadeMetadata;
+import java.sql.Timestamp;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Time;
+import java.math.BigDecimal;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * @author znn
+ * @date 2022-12-09 17:29:50
+ */
+@Data
+public class OprLogVO extends CommonVO {
+	
+	/**
+	 * 字段列表(开发工具生成的字段和数据库字段一致)
+	 */
+	@ApiModelProperty(value="操作人")
+	private String czr;
+	@ApiModelProperty(value="类名")
+	private String lm;
+	@ApiModelProperty(value="方法名")
+	private String ffm;
+	
+	
+	/**
+	 * 获得表名
+	 */
+	@Override
+	public String getTableName() {
+		return "tbl_opr_log";
+	}
+	
+	/**
+	 * 获得关联子表的CascadeMetadata,没有直接null
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		return null;
+	}
+}

+ 168 - 0
src/main/java/com/admin/org/OrgController.java

@@ -0,0 +1,168 @@
+package com.admin.org;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.admin.role.RoleVO;
+import com.admin.user.UserVO;
+import com.pub.env.Environment;
+import com.pub.jdbc.BaseDAO;
+import com.pub.listener.SpringContext;
+import com.pub.log.Log;
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+import com.pub.util.SQLUtil;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.annotations.ApiIgnore;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2022-12-08 19:06:55
+ */
+@Controller
+@RequestMapping("/org")
+@Api(tags = "组织机构接口")
+public class OrgController {
+
+	@Autowired
+	private OrgService orgService;
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	
+	
+	
+	/**
+	 * 根据ID获得数据
+	 *@author znn
+	 *@date 2022-12-08 19:06:55
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/getOrgById")
+	@ApiOperation(value = "查询组织机构详情")
+    @ApiImplicitParams({
+    	@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query")
+    })
+	public R getOrgById(@ApiIgnore OrgVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		OrgVO org = orgService.getOrgById(vo);
+		r.data.put("org", org);
+		return r;
+	}
+	
+	/**
+	 * 获得列表数据
+	 *@author znn
+	 *@date 2022-12-08 19:06:55
+	 *@param page
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/queryOrgTree")
+	@ApiOperation(value = "查询组织机构列表")
+    @ApiImplicitParams({
+    	@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query"),
+        @ApiImplicitParam(name = "page", value = "页码", dataType = "int", required = true, paramType = "query"),
+        @ApiImplicitParam(name = "rows", value = "每页条数", dataType = "int", required = true, paramType = "query"),
+        @ApiImplicitParam(name = "sort", value = "排序字段", dataType = "String", paramType = "query"),
+        @ApiImplicitParam(name = "order", value = "排序方式", dataType = "String", paramType = "query"),
+    })
+	public R queryOrgList(@ApiIgnore OrgVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		StringBuffer sqlBuf = SQLUtil.getDataPowSQL(null);
+		List<OrgVO> orgs = baseDAO.queryByCondition(OrgVO.class, sqlBuf.toString(), " create_time desc ");
+		List<OrgVO> rootOrgs = new ArrayList<>();
+		List<OrgVO> childOrgs = new ArrayList<>();
+		for (OrgVO org : orgs) {
+			if (StringUtils.isEmpty(org.getParent_id())) {
+				rootOrgs.add(org);
+			}else {
+				childOrgs.add(org);
+			}
+		}
+		rootOrgs.stream()
+                .map(item -> {
+                    item.setChildren(getChildren(item, childOrgs));
+                    return item;
+                })
+                .collect(Collectors.toList());
+		r.data.put("tree_data", rootOrgs);
+		return r;
+	}
+	
+	public List<OrgVO> getChildren(OrgVO root, List<OrgVO> all) {
+        List<OrgVO> children = all.stream()
+                .filter(item -> item.getParent_id().equals(root.getId()))
+                .map((item) -> {
+                    item.setChildren(getChildren(item, all));
+                    return item;
+                }).collect(Collectors.toList());
+        return children;
+    }
+	
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2022-12-08 19:06:55
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@PostMapping("/saveOrUpdate")
+	@ApiOperation(value = "保存或更新组织机构")
+	@ApiImplicitParam(name = "组织机构实体对象", value = "对应表:tbl_org", required = true, dataType = "OrgVO")
+	public R saveOrUpdate(@ApiIgnore @RequestBody OrgVO vo) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			orgService.saveOrUpdate(vo);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2022-12-08 19:06:55
+	 *@param id
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/delete")
+	@ApiOperation(value = "删除组织机构")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "id", value = "主键(多个以,号分隔)", dataType = "String", required = true, paramType = "query")
+    })
+	public R delete(String id) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			orgService.delete(id);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+}

+ 84 - 0
src/main/java/com/admin/org/OrgService.java

@@ -0,0 +1,84 @@
+package com.admin.org;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.pub.jdbc.BaseDAO;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import org.springframework.util.StringUtils;
+import java.sql.Timestamp;
+import com.pub.env.Environment;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2022-12-08 19:06:55
+ */
+@Service
+public class OrgService {
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	/**
+	 * 分页查询数据
+	 *@author znn
+	 *@date 2022-12-08 19:06:55
+	 *@param page
+	 *@param condtion
+	 *@description
+	 */
+	public PageRecord<OrgVO> queryOrgList(Page page, StringBuffer condition) {
+		if(StringUtils.isEmpty(page.getSort())){
+			page.setSort("create_time");
+			page.setOrder("desc");
+		}
+		return baseDAO.queryPaginateByCondition(OrgVO.class, condition.toString(), page.getRows(), page.getPage(),page.getSort()+" "+page.getOrder());
+	}
+
+	/**
+	 * 根据ID查询数据
+	 *@author znn
+	 *@date 2022-12-08 19:06:55
+	 *@param vo
+	 *@description
+	 */
+	public OrgVO getOrgById(OrgVO vo) {
+		return baseDAO.queryByPK(vo.getClass(), vo.getPrimaryKey());
+	}
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2022-12-08 19:06:55
+	 *@param vo
+	 *@description
+	 */
+	public void saveOrUpdate(OrgVO vo) {
+		if (!StringUtils.isEmpty(vo.getPrimaryKey())) {
+			vo.setUpdate_time(new Timestamp(System.currentTimeMillis()));
+			vo.setUpdator(Environment.getUser().getId());
+			baseDAO.update(vo);
+		} else {
+			baseDAO.insert(vo);
+		}
+	}
+	
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2022-12-08 19:06:55
+	 *@param id
+	 *@description
+	 */
+	public void delete(String id) {
+		String[] ids = id.split(",");
+		OrgVO[] vos = new OrgVO[ids.length];
+		for (int index = 0; index < vos.length; ++index) {
+			OrgVO vo = new OrgVO();
+			vo.setPrimaryKey(ids[index]);
+			vos[index] = vo;
+		}
+		baseDAO.deleteArray(vos);
+	}
+}

+ 55 - 0
src/main/java/com/admin/org/OrgVO.java

@@ -0,0 +1,55 @@
+package com.admin.org;
+
+import com.pub.jdbc.CommonVO;
+import com.pub.jdbc.CascadeMetadata;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Time;
+import java.math.BigDecimal;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * @author znn
+ * @date 2022-12-08 19:06:55
+ */
+@Data
+public class OrgVO extends CommonVO {
+	
+	/**
+	 * 字段列表(开发工具生成的字段和数据库字段一致)
+	 */
+	@ApiModelProperty(value="父节点ID")
+	private String parent_id;
+	@ApiModelProperty(value="机构名称")
+	private String name;
+	@ApiModelProperty(value="机构描述")
+	private String description;
+	
+	
+	
+	private List<OrgVO> children = new ArrayList<>();
+	
+	/**
+	 * 获得表名
+	 */
+	@Override
+	public String getTableName() {
+		return "tbl_org";
+	}
+	
+	/**
+	 * 获得关联子表的CascadeMetadata,没有直接null
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		return null;
+	}
+}

+ 129 - 0
src/main/java/com/admin/parameter/ParameterController.java

@@ -0,0 +1,129 @@
+package com.admin.parameter;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import com.pub.log.Log;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+import com.pub.util.SQLUtil;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.annotations.ApiIgnore;
+
+/**
+ * 开发工具生成
+ * 
+ * @author znn
+ * @date 2022-12-09 17:30:09
+ */
+@Controller
+@RequestMapping("/parameter")
+@Api(tags = "参数管理接口")
+public class ParameterController {
+
+	@Autowired
+	private ParameterService parameterService;
+
+	/**
+	 * 根据ID获得数据
+	 * 
+	 * @author znn
+	 * @date 2022-12-09 17:30:09
+	 * @param vo
+	 * @description
+	 */
+	@ResponseBody
+	@GetMapping("/getParameterById")
+	@ApiOperation(value = "查询参数管理详情")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query") })
+	public R getParameterById(@ApiIgnore ParameterVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		ParameterVO parameter = parameterService.getParameterById(vo);
+		r.data.put("parameter", parameter);
+		return r;
+	}
+
+	/**
+	 * 获得列表数据
+	 * 
+	 * @author znn
+	 * @date 2022-12-09 17:30:09
+	 * @param page
+	 * @param vo
+	 * @description
+	 */
+	@ResponseBody
+	@GetMapping("/queryParameterList")
+	@ApiOperation(value = "查询参数管理列表")
+	@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query"),
+			@ApiImplicitParam(name = "page", value = "页码", dataType = "int", required = true, paramType = "query"),
+			@ApiImplicitParam(name = "rows", value = "每页条数", dataType = "int", required = true, paramType = "query"),
+			@ApiImplicitParam(name = "sort", value = "排序字段", dataType = "String", paramType = "query"),
+			@ApiImplicitParam(name = "order", value = "排序方式", dataType = "String", paramType = "query"), })
+	public R queryParameterList(@ApiIgnore Page page, @ApiIgnore ParameterVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		StringBuffer condition = SQLUtil.getCondition(vo);
+		PageRecord<ParameterVO> pr = parameterService.queryParameterList(page, condition);
+		r.data.put("pr", pr);
+		return r;
+	}
+
+	/**
+	 * 新增或编辑时进行保存
+	 * 
+	 * @author znn
+	 * @date 2022-12-09 17:30:09
+	 * @param vo
+	 * @description
+	 */
+	@ResponseBody
+	@PostMapping("/saveOrUpdate")
+	@ApiOperation(value = "保存或更新参数管理")
+	@ApiImplicitParam(name = "参数管理实体对象", value = "对应表:tbl_parameter", required = true, dataType = "ParameterVO")
+	public R saveOrUpdate(@ApiIgnore @RequestBody ParameterVO vo) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			parameterService.saveOrUpdate(vo);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+
+	/**
+	 * 批量删除数据
+	 * 
+	 * @author znn
+	 * @date 2022-12-09 17:30:09
+	 * @param id
+	 * @description
+	 */
+	@ResponseBody
+	@GetMapping("/delete")
+	@ApiOperation(value = "删除参数管理")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "id", value = "主键(多个以,号分隔)", dataType = "String", required = true, paramType = "query") })
+	public R delete(String id) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			parameterService.delete(id);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+}

+ 84 - 0
src/main/java/com/admin/parameter/ParameterService.java

@@ -0,0 +1,84 @@
+package com.admin.parameter;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.pub.jdbc.BaseDAO;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import org.springframework.util.StringUtils;
+import java.sql.Timestamp;
+import com.pub.env.Environment;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2022-12-09 17:30:09
+ */
+@Service
+public class ParameterService {
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	/**
+	 * 分页查询数据
+	 *@author znn
+	 *@date 2022-12-09 17:30:09
+	 *@param page
+	 *@param condtion
+	 *@description
+	 */
+	public PageRecord<ParameterVO> queryParameterList(Page page, StringBuffer condition) {
+		if(StringUtils.isEmpty(page.getSort())){
+			page.setSort("create_time");
+			page.setOrder("desc");
+		}
+		return baseDAO.queryPaginateByCondition(ParameterVO.class, condition.toString(), page.getRows(), page.getPage(),page.getSort()+" "+page.getOrder());
+	}
+
+	/**
+	 * 根据ID查询数据
+	 *@author znn
+	 *@date 2022-12-09 17:30:09
+	 *@param vo
+	 *@description
+	 */
+	public ParameterVO getParameterById(ParameterVO vo) {
+		return baseDAO.queryByPK(vo.getClass(), vo.getPrimaryKey());
+	}
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2022-12-09 17:30:09
+	 *@param vo
+	 *@description
+	 */
+	public void saveOrUpdate(ParameterVO vo) {
+		if (!StringUtils.isEmpty(vo.getPrimaryKey())) {
+			vo.setUpdate_time(new Timestamp(System.currentTimeMillis()));
+			vo.setUpdator(Environment.getUser().getId());
+			baseDAO.update(vo);
+		} else {
+			baseDAO.insert(vo);
+		}
+	}
+	
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2022-12-09 17:30:09
+	 *@param id
+	 *@description
+	 */
+	public void delete(String id) {
+		String[] ids = id.split(",");
+		ParameterVO[] vos = new ParameterVO[ids.length];
+		for (int index = 0; index < vos.length; ++index) {
+			ParameterVO vo = new ParameterVO();
+			vo.setPrimaryKey(ids[index]);
+			vos[index] = vo;
+		}
+		baseDAO.deleteArray(vos);
+	}
+}

+ 47 - 0
src/main/java/com/admin/parameter/ParameterVO.java

@@ -0,0 +1,47 @@
+package com.admin.parameter;
+
+import com.pub.jdbc.CommonVO;
+import com.pub.jdbc.CascadeMetadata;
+import java.sql.Timestamp;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Time;
+import java.math.BigDecimal;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * @author znn
+ * @date 2022-12-09 17:30:09
+ */
+@Data
+public class ParameterVO extends CommonVO {
+	
+	/**
+	 * 字段列表(开发工具生成的字段和数据库字段一致)
+	 */
+	@ApiModelProperty(value="参数名")
+	private String parameter_name;
+	@ApiModelProperty(value="参数值")
+	private String parameter_value;
+	
+	
+	/**
+	 * 获得表名
+	 */
+	@Override
+	public String getTableName() {
+		return "tbl_parameter";
+	}
+	
+	/**
+	 * 获得关联子表的CascadeMetadata,没有直接null
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		return null;
+	}
+}

+ 130 - 0
src/main/java/com/admin/role/RoleController.java

@@ -0,0 +1,130 @@
+package com.admin.role;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import com.pub.log.Log;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+import com.pub.util.SQLUtil;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.annotations.ApiIgnore;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2022-12-08 18:44:04
+ */
+@Controller
+@RequestMapping("/role")
+@Api(tags = "角色接口")
+public class RoleController {
+
+	@Autowired
+	private RoleService roleService;
+	
+	/**
+	 * 根据ID获得数据
+	 *@author znn
+	 *@date 2022-12-08 18:44:04
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/getRoleById")
+	@ApiOperation(value = "查询角色详情")
+    @ApiImplicitParams({
+    	@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query")
+    })
+	public R getRoleById(@ApiIgnore RoleVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		RoleVO role = roleService.getRoleById(vo);
+		r.data.put("role", role);
+		return r;
+	}
+	
+	/**
+	 * 获得列表数据
+	 *@author znn
+	 *@date 2022-12-08 18:44:04
+	 *@param page
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/queryRoleList")
+	@ApiOperation(value = "查询角色列表")
+    @ApiImplicitParams({
+    	@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query"),
+        @ApiImplicitParam(name = "page", value = "页码", dataType = "int", required = true, paramType = "query"),
+        @ApiImplicitParam(name = "rows", value = "每页条数", dataType = "int", required = true, paramType = "query"),
+        @ApiImplicitParam(name = "sort", value = "排序字段", dataType = "String", paramType = "query"),
+        @ApiImplicitParam(name = "order", value = "排序方式", dataType = "String", paramType = "query"),
+    })
+	public R queryRoleList(@ApiIgnore Page page,@ApiIgnore RoleVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		StringBuffer condition = SQLUtil.getCondition(vo);
+		PageRecord<RoleVO> pr = roleService.queryRoleList(page, condition);
+		r.data.put("pr", pr);
+		return r;
+	}
+	
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2022-12-08 18:44:04
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@PostMapping("/saveOrUpdate")
+	@ApiOperation(value = "保存或更新角色")
+	@ApiImplicitParam(name = "角色实体对象", value = "对应表:tbl_role", required = true, dataType = "RoleVO")
+	public R saveOrUpdate(@ApiIgnore @RequestBody RoleVO vo) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			roleService.saveOrUpdate(vo);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2022-12-08 18:44:04
+	 *@param id
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/delete")
+	@ApiOperation(value = "删除角色")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "id", value = "主键(多个以,号分隔)", dataType = "String", required = true, paramType = "query")
+    })
+	public R delete(String id) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			roleService.delete(id);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+}

+ 84 - 0
src/main/java/com/admin/role/RoleService.java

@@ -0,0 +1,84 @@
+package com.admin.role;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.pub.jdbc.BaseDAO;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import org.springframework.util.StringUtils;
+import java.sql.Timestamp;
+import com.pub.env.Environment;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2022-12-08 18:44:04
+ */
+@Service
+public class RoleService {
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	/**
+	 * 分页查询数据
+	 *@author znn
+	 *@date 2022-12-08 18:44:04
+	 *@param page
+	 *@param condtion
+	 *@description
+	 */
+	public PageRecord<RoleVO> queryRoleList(Page page, StringBuffer condition) {
+		if(StringUtils.isEmpty(page.getSort())){
+			page.setSort("create_time");
+			page.setOrder("desc");
+		}
+		return baseDAO.queryPaginateByCondition(RoleVO.class, condition.toString(), page.getRows(), page.getPage(),page.getSort()+" "+page.getOrder());
+	}
+
+	/**
+	 * 根据ID查询数据
+	 *@author znn
+	 *@date 2022-12-08 18:44:04
+	 *@param vo
+	 *@description
+	 */
+	public RoleVO getRoleById(RoleVO vo) {
+		return baseDAO.queryByPK(vo.getClass(), vo.getPrimaryKey());
+	}
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2022-12-08 18:44:04
+	 *@param vo
+	 *@description
+	 */
+	public void saveOrUpdate(RoleVO vo) {
+		if (!StringUtils.isEmpty(vo.getPrimaryKey())) {
+			vo.setUpdate_time(new Timestamp(System.currentTimeMillis()));
+			vo.setUpdator(Environment.getUser().getId());
+			baseDAO.update(vo);
+		} else {
+			baseDAO.insert(vo);
+		}
+	}
+	
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2022-12-08 18:44:04
+	 *@param id
+	 *@description
+	 */
+	public void delete(String id) {
+		String[] ids = id.split(",");
+		RoleVO[] vos = new RoleVO[ids.length];
+		for (int index = 0; index < vos.length; ++index) {
+			RoleVO vo = new RoleVO();
+			vo.setPrimaryKey(ids[index]);
+			vos[index] = vo;
+		}
+		baseDAO.deleteArray(vos);
+	}
+}

+ 51 - 0
src/main/java/com/admin/role/RoleVO.java

@@ -0,0 +1,51 @@
+package com.admin.role;
+
+import com.pub.jdbc.CommonVO;
+import com.pub.jdbc.CascadeMetadata;
+import java.sql.Timestamp;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Time;
+import java.math.BigDecimal;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * @author znn
+ * @date 2022-12-08 18:44:04
+ */
+@Data
+public class RoleVO extends CommonVO {
+	
+	/**
+	 * 字段列表(开发工具生成的字段和数据库字段一致)
+	 */
+	@ApiModelProperty(value="名称")
+	private String name;
+	@ApiModelProperty(value="数据权限")
+	private String sjqx;
+	@ApiModelProperty(value="按钮权限")
+	private String anqx;
+	@ApiModelProperty(value="菜单权限")
+	private String cdqx;
+	
+	
+	/**
+	 * 获得表名
+	 */
+	@Override
+	public String getTableName() {
+		return "tbl_role";
+	}
+	
+	/**
+	 * 获得关联子表的CascadeMetadata,没有直接null
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		return null;
+	}
+}

+ 289 - 0
src/main/java/com/admin/sb/SbController.java

@@ -0,0 +1,289 @@
+package com.admin.sb;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.UUID;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.admin.sbgj.SbgjVO;
+import com.google.common.collect.Lists;
+import com.pub.excel.WriteExcelInterface;
+import com.pub.jdbc.BaseDAO;
+import com.pub.log.Log;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import com.pub.util.CommandUtil;
+import com.pub.util.ExcelUtil;
+import com.pub.util.ForeignKeyUtil;
+import com.pub.util.ImageUtil;
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+import com.pub.util.SQLUtil;
+import com.pub.util.ZipUtil;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.annotations.ApiIgnore;
+
+/**
+ * 开发工具生成
+ * 
+ * @author znn
+ * @date 2024-08-16 15:07:33
+ */
+@Controller
+@RequestMapping("/sb")
+@Api(tags = "设备接口")
+public class SbController {
+
+	@Autowired
+	private SbService sbService;
+	@Autowired
+	private BaseDAO baseDAO;
+
+	/**
+	 * 根据ID获得数据
+	 * 
+	 * @author znn
+	 * @date 2024-08-16 15:07:33
+	 * @param vo
+	 * @description
+	 */
+	@ResponseBody
+	@GetMapping("/getSbById")
+	@ApiOperation(value = "查询设备详情")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query") })
+	public R getSbById(@ApiIgnore SbVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		SbVO sb = sbService.getSbById(vo);
+		r.data.put("sb", sb);
+		return r;
+	}
+
+	/**
+	 * 获得列表数据
+	 * 
+	 * @author znn
+	 * @date 2024-08-16 15:07:33
+	 * @param page
+	 * @param vo
+	 * @description
+	 */
+	@ResponseBody
+	@GetMapping("/querySbList")
+	@ApiOperation(value = "查询设备列表")
+	@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query"),
+			@ApiImplicitParam(name = "page", value = "页码", dataType = "int", required = true, paramType = "query"),
+			@ApiImplicitParam(name = "rows", value = "每页条数", dataType = "int", required = true, paramType = "query"),
+			@ApiImplicitParam(name = "sort", value = "排序字段", dataType = "String", paramType = "query"),
+			@ApiImplicitParam(name = "order", value = "排序方式", dataType = "String", paramType = "query"), })
+	public R querySbList(@ApiIgnore Page page, @ApiIgnore SbVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		StringBuffer condition = SQLUtil.getCondition(vo);
+		PageRecord<SbVO> pr = sbService.querySbList(page, condition);
+		ForeignKeyUtil.processForeignKey(pr.getRows(), "tbl_hy", "hy_id", new String[] { "sjhm" },
+				new String[] { "hy_id" });
+		r.data.put("pr", pr);
+		return r;
+	}
+
+	/**
+	 * 新增或编辑时进行保存
+	 * 
+	 * @author znn
+	 * @date 2024-08-16 15:07:33
+	 * @param vo
+	 * @description
+	 */
+	@ResponseBody
+	@PostMapping("/saveOrUpdate")
+	@ApiOperation(value = "保存或更新设备")
+	@ApiImplicitParam(name = "设备实体对象", value = "对应表:tbl_sb", required = true, dataType = "SbVO")
+	public R saveOrUpdate(@ApiIgnore @RequestBody SbVO vo) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			sbService.saveOrUpdate(vo);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+
+	/**
+	 * 批量删除数据
+	 * 
+	 * @author znn
+	 * @date 2024-08-16 15:07:33
+	 * @param id
+	 * @description
+	 */
+	@ResponseBody
+	@GetMapping("/delete")
+	@ApiOperation(value = "删除设备")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "id", value = "主键(多个以,号分隔)", dataType = "String", required = true, paramType = "query") })
+	public R delete(String id) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			sbService.delete(id);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+
+	@GetMapping("/scewm")
+	public void scewm(String id, HttpServletResponse resp) {
+		try {
+			String srcPath = "/mnt/zip/" + UUID.randomUUID().toString();
+			String zipPath = "/mnt/zip/" + UUID.randomUUID().toString();
+			File srcFile = new File(srcPath);
+			File zipFile = new File(zipPath);
+			if (!srcFile.exists()) {
+				srcFile.mkdirs();
+			}
+			if (!zipFile.exists()) {
+				zipFile.mkdirs();
+			}
+			if (!StringUtils.isEmpty(id)) {
+				String[] ids = id.split(",");
+				List<SbVO> sbs = baseDAO.queryByPks(SbVO.class, ids);
+				// String logo_path = "/mnt/zip/logo.jpg";
+				for (SbVO l : sbs) {
+					ImageUtil.createQRToFile(l.getBh(), srcPath + File.separator + l.getBh() + ".png", null, true,
+							l.getBh());
+				}
+				ZipUtil.zip(srcPath, zipPath, "qr.zip");
+			}
+			File file = new File(zipPath + File.separator + "qr.zip");
+			if (file.exists()) {
+				InputStream input = new FileInputStream(file);
+				byte[] bytes = new byte[input.available()];
+				input.read(bytes);
+				OutputStream outputStream = resp.getOutputStream();
+				outputStream.write(bytes);
+				outputStream.flush();
+				input.close();
+			}
+			FileUtils.deleteDirectory(srcFile);
+			FileUtils.deleteDirectory(zipFile);
+		} catch (Exception e) {
+			// TODO: handle exception
+			Log.error("生成二维码", e);
+		}
+
+	}
+
+	@GetMapping("/dcgjsj")
+	public void dcgjsj(String id, HttpServletResponse resp) {
+		try {
+			List<SbgjVO> gjs = baseDAO.queryByCondition(SbgjVO.class, " and sb_id='" + id + "' ", " create_time desc ");
+			List<String[]> metadata = Lists.newArrayList();
+			metadata.add(new String[] { "姿态", "zt" });
+			metadata.add(new String[] { "x坐标", "xzb" });
+			metadata.add(new String[] { "y坐标", "yzb" });
+			metadata.add(new String[] { "z坐标", "zzb" });
+			metadata.add(new String[] { "事件类型", "sjlx" });
+			metadata.add(new String[] { "时间", "create_time" });
+			HSSFWorkbook workbook = ExcelUtil.writeToExcel(metadata, gjs, new WriteExcelInterface() {
+
+				@Override
+				public String processData(String field, String value, Object rowData) {
+					if (field.equals("zt")) {
+						if (value.equals("0")) {
+							value = "躺";
+						}
+						if (value.equals("1")) {
+							value = "坐在椅子上";
+						}
+						if (value.equals("2")) {
+							value = "坐在地上";
+						}
+						if (value.equals("3")) {
+							value = "蹲";
+						}
+						if (value.equals("4")) {
+							value = "站";
+						}
+						if (value.equals("5")) {
+							value = "坐";
+						}
+						if (value.equals("6")) {
+							value = "躺在沙发上";
+						}
+						if (value.equals("7")) {
+							value = "躺在其他";
+						}
+					}
+					if (field.equals("sjlx")) {
+						if (value.equals("0")) {
+							value = "设备状态变更";
+						}
+						if (value.equals("1")) {
+							value = "实时点云数据";
+						}
+						if (value.equals("2")) {
+							value = "实时目标位置";
+						}
+						if (value.equals("2")) {
+							value = "跌倒事件";
+						}
+					}
+					return value;
+				}
+			});
+			OutputStream outputStream = resp.getOutputStream();
+			workbook.write(outputStream);
+			outputStream.flush();
+			workbook.close();
+		} catch (Exception e) {
+			// TODO: handle exception
+			Log.error("导出轨迹", e);
+		}
+
+	}
+
+	@ResponseBody
+	@GetMapping("/xfcs")
+	public R xfcs(String id,String lx, String sj) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			SbVO sb = baseDAO.queryByPK(SbVO.class, id);
+			if (lx.equals("0")) {
+				String[] arr = sj.split(",");
+				CommandUtil.sendJcqy(sb.getBh(), new BigDecimal(arr[0]), new BigDecimal(arr[1]), new BigDecimal(arr[2]), new BigDecimal(arr[3]));
+			}
+			if (lx.equals("1")) {
+				CommandUtil.sendAzgd(sb.getBh(), new BigDecimal(sj));
+			}
+			if (lx.equals("2")) {
+				CommandUtil.sendLmd(sb.getBh(), new BigDecimal(sj));
+			}
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+}

+ 82 - 0
src/main/java/com/admin/sb/SbService.java

@@ -0,0 +1,82 @@
+package com.admin.sb;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.pub.jdbc.BaseDAO;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import org.springframework.util.StringUtils;
+import java.sql.Timestamp;
+import com.pub.env.Environment;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2024-08-16 15:07:33
+ */
+@Service
+public class SbService {
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	/**
+	 * 分页查询数据
+	 *@author znn
+	 *@date 2024-08-16 15:07:33
+	 *@param page
+	 *@param condtion
+	 *@description
+	 */
+	public PageRecord<SbVO> querySbList(Page page, StringBuffer condition) {
+		if(StringUtils.isEmpty(page.getSort())){
+			page.setSort("create_time");
+			page.setOrder("desc");
+		}
+		return baseDAO.queryPaginateByCondition(SbVO.class, condition.toString(), page.getRows(), page.getPage(),page.getSort()+" "+page.getOrder());
+	}
+
+	/**
+	 * 根据ID查询数据
+	 *@author znn
+	 *@date 2024-08-16 15:07:33
+	 *@param vo
+	 *@description
+	 */
+	public SbVO getSbById(SbVO vo) {
+		return baseDAO.queryByPK(vo.getClass(), vo.getPrimaryKey());
+	}
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2024-08-16 15:07:33
+	 *@param vo
+	 *@description
+	 */
+	public void saveOrUpdate(SbVO vo) {
+		if (!StringUtils.isEmpty(vo.getPrimaryKey())) {
+			baseDAO.update(vo);
+		} else {
+			baseDAO.insert(vo);
+		}
+	}
+	
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2024-08-16 15:07:33
+	 *@param id
+	 *@description
+	 */
+	public void delete(String id) {
+		String[] ids = id.split(",");
+		SbVO[] vos = new SbVO[ids.length];
+		for (int index = 0; index < vos.length; ++index) {
+			SbVO vo = new SbVO();
+			vo.setPrimaryKey(ids[index]);
+			vos[index] = vo;
+		}
+		baseDAO.deleteArray(vos);
+	}
+}

+ 72 - 0
src/main/java/com/admin/sb/SbVO.java

@@ -0,0 +1,72 @@
+package com.admin.sb;
+
+import com.pub.jdbc.CommonVO;
+import com.pub.jdbc.CascadeMetadata;
+import java.sql.Timestamp;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Time;
+import java.math.BigDecimal;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * @author znn
+ * @date 2024-08-16 15:07:33
+ */
+@Data
+public class SbVO extends CommonVO {
+	
+	/**
+	 * 字段列表(开发工具生成的字段和数据库字段一致)
+	 */
+	@ApiModelProperty(value="编号")
+	private String bh;
+	@ApiModelProperty(value="姿态")
+	private Integer zt;
+	@ApiModelProperty(value="会员")
+	private String hy_id;
+	@ApiModelProperty(value="名称")
+	private String mc;
+	@ApiModelProperty(value="长度")
+	private BigDecimal cd;
+	@ApiModelProperty(value="宽度")
+	private BigDecimal kd;
+	@ApiModelProperty(value="安装高度")
+	private BigDecimal azgd;
+	@ApiModelProperty(value="x坐标")
+	private BigDecimal xzb;
+	@ApiModelProperty(value="y坐标")
+	private BigDecimal yzb;
+	@ApiModelProperty(value="离线")
+	private Integer lx;
+	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+	@ApiModelProperty(value="绑定时间")
+	private Timestamp bdsj;
+	private Integer sjlx;
+	private BigDecimal zzb;
+	private Timestamp sign_time;
+	private String dev_id;
+	
+	
+	
+	
+	/**
+	 * 获得表名
+	 */
+	@Override
+	public String getTableName() {
+		return "tbl_sb";
+	}
+	
+	/**
+	 * 获得关联子表的CascadeMetadata,没有直接null
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		return null;
+	}
+}

+ 130 - 0
src/main/java/com/admin/sbgj/SbgjController.java

@@ -0,0 +1,130 @@
+package com.admin.sbgj;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import com.pub.log.Log;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+import com.pub.util.SQLUtil;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.annotations.ApiIgnore;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2024-08-22 13:45:35
+ */
+@Controller
+@RequestMapping("/sbgj")
+@Api(tags = "设备轨迹接口")
+public class SbgjController {
+
+	@Autowired
+	private SbgjService sbgjService;
+	
+	/**
+	 * 根据ID获得数据
+	 *@author znn
+	 *@date 2024-08-22 13:45:35
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/getSbgjById")
+	@ApiOperation(value = "查询设备轨迹详情")
+    @ApiImplicitParams({
+    	@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query")
+    })
+	public R getSbgjById(@ApiIgnore SbgjVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		SbgjVO sbgj = sbgjService.getSbgjById(vo);
+		r.data.put("sbgj", sbgj);
+		return r;
+	}
+	
+	/**
+	 * 获得列表数据
+	 *@author znn
+	 *@date 2024-08-22 13:45:35
+	 *@param page
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/querySbgjList")
+	@ApiOperation(value = "查询设备轨迹列表")
+    @ApiImplicitParams({
+    	@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query"),
+        @ApiImplicitParam(name = "page", value = "页码", dataType = "int", required = true, paramType = "query"),
+        @ApiImplicitParam(name = "rows", value = "每页条数", dataType = "int", required = true, paramType = "query"),
+        @ApiImplicitParam(name = "sort", value = "排序字段", dataType = "String", paramType = "query"),
+        @ApiImplicitParam(name = "order", value = "排序方式", dataType = "String", paramType = "query"),
+    })
+	public R querySbgjList(@ApiIgnore Page page,@ApiIgnore SbgjVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		StringBuffer condition = SQLUtil.getCondition(vo);
+		PageRecord<SbgjVO> pr = sbgjService.querySbgjList(page, condition);
+		r.data.put("pr", pr);
+		return r;
+	}
+	
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2024-08-22 13:45:35
+	 *@param vo
+	 *@description
+	 */
+	@ResponseBody
+	@PostMapping("/saveOrUpdate")
+	@ApiOperation(value = "保存或更新设备轨迹")
+	@ApiImplicitParam(name = "设备轨迹实体对象", value = "对应表:tbl_sbgj", required = true, dataType = "SbgjVO")
+	public R saveOrUpdate(@ApiIgnore @RequestBody SbgjVO vo) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			sbgjService.saveOrUpdate(vo);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2024-08-22 13:45:35
+	 *@param id
+	 *@description
+	 */
+	@ResponseBody
+	@GetMapping("/delete")
+	@ApiOperation(value = "删除设备轨迹")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "id", value = "主键(多个以,号分隔)", dataType = "String", required = true, paramType = "query")
+    })
+	public R delete(String id) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			sbgjService.delete(id);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+}

+ 82 - 0
src/main/java/com/admin/sbgj/SbgjService.java

@@ -0,0 +1,82 @@
+package com.admin.sbgj;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.pub.jdbc.BaseDAO;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import org.springframework.util.StringUtils;
+import java.sql.Timestamp;
+import com.pub.env.Environment;
+
+
+/**
+ * 开发工具生成
+ * @author znn
+ * @date 2024-08-22 13:45:35
+ */
+@Service
+public class SbgjService {
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	/**
+	 * 分页查询数据
+	 *@author znn
+	 *@date 2024-08-22 13:45:35
+	 *@param page
+	 *@param condtion
+	 *@description
+	 */
+	public PageRecord<SbgjVO> querySbgjList(Page page, StringBuffer condition) {
+		if(StringUtils.isEmpty(page.getSort())){
+			page.setSort("create_time");
+			page.setOrder("desc");
+		}
+		return baseDAO.queryPaginateByCondition(SbgjVO.class, condition.toString(), page.getRows(), page.getPage(),page.getSort()+" "+page.getOrder());
+	}
+
+	/**
+	 * 根据ID查询数据
+	 *@author znn
+	 *@date 2024-08-22 13:45:35
+	 *@param vo
+	 *@description
+	 */
+	public SbgjVO getSbgjById(SbgjVO vo) {
+		return baseDAO.queryByPK(vo.getClass(), vo.getPrimaryKey());
+	}
+	
+	/**
+	 * 新增或编辑时进行保存
+	 *@author znn
+	 *@date 2024-08-22 13:45:35
+	 *@param vo
+	 *@description
+	 */
+	public void saveOrUpdate(SbgjVO vo) {
+		if (!StringUtils.isEmpty(vo.getPrimaryKey())) {
+			baseDAO.update(vo);
+		} else {
+			baseDAO.insert(vo);
+		}
+	}
+	
+	/**
+	 * 批量删除数据
+	 *@author znn
+	 *@date 2024-08-22 13:45:35
+	 *@param id
+	 *@description
+	 */
+	public void delete(String id) {
+		String[] ids = id.split(",");
+		SbgjVO[] vos = new SbgjVO[ids.length];
+		for (int index = 0; index < vos.length; ++index) {
+			SbgjVO vo = new SbgjVO();
+			vo.setPrimaryKey(ids[index]);
+			vos[index] = vo;
+		}
+		baseDAO.deleteArray(vos);
+	}
+}

+ 55 - 0
src/main/java/com/admin/sbgj/SbgjVO.java

@@ -0,0 +1,55 @@
+package com.admin.sbgj;
+
+import com.pub.jdbc.CommonVO;
+import com.pub.jdbc.CascadeMetadata;
+import java.sql.Timestamp;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Time;
+import java.math.BigDecimal;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * @author znn
+ * @date 2024-08-22 13:45:35
+ */
+@Data
+public class SbgjVO extends CommonVO {
+	
+	/**
+	 * 字段列表(开发工具生成的字段和数据库字段一致)
+	 */
+	@ApiModelProperty(value="设备")
+	private String sb_id;
+	@ApiModelProperty(value="姿态")
+	private Integer zt;
+	@ApiModelProperty(value="x坐标")
+	private BigDecimal xzb;
+	@ApiModelProperty(value="y坐标")
+	private BigDecimal yzb;
+	@ApiModelProperty(value="事件类型")
+	private Integer sjlx;
+	@ApiModelProperty(value="z坐标")
+	private BigDecimal zzb;
+	
+	
+	/**
+	 * 获得表名
+	 */
+	@Override
+	public String getTableName() {
+		return "tbl_sbgj";
+	}
+	
+	/**
+	 * 获得关联子表的CascadeMetadata,没有直接null
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		return null;
+	}
+}

+ 195 - 0
src/main/java/com/admin/user/UserController.java

@@ -0,0 +1,195 @@
+package com.admin.user;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.admin.role.RoleVO;
+import com.admin.user_role.UserRoleVO;
+import com.pub.env.Environment;
+import com.pub.jdbc.BaseDAO;
+import com.pub.listener.SpringContext;
+import com.pub.log.Log;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+import com.pub.util.SQLUtil;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.annotations.ApiIgnore;
+
+/**
+ * 开发工具生成
+ * 
+ * @author znn
+ * @date 2022-12-08 18:44:30
+ */
+@Controller
+@RequestMapping("/user")
+@Api(tags = "用户接口")
+public class UserController {
+
+	@Autowired
+	private UserService userService;
+	@Autowired
+	private BaseDAO baseDAO;
+
+	/**
+	 * 根据ID获得数据
+	 * 
+	 * @author znn
+	 * @date 2022-12-08 18:44:30
+	 * @param vo
+	 * @description
+	 */
+	@ResponseBody
+	@GetMapping("/getUserById")
+	@ApiOperation(value = "查询用户详情")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query") })
+	public R getUserById(@ApiIgnore UserVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		UserVO user = userService.getUserById(vo);
+		r.data.put("user", user);
+		return r;
+	}
+
+	/**
+	 * 获得列表数据
+	 * 
+	 * @author znn
+	 * @date 2022-12-08 18:44:30
+	 * @param page
+	 * @param vo
+	 * @description
+	 */
+	@ResponseBody
+	@GetMapping("/queryUserList")
+	@ApiOperation(value = "查询用户列表")
+	@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "主键(查询唯一记录)", dataType = "String", paramType = "query"),
+			@ApiImplicitParam(name = "page", value = "页码", dataType = "int", required = true, paramType = "query"),
+			@ApiImplicitParam(name = "rows", value = "每页条数", dataType = "int", required = true, paramType = "query"),
+			@ApiImplicitParam(name = "sort", value = "排序字段", dataType = "String", paramType = "query"),
+			@ApiImplicitParam(name = "order", value = "排序方式", dataType = "String", paramType = "query"), })
+	public R queryUserList(@ApiIgnore Page page, @ApiIgnore UserVO vo) {
+		R r = JSONUtil.getSuccessMsg(null);
+		StringBuffer condition = SQLUtil.getCondition(vo);
+		PageRecord<UserVO> pr = userService.queryUserList(page, condition);
+		r.data.put("pr", pr);
+		return r;
+	}
+
+	/**
+	 * 新增或编辑时进行保存
+	 * 
+	 * @author znn
+	 * @date 2022-12-08 18:44:30
+	 * @param vo
+	 * @description
+	 */
+	@ResponseBody
+	@PostMapping("/saveOrUpdate")
+	@ApiOperation(value = "保存或更新用户")
+	@ApiImplicitParam(name = "用户实体对象", value = "对应表:tbl_user", required = true, dataType = "UserVO")
+	public R saveOrUpdate(@ApiIgnore @RequestBody UserVO vo) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			userService.saveOrUpdate(vo);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+
+	/**
+	 * 批量删除数据
+	 * 
+	 * @author znn
+	 * @date 2022-12-08 18:44:30
+	 * @param id
+	 * @description
+	 */
+	@ResponseBody
+	@GetMapping("/delete")
+	@ApiOperation(value = "删除用户")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "id", value = "主键(多个以,号分隔)", dataType = "String", required = true, paramType = "query") })
+	public R delete(String id) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			userService.delete(id);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+
+	@ResponseBody
+	@GetMapping("/saveDisRole")
+	public R saveUserAndRole(String user_id, String role_id) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			baseDAO.updateSQL("delete from tbl_user_role where user_id='" + user_id + "' ");
+			if (StringUtils.isNotEmpty(role_id)) {
+				String[] rs = role_id.split(",");
+				List<UserRoleVO> data = new ArrayList<UserRoleVO>();
+				for (String r : rs) {
+					UserRoleVO vo = new UserRoleVO();
+					vo.setUser_id(user_id);
+					vo.setRole_id(r);
+					data.add(vo);
+				}
+				baseDAO.insertList(data);
+			}
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+
+	@ResponseBody
+	@GetMapping("/queryUserRole")
+	public R queryUserRole(String user_id) {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			List<String> roles = baseDAO.getJdbcTemplate().queryForList(
+					"select role_id from tbl_user_role where ifnull(dr,0)=0 and user_id='" + user_id + "' ",
+					String.class);
+			map.data.put("roles", roles);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+
+	@ResponseBody
+	@GetMapping("/queryRoleList")
+	public R queryRoleList() {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			StringBuffer sqlBuf = SQLUtil.getDataPowSQL(null);
+			List<RoleVO> roles = baseDAO.queryByCondition(RoleVO.class, sqlBuf.toString(), null);
+			map.data.put("roles", roles);
+		} catch (Exception ex) {
+			Log.error(ex);
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+}

+ 114 - 0
src/main/java/com/admin/user/UserService.java

@@ -0,0 +1,114 @@
+package com.admin.user;
+
+import java.sql.Timestamp;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import com.pub.env.Environment;
+import com.pub.exception.BusinessException;
+import com.pub.jdbc.BaseDAO;
+import com.pub.page.Page;
+import com.pub.page.PageRecord;
+
+/**
+ * 开发工具生成
+ * 
+ * @author znn
+ * @date 2022-12-08 18:44:30
+ */
+@Service
+public class UserService {
+	@Autowired
+	private BaseDAO baseDAO;
+
+	public UserVO checkUserLogin(UserVO vo) {
+		Object[] args = new Object[] { vo.getUser_code(), vo.getUser_pwd() };
+		List<UserVO> users = baseDAO.getJdbcTemplate().query(
+				"select * from tbl_user where IFNULL(dr,0)=0 and user_code=? and user_pwd =?", args,
+				new BeanPropertyRowMapper(UserVO.class));
+		if (users != null && users.size() > 0) {
+			return users.get(0);
+		}
+		return null;
+	}
+
+	/**
+	 * 分页查询数据
+	 * 
+	 * @author znn
+	 * @date 2022-12-08 18:44:30
+	 * @param page
+	 * @param condtion
+	 * @description
+	 */
+	public PageRecord<UserVO> queryUserList(Page page, StringBuffer condition) {
+		if (StringUtils.isEmpty(page.getSort())) {
+			page.setSort("create_time");
+			page.setOrder("desc");
+		}
+		return baseDAO.queryPaginateByCondition(UserVO.class, condition.toString(), page.getRows(), page.getPage(),
+				page.getSort() + " " + page.getOrder());
+	}
+
+	/**
+	 * 根据ID查询数据
+	 * 
+	 * @author znn
+	 * @date 2022-12-08 18:44:30
+	 * @param vo
+	 * @description
+	 */
+	public UserVO getUserById(UserVO vo) {
+		return baseDAO.queryByPK(vo.getClass(), vo.getPrimaryKey());
+	}
+
+	/**
+	 * 新增或编辑时进行保存
+	 * 
+	 * @author znn
+	 * @date 2022-12-08 18:44:30
+	 * @param vo
+	 * @description
+	 */
+	public void saveOrUpdate(UserVO vo) {
+		String c = "";
+		if (!StringUtils.isEmpty(vo.getId())) {
+			c = c + " and id!='" + vo.getId() + "'";
+		}
+		List<UserVO> users = baseDAO.queryByCondition(UserVO.class, " and user_code='" + vo.getUser_code() + "' " + c,
+				null);
+		if (users.size() > 0) {
+			throw new BusinessException("账号重复!");
+		}
+		if (!StringUtils.isEmpty(vo.getPrimaryKey())) {
+			vo.setUpdate_time(new Timestamp(System.currentTimeMillis()));
+			vo.setUpdator(Environment.getUser().getId());
+			baseDAO.update(vo);
+		} else {
+			baseDAO.insert(vo);
+		}
+	}
+
+	/**
+	 * 批量删除数据
+	 * 
+	 * @author znn
+	 * @date 2022-12-08 18:44:30
+	 * @param id
+	 * @description
+	 */
+	public void delete(String id) {
+		String[] ids = id.split(",");
+		UserVO[] vos = new UserVO[ids.length];
+		for (int index = 0; index < vos.length; ++index) {
+			UserVO vo = new UserVO();
+			vo.setPrimaryKey(ids[index]);
+			vos[index] = vo;
+		}
+		baseDAO.deleteArray(vos);
+	}
+}

+ 67 - 0
src/main/java/com/admin/user/UserVO.java

@@ -0,0 +1,67 @@
+package com.admin.user;
+
+import java.sql.Timestamp;
+import java.util.List;
+
+import com.admin.role.RoleVO;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.pub.jdbc.CascadeMetadata;
+import com.pub.jdbc.CommonVO;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * @author znn
+ * @date 2022-12-08 18:44:30
+ */
+@Data
+public class UserVO extends CommonVO {
+	
+	/**
+	 * 字段列表(开发工具生成的字段和数据库字段一致)
+	 */
+	@ApiModelProperty(value="员工名称")
+	private String user_name;
+	@ApiModelProperty(value="账号")
+	private String user_code;
+	@ApiModelProperty(value="密码")
+	private String user_pwd;
+	@ApiModelProperty(value="邮箱")
+	private String email;
+	@ApiModelProperty(value="联系电话")
+	private String tel;
+	@ApiModelProperty(value="所属组织")
+	private String sszz_id;
+	@ApiModelProperty(value="头像")
+	private String tx;
+	@ApiModelProperty(value="性别")
+	private String gender;
+	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+	@ApiModelProperty(value="失效时间")
+	private Timestamp expire_time;
+	
+	
+	
+	private String btnPower;
+	private List<RoleVO> roles;
+	private Boolean isRoot;
+	
+	
+	/**
+	 * 获得表名
+	 */
+	@Override
+	public String getTableName() {
+		return "tbl_user";
+	}
+	
+	/**
+	 * 获得关联子表的CascadeMetadata,没有直接null
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		return null;
+	}
+}

+ 51 - 0
src/main/java/com/admin/user_role/UserRoleVO.java

@@ -0,0 +1,51 @@
+package com.admin.user_role;
+
+import com.pub.jdbc.CascadeMetadata;
+import com.pub.jdbc.CommonVO;
+
+import lombok.Data;
+
+/**
+ * @author znn
+ * @Description
+ * @date 2014-12-24
+ */
+@Data
+public class UserRoleVO extends CommonVO {
+
+	private String user_id;
+	private String role_id;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.ksxx.jdbc.SuperVO#getTableName()
+	 */
+	@Override
+	public String getTableName() {
+		// TODO Auto-generated method stub
+		return "tbl_user_role";
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.ksxx.jdbc.SuperVO#getPKFieldName()
+	 */
+	@Override
+	public String getPKFieldName() {
+		// TODO Auto-generated method stub
+		return "id";
+	}
+
+
+	/* (non-Javadoc)
+	 * @see com.ksxx.jdbc.SuperVO#getChildCascadeMetadata()
+	 */
+	@Override
+	public CascadeMetadata[] getChildCascadeMetadata() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

+ 90 - 0
src/main/java/com/api/index/ApiIndexController.java

@@ -0,0 +1,90 @@
+package com.api.index;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.admin.sb.SbVO;
+import com.admin.sbgj.SbgjVO;
+import com.pub.jdbc.BaseDAO;
+import com.pub.log.Log;
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+import com.pub.util.WXUtil;
+
+import io.swagger.annotations.Api;
+
+@Api(tags = "第三方api接口")
+@RequestMapping("/s/api/index")
+@RestController
+public class ApiIndexController {
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	
+	@RequestMapping("/wxghz")
+	public void wxghz(HttpServletRequest req,HttpServletResponse resp) throws IOException {
+		String echostr = req.getParameter("echostr");
+		if(StringUtils.isNotEmpty(echostr)) {
+			resp.getWriter().print(echostr);
+			return;
+		}
+		
+		String notify = IOUtils.toString(req.getInputStream(), "UTF-8");
+		Log.info("微信公众号通知:"+notify);
+		Map<String,String> ghzmap = WXUtil.xmlToMap(notify);
+		String event = ghzmap.get("Event");
+		if(StringUtils.isNotEmpty(event) && event.equals("subscribe")) {
+			String xcxopenid = ghzmap.get("EventKey").replaceAll("qrscene_", "");
+			String ghzopenid = ghzmap.get("FromUserName");
+			//绑定公众号openid和小程序opendi的关系,用于发送公众号微信提醒消息
+			
+		}
+		
+	}
+	
+	
+	@RequestMapping("/sjtz")
+	public R sjtz(String sign_data) throws IOException {
+		R r = JSONUtil.getSuccessMsg(null);
+		Log.info("信号数据:" + sign_data);
+		String[] sarr = sign_data.split(",");
+		String code = sarr[7] + sarr[8] + sarr[9] + sarr[10];
+		if(sarr[6].equals("11")) {
+			String x = Integer.parseInt(sarr[11], 16)+"."+Integer.parseInt(sarr[12], 16);
+			String y = Integer.parseInt(sarr[13], 16)+"."+Integer.parseInt(sarr[14], 16);
+			String z = Integer.parseInt(sarr[15], 16)+"."+Integer.parseInt(sarr[16], 16);
+			Integer zt = Integer.parseInt(sarr[17], 16);
+			Integer sjlx = Integer.parseInt(sarr[18], 16);
+			baseDAO.updateSQL("update tbl_sb set xzb="+x+",yzb="+y+",zzb="+z+",sjlx="+sjlx+",zt="+zt+",sign_time=now(),lx=null where bh='"+code+"' ");
+			
+			List<SbVO> sbs = baseDAO.queryByCondition(SbVO.class, " and bh='"+code+"' ", null);
+			if(sbs.size() > 0) {
+				SbVO sb = sbs.get(0);
+				if(sb.getXzb().compareTo(new BigDecimal(x)) != 0 || sb.getYzb().compareTo(new BigDecimal(y)) != 0
+						|| sb.getZzb().compareTo(new BigDecimal(z)) != 0 || sb.getZt() != zt
+						|| sb.getSjlx() != sjlx) {
+					SbgjVO gj = new SbgjVO();
+					gj.setSb_id(sb.getId());
+					gj.setXzb(new BigDecimal(x));
+					gj.setYzb(new BigDecimal(y));
+					gj.setZzb(new BigDecimal(z));
+					gj.setZt(zt);
+					gj.setSjlx(sjlx);
+					baseDAO.insert(gj);
+				}
+			}
+		}
+		return r;
+	}
+}

+ 18 - 0
src/main/java/com/h5/index/H5IndexController.java

@@ -0,0 +1,18 @@
+package com.h5.index;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.pub.jdbc.BaseDAO;
+
+import io.swagger.annotations.Api;
+
+@Api(tags = "H5网页接口")
+@RequestMapping("/s/h5/index")
+@RestController
+public class H5IndexController {
+	@Autowired
+	private BaseDAO baseDAO;
+
+}

+ 23 - 0
src/main/java/com/pub/config/ActivitiUserDetailService.java

@@ -0,0 +1,23 @@
+package com.pub.config;
+/*
+ * 工作流启用时开启
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ActivitiUserDetailService implements UserDetailsService{
+
+	@Override
+	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}
+*/
+
+public class ActivitiUserDetailService {
+	
+}

+ 36 - 0
src/main/java/com/pub/config/CorsCfg.java

@@ -0,0 +1,36 @@
+package com.pub.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+
+@Configuration
+public class CorsCfg {
+	@Bean
+    public CorsFilter corsFilter() {
+ 
+        //创建CorsConfiguration对象后添加配置
+        CorsConfiguration config = new CorsConfiguration();
+        //设置放行哪些原始域
+        config.addAllowedOriginPattern("*");
+        //放行哪些原始请求头部信息
+        config.addAllowedHeader("*");
+        //放行哪些请求方式
+        config.addAllowedMethod("*");     //放行全部请求
+ 
+        //是否发送Cookie
+        config.setAllowCredentials(true);
+        
+        config.setMaxAge(3600*24l);
+ 
+        //2. 添加映射路径
+        UrlBasedCorsConfigurationSource corsConfigurationSource =
+                new UrlBasedCorsConfigurationSource();
+        corsConfigurationSource.registerCorsConfiguration("/**", config);
+        //返回CorsFilter
+        return new CorsFilter(corsConfigurationSource);
+    }
+
+}

+ 33 - 0
src/main/java/com/pub/config/CustomInterceptorConfig.java

@@ -0,0 +1,33 @@
+package com.pub.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.pub.interceptor.CustomInterceptor;
+
+@Configuration
+public class CustomInterceptorConfig implements WebMvcConfigurer {
+
+	@Override
+	public void addInterceptors(InterceptorRegistry registry) {
+		registry.addInterceptor(new CustomInterceptor()).addPathPatterns("/**").excludePathPatterns("/s/**",
+				"/framework-ui/**","/ws/**", "/error/**", "/index/login", "/index/initData","/fileUpload/upload");
+	}
+
+	@Bean
+	public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
+
+		MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
+		ObjectMapper objectMapper = new ObjectMapper();
+		// 添加此配置
+		objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+		converter.setObjectMapper(objectMapper);
+		return converter;
+	}
+
+}

+ 25 - 0
src/main/java/com/pub/config/RabbitConfig.java

@@ -0,0 +1,25 @@
+package com.pub.config;
+
+import org.springframework.amqp.core.Queue;
+import org.springframework.amqp.rabbit.connection.ConnectionFactory;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+
+//@Configuration
+public class RabbitConfig {
+	@Bean
+	public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
+		RabbitTemplate template = new RabbitTemplate(connectionFactory);
+		//template.convertAndSend("RabbitQueue", "");
+		return template;
+	}
+	
+	/*
+	@Bean
+	public Queue createQueue() {
+		return new Queue("RabbitQueue");
+	}
+	*/
+}

+ 29 - 0
src/main/java/com/pub/config/RedisConfig.java

@@ -0,0 +1,29 @@
+package com.pub.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+//@Configuration
+public class RedisConfig{
+	@Bean
+	public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
+		RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
+		// 关联
+		template.setConnectionFactory(factory);
+		// 设置key的序列化器
+		template.setKeySerializer(new StringRedisSerializer());
+		// 设置value的序列化器
+		template.setValueSerializer(new Jackson2JsonRedisSerializer<>(Object.class));
+		template.afterPropertiesSet();
+		//Map data = new HashMap();
+		//data.put("111", 111);
+		//data.put("222", "222");
+		//template.opsForValue().set("11", JSONObject.toJSONString(data),5,TimeUnit.SECONDS);
+		//System.out.println(template.opsForValue().get("11"));
+		return template;
+	}
+}

+ 62 - 0
src/main/java/com/pub/config/SwaggerConfig.java

@@ -0,0 +1,62 @@
+package com.pub.config;
+
+
+import static com.google.common.collect.Lists.newArrayList;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.ParameterBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.schema.ModelRef;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.ApiKey;
+import springfox.documentation.service.Parameter;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+@Configuration
+@EnableSwagger2
+public class SwaggerConfig implements WebMvcConfigurer {
+
+    @Bean
+    public Docket createRestApi() {
+        return new Docket(DocumentationType.SWAGGER_2)
+            .apiInfo(apiInfo())
+            .globalOperationParameters(getGlobalOperationParameters())
+            .select()
+            //加了ApiOperation注解的类,才生成接口文档
+            .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
+            .paths(PathSelectors.any())
+            .build()
+            .securitySchemes(security());
+    }
+    private List<Parameter> getGlobalOperationParameters() {
+        List<Parameter> pars = new ArrayList<>();
+        pars.add(new ParameterBuilder().name("token").description("token(除了管理端需要传,其他端不用传)").modelRef(new ModelRef("string")).parameterType("header").build());
+        return pars;
+    }
+
+    private ApiInfo apiInfo() {
+        return new ApiInfoBuilder()
+            .title("后端接口平台")
+            .description("后端接口平台文档")
+            .version("1.0.0")
+            .build();
+    }
+
+    private List<ApiKey> security() {
+        return newArrayList(
+            new ApiKey("token", "token", "header")
+        );
+    }
+
+}

+ 49 - 0
src/main/java/com/pub/config/TransactionAdviceConfig.java

@@ -0,0 +1,49 @@
+package com.pub.config;
+
+import org.aspectj.lang.annotation.Aspect;
+import org.springframework.aop.Advisor;
+import org.springframework.aop.aspectj.AspectJExpressionPointcut;
+import org.springframework.aop.support.DefaultPointcutAdvisor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.transaction.TransactionDefinition;
+import org.springframework.transaction.TransactionManager;
+import org.springframework.transaction.interceptor.DefaultTransactionAttribute;
+import org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource;
+import org.springframework.transaction.interceptor.TransactionInterceptor;
+
+@Aspect
+@Configuration
+public class TransactionAdviceConfig {
+	private static final String AOP_POINTCUT_EXPRESSION = "execution (* com.*.*.*Service.*(..))";
+
+	@Autowired
+	private TransactionManager transactionManager;
+
+	@Bean
+	public TransactionInterceptor txAdvice() {
+
+		DefaultTransactionAttribute txAttr_REQUIRED = new DefaultTransactionAttribute();
+		txAttr_REQUIRED.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
+
+		DefaultTransactionAttribute txAttr_REQUIRED_READONLY = new DefaultTransactionAttribute();
+		txAttr_REQUIRED_READONLY.setPropagationBehavior(TransactionDefinition.PROPAGATION_NOT_SUPPORTED);
+
+		NameMatchTransactionAttributeSource source = new NameMatchTransactionAttributeSource();
+		source.addTransactionalMethod("*", txAttr_REQUIRED);
+		source.addTransactionalMethod("get*", txAttr_REQUIRED_READONLY);
+		source.addTransactionalMethod("query*", txAttr_REQUIRED_READONLY);
+		source.addTransactionalMethod("load*", txAttr_REQUIRED_READONLY);
+		source.addTransactionalMethod("select*", txAttr_REQUIRED_READONLY);
+		return new TransactionInterceptor(transactionManager, source);
+	}
+
+	@Bean
+	public Advisor txAdviceAdvisor() {
+		AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
+		pointcut.setExpression(AOP_POINTCUT_EXPRESSION);
+		return new DefaultPointcutAdvisor(pointcut, txAdvice());
+	}
+
+}

+ 39 - 0
src/main/java/com/pub/constant/Constants.java

@@ -0,0 +1,39 @@
+package com.pub.constant;
+
+public class Constants {
+
+    // 域名
+    public static String DOMAIN = "http://jkld.radar-power.com/";
+
+    /*
+     * 微信参数
+     */
+    public static String WXMCHID = "";
+    public static String WXMCHKEY = "";
+    public static String WXMCHKEYV3 = "";
+    public static String WXMCHAPICERTNUM = "";
+    public static String WXMCHPKPATH = "";
+    public static String WXXCXAPPID = "wx60b2cd643b46d5eb";
+    public static String WXXCXAPPSECRET = "a7c1e377869fffb6fcbacca979d77617";
+    public static String WXXCXACCESS_TOKEN = "";
+    public static String WXGZHAPPID = "";
+    public static String WXGZHAPPSECRET = "";
+    public static String WXGZHACCESS_TOKEN = "";
+    public static String WXGZHJS_TICKET = "";
+
+    /*
+     * 支付宝参数
+     */
+    public static String ZFBAPPID = "";
+    public static String ZFBRSA_PRIVATE_KEY = "";
+    public static String ZFBURL = "https://openapi.alipay.com/gateway.do";
+    public static String ZFBCHARSET = "UTF-8";
+    public static String ZFBFORMAT = "json";
+    public static String ZFBALIPAY_PUBLIC_KEY = "";
+    public static String ZFBSIGNTYPE = "RSA2";
+
+    //服务号参数
+    public static String FWHAPPID = "wx9b479fa3c2af4f21";
+    public static String FWHAPPSECRET = "426effb7b58f9ba7c5f6dd1062db0074";
+    public static String FWHACCESS_TOKEN = "lnServer";
+}

+ 106 - 0
src/main/java/com/pub/env/Environment.java

@@ -0,0 +1,106 @@
+package com.pub.env;
+
+import java.security.PrivateKey;
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.http.impl.client.CloseableHttpClient;
+
+import com.admin.user.UserVO;
+import com.alibaba.fastjson.serializer.SerializeConfig;
+import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
+
+import co.elastic.clients.elasticsearch.ElasticsearchClient;
+
+
+/**
+ * @author znn
+ * @Description
+ * @date 2014-12-16
+ */
+public final class Environment {
+
+	/**
+	 * 保存线程中信息
+	 */
+	public static ThreadLocal<HashMap<String, Object>> threadLocal = new ThreadLocal<HashMap<String, Object>>();
+
+	/**
+	 * 系统中不受权限控制的root用户
+	 */
+	public static String ROOT = "admin";
+
+
+	/**
+	 * 管理端的key
+	 */
+	public static String USER = "user";
+	
+	
+	/**
+	 * 公共文件服务上传路径
+	 */
+	public static String COMMON_FILE_UPLOAD_PATH = "/uploadFiles/framework/";
+	
+
+	/**
+	 * 微信SDK HC
+	 */
+	public static CloseableHttpClient wxHttpClient;
+	/**
+	 * 微信SDK PK
+	 */
+	public static PrivateKey wxPrivateKey;
+	
+	/**
+	 * ElasticsearchClient
+	 */
+	public static boolean elasticsearchEnable = false;
+	public static ElasticsearchClient elasticsearchClient ;
+	
+	/**
+	 * 线程池
+	 */
+	public static ExecutorService es = Executors.newCachedThreadPool(new ThreadFactory() {
+		private final AtomicInteger threadNumber = new AtomicInteger(1);
+		@Override
+		public Thread newThread(Runnable r) {
+			String name = "pool-thread-" + threadNumber.getAndIncrement();
+			Thread t = new Thread(r, name);
+			return t;
+		}
+
+	});
+	
+	
+	public static SerializeConfig jsonsc = new SerializeConfig();
+	static {
+		jsonsc.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd"));
+		jsonsc.put(Timestamp.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));
+	}
+	
+	/**
+	 * 获取用户信息
+	 * 
+	 * @author znn
+	 * @date 2014-12-26
+	 * @return
+	 * @description
+	 */
+	public static UserVO getUser() {
+		HashMap<String, Object> map = threadLocal.get();
+		if (map != null) {
+			return (UserVO) map.get(USER);
+		}
+		return null;
+	}
+
+	public static boolean isRoot() {
+		return getUser().getUser_code().equals(ROOT);
+	}
+}

+ 13 - 0
src/main/java/com/pub/excel/WriteExcelInterface.java

@@ -0,0 +1,13 @@
+package com.pub.excel;
+
+import com.pub.jdbc.SuperVO;
+
+/**
+ * 需要自己处理的excel列
+ * @author znn
+ * @Description 
+ * @date 2015-11-10
+ */
+public interface WriteExcelInterface {
+	public String processData(String field,String value,Object rowData);
+}

+ 14 - 0
src/main/java/com/pub/exception/BusinessException.java

@@ -0,0 +1,14 @@
+package com.pub.exception;
+
+public class BusinessException extends RuntimeException {
+
+	private static final long serialVersionUID = 2614335120127949188L;
+
+	public BusinessException(String exceptionMsg) {
+		super(exceptionMsg);
+	}
+	
+	public BusinessException(String exceptionMsg,Throwable cause) {
+		super(exceptionMsg,cause);
+	}
+}

+ 15 - 0
src/main/java/com/pub/field/Fields.java

@@ -0,0 +1,15 @@
+package com.pub.field;
+
+/**
+ * @author znn
+ * @Description 
+ * @date 2014-12-16
+ */
+public class Fields {
+	public final static String OPERATOR = "operator";
+	public final static String CREATE_TIME = "create_time";
+	public final static String ORG = "org_id";
+	public final static String DR = "dr";
+	public final static String UPDATE_TIME = "update_time";
+	public final static String UPDATOR = "updator";
+}

+ 104 - 0
src/main/java/com/pub/foreignKey/ForeignKeyController.java

@@ -0,0 +1,104 @@
+package com.pub.foreignKey;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.pub.jdbc.BaseDAO;
+import com.pub.util.JSONUtil;
+import com.pub.util.SQLUtil;
+
+@Controller
+@RequestMapping("/foreignKey")
+public class ForeignKeyController {
+
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	/**
+	 * 用于前端加载el-select
+	 * @param table_name
+	 * @param label
+	 * @param condition
+	 * @param sort
+	 * @return
+	 */
+	@ResponseBody
+	@RequestMapping("/loadSelect")
+	public Map<String, Object> loadSelectForeignKeySingleTable(String table_name,String label, String condition, String sort) {
+		Map<String, Object> map = new HashMap<String, Object>();
+		map.put("result", JSONUtil.SUCCESS);
+		map.put("msg", "操作成功");
+		try {
+			StringBuffer sqlBuf = new StringBuffer();
+			if (!StringUtils.isEmpty(condition)) {
+				sqlBuf.append(condition);
+			}
+			sqlBuf.append(SQLUtil.getDataPowSQL(null));
+			String sql = "select * from " + table_name + " where ifnull(dr,0)=0 " + sqlBuf;
+			if (StringUtils.isNotEmpty(sort)) {
+				sql = sql + " order by " + sort;
+			}else {
+				sql = sql + " order by create_time desc ";
+			}
+			List<Map<String, Object>> data = baseDAO.queryBySQL(sql);
+			List<Map<String, Object>> dest_data = new ArrayList<>();
+			for(Map<String, Object> m : data) {
+				Map<String, Object> m1 = new HashMap<>();
+				m1.put("value", m.get("id"));
+				String str = "";
+				String[] ls = label.split(",");
+				for(String l : ls) {
+					str = str + m.get(l)+"/";
+				}
+				if(StringUtils.isNotEmpty(str)) {
+					str = str.substring(0, str.length() - 1);
+				}
+				m1.put("label", str);
+				dest_data.add(m1);
+			}
+			map.put("f_data", dest_data);
+		} catch (Exception ex) {
+			map.put("result", JSONUtil.FAIL);
+			map.put("msg", ex.getMessage());
+		}
+		return map;
+	}
+	
+	
+	/**
+	 * 用于前端加载外键对应的对象
+	 * @param table_name
+	 * @param label
+	 * @param condition
+	 * @param sort
+	 * @return
+	 */
+	@ResponseBody
+	@RequestMapping("/loadForeignObj")
+	public Map<String, Object> loadForeignObj(String f_id, String t_name) {
+		Map<String, Object> map = new HashMap<String, Object>();
+		map.put("result", JSONUtil.SUCCESS);
+		map.put("msg", "操作成功");
+		try {
+			List<Map<String, Object>> data = baseDAO.queryBySQL("select * from " + t_name
+					+ " where ifnull(dr,0)=0  and id='" + f_id + "' ");
+			if(data.size() > 0) {
+				map.put("f_data", data.get(0));
+			}else{
+				map.put("f_data", null);
+			}
+		} catch (Exception ex) {
+			map.put("result", JSONUtil.FAIL);
+			map.put("msg", ex.getMessage());
+		}
+		return map;
+	}
+}

+ 58 - 0
src/main/java/com/pub/gencode/ColumnInfo.java

@@ -0,0 +1,58 @@
+package com.pub.gencode;
+
+/**
+ * @author znn
+ * @Description
+ * @date 2015-1-16
+ */
+public class ColumnInfo {
+	private Integer data_type;
+	private String column_name;
+	private Integer column_size;
+	private String type_name;
+	private String remarks;
+	
+
+	public Integer getData_type() {
+		return data_type;
+	}
+
+	public void setData_type(Integer data_type) {
+		this.data_type = data_type;
+	}
+
+	public String getColumn_name() {
+		return column_name;
+	}
+
+	public void setColumn_name(String column_name) {
+		this.column_name = column_name;
+	}
+
+	public Integer getColumn_size() {
+		return column_size;
+	}
+
+	public void setColumn_size(Integer column_size) {
+		this.column_size = column_size;
+	}
+
+	public String getType_name() {
+		return type_name;
+	}
+
+	public void setType_name(String type_name) {
+		this.type_name = type_name;
+	}
+
+
+	public String getRemarks() {
+		return remarks;
+	}
+
+	public void setRemarks(String remarks) {
+		this.remarks = remarks;
+	}
+
+
+}

+ 303 - 0
src/main/java/com/pub/gencode/GenCode.java

@@ -0,0 +1,303 @@
+package com.pub.gencode;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+
+/**
+ * @author znn
+ * @Description
+ * @date 2014-12-28
+ */
+public class GenCode {
+	public static void main(String[] args) throws SQLException, ClassNotFoundException {
+		//接口代码路径
+		String java_path = "D:/GitRespo/jkldhtjk/src/main/java";
+		//前端代码路径
+		String html_path = "D:/GitRespo/jkldhtui/src/view/";
+		//数据库
+		String db_name = "jkld";
+		//表名
+		String table_name = "tbl_sbgj";
+		//模块名称
+		String mk_name = "设备轨迹";
+		//列表查询条件
+		String[] defConditionColumns = new String[] {};
+		
+		new GenCode().genCode("com.mysql.cj.jdbc.Driver",
+				"jdbc:mysql://localhost:3306/"+db_name+"?user=root&password=root&serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&useSSL=false&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true&autoReconnect=true", table_name,mk_name,defConditionColumns,html_path,java_path);
+		
+	}
+
+	String dbName;
+
+	
+	public void genCode(String driverClass, String url, String tableName,String mkName, String[] defConditionColumns,String html_path,String java_path) {
+		try {
+			Class.forName(driverClass);
+			Properties props = new Properties();
+			props.put("remarksReporting", "true");
+			Connection conn = DriverManager.getConnection(url, props);
+			Map<String, Object> map = new HashMap<String, Object>();
+			map.put("tableName", tableName);
+			map.put("mkName", mkName);
+			String[] tableNames = tableName.split("_");
+			if (tableNames.length > 1) {
+				String funcNameLowerCase = "";
+				String funcNameUpperCase = "";
+				for (int i = 1; i < tableNames.length; i++) {
+					if (i == 1) {
+						funcNameLowerCase = funcNameLowerCase + tableNames[i];
+					} else {
+						funcNameLowerCase = funcNameLowerCase + tableNames[i].substring(0, 1).toUpperCase()
+								+ tableNames[i].substring(1);
+					}
+					funcNameUpperCase = funcNameUpperCase + tableNames[i].substring(0, 1).toUpperCase()
+							+ tableNames[i].substring(1);
+				}
+
+				map.put("funcNameLowerCase", funcNameLowerCase);
+				map.put("funcNameUpperCase", funcNameUpperCase);
+				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+				String sysTime = sdf.format(new Date());
+				map.put("systemTime", sysTime);
+				File java_dir = new File(java_path+"/com/admin/" + funcNameLowerCase);
+				if (!java_dir.exists()) {
+					java_dir.mkdirs();
+				}
+				Configuration configuration = new Configuration();
+				configuration.setDefaultEncoding("utf-8");
+				configuration.setClassForTemplateLoading(getClass(), "/templates");
+				/**
+				 * template
+				 */
+				Template t = null;
+				FileWriter fw = null;
+				
+				t = configuration.getTemplate("TemplateController.ftl", "UTF-8");
+				t.setEncoding("UTF-8");
+				fw = new FileWriter(java_dir.getAbsolutePath() + "/" + funcNameUpperCase + "Controller.java");
+				t.process(map, fw);
+
+				t = configuration.getTemplate("TemplateService.ftl", "UTF-8");
+				t.setEncoding("UTF-8");
+				fw = new FileWriter(java_dir.getAbsolutePath() + "/" + funcNameUpperCase + "Service.java");
+				t.process(map, fw);
+				DatabaseMetaData metaData = conn.getMetaData();
+				dbName = metaData.getDatabaseProductName();
+				ResultSet rsColumns = null;
+				if (this.dbName != null) {
+					this.dbName = this.dbName.toUpperCase();
+					if (this.dbName.indexOf("SQL") != -1) {
+						rsColumns = metaData.getColumns(null, null, tableName.toUpperCase(), "%");
+					} else if (this.dbName.indexOf("DB2") != -1 || this.dbName.indexOf("ORACLE") != -1) {
+						rsColumns = metaData.getColumns(null, metaData.getUserName().toUpperCase(),
+								tableName.toUpperCase(), "%");
+					}
+				} else {
+					rsColumns = metaData.getColumns(null, metaData.getUserName().toUpperCase(), tableName.toUpperCase(),
+							"%");
+				}
+				LinkedHashMap<String, ColumnInfo> typeMap = new LinkedHashMap<String, ColumnInfo>();
+				while (rsColumns.next()) {
+					String columnName = rsColumns.getString("COLUMN_NAME").toLowerCase();
+					if (!columnName.equals("operator") && !columnName.equals("create_time") && !columnName.equals("id")
+							&& !columnName.equals("dr") && !columnName.equals("org_id") && !columnName.equals("del_time")&& !columnName.equals("del_opr") && !columnName.equals("update_time")&& !columnName.equals("updator")) {
+						int columnType = rsColumns.getShort("DATA_TYPE");
+						ColumnInfo cinfo = new ColumnInfo();
+						cinfo.setData_type(columnType);
+						cinfo.setRemarks(rsColumns.getString("REMARKS"));
+						if (columnType == Types.DECIMAL || columnType == Types.FLOAT || columnType == Types.DOUBLE) {
+							cinfo.setColumn_size(rsColumns.getInt("COLUMN_SIZE") + 1);
+						}else {
+							cinfo.setColumn_size(rsColumns.getInt("COLUMN_SIZE"));
+						}
+						cinfo.setColumn_size(rsColumns.getInt("COLUMN_SIZE"));
+						typeMap.put(columnName, cinfo);
+					}
+				}
+				// VO类中的字段
+				List<VoColumn> voColumns = new ArrayList<VoColumn>();
+				
+				List<HtmlListColumn> HtmlListColumns = new ArrayList<HtmlListColumn>();
+				List<HtmlEditTr> htmlListConditionTrs = new ArrayList<HtmlEditTr>();
+				List<HtmlEditTr> htmlEditTrs = new ArrayList<HtmlEditTr>();
+				List<String> zsrules = new ArrayList<String>();
+				List<String> xsrules = new ArrayList<String>();
+				
+				List<String> files = new ArrayList<String>();
+				List<String> mfiles = new ArrayList<String>();
+				
+				HtmlEditTr tr = null;
+				// condition记录每一行tr对象
+				HtmlEditTr conditionTr = null;
+				// 每两个字段换一行tr
+				int count = 0;
+				// condition记录每一行td数量
+				int conditionTdCount = 0;
+				boolean editor = false;
+				for (String key : typeMap.keySet()) {
+					VoColumn column = new VoColumn();
+					String columnName = key.toLowerCase();
+					column.setName(columnName);
+					Integer type = typeMap.get(key).getData_type();
+					if (type == Types.CHAR || type == Types.VARCHAR || type == Types.LONGVARCHAR) {
+						column.setType("String");
+					} else if (type == Types.DECIMAL) {
+						column.setType("BigDecimal");
+						xsrules.add(columnName);
+					} else if (type == Types.FLOAT) {
+						column.setType("Float");
+					} else if (type == Types.DOUBLE) {
+						column.setType("Double");
+					} else if (type == Types.INTEGER || type == Types.TINYINT || type == Types.SMALLINT) {
+						column.setType("Integer");
+						zsrules.add(columnName);
+					} else if (type == Types.BIGINT) {
+						column.setType("Long");
+					} else if (type == Types.DATE) {
+						column.setType("Date");
+					} else if (type == Types.TIMESTAMP) {
+						column.setType("Timestamp");
+					} else if (type == Types.BLOB) {
+						column.setType("Blob");
+					} else if (type == Types.CLOB) {
+						column.setType("Clob");
+					} else if (type == Types.BIT) {
+						column.setType("Boolean");
+					} else if (type == Types.BOOLEAN) {
+						column.setType("Integer");
+					} else if (type == Types.TIME) {
+						column.setType("Time");
+					} else {
+						column.setType("String");
+					}
+					column.setBz(typeMap.get(key).getRemarks());
+					voColumns.add(column);
+					
+					
+					HtmlListColumn HtmlListColumn = new HtmlListColumn();
+					HtmlListColumn.setName(columnName);
+					HtmlListColumn.setComment(typeMap.get(key).getRemarks());
+					if (column.getType().equals("String") && typeMap.get(key).getColumn_size() == 65535) {
+						HtmlListColumn.setType_name("text");
+					}else if(column.getType().equals("String") && typeMap.get(key).getColumn_size() == 2147483647) {
+						HtmlListColumn = null;
+					}else if(column.getType().equals("String") && typeMap.get(key).getColumn_size() == 666) {
+						HtmlListColumn.setType_name("file");
+						files.add(columnName);
+					}else if(column.getType().equals("String") && typeMap.get(key).getColumn_size() == 777) {
+						HtmlListColumn.setType_name("mfile");
+						mfiles.add(columnName);
+					}else if(column.getType().equals("String") && typeMap.get(key).getColumn_size() == 1) {
+						HtmlListColumn.setType_name("Boolean");
+					}else if(column.getType().equals("String") && (typeMap.get(key).getColumn_size() == 36 || typeMap.get(key).getColumn_size() == 166)) {
+						HtmlListColumn.setType_name("select");
+					} else {
+						HtmlListColumn.setType_name(column.getType());
+					}
+					if(HtmlListColumn != null) {
+						HtmlListColumns.add(HtmlListColumn);
+					}
+					if (Arrays.asList(defConditionColumns).contains(key)) {
+						if (conditionTdCount % 4 == 0) {
+							conditionTr = new HtmlEditTr();
+							htmlListConditionTrs.add(conditionTr);
+						}
+						ColumnInfo columnInfo = new ColumnInfo();
+						columnInfo.setColumn_name(columnName);
+						columnInfo.setRemarks(typeMap.get(key).getRemarks());
+						conditionTr.getColumnInfos().add(columnInfo);
+						conditionTdCount++;
+					}
+					if (count % 2 == 0) {
+						tr = new HtmlEditTr();
+						htmlEditTrs.add(tr);
+					}
+					ColumnInfo columnInfo = new ColumnInfo();
+					columnInfo.setColumn_name(columnName);
+					columnInfo.setRemarks(typeMap.get(key).getRemarks());
+					columnInfo.setColumn_size(typeMap.get(key).getColumn_size());
+					if (column.getType().equals("String") && typeMap.get(key).getColumn_size() == 65535) {
+						columnInfo.setType_name("text");
+					}else if(column.getType().equals("String") && typeMap.get(key).getColumn_size() == 2147483647) {
+						columnInfo.setType_name("editor");
+						editor = true;
+					}else if(column.getType().equals("String") && typeMap.get(key).getColumn_size() == 666) {
+						columnInfo.setType_name("file");
+					}else if(column.getType().equals("String") && typeMap.get(key).getColumn_size() == 777) {
+						columnInfo.setType_name("mfile");
+					}else if(column.getType().equals("String") && typeMap.get(key).getColumn_size() == 1) {
+						columnInfo.setType_name("Boolean");
+					}else if(column.getType().equals("String") && (typeMap.get(key).getColumn_size() == 36 || typeMap.get(key).getColumn_size() == 166)) {
+						columnInfo.setType_name("select");
+					} else {
+						columnInfo.setType_name(column.getType());
+					}
+
+					tr.getColumnInfos().add(columnInfo);
+					count++;
+
+				}
+				map.put("voColumns", voColumns);
+				t = configuration.getTemplate("TemplateVO.ftl", "UTF-8");
+				t.setEncoding("UTF-8");
+				fw = new FileWriter(java_dir.getAbsolutePath() + "/" + funcNameUpperCase + "VO.java");
+				t.process(map, fw);
+				
+				if(html_path != null && !html_path.equals("")) {
+					File html_dir = new File(html_path+"/" + funcNameLowerCase);
+					if (!html_dir.exists()) {
+						html_dir.mkdirs();
+					}
+					
+					// 生成Vue页面
+					map.put("editor", editor);
+					map.put("jspListConditionTrs", htmlListConditionTrs);
+					map.put("htmlListColumns", HtmlListColumns);
+					map.put("jspEditTrs", htmlEditTrs);
+					map.put("zsrules", zsrules);
+					map.put("xsrules", xsrules);
+					map.put("files", files);
+					map.put("mfiles", mfiles);
+					
+					
+					t = configuration.getTemplate("TemplateVue.ftl", "UTF-8");
+					t.setEncoding("UTF-8");
+					fw = new FileWriter(html_dir.getAbsolutePath() + "/" + funcNameLowerCase + ".vue");
+					t.process(map, fw);
+
+				}
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		} catch (TemplateException e) {
+			e.printStackTrace();
+		} catch (ClassNotFoundException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (SQLException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+}

+ 26 - 0
src/main/java/com/pub/gencode/HtmlEditTr.java

@@ -0,0 +1,26 @@
+package com.pub.gencode;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author znn
+ * @Description 
+ * @date 2015-1-16
+ */
+public class HtmlEditTr {
+	private List<ColumnInfo> columnInfos = new ArrayList<ColumnInfo>();
+	
+	public void addColumnInfos(ColumnInfo columnInfo){
+		columnInfos.add(columnInfo);
+	}
+
+	public List<ColumnInfo> getColumnInfos() {
+		return columnInfos;
+	}
+
+	public void setColumnInfos(List<ColumnInfo> columnInfos) {
+		this.columnInfos = columnInfos;
+	}
+	
+}

+ 36 - 0
src/main/java/com/pub/gencode/HtmlListColumn.java

@@ -0,0 +1,36 @@
+package com.pub.gencode;
+
+/**
+ * @author znn
+ * @Description
+ * @date 2014-12-28
+ */
+public class HtmlListColumn {
+	private String name;
+	private String comment;
+	private String type_name;
+
+	public String getComment() {
+		return comment;
+	}
+
+	public void setComment(String comment) {
+		this.comment = comment;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getType_name() {
+		return type_name;
+	}
+
+	public void setType_name(String type_name) {
+		this.type_name = type_name;
+	}
+}

+ 37 - 0
src/main/java/com/pub/gencode/VoColumn.java

@@ -0,0 +1,37 @@
+package com.pub.gencode;
+
+/**
+ * @author znn
+ * @Description
+ * @date 2014-12-28
+ */
+public class VoColumn {
+	private String type;
+	private String name;
+	private String bz;
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getBz() {
+		return bz;
+	}
+
+	public void setBz(String bz) {
+		this.bz = bz;
+	}
+
+}

+ 82 - 0
src/main/java/com/pub/index/IndexController.java

@@ -0,0 +1,82 @@
+package com.pub.index;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.admin.role.RoleVO;
+import com.admin.user.UserService;
+import com.admin.user.UserVO;
+import com.pub.constant.Constants;
+import com.pub.env.Environment;
+import com.pub.jdbc.BaseDAO;
+import com.pub.system.SystemCache;
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+import com.pub.util.UserUtil;
+
+/**
+ * @author znn
+ * @Description
+ * @date 2014-12-12
+ */
+@Controller
+@RequestMapping("/index")
+public class IndexController {
+
+	@Autowired
+	private UserService userService;
+	@Autowired
+	private BaseDAO baseDAO;
+	
+	
+	@RequestMapping("/initData")
+	@ResponseBody
+	public R initData() {
+		R r = JSONUtil.getSuccessMsg(null);
+		String title = SystemCache.paramMap.get("title").getParameter_value();
+		r.data.put("title", title);
+		return r;
+	}
+	
+	@RequestMapping("/login")
+	@ResponseBody
+	public Map<String, Object> login(UserVO vo) {
+		Map<String, Object> data = new HashMap<String, Object>();
+		data.put("result", JSONUtil.SUCCESS);
+		data.put("msg", "操作成功");
+		UserVO user = userService.checkUserLogin(vo);
+		if (user == null) {
+			data.put("result", JSONUtil.FAIL);
+			data.put("msg", "账号或密码错误!");
+		} else {
+			if(StringUtils.isNotEmpty(user.getTx())) {
+				user.setTx(Constants.DOMAIN+Environment.COMMON_FILE_UPLOAD_PATH+user.getTx());
+			}
+			String btnPower = "";
+			List<RoleVO> roles = UserUtil.getRoleList(user.getId());
+			if (roles.size() > 0) {
+				for (RoleVO role : roles) {
+					String anqx = role.getAnqx();
+					if (!StringUtils.isEmpty(anqx)) {
+						btnPower = btnPower + anqx + ",";
+					}
+				}
+			}
+			user.setIsRoot(user.getUser_code().equals(Environment.ROOT));
+			user.setBtnPower(btnPower);
+			user.setRoles(roles);
+			baseDAO.updateSQL(
+					"update tbl_user set expire_time=DATE_ADD(now(),interval 6 HOUR) where id='" + user.getId() + "' ");
+			data.put("user", user);
+		}
+		return data;
+	}
+
+}

+ 97 - 0
src/main/java/com/pub/interceptor/CustomInterceptor.java

@@ -0,0 +1,97 @@
+package com.pub.interceptor;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.springframework.web.method.HandlerMethod;
+import org.springframework.web.servlet.HandlerInterceptor;
+
+import com.admin.oprLog.OprLogVO;
+import com.admin.user.UserVO;
+import com.alibaba.fastjson.JSONObject;
+import com.pub.env.Environment;
+import com.pub.jdbc.BaseDAO;
+import com.pub.listener.SpringContext;
+import com.pub.util.JSONUtil;
+
+public class CustomInterceptor implements HandlerInterceptor {
+
+	private static Map<String, Long> apiLock = new HashMap<>();
+
+	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
+			throws Exception {
+
+		String servlet_path = request.getServletPath();
+		if (StringUtils.isNotEmpty(servlet_path) && (servlet_path.endsWith(".txt") || servlet_path.endsWith(".html")
+				|| servlet_path.contains("swagger"))) {
+			return true;
+		}
+
+		
+		UserVO vo = null;
+		String token = request.getHeader("token");
+		if(StringUtils.isEmpty(token)) {
+			token = request.getParameter("token");
+		}
+		if (StringUtils.isEmpty(token)) {
+			response.getWriter().print(JSONObject.toJSONString(JSONUtil.getNoAuthMsg(null)));
+			return false;
+		}
+		
+		String q = request.getQueryString();
+		String apiLockKey = token+servlet_path+q;
+		if (apiLock.containsKey(apiLockKey)) {
+			long time = apiLock.get(apiLockKey);
+			if(System.currentTimeMillis() - time < 1000) {
+				response.getWriter().print(JSONObject.toJSONString(JSONUtil.getReSubmitMsg(null)));
+				return false;
+			}
+		}
+		apiLock.put(apiLockKey, System.currentTimeMillis());
+		
+		BaseDAO baseDAO = SpringContext.getContext().getBean(BaseDAO.class);
+		List<UserVO> users = baseDAO.queryByCondition(UserVO.class,
+				" and id='" + token + "' and unix_timestamp(now())<=unix_timestamp(expire_time) ", null);
+		if (users.size() == 0) {
+			response.getWriter().print(JSONObject.toJSONString(JSONUtil.getNoAuthMsg(null)));
+			return false;
+		} else {
+			// 距离2小时时进行自动续期
+			long ntime = new Date().getTime() / 1000;
+			long etime = users.get(0).getExpire_time().getTime() / 1000;
+			if (etime - ntime <= (120 * 60)) {
+				baseDAO.updateSQL("update tbl_user set expire_time=DATE_ADD(expire_time,interval 6 HOUR) where id='"
+						+ token + "' ");
+			}
+			vo = users.get(0);
+		}
+		if (handler instanceof HandlerMethod) {
+			HashMap<String, Object> localMap = new HashMap<String, Object>();
+			localMap.put(Environment.USER, vo);
+			Environment.threadLocal.set(localMap);
+			HandlerMethod hm = (HandlerMethod) handler;
+			OprLogVO ol = new OprLogVO();
+			ol.setCzr(vo.getUser_name());
+			ol.setLm(hm.getBeanType().getName());
+			ol.setFfm(hm.getMethod().getName());
+			baseDAO.insert(ol);
+		}
+		return true;
+	}
+
+	@Override
+	public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
+			throws Exception {
+		Object obj = Environment.threadLocal.get();
+		if (obj != null) {
+			Environment.threadLocal.remove();
+		}
+	}
+
+}

+ 1508 - 0
src/main/java/com/pub/jdbc/BaseDAO.java

@@ -0,0 +1,1508 @@
+package com.pub.jdbc;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.Date;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DataAccessException;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.PreparedStatementCallback;
+import org.springframework.jdbc.core.RowMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import com.admin.user.UserVO;
+import com.google.common.collect.Lists;
+import com.pub.env.Environment;
+import com.pub.exception.BusinessException;
+import com.pub.field.Fields;
+import com.pub.log.Log;
+import com.pub.page.PageRecord;
+import com.pub.system.SystemCache;
+
+@Service
+public class BaseDAO {
+	@Autowired
+	private JdbcTemplate jdbcTemplate = null;
+
+
+	/**
+	 * 除了null,有值就更新
+	 * @param vo
+	 */
+	public void update(SuperVO vo) {
+
+		try {
+			if (!StringUtils.isEmpty(vo.getPrimaryKey())) {
+				vo.setAttribute(Fields.UPDATE_TIME, new Timestamp(System.currentTimeMillis()));
+				if(Environment.getUser() != null) {
+					vo.setAttribute(Fields.UPDATOR, Environment.getUser().getId());
+				}
+				String tableName = vo.getTableName();
+				Map<String, Integer> types = getColumnTypes(tableName);
+				String[] fieldNames = getUpdateValidNames(vo, types, Lists.newArrayList());
+				String updateSQL = getUpdateSQL(tableName, fieldNames, vo);
+				jdbcTemplate.execute(updateSQL, new PreparedStatementCallback<Object>() {
+
+					@Override
+					public Object doInPreparedStatement(PreparedStatement prepare)
+							throws SQLException, DataAccessException {
+						BaseSQLParam sqlParam = getUpdateSQLParam(vo, fieldNames);
+						commitTransaction(prepare, sqlParam, types, fieldNames);
+						prepare.executeUpdate();
+						return null;
+					}
+
+				});
+			}
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("更新数据异常", e);
+		}
+
+	}
+
+	/**
+	 * 根据字段更新,设置了null也会更新
+	 * @param vo
+	 * @param updateFieldList
+	 */
+	public void update(SuperVO vo, List<String> updateFieldList) {
+
+		try {
+			if (!StringUtils.isEmpty(vo.getPrimaryKey())) {
+				vo.setAttribute(Fields.UPDATE_TIME, new Timestamp(System.currentTimeMillis()));
+				if(Environment.getUser() != null) {
+					vo.setAttribute(Fields.UPDATOR, Environment.getUser().getId());
+				}
+				String tableName = vo.getTableName();
+				Map<String, Integer> types = getColumnTypes(tableName);
+				String[] fieldNames = getUpdateValidNames(vo, types, updateFieldList);
+				String updateSQL = getUpdateSQL(tableName, fieldNames, vo);
+				jdbcTemplate.execute(updateSQL, new PreparedStatementCallback<Object>() {
+
+					@Override
+					public Object doInPreparedStatement(PreparedStatement prepare)
+							throws SQLException, DataAccessException {
+						BaseSQLParam sqlParam = getUpdateSQLParam(vo, fieldNames);
+						commitTransaction(prepare, sqlParam, types, fieldNames);
+						prepare.executeUpdate();
+						return null;
+					}
+
+				});
+			}
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("更新数据异常", e);
+		}
+
+	}
+
+	/**
+	 * 根据字段更新,设置了null也会更新
+	 * @param vo
+	 * @param updateFieldList
+	 */
+	public void updateAll(SuperVO vo, List<String> updateFieldList) {
+
+		try {
+			if (true) {
+				vo.setAttribute(Fields.UPDATE_TIME, new Timestamp(System.currentTimeMillis()));
+
+				String tableName = vo.getTableName();
+				Map<String, Integer> types = getColumnTypes(tableName);
+				String[] fieldNames = getUpdateValidNames(vo, types, updateFieldList);
+				String updateSQL = getUpdateSQL(tableName, fieldNames, vo);
+				jdbcTemplate.execute(updateSQL, new PreparedStatementCallback<Object>() {
+
+					@Override
+					public Object doInPreparedStatement(PreparedStatement prepare)
+							throws SQLException, DataAccessException {
+						BaseSQLParam sqlParam = getUpdateSQLParam(vo, fieldNames);
+						commitTransaction(prepare, sqlParam, types, fieldNames);
+						prepare.executeUpdate();
+						return null;
+					}
+
+				});
+			}
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("更新数据异常", e);
+		}
+
+	}
+
+	/**
+	 * 除了null,有值就更新
+	 * @param vo
+	 * @param updateFieldList
+	 */
+	public void updateList(List<? extends SuperVO> voList) {
+		try {
+			if (voList != null && voList.size() > 0) {
+				String tableName = voList.get(0).getTableName();
+				Map<String, Integer> types = getColumnTypes(tableName);
+				String[] fieldNames = getUpdateValidNames(voList.get(0), types, Lists.newArrayList());
+				String updateSQL = getUpdateSQL(tableName, fieldNames, voList.get(0));
+				jdbcTemplate.execute(updateSQL, new PreparedStatementCallback<Object>() {
+
+					@Override
+					public Object doInPreparedStatement(PreparedStatement prepare)
+							throws SQLException, DataAccessException {
+						for (SuperVO vo : voList) {
+							vo.setAttribute(Fields.UPDATE_TIME, new Timestamp(System.currentTimeMillis()));
+							if(Environment.getUser() != null) {
+								vo.setAttribute(Fields.UPDATOR, Environment.getUser().getId());
+							}
+							if (!StringUtils.isEmpty(vo.getPrimaryKey())) {
+								BaseSQLParam sqlParam = getUpdateSQLParam(vo, fieldNames);
+								commitTransaction(prepare, sqlParam, types, fieldNames);
+								prepare.addBatch();
+							}
+						}
+						prepare.executeBatch();
+						return null;
+					}
+
+				});
+			}
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("更新数据异常", e);
+		}
+	}
+
+	/**
+	 * 根据字段更新List,设置了null也会更新
+	 * @param vo
+	 * @param updateFieldList
+	 */
+	public void updateList(List<? extends SuperVO> voList, List<String> updateFieldList) {
+		try {
+			if (voList != null && voList.size() > 0) {
+				String tableName = voList.get(0).getTableName();
+				Map<String, Integer> types = getColumnTypes(tableName);
+				updateFieldList.add(Fields.UPDATE_TIME);
+				updateFieldList.add(Fields.UPDATOR);
+				String[] fieldNames = getUpdateValidNames(voList.get(0), types, updateFieldList);
+				String updateSQL = getUpdateSQL(tableName, fieldNames, voList.get(0));
+				jdbcTemplate.execute(updateSQL, new PreparedStatementCallback<Object>() {
+
+					@Override
+					public Object doInPreparedStatement(PreparedStatement prepare)
+							throws SQLException, DataAccessException {
+						for (SuperVO vo : voList) {
+							vo.setAttribute(Fields.UPDATE_TIME, new Timestamp(System.currentTimeMillis()));
+							if(Environment.getUser() != null) {
+								vo.setAttribute(Fields.UPDATOR, Environment.getUser().getId());
+							}
+							if (!StringUtils.isEmpty(vo.getPrimaryKey())) {
+								BaseSQLParam sqlParam = getUpdateSQLParam(vo, fieldNames);
+								commitTransaction(prepare, sqlParam, types, fieldNames);
+								prepare.addBatch();
+							}
+						}
+						prepare.executeBatch();
+						return null;
+					}
+
+				});
+			}
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("更新数据异常", e);
+		}
+	}
+
+	/**
+	 * 除了null,有值就更新
+	 * @param vo
+	 * @param updateFieldList
+	 */
+	public void updateArray(SuperVO[] vo) {
+		try {
+			updateList(Arrays.asList(vo));
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("更新数据异常", e);
+		}
+	}
+
+	/**
+	 * 根据字段更新Array,设置了null也会更新
+	 * @param vo
+	 * @param updateFieldList
+	 */
+	public void updateArray(SuperVO[] vo, List<String> updateFieldList) {
+		try {
+			updateList(Arrays.asList(vo), updateFieldList);
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("更新数据异常", e);
+		}
+	}
+
+	/**
+	 * 根据SQL进行更新
+	 * @param sql
+	 */
+	public void updateSQL(String sql) {
+		jdbcTemplate.update(sql);
+	}
+
+	/**
+	 * 插入数据
+	 * @param vo
+	 * @return
+	 */
+	public String insert(SuperVO vo) {
+		try {
+			String pk = "";
+			if (StringUtils.isEmpty(vo.getPrimaryKey())) {
+				pk = UUID.randomUUID().toString();
+			} else {
+				pk = vo.getPrimaryKey();
+			}
+			vo.setPrimaryKey(pk);
+			if (vo.getAttribute(Fields.CREATE_TIME) == null) {
+				vo.setAttribute(Fields.CREATE_TIME, new Timestamp(System.currentTimeMillis()));
+			}
+			HashMap<String, Object> map = Environment.threadLocal.get();
+			if (map != null) {
+				UserVO person = (UserVO) map.get(Environment.USER);
+				if (StringUtils.isEmpty(vo.getAttribute(Fields.OPERATOR)) && person != null) {
+					vo.setAttribute(Fields.OPERATOR, person.getId());
+				}
+				if (StringUtils.isEmpty(vo.getAttribute(Fields.ORG)) && person != null) {
+					vo.setAttribute(Fields.ORG, person.getSszz_id());
+				}
+			}
+			vo.setAttribute(Fields.DR, 0);
+			String tableName = vo.getTableName();
+			Map<String, Integer> types = getColumnTypes(tableName);
+			String[] fieldNames = getValidNames(vo, types);
+			String sql = getInsertSQL(tableName, fieldNames);
+			jdbcTemplate.execute(sql, new PreparedStatementCallback<Object>() {
+				@Override
+				public Object doInPreparedStatement(PreparedStatement prepare)
+						throws SQLException, DataAccessException {
+					BaseSQLParam sqlParam = getSQLParam(vo, fieldNames);
+					commitTransaction(prepare, sqlParam, types, fieldNames);
+					prepare.executeUpdate();
+					return null;
+				}
+
+			});
+			return pk;
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("插入数据异常", e);
+		}
+	}
+
+	/**
+	 * 插入数据(wy)
+	 * @param vo
+	 */
+	public void insertAll(SuperVO vo) {
+		try {
+			// 设置创建时间为当前时间
+			if (vo.getAttribute(Fields.CREATE_TIME) == null) {
+				vo.setAttribute(Fields.CREATE_TIME, new Timestamp(System.currentTimeMillis()));
+
+			}
+			String tableName = vo.getTableName();
+			Map<String, Integer> types = getColumnTypes(tableName);
+			// 主键递增
+			types.remove("ID");
+			String[] fieldNames = getValidNames(vo, types);
+			String sql = getInsertSQL(tableName, fieldNames);
+			jdbcTemplate.execute(sql, new PreparedStatementCallback<Object>() {
+				@Override
+				public Object doInPreparedStatement(PreparedStatement prepare)
+						throws SQLException, DataAccessException {
+					BaseSQLParam sqlParam = getSQLParam(vo, fieldNames);
+					commitTransaction(prepare, sqlParam, types, fieldNames);
+					prepare.executeUpdate();
+					return null;
+				}
+			});
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("插入数据异常", e);
+		}
+	}
+
+	/**
+	 * 插入数组
+	 * @param vo
+	 * @return
+	 */
+	public String[] insertArray(SuperVO[] vos) {
+		return insertList(Arrays.asList(vos));
+	}
+
+	/**
+	 * 批量插入List
+	 * @param vos
+	 * @return
+	 */
+	public String[] insertList(List<? extends SuperVO> vos) {
+		List<String> pks = new ArrayList<String>();
+		try {
+			if (vos != null && vos.size() > 0) {
+				String tableName = vos.get(0).getTableName();
+				Map<String, Integer> types = getColumnTypes(tableName);
+				String[] fieldNames = getValidNames(vos.get(0), types);
+				String sql = getInsertSQL(tableName, fieldNames);
+				jdbcTemplate.execute(sql, new PreparedStatementCallback<Object>() {
+					@Override
+					public Object doInPreparedStatement(PreparedStatement prepare)
+							throws SQLException, DataAccessException {
+						for (SuperVO vo : vos) {
+							String pk = "";
+							if (StringUtils.isEmpty(vo.getPrimaryKey())) {
+								pk = UUID.randomUUID().toString();
+							} else {
+								pk = vo.getPrimaryKey();
+							}
+							vo.setPrimaryKey(pk);
+							if (vo.getAttribute(Fields.CREATE_TIME) == null) {
+								vo.setAttribute(Fields.CREATE_TIME, new Timestamp(System.currentTimeMillis()));
+							}
+							HashMap<String, Object> map = Environment.threadLocal.get();
+							if (map != null) {
+								UserVO person = (UserVO) map.get(Environment.USER);
+								if (StringUtils.isEmpty(vo.getAttribute(Fields.OPERATOR)) && person != null) {
+									vo.setAttribute(Fields.OPERATOR, person.getId());
+								}
+								if (StringUtils.isEmpty(vo.getAttribute(Fields.ORG)) && person != null) {
+									vo.setAttribute(Fields.ORG, person.getSszz_id());
+								}
+							}
+							vo.setAttribute(Fields.DR, 0);
+							BaseSQLParam sqlParam = getSQLParam(vo, fieldNames);
+							commitTransaction(prepare, sqlParam, types, fieldNames);
+							prepare.addBatch();
+							pks.add(pk);
+						}
+						prepare.executeBatch();
+						return null;
+					}
+
+				});
+
+			}
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("插入数据异常", e);
+		}
+		return pks.toArray(new String[0]);
+	}
+
+	/**
+	 * 根据条件进行查询所有数据
+	 * @param <T>
+	 * @param clazz
+	 * @param condition
+	 * @param sortSQL
+	 * @return
+	 */
+	public <T> List<T> queryByCondition(Class<? extends SuperVO> clazz, String condition, String sortSQL) {
+		try {
+			List<T> list = new ArrayList<T>();
+			SuperVO vo = clazz.newInstance();
+			String tableName = vo.getTableName();
+			Map<String, Integer> types = getColumnTypes(tableName);
+			String[] fieldNames = getValidNames(vo, types);
+			String sql = getQuerySQL(tableName, fieldNames, condition);
+
+			if (sql == null) {
+				return list;
+			}
+			sql = addSortSQL(sql, sortSQL);
+			list = jdbcTemplate.query(sql, new RowMapper<T>() {
+				@SuppressWarnings("unchecked")
+				@Override
+				public T mapRow(ResultSet rs, int arg1) throws SQLException {
+					SuperVO rs2vo = null;
+					try {
+						rs2vo = (SuperVO) clazz.newInstance();
+						rs2vo(rs2vo, rs, fieldNames);
+					} catch (Exception e) {
+						Log.error(e);
+						e.printStackTrace();
+					}
+					return (T) rs2vo;
+				}
+
+			});
+			return list;
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("查询数据异常", e);
+		}
+	}
+
+	/**
+	 * 根据条件进行查询所有数据(wy)
+	 * @param <T>
+	 * @param clazz
+	 * @param condition
+	 * @param sortSQL
+	 * @return
+	 */
+	public <T> List<T> queryAllByCondition(Class<? extends SuperVO> clazz, String condition, String sortSQL) {
+		try {
+			List<T> list = new ArrayList<T>();
+			SuperVO vo = clazz.newInstance();
+			String tableName = vo.getTableName();
+			Map<String, Integer> types = getColumnTypes(tableName);
+			String[] fieldNames = getValidNames(vo, types);
+			String sql = getQueryAllSQL(tableName, fieldNames, condition);
+			if (sql == null) {
+				return list;
+			}
+			sql = addSortSQL(sql, sortSQL);
+			list = jdbcTemplate.query(sql, new RowMapper<T>() {
+				@SuppressWarnings("unchecked")
+				@Override
+				public T mapRow(ResultSet rs, int arg1) throws SQLException {
+					SuperVO rs2vo = null;
+					try {
+						rs2vo = (SuperVO) clazz.newInstance();
+						rs2vo(rs2vo, rs, fieldNames);
+					} catch (Exception e) {
+						Log.error(e);
+						e.printStackTrace();
+					}
+					return (T) rs2vo;
+				}
+
+			});
+			return list;
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("查询数据异常", e);
+		}
+	}
+
+	/**
+	 * 根据条件进行查询所有数据不关心删除标记(wy)
+	 * @param <T>
+	 * @param clazz
+	 * @param condition
+	 * @param sortSQL
+	 * @return
+	 */
+	public <T> List<T> queryAllByConditionNocare(Class<? extends SuperVO> clazz, String condition, String sortSQL) {
+		try {
+			List<T> list = new ArrayList<T>();
+			SuperVO vo = clazz.newInstance();
+			String tableName = vo.getTableName();
+			Map<String, Integer> types = getColumnTypes(tableName);
+			String[] fieldNames = getValidNames(vo, types);
+			String sql = getQueryAllSQLNocare(tableName, fieldNames, condition);
+
+			if (sql == null) {
+				return list;
+			}
+			sql = addSortSQL(sql, sortSQL);
+			list = jdbcTemplate.query(sql, new RowMapper<T>() {
+				@SuppressWarnings("unchecked")
+				@Override
+				public T mapRow(ResultSet rs, int arg1) throws SQLException {
+					SuperVO rs2vo = null;
+					try {
+						rs2vo = (SuperVO) clazz.newInstance();
+						rs2vo(rs2vo, rs, fieldNames);
+					} catch (Exception e) {
+						Log.error(e);
+						e.printStackTrace();
+					}
+					return (T) rs2vo;
+				}
+
+			});
+			return list;
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("查询数据异常", e);
+		}
+	}
+
+	/**
+	 * 根据条件进行查询分页数据
+	 * @param <T>
+	 * @param clazz
+	 * @param condition
+	 * @param pageSize
+	 * @param pageNum
+	 * @param sortSQL
+	 * @return
+	 */
+	public <T> PageRecord<T> queryAllPaginateByCondition(Class<? extends SuperVO> clazz, String condition,
+			Integer pageSize, Integer pageNum, String sortSQL) {
+		PageRecord<T> page = new PageRecord<T>();
+		try {
+
+			List<T> list = new ArrayList<T>();
+			SuperVO vo = clazz.newInstance();
+			String tableName = vo.getTableName();
+			Map<String, Integer> types = getColumnTypes(tableName);
+			String[] fieldNames = getValidNames(vo, types);
+			String sql = getQueryAllSQL(tableName, fieldNames, condition);
+
+			if (sql == null || pageSize == null || pageNum == null) {
+				return page;
+			}
+			String count_sql = sql;
+			sql = addSortSQL(sql, sortSQL);
+			Long total = jdbcTemplate.queryForObject("select count(*) from (" + count_sql + ") tt ", Long.class);
+			page.setTotal(total);
+			Integer totalPageNum;
+			if (total % pageSize == 0) {
+				totalPageNum = total.intValue() / pageSize;
+			} else {
+				totalPageNum = (total.intValue() / pageSize) + 1;
+			}
+			if (pageNum > totalPageNum) {
+				page.setOutTotalPageNum(true);
+			}
+			page.setTotalPageNum(totalPageNum);
+			page.setPageNum(pageNum);
+			page.setPageSize(pageSize);
+			sql = sql + " limit " + (pageNum - 1) * pageSize + "," + pageSize;
+			list = jdbcTemplate.query(sql, new RowMapper<T>() {
+				@SuppressWarnings("unchecked")
+				@Override
+				public T mapRow(ResultSet rs, int arg1) throws SQLException {
+					SuperVO rs2vo = null;
+					try {
+						rs2vo = (SuperVO) clazz.newInstance();
+						rs2vo(rs2vo, rs, fieldNames);
+					} catch (Exception e) {
+						Log.error(e);
+						e.printStackTrace();
+					}
+					return (T) rs2vo;
+				}
+
+			});
+			page.setRows(list);
+			return page;
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("查询数据异常", e);
+		}
+
+	}
+
+	/**
+	 * 根据条件进行查询分页数据
+	 * @param <T>
+	 * @param clazz
+	 * @param condition
+	 * @param pageSize
+	 * @param pageNum
+	 * @param sortSQL
+	 * @return
+	 */
+	public <T> PageRecord<T> queryPaginateByCondition(Class<? extends SuperVO> clazz, String condition,
+			Integer pageSize, Integer pageNum, String sortSQL) {
+		PageRecord<T> page = new PageRecord<T>();
+		try {
+
+			List<T> list = new ArrayList<T>();
+			SuperVO vo = clazz.newInstance();
+			String tableName = vo.getTableName();
+			Map<String, Integer> types = getColumnTypes(tableName);
+			String[] fieldNames = getValidNames(vo, types);
+			String sql = getQuerySQL(tableName, fieldNames, condition);
+
+			if (sql == null || pageSize == null || pageNum == null) {
+				return page;
+			}
+			String count_sql = sql;
+			sql = addSortSQL(sql, sortSQL);
+			Long total = jdbcTemplate.queryForObject("select count(*) from (" + count_sql + ") tt ", Long.class);
+			page.setTotal(total);
+			Integer totalPageNum;
+			if (total % pageSize == 0) {
+				totalPageNum = total.intValue() / pageSize;
+			} else {
+				totalPageNum = (total.intValue() / pageSize) + 1;
+			}
+			if (pageNum > totalPageNum) {
+				page.setOutTotalPageNum(true);
+			}
+			page.setTotalPageNum(totalPageNum);
+			page.setPageNum(pageNum);
+			page.setPageSize(pageSize);
+			sql = sql + " limit " + (pageNum - 1) * pageSize + "," + pageSize;
+			list = jdbcTemplate.query(sql, new RowMapper<T>() {
+				@SuppressWarnings("unchecked")
+				@Override
+				public T mapRow(ResultSet rs, int arg1) throws SQLException {
+					SuperVO rs2vo = null;
+					try {
+						rs2vo = (SuperVO) clazz.newInstance();
+						rs2vo(rs2vo, rs, fieldNames);
+					} catch (Exception e) {
+						Log.error(e);
+						e.printStackTrace();
+					}
+					return (T) rs2vo;
+				}
+
+			});
+			page.setRows(list);
+			return page;
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("查询数据异常", e);
+		}
+
+	}
+
+	/**
+	 * 根据主键查询
+	 * @param <T>
+	 * @param clazz
+	 * @param pk
+	 * @return
+	 */
+	public <T> T queryByPK(Class<? extends SuperVO> clazz, String pk) {
+		try {
+			List<SuperVO> list = new ArrayList<SuperVO>();
+			SuperVO vo = (SuperVO) clazz.newInstance();
+			String tableName = vo.getTableName();
+			Map<String, Integer> types = getColumnTypes(tableName);
+			String[] fieldNames = getValidNames(vo, types);
+			String sql = getQueryByPK(vo, tableName, fieldNames, pk);
+
+			if (sql == null) {
+				return null;
+			}
+			list = jdbcTemplate.query(sql, new RowMapper<SuperVO>() {
+				@Override
+				public SuperVO mapRow(ResultSet rs, int arg1) throws SQLException {
+					rs2vo(vo, rs, fieldNames);
+					return vo;
+				}
+
+			});
+			if ((list != null) && (list.size() != 0)) {
+				return (T) list.get(0);
+			}
+			return null;
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("查询数据异常", e);
+		}
+	}
+
+	/**
+	 * 根据键名查询
+	 * @author wy
+	 * @param <T>
+	 * @param clazz
+	 * @param pk
+	 * @return
+	 */
+	public <T> T queryByKey(Class<? extends SuperVO> clazz,String keyName, String k) {
+		try {
+			List<SuperVO> list = new ArrayList<SuperVO>();
+			SuperVO vo = (SuperVO) clazz.newInstance();
+			String tableName = vo.getTableName();
+			Map<String, Integer> types = getColumnTypes(tableName);
+			String[] fieldNames = getValidNames(vo, types);
+			String sql = getQueryByKey(vo, tableName, fieldNames, keyName, k);
+			if (sql == null) {
+				return null;
+			}
+			list = jdbcTemplate.query(sql, new RowMapper<SuperVO>() {
+				@Override
+				public SuperVO mapRow(ResultSet rs, int arg1) throws SQLException {
+					rs2vo(vo, rs, fieldNames);
+					return vo;
+				}
+
+			});
+			if ((list != null) && (list.size() != 0)) {
+				return (T) list.get(0);
+			}
+			return null;
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("查询数据异常", e);
+		}
+	}
+
+	/**
+	 * 根据SQL查询数据
+	 * @param sql
+	 * @return
+	 */
+	public List<Map<String, Object>> queryBySQL(String sql) {
+		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
+		list = jdbcTemplate.query(sql, new RowMapper<Map<String, Object>>() {
+			@Override
+			public Map<String, Object> mapRow(ResultSet rs, int arg1) throws SQLException {
+				Map<String, Object> map = new HashMap<String, Object>();
+				int columncount = rs.getMetaData().getColumnCount();
+				for (int i = 0; i < columncount; ++i) {
+					String name = rs.getMetaData().getColumnLabel(i + 1);
+					Object obj = rs.getObject(i + 1);
+					if (obj instanceof oracle.sql.TIMESTAMP) {
+						oracle.sql.TIMESTAMP timestamp = (oracle.sql.TIMESTAMP) obj;
+						obj = timestamp.timestampValue();
+					} else if (obj instanceof Date) {
+						Date date = (Date) obj;
+						obj = new java.util.Date(date.getTime());
+					}
+					map.put(name.toLowerCase(), obj);
+				}
+				return map;
+			}
+
+		});
+		return list;
+	}
+
+	/**
+	 * 根据SQL查询分页数据
+	 * @param sql
+	 * @param pageSize
+	 * @param pageNum
+	 * @param sortSQL
+	 * @return
+	 */
+	public PageRecord<Map<String, Object>> queryPaginateBySQL(String sql, Integer pageSize, Integer pageNum,
+			String sortSQL) {
+		String count_sql = sql;
+		sql = addSortSQL(sql, sortSQL);
+		PageRecord<Map<String, Object>> page = new PageRecord<Map<String, Object>>();
+		Long total = jdbcTemplate.queryForObject("select count(*) from (" + count_sql + ") t1", Long.class);
+		page.setTotal(total);
+		Integer totalPageNum;
+		if (total % pageSize == 0) {
+			totalPageNum = total.intValue() / pageSize;
+		} else {
+			totalPageNum = (total.intValue() / pageSize) + 1;
+		}
+		if (pageNum > totalPageNum) {
+			page.setOutTotalPageNum(true);
+		}
+		page.setTotalPageNum(totalPageNum);
+		page.setPageNum(pageNum);
+		page.setPageSize(pageSize);
+		sql = sql + " limit " + (pageNum - 1) * pageSize + "," + pageSize;
+		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
+		list = jdbcTemplate.query(sql, new RowMapper<Map<String, Object>>() {
+			@Override
+			public Map<String, Object> mapRow(ResultSet rs, int arg1) throws SQLException {
+				Map<String, Object> map = new HashMap<String, Object>();
+				int columncount = rs.getMetaData().getColumnCount();
+				for (int i = 0; i < columncount; ++i) {
+					String name = rs.getMetaData().getColumnLabel(i + 1);
+					Object obj = rs.getObject(i + 1);
+					if (obj instanceof oracle.sql.TIMESTAMP) {
+						oracle.sql.TIMESTAMP timestamp = (oracle.sql.TIMESTAMP) obj;
+						obj = timestamp.timestampValue();
+					} else if (obj instanceof Date) {
+						Date date = (Date) obj;
+						obj = new java.util.Date(date.getTime());
+					}
+					map.put(name.toLowerCase(), obj);
+				}
+				return map;
+			}
+
+		});
+		page.setRows(list);
+		return page;
+	}
+
+	/**
+	 * 根据SQL查询所有数据
+	 * @param <T>
+	 * @param clazz
+	 * @param sql
+	 * @return
+	 */
+	public <T> List<T> queryBySQL(Class<? extends SuperVO> clazz, String sql) {
+		List<T> list = new ArrayList<T>();
+		list = jdbcTemplate.query(sql, new RowMapper<T>() {
+			@Override
+			public T mapRow(ResultSet rs, int arg1) throws SQLException {
+				try {
+					SuperVO superVO = clazz.newInstance();
+					int columncount = rs.getMetaData().getColumnCount();
+					for (int i = 0; i < columncount; ++i) {
+						String name = rs.getMetaData().getColumnLabel(i + 1);
+						Object obj = rs.getObject(i + 1);
+						if (obj instanceof oracle.sql.TIMESTAMP) {
+							oracle.sql.TIMESTAMP timestamp = (oracle.sql.TIMESTAMP) obj;
+							obj = timestamp.timestampValue();
+						} else if (obj instanceof Date) {
+							Date date = (Date) obj;
+							obj = new java.util.Date(date.getTime());
+						}
+						superVO.setAttribute(name.toLowerCase(), obj);
+					}
+					return (T) superVO;
+				} catch (Exception e) {
+					Log.error(e);
+					e.printStackTrace();
+					throw new BusinessException("查询数据异常", e);
+				}
+			}
+
+		});
+		return list;
+	}
+
+	/**
+	 * 根据SQL查询分页数据
+	 * @param <T>
+	 * @param clazz
+	 * @param sql
+	 * @param pageSize
+	 * @param pageNum
+	 * @param sortSQL
+	 * @return
+	 */
+	public <T> PageRecord<T> queryPaginateBySQL(Class<? extends SuperVO> clazz, String sql, Integer pageSize,
+			Integer pageNum, String sortSQL) {
+		String count_sql = sql;
+		sql = addSortSQL(sql, sortSQL);
+		PageRecord<T> page = new PageRecord<T>();
+		List<T> list = new ArrayList<T>();
+		if (StringUtils.isEmpty(sql) || StringUtils.isEmpty(pageSize) || StringUtils.isEmpty(pageNum)) {
+			return page;
+		}
+		Long total = jdbcTemplate.queryForObject("select count(*) from (" + count_sql + ") t1", Long.class);
+		page.setTotal(total);
+		Integer totalPageNum;
+		if (total % pageSize == 0) {
+			totalPageNum = total.intValue() / pageSize;
+		} else {
+			totalPageNum = (total.intValue() / pageSize) + 1;
+		}
+		if (pageNum > totalPageNum) {
+			page.setOutTotalPageNum(true);
+		}
+		page.setTotalPageNum(totalPageNum);
+		page.setPageNum(pageNum);
+		page.setPageSize(pageSize);
+		sql = sql + " limit " + (pageNum - 1) * pageSize + "," + pageSize;
+		list = jdbcTemplate.query(sql, new RowMapper<T>() {
+			@Override
+			public T mapRow(ResultSet rs, int arg1) throws SQLException {
+				try {
+					SuperVO superVO = clazz.newInstance();
+					int columncount = rs.getMetaData().getColumnCount();
+					for (int i = 0; i < columncount; ++i) {
+						String name = rs.getMetaData().getColumnLabel(i + 1);
+						Object obj = rs.getObject(i + 1);
+						if (obj instanceof oracle.sql.TIMESTAMP) {
+							oracle.sql.TIMESTAMP timestamp = (oracle.sql.TIMESTAMP) obj;
+							obj = timestamp.timestampValue();
+						} else if (obj instanceof Date) {
+							Date date = (Date) obj;
+							obj = new java.util.Date(date.getTime());
+						}
+						superVO.setAttribute(name.toLowerCase(), obj);
+					}
+					return (T) superVO;
+				} catch (Exception e) {
+					Log.error(e);
+					e.printStackTrace();
+					throw new BusinessException("查询数据异常", e);
+				}
+			}
+
+		});
+		page.setRows(list);
+		return page;
+	}
+
+	/**
+	 * 根据主键删除数据
+	 * @param clazz
+	 * @param pk
+	 */
+	public void deleteByPK(Class<? extends SuperVO> clazz, String pk) {
+		try {
+			SuperVO vo = clazz.newInstance();
+			String tableName = vo.getTableName();
+			String pkname = vo.getPKFieldName();
+			HashMap<String, Object> map = Environment.threadLocal.get();
+			String del_sql = "";
+			if (map != null) {
+				UserVO person = (UserVO) map.get(Environment.USER);
+				if (person != null) {
+					del_sql = ",del_opr='" + person.getId() + "' ";
+				}
+			}
+			String sql = "update " + tableName + " set dr=1,del_time=now()" + del_sql + " where " + pkname + "='" + pk
+					+ "'";
+			jdbcTemplate.update(sql);
+			deleteRecursion(clazz, pk);
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("删除数据异常", e);
+		}
+	}
+
+	/**
+	 * 根据键名删除数据
+	 * @param clazz
+	 * @param keyName
+	 * @param k
+	 */
+	public void deleteByKey(Class<? extends SuperVO> clazz,String keyName,String k) {
+		try {
+			SuperVO vo = clazz.newInstance();
+			String tableName =vo.getTableName();
+			String sql = "update " + tableName + " set delete_tag=1,delete_time=now()" + " where " + keyName + "='" + k+ "'";
+			jdbcTemplate.update(sql);
+//			deleteRecursion(clazz, k);
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("删除数据异常", e);
+		}
+	}
+
+	/**
+	 * 递归删除级联数据
+	 * @param clazz
+	 * @param pk
+	 * @throws InstantiationException
+	 * @throws IllegalAccessException
+	 */
+	private void deleteRecursion(Class<? extends SuperVO> clazz, String pk)
+			throws InstantiationException, IllegalAccessException {
+		CascadeMetadata[] childs = clazz.newInstance().getChildCascadeMetadata();
+		if (childs != null) {
+			for (CascadeMetadata md : childs) {
+				List<? extends SuperVO> vos = queryByCondition(md.getClazz(),
+						" and " + md.getParentFieldName() + "='" + pk + "'", null);
+				if (vos.size() != 0) {
+					deleteByCondition(md.getClazz(), " and " + md.getParentFieldName() + "='" + pk + "'");
+					for (SuperVO vo : vos) {
+						deleteRecursion(md.getClazz(), vo.getPrimaryKey());
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * 根据条件删除数据
+	 * @param clazz
+	 * @param condition
+	 */
+	public void deleteByCondition(Class<? extends SuperVO> clazz, String condition) {
+		try {
+			List<? extends SuperVO> vos = queryByCondition(clazz, condition, null);
+			deleteList(vos);
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("删除数据异常", e);
+		}
+	}
+
+	/**
+	 * 删除一个List
+	 * @param delList
+	 */
+	public void deleteList(List<? extends SuperVO> delList) {
+		try {
+			if (delList != null && delList.size() > 0) {
+				for (SuperVO vo : delList) {
+					deleteByPK(vo.getClass(), vo.getPrimaryKey());
+				}
+			}
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("删除数据异常", e);
+		}
+	}
+
+	/**
+	 * 删除一个数组
+	 * @param supers
+	 */
+	public void deleteArray(SuperVO[] supers) {
+		try {
+			deleteList(Arrays.asList(supers));
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("删除数据异常", e);
+		}
+	}
+
+	/**
+	 * 将结果集转换成对象
+	 * @param rs2vo
+	 * @param rs
+	 * @param fieldNames
+	 */
+	private void rs2vo(SuperVO rs2vo, ResultSet rs, String[] fieldNames) {
+		try {
+			for (String field : fieldNames) {
+				field = field.toUpperCase();
+				Object obj = rs.getObject(field);
+				if (obj != null) {
+					if (obj instanceof oracle.sql.TIMESTAMP) {
+						oracle.sql.TIMESTAMP timestamp = (oracle.sql.TIMESTAMP) obj;
+						obj = timestamp.timestampValue();
+					} else if (obj instanceof Date) {
+						Date date = (Date) obj;
+						obj = new java.util.Date(date.getTime());
+					}
+				}
+				rs2vo.setAttribute(field.toLowerCase(), obj);
+			}
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("删除数据异常", e);
+		}
+	}
+
+	/**
+	 * 获得查询SQL
+	 * @param tableName
+	 * @param fieldNames
+	 * @param condition
+	 * @return
+	 */
+	private String getQuerySQL(String tableName, String[] fieldNames, String condition) {
+		if (condition == null) {
+			condition = "";
+		}
+		condition = condition + " and IFNULL(dr,0)=0";
+		StringBuffer sb = new StringBuffer();
+		if (fieldNames.length != 0) {
+			sb.append("select ");
+			for (String field : fieldNames) {
+				sb.append(field + ",");
+			}
+			sb.setLength(sb.length() - 1);
+			sb.append(" from " + tableName + " where 1=1 ");
+			if (condition != null && !condition.trim().equals("")) {
+				sb.append(condition);
+			}
+			return sb.toString();
+		}
+		return null;
+	}
+
+	/**
+	 * 获得查询SQL(wy)
+	 * @param tableName
+	 * @param fieldNames
+	 * @param condition
+	 * @return
+	 */
+	private String getQueryAllSQL(String tableName, String[] fieldNames, String condition) {
+		if (condition == null) {
+			condition = "";
+		}
+		condition = condition + " and IFNULL(delete_tag,0)=0";
+		StringBuffer sb = new StringBuffer();
+		if (fieldNames.length != 0) {
+			sb.append("select ");
+			for (String field : fieldNames) {
+				sb.append(field + ",");
+			}
+			sb.setLength(sb.length() - 1);
+			sb.append(" from " + tableName + " where 1=1 ");
+			if (condition != null && !condition.trim().equals("")) {
+				sb.append(condition);
+			}
+//			Log.info(sb.toString());
+			return sb.toString();
+		}
+		return null;
+	}
+
+	/**
+	 * 获得查询SQL不关心删除标记(wy)
+	 * @param tableName
+	 * @param fieldNames
+	 * @param condition
+	 * @return
+	 */
+	private String getQueryAllSQLNocare(String tableName, String[] fieldNames, String condition) {
+		if (condition == null) {
+			condition = "";
+		}
+		StringBuffer sb = new StringBuffer();
+		if (fieldNames.length != 0) {
+			sb.append("select ");
+			for (String field : fieldNames) {
+				sb.append(field + ",");
+			}
+			sb.setLength(sb.length() - 1);
+			sb.append(" from " + tableName + " where 1=1 ");
+			if (condition != null && !condition.trim().equals("")) {
+				sb.append(condition);
+			}
+			Log.info(sb.toString());
+			return sb.toString();
+		}
+		return null;
+	}
+
+	/**
+	 * 根据主键获得查询语句
+	 * @param vo
+	 * @param tableName
+	 * @param fieldNames
+	 * @param pk
+	 * @return
+	 */
+	private String getQueryByPK(SuperVO vo, String tableName, String[] fieldNames, String pk) {
+		StringBuffer sb = new StringBuffer();
+		if (fieldNames.length != 0) {
+			sb.append("select ");
+			for (String field : fieldNames) {
+				sb.append(field + ",");
+			}
+			sb.setLength(sb.length() - 1);
+			sb.append(" from " + tableName);
+			sb.append(" where " + vo.getPKFieldName() + "='" + pk + "'");
+			return sb.toString();
+		}
+		return null;
+	}
+
+	/**
+	 * 根据键名获得查询语句
+	 * @author wy
+	 * @param vo
+	 * @param tableName
+	 * @param fieldNames
+	 * @param pk
+	 * @return
+	 */
+	private String getQueryByKey(SuperVO vo, String tableName, String[] fieldNames, String keyName,String k) {
+		StringBuffer sb = new StringBuffer();
+		if (fieldNames.length != 0) {
+			sb.append("select ");
+			for (String field : fieldNames) {
+				sb.append(field + ",");
+			}
+			sb.setLength(sb.length() - 1);
+			sb.append(" from " + tableName);
+			sb.append(" where " + keyName+ "='" + k + "'");
+			return sb.toString();
+		}
+		return null;
+	}
+
+	/**
+	 * 获得数据库表的列名信息
+	 * @param table
+	 * @return
+	 */
+	private Map<String, Integer> getColumnTypes(String table) {
+		try {
+			HashMap<String, Integer> typeMap = new HashMap<String, Integer>();
+			if (SystemCache.table_cache.containsKey(table)) {
+				return SystemCache.table_cache.get(table);
+			}
+			Connection conn = jdbcTemplate.getDataSource().getConnection();
+			DatabaseMetaData dbMetaData = conn.getMetaData();
+			ResultSet rsColumns = null;
+			rsColumns = dbMetaData.getColumns(null, null, table, "%");
+			while (rsColumns.next()) {
+				String columnName = rsColumns.getString("COLUMN_NAME").toUpperCase();
+				int columnType = rsColumns.getShort("DATA_TYPE");
+				typeMap.put(columnName, new Integer(columnType));
+			}
+			rsColumns.close();
+			conn.close();
+			SystemCache.table_cache.put(table, typeMap);
+			return typeMap;
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("获得表的元数据产生异常", e);
+		}
+	}
+
+	/**
+	 * 设置PreparedStatement
+	 * @param prepareStatement
+	 * @param sqlParam
+	 * @param types
+	 * @param fieldName
+	 */
+	private void commitTransaction(PreparedStatement prepareStatement, BaseSQLParam sqlParam,
+			Map<String, Integer> types, String[] fieldName) {
+		try {
+			List<?> list = sqlParam.getList();
+			for (int i = 0; i < list.size(); ++i) {
+				Object obj = list.get(i);
+				if (obj instanceof Timestamp) {
+					prepareStatement.setTimestamp(i + 1, (Timestamp) obj);
+				} else if (obj instanceof java.util.Date) {
+					prepareStatement.setDate(i + 1, new Date(((java.util.Date) obj).getTime()));
+				} else {
+					prepareStatement.setObject(i + 1, obj);
+				}
+			}
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("设置数据异常", e);
+		}
+	}
+
+	/**
+	 * 获得插入的SQL参数
+	 * @param vo
+	 * @param fieldNames
+	 * @return
+	 */
+	private BaseSQLParam getSQLParam(SuperVO vo, String[] fieldNames) {
+		BaseSQLParam sqlParam = new BaseSQLParam();
+		for (String fieldName : fieldNames) {
+			sqlParam.addParam(vo.getAttribute(fieldName));
+		}
+		return sqlParam;
+	}
+
+	/**
+	 * 获得更新的SQL参数
+	 * @param vo
+	 * @param fieldNames
+	 * @return
+	 */
+	private BaseSQLParam getUpdateSQLParam(SuperVO vo, String[] fieldNames) {
+		BaseSQLParam sqlParam = new BaseSQLParam();
+		String pkValue = "";
+		for (String fieldName : fieldNames) {
+			if (!fieldName.equals(vo.getPKFieldName()))
+				sqlParam.addParam(vo.getAttribute(fieldName));
+			else {
+				pkValue = (String) vo.getAttribute(fieldName);
+			}
+		}
+		sqlParam.addParam(pkValue);
+		return sqlParam;
+	}
+
+	/**
+	 * 获得插入SQL
+	 * @param table
+	 * @param names
+	 * @return
+	 */
+	private String getInsertSQL(String table, String[] names) {
+		StringBuffer buffer = new StringBuffer("INSERT INTO " + table + " (");
+		for (int i = 0; i < names.length; ++i) {
+			buffer.append(names[i] + ",");
+		}
+		buffer.setLength(buffer.length() - 1);
+		buffer.append(") VALUES (");
+		for (int i = 0; i < names.length; ++i) {
+			buffer.append("?,");
+		}
+		buffer.setLength(buffer.length() - 1);
+		buffer.append(")");
+		return buffer.toString();
+	}
+
+	/**
+	 * 获得更新SQL
+	 * @param table
+	 * @param names
+	 * @param vo
+	 * @return
+	 */
+	private String getUpdateSQL(String table, String[] names, SuperVO vo) {
+		StringBuffer buffer = new StringBuffer("UPDATE " + table + " SET ");
+		for (String name : names) {
+			if (!name.equals(vo.getPKFieldName())) {
+				buffer.append(name + "=?,");
+			}
+		}
+		buffer.setLength(buffer.length() - 1);
+		buffer.append(" where " + vo.getPKFieldName() + "=?");
+		return buffer.toString();
+	}
+
+	/**
+	 * 获得更新SQL
+	 * @author wy
+	 * @param table
+	 * @param names
+	 * @param vo
+	 * @return
+	 */
+	private String getUpdateAllSQL(String table, String[] names, SuperVO vo) {
+		StringBuffer buffer = new StringBuffer("UPDATE " + table + " SET ");
+		for (String name : names) {
+			if (!name.equals(vo.getPKFieldName())) {
+				buffer.append(name + "=?,");
+			}
+		}
+		buffer.setLength(buffer.length() - 1);
+		buffer.append(" where dev_id =?");
+		return buffer.toString();
+	}
+
+	/**
+	 * 获得插入和查询数据时有效的列名
+	 * @param vo
+	 * @param types
+	 * @return
+	 */
+	private String[] getValidNames(SuperVO vo, Map<String, Integer> types) {
+		String[] names = vo.getAttributeNames();
+		List<String> nameList = new ArrayList<String>();
+		for (int i = 0; i < names.length; ++i) {
+			if (types.get(names[i].toUpperCase()) != null) {
+				nameList.add(names[i]);
+			}
+		}
+		return (String[]) nameList.toArray(new String[0]);
+	}
+
+	/**
+	 * 获得更新时有效的列名
+	 * @param vo
+	 * @param types
+	 * @param paramNameList
+	 * @return
+	 */
+	private String[] getUpdateValidNames(SuperVO vo, Map<String, Integer> types, List<String> paramNameList) {
+		String[] names = vo.getAttributeNames();
+		List<String> nameList = new ArrayList<String>();
+		for (int i = 0; i < names.length; ++i) {
+			if (!names[i].equals("operator") && !names[i].equals("create_time") && !names[i].equals("dr")
+					&& !names[i].equals("org_id") && !names[i].equals(vo.getPKFieldName())
+					&& types.get(names[i].toUpperCase()) != null) {
+				if (paramNameList.size() > 0 && paramNameList.contains(names[i])) {
+					nameList.add(names[i]);
+				} else {
+					if (vo.getAttribute(names[i]) != null) {
+						nameList.add(names[i]);
+					}
+				}
+			}
+		}
+
+		nameList.add(vo.getPKFieldName());
+		return (String[]) nameList.toArray(new String[0]);
+	}
+
+	/**
+	 * 加入排序SQL
+	 * @param sql
+	 * @param sortSQL
+	 * @return
+	 */
+	private String addSortSQL(String sql, String sortSQL) {
+		if (!StringUtils.isEmpty(sortSQL)) {
+			sql = sql + " order by " + sortSQL;
+		}
+		return sql;
+	}
+
+	public JdbcTemplate getJdbcTemplate() {
+		return jdbcTemplate;
+	}
+
+	/**
+	 * 根据主键数组查询数据
+	 * @param <T>
+	 * @param clazz
+	 * @param pks
+	 * @return
+	 */
+	public <T> List<T> queryByPks(Class<? extends SuperVO> clazz, String[] pks) {
+		try {
+			List<T> list = new ArrayList<T>();
+			if (pks != null && pks.length > 0) {
+				SuperVO vo = clazz.newInstance();
+				String tableName = vo.getTableName();
+				Map<String, Integer> types = getColumnTypes(tableName);
+				String[] fieldNames = getValidNames(vo, types);
+				StringBuffer buf = new StringBuffer(" and id in (");
+				for (String pk : pks) {
+					buf.append("'").append(pk).append("',");
+				}
+				String inpk = buf.substring(0, buf.length() - 1) + ")";
+				String sql = getQuerySQL(tableName, fieldNames, inpk);
+
+				if (sql == null) {
+					return list;
+				}
+				list = jdbcTemplate.query(sql, new RowMapper<T>() {
+					@SuppressWarnings("unchecked")
+					@Override
+					public T mapRow(ResultSet rs, int arg1) throws SQLException {
+						// TODO Auto-generated method stub
+						SuperVO rs2vo = null;
+						try {
+							rs2vo = (SuperVO) clazz.newInstance();
+							rs2vo(rs2vo, rs, fieldNames);
+						} catch (Exception e) {
+							Log.error(e);
+							e.printStackTrace();
+						}
+						return (T) rs2vo;
+					}
+				});
+			}
+			return list;
+		} catch (Exception e) {
+			Log.error(e);
+			e.printStackTrace();
+			throw new BusinessException("查询数据异常", e);
+		}
+	}
+
+}

+ 17 - 0
src/main/java/com/pub/jdbc/BaseSQLParam.java

@@ -0,0 +1,17 @@
+package com.pub.jdbc;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import lombok.Data;
+
+@Data
+public class BaseSQLParam {
+	private List list = new ArrayList();
+
+	public void addParam(Object obj) {
+		if (list != null) {
+			list.add(obj);
+		}
+	}
+}

+ 10 - 0
src/main/java/com/pub/jdbc/CascadeMetadata.java

@@ -0,0 +1,10 @@
+package com.pub.jdbc;
+
+import lombok.Data;
+
+@Data
+public class CascadeMetadata {
+	private Class<? extends SuperVO> clazz;
+	private String parentFieldName;
+
+}

+ 44 - 0
src/main/java/com/pub/jdbc/CommonVO.java

@@ -0,0 +1,44 @@
+package com.pub.jdbc;
+
+import java.sql.Timestamp;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public abstract class CommonVO extends SuperVO {
+	
+	private String id;
+	@ApiModelProperty(hidden = true)
+	private String operator;
+	@ApiModelProperty(hidden = true)
+	private Integer dr;
+	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+	@ApiModelProperty(hidden = true)
+	private Timestamp create_time;
+	@ApiModelProperty(hidden = true)
+	private String org_id;
+	@ApiModelProperty(hidden = true)
+	private Timestamp del_time;
+	@ApiModelProperty(hidden = true)
+	private String del_opr;
+	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+	@ApiModelProperty(hidden = true)
+	private Timestamp update_time;
+	@ApiModelProperty(hidden = true)
+	private String updator;
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.ksxx.jdbc.SuperVO#getPKFieldName()
+	 */
+	@Override
+	public String getPKFieldName() {
+		// TODO Auto-generated method stub
+		return "id";
+	}
+}

+ 135 - 0
src/main/java/com/pub/jdbc/SuperVO.java

@@ -0,0 +1,135 @@
+package com.pub.jdbc;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.beanutils.PropertyUtils;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+import io.swagger.annotations.ApiModelProperty;
+
+public abstract class SuperVO {
+
+	@JSONField(serialize = false)
+	@ApiModelProperty(hidden = true)
+	@JsonIgnore
+	public List<String> fieldNames = new ArrayList<String>();
+
+	public SuperVO() {
+		try {
+			Class<? extends Object> c = super.getClass();
+			synchronized (c) {
+				do {
+					initFields(c);
+					c = c.getSuperclass();
+				} while (c != SuperVO.class);
+			}
+		} catch (SecurityException e) {
+			e.printStackTrace();
+		}
+	}
+
+	public void initFields(Class<? extends Object> clazz) {
+		Field[] fields = clazz.getDeclaredFields();
+		for (Field f : fields) {
+			this.fieldNames.add(f.getName());
+		}
+	}
+
+	/**
+	 * 获得操作数据库的表名
+	 * 
+	 * @author znn
+	 * @date 2014-12-20
+	 * @return
+	 * @description
+	 */
+	@JSONField(serialize = false)
+	@JsonIgnore
+	public abstract String getTableName();
+
+	/**
+	 * 获得主键字段名称
+	 * 
+	 * @author znn
+	 * @date 2014-12-20
+	 * @return
+	 * @description
+	 */
+	@JSONField(serialize = false)
+	@JsonIgnore
+	public abstract String getPKFieldName();
+
+	/**
+	 * 获得子表的Metadata
+	 * 
+	 * @author znn
+	 * @date 2014-12-20
+	 * @return
+	 * @description
+	 */
+	@JSONField(serialize = false)
+	@JsonIgnore
+	public abstract CascadeMetadata[] getChildCascadeMetadata();
+
+	@JSONField(serialize = false)
+	@JsonIgnore
+	public String getPrimaryKey() {
+		String pkname = getPKFieldName();
+		return (String) getAttribute(pkname);
+	}
+
+	public void setPrimaryKey(String key) {
+		String pkname = getPKFieldName();
+		try {
+			PropertyUtils.setProperty(this, pkname, key);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
+	public void setAttribute(String fieldname, Object value) {
+		try {
+			if (value != null) {
+				PropertyUtils.setProperty(this, fieldname, value);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	@JSONField(serialize = false)
+	@JsonIgnore
+	public Object getAttribute(String fieldname) {
+		try {
+			return PropertyUtils.getProperty(this, fieldname);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	@JSONField(serialize = false)
+	@JsonIgnore
+	public String[] getAttributeNames() {
+		if (this.fieldNames != null) {
+			return (String[]) this.fieldNames.toArray(new String[0]);
+		}
+		return new String[0];
+	}
+
+	@JSONField(serialize = false)
+	@JsonIgnore
+	public Object clone(SuperVO dest) throws CloneNotSupportedException {
+		for (String name : fieldNames) {
+			dest.setAttribute(name, getAttribute(name));
+		}
+		return dest;
+	}
+}

+ 167 - 0
src/main/java/com/pub/job/UpdateJob.java

@@ -0,0 +1,167 @@
+package com.pub.job;
+
+import java.io.ByteArrayInputStream;
+import java.security.cert.CertificateExpiredException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.CertificateNotYetValidException;
+import java.security.cert.X509Certificate;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.util.EntityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+
+import com.admin.sb.SbVO;
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.Lists;
+import com.pub.constant.Constants;
+import com.pub.env.Environment;
+import com.pub.jdbc.BaseDAO;
+import com.pub.log.Log;
+import com.pub.util.DateUtil;
+import com.pub.util.HttpUtil;
+import com.pub.wxpaycert.WxpaycertVO;
+import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder;
+import com.wechat.pay.contrib.apache.httpclient.util.AesUtil;
+
+@Service(value = "pubUpdateJob")
+public class UpdateJob {
+
+	@Autowired
+	private BaseDAO baseDAO;
+
+	@Scheduled(cron = "0 0 */6 * * ?")
+	public void updateWxpayCert() {
+		if(Environment.wxHttpClient != null) {
+			CloseableHttpResponse res = null;
+			try {
+				List<X509Certificate> certs = new ArrayList<X509Certificate>();
+				List<WxpaycertVO> wxcerts = baseDAO.queryByCondition(WxpaycertVO.class, null, "effective_time desc");
+				URIBuilder uriBuilder = new URIBuilder("https://api.mch.weixin.qq.com/v3/certificates");
+				HttpGet httpGet = new HttpGet(uriBuilder.build());
+				httpGet.addHeader("Accept", "application/json");
+				res = Environment.wxHttpClient.execute(httpGet);
+				String body = EntityUtils.toString(res.getEntity());
+				res.close();
+				ObjectMapper mapper = new ObjectMapper();
+				JsonNode dataNode = mapper.readTree(body).get("data");
+				if (dataNode != null) {
+					for (int i = 0, count = dataNode.size(); i < count; i++) {
+						String serial_no = dataNode.get(i).get("serial_no").textValue();
+						boolean match = false;
+						for (WxpaycertVO c : wxcerts) {
+							if (serial_no.equals(c.getSerial_no())) {
+								match = true;
+								break;
+							}
+						}
+						if (!match) {
+							AesUtil decryptor = new AesUtil(Constants.WXMCHKEYV3.getBytes("UTF-8"));
+							JsonNode encryptCertificateNode = dataNode.get(i).get("encrypt_certificate");
+							String cert = decryptor.decryptToString(
+									encryptCertificateNode.get("associated_data").toString().replaceAll("\"", "")
+											.getBytes("utf-8"),
+									encryptCertificateNode.get("nonce").toString().replaceAll("\"", "").getBytes("utf-8"),
+									encryptCertificateNode.get("ciphertext").toString().replaceAll("\"", ""));
+
+							CertificateFactory cf = CertificateFactory.getInstance("X509");
+							X509Certificate x509Cert = (X509Certificate) cf
+									.generateCertificate(new ByteArrayInputStream(cert.getBytes("utf-8")));
+							try {
+								x509Cert.checkValidity();
+							} catch (CertificateExpiredException | CertificateNotYetValidException e) {
+								continue;
+							}
+							certs.add(x509Cert);
+							
+							WxpaycertVO c = new WxpaycertVO();
+							c.setSerial_no(dataNode.get(i).get("serial_no").textValue());
+							Date effective_time = DateUtil.parse("yyyy-MM-dd'T'HH:mm:ssX",
+									dataNode.get(i).get("effective_time").textValue());
+							c.setEffective_time(new Timestamp(effective_time.getTime()));
+							Date expire_time = DateUtil.parse("yyyy-MM-dd'T'HH:mm:ssX",
+									dataNode.get(i).get("expire_time").textValue());
+							c.setExpire_time(new Timestamp(expire_time.getTime()));
+							c.setCerttext(cert);
+							baseDAO.insert(c);
+						}
+					}
+
+				}
+				if (certs.size() > 0) {
+					Log.info("新增证书:"+certs.size());
+					// 证书有变动重新加载
+					for (WxpaycertVO c : wxcerts) {
+						CertificateFactory cf = CertificateFactory.getInstance("X509");
+						X509Certificate x509Cert = (X509Certificate) cf
+								.generateCertificate(new ByteArrayInputStream(c.getCerttext().getBytes("utf-8")));
+						try {
+							x509Cert.checkValidity();
+						} catch (CertificateExpiredException | CertificateNotYetValidException e) {
+							continue;
+						}
+						certs.add(x509Cert);
+					}
+					Environment.wxHttpClient = WechatPayHttpClientBuilder.create()
+							.withMerchant(Constants.WXMCHID, Constants.WXMCHAPICERTNUM, Environment.wxPrivateKey)
+							.withWechatPay(certs).build();
+				}
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+		
+	}
+	
+	@Scheduled(cron = "0 0 */1 * * ?")
+	public void updateWxgzh() {
+		if(StringUtils.isNotBlank(Constants.WXGZHAPPID) && StringUtils.isNotBlank(Constants.WXGZHAPPSECRET)) {
+			String res = HttpUtil.request("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="
+					+ Constants.WXGZHAPPID + "&secret=" + Constants.WXGZHAPPSECRET, null, false, null, null);
+			if(StringUtils.isNotEmpty(res)) {
+				Constants.WXGZHACCESS_TOKEN = (String) JSONObject.parseObject(res).get("access_token");
+				Log.info("公众号更新ACCESS_TOKEN:" + Constants.WXGZHACCESS_TOKEN);
+				String res_str = HttpUtil.request("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token="
+						+ Constants.WXGZHACCESS_TOKEN + "&type=jsapi", null, false, null, null);
+				if(StringUtils.isNotEmpty(res_str)) {
+					Constants.WXGZHJS_TICKET = (String) JSONObject.parseObject(res_str).get("ticket");
+					Log.info("公众号更新JS_TICKET:" + Constants.WXGZHJS_TICKET);
+				}
+			}
+		}
+	}
+	
+	@Scheduled(cron = "0 0 */1 * * ?")
+	public void updateWxxcx() {
+		if(StringUtils.isNotBlank(Constants.WXXCXAPPID) && StringUtils.isNotBlank(Constants.WXXCXAPPSECRET)) {
+			String res = HttpUtil.request("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="
+					+ Constants.WXXCXAPPID + "&secret=" + Constants.WXXCXAPPSECRET, null, false, null, null);
+			if(StringUtils.isNotEmpty(res)) {
+				Constants.WXXCXACCESS_TOKEN = (String) JSONObject.parseObject(res).get("access_token");
+				Log.info("小程序更新ACCESS_TOKEN:" + Constants.WXXCXACCESS_TOKEN);
+			}
+		}
+	}
+	
+	@Scheduled(cron = "0 */1 * * * ?")
+	public void processSblx() {
+		List<String> sqls = Lists.newArrayList();
+		List<SbVO> sbs = baseDAO.queryByCondition(SbVO.class, " and lx is null and UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(sign_time)>120 ", null);
+		for(SbVO v : sbs) {
+			sqls.add("update tbl_sb set lx=1 where id='"+v.getId()+"' ");
+		}
+		if(sqls.size() > 0) {
+			baseDAO.getJdbcTemplate().batchUpdate(sqls.toArray(new String[] {}));
+		}
+	}
+}

+ 196 - 0
src/main/java/com/pub/listener/SpringContext.java

@@ -0,0 +1,196 @@
+package com.pub.listener;
+
+import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.security.cert.CertificateExpiredException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.CertificateNotYetValidException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.annotation.WebListener;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.HttpHost;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.util.EntityUtils;
+import org.eclipse.paho.client.mqttv3.MqttException;
+import org.elasticsearch.client.RestClient;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+import com.pub.constant.Constants;
+import com.pub.env.Environment;
+import com.pub.jdbc.BaseDAO;
+import com.pub.job.UpdateJob;
+import com.pub.system.SystemCache;
+import com.pub.util.MqttUtil;
+import com.pub.util.WXUtil;
+import com.pub.wxpaycert.WxpaycertVO;
+import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder;
+import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
+
+import co.elastic.clients.elasticsearch.ElasticsearchClient;
+import co.elastic.clients.elasticsearch.shutdown.ElasticsearchShutdownClient;
+import co.elastic.clients.json.jackson.JacksonJsonpMapper;
+import co.elastic.clients.transport.ElasticsearchTransport;
+import co.elastic.clients.transport.rest_client.RestClientTransport;
+
+/**
+ * @author znn
+ * @Description
+ * @date 2014-12-29
+ */
+@WebListener
+public class SpringContext implements ServletContextListener {
+	private static WebApplicationContext context;
+
+	public static WebApplicationContext getContext() {
+		return context;
+	}
+
+	public static void setContext(WebApplicationContext context) {
+		SpringContext.context = context;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.
+	 * ServletContextEvent)
+	 */
+	@Override
+	public void contextDestroyed(ServletContextEvent arg0) {
+		// TODO Auto-generated method stub
+		try {
+			if(Environment.elasticsearchClient != null) {
+				Environment.elasticsearchClient._transport().close();
+			}
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.
+	 * ServletContextEvent)
+	 */
+	@Override
+	public void contextInitialized(ServletContextEvent arg0) {
+		// TODO Auto-generated method stub
+		context = WebApplicationContextUtils.getWebApplicationContext(arg0.getServletContext());
+		SystemCache.refreshCache();
+		UpdateJob updateJob = context.getBean(UpdateJob.class);
+		updateJob.updateWxgzh();
+		updateJob.updateWxxcx();
+		try {
+			MqttUtil.start();
+		} catch (MqttException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		/*
+		PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
+		try {
+			Resource[] resources = resolver.getResources("classpath*:/processes/**.bpmn");
+			for (Resource r : resources) {
+				String deploymentName = r.getFilename();
+				String resourceName = r.getFilename();
+				boolean doDeploy = true;
+				RepositoryService repositoryService = context.getBean(RepositoryService.class);
+				List<Deployment> deployments = repositoryService.createDeploymentQuery().deploymentName(deploymentName)
+						.orderByDeploymenTime().desc().list();
+				if (!deployments.isEmpty()) {
+					Deployment existing = deployments.get(0);
+					InputStream in = repositoryService.getResourceAsStream(existing.getId(), resourceName);
+					if (in != null) {
+						File f = File.createTempFile("deployment", "xml",
+								new File(System.getProperty("java.io.tmpdir")));
+						if (f.exists()) {
+							f.delete();
+						}
+						OutputStream out = new FileOutputStream(f);
+						IOUtils.copy(in, out);
+						in.close();
+						out.close();
+						doDeploy = (FileUtils.checksumCRC32(f) != FileUtils.checksumCRC32(r.getFile()));
+						f.delete();
+					} else
+						throw new ActivitiException("不能读取资源 " + resourceName + ", 输入流为空");
+				}
+				if (doDeploy) {
+					repositoryService.createDeployment().name(deploymentName)
+							.addInputStream(resourceName, r.getInputStream()).deploy();
+				}
+			}
+		} catch (Exception e) {
+			// TODO: handle exception
+			e.printStackTrace();
+		}*/
+
+		if (StringUtils.isNotEmpty(Constants.WXMCHPKPATH)) {
+			CloseableHttpResponse res = null;
+			try {
+				// 检查是否初始化过证书
+				boolean init = true;
+				BaseDAO baseDAO = context.getBean(BaseDAO.class);
+				List<WxpaycertVO> wxcerts = baseDAO.queryByCondition(WxpaycertVO.class, null, "effective_time desc");
+				if (wxcerts.size() > 0) {
+					init = false;
+				}
+				Environment.wxPrivateKey = PemUtil.loadPrivateKey(new FileInputStream(Constants.WXMCHPKPATH));
+				if (init) {
+					Environment.wxHttpClient = WechatPayHttpClientBuilder.create()
+							.withMerchant(Constants.WXMCHID, Constants.WXMCHAPICERTNUM, Environment.wxPrivateKey)
+							.withValidator(response -> true).build();
+					URIBuilder uriBuilder = new URIBuilder("https://api.mch.weixin.qq.com/v3/certificates");
+					HttpGet httpGet = new HttpGet(uriBuilder.build());
+					httpGet.addHeader("Accept", "application/json");
+					res = Environment.wxHttpClient.execute(httpGet);
+					String body = EntityUtils.toString(res.getEntity());
+					List<X509Certificate> certs = WXUtil.deserializeToCerts(Constants.WXMCHKEYV3.getBytes("UTF-8"),
+							body);
+					Environment.wxHttpClient = WechatPayHttpClientBuilder.create()
+							.withMerchant(Constants.WXMCHID, Constants.WXMCHAPICERTNUM, Environment.wxPrivateKey)
+							.withWechatPay(certs).build();
+					res.close();
+				} else {
+					List<X509Certificate> certs = new ArrayList<X509Certificate>();
+					for (WxpaycertVO c : wxcerts) {
+						CertificateFactory cf = CertificateFactory.getInstance("X509");
+						X509Certificate x509Cert = (X509Certificate) cf
+								.generateCertificate(new ByteArrayInputStream(c.getCerttext().getBytes("utf-8")));
+						try {
+							x509Cert.checkValidity();
+						} catch (CertificateExpiredException | CertificateNotYetValidException e) {
+							continue;
+						}
+						certs.add(x509Cert);
+					}
+					Environment.wxHttpClient = WechatPayHttpClientBuilder.create()
+							.withMerchant(Constants.WXMCHID, Constants.WXMCHAPICERTNUM, Environment.wxPrivateKey)
+							.withWechatPay(certs).build();
+				}
+
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+		if(Environment.elasticsearchEnable) {
+			RestClient restClient = RestClient.builder(
+			        new HttpHost("localhost", 9201)).build();
+			ElasticsearchTransport transport = new RestClientTransport(
+			        restClient, new JacksonJsonpMapper());
+			Environment.elasticsearchClient = new ElasticsearchClient(transport);
+		}
+	}
+}

+ 70 - 0
src/main/java/com/pub/log/Log.java

@@ -0,0 +1,70 @@
+package com.pub.log;
+
+import java.util.Date;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.pub.util.DateUtil;
+
+/**
+ * @author znn
+ * @Description
+ * @date 2015-1-23
+ */
+public class Log {
+	private static Logger logger = LoggerFactory.getLogger(Log.class);
+
+	public static void error(Throwable obj) {
+		String now = DateUtil.formate("yyyy-MM-dd HH:mm:ss", new Date());
+		logger.error("系统错误信息,发生时间:" + now, obj);
+	}
+
+	public static void debug(Throwable obj) {
+		String now = DateUtil.formate("yyyy-MM-dd HH:mm:ss", new Date());
+		logger.debug("系统调试信息,发生时间:" + now, obj);
+	}
+
+	public static void info(Throwable obj) {
+		String now = DateUtil.formate("yyyy-MM-dd HH:mm:ss", new Date());
+		logger.info("系统日常信息,发生时间:" + now, obj);
+	}
+
+	public static void warn(Throwable obj) {
+		String now = DateUtil.formate("yyyy-MM-dd HH:mm:ss", new Date());
+		logger.warn("系统警告信息,发生时间:" + now, obj);
+	}
+	
+	
+	public static void error(String msg,Throwable obj) {
+		logger.error(msg, obj);
+	}
+
+	public static void debug(String msg,Throwable obj) {
+		logger.debug(msg, obj);
+	}
+
+	public static void info(String msg,Throwable obj) {
+		logger.info(msg, obj);
+	}
+
+	public static void warn(String msg,Throwable obj) {
+		logger.warn(msg, obj);
+	}
+	
+	public static void error(String msg) {
+		logger.error(msg);
+	}
+
+	public static void debug(String msg) {
+		logger.debug(msg);
+	}
+
+	public static void info(String msg) {
+		logger.info(msg);
+	}
+
+	public static void warn(String msg) {
+		logger.warn(msg);
+	}
+}

+ 55 - 0
src/main/java/com/pub/page/Page.java

@@ -0,0 +1,55 @@
+package com.pub.page;
+
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * @author znn
+ * @Description 
+ * @date 2014-12-15
+ */
+public class Page {
+	private Integer rows;
+	private Integer page;
+	private String sort;
+	private String order;
+
+	public Integer getRows() {
+		return rows;
+	}
+
+	public void setRows(Integer rows) {
+		this.rows = rows;
+	}
+
+	public Integer getPage() {
+		return page;
+	}
+
+	public void setPage(Integer page) {
+		this.page = page;
+	}
+
+	public String getSort() {
+		return sort;
+	}
+
+	public void setSort(String sort) {
+		this.sort = sort;
+	}
+
+	public String getOrder() {
+		if(StringUtils.isNotEmpty(order)) {
+			if(order.equals("ascending")) {
+				order = "asc";
+			}
+			if(order.equals("descending")) {
+				order = "desc";
+			}
+		}
+		return order;
+	}
+
+	public void setOrder(String order) {
+		this.order = order;
+	}
+}

+ 17 - 0
src/main/java/com/pub/page/PageRecord.java

@@ -0,0 +1,17 @@
+package com.pub.page;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import lombok.Data;
+
+
+@Data
+public class PageRecord<T> {
+	private List<T> rows = new ArrayList<T>();
+	private Long total;
+	private Integer pageNum;
+	private Integer pageSize;
+	private Boolean outTotalPageNum = false;
+	private Integer totalPageNum;
+}

+ 31 - 0
src/main/java/com/pub/page/TotalRecord.java

@@ -0,0 +1,31 @@
+package com.pub.page;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author znn
+ * @Description
+ * @date 2014-12-15
+ */
+public class TotalRecord<T> {
+	private List<T> rows = new ArrayList<T>();
+	private Long total;
+
+	public List<T> getRows() {
+		return rows;
+	}
+
+	public void setRows(List<T> rows) {
+		total = (long) rows.size();
+		this.rows = rows;
+	}
+
+	public Long getTotal() {
+		return total;
+	}
+
+	public void setTotal(Long total) {
+		this.total = total;
+	}
+}

+ 45 - 0
src/main/java/com/pub/queue/SQLQueue.java

@@ -0,0 +1,45 @@
+package com.pub.queue;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import com.pub.jdbc.BaseDAO;
+import com.pub.listener.SpringContext;
+
+public class SQLQueue extends Thread {
+	
+	private static ConcurrentLinkedQueue<String> sqlList = new ConcurrentLinkedQueue<String>();
+
+	public static void push(List<String> sqls) {
+		sqlList.addAll(sqls);
+	}
+	@Override
+	public void run() {
+		BaseDAO baseDAO = SpringContext.getContext().getBean(BaseDAO.class);
+		List<String> sqls = new ArrayList<String>();
+		while (true) {
+			try {
+				while (!sqlList.isEmpty()) {
+					String sql = sqlList.poll();
+					sqls.add(sql);
+				}
+				if(sqls.size() > 0) {
+					baseDAO.getJdbcTemplate().batchUpdate(sqls.toArray(new String[0]));
+					sqls.clear();
+				}
+				Thread.sleep(5000);
+			} catch (Exception e) {
+				e.printStackTrace();
+				try {
+					Thread.sleep(5000);
+				} catch (InterruptedException e1) {
+					// TODO Auto-generated catch block
+					e1.printStackTrace();
+				}
+			}
+
+		}
+	}
+
+}

+ 39 - 0
src/main/java/com/pub/system/SystemCache.java

@@ -0,0 +1,39 @@
+package com.pub.system;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.admin.dicitem.DicitemVO;
+import com.admin.parameter.ParameterVO;
+import com.pub.jdbc.BaseDAO;
+import com.pub.listener.SpringContext;
+
+public class SystemCache {
+	
+	public static Map<String, List<DicitemVO>> dicData;
+	public static Map<String, String> dicMap;
+	public static Map<String, ParameterVO> paramMap;
+	public static List<String> noBtnCdbm;
+	public static Map<String,Map<String,Integer>> table_cache = new HashMap<String,Map<String,Integer>>();
+
+	public static void refreshCache() {
+		dicData = new HashMap<String, List<DicitemVO>>();
+		dicMap = new HashMap<String, String>();
+		paramMap = new HashMap<String, ParameterVO>();
+		table_cache = new HashMap<String,Map<String,Integer>>();
+		BaseDAO baseDAO = SpringContext.getContext().getBean(BaseDAO.class);
+		
+		List<DicitemVO> dicItemVOs = baseDAO.queryByCondition(DicitemVO.class,
+				null,null);
+		
+		for (DicitemVO item : dicItemVOs) {
+			dicMap.put(item.getId(), item.getName());
+		}
+		
+		List<ParameterVO> params = baseDAO.queryByCondition(ParameterVO.class, null, null);
+		for(ParameterVO param : params){
+			paramMap.put(param.getId(), param);
+		}
+	}
+}

+ 28 - 0
src/main/java/com/pub/system/SystemController.java

@@ -0,0 +1,28 @@
+package com.pub.system;
+
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+
+
+@Controller
+@RequestMapping("/system")
+public class SystemController {
+	
+	@ResponseBody
+	@GetMapping("/refreshCache")
+	public R refreshCache() {
+		R map = JSONUtil.getSuccessMsg("操作成功");
+		try {
+			SystemCache.refreshCache();
+		} catch (Exception ex) {
+			map = JSONUtil.getErrorMsg(ex);
+		}
+		return map;
+	}
+}

+ 272 - 0
src/main/java/com/pub/upload/FileUploadController.java

@@ -0,0 +1,272 @@
+package com.pub.upload;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+import com.admin.parameter.ParameterVO;
+import com.pub.constant.Constants;
+import com.pub.env.Environment;
+import com.pub.log.Log;
+import com.pub.system.SystemCache;
+import com.pub.util.JSONUtil;
+import com.pub.util.R;
+
+@Controller
+@RequestMapping("/fileUpload")
+public class FileUploadController {
+
+	public static String getFilePath() {
+		ParameterVO param = SystemCache.paramMap.get("file_path");
+		return param.getParameter_value()+Environment.COMMON_FILE_UPLOAD_PATH;
+	}
+
+	@ResponseBody
+	@RequestMapping("/upload")
+	public Map<String, String> upload(HttpServletRequest request,
+			HttpServletResponse response) throws IllegalStateException,
+			IOException {
+		String fileName = "";
+		String fileRelativePath = "";
+		MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request;
+		MultiValueMap<String, MultipartFile> multiMap = multiRequest
+				.getMultiFileMap();
+		if (multiMap != null) {
+			for (String key : multiMap.keySet()) {
+				List<MultipartFile> fileList = multiMap.get(key);
+				// 这里也只有一个
+				for (MultipartFile file : fileList) {
+					// 上传目录路径
+					String dirPath = getFilePath();
+					String filePrefix = file.getOriginalFilename();
+					int lastDotIndex = filePrefix.lastIndexOf(".");
+					String fileSuffix = "";
+					if (lastDotIndex > -1
+							&& lastDotIndex < filePrefix.length() - 1) {
+						fileSuffix = filePrefix.substring(lastDotIndex + 1);
+						filePrefix = filePrefix.substring(0, lastDotIndex);
+					}
+					String dirName = request.getParameter("dir");
+					if (dirName == null) {
+						dirName = "file";
+					}
+					dirPath += dirName + "/";
+					fileRelativePath += dirName + "/";
+					SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+					String nowadays = sdf.format(new Date());
+					dirPath += nowadays + "/";
+					fileRelativePath += nowadays + "/";
+					File dir = new File(dirPath);
+					// 如果上传目录不存在则创建
+					if (!dir.exists() || dir.isFile()) {
+						dir.mkdirs();
+					}
+					// 文件名
+					fileName = System.currentTimeMillis() + "."
+							+ fileSuffix;
+					fileRelativePath += fileName;
+					// 如果文件名不为空则上传
+					if (fileName != null && !"".equals(fileName.trim())) {
+						file.transferTo(new File(dirPath, fileName));
+					}
+
+				}
+			}
+		}
+		Map<String, String> result = new HashMap<String, String>();
+		result.put("name", fileRelativePath);
+		result.put("url", Constants.DOMAIN+Environment.COMMON_FILE_UPLOAD_PATH+fileRelativePath);
+		return result;
+	}
+	
+//	@ResponseBody
+//	@PostMapping("/uploadMap")
+//	public R uploadMap(@RequestParam("file") MultipartFile file,
+//		    @RequestParam String group_uuid) throws IllegalStateException,
+//			IOException {
+//		R r =JSONUtil.getSuccessMsg(null);
+//		
+//		// 校验文件非空
+//	    if (file.isEmpty()) {
+//	        return JSONUtil.getErrorMsg("文件为空");
+//	    }
+//	    
+//	    // 生成安全路径
+//	    String dirPath = getFilePath() + "map/" + group_uuid + "/";
+//	    File dir = new File(dirPath);
+//	    if (!dir.exists() && !dir.mkdirs()) {
+//	        Log.error("目录创建失败: " + dirPath);
+//	        return JSONUtil.getErrorMsg("服务器错误");
+//	    }
+//	    
+//		// 文件名
+//		String  fileName= System.currentTimeMillis() + ".png";
+//		// 如果文件名不为空则上传
+//		if (fileName != null && !"".equals(fileName.trim())) {
+//			file.transferTo(new File(dirPath, fileName));
+//			Log.info("fileUpload:上传成功");
+//			return r;
+//		}
+//		else {
+//			r =JSONUtil.getErrorMsg("上传失败,请重试");
+//			Log.info("fileUpload:上传失败");
+//			return r;
+//		}
+//	}
+
+	@ResponseBody
+	@RequestMapping("/uploadByKindEditor")
+	public Map<String, Object> uploadByKindEditor(HttpServletRequest request,
+			HttpServletResponse response) throws IllegalStateException,
+			IOException {
+
+		MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request;
+		MultiValueMap<String, MultipartFile> multiMap = multiRequest
+				.getMultiFileMap();
+		if (multiMap != null) {
+			// jquery upload 是一个一个上传的,所以这里实际上只有一个
+			for (String key : multiMap.keySet()) {
+				List<MultipartFile> fileList = multiMap.get(key);
+				// 这里也只有一个
+				for (MultipartFile file : fileList) {
+					// 文件保存目录路径
+					String savePath = getFilePath();
+					// 文件保存目录URL
+					String saveUrl = Environment.COMMON_FILE_UPLOAD_PATH;
+
+					String dirName = request.getParameter("dir");
+					if (dirName == null) {
+						dirName = "file";
+					}
+					// 创建文件夹
+					savePath += dirName + "/";
+					saveUrl += dirName + "/";
+					File saveDirFile = new File(savePath);
+					if (!saveDirFile.exists()) {
+						saveDirFile.mkdirs();
+					}
+					SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+					String ymd = sdf.format(new Date());
+					savePath += ymd + "/";
+					saveUrl += ymd + "/";
+					File dirFile = new File(savePath);
+					if (!dirFile.exists()) {
+						dirFile.mkdirs();
+					}
+					String fileName = "";
+
+					String filePrefix = file.getOriginalFilename();
+					int lastDotIndex = filePrefix.lastIndexOf(".");
+					String fileSuffix = "";
+					if (lastDotIndex > -1
+							&& lastDotIndex < filePrefix.length() - 1) {
+						fileSuffix += "."
+								+ filePrefix.substring(lastDotIndex + 1);
+						filePrefix = filePrefix.substring(0, lastDotIndex);
+					}
+					// 文件名
+					fileName = System.currentTimeMillis() + fileSuffix;
+					// 如果文件名不为空则上传
+					if (fileName != null && !"".equals(fileName.trim())) {
+						file.transferTo(new File(savePath, fileName));
+					}
+					Map<String, Object> obj = new HashMap<String, Object>();
+					obj.put("error", 0);
+					obj.put("url", saveUrl + fileName);
+					return obj;
+				}
+			}
+		}
+		Map<String, Object> obj = new HashMap<String, Object>();
+		obj.put("error", 1);
+		obj.put("msg", "上传失败");
+		return obj;
+	}
+
+	@ResponseBody
+	@RequestMapping("/fileManage")
+	public Map<String, Object> fileManage(HttpServletRequest request,
+			HttpServletResponse response) throws IOException {
+		String rootPath = getFilePath();
+		// 根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
+		String rootUrl = Environment.COMMON_FILE_UPLOAD_PATH;
+		String[] fileTypes = new String[] { "gif", "jpg", "jpeg", "png", "bmp" };
+		String dirName = request.getParameter("dir");
+		rootPath += dirName + "/";
+		rootUrl += dirName + "/";
+		File saveDirFile = new File(rootPath);
+		if (!saveDirFile.exists()) {
+			saveDirFile.mkdirs();
+		}
+		// 根据path参数,设置各路径和URL
+		String path = request.getParameter("path") != null ? request
+				.getParameter("path") : "";
+		String currentPath = rootPath + path;
+		String currentUrl = rootUrl + path;
+		String currentDirPath = path;
+		String moveupDirPath = "";
+		if (!"".equals(path)) {
+			String str = currentDirPath.substring(0,
+					currentDirPath.length() - 1);
+			moveupDirPath = str.lastIndexOf("/") >= 0 ? str.substring(0,
+					str.lastIndexOf("/") + 1) : "";
+		}
+		File currentPathFile = new File(currentPath);
+		List<Hashtable<String, Object>> fileList = new ArrayList<Hashtable<String, Object>>();
+		if (currentPathFile.listFiles() != null) {
+			for (File file : currentPathFile.listFiles()) {
+				Hashtable<String, Object> hash = new Hashtable<String, Object>();
+				String fileName = file.getName();
+				if (file.isDirectory()) {
+					hash.put("is_dir", true);
+					hash.put("has_file", (file.listFiles() != null));
+					hash.put("filesize", 0L);
+					hash.put("is_photo", false);
+					hash.put("filetype", "");
+				} else if (file.isFile()) {
+					String fileExt = fileName.substring(
+							fileName.lastIndexOf(".") + 1).toLowerCase();
+					hash.put("is_dir", false);
+					hash.put("has_file", false);
+					hash.put("filesize", file.length());
+					hash.put("is_photo", Arrays.<String> asList(fileTypes)
+							.contains(fileExt));
+					hash.put("filetype", fileExt);
+				}
+				hash.put("filename", fileName);
+				hash.put("datetime",
+						new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(file
+								.lastModified()));
+				fileList.add(hash);
+			}
+		}
+
+		Map<String, Object> result = new HashMap<String, Object>();
+		result.put("moveup_dir_path", moveupDirPath);
+		result.put("current_dir_path", currentDirPath);
+		result.put("current_url", currentUrl);
+		result.put("total_count", fileList.size());
+		result.put("file_list", fileList);
+		return result;
+	}
+
+}

+ 81 - 0
src/main/java/com/pub/util/AESUtil.java

@@ -0,0 +1,81 @@
+package com.pub.util;
+
+import java.security.AlgorithmParameters;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Security;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+
+public class AESUtil {
+	public static boolean initialized = false;
+
+	/**
+	 * AES解密
+	 * 
+	 * @param content 密文
+	 * @return
+	 * @throws InvalidAlgorithmParameterException
+	 * @throws NoSuchProviderException
+	 */
+	public static byte[] decrypt(byte[] content, byte[] keyByte, byte[] ivByte)
+			throws InvalidAlgorithmParameterException {
+		initialize();
+		try {
+			Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding", "BC");
+			Key sKeySpec = new SecretKeySpec(keyByte, "AES");
+
+			cipher.init(Cipher.DECRYPT_MODE, sKeySpec, generateIV(ivByte));// 初始化
+			byte[] result = cipher.doFinal(content);
+			return result;
+		} catch (NoSuchAlgorithmException e) {
+			e.printStackTrace();
+		} catch (NoSuchPaddingException e) {
+			e.printStackTrace();
+		} catch (InvalidKeyException e) {
+			e.printStackTrace();
+		} catch (IllegalBlockSizeException e) {
+			e.printStackTrace();
+		} catch (BadPaddingException e) {
+			e.printStackTrace();
+		} catch (NoSuchProviderException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	public static void initialize() {
+		if (initialized)
+			return;
+		Security.addProvider(new BouncyCastleProvider());
+		initialized = true;
+	}
+
+	/**
+	 * 生成iv
+	 * 
+	 * @param iv
+	 * @return
+	 * @throws Exception
+	 * @see
+	 */
+	public static AlgorithmParameters generateIV(byte[] iv) throws Exception {
+		AlgorithmParameters params = AlgorithmParameters.getInstance("AES");
+		params.init(new IvParameterSpec(iv));
+		return params;
+	}
+}

+ 206 - 0
src/main/java/com/pub/util/BeanUtil.java

@@ -0,0 +1,206 @@
+package com.pub.util;
+
+import java.net.URLDecoder;
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.beanutils.BeanMap;
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.beanutils.ConvertUtils;
+import org.apache.commons.beanutils.Converter;
+import org.springframework.util.StringUtils;
+
+import com.pub.jdbc.SuperVO;
+
+/**
+ * @author znn
+ * @Description
+ * @date 2014-12-31
+ */
+public class BeanUtil {
+
+	public static List<Map> toMap(List rows) {
+		List<Map> mapList = new ArrayList<>();
+		for (Object obj : rows) {
+			mapList.add(new BeanMap(obj));
+		}
+		return mapList;
+	}
+
+	public static <T> T getFormVO(Class<? extends SuperVO> clazz, HttpServletRequest req) {
+		ConvertUtils.register(new Converter() {
+			// 转换的内部实现方法,需要重写
+			@Override
+			public Object convert(Class type, Object value) {
+				try {
+					// 字符串转换为日期
+					SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+					return sdf.parse(value.toString());
+				} catch (ParseException e) {
+					throw new RuntimeException(e);
+				}
+			}
+		}, Date.class);
+		ConvertUtils.register(new Converter() {
+			// 转换的内部实现方法,需要重写
+			@Override
+			public Object convert(Class type, Object value) {
+				try {
+					if (value != null) {
+						// 字符串转换为日期
+						SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+						return new Timestamp(sdf.parse(value.toString()).getTime());
+					} else {
+						return null;
+					}
+				} catch (ParseException e) {
+					throw new RuntimeException(e);
+				}
+			}
+		}, Timestamp.class);
+		SuperVO vo;
+		try {
+			vo = clazz.newInstance();
+			String[] names = vo.getAttributeNames();
+			Map<String, String[]> p_map = req.getParameterMap();
+			for (String name : names) {
+				if (p_map.containsKey(name)) {
+					try {
+						String[] v_arr = p_map.get(name);
+						String value = "";
+						if (v_arr.length > 0) {
+							for (String v : v_arr) {
+								value = value + v + ",";
+							}
+							value = value.substring(0, value.length() - 1);
+						}
+						BeanUtils.setProperty(vo, name, URLDecoder.decode(value, "UTF-8"));
+					} catch (Exception e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
+				}
+			}
+			return (T) vo;
+		} catch (InstantiationException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IllegalAccessException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	public static <T> T getFormVO(Class<? extends SuperVO> clazz, HttpServletRequest req, String dateFmt,
+			String timestampFmt) {
+		if (StringUtils.isEmpty(dateFmt)) {
+			ConvertUtils.register(new Converter() {
+				// 转换的内部实现方法,需要重写
+				@Override
+				public Object convert(Class type, Object value) {
+					try {
+						// 字符串转换为日期
+						SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+						return sdf.parse(value.toString());
+					} catch (ParseException e) {
+						throw new RuntimeException(e);
+					}
+				}
+			}, Date.class);
+		} else {
+			ConvertUtils.register(new Converter() {
+				// 转换的内部实现方法,需要重写
+				@Override
+				public Object convert(Class type, Object value) {
+					try {
+						// 字符串转换为日期
+						SimpleDateFormat sdf = new SimpleDateFormat(dateFmt);
+						return sdf.parse(value.toString());
+					} catch (ParseException e) {
+						throw new RuntimeException(e);
+					}
+				}
+			}, Date.class);
+		}
+		if (StringUtils.isEmpty(timestampFmt)) {
+			ConvertUtils.register(new Converter() {
+				// 转换的内部实现方法,需要重写
+				@Override
+				public Object convert(Class type, Object value) {
+					try {
+						if (value != null) {
+							// 字符串转换为日期
+							SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+							return new Timestamp(sdf.parse(value.toString()).getTime());
+						} else {
+							return null;
+						}
+					} catch (ParseException e) {
+						throw new RuntimeException(e);
+					}
+				}
+			}, Timestamp.class);
+		} else {
+			ConvertUtils.register(new Converter() {
+				// 转换的内部实现方法,需要重写
+				@Override
+				public Object convert(Class type, Object value) {
+					try {
+						if (value != null) {
+							// 字符串转换为日期
+							SimpleDateFormat sdf = new SimpleDateFormat(timestampFmt);
+							return new Timestamp(sdf.parse(value.toString()).getTime());
+						} else {
+							return null;
+						}
+					} catch (ParseException e) {
+						throw new RuntimeException(e);
+					}
+				}
+			}, Timestamp.class);
+		}
+		SuperVO vo;
+		try {
+			vo = clazz.newInstance();
+			String[] names = vo.getAttributeNames();
+			Map<String, String[]> p_map = req.getParameterMap();
+			for (String name : names) {
+				if (p_map.containsKey(name)) {
+					try {
+						String[] v_arr = p_map.get(name);
+						String value = "";
+						if (v_arr.length > 0) {
+							for (String v : v_arr) {
+								value = value + v + ",";
+							}
+							value = value.substring(0, value.length() - 1);
+						}
+						if (org.apache.commons.lang.StringUtils.isNotEmpty(value)) {
+							BeanUtils.setProperty(vo, name, URLDecoder.decode(value, "UTF-8"));
+						}
+
+					} catch (Exception e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
+				}
+			}
+			return (T) vo;
+		} catch (InstantiationException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IllegalAccessException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+	}
+}

+ 34 - 0
src/main/java/com/pub/util/ByteUtil.java

@@ -0,0 +1,34 @@
+package com.pub.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ByteUtil {
+	public static List<String> bytesToHex(byte[] src) {
+		List<String> hex_list = new ArrayList<String>();
+		if (src == null || src.length <= 0) {
+			return null;
+		}
+
+		for (int i = 0; i < src.length; i++) {
+			String str = "";
+			int v = src[i] & 0xFF;
+			String hv = Integer.toHexString(v);
+			if (hv.length() < 2) {
+				str = str + "0";
+			}
+			str = str + hv;
+			hex_list.add(str.toUpperCase());
+		}
+		return hex_list;
+	}
+
+	public static byte[] hexToByte(List<String> hex_list) {
+		byte[] src = new byte[hex_list.size()];
+		for (int i = 0; i < hex_list.size(); i++) {
+			src[i] = (byte) Long.parseLong(hex_list.get(i), 16);
+		}
+		return src;
+	}
+
+}

+ 104 - 0
src/main/java/com/pub/util/CommandUtil.java

@@ -0,0 +1,104 @@
+package com.pub.util;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.commons.lang3.StringUtils;
+
+import com.google.common.collect.Lists;
+
+public class CommandUtil {
+	private static String APPID = "ahqljkj";
+	private static String NWURL = "http://127.0.0.1:8180/s/web?appid=" + APPID;
+	private static AtomicInteger msgNumber = new AtomicInteger(1);
+
+	private static String genCommand(String[] param) {
+		int msgid = msgNumber.getAndIncrement();
+		if(msgid >=62000) {
+			msgNumber = new AtomicInteger(1);
+		}
+		StringBuilder sb = new StringBuilder(StringUtils.leftPad(Integer.toHexString(msgid), 4, "0"));
+		String s_msgid = sb.insert(2, ",").toString();
+		StringBuffer c = new StringBuffer("FF,FF," + param[0] + "," + s_msgid + ",");
+		for (int i = 1; i < param.length; i++) {
+			c = c.append(param[i]).append(",");
+		}
+		// 计算校验码
+		String[] arr = c.toString().split(",");
+		int num = 0;
+		for (String a : arr) {
+			int ai = Integer.parseInt(a, 16);
+			num = num + ai;
+		}
+		int jym = ~num & 0xFFFF;
+		sb = new StringBuilder(StringUtils.leftPad(Integer.toHexString(jym), 4, "0"));
+		c = c.append(sb.insert(2, ",").toString()).append(",FE,FE");
+		return c.toString().toUpperCase();
+	}
+
+	private static String BigDecimalToHex(BigDecimal b,int l1,int l2,int dScale) {
+		String bs = b.setScale(dScale, BigDecimal.ROUND_HALF_UP).toString();
+		//整数不用截取小数位
+		String bs_1 = l2==0?Integer.toHexString(Integer.parseInt(bs)):Integer.toHexString(Integer.parseInt(bs.substring(0, bs.indexOf("."))));
+		String bs_2 = Integer.toHexString(Integer.parseInt(bs.substring(bs.indexOf(".") + 1)));
+		String hex = "";
+		if(l1 == 2) {
+			hex = hex + StringUtils.leftPad(bs_1, l1, "0")+",";
+		}
+		if(l1 == 4) {
+			hex = hex + new StringBuilder(StringUtils.leftPad(bs_1, l1, "0")).insert(2, ",")+",";
+		}
+		if(l2 == 2) {
+			hex = hex +  StringUtils.leftPad(bs_2, l2, "0")+",";
+		}
+		if(l2 == 4) {
+			hex = hex +   new StringBuilder(StringUtils.leftPad(bs_2, l2, "0")).insert(2, ",")+",";
+		}
+		hex = hex.substring(0, hex.length() - 1);
+		return hex;
+
+	}
+
+	public static String sendJcqy(String code, BigDecimal x1, BigDecimal y1, BigDecimal x2, BigDecimal y2) {
+		List<String> param = Lists.newArrayList();
+		StringBuilder sb = new StringBuilder(StringUtils.leftPad(Integer.toHexString(13), 4, "0"));
+		param.add(sb.insert(2, ",").toString());
+		param.add("01");
+		param.add(BigDecimalToHex(x1,2,2,2));
+		param.add(BigDecimalToHex(y1,2,2,2));
+		param.add(BigDecimalToHex(x2,2,2,2));
+		param.add(BigDecimalToHex(y2,2,2,2));
+		String c = genCommand(param.toArray(new String[] {}));
+		System.out.println(c);
+		return HttpUtil.request(NWURL + "&key=" + code + "&command="+c, null, false, null, null);
+	}
+	
+	public static void main(String[] args) {
+		//sendJcqy("12345678",new BigDecimal(1),new BigDecimal(2.14),new BigDecimal(3.47),new BigDecimal(4.28));
+		//sendAzgd("12345678",new BigDecimal(1.468));
+		//sendLmd("12345678",new BigDecimal(36));
+	}
+	
+	public static String sendAzgd(String code, BigDecimal xazgd) {
+		List<String> param = Lists.newArrayList();
+		StringBuilder sb = new StringBuilder(StringUtils.leftPad(Integer.toHexString(8), 4, "0"));
+		param.add(sb.insert(2, ",").toString());
+		param.add("02");
+		param.add(BigDecimalToHex(xazgd,2,4,3));
+		String c = genCommand(param.toArray(new String[] {}));
+		System.out.println(c);
+		return HttpUtil.request(NWURL + "&key=" + code + "&command="+c, null, false, null, null);
+	}
+	
+	public static String sendLmd(String code, BigDecimal lmd) {
+		List<String> param = Lists.newArrayList();
+		StringBuilder sb = new StringBuilder(StringUtils.leftPad(Integer.toHexString(7), 4, "0"));
+		param.add(sb.insert(2, ",").toString());
+		param.add("03");
+		param.add(BigDecimalToHex(lmd,4,0,0));
+		String c = genCommand(param.toArray(new String[] {}));
+		System.out.println(c);
+		return HttpUtil.request(NWURL + "&key=" + code + "&command="+c, null, false, null, null);
+	}
+}

+ 33 - 0
src/main/java/com/pub/util/ContentUtil.java

@@ -0,0 +1,33 @@
+package com.pub.util;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.springframework.util.StringUtils;
+
+/**
+ * @author znn
+ * @Description
+ * @date 2014-12-17
+ */
+public class ContentUtil {
+	public static String getContentSummary(String content, int length) {
+		String regex = "<[^>]*>";
+
+		Pattern pattern = Pattern.compile(regex);
+		if(StringUtils.isEmpty(content)){
+			return content;
+		}
+		Matcher matcher = pattern.matcher(content);
+
+		content = matcher.replaceAll("");
+		content = content.replace("\t", "");
+		content = content.replace("\n", "");
+		content = content.replace("&nbsp;", "");
+		
+		if (content.length() <= length) {
+			return content;
+		}
+		return content.substring(0, length) + "...";
+	}
+}

+ 17 - 0
src/main/java/com/pub/util/CoordinateUtil.java

@@ -0,0 +1,17 @@
+package com.pub.util;
+
+import java.math.BigDecimal;
+
+public class CoordinateUtil {
+	public static BigDecimal distance(double lat1, double lng1, double lat2, double lng2) {
+		double radLat1 = Math.toRadians(lat1);
+		double radLat2 = Math.toRadians(lat2);
+		double a = radLat1 - radLat2;
+		double b = Math.toRadians(lng1) - Math.toRadians(lng2);
+		double distance = 2 * Math.asin(Math.sqrt(
+				Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
+		distance = distance * 6378.137;
+		BigDecimal bd_distance = new BigDecimal(distance).setScale(2, BigDecimal.ROUND_HALF_UP);
+		return bd_distance;
+	}
+}

+ 34 - 0
src/main/java/com/pub/util/DateUtil.java

@@ -0,0 +1,34 @@
+package com.pub.util;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * @author znn
+ * @Description
+ * @date 2014-12-19
+ */
+public class DateUtil {
+	public static String formate(String pattern, Date date) {
+		SimpleDateFormat sdf = new SimpleDateFormat(pattern);
+		return sdf.format(date);
+	}
+	
+	public static Integer getBetweenDay(Date start, Date end) {
+		Integer day = (int) ((end.getTime() - start.getTime()) / (60 * 60 * 24 * 1000));
+		return day;
+	}
+
+	public static Date parse(String pattern, String date) {
+		SimpleDateFormat sdf = new SimpleDateFormat(pattern);
+		try {
+			return sdf.parse(date);
+		} catch (ParseException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+}

+ 111 - 0
src/main/java/com/pub/util/ElasticUtil.java

@@ -0,0 +1,111 @@
+package com.pub.util;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import com.pub.env.Environment;
+import com.pub.page.Page;
+
+import co.elastic.clients.elasticsearch._types.ElasticsearchException;
+import co.elastic.clients.elasticsearch._types.FieldSort;
+import co.elastic.clients.elasticsearch._types.SortOptions;
+import co.elastic.clients.elasticsearch._types.SortOrder;
+import co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery;
+import co.elastic.clients.elasticsearch._types.query_dsl.TermQuery;
+import co.elastic.clients.elasticsearch._types.query_dsl.WildcardQuery;
+import co.elastic.clients.elasticsearch.core.BulkResponse;
+import co.elastic.clients.elasticsearch.core.DeleteByQueryRequest;
+import co.elastic.clients.elasticsearch.core.SearchRequest;
+import co.elastic.clients.elasticsearch.core.SearchResponse;
+import co.elastic.clients.elasticsearch.core.UpdateRequest;
+import co.elastic.clients.elasticsearch.core.bulk.BulkOperation;
+import co.elastic.clients.elasticsearch.core.search.Hit;
+
+public class ElasticUtil {
+	
+	public static void inserIndex(String index) throws Exception {
+		Environment.elasticsearchClient.indices().create(c -> c.index(index));
+	}
+	
+	public static void deleteIndex(String index) throws Exception {
+		Environment.elasticsearchClient.indices().delete(c -> c.index(index));
+	}
+	
+	public static void inserData(String index, List<Map> datas) throws Exception {
+		List<BulkOperation> bulkOperations = new ArrayList<>();
+		for (Map data : datas) {
+			bulkOperations.add(new BulkOperation.Builder().create(d -> d.document(data).index(index)).build());
+		}
+		BulkResponse response = Environment.elasticsearchClient.bulk(e -> e.index(index).operations(bulkOperations));
+		if (response.errors() == true) {
+			throw new Exception("保存数据错误");
+		}
+	}
+
+	public static List<Map> queryData(String index,Map<String, Object> params, Page page) throws Exception {
+		List<Map> datas = new ArrayList<Map>();
+		BoolQuery.Builder bb = new BoolQuery.Builder();
+		Set<String> set = params.keySet();
+		for (String key : set) {
+			WildcardQuery.Builder wb = new WildcardQuery.Builder();
+			wb.field(key).value("*" + params.get(key) + "*");
+			bb.must(wb.build()._toQuery());
+		}
+
+		SearchRequest.Builder srb = new SearchRequest.Builder();
+		srb.index(index);
+		srb.query(bb.build()._toQuery());
+		if (page != null) {
+			List<SortOptions> soList = new ArrayList<SortOptions>();
+			SortOptions.Builder sob = new SortOptions.Builder();
+			if (page.getOrder().equals("asc")) {
+				sob.field(FieldSort.of(sort -> sort.field(page.getSort()).order(SortOrder.Asc)));
+			} else {
+				sob.field(FieldSort.of(sort -> sort.field(page.getSort()).order(SortOrder.Desc)));
+			}
+			soList.add(sob.build());
+			srb.sort(soList);
+		}
+		srb.from((page.getPage() - 1) * page.getRows());
+		srb.size(page.getRows());
+		SearchResponse<Map> s_res = Environment.elasticsearchClient.search(srb.build(), Map.class);
+		List<Hit<Map>> hms = s_res.hits().hits();
+		for (Hit<Map> hm : hms) {
+			Map data = hm.source();
+			datas.add(data);
+		}
+		return datas;
+	}
+	
+	public void deleteData(List<String> ids,String index) throws ElasticsearchException, IOException {
+		for(String id : ids) {
+			DeleteByQueryRequest.Builder drb = new DeleteByQueryRequest.Builder();
+			drb.index(index);
+			TermQuery.Builder tqb = new TermQuery.Builder();
+			tqb.field("id").value(id);
+			drb.query(tqb.build()._toQuery());
+			Environment.elasticsearchClient.deleteByQuery(drb.build());
+		}
+	}
+	
+	public void updateData(String index,String id,Map obj) throws ElasticsearchException, IOException {
+		SearchRequest.Builder srb = new SearchRequest.Builder();
+		srb.index(index);
+		TermQuery.Builder tqb = new TermQuery.Builder();
+		tqb.field("id").value(id);
+		srb.query(tqb.build()._toQuery());
+		SearchResponse<Map> s_res = Environment.elasticsearchClient.search(srb.build(), Map.class);
+		List<Hit<Map>> hms = s_res.hits().hits();
+		for (Hit<Map> hm : hms) {
+			UpdateRequest.Builder urb = new UpdateRequest.Builder();
+			urb.doc(obj);
+			urb.id(hm.id());
+			urb.index(hm.index());
+			Environment.elasticsearchClient.update(urb.build(), Map.class);
+		}
+	}
+	
+}

+ 112 - 0
src/main/java/com/pub/util/ExcelUtil.java

@@ -0,0 +1,112 @@
+package com.pub.util;
+
+import java.lang.reflect.InvocationTargetException;
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFCellStyle;
+import org.apache.poi.hssf.usermodel.HSSFDataFormat;
+import org.apache.poi.hssf.usermodel.HSSFRow;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+
+import com.pub.excel.WriteExcelInterface;
+import com.pub.jdbc.SuperVO;
+
+public class ExcelUtil {
+	public static HSSFWorkbook writeToExcel(List<String[]> metadata, List<? extends Object> data,
+			WriteExcelInterface wel) {
+		int length = metadata.size();
+		HSSFWorkbook workbook = new HSSFWorkbook();
+		HSSFSheet sheet = workbook.createSheet();
+		for (int i = 0; i < length; i++) {
+			sheet.setColumnWidth(i, 25 * 256);
+		}
+		HSSFRow row = sheet.createRow(0);
+		for (int i = 0; i < length; i++) {
+			String[] str = metadata.get(i);
+			HSSFCell cell = row.createCell(i);
+			cell.setCellValue(str[0]);
+		}
+
+		HSSFCellStyle cellStyle = workbook.createCellStyle();
+		HSSFDataFormat format = workbook.createDataFormat();
+		cellStyle.setDataFormat(format.getFormat("@"));
+
+		for (int i = 0; i < data.size(); i++) {
+			row = sheet.createRow(i + 1);
+			for (int j = 0; j < length; j++) {
+				HSSFCell cell = row.createCell(j);
+				String[] str = metadata.get(j);
+				cell.setCellStyle(cellStyle);
+				Object obj = null;
+				try {
+					obj = PropertyUtils.getProperty(data.get(i), str[1]);
+				} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+				if (obj != null) {
+					String value = obj.toString();
+					if (obj instanceof Timestamp) {
+						Timestamp timestamp = (Timestamp) obj;
+						value = DateUtil.formate("yyyy-MM-dd HH:mm:ss", timestamp);
+					} else if (obj instanceof Date) {
+						Date date = (Date) obj;
+						value = DateUtil.formate("yyyy-MM-dd", date);
+					}
+					if (wel != null) {
+						cell.setCellValue(wel.processData(str[1], value, data.get(i)));
+					} else {
+						cell.setCellValue(value);
+					}
+				}
+			}
+		}
+		return workbook;
+	}
+
+	public static void writeDataToExcelByTemplate(HSSFSheet sheet, HSSFCellStyle cellStyle, List<String> metadata,
+			List data, int index_row, int index_col, WriteExcelInterface wel) {
+
+		HSSFRow row;
+		for (int i = 0; i < data.size(); i++) {
+			row = sheet.createRow(i + index_row);
+			for (int j = 0; j < metadata.size(); j++) {
+				HSSFCell cell = row.createCell(index_col + j);
+				cell.setCellStyle(cellStyle);
+				Object obj = null;
+				try {
+					obj = PropertyUtils.getProperty(data.get(i), metadata.get(j));
+				} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+				if (obj != null) {
+					String value = obj.toString();
+					if (obj instanceof Timestamp) {
+						Timestamp timestamp = (Timestamp) obj;
+						value = DateUtil.formate("yyyy-MM-dd HH:mm:ss", timestamp);
+					} else if (obj instanceof Date) {
+						Date date = (Date) obj;
+						value = DateUtil.formate("yyyy-MM-dd", date);
+					}
+					if (wel != null) {
+						cell.setCellValue(wel.processData(metadata.get(j), value, data.get(i)));
+					} else {
+						cell.setCellValue(value);
+					}
+				} else {
+					if (wel != null) {
+						cell.setCellValue(wel.processData(metadata.get(j), "", data.get(i)));
+					} else {
+						cell.setCellValue("");
+					}
+				}
+			}
+		}
+	}
+}

+ 71 - 0
src/main/java/com/pub/util/ForeignKeyUtil.java

@@ -0,0 +1,71 @@
+package com.pub.util;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.beanutils.BeanUtils;
+
+import com.pub.jdbc.BaseDAO;
+import com.pub.listener.SpringContext;
+import com.pub.log.Log;
+
+public class ForeignKeyUtil {
+
+	/**
+	 * 
+	 * @param rows    数据
+	 * @param v_field 数据的外键字段
+	 * @param t_name  表名
+	 * @param t_field 获取表的字段
+	 * @param d_field 设置数据的字段
+	 */
+	public static void processForeignKey(List<? extends Object> rows, String t_name, String v_field, String[] t_field,
+			String[] d_field) {
+		try {
+			if (d_field == null) {
+				d_field = t_field;
+			}
+			if (t_field.length != d_field.length) {
+				throw new Exception("c_field和k_field数量要一致");
+			}
+			BaseDAO baseDAO = SpringContext.getContext().getBean(BaseDAO.class);
+			Set<String> idSet = new HashSet<>();
+			for (Object row : rows) {
+				Object v = BeanUtils.getProperty(row, v_field);
+				if (v != null) {
+					idSet.add(v.toString());
+				}
+			}
+			if (idSet.size() > 0) {
+				String id_in = "";
+				for (String id : idSet) {
+					id_in = id_in + id + ",";
+				}
+				id_in = id_in.substring(0, id_in.length() - 1);
+				List<Map<String, Object>> fks = baseDAO.queryBySQL(
+						"select * from " + t_name + " where ifnull(dr,0)=0 and id in ('" + id_in.replaceAll(",", "','") + "') ");
+				Map<String, Map<String, Object>> um = new HashMap<String, Map<String, Object>>();
+				for (Map<String, Object> fk : fks) {
+					um.put((String) fk.get("id"), fk);
+				}
+				for (Object row : rows) {
+					Object key = BeanUtils.getProperty(row, v_field);
+					if (um.get(key) != null) {
+						int i = 0;
+						for (String k : t_field) {
+							BeanUtils.setProperty(row, d_field[i], um.get(key).get(k));
+							i++;
+						}
+					}
+				}
+			}
+		} catch (Exception e) {
+			// TODO: handle exception
+			e.printStackTrace();
+			Log.error(e);
+		}
+	}
+}

部分文件因为文件数量过多而无法显示