liu 2 år sedan
förälder
incheckning
7705919ee5
100 ändrade filer med 7237 tillägg och 0 borttagningar
  1. 222 0
      hs_err_pid5336.log
  2. 196 0
      pom.xml
  3. 163 0
      share_video.iml
  4. 110 0
      share_videos.iml
  5. 84 0
      src/main/java/com/template/AutoCode.java
  6. 19 0
      src/main/java/com/template/MybatisPlusApplication.java
  7. 12 0
      src/main/java/com/template/annotation/ControllerIsShow.java
  8. 16 0
      src/main/java/com/template/annotation/Encrypt.java
  9. 28 0
      src/main/java/com/template/annotation/PassToken.java
  10. 14 0
      src/main/java/com/template/annotation/UserLoginCheck.java
  11. 45 0
      src/main/java/com/template/aop/LoginCheckAspect.java
  12. 18 0
      src/main/java/com/template/api/ExcelControllerAPI.java
  13. 38 0
      src/main/java/com/template/api/HouseAPI.java
  14. 28 0
      src/main/java/com/template/api/HousePriceAPI.java
  15. 27 0
      src/main/java/com/template/api/LoginControllerAPI.java
  16. 34 0
      src/main/java/com/template/api/RepairAdminControllerAPI.java
  17. 14 0
      src/main/java/com/template/common/exception/EmsException.java
  18. 200 0
      src/main/java/com/template/common/exception/EmsExceptionHandler.java
  19. 29 0
      src/main/java/com/template/common/exception/MyCustomException.java
  20. 7 0
      src/main/java/com/template/common/result/Code.java
  21. 83 0
      src/main/java/com/template/common/result/ResponseStatusEnum.java
  22. 184 0
      src/main/java/com/template/common/utils/AES.java
  23. 244 0
      src/main/java/com/template/common/utils/AesUtils.java
  24. 173 0
      src/main/java/com/template/common/utils/CommonUtil.java
  25. 154 0
      src/main/java/com/template/common/utils/DoorLockAESUtil.java
  26. 40 0
      src/main/java/com/template/common/utils/DoorLockMD5Util.java
  27. 41 0
      src/main/java/com/template/common/utils/EncryptionUtil.java
  28. 74 0
      src/main/java/com/template/common/utils/FileUtil.java
  29. 401 0
      src/main/java/com/template/common/utils/HttpClientHelper.java
  30. 105 0
      src/main/java/com/template/common/utils/JWTUtil.java
  31. 46 0
      src/main/java/com/template/common/utils/MD5.java
  32. 132 0
      src/main/java/com/template/common/utils/MyBase64.java
  33. 196 0
      src/main/java/com/template/common/utils/RSAUtils.java
  34. 176 0
      src/main/java/com/template/common/utils/SendSms.java
  35. 25 0
      src/main/java/com/template/common/utils/ValidateCode.java
  36. 67 0
      src/main/java/com/template/common/utils/WaterElectricDataEncAndDecUtil.java
  37. 131 0
      src/main/java/com/template/common/utils/WaterElectricSignUtil.java
  38. 27 0
      src/main/java/com/template/common/utils/paramUtils.java
  39. 25 0
      src/main/java/com/template/common/utils/smsUtil.java
  40. 183 0
      src/main/java/com/template/component/WaterElectricComponent.java
  41. 119 0
      src/main/java/com/template/component/WeiXiaoComponent.java
  42. 25 0
      src/main/java/com/template/config/DoorLockConfig.java
  43. 52 0
      src/main/java/com/template/config/MyBatisPlusConfig.java
  44. 37 0
      src/main/java/com/template/config/MySecurity.java
  45. 39 0
      src/main/java/com/template/config/WaterElectricConfig.java
  46. 21 0
      src/main/java/com/template/config/WeixiaoConfig.java
  47. 21 0
      src/main/java/com/template/controller/ClassScheduleController.java
  48. 85 0
      src/main/java/com/template/controller/ExcelController.java
  49. 290 0
      src/main/java/com/template/controller/HouseController.java
  50. 21 0
      src/main/java/com/template/controller/HouseNumberController.java
  51. 173 0
      src/main/java/com/template/controller/HousePriceController.java
  52. 21 0
      src/main/java/com/template/controller/HouseStateController.java
  53. 121 0
      src/main/java/com/template/controller/LoginController.java
  54. 212 0
      src/main/java/com/template/controller/PasswordIssController.java
  55. 21 0
      src/main/java/com/template/controller/PermissionSettingController.java
  56. 163 0
      src/main/java/com/template/controller/RepairAdminController.java
  57. 49 0
      src/main/java/com/template/controller/UploadServlet.java
  58. 27 0
      src/main/java/com/template/core/CORSConfiguration.java
  59. 113 0
      src/main/java/com/template/core/JwtAuthenticationInterceptor.java
  60. 25 0
      src/main/java/com/template/core/JwtlnterceptorConfig.java
  61. 77 0
      src/main/java/com/template/core/ReplaceStreamFilter.java
  62. 129 0
      src/main/java/com/template/core/RequestWrapper.java
  63. 74 0
      src/main/java/com/template/core/SwaggerConfiguration.java
  64. 26 0
      src/main/java/com/template/handle/NonStaticResourceHttpRequestHandler.java
  65. 49 0
      src/main/java/com/template/handler/MyMetaObjectHandler.java
  66. 18 0
      src/main/java/com/template/mapper/ClassScheduleMapper.java
  67. 31 0
      src/main/java/com/template/mapper/HouseMapper.java
  68. 18 0
      src/main/java/com/template/mapper/HouseNumberMapper.java
  69. 23 0
      src/main/java/com/template/mapper/HousePriceMapper.java
  70. 18 0
      src/main/java/com/template/mapper/HouseStateMapper.java
  71. 18 0
      src/main/java/com/template/mapper/PermissionSettingMapper.java
  72. 17 0
      src/main/java/com/template/mapper/RepairAdminMapper.java
  73. 19 0
      src/main/java/com/template/model/dto/AlterDto.java
  74. 13 0
      src/main/java/com/template/model/dto/AlterPriceDto.java
  75. 29 0
      src/main/java/com/template/model/dto/BillHandleResultDTO.java
  76. 41 0
      src/main/java/com/template/model/dto/CardInfoDto.java
  77. 56 0
      src/main/java/com/template/model/dto/EventMessageDTO.java
  78. 39 0
      src/main/java/com/template/model/dto/FingerprintDataDto.java
  79. 15 0
      src/main/java/com/template/model/dto/HouseDto.java
  80. 12 0
      src/main/java/com/template/model/dto/HousePriceAlterDto.java
  81. 37 0
      src/main/java/com/template/model/dto/LockRoomDTO.java
  82. 33 0
      src/main/java/com/template/model/dto/PasswordDto.java
  83. 27 0
      src/main/java/com/template/model/enumModel/PasswordUrlEnum.java
  84. 32 0
      src/main/java/com/template/model/enumModel/eIsSuper.java
  85. 33 0
      src/main/java/com/template/model/enumModel/eStatu.java
  86. 76 0
      src/main/java/com/template/model/pojo/ClassSchedule.java
  87. 89 0
      src/main/java/com/template/model/pojo/House.java
  88. 73 0
      src/main/java/com/template/model/pojo/HouseNumber.java
  89. 75 0
      src/main/java/com/template/model/pojo/HousePrice.java
  90. 67 0
      src/main/java/com/template/model/pojo/HouseState.java
  91. 98 0
      src/main/java/com/template/model/pojo/PermissionSetting.java
  92. 81 0
      src/main/java/com/template/model/pojo/RepairAdmin.java
  93. 29 0
      src/main/java/com/template/model/request/changePasswordRequest.java
  94. 29 0
      src/main/java/com/template/model/request/freezeRepairAdminRequest.java
  95. 23 0
      src/main/java/com/template/model/request/loginRequest.java
  96. 40 0
      src/main/java/com/template/model/request/queryAccountPageRequest.java
  97. 34 0
      src/main/java/com/template/model/request/updateRepairAdminRequest.java
  98. 35 0
      src/main/java/com/template/model/result/BaseResult.java
  99. 158 0
      src/main/java/com/template/model/result/CommonResult.java
  100. 0 0
      src/main/java/com/template/model/result/PageUtils.java

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 222 - 0
hs_err_pid5336.log


+ 196 - 0
pom.xml

@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.4.0</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>com.template</groupId>
+    <artifactId>mybatis_plus</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>mybatis_plus</name>
+    <description>Demo project for Spring Boot</description>
+
+    <properties>
+        <java.version>1.8</java.version>
+        <tencent.qcloudsms.version>1.0.6</tencent.qcloudsms.version>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>javax.validation</groupId>
+            <artifactId>validation-api</artifactId>
+            <version>2.0.1.Final</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-validator</artifactId>
+            <version>6.1.5.Final</version>
+        </dependency>
+
+        <!--   读取excel数据     -->
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+            <version>4.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>4.1.0</version>
+        </dependency>
+
+        <!-- fastjson -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>2.0.12</version>
+        </dependency>
+
+        <!--引入JWT-->
+        <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>java-jwt</artifactId>
+            <version>3.10.0</version>
+        </dependency>
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt</artifactId>
+            <version>0.9.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.qcloudsms</groupId>
+            <artifactId>qcloudsms</artifactId>
+            <version>${tencent.qcloudsms.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.tencentcloudapi</groupId>
+            <artifactId>tencentcloud-sdk-java</artifactId>
+            <version>3.1.742</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.10</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.8.7</version>
+        </dependency>
+        <!-- 数据库驱动 -->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+        <!-- lombok -->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+        <!-- mybatis-plus -->
+        <!-- mybatis-plus 是自己开发,并非官方的! -->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.0.5</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-test</artifactId>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.junit.vintage</groupId>
+                    <artifactId>junit-vintage-engine</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+            <version>5.3.22</version>
+        </dependency>
+
+        <!-- https://mvnrepository.com/artifact/org.eclipse.jgit/org.eclipse.jgit -->
+        <dependency>
+            <groupId>org.eclipse.jgit</groupId>
+            <artifactId>org.eclipse.jgit</artifactId>
+            <version>5.4.3.201909031940-r</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-configuration-processor</artifactId>
+            <optional>true</optional>
+        </dependency>
+
+        <!-- redis -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>io.lettuce</groupId>
+                    <artifactId>lettuce-core</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>redis.clients</groupId>
+            <artifactId>jedis</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+            <version>2.9.2</version>
+        </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger-ui</artifactId>
+            <version>2.9.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.velocity</groupId>
+            <artifactId>velocity-engine-core</artifactId>
+            <version>2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>jakarta.validation</groupId>
+            <artifactId>jakarta.validation-api</artifactId>
+            <version>2.0.2</version>
+        </dependency>
+
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 163 - 0
share_video.iml

@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="Spring" name="Spring">
+      <configuration>
+        <fileset id="spring_boot_com.video.MybatisPlusApplication" profiles="dev" autodetected="true" />
+      </configuration>
+    </facet>
+    <facet type="web" name="Web">
+      <configuration>
+        <webroots />
+        <sourceRoots>
+          <root url="file://$MODULE_DIR$/src/main/java" />
+          <root url="file://$MODULE_DIR$/src/main/resources" />
+        </sourceRoots>
+      </configuration>
+    </facet>
+  </component>
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
+    <output url="file://$MODULE_DIR$/target/classes" />
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+      <excludeFolder url="file://$MODULE_DIR$/target" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="Maven: com.alibaba:fastjson:2.0.12" level="project" />
+    <orderEntry type="library" name="Maven: com.alibaba.fastjson2:fastjson2-extension:2.0.12" level="project" />
+    <orderEntry type="library" name="Maven: com.alibaba.fastjson2:fastjson2:2.0.12" level="project" />
+    <orderEntry type="library" name="Maven: com.auth0:java-jwt:3.10.0" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.3" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.3" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.3" level="project" />
+    <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.15" level="project" />
+    <orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt:0.9.1" level="project" />
+    <orderEntry type="library" name="Maven: com.github.qcloudsms:qcloudsms:1.0.6" level="project" />
+    <orderEntry type="library" name="Maven: org.json:json:20170516" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.13" level="project" />
+    <orderEntry type="library" name="Maven: com.tencentcloudapi:tencentcloud-sdk-java:3.1.742" level="project" />
+    <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
+    <orderEntry type="library" name="Maven: com.squareup.okio:okio:2.10.0" level="project" />
+    <orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib:1.4.10" level="project" />
+    <orderEntry type="library" name="Maven: org.jetbrains:annotations:13.0" level="project" />
+    <orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-common:1.4.10" level="project" />
+    <orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:3.14.9" level="project" />
+    <orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.3.1" level="project" />
+    <orderEntry type="library" name="Maven: javax.activation:javax.activation-api:1.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.squareup.okhttp3:logging-interceptor:3.14.9" level="project" />
+    <orderEntry type="library" name="Maven: org.ini4j:ini4j:0.5.4" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.4.0" level="project" />
+    <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
+    <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.13.3" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.13.3" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
+    <orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
+    <orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.27" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.1" level="project" />
+    <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.6" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.10" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.13" level="project" />
+    <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.7" level="project" />
+    <orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.22" level="project" />
+    <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.16" level="project" />
+    <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.0.5" level="project" />
+    <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.0.5" level="project" />
+    <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.0.5" level="project" />
+    <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.0.5" level="project" />
+    <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.0.5" level="project" />
+    <orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:1.2" level="project" />
+    <orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.2" level="project" />
+    <orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.6" level="project" />
+    <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-generator:3.0.5" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.4.0" level="project" />
+    <orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.4.0" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.3" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.3" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.3" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.39" level="project" />
+    <orderEntry type="library" name="Maven: org.glassfish:jakarta.el:3.0.3" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.39" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.3.1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.4.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.4.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.4.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.18.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.7.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.7.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.7.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.7.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.7.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.7.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:3.6.0" level="project" />
+    <orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.10.18" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.18" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:3.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:3.6.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.3.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.7.0" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.22" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.1" level="project" />
+    <orderEntry type="library" name="Maven: org.eclipse.jgit:org.eclipse.jgit:5.4.3.201909031940-r" level="project" />
+    <orderEntry type="library" name="Maven: com.jcraft:jsch:0.1.55" level="project" />
+    <orderEntry type="library" name="Maven: com.jcraft:jzlib:1.1.1" level="project" />
+    <orderEntry type="library" name="Maven: com.googlecode.javaewah:JavaEWAH:1.1.6" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
+    <orderEntry type="library" name="Maven: org.bouncycastle:bcpg-jdk15on:1.61" level="project" />
+    <orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.61" level="project" />
+    <orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.61" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:2.4.0" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.4.1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.4.1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.4.1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-tx:5.3.1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.3.1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.1" level="project" />
+    <orderEntry type="library" name="Maven: redis.clients:jedis:3.3.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.9.0" level="project" />
+    <orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.9.2" level="project" />
+    <orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.20" level="project" />
+    <orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.20" level="project" />
+    <orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.9.2" level="project" />
+    <orderEntry type="library" name="Maven: io.springfox:springfox-core:2.9.2" level="project" />
+    <orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.9.2" level="project" />
+    <orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.9.2" level="project" />
+    <orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.9.2" level="project" />
+    <orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.2.0.Final" level="project" />
+    <orderEntry type="library" name="Maven: io.springfox:springfox-swagger-ui:2.9.2" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.velocity:velocity-engine-core:2.0" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.11" level="project" />
+  </component>
+</module>

+ 110 - 0
share_videos.iml

@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="Spring" name="Spring">
+      <configuration />
+    </facet>
+    <facet type="web" name="Web">
+      <configuration>
+        <webroots />
+        <sourceRoots>
+          <root url="file://$MODULE_DIR$/src/main/java" />
+          <root url="file://$MODULE_DIR$/src/main/resources" />
+        </sourceRoots>
+      </configuration>
+    </facet>
+  </component>
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
+    <output url="file://$MODULE_DIR$/target/classes" />
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+      <excludeFolder url="file://$MODULE_DIR$/target" />
+    </content>
+    <orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.19" level="project" />
+    <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.12" level="project" />
+    <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.0.5" level="project" />
+    <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.0.5" level="project" />
+    <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.0.5" level="project" />
+    <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.0.5" level="project" />
+    <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.0.5" level="project" />
+    <orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:1.2" level="project" />
+    <orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.2" level="project" />
+    <orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.6" level="project" />
+    <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-generator:3.0.5" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.2.5.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.2.5.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.2.5.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.2" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.4.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.4.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.2.5.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.2.5.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.2.5.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.2.5.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
+    <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.12.1" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.12.1" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
+    <orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.25" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.2.5.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.2" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.10.2" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.10.2" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.10.2" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.10.2" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.10.2" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.2.5.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.31" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.31" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.31" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.2.5.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
+    <orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.18.Final" level="project" />
+    <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.4.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.4.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.4.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.4.RELEASE" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.2.5.RELEASE" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.2.5.RELEASE" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.2.5.RELEASE" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.2" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.5.2" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.5.2" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.5.2" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.5.2" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.5.2" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.5.2" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:3.1.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.13.2" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.1" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:3.1.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.10.8" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.8" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.4.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.4.RELEASE" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.2.4.RELEASE" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.6.3" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.22" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.4.RELEASE" level="project" />
+  </component>
+</module>

+ 84 - 0
src/main/java/com/template/AutoCode.java

@@ -0,0 +1,84 @@
+package com.template;
+
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.generator.AutoGenerator;
+import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
+import com.baomidou.mybatisplus.generator.config.GlobalConfig;
+import com.baomidou.mybatisplus.generator.config.PackageConfig;
+import com.baomidou.mybatisplus.generator.config.StrategyConfig;
+import com.baomidou.mybatisplus.generator.config.po.TableFill;
+import com.baomidou.mybatisplus.generator.config.rules.DateType;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+
+import java.util.ArrayList;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/3/30 星期四 15:46
+ * @Description: com.video
+ * @Version: 1.0
+ */
+public class AutoCode {
+    public static void main(String[] args) {
+// 需要构建一个 代码自动生成器 对象
+        AutoGenerator mpg = new AutoGenerator();
+// 配置策略
+// 1、全局配置
+        GlobalConfig gc = new GlobalConfig();
+        String projectPath = System.getProperty("user.dir");
+        gc.setOutputDir(projectPath + "/src/main/java");
+        gc.setAuthor("ceshi");
+        gc.setOpen(false);
+        gc.setFileOverride(false); // 是否覆盖
+        gc.setServiceName("%sService"); // 去Service的I前缀
+        gc.setIdType(IdType.UUID);
+        gc.setDateType(DateType.ONLY_DATE);
+        gc.setSwagger2(true);
+        mpg.setGlobalConfig(gc);
+//2、设置数据源
+        DataSourceConfig dsc = new DataSourceConfig();
+        dsc.setUrl("jdbc:mysql://localhost:3306/ihotel_test?useUnicode=tru&characterEncoding=UTF-8&useSSL=false&useAffectedRows=true&allowPublicKeyRetrieval=true&allowMultiQueries=true&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai");
+        dsc.setDriverName("com.mysql.cj.jdbc.Driver");
+        dsc.setUsername("root");
+        dsc.setPassword("root");
+        dsc.setDbType(DbType.MYSQL);
+        mpg.setDataSource(dsc);
+        //3、包的配置
+        PackageConfig pc = new PackageConfig();
+        pc.setModuleName("auto");
+        pc.setParent("com.template");
+        pc.setEntity("model");
+        pc.setMapper("mapper");
+        pc.setService("services");
+        pc.setController("controller");
+        mpg.setPackageInfo(pc);
+        //4、策略配置
+        StrategyConfig strategy = new StrategyConfig();
+        strategy.setInclude("house_price"); // 设置要映射的表名
+        strategy.setNaming(NamingStrategy.underline_to_camel);//下划线转驼峰
+        strategy.setColumnNaming(NamingStrategy.underline_to_camel);//下划线转驼峰
+        strategy.setEntityLombokModel(true); // 自动lombok;
+        strategy.setLogicDeleteFieldName("deleted");//逻辑删除 调用service的删除方法不会真删除 会把deleted字段的值改为1 (未删除="0",删除="1")
+        // 自动填充配置
+        TableFill deletedCreate = new TableFill("deleted", FieldFill.INSERT);
+        TableFill timeCreate = new TableFill("create_time", FieldFill.INSERT);
+        TableFill userCreate = new TableFill("create_user", FieldFill.INSERT);
+        TableFill timeModified = new TableFill("update_time", FieldFill.INSERT_UPDATE);
+        TableFill userModified = new TableFill("update_user", FieldFill.INSERT_UPDATE);
+        ArrayList<TableFill> tableFills = new ArrayList<>();
+        tableFills.add(deletedCreate);
+        tableFills.add(timeCreate);
+        tableFills.add(userCreate);
+        tableFills.add(timeModified);
+        tableFills.add(userModified);
+        strategy.setTableFillList(tableFills);
+        // 乐观锁
+        strategy.setVersionFieldName("version");
+        strategy.setRestControllerStyle(true);
+        strategy.setControllerMappingHyphenStyle(true); //localhost:8080/hello_id_2
+        mpg.setStrategy(strategy);
+        mpg.execute(); //执行
+    }
+}

+ 19 - 0
src/main/java/com/template/MybatisPlusApplication.java

@@ -0,0 +1,19 @@
+package com.template;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@EnableCaching//开启缓存
+@SpringBootApplication
+@EnableTransactionManagement //开启事务回滚
+@EnableScheduling//开启定时任务
+public class MybatisPlusApplication {
+
+    public static void main(String[] args) {
+
+        SpringApplication.run(MybatisPlusApplication.class, args);
+    }
+}

+ 12 - 0
src/main/java/com/template/annotation/ControllerIsShow.java

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

+ 16 - 0
src/main/java/com/template/annotation/Encrypt.java

@@ -0,0 +1,16 @@
+package com.template.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ *  加密注解
+ *
+ * @author wang
+ * @date 2022-05-20
+ * */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface Encrypt {
+
+}

+ 28 - 0
src/main/java/com/template/annotation/PassToken.java

@@ -0,0 +1,28 @@
+package com.template.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/** 说明
+ * 在方法上加入本注解 即可接口拦截
+ * @interface:代表当前类是注解
+ * @Target:描述当前的注解可以定义在扫描资源上。
+ * 属性value:
+ *     定义具体的资源。包括:
+ *     ElementType.METHOD:可以定义在方法上
+ *     ElementType.TYPE:可以定义在类上
+ *     ElementType.FIELD:可以定义在属性上
+ *     ElementType.PARAMETER:可以定义在方法参数上
+ * @Retention:当前注解在什么时候有效
+ *     定义具体的生效标记
+ *     RetentionPolicy.RUNTIME:运行时有效
+ *     RetentionPolicy.SOURCE:源码中有效
+ *     RetentionPolicy.CLASS:字节码有效
+ *///说明 该注解要加在控制器中的方法上才会生效 加在api中无法生效
+@Target(value = {ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PassToken {
+    boolean requeired() default true;
+}

+ 14 - 0
src/main/java/com/template/annotation/UserLoginCheck.java

@@ -0,0 +1,14 @@
+package com.template.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/4/10 星期一 14:04
+ * @Description: com.video.services.annotation
+ * @Version: 1.0
+ */
+@Target(ElementType.METHOD)
+public @interface UserLoginCheck {
+}

+ 45 - 0
src/main/java/com/template/aop/LoginCheckAspect.java

@@ -0,0 +1,45 @@
+package com.template.aop;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.After;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/4/10 星期一 14:10
+ * @Description: com.video.aop
+ * @Version: 1.0
+ */
+@Aspect//把当前类标识作为一个切面供容器读取
+@Component//将此类标记为Spring容器中的一个Bean
+@Order(0)//order的值越小,优先级越高 order如果不标注数字,默认最低优先级,因为其默认值是int最大值
+public class LoginCheckAspect {
+
+    @Around("@annotation(com.template.annotation.UserLoginCheck)")
+    public Object userLoginCheck(ProceedingJoinPoint process) throws Throwable {
+        System.out.println("用户登录检测机制");
+        if(1 == 1){
+           //通过抛异常方式拦截
+           // throw new Exception("非法登录");
+        }
+
+        Object proceed;
+        proceed = process.proceed();//执行目标方法
+        return proceed;//将执行目标方法后的返回值返回出去
+    }
+
+    @After("@annotation(com.template.annotation.UserLoginCheck)")
+    public void test(){
+        System.out.println("测试After");
+    }
+
+    @Before("@annotation(com.template.annotation.UserLoginCheck)")
+    public void test1(){
+        System.out.println("测试Before");
+    }
+
+}

+ 18 - 0
src/main/java/com/template/api/ExcelControllerAPI.java

@@ -0,0 +1,18 @@
+package com.template.api;
+
+import com.template.annotation.PassToken;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Api(tags = {"ExcelController"}, value = "导入excel表")
+@RequestMapping("/api/excel")
+public interface ExcelControllerAPI {
+
+    @PostMapping("/toExcel")
+    @ApiOperation(value = "导入excel表更新用户",httpMethod = "POST")
+    @PassToken
+    void toExcel(String fileUrl);
+
+}

+ 38 - 0
src/main/java/com/template/api/HouseAPI.java

@@ -0,0 +1,38 @@
+package com.template.api;
+
+import com.template.model.dto.HouseDto;
+import com.template.model.pojo.House;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.ApiOperation;
+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;
+
+@RequestMapping("/auto/house")
+public interface HouseAPI {
+
+    @PostMapping("/save")
+    @ApiOperation(value = "房型添加", notes = "房型编辑", httpMethod = "POST")
+    CommonResult save(@RequestBody HouseDto houseDto);
+
+
+    @GetMapping("/list")
+    @ApiOperation(value = "房型管理", notes = "房型管理", httpMethod = "GET")
+    CommonResult getPage(int page, int size, int type, String keyWord);
+
+
+    @GetMapping("/details")
+    @ApiOperation(value = "房型编辑详情", notes = "房型编辑详情", httpMethod = "GET")
+    CommonResult details(String houseId);
+
+
+    @PostMapping("/update")
+    @ApiOperation(value = "房型修改", notes = "房型修改", httpMethod = "POST")
+    CommonResult update(@RequestBody HouseDto houseDto);
+
+    @GetMapping("/delete")
+    @ApiOperation(value = "房型删除", notes = "房型删除", httpMethod = "GET")
+    CommonResult delete(String houseId,int adminId);
+
+}

+ 28 - 0
src/main/java/com/template/api/HousePriceAPI.java

@@ -0,0 +1,28 @@
+package com.template.api;
+
+import com.template.model.dto.AlterPriceDto;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.ApiOperation;
+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;
+
+@RequestMapping("/auto/house-price")
+public interface HousePriceAPI {
+
+    @GetMapping("/roomType")
+    @ApiOperation(value = "房型类型列表", notes = "房型类型列表", httpMethod = "GET")
+    CommonResult roomType();
+
+
+    @PostMapping("/alterPrice")
+    @ApiOperation(value = "批量改价", notes = "批量改价", httpMethod = "POST")
+    CommonResult alterPrice(@RequestBody AlterPriceDto alterPriceDto);
+
+
+    @GetMapping("/alterPriceRecord")
+    @ApiOperation(value = "批量改价记录", notes = "批量改价记录", httpMethod = "GET")
+    CommonResult alterPriceRecord(int adminId,String type,String houseName,String operatingTime,String priceTime,String operatingName,int page,int size);
+
+}

+ 27 - 0
src/main/java/com/template/api/LoginControllerAPI.java

@@ -0,0 +1,27 @@
+package com.template.api;
+
+import com.template.model.pojo.RepairAdmin;
+import com.template.model.request.loginRequest;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+
+@RequestMapping("/api/login")
+@Api(tags = {"LoginController"}, value = "登录")
+public interface LoginControllerAPI {
+
+
+    @PostMapping(value = "/Login")
+    @ApiOperation(value = "登录", notes = "登录", httpMethod = "POST")
+    CommonResult Login(@Validated @RequestBody loginRequest lr, BindingResult bindingResult);
+
+    @PostMapping(value = "/ChangePassword")
+    @ApiOperation(value = "修改密码", notes = "修改密码", httpMethod = "POST")
+    CommonResult ChangePassword(@Validated @RequestBody com.repair.model.request.changePasswordRequest cpr, @RequestHeader("user_head") String userhead, BindingResult bindingResult);
+}

+ 34 - 0
src/main/java/com/template/api/RepairAdminControllerAPI.java

@@ -0,0 +1,34 @@
+package com.template.api;
+
+import com.template.model.pojo.RepairAdmin;
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+@RequestMapping("/api/repairAdmin")
+@Api(tags = {"RepairAdminController"}, value = "账号")
+public interface RepairAdminControllerAPI {
+
+    @PostMapping(value = "/insertRepairAdmin")
+    @ApiOperation(value = "添加账号", notes = "添加账号数据", httpMethod = "POST")
+    CommonResult InsertRepairAdmin(@Validated @RequestBody RepairAdmin repairAdmin, BindingResult bindingResult);
+
+    @GetMapping(value = "/queryPageRepairAdmins")
+    @ApiOperation(value = "账号分页数据", notes = "账号分页数据", httpMethod = "POST")
+    CommonResult queryPageRepairAdmins(@RequestParam int currentPage, @RequestParam int pageCount, String account, String phone, String userName);
+
+    @PostMapping(value = "/freezeRepairAdminById")
+    @ApiOperation(value = "根据ID冻结指定账号", notes = "根据ID冻结指定账户", httpMethod = "POST")
+    CommonResult freezeRepairAdminById(@Validated @RequestBody com.repair.model.request.freezeRepairAdminRequest frar, BindingResult bindingResult);
+
+    @GetMapping(value = "/deleteRepairAdminById")
+    @ApiOperation(value = "根据ID删除指定账号", notes = "根据ID删除指定账号", httpMethod = "POST")
+    CommonResult deleteRepairAdminById(@RequestParam String id);
+
+    @PostMapping(value = "/updateRepairAdminById")
+    @ApiOperation(value = "编辑账号数据", notes = "编辑账号数据", httpMethod = "POST")
+    CommonResult updateRepairAdminById(@Validated @RequestBody com.repair.model.request.updateRepairAdminRequest ra, @RequestHeader("user_head") String userhead, BindingResult bindingResult);
+}

+ 14 - 0
src/main/java/com/template/common/exception/EmsException.java

@@ -0,0 +1,14 @@
+package com.template.common.exception;
+
+import com.template.common.result.ResponseStatusEnum;
+
+/**
+ * 处理异常,统一封装
+ */
+public class EmsException {
+
+    public static void display(ResponseStatusEnum responseStatusEnum) {
+        throw new MyCustomException(responseStatusEnum);
+    }
+
+}

+ 200 - 0
src/main/java/com/template/common/exception/EmsExceptionHandler.java

@@ -0,0 +1,200 @@
+package com.template.common.exception;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.template.common.result.ResponseStatusEnum;
+import com.template.model.result.CommonResult;
+import org.mybatis.spring.MyBatisSystemException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.support.DefaultMessageSourceResolvable;
+import org.springframework.http.converter.HttpMessageNotReadableException;
+import org.springframework.validation.BindException;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.FieldError;
+import org.springframework.web.HttpRequestMethodNotSupportedException;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.MissingServletRequestParameterException;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.fasterxml.jackson.databind.exc.InvalidFormatException;
+import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 统一异常拦截处理
+ * 可以针对异常的类型进行捕获,然后返回json信息到前端
+ */
+@ControllerAdvice
+public class EmsExceptionHandler {
+
+    //org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported
+    final static Logger logger=LoggerFactory.getLogger(EmsExceptionHandler.class);
+
+    //处理Get请求中 使用@Valid 验证路径中请求实体校验失败后抛出的异常
+    @ExceptionHandler(BindException.class)
+    @ResponseBody
+    public CommonResult BindExceptionHandler(BindException e) {
+        String message = e.getBindingResult().getAllErrors().stream().map(DefaultMessageSourceResolvable::getDefaultMessage).collect(Collectors.joining());
+        logger.error("错误信息",message);
+        return CommonResult.resultValue(ResponseStatusEnum.SYSTEM_NULL_POINTER);
+    }
+
+    //处理请求参数格式错误 @RequestParam上validate失败后抛出的异常是javax.validation.ConstraintViolationException
+    @ExceptionHandler(ConstraintViolationException.class)
+    @ResponseBody
+    public CommonResult ConstraintViolationExceptionHandler(ConstraintViolationException e) {
+        String message = e.getConstraintViolations().stream().map(ConstraintViolation::getMessage).collect(Collectors.joining());
+        logger.error("错误信息",message);
+        return CommonResult.resultValue(ResponseStatusEnum.SYSTEM_NULL_POINTER);
+    }
+
+    @ResponseBody
+    @ExceptionHandler(NullPointerException.class)
+    public CommonResult exception(NullPointerException e) {
+        e.printStackTrace();
+        //String error=e.getFieldError().getDefaultMessage();
+        logger.error("错误信息",e.fillInStackTrace());
+        return CommonResult.resultValue(ResponseStatusEnum.SYSTEM_NULL_POINTER);
+    }
+
+    @ExceptionHandler(Exception.class)
+    @ResponseBody
+    public CommonResult exception(Exception e) {
+        e.printStackTrace();
+        //String error=e.getFieldError().getDefaultMessage();
+        logger.error("错误信息",e.fillInStackTrace());
+        return CommonResult.resultValue(ResponseStatusEnum.SYSTEM_ERROR);
+    }
+
+    //mysql连接超时
+    @ExceptionHandler(MyBatisSystemException.class)
+    @ResponseBody
+    public CommonResult exception(MyBatisSystemException e) {
+        e.printStackTrace();
+        //String error=e.getFieldError().getDefaultMessage();
+        logger.error("错误信息",e.fillInStackTrace());
+        return CommonResult.resultValue(ResponseStatusEnum.SYSTEM_MYSQL_TIMEOUT_ERROR);
+    }
+
+    //请求方式错误
+    @ExceptionHandler(HttpRequestMethodNotSupportedException.class)
+    @ResponseBody
+    public CommonResult httpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) {
+        e.printStackTrace();
+        logger.error("错误信息",e.fillInStackTrace());
+        //String error=e.getFieldError().getDefaultMessage();
+        return CommonResult.resultValue(ResponseStatusEnum.SYSTEM_REQUEST_METHOD_ERROR);
+    }
+
+    //传参空异常
+    @ExceptionHandler(MissingServletRequestParameterException.class)
+    @ResponseBody
+    public CommonResult missingServletRequestParameterException(MissingServletRequestParameterException e) {
+        String name=  e.getParameterName();
+        logger.error("错误信息",e.fillInStackTrace());
+
+        //String error=e.getFieldError().getDefaultMessage();
+        return CommonResult.fail(name+"不能为空");
+    }
+
+    @ExceptionHandler(MyCustomException.class)
+    @ResponseBody
+    public CommonResult returnMyException(MyCustomException e) {
+        e.printStackTrace();
+        logger.error("错误信息",e.fillInStackTrace());
+        return CommonResult.resultValue(e.getResponseStatusEnum());
+    }
+
+    /**
+     * 传入JSON数据格式错误
+     * @param e
+     * @return
+     */
+    @ExceptionHandler(JsonParseException.class)
+    @ResponseBody
+    public CommonResult returnMyException(JsonParseException e) {
+        logger.error("错误信息",e.fillInStackTrace());
+        e.printStackTrace();
+        return CommonResult.resultValue(ResponseStatusEnum.SEND_PARAMS);
+    }
+
+
+    /**
+     * 传入JSON数据格式转换错误
+     * @param e
+     * @return
+     */
+    @ExceptionHandler(HttpMessageNotReadableException.class)
+    @ResponseBody
+    public CommonResult httpMessageNotReadableException(HttpMessageNotReadableException e) {
+        logger.error("错误信息",e.fillInStackTrace());
+        e.printStackTrace();//
+        if(e.getCause() instanceof  InvalidFormatException){
+            InvalidFormatException e1=   (InvalidFormatException)e.getCause();
+            Object erro1= e1.getValue();
+            Object erro2=e1.getTargetType().getSimpleName();
+            System.out.print(erro1);
+            System.out.print(erro2);
+        }
+
+        String error=e.getMessage();
+        return CommonResult.resultValue(ResponseStatusEnum.SEND_PARAMS_TYPE);
+    }
+
+
+
+
+
+
+
+    /**
+     * 参数验证错误
+     * @param e
+     * @return
+     */
+    @ExceptionHandler(MethodArgumentNotValidException.class)
+    @ResponseBody
+    public CommonResult returnException(MethodArgumentNotValidException e) {
+        logger.error("错误信息",e.fillInStackTrace());
+        BindingResult result = e.getBindingResult();
+        Map<String, String> map = getErrors(result);
+        return CommonResult.fail(map.values().toString().replace("[","").replace("]",""));
+    }
+
+    /**
+     * 参数验证错误
+     * @param e
+     * @return
+     */
+    @ExceptionHandler(MethodArgumentTypeMismatchException.class)
+    @ResponseBody
+    public CommonResult returnException(MethodArgumentTypeMismatchException e) {
+        logger.error("错误信息",e.fillInStackTrace());
+        String value=e.getValue().toString();
+        String paraType=e.getRequiredType().getName().toString();
+
+        return CommonResult.errorMsg(e.getName()+"数据格式转换错误");
+    }
+
+
+    public Map<String, String> getErrors(BindingResult result) {
+        Map<String, String> map = new HashMap<>();
+        List<FieldError> errorList = result.getFieldErrors();
+        for (FieldError error : errorList) {
+            // 发送验证错误的时候所对应的某个属性
+            String field = error.getField();
+            // 验证的错误消息
+            String msg = error.getDefaultMessage();
+            map.put(field, msg);
+        }
+        return map;
+    }
+
+
+}

+ 29 - 0
src/main/java/com/template/common/exception/MyCustomException.java

@@ -0,0 +1,29 @@
+package com.template.common.exception;
+
+import com.template.common.result.ResponseStatusEnum;
+
+/**
+ * 自定义异常
+ * 目的:统一处理异常信息
+ *      便于解耦,service与controller错误的解耦,不会被service返回的类型而限制
+ */
+public class MyCustomException extends RuntimeException {
+
+    private ResponseStatusEnum responseStatusEnum;
+
+    public MyCustomException(ResponseStatusEnum responseStatusEnum) {
+        super("异常状态码为:" + responseStatusEnum.status()
+                + ";具体异常信息为:" + responseStatusEnum.msg());
+        this.responseStatusEnum = responseStatusEnum;
+    }
+
+    public ResponseStatusEnum getResponseStatusEnum() {
+        return responseStatusEnum;
+    }
+
+    public void setResponseStatusEnum(ResponseStatusEnum responseStatusEnum) {
+        this.responseStatusEnum = responseStatusEnum;
+    }
+
+
+}

+ 7 - 0
src/main/java/com/template/common/result/Code.java

@@ -0,0 +1,7 @@
+package com.template.common.result;
+
+public interface Code {
+    Integer getStatus();
+    Boolean getSuccess();
+    String getMsg();
+}

+ 83 - 0
src/main/java/com/template/common/result/ResponseStatusEnum.java

@@ -0,0 +1,83 @@
+package com.template.common.result;
+
+/**
+ * 响应结果枚举,用于提供给GraceJSONResult返回给前端的
+ * 本枚举类中包含了很多的不同的状态码供使用,可以自定义
+ * 便于更优雅的对状态码进行管理,一目了然
+ */
+public enum ResponseStatusEnum implements Code{
+
+
+    SUCCESS(200, true, "操作成功!"),
+    NO_PERMISSION(401,false,"没有权限"),
+    MISSING_REQUEST_HEADER(499,false,"缺少请求头"),
+    FAILED(500, false, "操作失败!"),
+    SEND_PARAMS(501,false,"传入参数数据结构错误"),
+    SEND_PARAMS_TYPE(502,false,"传入参数数据类型错误"),
+    UN_SERVICES_ERROR(505,false,"操作失败,请联系管理员"),
+
+    // 自定义系统级别异常 54x
+    SYSTEM_ERROR(540, false, "系统错误,错误未知!"),
+    SYSTEM_INDEX_OUT_OF_BOUNDS(541, false, "系统错误,数组越界!"),
+    SYSTEM_ARITHMETIC_BY_ZERO(542, false, "系统错误,无法除零!"),
+    SYSTEM_NULL_POINTER(543, false, "系统错误,空指针!"),
+    SYSTEM_NUMBER_FORMAT(544, false, "系统错误,数字转换异常!"),
+    SYSTEM_PARSE(545, false, "系统错误,解析异常!"),
+    SYSTEM_IO(546, false, "系统错误,IO输入输出异常!"),
+    SYSTEM_FILE_NOT_FOUND(547, false, "系统错误,文件未找到!"),
+    SYSTEM_CLASS_CAST(548, false, "系统错误,类型强制转换错误!"),
+    SYSTEM_PARSER_ERROR(549, false, "系统错误,解析出错!"),
+    SYSTEM_DATE_PARSER_ERROR(550, false, "系统错误,日期解析出错!"),
+    SYSTEM_ERROR_GLOBAL(551, false, "系统繁忙,请稍后再试!"),
+    SYSTEM_ERROR_ZUUL(552, false, "请求系统过于繁忙,请稍后再试!"),
+    SYSTEM_REQUEST_METHOD_ERROR(553, false, "请求类型错误"),
+    SYSTEM_MYSQL_TIMEOUT_ERROR(554, false, "Mysql连接超时"),
+    SYSTEM_MONGO_TIMEOUT_ERROR(555, false, "Mongo连接超时"),
+    SYSTEM_PHONE_ERROR(556,false,"手机号格式错误"),
+    SYSTEM_SEND_PHONE_ERROR(557,false,"发送验证码失败"),
+    SYSTEM_TOKEN_ERROR(558,false,"token为空"),
+    SYSTEM_LOGIN_ERROR(559,false,"无效token"),
+    PARAM_ERROR(560, false, "参数不能为空!"),
+    THIRD_PARTY_SERVICE_CALL_FAILED(561,false,"第三方服务调用失败"),
+    EXISTS(999,false,"已存在");
+
+    // 响应业务状态
+    private Integer status;
+    // 调用是否成功
+    private Boolean success;
+    // 响应消息,可以为成功或者失败的消息
+    private String msg;
+
+    ResponseStatusEnum(Integer status, Boolean success, String msg) {
+        this.status = status;
+        this.success = success;
+        this.msg = msg;
+    }
+
+    public Integer status() {
+        return status;
+    }
+    public Boolean success() {
+        return success;
+    }
+    public String msg() {
+        return msg;
+    }
+
+    @Override
+    public Integer getStatus() {
+        return status;
+    }
+
+    @Override
+    public Boolean getSuccess() {
+        return success;
+    }
+
+    @Override
+    public String getMsg() {
+        return msg;
+    }
+
+
+}

+ 184 - 0
src/main/java/com/template/common/utils/AES.java

@@ -0,0 +1,184 @@
+package com.template.common.utils;
+
+
+import org.bouncycastle.util.encoders.Base64;
+
+import javax.crypto.Cipher;
+import javax.crypto.KeyGenerator;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.UnsupportedEncodingException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.util.Random;
+
+/**
+ * 	AES加密解密
+ */
+public class AES {
+    public static final String CHAR_ENCODING = "UTF-8";
+    public static final String AES_ALGORITHM = "AES/ECB/PKCS5Padding";
+	private static char[] HEXCHAR = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+	/**
+	 * 随机生成AESKey
+	 * @return string
+	 */
+	public static String getAESKey(int length) throws Exception {
+		Random random = new Random();
+		StringBuilder ret = new StringBuilder();
+		for (int i = 0; i < length; i++) {
+			boolean isChar = (random.nextInt(2) % 2 == 0);// 输出字母还是数字
+			if (isChar) { // 字符串
+				int choice = (random.nextInt(2) % 2 == 0) ? 65 : 97; // 取得大写字母还是小写字母
+				ret.append((char) (choice + random.nextInt(26)));
+			} else { // 数字
+				ret.append((random.nextInt(10)));
+			}
+		}
+		return ret.toString();
+	}
+
+	/**
+	 * 加密
+	 * 
+	 * @param / content
+	 *            需要加密的内容
+	 * @param /password
+	 *            加密密码
+	 * @return
+	 */
+	public static byte[] encrypt(byte[] data, byte[] key) {
+		if(key.length!=16){
+			throw new RuntimeException("Invalid AES key length (must be 16 bytes)");
+		}
+		try {
+			SecretKeySpec secretKey = new SecretKeySpec(key, "AES"); 
+			byte[] enCodeFormat = secretKey.getEncoded();
+			SecretKeySpec seckey = new SecretKeySpec(enCodeFormat,"AES");
+			Cipher cipher = Cipher.getInstance(AES_ALGORITHM);// 创建密码器
+			cipher.init(Cipher.ENCRYPT_MODE, seckey);// 初始化
+			byte[] result = cipher.doFinal(data);
+			return result; // 加密
+		} catch (Exception e){
+			throw new RuntimeException("encrypt fail!", e);
+		}
+	}
+
+	/**
+	 * 解密
+	 * 
+	 * @param / content
+	 *            待解密内容
+	 * @param /password
+	 *            解密密钥
+	 * @return
+	 */
+	public static byte[] decrypt(byte[] data, byte[] key) {
+		if(key.length!=16){
+			throw new RuntimeException("Invalid AES key length (must be 16 bytes)");
+		}
+		try {
+			SecretKeySpec secretKey = new SecretKeySpec(key, "AES"); 
+			byte[] enCodeFormat = secretKey.getEncoded();
+			SecretKeySpec seckey = new SecretKeySpec(enCodeFormat, "AES");
+			Cipher cipher = Cipher.getInstance(AES_ALGORITHM);// 创建密码器
+			cipher.init(Cipher.DECRYPT_MODE, seckey);// 初始化
+			byte[] result = cipher.doFinal(data);
+			return result; // 加密
+		} catch (Exception e){
+			throw new RuntimeException("decrypt fail!", e);
+		}
+	}
+	//	//加密
+	public static String encryptToBase64(String data, String key){
+		try {
+			byte[] valueByte = encrypt(data.getBytes(CHAR_ENCODING), key.getBytes(CHAR_ENCODING));
+			return new String(Base64.encode(valueByte));
+		} catch (UnsupportedEncodingException e) {
+			throw new RuntimeException("encrypt fail!", e);
+		}
+		
+	}
+	//	解密
+	public static String decryptFromBase64(String data, String key){
+		try {
+			byte[] originalData = Base64.decode(data.getBytes());
+			byte[] valueByte = decrypt(originalData, key.getBytes(CHAR_ENCODING));
+			return new String(valueByte, CHAR_ENCODING);
+		} catch (UnsupportedEncodingException e) {
+			throw new RuntimeException("decrypt fail!", e);
+		}
+	}
+
+
+	public static String encryptWithKeyBase64(String data, String key){
+		try {
+			byte[] valueByte = encrypt(data.getBytes(CHAR_ENCODING), Base64.decode(key.getBytes()));
+			return new String(Base64.encode(valueByte));
+		} catch (UnsupportedEncodingException e) {
+			throw new RuntimeException("encrypt fail!", e);
+		}
+	}
+
+
+	public static String decryptWithKeyBase64(String data, String key){
+		try {
+			byte[] originalData = Base64.decode(data.getBytes());
+			byte[] valueByte = decrypt(originalData, Base64.decode(key.getBytes()));
+			return new String(valueByte, CHAR_ENCODING);
+		} catch (UnsupportedEncodingException e) {
+			throw new RuntimeException("decrypt fail!", e);
+		}
+	}
+	
+	public static byte[] genarateRandomKey(){
+		KeyGenerator keygen = null;
+		try {
+			keygen = KeyGenerator.getInstance(AES_ALGORITHM);
+		} catch (NoSuchAlgorithmException e) {
+			throw new RuntimeException(" genarateRandomKey fail!", e);
+		}
+		SecureRandom random = new SecureRandom();
+		keygen.init(random);
+		Key key = keygen.generateKey();
+		return key.getEncoded();
+	}
+	
+	public static String genarateRandomKeyWithBase64(){
+		return new String(Base64.encode(genarateRandomKey()));
+	}
+
+	public static void main(String[] args) throws Exception {
+		String aesKey = getAESKey(16);
+		System.out.println("aesKey = " + aesKey);
+
+
+		String key="Vl3726F2RE62zPjH";
+
+//		String ss="https://chtech.ncjti.edu.cn/campusclock/attendance-media/1683595495359_wcbm4bxzrq.jpg";
+		String ss="{\n" +
+				"    \"url\" : \"https://chtech.ncjti.edu.cn/campusclock/attendance-media/1683595495359_wcbm4bxzrq.jpg\" ,\n" +
+				"    \"name\" : \"周祥\" ,\n" +
+				"    \"idCard\" : \"123456789101112131\" ,\n" +
+				"    \"category\" : \"打卡签到\" ,\n" +
+				"    \"studentNumber\" : \"45146054656461\" \n" +
+				"}";
+//		加密
+		String encrypt = encryptToBase64(ss, key);
+		System.out.println("encrypt = " + encrypt);
+
+
+
+		String s="qedS5LjKuPlHHLTiy657GYAAPWslki6rv8AbgN6hqDZLM2Rbgd5XilvOUivIRCHxQJeQeKd2ydDj621GcO6HNVIz3wBtIrUwhe0TJm7kfIfuRQXuo2QVZtX7/S6KowSU";
+//		String s="UtoBNp9fICucUkBimiClN3z5Tz7o0KLiwJ9z50zjOiWNcnqYZ/p/awyi01nDEmxOShfMZFTd9uWkWM7fNPHotvsGhxAdHZNiv3WOMYWzuHIDu27iNcH9tkZhEIr72EFo";
+//		解密
+		String decrypt = decryptFromBase64("MQdw2zW/srXr5Lm/vntgQ8rlW6gin+/VKfb9aKi36nyiEtwg1hORSLOTm9y0m8WxpLoECkMeDa0WQevMHmkNGQajYMrDRhGho6jGGvdNdQVRQXNSWGRZgQTg3ycq1cxT", key);
+		System.out.println("decrypt = " + decrypt);
+
+
+
+
+
+	}
+
+}

+ 244 - 0
src/main/java/com/template/common/utils/AesUtils.java

@@ -0,0 +1,244 @@
+package com.template.common.utils;
+
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.util.StringUtil;
+import org.bouncycastle.util.encoders.Base64;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.util.UUID;
+
+/**
+ * @Author: liujun
+ * @Description: Aes 加解密算法
+ * @Date Create in 上午 9:38$ 2017/12/26 0026$
+ * @Modify By:
+ */
+@Slf4j
+public class AesUtils {
+    private static String password = "52D04DC20036DBD8";
+    /**
+     * @Author liujun
+     * @Description:
+     * @params: * @param content 需要加密的内容
+     * @param password  加密密码
+     * @Date 上午 9:41 2017/12/26 0026
+     */
+    public static String encrypt(String content) {
+
+        if(password.length()<16) {
+            password = password + "0000000000000000".substring(0, 16-password.length());
+        }
+        else if(password.length()>16) {
+            password = password.substring(0, 16);
+        }
+
+        return bytes2HexString(encryptAES(content.getBytes(), password.getBytes()));
+    }
+
+
+    /**
+     * @Author liujun
+     * @Description:
+     * @params: * @param content 待解密内容
+     * @param password 解密密钥
+     * @Date 上午 9:40 2017/12/26 0026
+     */
+    public static String decrypt(String content) {
+        if(password.length()<16) {
+            password = password + "0000000000000000".substring(0, 16-password.length());
+        }
+        else if(password.length()>16) {
+            password = password.substring(0, 16);
+        }
+
+        return new String(decryptAES(hexString2Bytes(content), password.getBytes()));
+    }
+
+
+
+
+    public static String encrypt(String content, String password) {
+        //数据为空,不需要进行加解密,否则会出现空指针异常
+        if (ObjectUtils.isEmpty(content)) {
+            return null;
+        }
+
+        if (password.length() < 16) {
+            password = password + "0000000000000000".substring(0, 16 - password.length());
+        } else if (password.length() > 16) {
+            password = password.substring(0, 16);
+        }
+
+        return bytes2HexString(encryptAES(content.getBytes(), password.getBytes()));
+    }
+
+
+    /**
+     * @param password 解密密钥
+     * @Author liujun
+     * @Description:
+     * @params: * @param content 待解密内容
+     * @Date 上午 9:40 2017/12/26 0026
+     */
+    public static String decrypt(String content, String password) {
+        //数据为空,不需要进行加解密,否则会出现空指针异常
+        if (ObjectUtils.isEmpty(content)) {
+            return null;
+        }
+
+        if (password.length() < 16) {
+            password = password + "0000000000000000".substring(0, 16 - password.length());
+        } else if (password.length() > 16) {
+            password = password.substring(0, 16);
+        }
+
+        return new String(decryptAES(hexString2Bytes(content), password.getBytes()));
+    }
+
+
+    /**
+     * AES 加密
+     *
+     * @param data 明文
+     * @param key  16、24、32 字节秘钥
+     * @return 密文
+     */
+    public static byte[] encryptAES(final byte[] data, final byte[] key) {
+
+        try {
+            SecretKeySpec secretKeySpec = new SecretKeySpec(key, "AES");
+            Cipher cipher = Cipher.getInstance("AES");// 创建密码器
+            byte[] byteContent = data;
+            cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);// 初始化
+            byte[] result = cipher.doFinal(byteContent);
+            return result; // 加密
+        } catch (NoSuchAlgorithmException e) {
+            log.error(e.getMessage(),e);
+        } catch (NoSuchPaddingException e) {
+            log.error(e.getMessage(),e);
+        } catch (InvalidKeyException e) {
+            log.error(e.getMessage(),e);
+        } catch (IllegalBlockSizeException e) {
+            log.error(e.getMessage(),e);
+        } catch (BadPaddingException e) {
+            log.error(e.getMessage(),e);
+        } catch (Exception e) {
+            log.error(e.getMessage(),e);
+        }
+        return null;
+    }
+
+    /**
+     * AES 解密
+     *
+     * @param data 密文
+     * @param key  16、24、32 字节秘钥
+     * @return 明文
+     */
+    public static byte[] decryptAES(final byte[] data, final byte[] key) {
+
+        try {
+            SecretKeySpec secretKeySpec = new SecretKeySpec(key, "AES");
+            Cipher cipher = Cipher.getInstance("AES");// 创建密码器
+            cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);// 初始化
+            byte[] result = cipher.doFinal(data);
+            return result; // 加密
+        } catch (NoSuchAlgorithmException e) {
+            log.error(e.getMessage(),e);
+        } catch (NoSuchPaddingException e) {
+            log.error(e.getMessage(),e);
+        } catch (InvalidKeyException e) {
+            log.error(e.getMessage(),e);
+        } catch (IllegalBlockSizeException e) {
+            log.error(e.getMessage(),e);
+        } catch (BadPaddingException e) {
+            log.error(e.getMessage(),e);
+        } catch (Exception e) {
+            log.error(e.getMessage(),e);
+        }
+        return null;
+    }
+
+    public static String bytes2HexString(final byte[] bytes) {
+        if (bytes == null) return null;
+        int len = bytes.length;
+        if (len <= 0) return null;
+        char[] ret = new char[len << 1];
+        for (int i = 0, j = 0; i < len; i++) {
+            ret[j++] = hexDigits[bytes[i] >>> 4 & 0x0f];
+            ret[j++] = hexDigits[bytes[i] & 0x0f];
+        }
+        return new String(ret);
+    }
+
+    private static final char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+
+    public static byte[] hexString2Bytes(String hexString) {
+        if (isSpace(hexString)) return null;
+        int len = hexString.length();
+        if (len % 2 != 0) {
+            hexString = "0" + hexString;
+            len = len + 1;
+        }
+        char[] hexBytes = hexString.toUpperCase().toCharArray();
+        byte[] ret = new byte[len >> 1];
+        for (int i = 0; i < len; i += 2) {
+            ret[i >> 1] = (byte) (hex2Dec(hexBytes[i]) << 4 | hex2Dec(hexBytes[i + 1]));
+        }
+        return ret;
+    }
+
+    private static int hex2Dec(final char hexChar) {
+        if (hexChar >= '0' && hexChar <= '9') {
+            return hexChar - '0';
+        } else if (hexChar >= 'A' && hexChar <= 'F') {
+            return hexChar - 'A' + 10;
+        } else {
+            throw new IllegalArgumentException();
+        }
+    }
+
+    public static byte[] base64Encode(final byte[] input) {
+        return Base64.encode(input);
+    }
+
+    public static byte[] base64Decode(final byte[] input) {
+
+        return Base64.decode(input);
+    }
+
+    private static boolean isSpace(final String s) {
+        if (s == null) return true;
+        for (int i = 0, len = s.length(); i < len; ++i) {
+            if (!Character.isWhitespace(s.charAt(i))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public static void main(String[] args) {
+        String s="{\n" +
+                "  \"categoryId\": \"72cf28a8789643bbbbb62d08ee91f17e\",\n" +
+                "     \"luid\": \"80A036D93CFB\",\n" +
+                "     \"type\":\"4\",\n" +
+                "     \"userName\":\"13097286670\",\n" +
+                "     \"startTime\":\"1682389484000\",\n" +
+                "     \"endTime\":\"1684981484000\",\n" +
+                "     \"password\":\"A08E87B5E777EBEE2C6EF3262F069D5A\"\n" +
+                "}";
+        //加密
+        String encryptString = AesUtils.encrypt("548903");
+        System.out.println("加密后字符串:"+encryptString);
+        //解密
+        String decryptString = AesUtils.decrypt("D7F2608679E842626C98CF8B6A9B61C5","047863CA78E0");
+        System.out.println("解密后字符串:"+decryptString);
+    }
+}

+ 173 - 0
src/main/java/com/template/common/utils/CommonUtil.java

@@ -0,0 +1,173 @@
+package com.template.common.utils;
+
+import lombok.extern.slf4j.Slf4j;
+
+import javax.servlet.http.HttpServletRequest;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.security.MessageDigest;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.util.*;
+
+/**
+ * 公共工具类
+ **/
+@Slf4j
+public class CommonUtil {
+    /**
+     * 获取ip
+     *
+     * @param request
+     * @return
+     */
+    public static String getIpAddr(HttpServletRequest request) {
+        String ipAddress = null;
+        try {
+            ipAddress = request.getHeader("x-forwarded-for");
+            System.out.println("x-forwarded-for="+ipAddress);
+            if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
+                ipAddress = request.getHeader("Proxy-Client-IP");
+                System.out.println("Proxy-Client-IP="+ipAddress);
+            }
+            if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
+                ipAddress = request.getHeader("WL-Proxy-Client-IP");
+                System.out.println("WL-Proxy-Client-IP="+ipAddress);
+            }
+            if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
+                ipAddress = request.getRemoteAddr();
+                System.out.println("getRemoteAddr="+ipAddress);
+                if (ipAddress.equals("127.0.0.1")) {
+                    // 根据网卡取本机配置的IP
+                    InetAddress inet = null;
+                    try {
+                        inet = InetAddress.getLocalHost();
+                    } catch (UnknownHostException e) {
+                        e.printStackTrace();
+                    }
+                    ipAddress = inet.getHostAddress();
+                    System.out.println("getHostAddress="+ipAddress);
+                }
+            }
+            // 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
+            if (ipAddress != null && ipAddress.length() > 15) {
+                // "***.***.***.***".length()
+                // = 15
+                if (ipAddress.indexOf(",") > 0) {
+                    ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
+                }
+            }
+        } catch (Exception e) {
+            ipAddress = "";
+        }
+        return ipAddress;
+    }
+
+
+    /**
+     * 获取全部请求头
+     *
+     * @param request
+     * @return
+     */
+    public static Map<String, String> getAllRequestHeader(HttpServletRequest request) {
+        Enumeration<String> headerNames = request.getHeaderNames();
+        Map<String, String> map = new HashMap<>();
+        while (headerNames.hasMoreElements()) {
+            String key = headerNames.nextElement();
+            //根据名称获取请求头的值
+            String value = request.getHeader(key);
+            map.put(key, value);
+        }
+
+        return map;
+    }
+
+
+    /**
+     * MD5加密
+     *
+     * @param data
+     * @return
+     */
+    public static String MD5(String data) {
+        try {
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            byte[] array = md.digest(data.getBytes("UTF-8"));
+            StringBuilder sb = new StringBuilder();
+            for (byte item : array) {
+                sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
+            }
+
+            return sb.toString().toUpperCase();
+        } catch (Exception exception) {
+        }
+        return null;
+    }
+
+
+    /**
+     * 获取验证码随机数
+     *
+     * @param length
+     * @return
+     */
+    public static String getRandomCode(int length) {
+        String sources = "0123456789";
+        Random random = new Random();
+        StringBuilder sb = new StringBuilder();
+        for (int j = 0; j < length; j++) {
+            sb.append(sources.charAt(random.nextInt(9)));
+        }
+        return sb.toString();
+    }
+
+    /**
+     * 获取当前时间戳
+     *
+     * @return
+     */
+    public static long getCurrentTimestamp() {
+        return System.currentTimeMillis();
+    }
+
+    /**
+     * 生成uuid
+     *
+     * @return
+     */
+    public static String generateUUID() {
+        return UUID.randomUUID().toString().replaceAll("-", "").substring(0, 32);
+    }
+
+    /**
+     * 获取随机长度的串
+     *
+     * @param length
+     * @return
+     */
+    private static final String ALL_CHAR_NUM = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+
+    public static String getStringNumRandom(int length) {
+        //生成随机数字和字母,
+        Random random = new Random();
+        StringBuilder saltString = new StringBuilder(length);
+        for (int i = 1; i <= length; ++i) {
+            saltString.append(ALL_CHAR_NUM.charAt(random.nextInt(ALL_CHAR_NUM.length())));
+        }
+        return saltString.toString();
+    }
+
+    /**
+     * LocalDate 拼接时间转成 LocalDateTime
+     * @param localDate
+     * @param timeStr HH:mm:ss
+     * @return
+     */
+    public static LocalDateTime localDateToTime(LocalDate localDate, String timeStr) {
+        LocalTime time = LocalTime.parse(timeStr);
+        return LocalDateTime.of(localDate.getYear(), localDate.getMonth(), localDate.getDayOfMonth(),
+                time.getHour(), time.getMinute(), time.getSecond());
+    }
+}

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 154 - 0
src/main/java/com/template/common/utils/DoorLockAESUtil.java


+ 40 - 0
src/main/java/com/template/common/utils/DoorLockMD5Util.java

@@ -0,0 +1,40 @@
+package com.template.common.utils;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * 门锁md5工具
+ */
+public class DoorLockMD5Util {
+
+    /**
+     * MD5加密
+     *
+     * @param str  明文
+     * @return 密文
+     * @throws Exception
+     */
+    public static String getMD5(String str) {
+        char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+        try {
+            byte[] strTemp = str.getBytes();
+            // 使用MD5创建MessageDigest对象
+            MessageDigest mdTemp = MessageDigest.getInstance("MD5");
+            mdTemp.update(strTemp);
+            byte[] md = mdTemp.digest();
+            int j = md.length;
+            char ch[] = new char[j * 2];
+            int k = 0;
+            for (int i = 0; i < j; i++) {
+                byte b = md[i];
+                // 将每个数(int)b进行双字节加密s
+                ch[k++] = hexDigits[b >> 4 & 0xf];
+                ch[k++] = hexDigits[b & 0xf];
+            }
+            return new String(ch);
+        } catch (NoSuchAlgorithmException e) {
+            return null;
+        }
+    }
+}

+ 41 - 0
src/main/java/com/template/common/utils/EncryptionUtil.java

@@ -0,0 +1,41 @@
+package com.template.common.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+public class EncryptionUtil {
+
+
+    private static final int MAX_JSON_STRING = 40;
+
+    /**
+     * 将需要加密的字段分批加密
+     *
+     * @param jsonString
+     * @param publicKey
+     * @return
+     * @throws Exception
+     */
+    public Map<Object, Object> encryption(String jsonString, String publicKey) throws Exception {
+        int length = jsonString.length();
+        int offset = 0;
+        int i = 0;
+        HashMap<Object, Object> map = new HashMap<>();
+//        判断字符串长度是否大于40,大于就截取前40位,分批加密
+        while (length - offset > 0) {
+            if (length - offset > MAX_JSON_STRING) {
+                String substring = jsonString.substring(offset, offset + MAX_JSON_STRING);
+                String encrypt = RSAUtils.encrypt(substring, RSAUtils.getPublicKey(publicKey));
+                map.put(i, encrypt);
+            } else {
+                String substring = jsonString.substring(offset,length);
+                String encrypt = RSAUtils.encrypt(substring, RSAUtils.getPublicKey(publicKey));
+                map.put(i, encrypt);
+            }
+            i++;
+            offset = i * MAX_JSON_STRING;
+        }
+        return map;
+    }
+}

+ 74 - 0
src/main/java/com/template/common/utils/FileUtil.java

@@ -0,0 +1,74 @@
+package com.template.common.utils;
+
+
+import java.io.File;
+import java.util.UUID;
+
+public class FileUtil {
+
+    /*
+        upload
+            36字符串  ----  4aeb1da864af42a58bd7aeee7e3ac63a
+            4
+             a
+              e
+                4aeb1da864af42a58bd7aeee7e3ac63a
+     */
+
+    /**
+     * 生成包含三级目录和随机文件名
+     *
+     * @return 数组,元素分别是:文件路径、文件名
+     */
+    public static String[] getFileNameAndPath() {
+        // 生成一个唯一的文件名
+        String fineName = UUID.randomUUID().toString();
+        fineName = fineName.replaceAll("-", "");
+
+        // 获取前三个字符作为目录名
+        char c1 = fineName.charAt(0);
+        char c2 = fineName.charAt(1);
+        char c3 = fineName.charAt(2);
+
+        StringBuilder filePath = new StringBuilder().append(c1).append("/").append(c2).append("/").append(c3).append("/");
+
+        return new String[]{filePath.toString(), fineName};
+    }
+
+    /**
+     * 生成包含三级目录的随机文件名
+     *
+     * @return 文件名,包含三级目录
+     */
+    public static String getFileNameWithPath() {
+        // 生成一个唯一的文件名
+        String fineName = UUID.randomUUID().toString();
+        fineName = fineName.replaceAll("-", "");
+
+        // 获取前三个字符作为目录名
+        char c1 = fineName.charAt(0);
+        char c2 = fineName.charAt(1);
+        char c3 = fineName.charAt(2);
+
+        StringBuilder filePath = new StringBuilder().append(c1).append("/").append(c2).append("/").append(c3).append("/");
+
+        return filePath.append(fineName).toString();
+    }
+
+    /**
+     * 判断三级目录是否存在
+     *
+     * @param fileNameWithPath
+     * @param uploadRealPath
+     */
+    public static void makeDirs(String fileNameWithPath, String uploadRealPath) {
+        //截取目录,判断是否存在,不存在就创建
+        String filePath = fileNameWithPath.substring(0, fileNameWithPath.lastIndexOf("/"));
+
+        // 如果不存在,就创建
+        if (!new File(uploadRealPath, filePath).exists()) {
+            new File(uploadRealPath, filePath).mkdirs();
+        }
+    }
+
+}

+ 401 - 0
src/main/java/com/template/common/utils/HttpClientHelper.java

@@ -0,0 +1,401 @@
+package com.template.common.utils;
+
+
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpHost;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.config.Registry;
+import org.apache.http.config.RegistryBuilder;
+import org.apache.http.config.SocketConfig;
+import org.apache.http.conn.socket.ConnectionSocketFactory;
+import org.apache.http.conn.socket.PlainConnectionSocketFactory;
+import org.apache.http.conn.ssl.NoopHostnameVerifier;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.impl.conn.DefaultProxyRoutePlanner;
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
+import org.apache.http.message.BasicHeader;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.protocol.HTTP;
+import org.apache.http.ssl.SSLContexts;
+import org.apache.http.util.EntityUtils;
+import org.apache.poi.util.StringUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.net.ssl.SSLContext;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+public class HttpClientHelper {
+
+
+    private static final Logger logger = LoggerFactory.getLogger(HttpClientHelper.class);
+    private static PoolingHttpClientConnectionManager poolConnManager = null;
+    private int maxTotalPool = 200;
+    private int maxConPerRoute = 20;
+    private int socketTimeout = 100000;
+    private int connectionRequestTimeout = 90000;
+    private int connectTimeout = 90000;
+
+    // 代理信息
+    public static String proxy_ip;
+    public static int proxy_port;
+
+    private static HttpClientHelper httpClientHelper = null;
+
+    private HttpClientHelper() {
+        init();
+    }
+
+    private static synchronized void syncInit() {
+        if (httpClientHelper == null) {
+            httpClientHelper = new HttpClientHelper();
+        }
+    }
+
+    public static HttpClientHelper getInstance(String proxyIp, Integer proxyPort) {
+        proxy_port = proxyPort;
+        proxy_ip = proxyIp;
+        if (httpClientHelper == null) {
+            syncInit();
+        }
+        return httpClientHelper;
+    }
+
+    public static HttpClientHelper getInstance() {
+        if (httpClientHelper == null) {
+            syncInit();
+        }
+        return httpClientHelper;
+    }
+
+    public PoolingHttpClientConnectionManager getConnManager() {
+        PoolingHttpClientConnectionManager cm = null;
+        try {
+            SSLContext sslcontext = SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build();
+            SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, NoopHostnameVerifier.INSTANCE);
+            Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register("http",
+                    PlainConnectionSocketFactory.getSocketFactory()).register("https",
+                    sslsf).build();
+            cm = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
+            // 将最大连接数增加到200
+            cm.setMaxTotal(maxTotalPool);
+            // 将每个路由基础的连接增加到20
+            cm.setDefaultMaxPerRoute(maxConPerRoute);
+        } catch (Exception e) {
+            logger.error("InterfacePhpUtilManager init Exception" + e.toString());
+        }
+        return cm;
+    }
+
+    public void init() {
+        try {
+            SSLContext sslcontext = SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build();
+            SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, NoopHostnameVerifier.INSTANCE);
+            Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register("http",
+                    PlainConnectionSocketFactory.getSocketFactory()).register("https",
+                    sslsf).build();
+            poolConnManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
+            // Increase max total connection to 200
+            poolConnManager.setMaxTotal(maxTotalPool);
+            // Increase default max connection per route to 20
+            poolConnManager.setDefaultMaxPerRoute(maxConPerRoute);
+            SocketConfig socketConfig = SocketConfig.custom().setSoTimeout(socketTimeout).build();
+            poolConnManager.setDefaultSocketConfig(socketConfig);
+        } catch (Exception e) {
+            logger.error("InterfacePhpUtilManager init Exception" + e.toString());
+        }
+    }
+
+    public CloseableHttpClient getConnection() {
+        RequestConfig requestConfig = RequestConfig.custom().setConnectionRequestTimeout(connectionRequestTimeout).setConnectTimeout(connectTimeout).setSocketTimeout(socketTimeout).build();
+        HttpClientBuilder httpClientBuilder = HttpClients.custom();
+        httpClientBuilder.setConnectionManager(poolConnManager).setDefaultRequestConfig(requestConfig);// set proxy
+        if (!ObjectUtils.isEmpty(proxy_ip) && proxy_port > 0) {
+            HttpHost proxy = new HttpHost(proxy_ip, proxy_port);
+            DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy);
+            httpClientBuilder.setRoutePlanner(routePlanner);
+        }
+
+        CloseableHttpClient httpClient = httpClientBuilder.build();
+        if (poolConnManager != null && poolConnManager.getTotalStats() != null) {
+            logger.info("now client pool " + poolConnManager.getTotalStats().toString());
+        }
+        return httpClient;
+    }
+
+    /**
+     * 发送 GET 请求(HTTP),不带输入数据
+     */
+    public String doGet(String url) {
+        return doGet(url, new HashMap<String,String>());
+    }
+
+    /**
+     * 发送 GET 请求(HTTP),K-V形式
+     */
+    public String doGet(String url, Map<String, String> params) {
+        String apiUrl = url;
+        StringBuffer param = new StringBuffer();
+        int i = 0;
+        for (String key : params.keySet()) {
+            if (i == 0) {
+                param.append("?");
+            } else {
+                param.append("&");
+            }
+            param.append(key).append("=").append(params.get(key));
+            i++;
+        }
+        apiUrl += param;
+        logger.info(apiUrl);
+        String result = null;
+        CloseableHttpClient httpClient = getConnection();
+        CloseableHttpResponse response = null;
+        HttpGet httpPost = null;
+        try {
+            httpPost = new HttpGet(apiUrl);
+            response = httpClient.execute(httpPost);
+            int status = response.getStatusLine().getStatusCode();
+            logger.info("http request url : " + url + " status : " + status);
+
+            if (status >= 200 && status < 300) {
+                HttpEntity entity = response.getEntity();
+                if (entity != null) {
+                    result = EntityUtils.toString(response.getEntity(), "UTF-8");
+                    logger.info("Request result : " + result);
+                }
+            }
+            EntityUtils.consume(response.getEntity());
+            response.close();
+            return result;
+
+        } catch (IOException e) {
+            logger.error(e.getMessage(), e);
+        } finally {
+            httpPost.releaseConnection();
+            if (response != null) {
+                try {
+                    EntityUtils.consume(response.getEntity());
+                    response.close();
+                } catch (IOException e) {
+                    logger.error(e.getMessage(), e);
+                }
+            }
+        }
+        return result;
+    }
+
+    public String doPost(String url) {
+        return doPost(url, new HashMap<String, String>());
+    }
+
+    /**
+     * 发送 POST json
+     *
+     * @param url 接口URL
+     */
+    public String doPostJson(String url, String jsonstr) {
+        String result = null;
+        HttpPost httpPost = new HttpPost(url);
+        CloseableHttpClient httpClient = getConnection();
+        CloseableHttpResponse response = null;
+        try {
+
+            StringEntity se = new StringEntity(jsonstr, Charset.forName("UTF-8"));
+            se.setContentType("text/json");
+            se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
+            httpPost.setEntity(se);
+            response = httpClient.execute(httpPost);
+            int status = response.getStatusLine().getStatusCode();
+            logger.info("http request url : " + url + " status : " + status);
+            if (status >= 200 && status < 300) {
+                HttpEntity entity = response.getEntity();
+                if (entity != null) {
+                    result = EntityUtils.toString(response.getEntity(), "UTF-8");
+                    logger.info("Request result : " + result);
+                }
+            }
+            EntityUtils.consume(response.getEntity());
+            response.close();
+            return result;
+
+        } catch (IOException e) {
+            logger.error(e.getMessage(), e);
+        } finally {
+            httpPost.releaseConnection();
+            if (response != null) {
+                try {
+                    EntityUtils.consume(response.getEntity());
+                    response.close();
+                } catch (IOException e) {
+                    logger.error(e.getMessage(), e);
+                }
+            }
+        }
+        return result;
+    }
+
+    /**
+     * 发送 POST json
+     *
+     * @param url 接口URL
+     */
+    public String doPostJson(String url, String jsonstr, String sign, String appId) {
+        String result = null;
+        HttpPost httpPost = new HttpPost(url);
+        CloseableHttpClient httpClient = getConnection();
+        CloseableHttpResponse response = null;
+        try {
+            StringEntity se = new StringEntity(jsonstr, Charset.forName("UTF-8"));
+            se.setContentType("application/json;charset=utf-8");
+            se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
+            httpPost.setEntity(se);
+            httpPost.addHeader("sign", sign);
+            httpPost.addHeader("appId", appId);
+            response = httpClient.execute(httpPost);
+            int status = response.getStatusLine().getStatusCode();
+            logger.info("http request url : " + url + " status : " + status);
+            if (status >= 200 && status < 300) {
+                HttpEntity entity = response.getEntity();
+                if (entity != null) {
+                    result = EntityUtils.toString(response.getEntity(), "UTF-8");
+                    logger.info("Request result : " + result);
+                }
+            }
+            EntityUtils.consume(response.getEntity());
+            response.close();
+            return result;
+
+        } catch (IOException e) {
+            logger.error(e.getMessage(), e);
+        } finally {
+            httpPost.releaseConnection();
+            if (response != null) {
+                try {
+                    EntityUtils.consume(response.getEntity());
+                    response.close();
+                } catch (IOException e) {
+                    logger.error(e.getMessage(), e);
+                }
+            }
+        }
+        return result;
+    }
+
+
+    /**
+     * 发送 POST 请求(HTTP),K-V形式
+     *
+     * @param url    接口URL
+     * @param params 参数map
+     * @return
+     */
+    public String doPost(String url, Map<String, String> params) {
+        String result = null;
+        HttpPost httpPost = new HttpPost(url);
+        CloseableHttpClient httpClient = getConnection();
+        CloseableHttpResponse response = null;
+        try {
+            List<NameValuePair> pairList = new ArrayList<>(params.size());
+            for (Map.Entry<String, String> entry : params.entrySet()) {
+                NameValuePair pair = new BasicNameValuePair(entry.getKey(), entry.getValue());
+                pairList.add(pair);
+            }
+            httpPost.setEntity(new UrlEncodedFormEntity(pairList, Charset.forName("UTF-8")));
+            response = httpClient.execute(httpPost);
+            int status = response.getStatusLine().getStatusCode();
+            logger.info("http request url : " + url + " status : " + status);
+            if (status >= 200 && status < 300) {
+                HttpEntity entity = response.getEntity();
+                if (entity != null) {
+                    result = EntityUtils.toString(response.getEntity(), "UTF-8");
+                    logger.info("Request result : " + result);
+                }
+            }
+            EntityUtils.consume(response.getEntity());
+            response.close();
+            return result;
+
+        } catch (IOException e) {
+            logger.error(e.getMessage(), e);
+        } finally {
+            httpPost.releaseConnection();
+            if (response != null) {
+                try {
+                    EntityUtils.consume(response.getEntity());
+                    response.close();
+                } catch (IOException e) {
+                    logger.error(e.getMessage(), e);
+                }
+            }
+        }
+        return result;
+    }
+    /**
+     * 发送 POST 请求(HTTP),K-V形式
+     *
+     * @param url    接口URL
+     * @param params 参数map
+     * @return
+     */
+    public String doPost(String url, Map<String, String> params, String token) {
+        String result = null;
+        HttpPost httpPost = new HttpPost(url);
+        CloseableHttpClient httpClient = getConnection();
+        CloseableHttpResponse response = null;
+        try {
+            List<NameValuePair> pairList = new ArrayList<>(params.size());
+            for (Map.Entry<String, String> entry : params.entrySet()) {
+                NameValuePair pair = new BasicNameValuePair(entry.getKey(), entry.getValue());
+                pairList.add(pair);
+            }
+            httpPost.setEntity(new UrlEncodedFormEntity(pairList, Charset.forName("UTF-8")));
+            httpPost.addHeader("token", token);
+            response = httpClient.execute(httpPost);
+            int status = response.getStatusLine().getStatusCode();
+            logger.info("http request url : " + url + " status : " + status);
+            if (status >= 200 && status < 300) {
+                HttpEntity entity = response.getEntity();
+                if (entity != null) {
+                    result = EntityUtils.toString(response.getEntity(), "UTF-8");
+                    logger.info("Request result : " + result);
+                }
+            }
+            EntityUtils.consume(response.getEntity());
+            response.close();
+            return result;
+
+        } catch (IOException e) {
+            logger.error(e.getMessage(), e);
+        } finally {
+            httpPost.releaseConnection();
+            if (response != null) {
+                try {
+                    EntityUtils.consume(response.getEntity());
+                    response.close();
+                } catch (IOException e) {
+                    logger.error(e.getMessage(), e);
+                }
+            }
+        }
+        return result;
+    }
+
+}

+ 105 - 0
src/main/java/com/template/common/utils/JWTUtil.java

@@ -0,0 +1,105 @@
+package com.template.common.utils;
+
+
+import com.auth0.jwt.JWT;
+import com.auth0.jwt.JWTVerifier;
+import com.auth0.jwt.algorithms.Algorithm;
+import com.auth0.jwt.interfaces.Claim;
+import com.auth0.jwt.interfaces.DecodedJWT;
+import com.template.model.pojo.RepairAdmin;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * jwt 工具
+ **/
+@Slf4j
+public class JWTUtil {
+
+    private static String SIGNATURE = "token!@#$%^7890";
+
+    /**
+     * token过期时间,7天
+     */
+//    private static final long EXPIRED = 1000 * 60 * 60 * 24 * 7;
+    private static final long EXPIRED = 1000 * 60 * 60 * 24;
+
+    /**
+     * 生成token 有过期时间
+     * @return 返回token
+     */
+    public static String getToken(RepairAdmin ra){
+
+        // 签发时间
+        Date iatDate = new Date();
+
+//        // 过期时间
+//        Calendar nowTime = Calendar.getInstance();
+//        nowTime.add(Calendar.DAY_OF_WEEK, 3);
+//        Date expiresDate = nowTime.getTime();
+
+        Map<String, Object> map = new HashMap<>();
+        map.put("alg", "HMAC256");
+        map.put("typ", "JWT");
+        String token = JWT.create()
+                .withHeader(map) // header
+                .withClaim("account", ra.getAccount()) // 账号
+                .withClaim("password", ra.getPassword()) // 密码
+                .withExpiresAt(new Date(CommonUtil.getCurrentTimestamp() + EXPIRED)) // 设置过期时间。过期时间要大于签发时间
+                .withIssuedAt(iatDate) // 设置签发时间
+                .sign(Algorithm.HMAC256(SIGNATURE)); // 加密
+        return token;
+
+//
+//        JWTCreator.Builder builder = JWT.create();
+//        map.forEach((k,v)->{
+//            builder.withClaim(k,v);
+//        });
+//        Calendar instance = Calendar.getInstance();
+//        instance.add(Calendar.SECOND,7);
+//        builder.withExpiresAt(instance.getTime());
+//        return builder.sign(Algorithm.HMAC256(SIGNATURE)).toString();
+    }
+
+    public static long getExpired() {
+        return EXPIRED;
+    }
+
+
+    /**
+     * 验证token
+     * @param token
+     */
+    public static void verify(String token){
+        JWT.require(Algorithm.HMAC256(SIGNATURE)).build().verify(token);
+    }
+
+    /**
+     * 获取token中payload
+     * @param token
+     * @return
+     */
+    public static DecodedJWT getToken(String token){
+        return JWT.require(Algorithm.HMAC256(SIGNATURE)).build().verify(token);
+    }
+
+
+
+    /*
+     * 解密Token
+     * */
+    public static Map<String, Claim> verifyToken(String token)  {
+        JWTVerifier verifier = JWT.require(Algorithm.HMAC256(SIGNATURE)).build();
+        DecodedJWT jwt = null;
+        try {
+            jwt = verifier.verify(token);
+        } catch (Exception e) {
+            throw new RuntimeException("登录凭证已过去,请重新登录");
+        }
+
+        return jwt.getClaims();
+    }
+}

+ 46 - 0
src/main/java/com/template/common/utils/MD5.java

@@ -0,0 +1,46 @@
+package com.template.common.utils;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/6/7 星期三 9:43
+ * @Description: com.chuanghai.ihotel.util
+ * @Version: 1.0
+ */
+@Slf4j
+public class MD5 {
+    /**
+     * MD5加密
+     *
+     * @param str  明文
+     * @return 密文
+     * @throws Exception
+     */
+    public static String getMD5(String str) {
+        char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+        try {
+            byte[] strTemp = str.getBytes();
+            // 使用MD5创建MessageDigest对象
+            MessageDigest mdTemp = MessageDigest.getInstance("MD5");
+            mdTemp.update(strTemp);
+            byte[] md = mdTemp.digest();
+            int j = md.length;
+            char ch[] = new char[j * 2];
+            int k = 0;
+            for (int i = 0; i < j; i++) {
+                byte b = md[i];
+                // 将没个数(int)b进行双字节加密s
+                ch[k++] = hexDigits[b >> 4 & 0xf];
+                ch[k++] = hexDigits[b & 0xf];
+            }
+            return new String(ch);
+        } catch (NoSuchAlgorithmException e) {
+            log.error(e.getMessage(),e);
+        }
+        return str;
+    }
+}

+ 132 - 0
src/main/java/com/template/common/utils/MyBase64.java

@@ -0,0 +1,132 @@
+package com.template.common.utils;
+
+import java.io.ByteArrayOutputStream;
+
+public class MyBase64 {
+
+    // map 6-bit int to char
+    private static final char[] chars64 = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a',
+                                            'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1',
+                                            '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' };
+
+    // map char to 6-bit int
+    private static final int[]  ints64  = new int[128];
+    static {
+        for (int i = 0; i < 64; i++) {
+            ints64[chars64[i]] = i;
+        }
+    }
+
+    /**
+     * 转换byte数组成Base64 string
+     * 
+     * @param unencoded
+     * @return
+     */
+    public static final String encode(byte[] unencoded) {
+        // Take 24-bits from three octets, translate into four encoded chars.
+        // If necessary, pad with 0 bits on the right at the end
+        // Use = signs as padding at the end to ensure encodedLength % 4 == 0
+        if (unencoded == null || unencoded.length == 0) return null;
+
+        ByteArrayOutputStream out = new ByteArrayOutputStream((int) (unencoded.length * 1.37));
+        int byteCount = 0;
+        int carryOver = 0;
+
+        for (int i = 0; i < unencoded.length; i++) {
+            int bc = (byteCount % 3);
+            byte b = unencoded[i];
+            int lookup = 0;
+
+            // First byte use first six bits, save last two bits
+            if (bc == 0) {
+                lookup = (b >> 2) & 0x3F;
+                carryOver = b & 0x03; // last two bits
+                out.write(chars64[lookup]);
+            } else if (bc == 1) {
+                // Second byte use previous two bits and first four new bits,
+                // save last four bits
+                lookup = ((carryOver << 4) | ((b >> 4) & 0x0F));
+                carryOver = b & 0x0F; // last four bits
+                out.write(chars64[lookup]);
+            } else if (bc == 2) {
+                // Third byte use previous four bits and first two new bits,
+                // then use last six new bits
+                lookup = ((carryOver << 2) | ((b >> 6) & 0x03));
+                out.write(chars64[lookup]);
+
+                lookup = b & 0x3F; // last six bits
+                out.write(chars64[lookup]);
+                carryOver = 0;
+            }
+            byteCount++;
+        }
+
+        if (byteCount % 3 == 1) { // one leftover
+            int lookup = (carryOver << 4) & 0xF0;
+            out.write(chars64[lookup]);
+            out.write('=');
+            out.write('=');
+        } else if (byteCount % 3 == 2) { // two leftovers
+            int lookup = (carryOver << 2) & 0x3C;
+            out.write(chars64[lookup]);
+            out.write('=');
+        }
+        return out.toString();
+    }
+
+    /**
+     * Decode MyBase64 string back to byte array
+     * 
+     * @param encoded
+     * @return
+     */
+    public static final byte[] decode(String encoded) {
+        if (encoded == null || encoded.length() == 0) return null;
+
+        byte[] bytes = encoded.getBytes();
+
+        ByteArrayOutputStream out = new ByteArrayOutputStream((int) (bytes.length * 0.67));
+        int byteCount = 0;
+        int carryOver = 0;
+
+        DECODE_LOOP: for (int i = 0; i < bytes.length; i++) {
+            int ch = bytes[i];
+
+            // Read the next non-whitespace character
+            // if (Character.isWhitespace((char)ch))
+            // continue;
+
+            // The '=' sign is just padding; geffective end of stream
+            if (ch == '=') break DECODE_LOOP;
+
+            // Convert from raw form to 6-bit form
+            int newbits = ints64[ch];
+
+            int bc = (byteCount % 4);
+            if (bc == 0) {
+                // First char save all six bits, go for another
+                carryOver = newbits & 0x3F;
+            } else if (bc == 1) {
+                // second char use 6 previous bits and first 2 new bits
+                int data = ((carryOver << 2) + ((newbits >> 4) & 0x03));
+                out.write(data);
+                carryOver = newbits & 0x0F; // save 4 bits
+            } else if (bc == 2) {
+                // Third char use previous four bits and first four new bits,
+                // save last two bits
+                int data = ((carryOver << 4) + ((newbits >> 2) & 0x0F));
+                out.write(data);
+                carryOver = newbits & 0x03; // save 2 bits
+            } else if (bc == 3) {
+                // Fourth char use previous two bits and all six new bits
+                int data = ((carryOver << 6) + (newbits & 0x3F));
+                out.write(data);
+                carryOver = 0;
+            }
+            byteCount++;
+        }
+
+        return out.toByteArray();
+    }
+}

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 196 - 0
src/main/java/com/template/common/utils/RSAUtils.java


+ 176 - 0
src/main/java/com/template/common/utils/SendSms.java

@@ -0,0 +1,176 @@
+package com.template.common.utils;
+
+import com.tencentcloudapi.common.Credential;
+import com.tencentcloudapi.common.exception.TencentCloudSDKException;
+
+//导入可选配置类
+import com.tencentcloudapi.common.profile.ClientProfile;
+import com.tencentcloudapi.common.profile.HttpProfile;
+
+// 导入对应SMS模块的client
+import com.tencentcloudapi.sms.v20210111.SmsClient;
+
+// 导入要请求接口对应的request response类
+import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest;
+import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
+import com.tencentcloudapi.sms.v20210111.models.SendStatus;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * Tencent Cloud Sms Sendsms
+ */
+public class SendSms {
+
+
+
+    //腾讯云上的签名
+
+    private static String secretID="AKIDDPo13qZCZqtgJsGQL7AyYu1wc7QVMyLl";
+    //腾讯云上的密钥
+
+    private static String secretKey="JPGrELFySiv0pOrKOPEwSnulOq9IPPDr";
+    //短信应用id
+
+    private static String sdkAppid="1400813506";
+    //短信签名内容
+
+    private static String signName="华仁享学教育";
+    //模板Id
+
+    private static String templateId="1770016";
+    //验证码有效时长
+
+    private static String smsMin="1";
+
+
+    public static SendStatus[] sendSms(String phoneNumber,String code) {
+        SendStatus[] returString= {};
+        try {
+            /* 必要步骤:
+             * 实例化一个认证对象,入参需要传入腾讯云账户密钥对secretId,secretKey。
+             * 这里采用的是从环境变量读取的方式,需要在环境变量中先设置这两个值。
+             * 你也可以直接在代码中写死密钥对,但是小心不要将代码复制、上传或者分享给他人,
+             * 以免泄露密钥对危及你的财产安全。
+             * SecretId、SecretKey 查询: https://console.cloud.tencent.com/cam/capi */
+//            Credential cred = new Credential(smsConfig.getSecretID(), smsConfig.getSecretKey());
+            Credential cred = new Credential(secretID,secretKey);
+
+            // 实例化一个http选项,可选,没有特殊需求可以跳过
+            HttpProfile httpProfile = new HttpProfile();
+            // 设置代理(无需要直接忽略)
+            // httpProfile.setProxyHost("真实代理ip");
+            // httpProfile.setProxyPort(真实代理端口);
+            /* SDK默认使用POST方法。
+             * 如果你一定要使用GET方法,可以在这里设置。GET方法无法处理一些较大的请求 */
+            httpProfile.setReqMethod("POST");
+            /* SDK有默认的超时时间,非必要请不要进行调整
+             * 如有需要请在代码中查阅以获取最新的默认值 */
+            httpProfile.setConnTimeout(60);
+            /* 指定接入地域域名,默认就近地域接入域名为 sms.tencentcloudapi.com ,也支持指定地域域名访问,例如广州地域的域名为 sms.ap-guangzhou.tencentcloudapi.com */
+            httpProfile.setEndpoint("sms.tencentcloudapi.com");
+
+            /* 非必要步骤:
+             * 实例化一个客户端配置对象,可以指定超时时间等配置 */
+            ClientProfile clientProfile = new ClientProfile();
+            /* SDK默认用TC3-HMAC-SHA256进行签名
+             * 非必要请不要修改这个字段 */
+            clientProfile.setSignMethod("HmacSHA256");
+            clientProfile.setHttpProfile(httpProfile);
+            /* 实例化要请求产品(以sms为例)的client对象
+             * 第二个参数是地域信息,可以直接填写字符串ap-guangzhou,支持的地域列表参考 https://cloud.tencent.com/document/api/382/52071#.E5.9C.B0.E5.9F.9F.E5.88.97.E8.A1.A8 */
+            SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile);
+            /* 实例化一个请求对象,根据调用的接口和实际情况,可以进一步设置请求参数
+             * 你可以直接查询SDK源码确定接口有哪些属性可以设置
+             * 属性可能是基本类型,也可能引用了另一个数据结构
+             * 推荐使用IDE进行开发,可以方便的跳转查阅各个接口和数据结构的文档说明 */
+            SendSmsRequest req = new SendSmsRequest();
+
+            /* 填充请求参数,这里request对象的成员变量即对应接口的入参
+             * 你可以通过官网接口文档或跳转到request对象的定义处查看请求参数的定义
+             * 基本类型的设置:
+             * 帮助链接:
+             * 短信控制台: https://console.cloud.tencent.com/smsv2
+             * 腾讯云短信小助手: https://cloud.tencent.com/document/product/382/3773#.E6.8A.80.E6.9C.AF.E4.BA.A4.E6.B5.81 */
+
+            /* 短信应用ID: 短信SdkAppId在 [短信控制台] 添加应用后生成的实际SdkAppId,示例如1400006666 */
+            // 应用 ID 可前往 [短信控制台](https://console.cloud.tencent.com/smsv2/app-manage) 查看
+//            String sdkAppId = "1400009099";
+//            req.setSmsSdkAppId(smsConfig.getSdkAppid());
+            req.setSmsSdkAppId(sdkAppid);
+
+            /* 短信签名内容: 使用 UTF-8 编码,必须填写已审核通过的签名 */
+            // 签名信息可前往 [国内短信](https://console.cloud.tencent.com/smsv2/csms-sign) 或 [国际/港澳台短信](https://console.cloud.tencent.com/smsv2/isms-sign) 的签名管理查看
+//            String signName = "腾讯云";
+//            req.setSignName(smsConfig.getSignName());
+            req.setSignName(signName);
+
+            /* 模板 ID: 必须填写已审核通过的模板 ID */
+            // 模板 ID 可前往 [国内短信](https://console.cloud.tencent.com/smsv2/csms-template) 或 [国际/港澳台短信](https://console.cloud.tencent.com/smsv2/isms-template) 的正文模板管理查看
+//            String templateId = "449739";
+//            req.setTemplateId(smsConfig.getTemplateId());
+            req.setTemplateId(templateId);
+
+
+            /* 模板参数: 模板参数的个数需要与 TemplateId 对应模板的变量个数保持一致,若无模板参数,则设置为空 */
+//           第一个为验证码,第二个为有效时间
+//            String[] templateParamSet = {code,smsConfig.getSmsMin()};
+            String[] templateParamSet = {code,"1"};
+            req.setTemplateParamSet(templateParamSet);
+
+            /* 下发手机号码,采用 E.164 标准,+[国家或地区码][手机号]
+             * 示例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号,最多不要超过200个手机号 */
+//            String[] phoneNumberSet = {"+8621212313123", "+8612345678902", "+8612345678903"};
+            String[] phoneNumbers = {phoneNumber};
+            req.setPhoneNumberSet(phoneNumbers);
+
+            /* 用户的 session 内容(无需要可忽略): 可以携带用户侧 ID 等上下文信息,server 会原样返回 */
+//            String sessionContext = "";
+//            req.setSessionContext(sessionContext);
+
+            /* 短信码号扩展号(无需要可忽略): 默认未开通,如需开通请联系 [腾讯云短信小助手] */
+//            String extendCode = "";
+//            req.setExtendCode(extendCode);
+
+            /* 国际/港澳台短信 SenderId(无需要可忽略): 国内短信填空,默认未开通,如需开通请联系 [腾讯云短信小助手] */
+//            String senderid = "";
+//            req.setSenderId(senderid);
+
+            /* 通过 client 对象调用 SendSms 方法发起请求。注意请求方法名与请求对象是对应的
+             * 返回的 res 是一个 SendSmsResponse 类的实例,与请求对象对应 */
+            SendSmsResponse res = client.SendSms(req);
+
+            // 输出json格式的字符串回包
+//            System.out.println(SendSmsResponse.toJsonString(res));
+
+            // 也可以取出单个值,你可以通过官网接口文档或跳转到response对象的定义处查看返回字段的定义
+            // System.out.println(res.getRequestId());
+
+            /* 当出现以下错误码时,快速解决方案参考
+             * [FailedOperation.SignatureIncorrectOrUnapproved](https://cloud.tencent.com/document/product/382/9558#.E7.9F.AD.E4.BF.A1.E5.8F.91.E9.80.81.E6.8F.90.E7.A4.BA.EF.BC.9Afailedoperation.signatureincorrectorunapproved-.E5.A6.82.E4.BD.95.E5.A4.84.E7.90.86.EF.BC.9F)
+             * [FailedOperation.TemplateIncorrectOrUnapproved](https://cloud.tencent.com/document/product/382/9558#.E7.9F.AD.E4.BF.A1.E5.8F.91.E9.80.81.E6.8F.90.E7.A4.BA.EF.BC.9Afailedoperation.templateincorrectorunapproved-.E5.A6.82.E4.BD.95.E5.A4.84.E7.90.86.EF.BC.9F)
+             * [UnauthorizedOperation.SmsSdkAppIdVerifyFail](https://cloud.tencent.com/document/product/382/9558#.E7.9F.AD.E4.BF.A1.E5.8F.91.E9.80.81.E6.8F.90.E7.A4.BA.EF.BC.9Aunauthorizedoperation.smssdkappidverifyfail-.E5.A6.82.E4.BD.95.E5.A4.84.E7.90.86.EF.BC.9F)
+             * [UnsupportedOperation.ContainDomesticAndInternationalPhoneNumber](https://cloud.tencent.com/document/product/382/9558#.E7.9F.AD.E4.BF.A1.E5.8F.91.E9.80.81.E6.8F.90.E7.A4.BA.EF.BC.9Aunsupportedoperation.containdomesticandinternationalphonenumber-.E5.A6.82.E4.BD.95.E5.A4.84.E7.90.86.EF.BC.9F)
+             * 更多错误,可咨询[腾讯云助手](https://tccc.qcloud.com/web/im/index.html#/chat?webAppId=8fa15978f85cb41f7e2ea36920cb3ae1&title=Sms)
+             */
+            SendStatus sendStatus = res.getSendStatusSet()[0];
+//            System.out.println("sendStatus = " + sendStatus);
+
+
+            returString=res.getSendStatusSet();
+
+        } catch (TencentCloudSDKException e) {
+            e.printStackTrace();
+        }
+        return returString;
+    }
+
+
+    public static  void main(String[] args) throws TencentCloudSDKException{
+        //这里定义一个存储电话号码的数组
+
+       String tels="+8615779633758"; // 手机号前面记得带上国家区域编码
+//        SendStatus[] test = sendSms(tels);
+
+    }
+
+}

+ 25 - 0
src/main/java/com/template/common/utils/ValidateCode.java

@@ -0,0 +1,25 @@
+package com.template.common.utils;
+
+import java.util.Random;
+
+//验证码随机数
+public  class  ValidateCode {
+
+   public static Integer generateValidateCode(int length){
+       Integer code =null;
+       if(length == 4){
+           code = new Random().nextInt(9999);//生成随机数,最大为9999
+           if(code < 1000){
+               code = code + 1000;//保证随机数为4位数字
+           }
+       }else if(length == 6){
+           code = new Random().nextInt(999999);//生成随机数,最大为999999
+           if(code < 100000){
+               code = code + 100000;//保证随机数为6位数字
+           }
+       }else{
+           throw new RuntimeException("只能生成4位或6位数字验证码");
+       }
+       return code;
+   }
+}

+ 67 - 0
src/main/java/com/template/common/utils/WaterElectricDataEncAndDecUtil.java

@@ -0,0 +1,67 @@
+package com.template.common.utils;
+
+import org.springframework.util.Assert;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+
+/**
+ * 水电服务data加解密工具
+ */
+public class WaterElectricDataEncAndDecUtil {
+
+    /**
+     * 解密
+     * @param src 源数据
+     * @param secret 秘钥
+     * @param iv 初始化向量
+     * @return String
+     */
+    public static String dataDecode(String src, String secret, String iv){
+        Assert.hasLength(secret, "密钥不能为空");
+        if (secret.length() != 16) {
+            System.out.print("密钥长度不是16位");
+            return null;
+        }
+        try {
+            byte[] raw = secret.getBytes(StandardCharsets.US_ASCII);
+            SecretKeySpec keySpec = new SecretKeySpec(raw, "AES");
+            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+            IvParameterSpec ips  = new IvParameterSpec(iv.getBytes());
+            cipher.init(Cipher.DECRYPT_MODE, keySpec, ips);
+            byte[] encrypted1 = MyBase64.decode(src);
+            try {
+                byte[] original = cipher.doFinal(encrypted1);
+                return new String(original, StandardCharsets.UTF_8);
+            } catch (Exception e) {
+                return null;
+            }
+        } catch (Exception ex) {
+            return null;
+        }
+    }
+
+    /**
+     * 加密
+     * @param src 源数据
+     * @param secret 秘钥
+     * @param iv 初始化向量
+     * @return String
+     */
+    public static String dataEncode(String src, String secret, String iv) throws Exception {
+        Assert.hasLength(secret, "密钥不能为空");
+        if (secret.length() != 16) {
+            System.out.print("密钥长度不是16位");
+            return null;
+        }
+        byte[] raw = secret.getBytes(StandardCharsets.UTF_8);
+        SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
+        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");// "算法/模式/补码方式"
+        IvParameterSpec ips = new IvParameterSpec(iv.getBytes(StandardCharsets.UTF_8));// 使用CBC模式,需要一个向量iv,可增加加密算法的强度
+        cipher.init(Cipher.ENCRYPT_MODE, skeySpec, ips);
+        byte[] encrypted = cipher.doFinal(src.getBytes(StandardCharsets.UTF_8));
+        return MyBase64.encode(encrypted);
+    }
+}

+ 131 - 0
src/main/java/com/template/common/utils/WaterElectricSignUtil.java

@@ -0,0 +1,131 @@
+package com.template.common.utils;
+
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * 水电服务参数签名工具
+ */
+public class WaterElectricSignUtil {
+
+    /**
+     * 签名
+     * @param src 源数据
+     * @param signKey 签名秘钥
+     * @return String
+     */
+    public static String sign(String src, String signKey){
+        String result = "";
+        try {
+            byte[] keyByte = signKey.getBytes(StandardCharsets.UTF_8);
+            byte[] dataByte = src.getBytes(StandardCharsets.UTF_8);
+            byte[] hmacMd5Byte = getHmacMd5Bytes(keyByte, dataByte);
+            StringBuilder md5Str = new StringBuilder();
+            for (byte b : hmacMd5Byte) {
+                if (Integer.toHexString(0xFF & b).length() == 1) md5Str.append("0").append(Integer.toHexString(0xFF & b));
+                else md5Str.append(Integer.toHexString(0xFF & b));
+            }
+            result = md5Str.toString().toUpperCase();
+
+        } catch (Exception ignored) {
+        }
+        return result;
+
+    }
+
+    /**
+     * 将待加密数据data,通过密钥key,使用hmac-md5算法进行加密,然后返回加密结果。 参照rfc2104 HMAC算法介绍实现。
+     *
+     * @author sc
+     * @param key 密钥
+     * @param data 待加密数据
+     * @return 加密结果
+     */
+    private static byte[] getHmacMd5Bytes(byte[] key, byte[] data) throws NoSuchAlgorithmException {
+        /*
+         * HmacMd5 calculation formula: H(K XOR opad, H(K XOR ipad, text)) HmacMd5 计算公式:H(K XOR opad, H(K XOR ipad,
+         * text)) H代表hash算法,本类中使用MD5算法,K代表密钥,text代表要加密的数据 ipad为0x36,opad为0x5C。
+         */
+        int length = 64;
+        byte[] ipad = new byte[length];
+        byte[] opad = new byte[length];
+        for (int i = 0; i < 64; i++) {
+            ipad[i] = 0x36;
+            opad[i] = 0x5C;
+        }
+        byte[] actualKey = key; // Actual key.
+        byte[] keyArr = new byte[length]; // Key bytes of 64 bytes length
+        /*
+         * If key's length is longer than 64,then use hash to digest it and use the result as actual key.
+         * 如果密钥长度,大于64字节,就使用哈希算法,计算其摘要,作为真正的密钥。
+         */
+        if (key.length > length) {
+            actualKey = md5(key);
+        }
+        System.arraycopy(actualKey, 0, keyArr, 0, actualKey.length);
+        /*
+         * append zeros to K 如果密钥长度不足64字节,就使用0x00补齐到64字节。
+         */
+        if (actualKey.length < length) {
+            for (int i = actualKey.length; i < keyArr.length; i++)
+                keyArr[i] = 0x00;
+        }
+
+        /*
+         * calc K XOR ipad 使用密钥和ipad进行异或运算。
+         */
+        byte[] firstAppendResult = xor(data, length, ipad, keyArr);
+
+        /*
+         * calc H(K XOR ipad, text) 使用哈希算法计算上面结果的摘要。
+         */
+        byte[] firstHashResult = md5(firstAppendResult);
+
+        /*
+         * calc K XOR opad 使用密钥和opad进行异或运算。
+         */
+        byte[] secondAppendResult = xor(firstHashResult, length, opad, keyArr);
+
+        /*
+         * H(K XOR opad, H(K XOR ipad, text)) 对上面的数据进行哈希运算。
+         */
+        return md5(secondAppendResult);
+    }
+
+    /**
+     * 异或运算
+     * @param data
+     * @param length
+     * @param ipad ipad
+     * @param keyArr 密钥
+     * @return
+     */
+    private static byte[] xor(byte[] data, int length, byte[] ipad, byte[] keyArr) {
+        byte[] kIpadXorResult = new byte[length];
+        for (int i = 0; i < length; i++) {
+            kIpadXorResult[i] = (byte) (keyArr[i] ^ ipad[i]);
+        }
+
+        /*
+         * append "text" to the end of "K XOR ipad" 将待加密数据追加到K XOR ipad计算结果后面。
+         */
+        byte[] firstAppendResult = new byte[kIpadXorResult.length + data.length];
+        System.arraycopy(kIpadXorResult, 0, firstAppendResult, 0, kIpadXorResult.length);
+        System.arraycopy(data, 0, firstAppendResult, keyArr.length, data.length);
+        return firstAppendResult;
+    }
+
+
+    /**
+     * 计算参数的md5信息
+     *
+     * @param str 待处理的字节数组
+     * @return md5摘要信息
+     */
+    private static byte[] md5(byte[] str) throws NoSuchAlgorithmException {
+        MessageDigest md = MessageDigest.getInstance("MD5");
+        md.update(str);
+        return md.digest();
+    }
+}

+ 27 - 0
src/main/java/com/template/common/utils/paramUtils.java

@@ -0,0 +1,27 @@
+package com.template.common.utils;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.ObjectError;
+
+import java.util.List;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/7/5 星期三 16:11
+ * @Description: com.template.utils
+ * @Version: 1.0
+ */
+@Slf4j
+public class paramUtils {
+    public static String getParamError(BindingResult bindingResult){
+        //有校验没通过
+        List<ObjectError> errorList = bindingResult.getAllErrors();
+        StringBuilder st = new StringBuilder();
+        for (ObjectError error : errorList) {
+            st.append(error.getDefaultMessage()+"! ");//输出具体的错误信息
+        }
+
+        return st.toString();
+    }
+}

+ 25 - 0
src/main/java/com/template/common/utils/smsUtil.java

@@ -0,0 +1,25 @@
+package com.template.common.utils;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/4/20 星期四 8:26
+ * @Description: common
+ * @Version: 1.0
+ */
+public class smsUtil {
+//    @Autowired
+//    private static smsConfig smsConfig;
+//
+//    /**
+//     * 发送单条短信验证码
+//     * @param smmCode 短信验证码
+//     * @param phoneNumber 手机号
+//     * @return
+//     */
+//    public static void sendSingleMessage(String smmCode, String phoneNumber) throws HTTPException, IOException {
+//        String[] params = {smmCode,Integer.toString(smsConfig.getSmsMin())};
+//        SmsSingleSender ssender = new SmsSingleSender(smsConfig.getSdkAppid(), smsConfig.getAppKey());
+//        SmsSingleSenderResult result = ssender.sendWithParam("86", phoneNumber, smsConfig.getTemplateId(), params, smsConfig.getSmsSign(), "", "");
+//        System.out.println(result);
+//    };
+}

+ 183 - 0
src/main/java/com/template/component/WaterElectricComponent.java

@@ -0,0 +1,183 @@
+package com.template.component;
+
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.template.common.exception.MyCustomException;
+import com.template.common.result.ResponseStatusEnum;
+import com.template.common.utils.WaterElectricDataEncAndDecUtil;
+import com.template.common.utils.WaterElectricSignUtil;
+import com.template.config.WaterElectricConfig;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.util.StringUtils;
+import org.springframework.web.client.RestTemplate;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 水电服务
+ */
+@Slf4j
+@Component
+public class WaterElectricComponent {
+
+    private static final DateTimeFormatter DTF = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
+
+    @Autowired
+    private StringRedisTemplate stringRedisTemplate;
+    @Autowired
+    private WaterElectricConfig waterElectricConfig;
+
+    /**
+     * 获取token  redis 暂时不管
+     * @return
+     */
+    public String queryToken() {
+//        String token = stringRedisTemplate.opsForValue().get(RedisKey.WATER_AND_ELECTRIC_SERVICE_TOKEN);
+//        if (StringUtils.hasText(token)) {
+//            return token;
+//        } else {
+            Map<String, String> map = new HashMap<>();
+            map.put("operatorSecret", waterElectricConfig.getOperatorSecret());
+            try {
+                JsonNode jsonNode = queryData("queryToken", map, null);
+                String accessToken = jsonNode.get("accessToken").asText();
+                long ttl = jsonNode.get("tokenAvailableTime").asLong();
+//                stringRedisTemplate.opsForValue().set(RedisKey.WATER_AND_ELECTRIC_SERVICE_TOKEN, accessToken, ttl, TimeUnit.SECONDS);
+
+                return accessToken;
+            } catch (Exception e) {
+                throw new MyCustomException(ResponseStatusEnum.THIRD_PARTY_SERVICE_CALL_FAILED);
+            }
+//        }
+    }
+
+    /**
+     * 获取电表实时数据
+     * @param pointId
+     * @return
+     */
+    public String queryPowerRealTimeData(String pointId) {
+        Map<String, String> map = new HashMap<>();
+        map.put("pointId", pointId);
+        try {
+            JsonNode jsonNode = queryData("queryPowerRealTimeData", map, queryToken());
+            // {"bm": 1822.1, "dataTime": "", "frequency": "", "pointId": "", "status": 0}
+            log.info("读取电表数据【{}】", jsonNode.toString());
+            return jsonNode.get("bm").asText();
+        } catch (Exception e) {
+            throw new MyCustomException(ResponseStatusEnum.THIRD_PARTY_SERVICE_CALL_FAILED);
+        }
+    }
+
+    /**
+     * 获取水表历史数据
+     * @param pointId
+     * @return
+     */
+    public String queryLastHistoryCumulantInfo(String pointId) {
+        Map<String, String> map = new HashMap<>();
+        map.put("pointId", pointId);
+        map.put("pointType", "2");
+        try {
+            JsonNode jsonNode = queryData("queryLastHistoryCumulantInfo", map, queryToken());
+            log.info("读取水电表数据【{}】", jsonNode.toString());
+            return jsonNode.get("bm").asText();
+        } catch (Exception e) {
+            throw new MyCustomException(ResponseStatusEnum.THIRD_PARTY_SERVICE_CALL_FAILED);
+        }
+    }
+
+    /**
+     * 远程控制水电表
+     * @param pointId
+     * @param operType 1关、2开
+     * @return
+     */
+    public JsonNode remoteDisconnect(String pointId, String operType) {
+        Map<String, String> map = new HashMap<>();
+        map.put("pointId", pointId);
+        map.put("operType", operType);
+        try {
+            return queryData("remoteDisconnect", map, queryToken());
+        } catch (Exception e) {
+            throw new MyCustomException(ResponseStatusEnum.THIRD_PARTY_SERVICE_CALL_FAILED);
+        }
+    }
+
+    /**
+     * 请求数据
+     *
+     * @param uri 请求接口url
+     * @param paramMap 请求参数
+     * @param token 请求token 获取token时该字段可以为空
+     */
+    private JsonNode queryData(String uri, Map<String, String> paramMap, String token) throws Exception {
+        ObjectMapper mapper = new ObjectMapper();
+
+        // 加密data部分
+        String encode = WaterElectricDataEncAndDecUtil.dataEncode(mapper.writeValueAsString(paramMap), waterElectricConfig.getDataSecret(), waterElectricConfig.getDataSecretIv());
+        String seq = "0001";
+        String timeStamp = DTF.format(LocalDateTime.now());
+        MultiValueMap<String, String> requestMap = new LinkedMultiValueMap<>();
+        requestMap.add("operatorId", waterElectricConfig.getOperatorId());
+        requestMap.add("data", encode);
+        requestMap.add("timeStamp", timeStamp);
+        requestMap.add("seq", seq);
+
+        // 为防止 + 在收发过程中被变成空格,将加密后的密文中的所有空格替换一下,需要签名的参数: operatorId + 加密后的data + 时间戳 + 自增序列
+        String signSrc = waterElectricConfig.getOperatorId() + encode.replaceAll(" ", "+") + timeStamp + seq;
+        String sig = WaterElectricSignUtil.sign(signSrc, waterElectricConfig.getSignKey());
+        requestMap.add("sig", sig);
+
+        RestTemplate restTemplate = new RestTemplate();
+        HttpHeaders headers = new HttpHeaders();
+        if (StringUtils.hasText(token)) {
+            headers.add("token", token);
+        }
+        HttpEntity<MultiValueMap<String, String>> formEntity = new HttpEntity<>(requestMap, headers);
+        log.info("=======开始请求数据=======");
+        ResponseEntity<String> responseEntity = restTemplate.postForEntity(waterElectricConfig.getServiceHost() + uri, formEntity, String.class);
+        log.info("=======请求成功===========");
+        String body = responseEntity.getBody();
+
+        JsonNode jsonNode = mapper.readTree(body);
+        if (!"0".equals(jsonNode.get("ret").asText())) {
+            log.error("接口请求失败,【{}】", body);
+        }
+
+        // 验签
+        String dataS = jsonNode.get("data").asText().replaceAll(" ", "+");
+        String resultSigStr = jsonNode.get("operatorId").asText()
+                + dataS
+                + jsonNode.get("msg").asText()
+                + jsonNode.get("ret").asText();
+
+        // 本地签名
+        String localSign = WaterElectricSignUtil.sign(resultSigStr, waterElectricConfig.getSignKey());
+
+        String remoteSign = jsonNode.get("sig").asText();
+        if (!(StringUtils.hasText(remoteSign) && remoteSign.equals(localSign))) {
+            log.error("接口验签失败,本地签名【{}】,远程签名【{}】", localSign, remoteSign);
+        }
+
+        String data = WaterElectricDataEncAndDecUtil.dataDecode(dataS, waterElectricConfig.getDataSecret(), waterElectricConfig.getDataSecretIv());
+        if (!StringUtils.hasText(data)) {
+            log.error("水电服务接口data解密失败");
+        }
+        JsonNode dataJson = mapper.readTree(data);
+        return dataJson;
+    }
+}

+ 119 - 0
src/main/java/com/template/component/WeiXiaoComponent.java

@@ -0,0 +1,119 @@
+package com.template.component;
+
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.template.common.exception.MyCustomException;
+import com.template.common.result.ResponseStatusEnum;
+import com.template.config.WeixiaoConfig;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @Author: codingliang
+ * @Description: 微校相关组件
+ * @Date: 2022-08-23 14:19
+ * @Version: V1.0
+ **/
+@Slf4j
+@Component
+public class WeiXiaoComponent {
+
+    @Autowired
+    private WeixiaoConfig weixiaoConfig;
+    @Autowired
+    private StringRedisTemplate stringRedisTemplate;
+
+    /**
+     * 获取token
+     * @return
+     */
+    public String getApplicationToken() {
+//        String token = stringRedisTemplate.opsForValue().get(RedisKey.WEI_XIAO_SERVICE_TOKEN);
+//        if (StringUtils.hasText(token)) {
+//            return token;
+//        } else {
+            Map<String, Object> jsonMap = doGetApplicationToken();
+            String accessToken = jsonMap.get("access_token").toString();
+            String expiresIn = jsonMap.get("expires_in").toString();
+
+//            stringRedisTemplate.opsForValue().set(RedisKey.WEI_XIAO_SERVICE_TOKEN, accessToken, Long.valueOf(expiresIn), TimeUnit.SECONDS);
+
+            return accessToken;
+//        }
+    }
+
+    /**
+     * 发送通知
+     * @param cards 卡号集合
+     * @param digest 摘要
+     * @param title 通知标题
+     * @param content 通知内容
+     * @param customs 自定义参数,长度为2,分别为提示文案和通知跳转链接
+     */
+    public void sendNotice(List<String> cards, String digest, String title, String content, List<String> customs) {
+        String uri = "https://open.wecard.qq.com/cgi-bin/notice/send?access_token=" + getApplicationToken();
+        Map<String, String> params = new HashMap<>();
+
+        try {
+            ObjectMapper mapper = new ObjectMapper();
+            params.put("cards", mapper.writeValueAsString(cards));
+            params.put("title", title);
+            params.put("content", content);
+            params.put("sender", "智慧公寓");
+            params.put("digest", digest);
+            if (customs != null && customs.size() == 2) {
+                params.put("customs", mapper.writeValueAsString(customs));
+
+             }
+
+            RestTemplate client = new RestTemplate();
+            ResponseEntity<String> tokenResponse = client.postForEntity(uri, params, String.class);
+            String body = tokenResponse.getBody();
+            log.info("微校发送通知返回结果【{}】", body);
+        } catch (Exception e) {
+            log.error("微校发送通知错误【{}】", e.getMessage());
+        }
+    }
+
+    /**
+     * 获取token
+     * @return
+     */
+    private Map<String, Object> doGetApplicationToken() {
+        String uri = "https://open.wecard.qq.com/cgi-bin/oauth2/token";
+
+        // 构建请求参数
+        Map<String, String> tokenParams = new HashMap<>();
+        tokenParams.put("app_key", weixiaoConfig.getAppKey());
+        tokenParams.put("app_secret", weixiaoConfig.getAppSecret());
+        tokenParams.put("grant_type", "client_credentials");
+        tokenParams.put("scope", "base");
+        tokenParams.put("ocode", weixiaoConfig.getOcode());
+
+        try {
+            RestTemplate client = new RestTemplate();
+            ResponseEntity<String> tokenResponse = client.postForEntity(uri, tokenParams, String.class);
+            String body = tokenResponse.getBody();
+            log.info("微校请求token返回结果【{}】", body);
+            ObjectMapper mapper = new ObjectMapper();
+            Map<String, Object> jsonMap = mapper.readValue(body, new TypeReference<Map<String, Object>>() {});
+
+
+            return jsonMap;
+        } catch (Exception e) {
+            log.error("微校请求token【{}】", e.getMessage());
+            throw new MyCustomException(ResponseStatusEnum.THIRD_PARTY_SERVICE_CALL_FAILED);
+        }
+    }
+}

+ 25 - 0
src/main/java/com/template/config/DoorLockConfig.java

@@ -0,0 +1,25 @@
+package com.template.config;
+
+import lombok.Data;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * 门锁配置
+ */
+@Configuration
+@Data
+//@ConfigurationProperties(prefix = "door-lock")
+public class DoorLockConfig {
+    @Value("${door-lock.app-id}")
+    private String appId;
+    @Value("${door-lock.app-secret}")
+    private String appSecret;
+    @Value("${door-lock.category-id}")
+    private String categoryId;
+    @Value("${door-lock.service-host}")
+    private String serviceHost;
+
+
+}

+ 52 - 0
src/main/java/com/template/config/MyBatisPlusConfig.java

@@ -0,0 +1,52 @@
+package com.template.config;
+
+import com.baomidou.mybatisplus.core.injector.ISqlInjector;
+import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
+import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+// 扫描我们的 mapper 文件夹
+@MapperScan("com.template.mapper")
+@EnableTransactionManagement
+@Configuration // 配置类
+public class MyBatisPlusConfig {
+
+    // 注册乐观锁插件
+    @Bean
+    public OptimisticLockerInterceptor optimisticLockerInterceptor() {
+        return new OptimisticLockerInterceptor();
+    }
+
+    // 分页插件
+    @Bean
+    public PaginationInterceptor paginationInterceptor() {
+        return  new PaginationInterceptor();
+    }
+
+    // 逻辑删除组件!
+    @Bean
+    public ISqlInjector sqlInjector() {
+        return new LogicSqlInjector();
+    }
+
+
+//    /**
+//     * SQL执行效率插件
+//     * 在控制台显示sql语句
+//     */
+//    @Bean
+//    @Profile({"dev","test"})// 设置 dev test 环境开启,保证我们的效率
+//    public PerformanceInterceptor performanceInterceptor() {
+//        PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
+//        performanceInterceptor.setMaxTime(3000); //ms 设置sql执行的最大时间,如果超过了则不执行
+//        performanceInterceptor.setFormat(true);
+//        return performanceInterceptor;
+//    }
+
+}

+ 37 - 0
src/main/java/com/template/config/MySecurity.java

@@ -0,0 +1,37 @@
+package com.template.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+//@ConfigurationProperties(prefix = "my-security")
+public class MySecurity {
+    @Value("${my-security.privateKey}")
+    public String privateKey;
+    @Value("${my-security.publicKey}")
+    public String publicKey;
+
+    public String getPrivateKey() {
+        return privateKey;
+    }
+
+    public String getPublicKey() {
+        return publicKey;
+    }
+
+    @Override
+    public String toString() {
+        return "MySecurity{" +
+                "privateKey='" + privateKey + '\'' +
+                ", publicKey='" + publicKey + '\'' +
+                '}';
+    }
+
+    public void setPrivateKey(String privateKey) {
+        this.privateKey = privateKey;
+    }
+
+    public void setPublicKey(String publicKey) {
+        this.publicKey = publicKey;
+    }
+}

+ 39 - 0
src/main/java/com/template/config/WaterElectricConfig.java

@@ -0,0 +1,39 @@
+package com.template.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+
+/**
+ * 水电服务配置
+ */
+@Configuration
+@ConfigurationProperties(prefix = "water-electric")
+@Data
+public class WaterElectricConfig {
+    /**
+     * 运营商标识
+     */
+    private String operatorId;
+    /**
+     * 运营商秘钥
+     */
+    private String operatorSecret;
+    /**
+     * 运营商数据秘钥
+     */
+    private String dataSecret;
+    /**
+     * 数据秘钥初始化向量
+     */
+    private String dataSecretIv;
+    /**
+     * 签名秘钥
+     */
+    private String signKey;
+    /**
+     * 服务地址
+     */
+    private String serviceHost;
+}

+ 21 - 0
src/main/java/com/template/config/WeixiaoConfig.java

@@ -0,0 +1,21 @@
+package com.template.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @Author: codingliang
+ * @Description: 微校相关配置
+ * @Date: 2021-06-21 15:26
+ * @Version: V1.0
+ **/
+@Data
+@Configuration
+@ConfigurationProperties(prefix = "weixiao")
+public class WeixiaoConfig {
+
+    private String appKey;
+    private String appSecret;
+    private String ocode;
+}

+ 21 - 0
src/main/java/com/template/controller/ClassScheduleController.java

@@ -0,0 +1,21 @@
+package com.template.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-06
+ */
+@RestController
+@RequestMapping("/auto/class-schedule")
+public class ClassScheduleController {
+
+}
+

+ 85 - 0
src/main/java/com/template/controller/ExcelController.java

@@ -0,0 +1,85 @@
+package com.template.controller;
+
+import com.template.annotation.PassToken;
+import com.template.api.ExcelControllerAPI;
+import org.apache.poi.ss.usermodel.DataFormatter;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+
+@RestController
+public class ExcelController implements ExcelControllerAPI {
+
+
+    /**
+     * .xlsx格式
+     * @param
+     */
+    @Override
+    @PassToken
+    public void toExcel(String fileUrl) {
+        //创建工作簿对象
+        XSSFWorkbook xssfWorkbook = null;
+        try {
+            xssfWorkbook = new XSSFWorkbook(new FileInputStream(fileUrl));
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        //获取工作簿下sheet的个数
+        int sheetNum = xssfWorkbook.getNumberOfSheets();
+        //遍历工作簿中的所有数据
+        for (int i = 0; i < sheetNum; i++) {
+            //读取第i个工作表
+            System.out.println("读取第"+(i+1)+"个sheet");
+            XSSFSheet sheet = xssfWorkbook.getSheetAt(i);
+            //获取最后一行的num,即总行数。此处从0开始
+            int maxRow = sheet.getLastRowNum();
+//            从第二行开始获取数据
+            for (int row = 1; row <= maxRow; row++) {
+                //获取最后单元格num,即总单元格数 ***注意:此处从1开始计数***
+                int maxRol = sheet.getRow(row).getLastCellNum();
+                System.out.println("--------第" + row + "行的数据如下--------");
+//                for (int rol = 0; rol < maxRol; rol++){
+//                    System.out.print(sheet.getRow(row).getCell(rol) + "  ");
+//                }
+                DataFormatter dataFormatter = new DataFormatter();
+//                获取手机号
+                XSSFCell cell = sheet.getRow(row).getCell(3);
+//                获取的手机号格式有问题需要转换
+                dataFormatter.addFormat("###########",null);
+                String phone = dataFormatter.formatCellValue(cell);
+//                获取名字
+                String name = sheet.getRow(row).getCell(1).toString();
+//                获取备注
+                String remarks = sheet.getRow(row).getCell(4).toString();
+//                获取性别
+                String genderName = sheet.getRow(row).getCell(2).toString();
+                int gender;
+                if ("女".equals(genderName)) {
+                    gender=1;
+                }else {
+                    gender=2;
+                }
+
+//                SystemUser systemUser = new SystemUser();
+//                systemUser.setRoleId(Long.valueOf(row));
+//                systemUser.setAccountName(name);
+//                systemUser.setAccountNumber(row+"");
+//                systemUser.setAccountPassword("123456");
+//                systemUser.setPhoneNumber(phone);
+//                systemUser.setEmail("123456@123456");
+//                systemUser.setRemarks(remarks);
+//                systemUser.setGender(gender);
+//                systemUser.setDeleted(0L);
+//                systemUser.setWechatId("123456789");
+
+//                systemUserService.save(systemUser);
+
+            }
+        }
+    }
+}

+ 290 - 0
src/main/java/com/template/controller/HouseController.java

@@ -0,0 +1,290 @@
+package com.template.controller;
+
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.template.annotation.Encrypt;
+import com.template.api.HouseAPI;
+import com.template.model.dto.HouseDto;
+import com.template.model.pojo.House;
+import com.template.model.pojo.HouseNumber;
+import com.template.model.pojo.PermissionSetting;
+import com.template.model.result.CommonResult;
+import com.template.model.result.PageUtils;
+import com.template.model.vo.HouseVo;
+import com.template.model.vo.HousedetailsVo;
+import com.template.services.HouseNumberService;
+import com.template.services.HouseService;
+import com.template.services.HouseStateService;
+import com.template.services.PermissionSettingService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>
+ * 前端控制器
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-06
+ */
+@RestController
+public class HouseController implements HouseAPI {
+    @Autowired
+    HouseService houseService;
+
+    @Autowired
+    HouseNumberService houseNumberService;
+
+    @Autowired
+    HouseStateService houseStateService;
+
+    @Autowired
+    PermissionSettingService permissionSettingService;
+
+    @Override
+    @Encrypt
+    @Transactional(rollbackFor = Exception.class)
+    public CommonResult save(@RequestBody HouseDto houseDto) {
+        if (ObjectUtils.isEmpty(houseDto) && ObjectUtils.isEmpty(houseDto.getRoomNumbers()) && ObjectUtils.isEmpty(houseDto.getAdminId())) {
+            return CommonResult.fail("参数异常");
+        }
+
+        PermissionSetting permissionSetting = permissionSettingService.getById(houseDto.getAdminId());
+        if (ObjectUtils.isEmpty(permissionSetting)) {
+            return CommonResult.fail("非法进入");
+        }
+//      判断该用户是否拥有权限
+        String houseTypeManagement = permissionSetting.getHouseTypeManagement();
+        if (!"0".equals(houseTypeManagement) && !"1".equals(houseTypeManagement)) {
+            return CommonResult.fail("此账号暂无该权限");
+        }
+
+
+        House house = houseDto.getHouse();
+        List<String> roomNumbers = houseDto.getRoomNumbers();
+
+        Integer number = house.getNumber();
+
+        if (number != roomNumbers.size()) {
+            return CommonResult.fail("房间数量不一致");
+        }
+        //      去重后的数量
+        long count = roomNumbers.stream().distinct().count();
+        if (count != roomNumbers.size()) {
+            return CommonResult.fail("房间号不可重复");
+        }
+
+        LambdaQueryWrapper<House> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(House::getRoomName, house.getRoomName())
+                .eq(House::getRoomType, house.getRoomType());
+        House one = houseService.getOne(wrapper);
+        if (ObjectUtils.isNotEmpty(one)) {
+            return CommonResult.fail("该房型已存在");
+        }
+
+        try {
+            houseService.saveOrUpdate(house);
+
+            ArrayList<HouseNumber> houseNumbers = new ArrayList<>();
+            for (String roomNumber : roomNumbers) {
+//                tian
+                HouseNumber houseNumber = new HouseNumber();
+                houseNumber.setRoomNumber(roomNumber);
+                houseNumber.setHouseId(house.getId() + "");
+//                默认净房
+                houseNumber.setHouseStatus(1);
+//               默认空闲
+                houseNumber.setStatus(1);
+//                默认关电
+                houseNumber.setElectricType("2");
+
+                houseNumbers.add(houseNumber);
+            }
+            boolean b = houseNumberService.saveOrUpdateBatch(houseNumbers);
+
+            if (b) {
+                return CommonResult.ok();
+            }
+
+        } catch (Exception e) {
+            return CommonResult.fail();
+        }
+
+        return CommonResult.fail();
+    }
+
+
+    @Override
+    public CommonResult getPage(int page, int size, int type, String keyWord) {
+        if (ObjectUtils.isEmpty(page) && page <= 0) {
+            page = 1;
+        }
+        if (ObjectUtils.isEmpty(size) && size <= 0) {
+            size = 10;
+        }
+//        if (!(type == 1 || type == 2)) {
+//            return CommonResult.fail("参数异常");
+//        }
+
+        PageUtils<HouseVo> pageDto = houseService.getPage(page, size, type, keyWord);
+
+        return CommonResult.ok(pageDto);
+    }
+
+
+    @Override
+    public CommonResult details(String houseId) {
+        if (ObjectUtils.isEmpty(houseId)) {
+            return CommonResult.fail("参数异常");
+        }
+
+        HousedetailsVo housedetailsVo = houseService.details(houseId);
+
+        return CommonResult.ok(housedetailsVo);
+    }
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public CommonResult update(HouseDto houseDto) {
+        if (ObjectUtils.isEmpty(houseDto) && ObjectUtils.isEmpty(houseDto.getRoomNumbers()) && ObjectUtils.isEmpty(houseDto.getHouse().getId()) && ObjectUtils.isEmpty(houseDto.getAdminId())) {
+            return CommonResult.fail("参数异常");
+        }
+
+        PermissionSetting permissionSetting = permissionSettingService.getById(houseDto.getAdminId());
+        if (ObjectUtils.isEmpty(permissionSetting)) {
+            return CommonResult.fail("非法进入");
+        }
+//      判断该用户是否拥有权限
+        String houseTypeManagement = permissionSetting.getHouseTypeManagement();
+        if (!"0".equals(houseTypeManagement) && !"2".equals(houseTypeManagement)) {
+            return CommonResult.fail("此账号暂无该权限");
+        }
+
+
+        House house = houseDto.getHouse();
+        List<String> roomNumbers = houseDto.getRoomNumbers();
+
+        Integer number = house.getNumber();
+
+        if (number != roomNumbers.size()) {
+            return CommonResult.fail("房间数量不一致");
+        }
+        //      去重后的数量
+        long count = roomNumbers.stream().distinct().count();
+        if (count != roomNumbers.size()) {
+            return CommonResult.fail("房间号不可重复");
+        }
+
+//        判断修改的房型名称和房型类型是是否已存在
+        House byId = houseService.getById(house.getId());
+        if (!house.getNumber().equals(byId.getNumber()) && house.getRoomType() != byId.getRoomType()) {
+            LambdaQueryWrapper<House> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(House::getRoomName, house.getRoomName())
+                    .eq(House::getRoomType, house.getRoomType());
+            House one = houseService.getOne(wrapper);
+            if (ObjectUtils.isNotEmpty(one)) {
+                return CommonResult.fail("该房型已存在");
+            }
+        }
+
+        try {
+            //        通过houseId,找到房间号
+            LambdaQueryWrapper<HouseNumber> wrapperHn = new LambdaQueryWrapper<>();
+            wrapperHn.eq(HouseNumber::getHouseId, house.getId());
+            List<HouseNumber> list = houseNumberService.list(wrapperHn);
+            for (HouseNumber houseNumber : list) {
+//            判断房间号是否还存在
+                String roomNumber = houseNumber.getRoomNumber();
+//            不存在则删除
+                if (!roomNumbers.contains(roomNumber)) {
+//                判断房间是否在使用,在使用则不能删除
+                    if (houseNumber.getStatus() != 1) {
+                        return CommonResult.fail(roomNumber + "房间在使用");
+                    }
+                    houseNumberService.removeById(houseNumber);
+
+                } else {
+//                存在则在集合删除这个
+                    roomNumbers.remove(roomNumber);
+                }
+            }
+
+            houseService.updateById(house);
+            if (ObjectUtils.isNotEmpty(roomNumbers) && roomNumbers.size() > 0) {
+                ArrayList<HouseNumber> houseNumbers = new ArrayList<>();
+                for (String roomNumber : roomNumbers) {
+//                添加
+                    HouseNumber houseNumber = new HouseNumber();
+                    houseNumber.setRoomNumber(roomNumber);
+                    houseNumber.setHouseId(house.getId() + "");
+//                默认净房
+                    houseNumber.setHouseStatus(1);
+//               默认空闲
+                    houseNumber.setStatus(1);
+//                默认关电
+                    houseNumber.setElectricType("2");
+
+                    houseNumbers.add(houseNumber);
+                }
+                boolean b = houseNumberService.saveOrUpdateBatch(houseNumbers);
+            }
+            return CommonResult.ok();
+
+        } catch (Exception e) {
+            return CommonResult.fail();
+        }
+
+
+    }
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public CommonResult delete(String houseId, int adminId) {
+        if (ObjectUtils.isEmpty(houseId) && ObjectUtils.isEmpty(adminId)) {
+            return CommonResult.fail();
+        }
+
+        PermissionSetting permissionSetting = permissionSettingService.getById(adminId);
+        if (ObjectUtils.isEmpty(permissionSetting)) {
+            return CommonResult.fail("非法进入");
+        }
+//      判断该用户是否拥有权限
+        String houseTypeManagement = permissionSetting.getHouseTypeManagement();
+        if (!"0".equals(houseTypeManagement) && !"3".equals(houseTypeManagement)) {
+            return CommonResult.fail("此账号暂无该权限");
+        }
+
+
+//        删除房型需先删除房间号
+        //        通过houseId,找到房间号
+        LambdaQueryWrapper<HouseNumber> wrapperHn = new LambdaQueryWrapper<>();
+        wrapperHn.eq(HouseNumber::getHouseId, houseId);
+        List<HouseNumber> list = houseNumberService.list(wrapperHn);
+        for (HouseNumber houseNumber : list) {
+            if (houseNumber.getStatus() != 1) {
+                return CommonResult.fail(houseNumber.getRoomNumber() + "房间在使用,无法删除");
+            }
+        }
+        try {
+            houseNumberService.removeByIds(list);
+            houseService.removeById(houseId);
+
+            return CommonResult.ok();
+        } catch (Exception e) {
+            return CommonResult.fail();
+        }
+
+
+    }
+
+
+}
+

+ 21 - 0
src/main/java/com/template/controller/HouseNumberController.java

@@ -0,0 +1,21 @@
+package com.template.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-09
+ */
+@RestController
+@RequestMapping("/auto/house-number")
+public class HouseNumberController {
+
+}
+

+ 173 - 0
src/main/java/com/template/controller/HousePriceController.java

@@ -0,0 +1,173 @@
+package com.template.controller;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.template.api.HousePriceAPI;
+import com.template.model.dto.AlterDto;
+import com.template.model.dto.AlterPriceDto;
+import com.template.model.pojo.House;
+import com.template.model.pojo.HousePrice;
+import com.template.model.pojo.PermissionSetting;
+import com.template.model.result.CommonResult;
+import com.template.model.result.PageUtils;
+import com.template.model.vo.AlterPriceRecordVo;
+import com.template.model.vo.HouseVo;
+import com.template.model.vo.RoomTypeVo;
+import com.template.services.HousePriceService;
+import com.template.services.HouseService;
+import com.template.services.PermissionSettingService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import org.springframework.web.bind.annotation.RestController;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * <p>
+ * 前端控制器
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-09
+ */
+@RestController
+public class HousePriceController implements HousePriceAPI {
+
+    @Autowired
+    HouseService houseService;
+
+    @Autowired
+    PermissionSettingService permissionSettingService;
+
+    @Autowired
+    HousePriceService housePriceService;
+
+    @Override
+    public CommonResult roomType() {
+
+        List<RoomTypeVo> roomTypeList = houseService.roomType();
+//        全日
+        ArrayList<RoomTypeVo> day = new ArrayList<>();
+
+//        钟点
+        ArrayList<RoomTypeVo> hour = new ArrayList<>();
+
+        for (RoomTypeVo roomTypeVo : roomTypeList) {
+            String roomType = roomTypeVo.getRoomType();
+            if ("1".equals(roomType)) {
+                day.add(roomTypeVo);
+            } else {
+                hour.add(roomTypeVo);
+            }
+
+        }
+        HashMap<String, List<RoomTypeVo>> map = new HashMap<>();
+        map.put("day", day);
+        map.put("hour", hour);
+
+        return CommonResult.ok(map);
+    }
+
+    @Override
+    public CommonResult alterPrice(AlterPriceDto alterPriceDto) {
+        if (ObjectUtils.isEmpty(alterPriceDto) && ObjectUtils.isEmpty(alterPriceDto.getAdminId())) {
+            return CommonResult.fail();
+        }
+
+        int adminId = alterPriceDto.getAdminId();
+        PermissionSetting permissionSetting = permissionSettingService.getById(adminId);
+        if (ObjectUtils.isEmpty(permissionSetting)) {
+            return CommonResult.fail("非法进入");
+        }
+//      判断该用户是否拥有权限
+        String houseTypeManagement = permissionSetting.getHouseTypeManagement();
+        if (!"0".equals(houseTypeManagement) && !"4".equals(houseTypeManagement)) {
+            return CommonResult.fail("此账号暂无该权限");
+        }
+
+        ArrayList<HousePrice> housePrices = new ArrayList<>();
+
+//    获取改价内容
+        List<AlterDto> list = alterPriceDto.getAlterDtoList();
+        for (AlterDto alterDto : list) {
+            int type = alterDto.getType();
+            String name = alterDto.getName();
+            LambdaQueryWrapper<House> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(House::getRoomType, type)
+                    .eq(House::getRoomName, name);
+
+            House house = houseService.getOne(wrapper);
+            if (ObjectUtils.isNotEmpty(house)) {
+                BigDecimal roomPrice = house.getRoomPrice();
+                HousePrice housePrice = new HousePrice();
+                BigDecimal price = alterDto.getPrice();
+//                改价后的价格
+                housePrice.setPrice(price);
+//                原价
+                housePrice.setOriginalPrice(roomPrice);
+//              房型id
+                housePrice.setHouseId(house.getId()+"");
+//              设置日期
+                housePrice.setSetDate(alterDto.getDate());
+
+                housePrices.add(housePrice);
+
+            }
+
+        }
+
+        boolean b = housePriceService.saveBatch(housePrices);
+        if (b) {
+            return CommonResult.ok();
+        }
+
+        return CommonResult.fail();
+    }
+
+    @Override
+    public CommonResult alterPriceRecord(int adminId, String type, String houseName, String operatingTime, String priceTime, String operatingName,int page,int size) {
+        if (ObjectUtils.isEmpty(adminId)) {
+            return CommonResult.fail();
+        }
+        PermissionSetting permissionSetting = permissionSettingService.getById(adminId);
+        if (ObjectUtils.isEmpty(permissionSetting)) {
+            return CommonResult.fail("非法进入");
+        }
+//      判断该用户是否拥有权限
+        String houseTypeManagement = permissionSetting.getHouseTypeManagement();
+        if (!"0".equals(houseTypeManagement) && !"5".equals(houseTypeManagement)) {
+            return CommonResult.fail("此账号暂无该权限");
+        }
+
+        if (ObjectUtils.isEmpty(page) && page <= 0) {
+            page = 1;
+        }
+        if (ObjectUtils.isEmpty(size) && size <= 0) {
+            size = 10;
+        }
+
+        if (ObjectUtils.isNotEmpty(operatingTime)) {
+            if (operatingTime.split(",").length != 2) {
+                return CommonResult.fail("参数异常");
+            }
+        }
+
+        if (ObjectUtils.isNotEmpty(priceTime)) {
+            if (priceTime.split(",").length != 2) {
+                return CommonResult.fail("参数异常");
+            }
+        }
+
+        PageUtils<AlterPriceRecordVo> voPageUtils=housePriceService.alterPriceRecord(type,houseName,operatingTime,priceTime,operatingName,page,size);
+
+
+        return CommonResult.ok(voPageUtils);
+    }
+
+
+}
+

+ 21 - 0
src/main/java/com/template/controller/HouseStateController.java

@@ -0,0 +1,21 @@
+package com.template.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-07
+ */
+@RestController
+@RequestMapping("/auto/house-state")
+public class HouseStateController {
+
+}
+

+ 121 - 0
src/main/java/com/template/controller/LoginController.java

@@ -0,0 +1,121 @@
+package com.template.controller;
+
+import com.template.annotation.PassToken;
+import com.template.api.LoginControllerAPI;
+import com.template.model.enumModel.eStatu;
+import com.template.model.pojo.RepairAdmin;
+import com.template.model.request.loginRequest;
+import com.template.model.result.CommonResult;
+import com.template.model.vo.LoginVO;
+import com.template.services.RepairAdminService;
+import com.template.common.utils.AesUtils;
+import com.template.common.utils.paramUtils;
+import com.template.common.utils.JWTUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/7/5 星期三 9:28
+ * @Description: com.template.controller
+ * @Version: 1.0
+ */
+@RestController
+public class LoginController implements LoginControllerAPI {
+
+    @Autowired
+    private RepairAdminService repairAdminService;
+
+
+
+
+
+    /**
+     * 登录接口
+     * @param loginRequest
+     * account 账号
+     * password 密码
+     * @return
+     *
+     */
+    @Override
+    @PassToken
+    public CommonResult Login(@RequestBody loginRequest loginRequest, BindingResult bindingResult) {
+        if(loginRequest == null){
+            return CommonResult.fail("请传递参数");
+        }
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+
+        RepairAdmin result = repairAdminService.getRepairByAccount(loginRequest.getAccount());
+        if(result == null){
+            return CommonResult.fail("账号或密码错误");
+        }
+
+        if(result.getStatu() == eStatu.Freeze.getValue()){
+            return CommonResult.fail("该账号已被冻结");
+        }
+
+        String encPassword = AesUtils.encrypt(loginRequest.getPassword());
+        if(!encPassword.equals(result.getPassword())){
+            return CommonResult.fail("密码错误");
+        }
+
+        String token = JWTUtil.getToken(result);
+        LoginVO login = new LoginVO();
+        login.setToken(token);
+        login.setTokenTtl(JWTUtil.getExpired());
+        login.setUserName(result.getUsername());
+        login.setUserhead(AesUtils.encrypt(result.getId()));
+
+        return CommonResult.ok("登录成功",login);
+    }
+
+    /**
+     * 修改密码
+     * @param cpr
+     * oldPassword 旧密码
+     * newPassword 新密码
+     * confirmPassword 确认密码
+     * @param userhead
+     * @param bindingResult
+     * @return
+     */
+    @Override
+    public CommonResult ChangePassword(com.repair.model.request.changePasswordRequest cpr, @RequestHeader("user_head") String userhead, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+
+        if(!cpr.getNewPassword().equals(cpr.getConfirmPassword())){
+            return CommonResult.fail("确认密码和新密码不一致!");
+        }
+
+        String userID = AesUtils.decrypt(userhead);
+        RepairAdmin operateData = repairAdminService.getRepairById(userID);
+        if(operateData == null){
+            return CommonResult.fail("当前账号不合法!");
+        }
+
+        if(operateData.getStatu() == eStatu.Freeze.getValue()){
+            return CommonResult.fail("该账号已被冻结");
+        }
+
+        if(!AesUtils.encrypt(cpr.getOldPassword()).equals(operateData.getPassword())){
+            return CommonResult.fail("原密码错误!");
+        }
+
+        RepairAdmin ra = new RepairAdmin();
+        ra.setId(userID);
+        ra.setPassword(AesUtils.encrypt(cpr.getNewPassword()));
+        int result = repairAdminService.updateRepairAdmin(ra);
+
+        return result > 0 ? CommonResult.ok("修改成功") : CommonResult.fail("修改失败");
+    }
+}

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 212 - 0
src/main/java/com/template/controller/PasswordIssController.java


+ 21 - 0
src/main/java/com/template/controller/PermissionSettingController.java

@@ -0,0 +1,21 @@
+package com.template.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-15
+ */
+@RestController
+@RequestMapping("/auto/permission-setting")
+public class PermissionSettingController {
+
+}
+

+ 163 - 0
src/main/java/com/template/controller/RepairAdminController.java

@@ -0,0 +1,163 @@
+package com.template.controller;
+
+
+import com.template.api.RepairAdminControllerAPI;
+import com.template.common.utils.AesUtils;
+import com.template.common.utils.paramUtils;
+import com.template.model.enumModel.eIsSuper;
+import com.template.model.enumModel.eStatu;
+import com.template.model.pojo.RepairAdmin;
+import com.template.model.result.CommonResult;
+import com.template.model.result.PageUtils;
+import com.template.services.RepairAdminService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-07-05
+ */
+@RestController
+public class RepairAdminController implements RepairAdminControllerAPI {
+
+    @Autowired
+    private RepairAdminService repairAdminService;
+
+    /**
+     * 添加账号数据
+     *
+     * @param ra account 账号
+     *           password 密码
+     *           username 用户名称
+     *           phone 手机号
+     * @return
+     */
+    @Override
+    public CommonResult InsertRepairAdmin(@RequestBody RepairAdmin ra, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+        int result = 0; // 帮我们自动生成id
+        try {
+            result = repairAdminService.insertRepairAdmin(ra);
+        } catch (Exception e) {
+            if (e.getCause().getMessage().contains("'repair_admin.account_un'")) {
+                return CommonResult.fail("该账号已存在!");
+            }
+            return CommonResult.fail("系统异常,添加失败!");
+        }
+        return result > 0 ? CommonResult.ok() : CommonResult.fail();
+    }
+
+    /**
+     * 查询账户列表数据
+     *
+     * @param currentPage 当前页
+     * @param pageCount   一页数据条数
+     * @param account     账号
+     * @param phone       手机号
+     * @param userName    账号名称
+     * @return
+     */
+    @Override
+    public CommonResult queryPageRepairAdmins(@RequestParam int currentPage, @RequestParam int pageCount, String account, String phone, String userName) {
+        PageUtils<RepairAdmin> result = repairAdminService.queryPageList(currentPage, pageCount, account, phone, userName);
+
+        return CommonResult.ok(result);
+    }
+
+    /**
+     * 根据ID冻结账号账号数据
+     *
+     * @param frar id 数据ID
+     *             statu 状态
+     *             正常:0;冻结:1
+     * @return
+     */
+    @Override
+    public CommonResult freezeRepairAdminById(@RequestBody com.repair.model.request.freezeRepairAdminRequest frar, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+        RepairAdmin data = repairAdminService.getRepairById(frar.getId());
+        if (data == null) {
+            return CommonResult.fail("当前数据不存在,解冻失败!");
+        }
+        if (data.getStatu() == frar.getStatu()) {
+            String Message = frar.getStatu() == eStatu.Freeze.getValue() ? "当前处于冻结状态,请勿重复操作!" : "当前处于未冻结状态,请勿重复操作!";
+            return CommonResult.fail(Message);
+        }
+
+        String success = frar.getStatu() == eStatu.Freeze.getValue() ? "冻结成功!" : "解冻成功";
+        String fail = frar.getStatu() == eStatu.Freeze.getValue() ? "冻结失败!" : "解冻失败";
+        RepairAdmin ra = new RepairAdmin();
+        ra.setId(frar.getId());
+        ra.setStatu(frar.getStatu());
+        int result = repairAdminService.updateRepairAdmin(ra);
+        System.out.println(result);
+        return result > 0 ? CommonResult.ok(success) : CommonResult.fail(fail);
+    }
+
+    /**
+     * 根据ID删除账号数据
+     *
+     * @param id id 数据ID
+     * @return
+     */
+    @Override
+    public CommonResult deleteRepairAdminById(@RequestParam String id) {
+        RepairAdmin data = repairAdminService.getRepairById(id);
+        if (data == null) {
+            return CommonResult.fail("当前数据不存在,删除失败!");
+        }
+
+        int result = repairAdminService.deleteRepairAdminById(id);
+
+        return result > 0 ? CommonResult.ok() : CommonResult.fail();
+    }
+
+    /**
+     * 编辑账号
+     *
+     * @param ra id 数据ID
+     *           username 账号名称
+     *           phone 手机号
+     *           password 密码
+     * @return
+     */
+    @Override
+    public CommonResult updateRepairAdminById(com.repair.model.request.updateRepairAdminRequest ra, @RequestHeader("user_head") String userhead, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+
+        RepairAdmin data = repairAdminService.getRepairById(ra.getId());
+        if (data == null) {
+            return CommonResult.fail("当前数据不存在,编辑失败!");
+        }
+
+        //只有操作管理员才能编辑他人的密码
+        String userID = AesUtils.decrypt(userhead);
+        if (ra.getPassword() != null && !userID.equals(ra.getId())) {
+            RepairAdmin operateData = repairAdminService.getRepairById(userID);
+            if(operateData == null){
+                return CommonResult.fail("操作身份不合法,编辑失败!");
+            }
+            if(!data.getPassword().equals(AesUtils.encrypt(ra.getPassword())) && operateData.getIsSuper() != eIsSuper.Super.getValue()){
+                return CommonResult.fail("只有超级管理员才能更改密码!");
+            }
+        }
+
+        int result = repairAdminService.updateRepaiRadmin(ra);
+        return result > 0 ? CommonResult.ok("编辑成功") : CommonResult.fail("编辑失败");
+    }
+}
+

+ 49 - 0
src/main/java/com/template/controller/UploadServlet.java

@@ -0,0 +1,49 @@
+package com.template.controller;
+
+
+import com.template.common.utils.FileUtil;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.Part;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+
+@RestController
+@RequestMapping("/auto/upload")
+public class UploadServlet {
+
+    @PostMapping("/save")
+    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+        // 获取文件内容
+        Part filePart = request.getPart("file");
+        InputStream fileContent = filePart.getInputStream();
+
+        String fileNameWithPath = FileUtil.getFileNameWithPath() + ".jpg";
+        FileUtil.makeDirs(fileNameWithPath, "E://image");
+        String imgFilePath = "E://image/" + fileNameWithPath;
+//        FileUtil.makeDirs(fileNameWithPath, "/home/nginx/html/image");
+//        String imgFilePath = "/home/nginx/html/image/" + fileNameWithPath;
+
+//        上传图片
+        Files.copy(fileContent,new File(imgFilePath).toPath());
+
+        // 保存文件到指定目录
+//        String fileName = filePart.getSubmittedFileName();
+//        OutputStream out = new FileOutputStream(imgFilePath);
+//        byte[] buffer = new byte[1024];
+//        int bytesRead;
+//        while ((bytesRead = fileContent.read(buffer)) != -1) {
+//            out.write(buffer, 0, bytesRead);
+//        }
+//        out.close();
+
+        response.getWriter().println(imgFilePath);
+    }
+}

+ 27 - 0
src/main/java/com/template/core/CORSConfiguration.java

@@ -0,0 +1,27 @@
+package com.template.core;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@Configuration
+public class CORSConfiguration{
+    @Bean
+    public WebMvcConfigurer corsConfigurer() {
+        return new WebMvcConfigurer() {
+            @Override
+            public void addCorsMappings(CorsRegistry registry) {
+                registry.addMapping("/**")
+                        //放行哪些原始域
+                        .allowedOrigins("*")
+                        //是否发送Cookie信息
+                        .allowCredentials(false)
+                        //放行哪些原始域(请求方式)
+                        .allowedMethods("GET", "POST", "DELETE", "PUT", "OPTIONS")
+                        //放行哪些原始域(头部信息)
+                        .allowedHeaders("*");
+            }
+        };
+    }
+}

+ 113 - 0
src/main/java/com/template/core/JwtAuthenticationInterceptor.java

@@ -0,0 +1,113 @@
+package com.template.core;
+
+import com.auth0.jwt.interfaces.Claim;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.template.annotation.PassToken;
+import com.template.common.exception.MyCustomException;
+import com.template.common.result.ResponseStatusEnum;
+import com.template.common.utils.JWTUtil;
+import org.springframework.boot.configurationprocessor.json.JSONObject;
+import org.springframework.util.StringUtils;
+import org.springframework.web.method.HandlerMethod;
+import org.springframework.web.servlet.HandlerInterceptor;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.PrintWriter;
+import java.lang.reflect.Method;
+import java.util.Map;
+
+public class JwtAuthenticationInterceptor implements HandlerInterceptor {
+
+    /**
+     * preHandle:进入到控制器方法之前执行的内容
+     *     boolean:
+     *         true:可以继续执行控制器方法
+     *         false:拦截
+     * posthandler:执行控制器方法之后执行的内容
+     * afterCompletion:响应结束之前执行的内容
+     *///说明
+    @Override
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+
+        //region 检查是否有passtoken注释,有则跳过认证
+        //PassToken注解用在方法上面
+        HandlerMethod handlerMethod = (HandlerMethod) handler;
+        Method method = handlerMethod.getMethod();
+        if (method.isAnnotationPresent(PassToken.class)) {
+            PassToken passToken = method.getAnnotation(PassToken.class);
+            if (passToken.requeired()) {
+                return true;
+            }
+        }
+        //endregion
+
+        //除了登录和注册接口不需要user_head和token请求头外其他时候基本都要请求头
+        if(request.getHeader("user_head") == null){
+            //region 自定义返回响应的json格式
+            //加上这个可以让浏览器那里得到浏览器的401:response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+            response.setCharacterEncoding("UTF-8");
+            response.setContentType("application/json; charset=utf-8");
+            JSONObject res = new JSONObject();
+            res.put("code", ResponseStatusEnum.MISSING_REQUEST_HEADER.getStatus());
+            res.put("message",  ResponseStatusEnum.MISSING_REQUEST_HEADER.getMsg());
+            res.put("success", false);
+            PrintWriter out = null;
+            out = response.getWriter();
+            out.write(res.toString());
+            out.flush();
+            out.close();
+            //endregion
+            return false;
+        }
+
+        //region 获取url传递的参数 Query string传递的参数
+        //获取url参数 getParameter方法里的参数名和定义的参数名一致
+        String token = request.getHeader("token");
+        // 验证userToken
+        if (!StringUtils.hasText(token)) {
+            throw new MyCustomException(ResponseStatusEnum.SYSTEM_TOKEN_ERROR);
+        }
+
+        // 解析token
+        Map<String, Claim> stringClaimMap = JWTUtil.verifyToken(token);
+        if (ObjectUtils.isNotEmpty(stringClaimMap)) { // 登录
+            return true;
+        }
+        //endregion
+
+        //region 自定义返回响应的json格式
+        //加上这个可以让浏览器那里得到浏览器的401:response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+        response.setCharacterEncoding("UTF-8");
+        response.setContentType("application/json; charset=utf-8");
+        JSONObject res = new JSONObject();
+        res.put("code", ResponseStatusEnum.NO_PERMISSION.getStatus());
+        res.put("message", ResponseStatusEnum.NO_PERMISSION.getMsg());
+        res.put("success", false);
+        PrintWriter out = null;
+        out = response.getWriter();
+        out.write(res.toString());
+        out.flush();
+        out.close();
+        //endregion
+
+        //region 默认的响应提示信息
+        //上面的提示信息返回格式和下面的只能开启一个,否则应用日志系统会导致Idean抛出异常:
+        //java.lang.IllegalStateException: getWriter() has already been called for this response
+        //response.sendError(401, "无权限");
+        //endregion
+
+        return false;
+    }
+
+    @Override
+    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
+
+    }
+
+    @Override
+    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
+
+    }
+}

+ 25 - 0
src/main/java/com/template/core/JwtlnterceptorConfig.java

@@ -0,0 +1,25 @@
+package com.template.core;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.HandlerInterceptor;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@Configuration
+public class JwtlnterceptorConfig implements WebMvcConfigurer {
+    @Override
+    public void addInterceptors(InterceptorRegistry registry) {
+        //region
+        //目前测试下来 使用 /**所有的话,response.sendError浏览器获取不到响应的信息
+        //默认拦截所有路径
+        registry.addInterceptor(authenticationInterceptor())
+                .addPathPatterns("/api/**");
+        //endregion
+    }
+
+    @Bean
+    public HandlerInterceptor authenticationInterceptor() {
+        return new JwtAuthenticationInterceptor();
+    }
+}

+ 77 - 0
src/main/java/com/template/core/ReplaceStreamFilter.java

@@ -0,0 +1,77 @@
+package com.template.core;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.template.common.utils.AES;
+import com.template.common.utils.RSAUtils;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import java.io.BufferedReader;
+import java.io.IOException;
+
+/**
+ * 替换请求体的过滤逻辑
+ *
+ * @author wang
+ * @since 2022-05-20
+ **/
+@Slf4j
+public class ReplaceStreamFilter implements Filter {
+    @Value("${my-security.privateKey}")
+    public String privateKey;
+    @Value("${aes-key}")
+    public String aesKey;
+
+    @SneakyThrows
+    @Override
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+        //转换自己的wrapper,实现多次读写
+        RequestWrapper requestWrapper = new RequestWrapper((HttpServletRequest) request);
+
+        //GET请求不加密
+        if (requestWrapper.getMethod().equals("GET")) {
+            chain.doFilter(requestWrapper, response);
+            return;
+        }
+
+        //读出json请求体
+        StringBuffer buffer = new StringBuffer();
+        String line = null;
+        BufferedReader reader = null;
+        reader = requestWrapper.getReader();
+        while ((line = reader.readLine()) != null) {
+            buffer.append(line);
+        }
+        System.out.println("buffer = " + buffer.toString());
+            String bufferString = buffer.toString().replaceAll(" ", "");
+        System.out.println("bufferString = " + bufferString);
+        //解密
+        JSONObject jsonObject = JSON.parseObject(bufferString);
+        //得到的密文
+        String data = jsonObject.getString("data");
+        //先用RSA解密,得到AES加密的数据
+        String decrypt = RSAUtils.decrypt(data, RSAUtils.getPrivateKey(privateKey));
+        //再用AES解密数据
+        decrypt = AES.decryptFromBase64(decrypt, aesKey);
+        System.out.println("decrypt = " + decrypt);
+        //把解密之后的aesKey一并交给下游,方便在AOP对出参加密
+//        jsonObject = JSON.parseObject(data);
+//        jsonObject.put("aesKey" , aesKey);
+
+        //重置json请求体,保证下游业务无感知获取数据
+        requestWrapper.setBody(decrypt.getBytes());
+
+        chain.doFilter(requestWrapper, response);
+    }
+
+    @Override
+    public void destroy() {
+
+    }
+
+
+}

+ 129 - 0
src/main/java/com/template/core/RequestWrapper.java

@@ -0,0 +1,129 @@
+package com.template.core;
+
+import lombok.extern.slf4j.Slf4j;
+
+import javax.servlet.ReadListener;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import java.io.*;
+import java.nio.charset.Charset;
+
+/**
+ *  自定义Request,实现请求体的多次读
+ *
+ * @author wang
+ * @since 2022-05-20
+ **/
+@Slf4j
+public class RequestWrapper extends HttpServletRequestWrapper {
+
+    /**
+     * 存储body数据
+     */
+    private byte[] body;
+ 
+    public RequestWrapper(HttpServletRequest request) throws IOException {
+        super(request);
+ 
+        // 将body数据存储起来
+        String bodyStr = getBodyString(request);
+        body = bodyStr.getBytes(Charset.defaultCharset());
+    }
+ 
+    /**
+     * 获取请求Body
+     *
+     * @param request request
+     * @return String
+     */
+    public String getBodyString(final ServletRequest request) {
+        try {
+            return inputStream2String(request.getInputStream());
+        } catch (IOException e) {
+            log.error("", e);
+            throw new RuntimeException(e);
+        }
+    }
+
+    // 赋值给body字段
+    public void setBody(byte[] body) {
+        this.body = body;
+    }
+ 
+    /**
+     * 获取请求Body
+     *
+     * @return String
+     */
+    public String getBodyString() {
+        final InputStream inputStream = new ByteArrayInputStream(body);
+ 
+        return inputStream2String(inputStream);
+    }
+ 
+    /**
+     * 将inputStream里的数据读取出来并转换成字符串
+     *
+     * @param inputStream inputStream
+     * @return String
+     */
+    private String inputStream2String(InputStream inputStream) {
+        StringBuilder sb = new StringBuilder();
+        BufferedReader reader = null;
+ 
+        try {
+            reader = new BufferedReader(new InputStreamReader(inputStream, Charset.defaultCharset()));
+            String line;
+            while ((line = reader.readLine()) != null) {
+                sb.append(line);
+            }
+        } catch (IOException e) {
+            log.error("", e);
+            throw new RuntimeException(e);
+        } finally {
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (IOException e) {
+                    log.error("", e);
+                }
+            }
+        }
+ 
+        return sb.toString();
+    }
+ 
+    @Override
+    public BufferedReader getReader() throws IOException {
+        return new BufferedReader(new InputStreamReader(getInputStream()));
+    }
+ 
+    @Override
+    public ServletInputStream getInputStream() throws IOException {
+ 
+        final ByteArrayInputStream inputStream = new ByteArrayInputStream(body);
+ 
+        return new ServletInputStream() {
+            @Override
+            public int read() throws IOException {
+                return inputStream.read();
+            }
+ 
+            @Override
+            public boolean isFinished() {
+                return false;
+            }
+ 
+            @Override
+            public boolean isReady() {
+                return false;
+            }
+ 
+            @Override
+            public void setReadListener(ReadListener readListener) {
+            }
+        };
+    }
+}

+ 74 - 0
src/main/java/com/template/core/SwaggerConfiguration.java

@@ -0,0 +1,74 @@
+package com.template.core;
+
+import com.google.common.base.Predicates;
+import com.template.annotation.ControllerIsShow;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+@Configuration//配置对象
+@EnableSwagger2//声明启动Swagger2
+/*
+* 两种方式控制生产环境是否显示swagger
+* */
+//@Profile("!prod")
+@Profile({"dev","test"})
+public class SwaggerConfiguration {
+    /**
+     * 创建Docket类型的对象。并使用spring容器管理。
+     * Docket是Swagger中的全局配置对象。
+     * 请求方式:http://ip地址:端口/项目名/swagger-ui.html#/
+     */
+    @Bean
+    public Docket createRestApi() {
+        ApiInfo apiInfo = new ApiInfoBuilder()
+                .version("1.1.0") //版本
+                .title("视频系统接口文档") //网站标题
+                .description("提供测试接口或前端查看对应参数以及返回参数使用") //网站描述
+                .contact(new Contact("创海", "https://www.baidu.com/", "a974264710@163.com"))
+                //region 在swagger中显示作用不是很大
+                /*
+                .license("The Apache License") //协议
+                .licenseUrl("http://www.baidu.com") //许可证链接地址
+                */
+                //endregion
+                .build();
+
+        return new Docket(DocumentationType.SWAGGER_2)
+                .apiInfo(apiInfo)//参数为类对象,并且这个类对象是swagger版本
+                .select()//获取Docket中的选择器。返回ApiSelctorBuilder。构建选择器的。如:扫描什么包的注解。
+                .apis(
+                        //region 是否在swagger中进行展示对应控制器
+                        /*
+                         Predicates.not:取反 例如,false -> true
+                         withMethodAnnotation:当方法上有注解的时候返回true
+                         整体作用:启用该段代码之后如果在方法上使用的自定义的注解:ControllerIsShow
+                         则在swagger中不会显示该方法
+                        */
+                        Predicates.not(
+                                RequestHandlerSelectors.withMethodAnnotation(
+                                        ControllerIsShow.class
+                                )
+                        )
+                        //endregion
+                )
+                .apis(RequestHandlerSelectors.basePackage("com.video"))//设定扫描哪个包(包含子包)中的注解。 如果要匹配多个不同包下的控制器可以精确到多个包的统一父级
+                //region 匹配路由地址
+                /*
+                //用正则匹配显示路由地址为swagger开头的链接 即:范围匹配器 以此来控制在swagger中描述哪些控制器
+                .paths(
+                        PathSelectors.regex("/swagger/.*")
+                )
+                */
+                //endregion
+                .build();//重新构建Docket对象
+
+    }
+}

+ 26 - 0
src/main/java/com/template/handle/NonStaticResourceHttpRequestHandler.java

@@ -0,0 +1,26 @@
+package com.template.handle;
+
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.core.io.Resource;
+import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
+
+import javax.servlet.http.HttpServletRequest;
+import java.nio.file.Path;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/3/27 星期一 8:49
+ * @Description: com.video.handle
+ * @Version: 1.0
+ */
+@Component
+public class NonStaticResourceHttpRequestHandler extends ResourceHttpRequestHandler {
+    public final static String ATTR_FILE = "NON-STATIC-FILE";
+
+    @Override
+    protected Resource getResource(HttpServletRequest request) {
+        final Path filePath = (Path) request.getAttribute(ATTR_FILE);
+        return new FileSystemResource(filePath);
+    }
+}

+ 49 - 0
src/main/java/com/template/handler/MyMetaObjectHandler.java

@@ -0,0 +1,49 @@
+package com.template.handler;
+
+import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
+import com.template.common.utils.AesUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.ibatis.reflection.MetaObject;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
+
+@Slf4j
+@Component // 一定不要忘记把处理器加到IOC容器中!
+public class MyMetaObjectHandler implements MetaObjectHandler {
+    //创建用户和更新用户填充0的时候则说明不是账号操作的
+
+    // 插入时的填充策略
+    @Override
+    public void insertFill(MetaObject metaObject) {
+        HttpServletRequest request = getHttpServletRequest();
+        String user_id = request.getHeader("user_head") == null ? "1" : AesUtils.decrypt(request.getHeader("user_head"));
+        log.info("start insert fill.....");
+        // setFieldValByName(String fieldName, Object fieldVal, MetaObject metaObject
+        this.setFieldValByName("createTime", new Date(), metaObject);
+        this.setFieldValByName("updateTime", new Date(), metaObject);
+        this.setFieldValByName("createUser", user_id , metaObject);
+        this.setFieldValByName("updateUser", user_id , metaObject);
+        this.setFieldValByName("deleted", 0 , metaObject);
+    }
+
+    // 更新时的填充策略
+    @Override
+    public void updateFill(MetaObject metaObject) {
+        HttpServletRequest request = getHttpServletRequest();
+        String user_id = request.getHeader("user_head") == null ? "1" : AesUtils.decrypt(request.getHeader("user_head"));
+        log.info("start update fill.....");
+        this.setFieldValByName("updateTime", new Date(), metaObject);
+        this.setFieldValByName("updateUser", user_id, metaObject);
+    }
+
+    private HttpServletRequest getHttpServletRequest() {
+        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
+        ServletRequestAttributes attributes = (ServletRequestAttributes) requestAttributes;
+        return attributes.getRequest();
+    }
+}

+ 18 - 0
src/main/java/com/template/mapper/ClassScheduleMapper.java

@@ -0,0 +1,18 @@
+package com.template.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.template.model.pojo.ClassSchedule;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-06
+ */
+@Mapper
+public interface ClassScheduleMapper extends BaseMapper<ClassSchedule> {
+
+}

+ 31 - 0
src/main/java/com/template/mapper/HouseMapper.java

@@ -0,0 +1,31 @@
+package com.template.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.template.model.pojo.House;
+import com.template.model.vo.HouseVo;
+import com.template.model.vo.HousedetailsVo;
+import com.template.model.vo.RoomTypeVo;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-06
+ */
+@Mapper
+public interface HouseMapper extends BaseMapper<House> {
+
+    IPage<HouseVo> getPage(Page<HouseVo> pageVo, int type, String keyWord);
+
+    HousedetailsVo  details(String houseId);
+
+    List<RoomTypeVo> roomType();
+
+}

+ 18 - 0
src/main/java/com/template/mapper/HouseNumberMapper.java

@@ -0,0 +1,18 @@
+package com.template.mapper;
+
+import com.template.model.pojo.HouseNumber;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-09
+ */
+@Mapper
+public interface HouseNumberMapper extends BaseMapper<HouseNumber> {
+
+}

+ 23 - 0
src/main/java/com/template/mapper/HousePriceMapper.java

@@ -0,0 +1,23 @@
+package com.template.mapper;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.template.model.pojo.HousePrice;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.template.model.vo.AlterPriceRecordVo;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-09
+ */
+@Mapper
+public interface HousePriceMapper extends BaseMapper<HousePrice> {
+
+    IPage<AlterPriceRecordVo> alterPriceRecord(Page<AlterPriceRecordVo> pageVo, String type, String houseName, String operatingTime, String priceTime, String operatingName);
+
+}

+ 18 - 0
src/main/java/com/template/mapper/HouseStateMapper.java

@@ -0,0 +1,18 @@
+package com.template.mapper;
+
+import com.template.model.pojo.HouseState;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-07
+ */
+@Mapper
+public interface HouseStateMapper extends BaseMapper<HouseState> {
+
+}

+ 18 - 0
src/main/java/com/template/mapper/PermissionSettingMapper.java

@@ -0,0 +1,18 @@
+package com.template.mapper;
+
+import com.template.model.pojo.PermissionSetting;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-15
+ */
+@Mapper
+public interface PermissionSettingMapper extends BaseMapper<PermissionSetting> {
+
+}

+ 17 - 0
src/main/java/com/template/mapper/RepairAdminMapper.java

@@ -0,0 +1,17 @@
+package com.template.mapper;
+
+import com.template.model.pojo.RepairAdmin;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/*
+Mapper和Repository的相同点:
+@Mapper和@Repository都是作用在dao层接口,使得其生成代理对象bean,交给spring 容器管理,对于mybatis来说,都可以不用写mapper.xml文件
+Mapper和Repository的区别:
+@Repository需要在Spring中配置扫描地址,然后生成Dao层的Bean才能被注入到Service层中:如下,在启动类中配置扫描地址:
+@Mapper不需要配置扫描地址,通过xml里面的namespace里面的接口地址,生成了Bean后注入到Service层中
+* */
+@Repository
+public interface RepairAdminMapper extends BaseMapper<RepairAdmin> {
+
+}

+ 19 - 0
src/main/java/com/template/model/dto/AlterDto.java

@@ -0,0 +1,19 @@
+package com.template.model.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class AlterDto {
+//    类型
+    private int type;
+//    名字
+    private String name;
+//      设置时间
+    private String date;
+//      改价价格
+    private BigDecimal price;
+
+
+}

+ 13 - 0
src/main/java/com/template/model/dto/AlterPriceDto.java

@@ -0,0 +1,13 @@
+package com.template.model.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class AlterPriceDto {
+    private List<AlterDto> alterDtoList;
+
+    private int adminId;
+
+}

+ 29 - 0
src/main/java/com/template/model/dto/BillHandleResultDTO.java

@@ -0,0 +1,29 @@
+package com.template.model.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 结账单处理结果
+ */
+@Data
+public class BillHandleResultDTO {
+
+    /**
+     * 结账单id
+     */
+    private Long billId;
+    /**
+     * 结果标识 1待退款、2待补缴
+     */
+    private String resultFlag;
+    /**
+     * 待退款金额
+     */
+    private BigDecimal returnFee;
+    /**
+     * 待补缴金额
+     */
+    private BigDecimal realFee;
+}

+ 41 - 0
src/main/java/com/template/model/dto/CardInfoDto.java

@@ -0,0 +1,41 @@
+package com.template.model.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/6/8 星期四 9:19
+ * @Description: com.chuanghai.ihotel.controller.request
+ * @Version: 1.0
+ */
+@Data
+public class CardInfoDto {
+    /**
+     * 锁设备ID
+     */
+    @NotNull(message = "锁设备ID不能为空")
+    public String luid;
+
+    /**
+     * 卡号
+     */
+    @NotNull(message = "卡号不能为空")
+    public String card;
+
+    @NotNull(message = "卡类型不能为空 0 卡片 1 身份证")
+    public int cardType;
+    /**
+     * 开始时间 时间戳
+     */
+    @NotNull(message = "开始时间不能为空")
+    public String startTime;
+
+    /**
+     * 结束时间 时间戳
+     */
+    @NotNull(message = "结束时间不能为空")
+    public String endTime;
+
+}

+ 56 - 0
src/main/java/com/template/model/dto/EventMessageDTO.java

@@ -0,0 +1,56 @@
+package com.template.model.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * @Author: codingliang
+ * @Description: 事件消息
+ * @Date: 2022-07-29 14:51
+ * @Version: V1.0
+ **/
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class EventMessageDTO implements Serializable {
+    private static final long serialVersionUID = 3279055428067063169L;
+
+    /**
+     * 消息队列的消息id
+     */
+    private String messageId;
+
+
+    /**
+     * 事件类型
+     */
+    private String eventMessageType;
+
+
+    /**
+     * 业务id
+     */
+    private Long bizId;
+
+
+    /**
+     * 账号
+     */
+    private String accountNo;
+
+
+    /**
+     * 消息体
+     */
+    private String content;
+
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 39 - 0
src/main/java/com/template/model/dto/FingerprintDataDto.java

@@ -0,0 +1,39 @@
+package com.template.model.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/6/8 星期四 9:19
+ * @Description: com.chuanghai.ihotel.controller.request
+ * @Version: 1.0
+ */
+@Data
+public class FingerprintDataDto {
+    /**
+     * 锁设备ID
+     */
+    @NotNull(message = "锁设备ID不能为空")
+    public String luid;
+
+    /**
+     * 指纹特征值
+     */
+    @NotNull(message = "指纹特征值不能为空")
+    public String fingerprintData;
+
+    /**
+     * 开始时间 时间戳
+     */
+    @NotNull(message = "开始时间不能为空")
+    public String startTime;
+
+    /**
+     * 结束时间 时间戳
+     */
+    @NotNull(message = "结束时间不能为空")
+    public String endTime;
+
+}

+ 15 - 0
src/main/java/com/template/model/dto/HouseDto.java

@@ -0,0 +1,15 @@
+package com.template.model.dto;
+
+import com.template.model.pojo.House;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class HouseDto {
+    private House house;
+//    房间号
+    private List<String> roomNumbers;
+
+    private int adminId;
+}

+ 12 - 0
src/main/java/com/template/model/dto/HousePriceAlterDto.java

@@ -0,0 +1,12 @@
+package com.template.model.dto;
+
+import lombok.Data;
+
+@Data
+public class HousePriceAlterDto {
+//    房间类型
+    private int roomType;
+//      房型名称
+    private String roomName;
+
+}

+ 37 - 0
src/main/java/com/template/model/dto/LockRoomDTO.java

@@ -0,0 +1,37 @@
+package com.template.model.dto;
+
+import lombok.Builder;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * @Author: codingliang
+ * @Description: 锁房dto
+ * @Date: 2022-07-28 17:19
+ * @Version: V1.0
+ **/
+@Data
+@Builder
+public class LockRoomDTO {
+    /**
+     * 锁定开始时间
+     */
+    private LocalDateTime startTime;
+    /**
+     * 锁定结束时间
+     */
+    private LocalDateTime endTime;
+    /**
+     * 业务id
+     */
+    private Long bizId;
+    /**
+     * 房型id
+     */
+    private Long roomTypeId;
+    /**
+     * 房间id
+     */
+    private Long roomId;
+}

+ 33 - 0
src/main/java/com/template/model/dto/PasswordDto.java

@@ -0,0 +1,33 @@
+package com.template.model.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/6/8 星期四 9:19
+ * @Description: com.chuanghai.ihotel.controller.request
+ * @Version: 1.0
+ */
+@Data
+public class PasswordDto {
+    /**
+     * 锁设备ID
+     */
+    @NotNull(message = "锁设备ID不能为空")
+    public String luid;
+
+    /**
+     * 开始时间 时间戳
+     */
+    @NotNull(message = "开始时间不能为空")
+    public String startTime;
+
+    /**
+     * 结束时间 时间戳
+     */
+    @NotNull(message = "结束时间不能为空")
+    public String endTime;
+
+}

+ 27 - 0
src/main/java/com/template/model/enumModel/PasswordUrlEnum.java

@@ -0,0 +1,27 @@
+package com.template.model.enumModel;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/6/7 星期三 9:55
+ * @Description: com.chuanghai.ihotel.enums
+ * @Version: 1.0
+ */
+public enum PasswordUrlEnum {
+
+    Device_Info("getDeviceInfo","获取设备详情"),
+    Card_Info("addCardInfo","添加卡片"),
+    Fingerprint_Data("addFingerprintData","下发指纹"),
+    Password("addPassword","下发密码");
+
+    String url;
+    String dsc;
+
+    PasswordUrlEnum(String url, String dsc) {
+        this.url = url;
+        this.dsc = dsc;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+}

+ 32 - 0
src/main/java/com/template/model/enumModel/eIsSuper.java

@@ -0,0 +1,32 @@
+package com.template.model.enumModel;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/7/7 星期五 15:14
+ * @Description: com.repair.model.enumModel
+ * @Version: 1.0
+ */
+public enum eIsSuper {
+    NotSuper(0),//非超级管理员
+    Super(1);//超级管理员
+
+    private int value;
+
+    eIsSuper(int value){
+        this.value = value;
+    }
+
+    public int getValue() {
+        return value;
+    }
+    public static eIsSuper valueOf(int value) {
+        switch (value) {
+            case 0:
+                return eIsSuper.NotSuper;
+            case 1:
+                return eIsSuper.Super;
+            default:
+                return null;
+        }
+    }
+}

+ 33 - 0
src/main/java/com/template/model/enumModel/eStatu.java

@@ -0,0 +1,33 @@
+package com.template.model.enumModel;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/7/6 星期四 16:34
+ * @Description: com.template.model.enumModel
+ * @Version: 1.0
+ * 账号状态
+ */
+public enum  eStatu {
+    Freeze(1),//冻结
+    Unfrozen(0);//未冻结
+
+    private int value;
+
+    eStatu(int value){
+        this.value = value;
+    }
+
+    public int getValue() {
+        return value;
+    }
+    public static eStatu valueOf(int value) {
+        switch (value) {
+            case 1:
+                return eStatu.Freeze;
+            case 0:
+                return eStatu.Unfrozen;
+            default:
+                return null;
+        }
+    }
+}

+ 76 - 0
src/main/java/com/template/model/pojo/ClassSchedule.java

@@ -0,0 +1,76 @@
+package com.template.model.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-06
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ClassSchedule对象", description = "")
+public class ClassSchedule implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "节次")
+    private String jc;
+
+    @ApiModelProperty(value = "周几")
+    private String zj;
+
+    @ApiModelProperty(value = "第几周")
+    private String djz;
+
+    @ApiModelProperty(value = "学期")
+    private String xq;
+
+    @ApiModelProperty(value = "学年")
+    private String xn;
+
+    @ApiModelProperty(value = "教师姓名")
+    private String jsxm;
+
+    @ApiModelProperty(value = "教师工号")
+    private String jsgh;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新时间")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Date updateTime;
+
+    @ApiModelProperty(value = "创建人员")
+    @TableField(fill = FieldFill.INSERT)
+    private String createUser;
+
+    @ApiModelProperty(value = "更新人员")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String updateUser;
+
+    @ApiModelProperty(value = "未删除:0;删除:1")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleted;
+
+
+}
+

+ 89 - 0
src/main/java/com/template/model/pojo/House.java

@@ -0,0 +1,89 @@
+package com.template.model.pojo;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-06
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="House对象", description="")
+public class House implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "房间名称")
+    private String roomName;
+
+    @ApiModelProperty(value = "房间类型(1:全日房,2:钟点房)")
+    private int roomType;
+
+    @ApiModelProperty(value = "房间单价")
+    private BigDecimal roomPrice;
+
+    @ApiModelProperty(value = "房间数量")
+    private Integer number;
+
+    @ApiModelProperty(value = "房间面积")
+    private String roomArea;
+
+    @ApiModelProperty(value = "居住时长(状态为钟点房时才有)")
+    private String roomLiveTime;
+
+    @ApiModelProperty(value = "营业时间receiving_time")
+    private String receivingTime;
+
+    @ApiModelProperty(value = "可见类型(0:全部,1:学生,2:教职工,3:校友,4:访客,5:临时人员,6:其他,7:领导)")
+    private String visible;
+
+    @ApiModelProperty(value = "房间配置")
+    private String roomConfiguration;
+
+    @ApiModelProperty(value = "房间图片")
+    private String roomPicture;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新时间")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Date updateTime;
+
+    @ApiModelProperty(value = "创建人员")
+    @TableField(fill = FieldFill.INSERT)
+    private String createUser;
+
+    @ApiModelProperty(value = "更新人员")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String updateUser;
+
+    @ApiModelProperty(value = "逻辑删除 未删除:0;删除:1")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic(value = "0", delval = "1")
+    private Integer deleted;
+
+
+}

+ 73 - 0
src/main/java/com/template/model/pojo/HouseNumber.java

@@ -0,0 +1,73 @@
+package com.template.model.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-09
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="HouseNumber对象", description="")
+public class HouseNumber implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "房型id")
+    private String houseId;
+
+    @ApiModelProperty(value = "房间号")
+    private String roomNumber;
+
+    @ApiModelProperty(value = "房间状态 1.净房 2.脏房")
+    private int  houseStatus;
+
+    @ApiModelProperty(value = "状态 1.空闲 2.正在使用")
+    private int status;
+
+    @ApiModelProperty(value = "电开关操作 1开电,2关电")
+    private String electricType;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新时间")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Date updateTime;
+
+    @ApiModelProperty(value = "创建人员")
+    @TableField(fill = FieldFill.INSERT)
+    private String createUser;
+
+    @ApiModelProperty(value = "更新人员")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String updateUser;
+
+    @ApiModelProperty(value = "逻辑删除 未删除:0;删除:1")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic(value = "0", delval = "1")
+    private Integer deleted;
+
+
+}

+ 75 - 0
src/main/java/com/template/model/pojo/HousePrice.java

@@ -0,0 +1,75 @@
+package com.template.model.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-09
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="HousePriceHistory对象", description="")
+public class HousePrice implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "房型id")
+    private String houseId;
+
+    @ApiModelProperty(value = "原价")
+    private BigDecimal originalPrice;
+
+    @ApiModelProperty(value = "单价")
+    private BigDecimal price;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+    @ApiModelProperty(value = "设置日期")
+    private String setDate;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新时间")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Date updateTime;
+
+    @ApiModelProperty(value = "创建人员")
+    @TableField(fill = FieldFill.INSERT)
+    private String createUser;
+
+    @ApiModelProperty(value = "更新人员")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String updateUser;
+
+    @ApiModelProperty(value = "逻辑删除 未删除:0;删除:1")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleted;
+
+
+}

+ 67 - 0
src/main/java/com/template/model/pojo/HouseState.java

@@ -0,0 +1,67 @@
+package com.template.model.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-07
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="HouseState对象", description="")
+public class HouseState implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "房间id")
+    private Integer houseId;
+
+    @ApiModelProperty(value = "状态 1空闲、2预定、3入住、4脏房、5锁定")
+    private int status;
+
+    @ApiModelProperty(value = "预定订单id")
+    private String bookingId;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新时间")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Date updateTime;
+
+    @ApiModelProperty(value = "创建人员")
+    @TableField(fill = FieldFill.INSERT)
+    private String createUser;
+
+    @ApiModelProperty(value = "更新人员")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String updateUser;
+
+    @ApiModelProperty(value = "逻辑删除 未删除:0;删除:1")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic(value = "0", delval = "1")
+    private Integer deleted;
+
+
+}

+ 98 - 0
src/main/java/com/template/model/pojo/PermissionSetting.java

@@ -0,0 +1,98 @@
+package com.template.model.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-11-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="PermissionSetting对象", description="")
+public class PermissionSetting implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "权限管理表")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "管理员id")
+    private Integer adminId;
+
+    @ApiModelProperty(value = "房态管理 0.全部 1.预定,2退房,3.维修,4.关房,5.置脏,6.置净,7.退款,8.入住,9.锁房,10.日志,11.换房,12.开房,13.门锁管理")
+    private String houseStatusManagement;
+
+    @ApiModelProperty(value = "房型管理 0.全部 1.添加,2.修改,3.删除,4.批量改价,5.改价记录")
+    private String houseTypeManagement;
+
+    @ApiModelProperty(value = "订单管理 0.全部 1.取消,2.详情,3.入住,4.退款,5.退房,6.查询,7.删除,8.换房,9.导出")
+    private String houseOrderManagement;
+
+    @ApiModelProperty(value = "值班管理 0.全部 1.导入值班,2.导出")
+    private String dutyManagement;
+
+    @ApiModelProperty(value = "流程管理 0.全部 1.添加流程,2.修改流程,3.同意,4.驳回,5.查询,6.规则设置,7.导出")
+    private String processManagement;
+
+    @ApiModelProperty(value = "报表管理 0.全部 1.查询,2.导出")
+    private String reportManagement;
+
+    @ApiModelProperty(value = "门锁管理 0.全部 1.添加,2.编辑,3.删除,4.查询,5.导出,6.导入,7.批量重置密码,8.重置密码,9.添加总卡,10.禁用门锁,11.钥匙管理,12.消息列表,13.远程开锁,14.解绑设备")
+    private String doorLockManagement;
+
+    @ApiModelProperty(value = "水电管理 0.全部 1.添加,2.编辑,3.删除,4.查询,5.导出,6.导入")
+    private String hydropowerManagement;
+
+    @ApiModelProperty(value = "用户管理 0.全部 1.添加,2.编辑,3.删除,4.查询,5.导出,6.导入")
+    private String userManagement;
+
+    @ApiModelProperty(value = "角色管理 0.全部 1.添加,2.编辑,3.删除,4.查询,5.导出,6.导入")
+    private String roleManagement;
+
+    @ApiModelProperty(value = "账号管理 0.全部 1.添加,2.编辑,3.删除,4.查询,5.导出,6.导入")
+    private String accountManagement;
+
+    @ApiModelProperty(value = "系统管理 0.全部 1.退房设置,2.公寓设置,3.补助设置,4.催缴设置")
+    private String systemManagement;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新时间")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Date updateTime;
+
+    @ApiModelProperty(value = "创建人员")
+    @TableField(fill = FieldFill.INSERT)
+    private String createUser;
+
+    @ApiModelProperty(value = "更新人员")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String updateUser;
+
+    @ApiModelProperty(value = "逻辑删除 未删除:0;删除:1")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic(value = "0", delval = "1")
+    private Integer deleted;
+
+
+}

+ 81 - 0
src/main/java/com/template/model/pojo/RepairAdmin.java

@@ -0,0 +1,81 @@
+package com.template.model.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-07-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="RepairAdmin对象", description="")
+public class RepairAdmin implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "主键")
+    @TableId(value = "id", type = IdType.UUID)
+    private String id;
+
+    @ApiModelProperty(value = "账号")
+    @NotBlank(message = "账号不能为空")
+    private String account;
+
+    @ApiModelProperty(value = "密码")
+    @NotBlank(message = "密码不能为空")
+    private String password;
+
+    @ApiModelProperty(value = "昵称")
+    @NotBlank(message = "昵称不能为空")
+    private String username;
+
+    @ApiModelProperty(value = "手机号")
+    @NotBlank(message = "手机号不能为空")
+    private String phone;
+
+    @ApiModelProperty(value = "是否是超级管理员 正常:0;超级管理员:1")
+    private Integer isSuper;
+
+    @ApiModelProperty(value = "状态 正常:0;冻结:1")
+    private Integer statu;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新时间")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Date updateTime;
+
+    @ApiModelProperty(value = "创建人员")
+    @TableField(fill = FieldFill.INSERT)
+    private String createUser;
+
+    @ApiModelProperty(value = "更新人员")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String updateUser;
+
+    @ApiModelProperty(value = "逻辑删除 未删除:0;删除:1")
+    @TableLogic
+    @TableField(fill = FieldFill.INSERT)
+    private Integer deleted;
+
+}

+ 29 - 0
src/main/java/com/template/model/request/changePasswordRequest.java

@@ -0,0 +1,29 @@
+package com.repair.model.request;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * 修改密码
+ */
+@Data
+public class changePasswordRequest {
+    /**
+     * 原密码
+     */
+    @NotBlank(message = "原密码不能为空")
+    private String oldPassword;
+
+    /**
+     * 新密码
+     */
+    @NotBlank(message = "新密码不能为空")
+    private String newPassword;
+
+    /**
+     * 确认密码
+     */
+    @NotBlank(message = "确认密码不能为空")
+    private String confirmPassword;
+}

+ 29 - 0
src/main/java/com/template/model/request/freezeRepairAdminRequest.java

@@ -0,0 +1,29 @@
+package com.repair.model.request;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/7/7 星期五 10:17
+ * @Description: com.repair.model.request
+ * @Version: 1.0
+ */
+@Data
+public class freezeRepairAdminRequest {
+    /**
+     * 数据ID
+     */
+    @NotBlank(message = "数据ID不能为空")
+    private String id;
+
+    /**
+     * 状态
+     * 正常:0;冻结:1
+     */
+    @NotNull(message = "状态不能为空")
+    private Integer statu;
+}

+ 23 - 0
src/main/java/com/template/model/request/loginRequest.java

@@ -0,0 +1,23 @@
+package com.template.model.request;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * 登录请求参数
+ */
+@Data
+public class loginRequest {
+    /**
+     * 账号
+     */
+    @NotBlank(message = "账号不能为空")
+    private String account;
+
+    /**
+     * 密码
+     */
+    @NotBlank(message = "密码不能为空")
+    private String password;
+}

+ 40 - 0
src/main/java/com/template/model/request/queryAccountPageRequest.java

@@ -0,0 +1,40 @@
+package com.repair.model.request;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/7/6 星期四 17:17
+ * @Description: com.repair.model.request
+ * @Version: 1.0
+ */
+@Data
+public class queryAccountPageRequest {
+
+    /**
+     * 当前页数
+     */
+    private int currentPage = 0;
+
+    /**
+     * 一页数据总条数
+     */
+    private int pageCount = 10;
+
+    /**
+     * 账号
+     */
+    private String account;
+
+    /**
+     * 手机号
+     */
+    private String phone;
+
+    /**
+     * 账号名称
+     */
+    private String userName;
+}

+ 34 - 0
src/main/java/com/template/model/request/updateRepairAdminRequest.java

@@ -0,0 +1,34 @@
+package com.repair.model.request;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/7/7 星期五 14:27
+ * @Description: com.repair.model.request
+ * @Version: 1.0
+ */
+@Data
+public class updateRepairAdminRequest {
+    /**
+     * 数据ID
+     */
+    @NotBlank(message = "数据ID不能为空")
+    private String id;
+    /**
+     * 账号名称
+     */
+    private String username;
+
+    /**
+     * 手机号
+     */
+    private String phone;
+
+    /**
+     * 密码
+     */
+    private String password;
+}

+ 35 - 0
src/main/java/com/template/model/result/BaseResult.java

@@ -0,0 +1,35 @@
+package com.template.model.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Author: codingliang
+ * @Description: 接口统一返回基类
+ * @Date: 2021-04-29 12:09
+ * @Version: V1.0
+ **/
+@Data
+public abstract class BaseResult<T> implements Serializable {
+
+    /**
+     * 接口调用结果标识
+     */
+    private boolean success = false;
+
+    /**
+     * 接口调用结果信息
+     */
+    private String message;
+
+    /**
+     * 接口调用业务码
+     */
+    private String code;
+
+    /**
+     * 接口调用返回数据
+     */
+    private T data;
+}

+ 158 - 0
src/main/java/com/template/model/result/CommonResult.java

@@ -0,0 +1,158 @@
+package com.template.model.result;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.template.common.result.Code;
+import com.template.common.result.ResponseStatusEnum;
+
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * @Author: codingliang
+ * @Description: 接口统一返回
+ * @Date: 2021-04-29 12:10
+ * @Version: V1.0
+ **/
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class CommonResult<T> extends BaseResult implements Serializable {
+
+
+    private Integer status;
+    // 调用是否成功
+    private Boolean success;
+    // 响应消息,可以为成功或者失败的消息
+    private String msg;
+
+    private T data;
+
+    private static final long serialVersionUID = 3616484754899974346L;
+
+
+    public static CommonResult ok() {
+        return ok(Integer.toString(ResponseStatusEnum.SUCCESS.getStatus()), ResponseStatusEnum.SUCCESS.getMsg());
+    }
+
+    public static <T> CommonResult<T> ok(T data) {
+        CommonResult<T> result = new CommonResult<T>(data);
+        return result;
+    }
+
+    public static <T> CommonResult<T> ok(String msg) {
+        return baseCreate(Integer.toString(ResponseStatusEnum.SUCCESS.getStatus()), msg, true);
+    }
+
+    public static <T> CommonResult<T> ok(String code, String msg) {
+        return baseCreate(code, msg, true);
+    }
+
+    public static <T> CommonResult<T> ok(String msg, T data) {
+        return baseCreate(Integer.toString(ResponseStatusEnum.SUCCESS.getStatus()), msg, true, data);
+    }
+
+    public static <T> CommonResult<T> ok(String code, String msg, T data) {
+        return baseCreate(code, msg, true, data);
+    }
+
+    public static CommonResult fail() {
+        return fail(Integer.toString(ResponseStatusEnum.FAILED.getStatus()), ResponseStatusEnum.FAILED.getMsg());
+    }
+
+    public static CommonResult fail(String code, String msg) {
+        return baseCreate(code, msg, false);
+    }
+
+    public static CommonResult fail(String msg) {
+        return baseCreate(Integer.toString(ResponseStatusEnum.FAILED.getStatus()), msg, false);
+    }
+
+    public static CommonResult fail(ResponseStatusEnum EnumCode){
+        return baseCreate(Integer.toString(EnumCode.getStatus()), EnumCode.getMsg(), false);
+    }
+
+    public CommonResult() {}
+
+    /**
+     * 用Code自定义返回信息
+     * 并把数据返回
+     */
+    public CommonResult(Code code, T data) {
+        this.status = code.getStatus();
+        this.msg = code.getMsg();
+        this.success = code.getSuccess();
+        this.data = data;
+    }
+
+    /**
+     * 成功的返回信息
+     */
+    public CommonResult(T data) {
+        this.setCode(Integer.toString(ResponseStatusEnum.SUCCESS.status()));
+        this.setMessage(ResponseStatusEnum.SUCCESS.msg());
+        this.setSuccess(ResponseStatusEnum.SUCCESS.success());
+        this.setData(data);
+    }
+
+    /**
+     * 自定义错误返回信息
+     * @param EnumCode 枚举错误信息
+     * @return
+     */
+    public CommonResult(ResponseStatusEnum EnumCode) {
+        this.setCode(Integer.toString(EnumCode.status()));
+        this.setMessage(EnumCode.msg());
+        this.setSuccess(EnumCode.success());
+    }
+
+
+    private static <T> CommonResult<T> baseCreate(String code, String msg, boolean success) {
+        CommonResult result = new CommonResult();
+        result.setCode(code);
+        result.setSuccess(success);
+        result.setMessage(msg);
+        return result;
+    }
+
+    private static <T> CommonResult<T> baseCreate(String code, String msg, boolean success, T data) {
+        CommonResult result = new CommonResult();
+        result.setCode(code);
+        result.setSuccess(success);
+        result.setMessage(msg);
+        result.setData(data);
+        return result;
+    }
+
+    public static CommonResult resultValue(ResponseStatusEnum responseStatus) {
+        return new CommonResult(responseStatus);
+    }
+
+    /**
+     * 错误返回,map中包含了多条错误信息,可以用于表单验证,把错误统一的全部返回出去
+     *
+     * @param map
+     * @return
+     */
+    public static CommonResult errorMap(Map map) {
+        return new CommonResult(ResponseStatusEnum.FAILED, map);
+    }
+
+    /**
+     * 错误返回,直接返回错误的消息
+     *
+     * @param msg 提示信息
+     * @return
+     */
+    public static CommonResult errorMsg(String msg) {
+        return new CommonResult(ResponseStatusEnum.FAILED, msg);
+    }
+
+    public CommonResult<T> setResult(T data) {
+        this.setData(data);
+        return this;
+    }
+
+    @Override
+    public T getData() {
+        return (T) super.getData();
+    }
+}

+ 0 - 0
src/main/java/com/template/model/result/PageUtils.java


Vissa filer visades inte eftersom för många filer har ändrats