夏文涛 2 лет назад
Родитель
Сommit
41df32a46d
32 измененных файлов с 2018 добавлено и 178 удалено
  1. 34 0
      .gitignore
  2. 1 1
      .idea/compiler.xml
  3. 1 0
      .idea/encodings.xml
  4. 690 4
      .idea/workspace.xml
  5. 4 0
      pom.xml
  6. 2 0
      src/main/java/com/template/MybatisPlusApplication.java
  7. 7 3
      src/main/java/com/template/api/SmartDataSourceControllerAPI.java
  8. 15 11
      src/main/java/com/template/api/SmartDataSourceLogControllerAPI.java
  9. 59 0
      src/main/java/com/template/api/SmartDataTaskControllerAPI.java
  10. 25 0
      src/main/java/com/template/api/Task.java
  11. 20 6
      src/main/java/com/template/common/utils/CommonUtil.java
  12. 176 0
      src/main/java/com/template/common/utils/QuartzJobUtils.java
  13. 28 8
      src/main/java/com/template/controller/SmartDataClassController.java
  14. 30 14
      src/main/java/com/template/controller/SmartDataSourceController.java
  15. 67 38
      src/main/java/com/template/controller/SmartDataSourceLogController.java
  16. 164 0
      src/main/java/com/template/controller/SmartDataTaskController.java
  17. 37 0
      src/main/java/com/template/mapper/SmartDataTaskMapper.java
  18. 7 0
      src/main/java/com/template/model/pojo/SmartDataClass.java
  19. 11 4
      src/main/java/com/template/model/pojo/SmartDataSource.java
  20. 9 7
      src/main/java/com/template/model/pojo/SmartDataSourceLog.java
  21. 61 0
      src/main/java/com/template/model/pojo/SmartDataTask.java
  22. 6 3
      src/main/java/com/template/services/SmartDataSourceLogService.java
  23. 7 3
      src/main/java/com/template/services/SmartDataSourceService.java
  24. 40 0
      src/main/java/com/template/services/SmartDataTaskService.java
  25. 1 0
      src/main/java/com/template/services/impl/SmartDataClassServiceImpl.java
  26. 27 15
      src/main/java/com/template/services/impl/SmartDataSourceLogServiceImpl.java
  27. 168 12
      src/main/java/com/template/services/impl/SmartDataSourceServiceImpl.java
  28. 321 0
      src/main/java/com/template/services/impl/SmartDataTaskServiceImpl.java
  29. 0 42
      target/classes/META-INF/spring-configuration-metadata.json
  30. 0 3
      target/maven-archiver/pom.properties
  31. 0 2
      target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
  32. 0 2
      target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst

+ 34 - 0
.gitignore

@@ -21,3 +21,37 @@
 
 # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
 hs_err_pid*
+
+
+### Spring Boot
+
+target/
+!target/classes/
+!target/dependency-reduced-pom.xml
+!target/maven-archiver/pom.properties
+!target/maven-archiver/pom.xml
+!**/.mvn/wrapper/maven-wrapper.jar
+!**/.mvn/wrapper/maven-wrapper.properties
+
+### IntelliJ IDEA
+
+.idea/
+*.iml
+*.ipr
+*.iws
+*.xml
+
+### Eclipse
+
+.project
+.classpath
+.settings/
+
+### Windows
+
+Thumbs.db
+*.DS_Store
+
+### macOS
+
+.DS_Store

+ 1 - 1
.idea/compiler.xml

@@ -8,8 +8,8 @@
         <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
         <outputRelativeToContentRoot value="true" />
         <module name="mybatis_plus" />
-        <module name="template_code" />
         <module name="Back-endDevelopmentFramework" />
+        <module name="template_code" />
       </profile>
     </annotationProcessing>
   </component>

+ 1 - 0
.idea/encodings.xml

@@ -2,6 +2,7 @@
 <project version="4">
   <component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
     <file url="file://$PROJECT_DIR$" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
     <file url="PROJECT" charset="UTF-8" />
   </component>
 </project>

+ 690 - 4
.idea/workspace.xml

@@ -4,6 +4,7 @@
     <option name="autoReloadType" value="SELECTIVE" />
   </component>
   <component name="ChangeListManager">
+<<<<<<< HEAD
     <list default="true" id="33456f28-da03-4d10-99dd-fd9bd193cf84" name="Default Changelist" comment="">
       <change afterPath="$PROJECT_DIR$/src/main/java/com/template/common/utils/TimeExchange.java" afterDir="false" />
       <change afterPath="$PROJECT_DIR$/src/main/java/com/template/model/enumModel/eFreezeRecord.java" afterDir="false" />
@@ -54,6 +55,20 @@
       <change beforePath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst" beforeDir="false" afterPath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/target/mybatis_plus-0.0.1-SNAPSHOT.jar.original" beforeDir="false" afterPath="$PROJECT_DIR$/target/mybatis_plus-0.0.1-SNAPSHOT.jar.original" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/框架代码说明文档/~$生成代码说明.docx" beforeDir="false" />
+=======
+    <list default="true" id="33456f28-da03-4d10-99dd-fd9bd193cf84" name="Default Changelist" comment="日志接口基本完成">
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/api/SmartDataSourceControllerAPI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/api/SmartDataSourceControllerAPI.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartDataClassController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartDataClassController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartDataSourceController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartDataSourceController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartDataSourceLogController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartDataSourceLogController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartDataClass.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartDataClass.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/services/SmartDataSourceService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/services/SmartDataSourceService.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartDataSourceServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartDataSourceServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/resources/application-dev.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application-dev.yml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/resources/application-prod.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application-prod.yml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/resources/application.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/application.yml" afterDir="false" />
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
     </list>
     <ignored path="$PROJECT_DIR$/target/" />
     <ignored path="$PROJECT_DIR$/out/" />
@@ -68,16 +83,61 @@
   </component>
   <component name="FileEditorManager">
     <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
+<<<<<<< HEAD
       <file pinned="false" current-in-tab="true">
         <entry file="file://$PROJECT_DIR$/src/main/resources/mapper/template/SystemUserMapper.xml">
           <provider selected="true" editor-type-id="text-editor">
             <state relative-caret-position="253">
               <caret line="11" selection-start-line="11" selection-end-line="16" selection-end-column="26" />
+=======
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartDataSourceLogServiceImpl.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="978">
+              <caret line="57" column="54" selection-start-line="57" selection-start-column="54" selection-end-line="57" selection-end-column="54" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartDataSourceController.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="138">
+              <caret line="69" column="7" selection-start-line="69" selection-start-column="7" selection-end-line="69" selection-end-column="7" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/api/SmartDataSourceControllerAPI.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="150">
+              <caret line="14" column="30" lean-forward="true" selection-start-line="14" selection-start-column="30" selection-end-line="14" selection-end-column="30" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/api/SmartDataClassControllerAPI.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="207">
+              <caret line="15" column="3" lean-forward="true" selection-start-line="15" selection-start-column="3" selection-end-line="15" selection-end-column="3" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/api/SmartDataSourceLogControllerAPI.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="161">
+              <caret line="13" column="30" lean-forward="true" selection-start-line="13" selection-start-column="30" selection-end-line="13" selection-end-column="30" />
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
+<<<<<<< HEAD
         <entry file="file://$PROJECT_DIR$/src/main/resources/mapper/template/SmartFreezeRecordMapper.xml">
           <provider selected="true" editor-type-id="text-editor">
             <state relative-caret-position="253">
@@ -148,15 +208,55 @@
               <folding>
                 <element signature="imports" expanded="true" />
               </folding>
+=======
+        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartDataSourceServiceImpl.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="1058">
+              <caret line="57" column="48" selection-start-line="57" selection-start-column="48" selection-end-line="57" selection-end-column="48" />
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
+<<<<<<< HEAD
         <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartFreezeRecordServiceImpl.java">
           <provider selected="true" editor-type-id="text-editor">
             <state relative-caret-position="1564">
               <caret line="85" column="71" selection-start-line="85" selection-start-column="46" selection-end-line="85" selection-end-column="71" />
+=======
+        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/SmartBuildService.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="299">
+              <caret line="16" column="4" selection-start-line="16" selection-start-column="4" selection-end-line="24" selection-end-column="36" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/SmartDataSourceLogService.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="483">
+              <caret line="24" column="22" selection-start-line="24" selection-start-column="22" selection-end-line="24" selection-end-column="22" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/SmartDataSourceService.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="161">
+              <caret line="10" column="7" selection-start-line="10" selection-start-column="7" selection-end-line="10" selection-end-column="7" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartBuildServiceImpl.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="687">
+              <caret line="60" column="5" selection-start-line="26" selection-start-column="4" selection-end-line="60" selection-end-column="5" />
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
             </state>
           </provider>
         </entry>
@@ -172,6 +272,21 @@
   </component>
   <component name="FindInProjectRecents">
     <findStrings>
+<<<<<<< HEAD
+=======
+      <find>冻结记录</find>
+      <find>学校基本信息</find>
+      <find>水电表能耗明细</find>
+      <find>截屏记录</find>
+      <find>用户</find>
+      <find>访客预约</find>
+      <find>Apply</find>
+      <find>AuthorGroup</find>
+      <find>Authority</find>
+      <find>BuildMeter</find>
+      <find>Department</find>
+      <find>return 0;</find>
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
       <find>FreezeRecord</find>
       <find>Identity</find>
       <find>MeterDetail</find>
@@ -188,9 +303,9 @@
       <find>queryIdentityByName</find>
       <find>预警信息</find>
       <find>数据源</find>
-      <find>@NotBlank</find>
       <find>Build</find>
       <find>楼栋</find>
+<<<<<<< HEAD
       <find>@NotNull</find>
       <find>getSmartByTimes</find>
       <find>queryScreenshotRecordPage</find>
@@ -202,6 +317,8 @@
       <find>queryFreezeRecordPageList</find>
       <find>queryPageFreezeRecord</find>
       <find>queryAffiliateUserById</find>
+=======
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
     </findStrings>
     <replaceStrings>
       <replace>身份</replace>
@@ -242,6 +359,7 @@
   <component name="IdeDocumentHistory">
     <option name="CHANGED_PATHS">
       <list>
+<<<<<<< HEAD
         <option value="$PROJECT_DIR$/src/main/java/com/template/services/SmartSchoolService.java" />
         <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartSchoolServiceImpl.java" />
         <option value="$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartSchool.java" />
@@ -293,6 +411,59 @@
         <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartUserServiceImpl.java" />
         <option value="$PROJECT_DIR$/src/main/java/com/template/controller/SmartUserController.java" />
         <option value="$PROJECT_DIR$/src/main/resources/mapper/template/SystemUserMapper.xml" />
+=======
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartMeterServiceImpl.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartSchoolServiceImpl.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartScreenshotRecordServiceImpl.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartScreenshotServiceImpl.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartUserServiceImpl.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartVisitorServiceImpl.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartWarningServiceImpl.java" />
+        <option value="$PROJECT_DIR$/src/main/resources/mapper/template/SmartApplyMapper.xml" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartApply.java" />
+        <option value="$PROJECT_DIR$/src/main/resources/application.yml" />
+        <option value="$PROJECT_DIR$/src/main/resources/application-dev.yml" />
+        <option value="$PROJECT_DIR$/src/main/resources/application-prod.yml" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/core/JwtAuthenticationInterceptor.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/config/MyBatisPlusConfig.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/model/request/changePasswordRequest.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/model/request/freezeRepairAdminRequest.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/model/request/queryAccountPageRequest.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/model/request/updateRepairAdminRequest.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/model/request/insertIdentityRequest.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/RepairAdminServiceImpl.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/api/RepairAdminControllerAPI.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/api/LoginControllerAPI.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/controller/LoginController.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/controller/RepairAdminController.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/RepairAdminService.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/model/request/updateIdentityRequest.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/api/SmartIdentityControllerAPI.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/model/vo/SmartIdentityVo.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartIdentityServiceImpl.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/SmartIdentityService.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/controller/SmartIdentityController.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/SmartApplyService.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartApplyServiceImpl.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/controller/SmartApplyController.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartIdentity.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/AutoCode.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/mapper/SmartDataSourceLogMapper.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/mapper/SmartDataClassMapper.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/mapper/SmartDataSourceMapper.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/controller/SmartDataClassController.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartDataClassServiceImpl.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/SmartDataClassService.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/api/SmartDataClassControllerAPI.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/api/SmartDataSourceLogControllerAPI.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/controller/SmartDataSourceController.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/controller/SmartDataSourceLogController.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/SmartDataSourceLogService.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/SmartDataSourceService.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartDataSourceServiceImpl.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartDataSourceLogServiceImpl.java" />
+        <option value="$PROJECT_DIR$/src/main/java/com/template/api/SmartDataSourceControllerAPI.java" />
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
       </list>
     </option>
   </component>
@@ -303,8 +474,8 @@
     <option name="generalSettings">
       <MavenGeneralSettings>
         <option name="localRepository" value="D:\Software\Develop\Maven\repository" />
-        <option name="mavenHome" value="$PROJECT_DIR$/../../Software/Develop/Maven/apache-maven-3.3.9" />
-        <option name="userSettingsFile" value="D:\Software\Develop\Maven\apache-maven-3.3.9\conf\settings.xml" />
+        <option name="mavenHome" value="$PROJECT_DIR$/../../Software/Develop/Maven/apache-maven-3.8.8" />
+        <option name="userSettingsFile" value="D:\Software\Develop\Maven\apache-maven-3.8.8\conf\settings.xml" />
       </MavenGeneralSettings>
     </option>
   </component>
@@ -327,7 +498,11 @@
   <component name="MavenRunner">
     <option name="skipTests" value="true" />
   </component>
+<<<<<<< HEAD
   <component name="ProjectFrameBounds">
+=======
+  <component name="ProjectFrameBounds" extendedState="6">
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
     <option name="x" value="-7" />
     <option name="width" value="974" />
     <option name="height" value="1039" />
@@ -461,7 +636,7 @@
               <item name="java" type="462c0819:PsiDirectoryNode" />
               <item name="template" type="462c0819:PsiDirectoryNode" />
               <item name="model" type="462c0819:PsiDirectoryNode" />
-              <item name="enumModel" type="462c0819:PsiDirectoryNode" />
+              <item name="pojo" type="462c0819:PsiDirectoryNode" />
             </path>
             <path>
               <item name="mybatis_plus" type="b2602c69:ProjectViewProjectNode" />
@@ -555,6 +730,7 @@
     <option name="hideEmptyMiddlePackages" value="true" />
     <option name="showLibraryContents" value="true" />
   </component>
+<<<<<<< HEAD
   <component name="PropertiesComponent">
     <property name="RequestMappingsPanelOrder0" value="0" />
     <property name="RequestMappingsPanelOrder1" value="1" />
@@ -564,14 +740,40 @@
     <property name="aspect.path.notification.shown" value="true" />
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
   </component>
+=======
+  <component name="PropertiesComponent">{
+  &quot;keyToString&quot;: {
+    &quot;RequestMappingsPanelOrder0&quot;: &quot;0&quot;,
+    &quot;RequestMappingsPanelOrder1&quot;: &quot;1&quot;,
+    &quot;RequestMappingsPanelWidth0&quot;: &quot;75&quot;,
+    &quot;RequestMappingsPanelWidth1&quot;: &quot;75&quot;,
+    &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
+    &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
+    &quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
+    &quot;git-widget-placeholder&quot;: &quot;master&quot;,
+    &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
+    &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
+    &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
+    &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
+    &quot;settings.editor.selected.configurable&quot;: &quot;MavenSettings&quot;,
+    &quot;spring.configuration.checksum&quot;: &quot;64bf9ba214eb006c40cb35e0f61a7d20&quot;,
+    &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
+  }
+}</component>
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
   <component name="RebelAgentSelection">
     <selection>jr</selection>
   </component>
   <component name="RecentsManager">
+    <key name="MoveFile.RECENT_KEYS">
+      <recent name="D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\resources\mapper\template" />
+      <recent name="D:\Bingo\Desktop\工作内容\报修系统\Back-endDevelopmentFramework\src\main\resources\mapper\video" />
+    </key>
     <key name="MoveClassesOrPackagesDialog.RECENTS_KEY">
       <recent name="com.template" />
     </key>
     <key name="CopyClassDialog.RECENTS_KEY">
+<<<<<<< HEAD
       <recent name="com.template.model.enumModel" />
       <recent name="com.template.model.request" />
       <recent name="com.template.model.vo" />
@@ -581,6 +783,13 @@
     <key name="MoveFile.RECENT_KEYS">
       <recent name="D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\resources\mapper\template" />
       <recent name="D:\Bingo\Desktop\工作内容\报修系统\Back-endDevelopmentFramework\src\main\resources\mapper\video" />
+=======
+      <recent name="com.template.mapper" />
+      <recent name="com.template.services.impl" />
+      <recent name="com.template.services" />
+      <recent name="com.template.model.pojo" />
+      <recent name="com.template.controller" />
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
     </key>
   </component>
   <component name="RunDashboard">
@@ -643,17 +852,77 @@
       <workItem from="1688612583930" duration="14000" />
       <workItem from="1688623572162" duration="6039000" />
       <workItem from="1701393315043" duration="136000" />
+<<<<<<< HEAD
       <workItem from="1701669886732" duration="49622000" />
+=======
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
       <workItem from="1701669886732" duration="27098000" />
       <workItem from="1701764903042" duration="5734000" />
       <workItem from="1701865008670" duration="65000" />
       <workItem from="1701869528061" duration="202000" />
+<<<<<<< HEAD
       <workItem from="1702523746981" duration="202000" />
+=======
+      <workItem from="1702001001960" duration="9678000" />
+      <workItem from="1702021190308" duration="1252000" />
+      <workItem from="1702022482922" duration="262000" />
+      <workItem from="1702022763352" duration="675000" />
+      <workItem from="1702025530468" duration="1600000" />
+      <workItem from="1702027894702" duration="309000" />
+      <workItem from="1702029297620" duration="202000" />
+      <workItem from="1702029596859" duration="116000" />
+      <workItem from="1702029914028" duration="156000" />
+      <workItem from="1702030090469" duration="6723000" />
+      <workItem from="1702041902347" duration="730000" />
+      <workItem from="1702101136568" duration="17031000" />
+      <workItem from="1702198575272" duration="25051000" />
+      <workItem from="1702254015850" duration="11814000" />
+      <workItem from="1702279037484" duration="433000" />
+      <workItem from="1702302748830" duration="227000" />
+      <workItem from="1702457243216" duration="4411000" />
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
     </task>
+    <task id="LOCAL-00001" summary="Default Changelist">
+      <option name="closed" value="true" />
+      <created>1702042267163</created>
+      <option name="number" value="00001" />
+      <option name="presentableId" value="LOCAL-00001" />
+      <option name="project" value="LOCAL" />
+      <updated>1702042267163</updated>
+    </task>
+    <task id="LOCAL-00002" summary="Default Changelist">
+      <option name="closed" value="true" />
+      <created>1702122558393</created>
+      <option name="number" value="00002" />
+      <option name="presentableId" value="LOCAL-00002" />
+      <option name="project" value="LOCAL" />
+      <updated>1702122558393</updated>
+    </task>
+    <task id="LOCAL-00003" summary="任务通过接口操作">
+      <option name="closed" value="true" />
+      <created>1702224101946</created>
+      <option name="number" value="00003" />
+      <option name="presentableId" value="LOCAL-00003" />
+      <option name="project" value="LOCAL" />
+      <updated>1702224101946</updated>
+    </task>
+    <task id="LOCAL-00004" summary="日志接口基本完成">
+      <option name="closed" value="true" />
+      <created>1702266412248</created>
+      <option name="number" value="00004" />
+      <option name="presentableId" value="LOCAL-00004" />
+      <option name="project" value="LOCAL" />
+      <updated>1702266412248</updated>
+    </task>
+    <option name="localTasksCounter" value="5" />
     <servers />
   </component>
   <component name="TimeTrackingManager">
+<<<<<<< HEAD
     <option name="totallyTimeSpent" value="125521000" />
+=======
+    <option name="totallyTimeSpent" value="63568000" />
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
   </component>
   <component name="TodoView">
     <todo-panel id="selected-file">
@@ -668,7 +937,11 @@
     <frame x="-8" y="-8" width="1936" height="1048" extended-state="6" />
     <editor active="true" />
     <layout>
+<<<<<<< HEAD
       <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.1380597" />
+=======
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.33102345" />
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
       <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
       <window_info id="Designer" order="2" />
       <window_info id="JRebel" order="3" side_tool="true" />
@@ -679,8 +952,13 @@
       <window_info id="Web" order="8" side_tool="true" />
       <window_info anchor="bottom" id="Message" order="0" />
       <window_info anchor="bottom" id="Find" order="1" weight="0.32932165" />
+<<<<<<< HEAD
       <window_info anchor="bottom" id="Run" order="2" weight="0.47513813" />
       <window_info anchor="bottom" id="Debug" order="3" weight="0.39889503" />
+=======
+      <window_info anchor="bottom" id="Run" order="2" weight="0.48687088" />
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.34901533" />
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
       <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
       <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
       <window_info anchor="bottom" id="TODO" order="6" weight="0.32932165" />
@@ -749,6 +1027,23 @@
   <component name="TypeScriptGeneratedFilesManager">
     <option name="version" value="1" />
   </component>
+  <component name="Vcs.Log.Tabs.Properties">
+    <option name="TAB_STATES">
+      <map>
+        <entry key="MAIN">
+          <value>
+            <State />
+          </value>
+        </entry>
+      </map>
+    </option>
+  </component>
+  <component name="VcsManagerConfiguration">
+    <MESSAGE value="Default Changelist" />
+    <MESSAGE value="任务通过接口操作" />
+    <MESSAGE value="日志接口基本完成" />
+    <option name="LAST_COMMIT_MESSAGE" value="日志接口基本完成" />
+  </component>
   <component name="XDebuggerManager">
     <breakpoint-manager>
       <breakpoints>
@@ -765,6 +1060,7 @@
           <option name="timeStamp" value="21" />
         </line-breakpoint>
         <line-breakpoint enabled="true" type="java-line">
+<<<<<<< HEAD
           <url>file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartUserServiceImpl.java</url>
           <line>67</line>
           <properties />
@@ -772,12 +1068,31 @@
         </line-breakpoint>
       </breakpoints>
     </breakpoint-manager>
+=======
+          <url>file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartDataClassController.java</url>
+          <line>64</line>
+          <option name="timeStamp" value="22" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartDataSourceServiceImpl.java</url>
+          <line>201</line>
+          <option name="timeStamp" value="24" />
+        </line-breakpoint>
+      </breakpoints>
+    </breakpoint-manager>
+    <pin-to-top-manager>
+      <pinned-members>
+        <PinnedItemInfo parentTag="com.baomidou.mybatisplus.core.conditions.query.QueryWrapper" memberName="paramNameValuePairs" />
+      </pinned-members>
+    </pin-to-top-manager>
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
   </component>
   <component name="antWorkspaceConfiguration">
     <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
     <option name="FILTER_TARGETS" value="false" />
   </component>
   <component name="editorHistoryManager">
+<<<<<<< HEAD
     <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/enumModel/ePunish.java">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="1414">
@@ -1133,6 +1448,377 @@
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="253">
           <caret line="11" selection-start-line="11" selection-end-line="16" selection-end-column="26" />
+=======
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/api/LoginControllerAPI.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="359">
+          <caret line="33" column="56" selection-start-line="33" selection-start-column="56" selection-end-line="33" selection-end-column="56" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/LoginController.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-317">
+          <caret line="130" column="39" selection-start-line="130" selection-start-column="39" selection-end-line="130" selection-end-column="39" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/RepairAdminController.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="124">
+          <caret line="132" column="26" selection-start-line="132" selection-start-column="26" selection-end-line="132" selection-end-column="26" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/RepairAdminServiceImpl.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="1224">
+          <caret line="65" column="48" selection-start-line="65" selection-start-column="48" selection-end-line="65" selection-end-column="48" />
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/RepairAdminService.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="92">
+          <caret line="4" column="59" selection-start-line="4" selection-start-column="59" selection-end-line="4" selection-end-column="59" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/vo/LoginVO.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-19">
+          <caret line="12" column="13" selection-start-line="12" selection-start-column="13" selection-end-line="12" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/core/JwtAuthenticationInterceptor.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="23">
+          <caret line="35" selection-start-line="35" selection-end-line="35" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/handler/MyMetaObjectHandler.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="134">
+          <caret line="21" column="51" lean-forward="true" selection-start-line="21" selection-start-column="51" selection-end-line="21" selection-end-column="51" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/vo/SystemMenuTreeVo.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="198">
+          <caret line="22" column="13" selection-start-line="22" selection-start-column="13" selection-end-line="22" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/handle/NonStaticResourceHttpRequestHandler.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="253">
+          <caret line="17" column="13" selection-start-line="17" selection-start-column="13" selection-end-line="17" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/core/JwtlnterceptorConfig.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="115">
+          <caret line="9" column="13" selection-start-line="9" selection-start-column="13" selection-end-line="9" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/vo/SmartIdentityVo.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="207">
+          <caret line="27" column="4" selection-start-line="27" selection-start-column="4" selection-end-line="31" selection-end-column="35" />
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/request/insertIdentityRequest.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="197">
+          <caret line="20" column="23" selection-start-line="20" selection-start-column="19" selection-end-line="20" selection-end-column="23" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartApply.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="188">
+          <caret line="30" column="13" selection-start-line="30" selection-start-column="13" selection-end-line="30" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartApplyServiceImpl.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="243">
+          <caret line="49" column="38" selection-start-line="49" selection-start-column="22" selection-end-line="49" selection-end-column="38" />
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SendController.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="161">
+          <caret line="12" column="13" selection-start-line="12" selection-start-column="13" selection-end-line="12" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/SmartApplyService.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="220">
+          <caret line="25" column="14" selection-start-line="25" selection-start-column="4" selection-end-line="25" selection-end-column="14" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartApplyController.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="276">
+          <caret line="59" column="9" selection-start-line="59" selection-start-column="9" selection-end-line="59" selection-end-column="9" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="jar://$MAVEN_REPOSITORY$/org/springframework/spring-web/5.3.22/spring-web-5.3.22-sources.jar!/org/springframework/web/method/support/InvocableHandlerMethod.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="188">
+          <caret line="213" selection-start-line="213" selection-end-line="213" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartIdentityServiceImpl.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="186">
+          <caret line="43" selection-start-line="43" selection-end-line="43" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartIdentityController.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="243">
+          <caret line="44" column="54" selection-start-line="44" selection-start-column="54" selection-end-line="44" selection-end-column="54" />
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/SmartIdentityService.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="220">
+          <caret line="20" column="51" lean-forward="true" selection-start-line="20" selection-start-column="4" selection-end-line="20" selection-end-column="51" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartIdentity.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="280">
+          <caret line="53" column="30" selection-start-line="53" selection-start-column="30" selection-end-line="53" selection-end-column="30" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/request/updateIdentityRequest.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="47">
+          <caret line="17" column="13" selection-start-line="17" selection-start-column="13" selection-end-line="17" selection-end-column="13" />
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/api/SmartIdentityControllerAPI.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="347">
+          <caret line="33" column="49" selection-start-line="33" selection-start-column="26" selection-end-line="33" selection-end-column="49" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/AutoCode.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="415">
+          <caret line="53" column="34" selection-start-line="53" selection-start-column="34" selection-end-line="53" selection-end-column="34" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/mapper/SmartBuildMeterMapper.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="276">
+          <caret line="14" selection-start-line="14" selection-end-line="14" selection-end-column="11" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/mapper/SmartDataSourceLogMapper.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="276">
+          <caret line="14" column="11" selection-start-line="14" selection-start-column="11" selection-end-line="14" selection-end-column="11" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/mapper/SmartDataClassMapper.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="276">
+          <caret line="14" column="11" selection-start-line="14" selection-start-column="11" selection-end-line="14" selection-end-column="11" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/mapper/SmartDataSourceMapper.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="276">
+          <caret line="14" column="12" selection-start-line="14" selection-start-column="12" selection-end-line="14" selection-end-column="12" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartDataSource.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="295">
+          <caret line="25" column="13" selection-start-line="25" selection-start-column="13" selection-end-line="25" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartDataSourceLog.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="23">
+          <caret line="25" column="13" selection-start-line="25" selection-start-column="13" selection-end-line="25" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartDataClassServiceImpl.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="164">
+          <caret line="39" lean-forward="true" selection-start-line="39" selection-end-line="39" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/model/pojo/SmartDataClass.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="310">
+          <caret line="25" column="13" selection-start-line="25" selection-start-column="13" selection-end-line="25" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartDataClassController.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="1403">
+          <caret line="71" column="47" selection-start-line="71" selection-start-column="47" selection-end-line="71" selection-end-column="47" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartBuildMeterController.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="295">
+          <caret line="26" column="13" selection-start-line="26" selection-start-column="13" selection-end-line="26" selection-end-column="13" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/api/SmartBuildMeterControllerAPI.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="276">
+          <caret line="19" column="17" selection-start-line="19" selection-start-column="17" selection-end-line="19" selection-end-column="17" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/api/SmartBuildControllerAPI.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="621">
+          <caret line="33" column="60" lean-forward="true" selection-start-line="19" selection-start-column="4" selection-end-line="33" selection-end-column="60" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartBuildController.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="654">
+          <caret line="91" column="5" selection-start-line="26" selection-start-column="4" selection-end-line="91" selection-end-column="5" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartDataSourceLogController.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="1288">
+          <caret line="87" column="71" selection-start-line="87" selection-start-column="71" selection-end-line="87" selection-end-column="71" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/SmartDataClassService.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="184">
+          <caret line="11" column="2" selection-start-line="11" selection-start-column="2" selection-end-line="11" selection-end-column="2" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/SmartBuildService.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="299">
+          <caret line="16" column="4" selection-start-line="16" selection-start-column="4" selection-end-line="24" selection-end-column="36" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/SmartDataSourceLogService.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="483">
+          <caret line="24" column="22" selection-start-line="24" selection-start-column="22" selection-end-line="24" selection-end-column="22" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/SmartDataSourceService.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="161">
+          <caret line="10" column="7" selection-start-line="10" selection-start-column="7" selection-end-line="10" selection-end-column="7" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartBuildServiceImpl.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="687">
+          <caret line="60" column="5" selection-start-line="26" selection-start-column="4" selection-end-line="60" selection-end-column="5" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartDataSourceServiceImpl.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="1058">
+          <caret line="57" column="48" selection-start-line="57" selection-start-column="48" selection-end-line="57" selection-end-column="48" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/services/impl/SmartDataSourceLogServiceImpl.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="978">
+          <caret line="57" column="54" selection-start-line="57" selection-start-column="54" selection-end-line="57" selection-end-column="54" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/controller/SmartDataSourceController.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="138">
+          <caret line="69" column="7" selection-start-line="69" selection-start-column="7" selection-end-line="69" selection-end-column="7" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/api/SmartDataSourceControllerAPI.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="150">
+          <caret line="14" column="30" lean-forward="true" selection-start-line="14" selection-start-column="30" selection-end-line="14" selection-end-column="30" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/api/SmartDataClassControllerAPI.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="207">
+          <caret line="15" column="3" lean-forward="true" selection-start-line="15" selection-start-column="3" selection-end-line="15" selection-end-column="3" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/template/api/SmartDataSourceLogControllerAPI.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="161">
+          <caret line="13" column="30" lean-forward="true" selection-start-line="13" selection-start-column="30" selection-end-line="13" selection-end-column="30" />
+>>>>>>> ec6aa58b0412c23a8063f4a062df1f7ec5e2277a
         </state>
       </provider>
     </entry>

+ 4 - 0
pom.xml

@@ -90,6 +90,10 @@
             <artifactId>gson</artifactId>
             <version>2.8.7</version>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-quartz</artifactId>
+        </dependency>
         <!-- 数据库驱动 -->
         <dependency>
             <groupId>mysql</groupId>

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

@@ -3,11 +3,13 @@ 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) {

+ 7 - 3
src/main/java/com/template/api/SmartDataSourceControllerAPI.java

@@ -20,15 +20,19 @@ import org.springframework.web.bind.annotation.*;
 public interface SmartDataSourceControllerAPI {
     @PostMapping(value = "/insertSmartDataSource")
     @ApiOperation(value = "添加数据源", notes = "添加数据源数据", httpMethod = "POST")
-    CommonResult insertSmartDataSource(@Validated @RequestBody SmartDataSource smartApply, BindingResult bindingResult);
+    CommonResult insertSmartDataSource(@Validated @RequestBody SmartDataSource smartDataSource, BindingResult bindingResult);
+
+    @PostMapping(value = "/vcoSmartDataSource")
+    @ApiOperation(value = "测试数据源连接有效性", notes = "测试数据源连接有效性", httpMethod = "POST")
+    CommonResult vcoSmartDataSource(@Validated @RequestBody SmartDataSource smartDataSource, BindingResult bindingResult);
 
     @PostMapping(value = "/updateSmartDataSourceById")
     @ApiOperation(value = "编辑数据源数据", notes = "编辑数据源数据", httpMethod = "POST")
-    CommonResult updateSmartDataSourceById(@Validated @RequestBody SmartDataSource ra, BindingResult bindingResult);
+    CommonResult updateSmartDataSourceById(@Validated @RequestBody SmartDataSource smartDataSource, BindingResult bindingResult);
 
     @GetMapping(value = "/queryPageSmartDataSource")
     @ApiOperation(value = "数据源分页数据", notes = "数据源分页数据", httpMethod = "GET")
-    CommonResult queryPageSmartDataSources(@RequestParam int currentPage, @RequestParam int pageCount, String name);
+    CommonResult queryPageSmartDataSources(@RequestParam int currentPage, @RequestParam int pageCount, SmartDataSource smartDataSource);
 
     @GetMapping(value = "/deleteSmartDataSourceById")
     @ApiOperation(value = "根据ID删除指定数据源", notes = "根据ID删除指定数据源", httpMethod = "GET")

+ 15 - 11
src/main/java/com/template/api/SmartDataSourceLogControllerAPI.java

@@ -15,21 +15,25 @@ import org.springframework.web.bind.annotation.*;
  * @Version: 1.0
  */
 @RequestMapping("/api/smartDataSourceLog")
-@Api(tags = {"SmartDataSourceLogControllerAPI"}, value = "操作记录")
+@Api(tags = {"SmartDataSourceLogControllerAPI"}, value = "操作日志记录")
 public interface SmartDataSourceLogControllerAPI {
     @PostMapping(value = "/insertSmartDataSourceLog")
-    @ApiOperation(value = "添加操作记录", notes = "添加操作记录数据", httpMethod = "POST")
-    CommonResult insertSmartDataSourceLog(@Validated @RequestBody SmartDataSourceLog smartApply, BindingResult bindingResult);
+    @ApiOperation(value = "添加操作日志记录", notes = "添加操作日志记录数据", httpMethod = "POST")
+    CommonResult insertSmartDataSourceLog(@Validated @RequestBody SmartDataSourceLog smartDataSourceLog, BindingResult bindingResult);
 
-    @PostMapping(value = "/updateSmartDataSourceLogById")
-    @ApiOperation(value = "编辑操作记录数据", notes = "编辑操作记录数据", httpMethod = "POST")
-    CommonResult updateSmartDataSourceLogById(@Validated @RequestBody SmartDataSourceLog ra, BindingResult bindingResult);
+//    @PostMapping(value = "/updateSmartDataSourceLogById")
+//    @ApiOperation(value = "编辑操作日志记录数据", notes = "编辑操作日志记录数据", httpMethod = "POST")
+//    CommonResult updateSmartDataSourceLogById(@Validated @RequestBody SmartDataSourceLog ra, BindingResult bindingResult);
 
     @GetMapping(value = "/queryPageSmartDataSourceLog")
-    @ApiOperation(value = "操作记录分页数据", notes = "操作记录分页数据", httpMethod = "GET")
-    CommonResult queryPageSmartDataSourceLogs(@RequestParam int currentPage, @RequestParam int pageCount, String name);
+    @ApiOperation(value = "操作日志记录分页数据", notes = "操作日志记录分页数据", httpMethod = "GET")
+    CommonResult queryPageSmartDataSourceLogs(@RequestParam int currentPage,
+                                              @RequestParam int pageCount,
+                                              @RequestParam(required = false) String startTime,
+                                              @RequestParam(required = false) String endTime,
+                                              SmartDataSourceLog smartDataSourceLog);
 
-    @GetMapping(value = "/deleteSmartDataSourceLogById")
-    @ApiOperation(value = "根据ID删除指定操作记录", notes = "根据ID删除指定操作记录", httpMethod = "GET")
-    CommonResult deleteSmartDataSourceLogById(@RequestParam int id);
+//    @GetMapping(value = "/deleteSmartDataSourceLogById")
+//    @ApiOperation(value = "根据ID删除指定操作日志记录", notes = "根据ID删除指定操作日志记录", httpMethod = "GET")
+//    CommonResult deleteSmartDataSourceLogById(@RequestParam int id);
 }

+ 59 - 0
src/main/java/com/template/api/SmartDataTaskControllerAPI.java

@@ -0,0 +1,59 @@
+package com.template.api;
+
+import com.template.model.pojo.SmartDataTask;
+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.*;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/3/30 星期四 17:28
+ * @Description: com.video.api
+ * @Version: 1.0
+ */
+@RequestMapping("/api/smartDataTask")
+@Api(tags = {"SmartDataTaskControllerAPI"}, value = "操作记录")
+public interface SmartDataTaskControllerAPI {
+    @PostMapping(value = "/createJob")
+    @ApiOperation(value = "创建定时任务", notes = "创建定时任务", httpMethod = "POST")
+    CommonResult createJob(@Validated @RequestBody SmartDataTask smartDataTask, BindingResult bindingResult);
+
+    @PostMapping(value = "/pauseJob")
+    @ApiOperation(value = "暂定定时任务", notes = "暂停定时任务", httpMethod = "POST")
+    CommonResult pauseJob(@Validated @RequestBody SmartDataTask smartDataTask, BindingResult bindingResult);
+
+    @PostMapping(value = "/resumeJob")
+    @ApiOperation(value = "恢复定时任务", notes = "恢复定时任务", httpMethod = "POST")
+    CommonResult resumeJob(@Validated @RequestBody SmartDataTask smartDataTask, BindingResult bindingResult);
+
+    @PostMapping(value = "/updateJob")
+    @ApiOperation(value = "修改定时任务", notes = "修改定时任务", httpMethod = "POST")
+    CommonResult updateJob(@Validated @RequestBody SmartDataTask smartDataTask, BindingResult bindingResult);
+
+    @PostMapping(value = "/deleteJob")
+    @ApiOperation(value = "修改定时任务", notes = "修改定时任务", httpMethod = "POST")
+    CommonResult deleteJob(@Validated @RequestBody SmartDataTask smartDataTask, BindingResult bindingResult);
+
+    @PostMapping(value = "/runOnceJob")
+    @ApiOperation(value = "运行一次定时任务", notes = "运行一次定时任务", httpMethod = "POST")
+    CommonResult runOnceJob(@Validated @RequestBody SmartDataTask smartDataTask, BindingResult bindingResult);
+
+    @PostMapping(value = "/insertSmartDataTask")
+    @ApiOperation(value = "添加数据源任务管理数据", notes = "添加数据源任务管理数据", httpMethod = "POST")
+    CommonResult insertSmartDataTask(@Validated @RequestBody SmartDataTask smartDataTask, BindingResult bindingResult);
+
+    @PostMapping(value = "/updateSmartDataTaskById")
+    @ApiOperation(value = "编辑数据源任务管理数据", notes = "编辑数据源任务管理数据", httpMethod = "POST")
+    CommonResult updateSmartDataTaskById(@Validated @RequestBody SmartDataTask smartDataTask, BindingResult bindingResult);
+
+    @GetMapping(value = "/queryPageSmartDataTask")
+    @ApiOperation(value = "数据源任务管理分页数据", notes = "数据源任务管理分页数据", httpMethod = "GET")
+    CommonResult queryPageSmartDataTasks(@RequestParam int currentPage, @RequestParam int pageCount, SmartDataTask smartDataTask);
+
+    @GetMapping(value = "/deleteSmartDataTaskById")
+    @ApiOperation(value = "根据ID删除数据源任务数据", notes = "根据ID删除数据源任务数据", httpMethod = "GET")
+    CommonResult deleteSmartDataTaskById(@RequestParam int id);
+}

+ 25 - 0
src/main/java/com/template/api/Task.java

@@ -0,0 +1,25 @@
+package com.template.api;
+
+import org.quartz.JobDetail;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.quartz.JobKey;
+import org.springframework.scheduling.quartz.QuartzJobBean;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class Task extends QuartzJobBean {
+    @Override
+    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        //输出当前时间
+        Date date = new Date();
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String dateString = dateFormat.format(date);
+
+        JobDetail jobDetail = jobExecutionContext.getJobDetail();
+        JobKey key = jobDetail.getKey();
+        //工作内容
+        System.out.println("定时任务名称:【" + key.getName() + "】,执行时间:" + dateString);
+    }
+}

+ 20 - 6
src/main/java/com/template/common/utils/CommonUtil.java

@@ -17,6 +17,19 @@ import java.util.*;
 @Slf4j
 public class CommonUtil {
     /**
+     * 检测客户端参数
+     * @param code 状态码
+     * @param object 对象
+     * @return 返回类型
+     */
+    public static Map<String, Object> getReturnMap(String code, Object object) {
+        Map<String, Object> returnMap = new HashMap<>();
+        returnMap.put("code", code);
+        returnMap.put("msg", object);
+        return returnMap;
+    }
+
+    /**
      * 获取ip
      *
      * @param request
@@ -26,18 +39,18 @@ public class CommonUtil {
         String ipAddress = null;
         try {
             ipAddress = request.getHeader("x-forwarded-for");
-            System.out.println("x-forwarded-for="+ipAddress);
+            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);
+                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);
+                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);
+                System.out.println("getRemoteAddr=" + ipAddress);
                 if (ipAddress.equals("127.0.0.1")) {
                     // 根据网卡取本机配置的IP
                     InetAddress inet = null;
@@ -47,7 +60,7 @@ public class CommonUtil {
                         e.printStackTrace();
                     }
                     ipAddress = inet.getHostAddress();
-                    System.out.println("getHostAddress="+ipAddress);
+                    System.out.println("getHostAddress=" + ipAddress);
                 }
             }
             // 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
@@ -161,8 +174,9 @@ public class CommonUtil {
 
     /**
      * LocalDate 拼接时间转成 LocalDateTime
+     *
      * @param localDate
-     * @param timeStr HH:mm:ss
+     * @param timeStr   HH:mm:ss
      * @return
      */
     public static LocalDateTime localDateToTime(LocalDate localDate, String timeStr) {

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

@@ -0,0 +1,176 @@
+package com.template.common.utils;
+
+import com.template.model.pojo.SmartDataTask;
+import com.template.model.result.CommonResult;
+import org.quartz.*;
+
+import java.util.Map;
+
+public class QuartzJobUtils {
+
+    private static final String JobClass = "com.template.api.Task";
+
+    /**
+     * 创建定时任务
+     *
+     * @param scheduler     调度器
+     * @param smartDataTask 定时任务信息类
+     */
+    public static Map<String, Object> createScheduleJob(Scheduler scheduler, SmartDataTask smartDataTask) {
+        Map<String, Object> exists = exists(scheduler, smartDataTask.getTkName());
+        if ("0".equals(exists.get("code"))) {
+            return exists;
+        }
+        try {
+            Class<? extends Job> jobClass = (Class<? extends Job>) Class.forName(JobClass);
+            // 构建定时任务信息
+            JobDetail jobDetail = JobBuilder.newJob(jobClass)
+                    .withIdentity(smartDataTask.getTkName())
+                    .withDescription(smartDataTask.getTkDescrition())
+                    .build();
+            // 设置定时任务的执行方式
+            CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(smartDataTask.getTkCron());
+            // 构建触发器
+            CronTrigger cronTrigger = TriggerBuilder.newTrigger()
+                    .withIdentity(smartDataTask.getTkName())
+                    .withSchedule(cronScheduleBuilder)
+                    .build();
+            //把触发器与任务进行绑定
+            scheduler.scheduleJob(jobDetail, cronTrigger);
+
+            return CommonUtil.getReturnMap(String.valueOf(0), "定时任务【" + smartDataTask.getTkName() + "】创建成功!");
+        } catch (ClassNotFoundException e) {
+            return CommonUtil.getReturnMap(String.valueOf(1), "找不到定时任务类!");
+        } catch (SchedulerException e) {
+            return CommonUtil.getReturnMap(String.valueOf(1), "创建定时任务出错:" + e.getMessage());
+        }
+    }
+
+    /**
+     * 根据任务暂停定时任务
+     *
+     * @param scheduler 调度器
+     * @param jobName   任务名称
+     */
+    public static CommonResult pauseScheduleJob(Scheduler scheduler, String jobName) {
+        Map<String, Object> exists = exists(scheduler, jobName);
+        if ("1".equals(exists.get("code"))) {
+            return CommonResult.fail((String) exists.get("msg"));
+        }
+
+        JobKey jobKey = JobKey.jobKey(jobName);
+        try {
+            scheduler.pauseJob(jobKey);
+            return CommonResult.ok("定时任务【" + jobName + "】暂停成功!");
+        } catch (SchedulerException e) {
+            return CommonResult.ok("定时任务【" + jobName + "】暂停出错:" + e.getMessage());
+        }
+    }
+
+    public static Map<String, Object> exists(Scheduler scheduler, String jobName) {
+        JobKey jobKey = new JobKey(jobName);
+        try {
+            if (scheduler.getJobDetail(jobKey) != null) {
+                return CommonUtil.getReturnMap("0", "定时任务【" + jobName + "】已在运行!");
+            } else {
+                return CommonUtil.getReturnMap("1", "定时任务【" + jobName + "】不存在!");
+            }
+        } catch (SchedulerException e) {
+            return CommonUtil.getReturnMap("1", "异常:" + e.getMessage());
+        }
+    }
+
+    /**
+     * 根据任务恢复定时任务
+     *
+     * @param scheduler 调度器
+     * @param jobName   任务名称
+     */
+    public static CommonResult resumeScheduleJob(Scheduler scheduler, String jobName) {
+        Map<String, Object> exists = exists(scheduler, jobName);
+        if ("1".equals(exists.get("code"))) {
+            return CommonResult.fail((String) exists.get("msg"));
+        }
+
+        JobKey jobKey = JobKey.jobKey(jobName);
+        try {
+            scheduler.resumeJob(jobKey);
+            return CommonResult.ok("定时任务【" + jobName + "】已恢复成功!");
+        } catch (SchedulerException e) {
+            return CommonResult.ok("定时任务【" + jobName + "】恢复出错:" + e.getMessage());
+        }
+    }
+
+    /**
+     * 根据任务名称立即运行一次定时任务
+     *
+     * @param scheduler 调度器
+     * @param jobName   任务名称
+     */
+    public static CommonResult runOnce(Scheduler scheduler, String jobName) {
+        Map<String, Object> exists = exists(scheduler, jobName);
+        if ("1".equals(exists.get("code"))) {
+            return CommonResult.fail((String) exists.get("msg"));
+        }
+
+        JobKey jobKey = JobKey.jobKey(jobName);
+        try {
+            scheduler.triggerJob(jobKey);
+            return CommonResult.ok("定时任务【" + jobName + "】立即运行1次成功!");
+        } catch (SchedulerException e) {
+            return CommonResult.ok("定时任务【" + jobName + "】立即运行1次出错:" + e.getMessage());
+        }
+    }
+
+    /**
+     * 根据任务更新定时任务
+     *
+     * @param scheduler     调度器
+     * @param smartDataTask 定时任务信息类
+     */
+    public static CommonResult updateScheduleJob(Scheduler scheduler, SmartDataTask smartDataTask) {
+        Map<String, Object> exists = exists(scheduler, smartDataTask.getTkName());
+        if ("1".equals(exists.get("code"))) {
+            return CommonResult.fail((String) exists.get("msg"));
+        }
+
+        try {
+            //获取到对应任务的触发器
+            TriggerKey triggerKey = TriggerKey.triggerKey(smartDataTask.getTkName());
+            //设置定时任务的执行方式
+            CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(smartDataTask.getTkCron());
+            //重新构建任务的触发器
+            CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey);
+            trigger = trigger.getTriggerBuilder()
+                    .withIdentity(triggerKey)
+                    .withSchedule(cronScheduleBuilder)
+                    .build();
+            //重置对应的Job
+            scheduler.rescheduleJob(triggerKey, trigger);
+            return CommonResult.ok("定时任务【" + smartDataTask.getTkName() + "】刷新成功!");
+        } catch (SchedulerException e) {
+            return CommonResult.ok("定时任务【" + smartDataTask.getTkName() + "】刷新出错:" + e.getMessage());
+        }
+    }
+
+    /**
+     * 根据定时任务名称从调度器中除定时任务
+     *
+     * @param scheduler 调度器
+     * @param jobName   任务名称
+     */
+    public static Map<String, Object> deleteScheduleJob(Scheduler scheduler, String jobName) {
+        Map<String, Object> exists = exists(scheduler, jobName);
+        if ("1".equals(exists.get("code"))) {
+            return exists;
+        }
+
+        JobKey jobKey = JobKey.jobKey(jobName);
+        try {
+            scheduler.deleteJob(jobKey);
+            return CommonUtil.getReturnMap(String.valueOf(0), "定时任务【" + jobName + "】删除成功!");
+        } catch (SchedulerException e) {
+            return CommonUtil.getReturnMap(String.valueOf(1), "定时任务【" + jobName + "】删除出错:" + e.getMessage());
+        }
+    }
+}

+ 28 - 8
src/main/java/com/template/controller/SmartDataClassController.java

@@ -31,8 +31,10 @@ public class SmartDataClassController implements SmartDataClassControllerAPI {
 
     @Autowired
     private SmartDataSourceService smartDataSourceService;
+
     /**
      * 新增 数据源分类
+     *
      * @param smartDataClass
      * @param bindingResult
      * @return
@@ -44,12 +46,20 @@ public class SmartDataClassController implements SmartDataClassControllerAPI {
             return CommonResult.fail(st);
         }
 
+        if (smartDataClass.getDsClsName() == null) {
+            return CommonResult.fail("数据源分类名称为空!");
+        }
+        if (smartDataClass.getDsClsDriver() == null) {
+            return CommonResult.fail("数据源驱动为空!");
+        }
+
         // 检测是否有重复名称
         QueryWrapper<SmartDataClass> smartDataClassQueryWrapper = new QueryWrapper<>();
         smartDataClassQueryWrapper.eq("ds_cls_name", smartDataClass.getDsClsName());
+        smartDataClassQueryWrapper.eq("ds_cls_driver", smartDataClass.getDsClsDriver());
         int count = smartDataClassService.count(smartDataClassQueryWrapper);
-        if(count > 0){
-            return CommonResult.fail("数据源分类名称有重名,新增失败!");
+        if (count > 0) {
+            return CommonResult.fail("数据源分类名称和驱动有重复,新增失败!");
         }
 
         int result = smartDataClassService.insertSmartDataClass(smartDataClass);
@@ -59,6 +69,7 @@ public class SmartDataClassController implements SmartDataClassControllerAPI {
 
     /**
      * 更新 数据源分类
+     *
      * @param smartDataClass
      * @param bindingResult
      * @return
@@ -70,12 +81,20 @@ public class SmartDataClassController implements SmartDataClassControllerAPI {
             return CommonResult.fail(st);
         }
 
+        if (smartDataClass.getDsClsName() == null) {
+            return CommonResult.fail("数据源分类名称为空!");
+        }
+        if (smartDataClass.getDsClsDriver() == null) {
+            return CommonResult.fail("数据源驱动为空!");
+        }
+
         // 检测是否有重复名称
         QueryWrapper<SmartDataClass> smartDataClassQueryWrapper = new QueryWrapper<>();
         smartDataClassQueryWrapper.eq("ds_cls_name", smartDataClass.getDsClsName());
+        smartDataClassQueryWrapper.eq("ds_cls_driver", smartDataClass.getDsClsDriver());
         int count = smartDataClassService.count(smartDataClassQueryWrapper);
-        if(count > 0){
-            return CommonResult.fail("数据源分类名称有重名,更新失败!");
+        if (count > 0) {
+            return CommonResult.fail("数据源分类名称和驱动有重复,更新失败!");
         }
 
         int result = smartDataClassService.updateSmartDataClass(smartDataClass);
@@ -84,9 +103,10 @@ public class SmartDataClassController implements SmartDataClassControllerAPI {
 
     /**
      * 数据源分类 分页数据查询
+     *
      * @param currentPage 当前页数
-     * @param pageCount 一页数据条数
-     * @param name 查询名称
+     * @param pageCount   一页数据条数
+     * @param name        查询名称
      * @return
      */
     @Override
@@ -102,7 +122,7 @@ public class SmartDataClassController implements SmartDataClassControllerAPI {
 
         SmartDataClass data = smartDataClassService.getSmartById(id);
 
-        if(data == null){
+        if (data == null) {
             return CommonResult.fail("当前数据不存在,删除失败!");
         }
 
@@ -110,7 +130,7 @@ public class SmartDataClassController implements SmartDataClassControllerAPI {
         QueryWrapper<SmartDataSource> smartDataSourceQueryWrapper = new QueryWrapper<>();
         smartDataSourceQueryWrapper.eq("ds_cls_id", id);
         int count = smartDataSourceService.count(smartDataSourceQueryWrapper);
-        if(count > 0){
+        if (count > 0) {
             return CommonResult.fail("当前类别下有数据,不能删除,删除失败!");
         }
 

+ 30 - 14
src/main/java/com/template/controller/SmartDataSourceController.java

@@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Map;
+
 /**
  * <p>
  * 数据源配置 前端控制器
@@ -23,54 +25,68 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @RestController
 public class SmartDataSourceController implements SmartDataSourceControllerAPI {
+
     @Autowired
     private SmartDataSourceService smartDataSourceService;
 
     /**
-     * 新增楼栋
-     * @param smartApply 楼栋数据
+     * 新增数据源
+     * @param smartDataSource 数据源
      * @param bindingResult
      * @return
      */
     @Override
-    public CommonResult insertSmartDataSource(SmartDataSource smartApply, BindingResult bindingResult) {
+    public CommonResult insertSmartDataSource(SmartDataSource smartDataSource, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+
+        Map<String, Object> result = smartDataSourceService.insertSmartDataSource(smartDataSource);
+
+        return Integer.parseInt((String) result.get("code")) == 0 ? CommonResult.ok(result.get("msg")) : CommonResult.fail((String) result.get("msg"));
+    }
+
+    @Override
+    public CommonResult vcoSmartDataSource(SmartDataSource smartDataSource, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
             return CommonResult.fail(st);
         }
 
-        int result = smartDataSourceService.insertSmartDataSource(smartApply);
+        Map<String, Object> result = smartDataSourceService.vcoSmartDataSource(smartDataSource);
 
-        return result > 0 ? CommonResult.ok("添加成功") : CommonResult.fail("添加失败");
+        return Integer.parseInt((String) result.get("code")) == 0 ? CommonResult.ok(result.get("msg")) : CommonResult.fail((String) result.get("msg"));
     }
 
     /**
-     * 更新楼栋
-     * @param sa 楼栋数据
+     * 更新数据源
+     * @param smartDataSource
      * @param bindingResult
      * @return
      */
     @Override
-    public CommonResult updateSmartDataSourceById(SmartDataSource sa, BindingResult bindingResult) {
+    public CommonResult updateSmartDataSourceById(SmartDataSource smartDataSource, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
             return CommonResult.fail(st);
         }
 
-        int result = smartDataSourceService.updateSmartDataSource(sa);
-        return result > 0 ? CommonResult.ok("修改成功") : CommonResult.fail("修改失败");
+        Map<String, Object> result = smartDataSourceService.updateSmartDataSource(smartDataSource);
+
+        return Integer.parseInt((String) result.get("code")) > 0 ? CommonResult.ok(result.get("msg")) : CommonResult.fail((String) result.get("msg"));
     }
 
     /**
-     * 楼栋分页数据查询
+     * 数据源分页数据查询
      * @param currentPage 当前页数
      * @param pageCount 一页数据条数
-     * @param name 查询名称
+     * @param smartDataSource 查询数据源实体
      * @return
      */
     @Override
-    public CommonResult queryPageSmartDataSources(int currentPage, int pageCount, String name) {
-        PageUtils<SmartDataSource> result = smartDataSourceService.queryPageSmartDataSources(currentPage, pageCount, name);
+    public CommonResult queryPageSmartDataSources(int currentPage, int pageCount, SmartDataSource smartDataSource) {
+        PageUtils<SmartDataSource> result = smartDataSourceService.queryPageSmartDataSources(currentPage, pageCount, smartDataSource);
 
         return CommonResult.ok(result);
     }

+ 67 - 38
src/main/java/com/template/controller/SmartDataSourceLogController.java

@@ -9,8 +9,6 @@ import com.template.model.result.PageUtils;
 import com.template.services.SmartDataSourceLogService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.RequestMapping;
-
 import org.springframework.web.bind.annotation.RestController;
 
 /**
@@ -23,71 +21,102 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @RestController
 public class SmartDataSourceLogController implements SmartDataSourceLogControllerAPI {
+
     @Autowired
     private SmartDataSourceLogService smartDataSourceLogService;
 
     /**
-     * 新增楼栋
-     * @param smartApply 楼栋数据
+     * 新增日志
+     *
+     * @param smartDataSourceLog 日志数据
      * @param bindingResult
      * @return
      */
     @Override
-    public CommonResult insertSmartDataSourceLog(SmartDataSourceLog smartApply, BindingResult bindingResult) {
+    public CommonResult insertSmartDataSourceLog(SmartDataSourceLog smartDataSourceLog, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
             return CommonResult.fail(st);
         }
 
-        int result = smartDataSourceLogService.insertSmartDataSourceLog(smartApply);
+        if (smartDataSourceLog.getLogActionBusiness() == null) {
+            return CommonResult.fail("【业务名称】不能为空!");
+        }
+        if (smartDataSourceLog.getLogActionHost() == null) {
+            return CommonResult.fail("【操作主机ip】不能为空!");
+        }
+        if (smartDataSourceLog.getLogActionModule() == null) {
+            return CommonResult.fail("【操作模块】不能为空!");
+        }
+        if (smartDataSourceLog.getLogActionClass() == null) {
+            return CommonResult.fail("【操作类型】不能为空!");
+        }
+        if (smartDataSourceLog.getLogActionPeople() == null) {
+            return CommonResult.fail("【操作人】不能为空!");
+        }
+        if (smartDataSourceLog.getLogActionRemote() == null) {
+            return CommonResult.fail("【操作人ip】不能为空!");
+        }
+        if (smartDataSourceLog.getLogActionName() == null) {
+            return CommonResult.fail("【操作名称】不能为空!");
+        }
+
+        int result = smartDataSourceLogService.insertSmartDataSourceLog(smartDataSourceLog);
 
-        return result > 0 ? CommonResult.ok("添加成功") : CommonResult.fail("添加失败");
+        return result > 0 ? CommonResult.ok("操作日志添加成功") : CommonResult.fail("操作日志添加失败");
     }
 
     /**
-     * 更新楼栋
-     * @param sa 楼栋数据
+     * 更新日志
+     * @param smartDataSourceLog 日志数据
      * @param bindingResult
      * @return
      */
-    @Override
-    public CommonResult updateSmartDataSourceLogById(SmartDataSourceLog sa, BindingResult bindingResult) {
-        if (bindingResult.hasErrors()) {
-            String st = paramUtils.getParamError(bindingResult);
-            return CommonResult.fail(st);
-        }
-
-        int result = smartDataSourceLogService.updateSmartDataSourceLog(sa);
-        return result > 0 ? CommonResult.ok("修改成功") : CommonResult.fail("修改失败");
-    }
+//    @Override
+//    public CommonResult updateSmartDataSourceLogById(SmartDataSourceLog smartDataSourceLog, BindingResult bindingResult) {
+//        if (bindingResult.hasErrors()) {
+//            String st = paramUtils.getParamError(bindingResult);
+//            return CommonResult.fail(st);
+//        }
+//
+//        int result = smartDataSourceLogService.updateSmartDataSourceLog(smartDataSourceLog);
+//        return result > 0 ? CommonResult.ok("修改成功") : CommonResult.fail("修改失败");
+//    }
 
     /**
-     * 楼栋分页数据查询
-     * @param currentPage 当前页数
-     * @param pageCount 一页数据条数
-     * @param name 查询名称
+     * 日志分页数据查询
+     *
+     * @param currentPage        当前页数
+     * @param pageCount          一页数据条数
+     * @param smartDataSourceLog 查询名称
      * @return
      */
     @Override
-    public CommonResult queryPageSmartDataSourceLogs(int currentPage, int pageCount, String name) {
-        PageUtils<SmartDataSourceLog> result = smartDataSourceLogService.queryPageSmartDataSourceLogs(currentPage, pageCount, name);
+    public CommonResult queryPageSmartDataSourceLogs(int currentPage, int pageCount, String startTime, String endTime,
+                                                     SmartDataSourceLog smartDataSourceLog) {
+
+        if ((startTime != null && endTime == null) || (startTime == null && endTime != null)) {
+            return CommonResult.fail("查询的【开始时间】和【结束时间】必须同时提供!");
+        }
+        PageUtils<SmartDataSourceLog> result = smartDataSourceLogService.queryPageSmartDataSourceLogs(currentPage, pageCount,
+                startTime, endTime, smartDataSourceLog);
 
         return CommonResult.ok(result);
     }
 
 
-    @Override
-    public CommonResult deleteSmartDataSourceLogById(int id) {
-
-        SmartDataSourceLog data = smartDataSourceLogService.getSmartById(id);
-
-        if(data == null){
-            return CommonResult.fail("当前数据不存在,删除失败!");
-        }
-
-        int result = smartDataSourceLogService.deleteSmartDataSourceLogById(id);
-
-        return result > 0 ? CommonResult.ok("删除成功") : CommonResult.fail("删除失败");
-    }
+//    @Override
+//    public CommonResult deleteSmartDataSourceLogById(int id) {
+//
+//        SmartDataSourceLog data = smartDataSourceLogService.getSmartById(id);
+//
+//        if(data == null){
+//            return CommonResult.fail("当前数据不存在,删除失败!");
+//        }
+//
+//        int result = smartDataSourceLogService.deleteSmartDataSourceLogById(id);
+//
+//        return result > 0 ? CommonResult.ok("删除成功") : CommonResult.fail("删除失败");
+//    }
 }
 

+ 164 - 0
src/main/java/com/template/controller/SmartDataTaskController.java

@@ -0,0 +1,164 @@
+package com.template.controller;
+
+
+import com.template.api.SmartDataTaskControllerAPI;
+import com.template.common.utils.paramUtils;
+import com.template.model.pojo.SmartDataTask;
+import com.template.model.result.CommonResult;
+import com.template.model.result.PageUtils;
+import com.template.services.SmartDataTaskService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 数据源任务 前端控制器
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-05
+ */
+@RestController
+public class SmartDataTaskController implements SmartDataTaskControllerAPI {
+
+    @Autowired
+    private SmartDataTaskService smartDataTaskService;
+
+
+    @Override
+    public CommonResult createJob(SmartDataTask smartDataTask, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+
+        return smartDataTaskService.createJob(smartDataTask);
+    }
+
+    @Override
+    public CommonResult pauseJob(SmartDataTask smartDataTask, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+
+        return smartDataTaskService.pauseJob(smartDataTask);
+    }
+
+    @Override
+    public CommonResult resumeJob(SmartDataTask smartDataTask, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+
+        return smartDataTaskService.resumeJob(smartDataTask);
+    }
+
+    @Override
+    public CommonResult updateJob(SmartDataTask smartDataTask, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+
+        return smartDataTaskService.updateJob(smartDataTask);
+    }
+
+    @Override
+    public CommonResult deleteJob(SmartDataTask smartDataTask, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+
+        return smartDataTaskService.deleteJob(smartDataTask);
+    }
+
+    @Override
+    public CommonResult runOnceJob(SmartDataTask smartDataTask, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+
+        return smartDataTaskService.runOnceJob(smartDataTask);
+    }
+
+    /**
+     * 新增任务数据库数据
+     *
+     * @param smartDataTask 任务数据
+     * @param bindingResult
+     * @return
+     */
+    @Override
+    public CommonResult insertSmartDataTask(SmartDataTask smartDataTask, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+
+        Map<String, Object> result = smartDataTaskService.insertSmartDataTask(smartDataTask);
+
+        return Integer.parseInt((String) result.get("code")) > 0 ? CommonResult.ok(result.get("msg")) : CommonResult.fail((String) result.get("msg"));
+    }
+
+    /**
+     * 更新任务数据库数据
+     *
+     * @param smartDataTask 数据库数据
+     * @param bindingResult
+     * @return
+     */
+    @Override
+    public CommonResult updateSmartDataTaskById(SmartDataTask smartDataTask, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+
+        Map<String, Object> result = smartDataTaskService.updateSmartDataTaskById(smartDataTask);
+
+        return Integer.parseInt((String) result.get("code")) > 0 ? CommonResult.ok(result.get("msg")) : CommonResult.fail((String) result.get("msg"));
+    }
+
+    /**
+     * 任务数据库数据分页数据查询
+     *
+     * @param currentPage   当前页数
+     * @param pageCount     一页数据条数
+     * @param smartDataTask 查询名称
+     * @return
+     */
+    @Override
+    public CommonResult queryPageSmartDataTasks(int currentPage, int pageCount, SmartDataTask smartDataTask) {
+        PageUtils<SmartDataTask> result = smartDataTaskService.queryPageSmartDataTasks(currentPage, pageCount, smartDataTask);
+
+        return CommonResult.ok(result);
+    }
+
+
+    /**
+     * 删除任务数据库数据
+     * @param id id
+     * @return
+     */
+    @Override
+    public CommonResult deleteSmartDataTaskById(int id) {
+
+        SmartDataTask data = smartDataTaskService.getSmartById(id);
+
+        if (data == null) {
+            return CommonResult.fail("当前数据不存在,删除失败!");
+        }
+
+        int result = smartDataTaskService.deleteSmartDataTaskById(id);
+
+        return result > 0 ? CommonResult.ok("删除成功") : CommonResult.fail("删除失败");
+    }
+}
+

+ 37 - 0
src/main/java/com/template/mapper/SmartDataTaskMapper.java

@@ -0,0 +1,37 @@
+package com.template.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.template.model.pojo.SmartDataTask;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 数据源任务 Mapper 接口
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-05
+ */
+@Repository
+public interface SmartDataTaskMapper extends BaseMapper<SmartDataTask> {
+
+    @Select("SELECT " +
+            "        tk_id, " +
+            "        tk_ds_id, " +
+            "        tk_name, " +
+            "        tk_cron, " +
+            "        tk_sql, " +
+            "        tk_activation, " +
+            "        tk_descrition, " +
+            "        tk_create_time, " +
+            "        tk_update_time  " +
+            "    FROM " +
+            "        smart_data_task  " +
+            "    WHERE " +
+            "        tk_name = #{tkName} " +
+            "        AND tk_id != #{tkId} ")
+    List<SmartDataTask> isRepeatTaskName(SmartDataTask smartDataTask);
+}

+ 7 - 0
src/main/java/com/template/model/pojo/SmartDataClass.java

@@ -5,6 +5,8 @@ import java.util.Date;
 import com.baomidou.mybatisplus.annotation.Version;
 import com.baomidou.mybatisplus.annotation.TableId;
 import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -34,9 +36,14 @@ public class SmartDataClass implements Serializable {
     @ApiModelProperty(value = "数据源类别名称")
     private String dsClsName;
 
+    @ApiModelProperty(value = "数据源驱动")
+    private String dsClsDriver;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty(value = "创建时间")
     private Date dsClsCreateTime;
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty(value = "更新时间")
     private Date dsClsUpdateTime;
 

+ 11 - 4
src/main/java/com/template/model/pojo/SmartDataSource.java

@@ -5,6 +5,8 @@ import java.util.Date;
 import com.baomidou.mybatisplus.annotation.Version;
 import com.baomidou.mybatisplus.annotation.TableId;
 import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -40,11 +42,14 @@ public class SmartDataSource implements Serializable {
     @ApiModelProperty(value = "数据源连接地址")
     private String dsUrl;
 
-    @ApiModelProperty(value = "数据源状态:0异常,1正常")
-    private String dsStatus;
+    @ApiModelProperty(value = "数据源用户")
+    private String dsUser;
 
-    @ApiModelProperty(value = "数据源SQL语言")
-    private String dsSql;
+    @ApiModelProperty(value = "数据源密码")
+    private String dsPassword;
+
+    @ApiModelProperty(value = "数据源状态:0异常,1正常")
+    private Integer dsStatus;
 
     @ApiModelProperty(value = "数据源描述")
     private String dsDescrition;
@@ -55,9 +60,11 @@ public class SmartDataSource implements Serializable {
     @ApiModelProperty(value = "目的数据库使用次数")
     private Integer dsTarget;
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty(value = "创建时间")
     private Date dsCreateTime;
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty(value = "更新时间")
     private Date dsUpdateTime;
 

+ 9 - 7
src/main/java/com/template/model/pojo/SmartDataSourceLog.java

@@ -1,16 +1,18 @@
 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.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonFormat;
 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>
  * 数据源操作日志
@@ -49,11 +51,11 @@ public class SmartDataSourceLog implements Serializable {
     @ApiModelProperty(value = "操作人ip")
     private String logActionRemote;
 
-    @ApiModelProperty(value = "操作类型:select  login update  delete create")
+    @ApiModelProperty(value = "操作类型:select login update delete create")
     private String logActionClass;
 
-    @ApiModelProperty(value = "操作日期时间")
-    private Date logActionTime;
-
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "操作日志创建时间")
+    private Date logActionCreateTime;
 
 }

+ 61 - 0
src/main/java/com/template/model/pojo/SmartDataTask.java

@@ -0,0 +1,61 @@
+package com.template.model.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+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.sql.Timestamp;
+import java.util.Date;
+
+/**
+ * <p>
+ * 数据源操作日志
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="SmartDataTask对象", description="数据源任务管理")
+public class SmartDataTask implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "主键id")
+    @TableId(value = "tk_id", type = IdType.AUTO)
+    private Integer tkId;
+
+    @ApiModelProperty(value = "数据源id")
+    private Integer tkDsId;
+
+    @ApiModelProperty(value = "任务名称")
+    private String tkName;
+
+    @ApiModelProperty(value = "任务定时表达式")
+    private String tkCron;
+
+    @ApiModelProperty(value = "任务使用的SQL语言")
+    private String tkSql;
+
+    @ApiModelProperty(value = "是否激活")
+    private Integer tkActivation;
+
+    @ApiModelProperty(value = "任务描述")
+    private String tkDescrition;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
+    private Date tkCreateTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "更新时间")
+    private Date tkUpdateTime;
+}

+ 6 - 3
src/main/java/com/template/services/SmartDataSourceLogService.java

@@ -4,6 +4,7 @@ import com.template.model.pojo.SmartDataSourceLog;
 import com.template.model.pojo.SmartDataSourceLog;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.template.model.result.PageUtils;
+import org.springframework.web.bind.annotation.RequestParam;
 
 /**
  * <p>
@@ -16,11 +17,13 @@ import com.template.model.result.PageUtils;
 public interface SmartDataSourceLogService extends IService<SmartDataSourceLog> {
     int insertSmartDataSourceLog(SmartDataSourceLog rns);
 
-    int updateSmartDataSourceLog(SmartDataSourceLog rns);
+//    int updateSmartDataSourceLog(SmartDataSourceLog rns);
 
-    PageUtils<SmartDataSourceLog> queryPageSmartDataSourceLogs(int currentPage, int pageCount, String name);
+    PageUtils<SmartDataSourceLog> queryPageSmartDataSourceLogs(int currentPage, int pageCount,
+                                                               String startTime,
+                                                               String endTime, SmartDataSourceLog smartDataSourceLog);
 
-    int deleteSmartDataSourceLogById(int id);
+//    int deleteSmartDataSourceLogById(int id);
 
     SmartDataSourceLog getSmartById(int id);
 }

+ 7 - 3
src/main/java/com/template/services/SmartDataSourceService.java

@@ -5,6 +5,8 @@ import com.template.model.pojo.SmartDataSource;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.template.model.result.PageUtils;
 
+import java.util.Map;
+
 /**
  * <p>
  * 数据源配置 服务类
@@ -14,13 +16,15 @@ import com.template.model.result.PageUtils;
  * @since 2023-12-05
  */
 public interface SmartDataSourceService extends IService<SmartDataSource> {
-    int insertSmartDataSource(SmartDataSource rns);
+    Map<String, Object> insertSmartDataSource(SmartDataSource rns);
 
-    int updateSmartDataSource(SmartDataSource rns);
+    Map<String, Object> updateSmartDataSource(SmartDataSource rns);
 
-    PageUtils<SmartDataSource> queryPageSmartDataSources(int currentPage, int pageCount, String name);
+    PageUtils<SmartDataSource> queryPageSmartDataSources(int currentPage, int pageCount, SmartDataSource smartDataSource);
 
     int deleteSmartDataSourceById(int id);
 
     SmartDataSource getSmartById(int id);
+
+    Map<String, Object> vcoSmartDataSource(SmartDataSource smartDataSource);
 }

+ 40 - 0
src/main/java/com/template/services/SmartDataTaskService.java

@@ -0,0 +1,40 @@
+package com.template.services;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.template.model.pojo.SmartDataTask;
+import com.template.model.result.CommonResult;
+import com.template.model.result.PageUtils;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 数据源任务 服务类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-05
+ */
+public interface SmartDataTaskService extends IService<SmartDataTask> {
+    Map<String, Object> insertSmartDataTask(SmartDataTask smartDataTask);
+
+    Map<String, Object> updateSmartDataTaskById(SmartDataTask smartDataTask);
+
+    PageUtils<SmartDataTask> queryPageSmartDataTasks(int currentPage, int pageCount, SmartDataTask smartDataTask);
+
+    int deleteSmartDataTaskById(int id);
+
+    SmartDataTask getSmartById(int id);
+
+    CommonResult createJob(SmartDataTask smartDataTask);
+
+    CommonResult pauseJob(SmartDataTask smartDataTask);
+
+    CommonResult resumeJob(SmartDataTask smartDataTask);
+
+    CommonResult updateJob(SmartDataTask smartDataTask);
+
+    CommonResult deleteJob(SmartDataTask smartDataTask);
+
+    CommonResult runOnceJob(SmartDataTask smartDataTask);
+}

+ 1 - 0
src/main/java/com/template/services/impl/SmartDataClassServiceImpl.java

@@ -46,6 +46,7 @@ public class SmartDataClassServiceImpl extends ServiceImpl<SmartDataClassMapper,
         Page<SmartDataClass> page = new Page<>(currentPage, pageCount);
         QueryWrapper<SmartDataClass> queryWrapper = new QueryWrapper<>();
         queryWrapper.like(StringUtils.hasText(name), "ds_cls_name", name);
+        queryWrapper.orderByDesc("ds_cls_update_time");
         IPage<SmartDataClass> result = smartDataClassMapper.selectPage(page,queryWrapper);
         return new PageUtils<>(result);
     }

+ 27 - 15
src/main/java/com/template/services/impl/SmartDataSourceLogServiceImpl.java

@@ -12,6 +12,7 @@ import com.template.services.SmartDataSourceLogService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
 /**
  * <p>
@@ -27,31 +28,42 @@ public class SmartDataSourceLogServiceImpl extends ServiceImpl<SmartDataSourceLo
     private SmartDataSourceLogMapper smartDataSourceLogMapper;
 
     @Override
-    public int insertSmartDataSourceLog(SmartDataSourceLog sa) {
-        int result = smartDataSourceLogMapper.insert(sa);
+    public int insertSmartDataSourceLog(SmartDataSourceLog smartDataSourceLog) {
+        int result = smartDataSourceLogMapper.insert(smartDataSourceLog);
         return result;
     }
 
-    @Override
-    public int updateSmartDataSourceLog(SmartDataSourceLog sa) {
-        int result = smartDataSourceLogMapper.updateById(sa);
-        return result;
-    }
+//    @Override
+//    public int updateSmartDataSourceLog(SmartDataSourceLog sa) {
+//        int result = smartDataSourceLogMapper.updateById(sa);
+//        return result;
+//    }
 
     @Override
-    public PageUtils<SmartDataSourceLog> queryPageSmartDataSourceLogs(int currentPage, int pageCount, String name) {
+    public PageUtils<SmartDataSourceLog> queryPageSmartDataSourceLogs(int currentPage, int pageCount, String startTime,
+                                                                      String endTime, SmartDataSourceLog smartDataSourceLog) {
         Page<SmartDataSourceLog> page = new Page<>(currentPage, pageCount);
         QueryWrapper<SmartDataSourceLog> queryWrapper = new QueryWrapper<>();
-        //queryWrapper.like(StringUtils.hasText(name), "name", name);
-        IPage<SmartDataSourceLog> result = smartDataSourceLogMapper.selectPage(page,queryWrapper);
+        queryWrapper.like(StringUtils.hasText(smartDataSourceLog.getLogActionName()), "log_action_name", smartDataSourceLog.getLogActionName());
+        queryWrapper.like(StringUtils.hasText(smartDataSourceLog.getLogActionHost()), "log_action_host", smartDataSourceLog.getLogActionHost());
+        queryWrapper.like(StringUtils.hasText(smartDataSourceLog.getLogActionPeople()), "log_action_people", smartDataSourceLog.getLogActionPeople());
+        queryWrapper.like(StringUtils.hasText(smartDataSourceLog.getLogActionModule()), "log_action_module", smartDataSourceLog.getLogActionModule());
+        queryWrapper.like(StringUtils.hasText(smartDataSourceLog.getLogActionBusiness()), "log_action_business", smartDataSourceLog.getLogActionBusiness());
+        queryWrapper.like(StringUtils.hasText(smartDataSourceLog.getLogActionRemote()), "log_action_remote", smartDataSourceLog.getLogActionRemote());
+        queryWrapper.like(StringUtils.hasText(smartDataSourceLog.getLogActionClass()), "log_action_class", smartDataSourceLog.getLogActionClass());
+        if (startTime != null && endTime != null) {
+            queryWrapper.between("log_action_create_time", startTime, endTime);
+        }
+        queryWrapper.orderByDesc("log_action_create_time");
+        IPage<SmartDataSourceLog> result = smartDataSourceLogMapper.selectPage(page, queryWrapper);
         return new PageUtils<>(result);
     }
 
-    @Override
-    public int deleteSmartDataSourceLogById(int id) {
-        int result = smartDataSourceLogMapper.deleteById(id);
-        return result;
-    }
+//    @Override
+//    public int deleteSmartDataSourceLogById(int id) {
+//        int result = smartDataSourceLogMapper.deleteById(id);
+//        return result;
+//    }
 
     @Override
     public SmartDataSourceLog getSmartById(int id) {

+ 168 - 12
src/main/java/com/template/services/impl/SmartDataSourceServiceImpl.java

@@ -3,15 +3,25 @@ package com.template.services.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.template.common.utils.CommonUtil;
+import com.template.mapper.SmartDataClassMapper;
 import com.template.mapper.SmartDataSourceMapper;
+import com.template.model.pojo.SmartDataClass;
 import com.template.model.pojo.SmartDataSource;
-import com.template.model.pojo.SmartDataSource;
-import com.template.mapper.SmartDataSourceMapper;
 import com.template.model.result.PageUtils;
 import com.template.services.SmartDataSourceService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.datasource.DriverManagerDataSource;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.List;
+import java.util.Map;
+
+import static org.hibernate.validator.internal.util.Contracts.assertNotNull;
 
 /**
  * <p>
@@ -23,27 +33,137 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class SmartDataSourceServiceImpl extends ServiceImpl<SmartDataSourceMapper, SmartDataSource> implements SmartDataSourceService {
+
     @Autowired
     private SmartDataSourceMapper smartDataSourceMapper;
 
+    @Autowired
+    private SmartDataClassMapper smartDataClassMapper;
+
+    private final static DriverManagerDataSource dataSource = new DriverManagerDataSource();
+
     @Override
-    public int insertSmartDataSource(SmartDataSource sa) {
-        int result = smartDataSourceMapper.insert(sa);
-        return result;
+    public Map<String, Object> insertSmartDataSource(SmartDataSource smartDataSource) {
+        // 检测参数,还有是否存在重复记录
+        if (smartDataSource.getDsClsId() == null) {
+            return CommonUtil.getReturnMap("1", "【数据源类型id】不能为空!");
+        }
+        SmartDataClass smartDataClass = smartDataClassMapper.selectById(smartDataSource.getDsClsId());
+        if (smartDataClass == null) {
+            return CommonUtil.getReturnMap("1", "选择的【数据源类型】不存在!");
+        }
+
+        if (smartDataSource.getDsName() == null) {
+            return CommonUtil.getReturnMap("1", "【数据源名称】不能为空!");
+        }
+        if (smartDataSource.getDsUrl() == null) {
+            return CommonUtil.getReturnMap("1", "【数据源连接地址】不能为空!");
+        }
+        if (smartDataSource.getDsUser() == null) {
+            return CommonUtil.getReturnMap("1", "【数据源用户】不能为空!");
+        }
+        if (smartDataSource.getDsPassword() == null) {
+            return CommonUtil.getReturnMap("1", "【数据源密码】不能为空!");
+        }
+        if (smartDataSource.getDsDescrition() == null) {
+            return CommonUtil.getReturnMap("1", "【数据源描述】不能为空!");
+        }
+
+        QueryWrapper<SmartDataSource> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq(smartDataSource.getDsClsId() != null, "ds_cls_id", smartDataSource.getDsClsId());
+        queryWrapper.eq(StringUtils.hasText(smartDataSource.getDsName()), "ds_name", smartDataSource.getDsName());
+        queryWrapper.like(StringUtils.hasText(smartDataSource.getDsUrl()), "ds_url", smartDataSource.getDsUrl());
+        queryWrapper.eq(StringUtils.hasText(smartDataSource.getDsUser()), "ds_user", smartDataSource.getDsUser());
+        queryWrapper.eq(StringUtils.hasText(smartDataSource.getDsPassword()), "ds_password", smartDataSource.getDsPassword());
+        queryWrapper.eq(smartDataSource.getDsStatus() != null, "ds_status", smartDataSource.getDsStatus());
+        queryWrapper.eq(StringUtils.hasText(smartDataSource.getDsDescrition()), "ds_descrition", smartDataSource.getDsDescrition());
+        List<SmartDataSource> smartDataSources = smartDataSourceMapper.selectList(queryWrapper);
+        if (smartDataSources.size() > 0) {
+            return CommonUtil.getReturnMap("1", "有重复记录!");
+        }
+
+        Map<String, Object> stringObjectMap = vcoSmartDataSource(smartDataSource);
+        if ("1".equals(stringObjectMap.get("code"))) {
+            smartDataSource.setDsStatus(0);
+        } else {
+            smartDataSource.setDsStatus(1);
+        }
+
+        // 必填的参数不为null,则进行新增操作
+        int result = smartDataSourceMapper.insert(smartDataSource);
+        if (result > 0) {
+            return CommonUtil.getReturnMap(String.valueOf(result), "数据源添加成功!");
+        } else {
+            return CommonUtil.getReturnMap(String.valueOf(result), "数据源添加失败!");
+        }
     }
 
     @Override
-    public int updateSmartDataSource(SmartDataSource sa) {
-        int result = smartDataSourceMapper.updateById(sa);
-        return result;
+    public Map<String, Object> updateSmartDataSource(SmartDataSource smartDataSource) {
+        // 检测参数,还有是否存在重复记录
+        if (smartDataSource.getDsId() == null) {
+            return CommonUtil.getReturnMap("0", "【数据源id】不能为空!");
+        }
+        SmartDataSource sdc = smartDataSourceMapper.selectById(smartDataSource.getDsId());
+        if (sdc == null) {
+            return CommonUtil.getReturnMap("0", "要修改的【数据源】不存在!");
+        }
+        // 检测必要参数是否为null
+        if (smartDataSource.getDsClsId() == null) {
+            return CommonUtil.getReturnMap("0", "【数据源类型id】不能为空!");
+        }
+        SmartDataClass smartDataClass = smartDataClassMapper.selectById(smartDataSource.getDsClsId());
+        if (smartDataClass == null) {
+            return CommonUtil.getReturnMap("0", "选择的【数据源类型】不存在!");
+        }
+
+        if (smartDataSource.getDsName() == null) {
+            return CommonUtil.getReturnMap("0", "【数据源名称】不能为空!");
+        }
+        if (smartDataSource.getDsUrl() == null) {
+            return CommonUtil.getReturnMap("0", "【数据源连接地址】不能为空!");
+        }
+        if (smartDataSource.getDsUser() == null) {
+            return CommonUtil.getReturnMap("0", "【数据源用户】不能为空!");
+        }
+        if (smartDataSource.getDsPassword() == null) {
+            return CommonUtil.getReturnMap("0", "【数据源密码】不能为空!");
+        }
+        if (smartDataSource.getDsDescrition() == null) {
+            return CommonUtil.getReturnMap("0", "【数据源描述】不能为空!");
+        }
+        QueryWrapper<SmartDataSource> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq(smartDataSource.getDsId() != null, "ds_id", smartDataSource.getDsId());
+        queryWrapper.eq(smartDataSource.getDsClsId() != null, "ds_cls_id", smartDataSource.getDsClsId());
+        queryWrapper.eq(StringUtils.hasText(smartDataSource.getDsName()), "ds_name", smartDataSource.getDsName());
+        queryWrapper.like(StringUtils.hasText(smartDataSource.getDsUrl()), "ds_url", smartDataSource.getDsUrl());
+        queryWrapper.eq(StringUtils.hasText(smartDataSource.getDsUser()), "ds_user", smartDataSource.getDsUser());
+        queryWrapper.eq(StringUtils.hasText(smartDataSource.getDsPassword()), "ds_password", smartDataSource.getDsPassword());
+        queryWrapper.eq(smartDataSource.getDsStatus() != null, "ds_status", smartDataSource.getDsStatus());
+        queryWrapper.eq(StringUtils.hasText(smartDataSource.getDsDescrition()), "ds_descrition", smartDataSource.getDsDescrition());
+        List<SmartDataSource> smartDataSources = smartDataSourceMapper.selectList(queryWrapper);
+        if (smartDataSources.size() > 0) {
+            return CommonUtil.getReturnMap("0", "数据未修改,请修改后再提交!");
+        }
+
+        int result = smartDataSourceMapper.updateById(smartDataSource);
+        if (result > 0) {
+            return CommonUtil.getReturnMap(String.valueOf(result), "数据源修改成功!");
+        } else {
+            return CommonUtil.getReturnMap(String.valueOf(result), "数据源修改失败!");
+        }
     }
 
     @Override
-    public PageUtils<SmartDataSource> queryPageSmartDataSources(int currentPage, int pageCount, String name) {
+    public PageUtils<SmartDataSource> queryPageSmartDataSources(int currentPage, int pageCount, SmartDataSource smartDataSource) {
         Page<SmartDataSource> page = new Page<>(currentPage, pageCount);
         QueryWrapper<SmartDataSource> queryWrapper = new QueryWrapper<>();
-        //queryWrapper.like(StringUtils.hasText(name), "name", name);
-        IPage<SmartDataSource> result = smartDataSourceMapper.selectPage(page,queryWrapper);
+        queryWrapper.like(StringUtils.hasText(smartDataSource.getDsName()), "ds_name", smartDataSource.getDsName());
+        queryWrapper.like(StringUtils.hasText(smartDataSource.getDsUrl()), "ds_url", smartDataSource.getDsUrl());
+        queryWrapper.like(smartDataSource.getDsStatus() != null, "ds_status", smartDataSource.getDsStatus());
+        queryWrapper.eq(StringUtils.hasText(smartDataSource.getDsDescrition()), "ds_descrition", smartDataSource.getDsDescrition());
+        queryWrapper.orderByDesc("ds_update_time");
+        IPage<SmartDataSource> result = smartDataSourceMapper.selectPage(page, queryWrapper);
         return new PageUtils<>(result);
     }
 
@@ -58,4 +178,40 @@ public class SmartDataSourceServiceImpl extends ServiceImpl<SmartDataSourceMappe
         SmartDataSource result = smartDataSourceMapper.selectById(id);
         return result;
     }
+
+    @Override
+    public Map<String, Object> vcoSmartDataSource(SmartDataSource smartDataSource) {
+        // 设置数据源信息
+        if (smartDataSource.getDsClsId() == null) {
+            return CommonUtil.getReturnMap("1", "【数据源类型id】不能为空!");
+        }
+        SmartDataClass smartDataClass = smartDataClassMapper.selectById(smartDataSource.getDsClsId());
+        if (smartDataClass == null) {
+            return CommonUtil.getReturnMap("1", "选择的【数据源类型】不存在!");
+        }
+
+        String dsClsDriver = smartDataClass.getDsClsDriver();
+        dataSource.setDriverClassName(dsClsDriver);
+        dataSource.setUrl(smartDataSource.getDsUrl());
+        dataSource.setUsername(smartDataSource.getDsUser());
+        dataSource.setPassword(smartDataSource.getDsPassword());
+
+        // 尝试获取数据库连接
+        Connection connection = null;
+        try {
+            connection = dataSource.getConnection();
+            assertNotNull(connection);
+            return CommonUtil.getReturnMap(String.valueOf(0), "连接成功!");
+        } catch (SQLException e) {
+            return CommonUtil.getReturnMap(String.valueOf(1), "连接失败:" + e.getMessage());
+        } finally {
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (SQLException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+    }
 }

+ 321 - 0
src/main/java/com/template/services/impl/SmartDataTaskServiceImpl.java

@@ -0,0 +1,321 @@
+package com.template.services.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.template.common.utils.CommonUtil;
+import com.template.common.utils.QuartzJobUtils;
+import com.template.mapper.SmartDataSourceMapper;
+import com.template.mapper.SmartDataTaskMapper;
+import com.template.model.pojo.SmartDataSource;
+import com.template.model.pojo.SmartDataTask;
+import com.template.model.result.CommonResult;
+import com.template.model.result.PageUtils;
+import com.template.services.SmartDataTaskService;
+import org.quartz.CronExpression;
+import org.quartz.JobKey;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import java.util.*;
+
+/**
+ * <p>
+ * 数据源任务 服务实现类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-05
+ */
+@Service
+public class SmartDataTaskServiceImpl extends ServiceImpl<SmartDataTaskMapper, SmartDataTask> implements SmartDataTaskService {
+
+    @Autowired
+    private SmartDataTaskMapper smartDataTaskMapper;
+
+    @Autowired
+    private SmartDataSourceMapper smartDataSourceMapper;
+
+    @Autowired
+    private Scheduler scheduler;
+
+    @Override
+    public Map<String, Object> insertSmartDataTask(SmartDataTask smartDataTask) {
+        // 检测参数,还有是否存在重复记录
+        if (smartDataTask.getTkName() == null) {
+            return CommonUtil.getReturnMap("0", "【任务名称】不能为空!");
+        }
+        QueryWrapper<SmartDataTask> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq(smartDataTask.getTkName() != null, "tk_name", smartDataTask.getTkName());
+        SmartDataTask sdt = smartDataTaskMapper.selectOne(queryWrapper);
+        if (sdt != null) {
+            return CommonUtil.getReturnMap("0", "任务名有重名!");
+        }
+        // 检测必要参数是否为null
+        if (smartDataTask.getTkDsId() == null) {
+            return CommonUtil.getReturnMap("0", "【数据源id】不能为空!");
+        }
+        SmartDataSource smartDataSource = smartDataSourceMapper.selectById(smartDataTask.getTkDsId());
+        if (smartDataSource == null) {
+            return CommonUtil.getReturnMap("0", "选择的【数据源】不存在!");
+        }
+        if (smartDataTask.getTkCron() == null) {
+            return CommonUtil.getReturnMap("0", "【定时表达式】不能为空!");
+        }
+        if (CronExpression.isValidExpression(smartDataTask.getTkCron())) {
+            return CommonUtil.getReturnMap("0", "【定时表达式】不正确!");
+        }
+        if (smartDataTask.getTkSql() == null) {
+            return CommonUtil.getReturnMap("0", "【任务sql】不能为空!");
+        }
+        if (smartDataTask.getTkDescrition() == null) {
+            return CommonUtil.getReturnMap("0", "【任务描述】不能为空!");
+        }
+        if (smartDataTask.getTkActivation() == null) {
+            return CommonUtil.getReturnMap("0", "【是否启用】不能为空!");
+        }
+        queryWrapper.eq(smartDataTask.getTkDsId() != null, "tk_ds_id", smartDataTask.getTkDsId());
+        queryWrapper.eq(StringUtils.hasText(smartDataTask.getTkCron()), "tk_cron", smartDataTask.getTkCron());
+        queryWrapper.eq(StringUtils.hasText(smartDataTask.getTkSql()), "tk_sql", smartDataTask.getTkSql());
+        queryWrapper.eq(StringUtils.hasText(smartDataTask.getTkDescrition()), "tk_descrition", smartDataTask.getTkDescrition());
+        queryWrapper.eq(smartDataTask.getTkActivation() != null, "tk_activation", smartDataTask.getTkActivation());
+        sdt = smartDataTaskMapper.selectOne(queryWrapper);
+        if (sdt != null) {
+            return CommonUtil.getReturnMap("0", "有重复记录!");
+        }
+
+        int result = smartDataTaskMapper.insert(smartDataTask);
+        if (result > 0) {
+            return CommonUtil.getReturnMap(String.valueOf(result), "任务添加成功!");
+        } else {
+            return CommonUtil.getReturnMap(String.valueOf(result), "任务添加失败!");
+        }
+    }
+
+    @Override
+    public Map<String, Object> updateSmartDataTaskById(SmartDataTask smartDataTask) {
+        if (smartDataTask.getTkId() == null) {
+            return CommonUtil.getReturnMap("0", "【任务id】不能为空!");
+        }
+        if (smartDataTask.getTkName() == null) {
+            return CommonUtil.getReturnMap("0", "【任务名称】不能为空!");
+        }
+        // 检测参数,还有是否存在重复记录
+        List<SmartDataTask> smartDataSources = smartDataTaskMapper.isRepeatTaskName(smartDataTask);
+        if (smartDataSources.size() > 0) {
+            return CommonUtil.getReturnMap("0", "任务名有重名!");
+        }
+        SmartDataTask sdc = smartDataTaskMapper.selectById(smartDataTask.getTkId());
+        if (sdc == null) {
+            return CommonUtil.getReturnMap("0", "要修改的【任务】不存在!");
+        }
+        if (smartDataTask.getTkDsId() == null) {
+            return CommonUtil.getReturnMap("0", "【数据源id】不能为空!");
+        }
+        SmartDataSource smartDataSource = smartDataSourceMapper.selectById(smartDataTask.getTkDsId());
+        if (smartDataSource == null) {
+            return CommonUtil.getReturnMap("0", "选择的【数据源】不存在!");
+        }
+        if (smartDataTask.getTkCron() == null) {
+            return CommonUtil.getReturnMap("0", "【定时表达式】不能为空!");
+        }
+        if (CronExpression.isValidExpression(smartDataTask.getTkCron())) {
+            return CommonUtil.getReturnMap("0", "【定时表达式】不正确!");
+        }
+        if (smartDataTask.getTkSql() == null) {
+            return CommonUtil.getReturnMap("0", "【任务sql】不能为空!");
+        }
+        if (smartDataTask.getTkDescrition() == null) {
+            return CommonUtil.getReturnMap("0", "【任务描述】不能为空!");
+        }
+        if (smartDataTask.getTkActivation() == null) {
+            return CommonUtil.getReturnMap("0", "【是否启动】不能为空!");
+        }
+        QueryWrapper<SmartDataTask> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq(smartDataTask.getTkId() != null, "tk_id", smartDataTask.getTkId());
+        queryWrapper.eq(smartDataTask.getTkDsId() != null, "tk_ds_id", smartDataTask.getTkDsId());
+        queryWrapper.eq(smartDataTask.getTkName() != null, "tk_name", smartDataTask.getTkName());
+        queryWrapper.eq(StringUtils.hasText(smartDataTask.getTkCron()), "tk_cron", smartDataTask.getTkCron());
+        queryWrapper.eq(StringUtils.hasText(smartDataTask.getTkSql()), "tk_sql", smartDataTask.getTkSql());
+        queryWrapper.eq(StringUtils.hasText(smartDataTask.getTkDescrition()), "tk_descrition", smartDataTask.getTkDescrition());
+        queryWrapper.eq(smartDataTask.getTkActivation() != null, "tk_activation", smartDataTask.getTkActivation());
+        SmartDataTask sdt = smartDataTaskMapper.selectOne(queryWrapper);
+        if (sdt != null) {
+            return CommonUtil.getReturnMap("0", "数据未修改,请修改后再提交!");
+        }
+
+        int result = smartDataTaskMapper.updateById(smartDataTask);
+        if (result > 0) {
+            return CommonUtil.getReturnMap(String.valueOf(result), "任务修改成功!");
+        } else {
+            return CommonUtil.getReturnMap(String.valueOf(result), "任务修改失败!");
+        }
+    }
+
+    private Map<String, Object> updateSmartDataTaskActivation(SmartDataTask smartDataTask) {
+        // 检测参数,还有是否存在重复记录
+        if (smartDataTask.getTkId() == null) {
+            return CommonUtil.getReturnMap("0", "【任务id】不能为空!");
+        }
+        SmartDataTask sdc = smartDataTaskMapper.selectById(smartDataTask.getTkId());
+        if (sdc == null) {
+            return CommonUtil.getReturnMap("0", "要修改的【任务】不存在!");
+        }
+        if (smartDataTask.getTkActivation() == null) {
+            return CommonUtil.getReturnMap("0", "【是否启用】不能为空!");
+        }
+
+        int result = smartDataTaskMapper.updateById(smartDataTask);
+        if (result > 0) {
+            return CommonUtil.getReturnMap(String.valueOf(result), "标注成功!");
+        } else {
+            if (smartDataTask.getTkActivation() == 1) {
+                return CommonUtil.getReturnMap(String.valueOf(result), "标注失败,之前已是启用状态!");
+            } else {
+                return CommonUtil.getReturnMap(String.valueOf(result), "标注失败,之前已是启用状态!");
+            }
+        }
+    }
+
+    @Override
+    public PageUtils<SmartDataTask> queryPageSmartDataTasks(int currentPage, int pageCount, SmartDataTask smartDataTask) {
+        Page<SmartDataTask> page = new Page<>(currentPage, pageCount);
+        QueryWrapper<SmartDataTask> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq(smartDataTask.getTkDsId() != null, "tk_ds_id", smartDataTask.getTkDsId());
+        queryWrapper.like(smartDataTask.getTkName() != null, "tk_name", smartDataTask.getTkName());
+        queryWrapper.eq(smartDataTask.getTkActivation() != null, "tk_activation", smartDataTask.getTkActivation());
+        queryWrapper.like(smartDataTask.getTkDescrition() != null, "tk_descrition", smartDataTask.getTkDescrition());
+        queryWrapper.orderByDesc("tk_update_time");
+        IPage<SmartDataTask> result = smartDataTaskMapper.selectPage(page, queryWrapper);
+        return new PageUtils<>(result);
+    }
+
+    @Override
+    public int deleteSmartDataTaskById(int id) {
+        int result = smartDataTaskMapper.deleteById(id);
+        return result;
+    }
+
+    @Override
+    public SmartDataTask getSmartById(int id) {
+        SmartDataTask result = smartDataTaskMapper.selectById(id);
+        return result;
+    }
+
+    private Map<String, Object> TaskNameValidator(SmartDataTask smartDataTask) {
+        if (smartDataTask.getTkName() == null) {
+            return CommonUtil.getReturnMap(String.valueOf(1), "任务名称为空!");
+        }
+        QueryWrapper<SmartDataTask> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq(smartDataTask.getTkName() != null, "tk_name", smartDataTask.getTkName());
+        SmartDataTask smartDataTask_return = smartDataTaskMapper.selectOne(queryWrapper);
+        if (smartDataTask_return == null) {
+            return CommonUtil.getReturnMap(String.valueOf(1), "【" + smartDataTask.getTkName() + "】没有找到!");
+        } else {
+            return CommonUtil.getReturnMap(String.valueOf(0), smartDataTask_return);
+        }
+    }
+
+    @Override
+    public CommonResult createJob(SmartDataTask smartDataTask) {
+        Map<String, Object> tmp_map = TaskNameValidator(smartDataTask);
+        if ("1".equals(tmp_map.get("code"))) {
+            return CommonResult.fail((String) tmp_map.get("msg"));
+        }
+
+        SmartDataTask smartDataTask_return = (SmartDataTask) tmp_map.get("msg");
+        Map<String, Object> returnMap = QuartzJobUtils.createScheduleJob(scheduler, smartDataTask_return);
+        if ("0".equals(returnMap.get("code"))) {
+            smartDataTask.setTkId(smartDataTask_return.getTkId());
+            smartDataTask.setTkActivation(1);
+            Map<String, Object> stringStringMap = updateSmartDataTaskActivation(smartDataTask);
+            String msg;
+            if ("0".equals(stringStringMap.get("code"))) {
+                msg = (String) returnMap.get("msg") + stringStringMap.get("msg");
+            } else {
+                msg = (String) returnMap.get("msg") + stringStringMap.get("msg");
+            }
+            return CommonResult.ok(msg);
+        } else {
+            return CommonResult.fail((String) returnMap.get("msg"));
+        }
+    }
+
+    @Override
+    public CommonResult pauseJob(SmartDataTask smartDataTask) {
+        Map<String, Object> tmp_map = TaskNameValidator(smartDataTask);
+        if ("1".equals(tmp_map.get("code"))) {
+            return CommonResult.fail((String) tmp_map.get("msg"));
+        }
+
+        SmartDataTask smartDataTask_return = (SmartDataTask) tmp_map.get("msg");
+
+        return QuartzJobUtils.pauseScheduleJob(scheduler, smartDataTask_return.getTkName());
+    }
+
+    @Override
+    public CommonResult resumeJob(SmartDataTask smartDataTask) {
+        Map<String, Object> tmp_map = TaskNameValidator(smartDataTask);
+        if ("1".equals(tmp_map.get("code"))) {
+            return CommonResult.fail((String) tmp_map.get("msg"));
+        }
+
+        SmartDataTask smartDataTask_return = (SmartDataTask) tmp_map.get("msg");
+
+        return QuartzJobUtils.resumeScheduleJob(scheduler, smartDataTask_return.getTkName());
+    }
+
+    @Override
+    public CommonResult updateJob(SmartDataTask smartDataTask) {
+        Map<String, Object> tmp_map = TaskNameValidator(smartDataTask);
+        if ("1".equals(tmp_map.get("code"))) {
+            return CommonResult.fail((String) tmp_map.get("msg"));
+        }
+
+        SmartDataTask smartDataTask_return = (SmartDataTask) tmp_map.get("msg");
+
+        return QuartzJobUtils.updateScheduleJob(scheduler, smartDataTask_return);
+    }
+
+    @Override
+    public CommonResult deleteJob(SmartDataTask smartDataTask) {
+        Map<String, Object> tmp_map = TaskNameValidator(smartDataTask);
+        if ("1".equals(tmp_map.get("code"))) {
+            return CommonResult.fail((String) tmp_map.get("msg"));
+        }
+
+        SmartDataTask smartDataTask_return = (SmartDataTask) tmp_map.get("msg");
+
+        Map<String, Object> returnMap = QuartzJobUtils.deleteScheduleJob(scheduler, smartDataTask_return.getTkName());
+        if ("0".equals(returnMap.get("code"))) {
+            smartDataTask.setTkId(smartDataTask_return.getTkId());
+            smartDataTask.setTkActivation(0);
+            Map<String, Object> stringStringMap = updateSmartDataTaskActivation(smartDataTask);
+            String msg;
+            if ("0".equals(stringStringMap.get("code"))) {
+                msg = (String) returnMap.get("msg") + stringStringMap.get("msg");
+            } else {
+                msg = (String) returnMap.get("msg") + stringStringMap.get("msg");
+            }
+            return CommonResult.ok(msg);
+        } else {
+            return CommonResult.fail((String) returnMap.get("msg"));
+        }
+    }
+
+    @Override
+    public CommonResult runOnceJob(SmartDataTask smartDataTask) {
+        Map<String, Object> tmp_map = TaskNameValidator(smartDataTask);
+        if ("1".equals(tmp_map.get("code"))) {
+            return CommonResult.fail((String) tmp_map.get("msg"));
+        }
+
+        SmartDataTask smartDataTask_return = (SmartDataTask) tmp_map.get("msg");
+
+        return QuartzJobUtils.runOnce(scheduler, smartDataTask_return.getTkName());
+    }
+}

+ 0 - 42
target/classes/META-INF/spring-configuration-metadata.json

@@ -1,42 +0,0 @@
-{
-  "groups": [
-    {
-      "name": "tencentcloud",
-      "type": "com.template.config.smsConfig",
-      "sourceType": "com.template.config.smsConfig"
-    }
-  ],
-  "properties": [
-    {
-      "name": "tencentcloud.sdk-appid",
-      "type": "java.lang.String",
-      "sourceType": "com.template.config.smsConfig"
-    },
-    {
-      "name": "tencentcloud.secret-i-d",
-      "type": "java.lang.String",
-      "sourceType": "com.template.config.smsConfig"
-    },
-    {
-      "name": "tencentcloud.secret-key",
-      "type": "java.lang.String",
-      "sourceType": "com.template.config.smsConfig"
-    },
-    {
-      "name": "tencentcloud.sign-name",
-      "type": "java.lang.String",
-      "sourceType": "com.template.config.smsConfig"
-    },
-    {
-      "name": "tencentcloud.sms-min",
-      "type": "java.lang.String",
-      "sourceType": "com.template.config.smsConfig"
-    },
-    {
-      "name": "tencentcloud.template-id",
-      "type": "java.lang.String",
-      "sourceType": "com.template.config.smsConfig"
-    }
-  ],
-  "hints": []
-}

+ 0 - 3
target/maven-archiver/pom.properties

@@ -1,3 +0,0 @@
-artifactId=mybatis_plus
-groupId=com.template
-version=0.0.1-SNAPSHOT

+ 0 - 2
target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst

@@ -1,2 +0,0 @@
-com\template\MybatisPlusApplicationTests.class
-com\template\WrapperTest.class

+ 0 - 2
target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst

@@ -1,2 +0,0 @@
-D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\test\java\com\template\MybatisPlusApplicationTests.java
-D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\test\java\com\template\WrapperTest.java