Browse Source

first commit

dujunlong 7 months ago
commit
07b3646a0c
38 changed files with 2772 additions and 0 deletions
  1. 34 0
      .gitignore
  2. 655 0
      config_api.json
  3. BIN
      lib/common-packet-process-1.0.2-RELEASE.jar
  4. BIN
      lib/dlsc-common-crypto-1.0.0-SNAPSHOT.jar
  5. BIN
      lib/px-common-defense-oauth-client-web-2.4.2-RELEASE.jar
  6. BIN
      lib/px-common-defense-oauth-common-2.4.2-RELEASE.jar
  7. BIN
      lib/sgsm-1.0.jar
  8. 170 0
      pom.xml
  9. 269 0
      src/main/java/cn/dulx/dc/DcApplication.java
  10. 14 0
      src/main/java/cn/dulx/dc/bean/ApiResponse.java
  11. 16 0
      src/main/java/cn/dulx/dc/bean/ApiResponseList.java
  12. 15 0
      src/main/java/cn/dulx/dc/bean/ApiResult.java
  13. 10 0
      src/main/java/cn/dulx/dc/bean/BusinessDate.java
  14. 7 0
      src/main/java/cn/dulx/dc/bean/Callback.java
  15. 31 0
      src/main/java/cn/dulx/dc/config/OAuth2ClientAutoConfiguration.java
  16. 25 0
      src/main/java/cn/dulx/dc/config/RestTemplateConfiguration.java
  17. 10 0
      src/main/java/cn/dulx/dc/constant/GeneratorType.java
  18. 10 0
      src/main/java/cn/dulx/dc/constant/HistoryConfig.java
  19. 14 0
      src/main/java/cn/dulx/dc/constant/InterFaceSleep.java
  20. 76 0
      src/main/java/cn/dulx/dc/constant/Market.java
  21. 6 0
      src/main/java/cn/dulx/dc/constant/MembersType.java
  22. 14 0
      src/main/java/cn/dulx/dc/constant/PeriodType.java
  23. 7 0
      src/main/java/cn/dulx/dc/constant/Signal.java
  24. 6 0
      src/main/java/cn/dulx/dc/constant/UserType.java
  25. 13 0
      src/main/java/cn/dulx/dc/entity/HistoryConfigBean.java
  26. 70 0
      src/main/java/cn/dulx/dc/service/BaseService.java
  27. 160 0
      src/main/java/cn/dulx/dc/service/GeneralService.java
  28. 223 0
      src/main/java/cn/dulx/dc/util/DateTimeUtil.java
  29. 50 0
      src/main/java/cn/dulx/dc/util/EncryptUtil.java
  30. 128 0
      src/main/java/cn/dulx/dc/util/FileOperate.java
  31. 150 0
      src/main/java/cn/dulx/dc/util/GsonUtil.java
  32. 128 0
      src/main/java/cn/dulx/dc/util/HttpUtil.java
  33. 17 0
      src/main/java/cn/dulx/dc/util/IdUtil.java
  34. 22 0
      src/main/java/cn/dulx/dc/util/ReflectUtil.java
  35. 73 0
      src/main/java/cn/dulx/dc/util/StringUtil.java
  36. 43 0
      src/main/resources/application.yml
  37. 242 0
      src/main/resources/logback-spring.xml
  38. 64 0
      src/test/java/cn/dulx/dc/DcApplicationTests.java

+ 34 - 0
.gitignore

@@ -0,0 +1,34 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+yq_dlp.db

+ 655 - 0
config_api.json

@@ -0,0 +1,655 @@
+[
+  {
+    "apiNo": "G127_1",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_ZDFL_TRANS_NUM",
+      "replaceParams": {
+        "targetCode": "LLJK_ZDFL_TRANS_NUM",
+        "replaceParams": [
+          {
+            "paramName": "${sys_code}",
+            "paramValue": "sadasdii"
+          }
+        ]
+      }
+    }
+  },
+  {
+    "apiNo": "G127_2",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_ZDFL_TRANS_NUM",
+      "replaceParams": {
+        "targetCode": "LLJK_ZDFL_TRANS_SUCCESS_RATE",
+        "replaceParams": [
+          {
+            "paramName": "${sys_code}",
+            "paramValue": "sadasdii"
+          }
+        ]
+      }
+    }
+  },
+  {
+    "apiNo": "G127_3",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_ZDFL_TRANS_NUM",
+      "replaceParams": {
+        "targetCode": "LLJK_ZDXT_CHANNEL_STATE",
+        "replaceParams": [
+          {
+            "paramName": "${unify_sys_code}",
+            "paramValue": "sadasdii"
+          }
+        ]
+      }
+    }
+  },
+  {
+    "apiNo": "G127_4",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_ZDFL_TRANS_NUM",
+      "replaceParams": {
+        "targetCode": "LLJK_TASK_001"
+      }
+    }
+  },
+  {
+    "apiNo": "G127_5",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_ZDFL_TRANS_NUM",
+      "replaceParams": {
+        "targetCode": "LLJK_TASK_002"
+      }
+    }
+  },
+  {
+    "apiNo": "G127_6",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_ZDFL_TRANS_NUM",
+      "replaceParams": {
+        "targetCode": "LLJK_TASK_003"
+      }
+    }
+  },
+  {
+    "apiNo": "G127_7",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_ZDFL_TRANS_NUM",
+      "replaceParams": {
+        "targetCode": "LLJK_SYSTEM_OBJECT_001"
+      }
+    }
+  },
+  {
+    "apiNo": "G127_8",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_SYSTEM_OBJECT_002"
+    }
+  },
+  {
+    "apiNo": "G127_9",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_SYSTEM_OBJECT_003"
+    }
+  },
+  {
+    "apiNo": "G127_10",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_LIVE_TASK_COUNT_TODAY"
+    }
+  },
+  {
+    "apiNo": "G127_11",
+    "url": "/commonMonitor/queryTargetData",
+    "param":{
+      "targetCode": "LLJK_TRANS_COUNT_TODAY"
+    }
+  },
+  {
+    "apiNo": "G127_12",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_TRANS_COUNT_TODAY"
+    }
+  },
+  {
+    "apiNo": "G127_13",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_TRANS_COUNT_TODAY"
+    }
+  },
+  {
+    "apiNo": "G127_14",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_TRANS_COUNT_TODAY"
+    }
+  },
+  {
+    "apiNo": "G127_15",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_TRANS_COUNT_TODAY"
+    }
+  },
+  {
+    "apiNo": "G127_16",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_TRANS_SUCCESS_RANK",
+      "replaceParams": [
+        {
+          "paramName": "${format}",
+          "paramValue": "%Y-%m-%d"
+        },
+        {
+          "paramName": "${format_value}",
+          "paramValue": "2024-10-10"
+        },
+        {
+          "paramName": "${type}",
+          "paramValue": "1"
+        }
+      ]
+    }
+  },
+  {
+    "apiNo": "G127_17",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_ZDFL_SEND_SUCCESS_RATE",
+      "replaceParams": [
+        {
+          "paramName": "${sys_code}",
+          "paramValue": "sadasdii"
+        }
+      ]
+    }
+  },
+  {
+    "apiNo": "G127_18",
+    "url": "/commonMonitor/queryTargetData",
+    "param": {
+      "targetCode": "LLJK_ZDFL_RECEIVE_SUCCESS_RATE",
+      "replaceParams": [
+        {
+          "paramName": "${sys_code}",
+          "paramValue": "sadasdii"
+        }
+      ]
+    }
+  },
+
+
+
+
+  {
+    "apiNo": "G128_1",
+    "url": "/px-common-habit/system/info/nacosStatus",
+    "param": {
+    }
+  },
+  {
+    "apiNo": "G128_2",
+    "url": "/px-common-habit/system/info/nacosStatus",
+    "param": {
+    }
+  },
+
+  {
+    "apiNo": "G129_1",
+    "url": "/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_REGISTRY_INTERFACE_NORMALNUM_INNET"
+      },
+      {
+        "targetCode": "YXJK_REGISTRY_INTERFACE_ERRORNUM_INNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G129_2",
+    "url": "/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_NGINX_NODENUM_OUTNET"
+      },
+      {
+        "targetCode": "YXJK_NGINX_NORMALNUM_OUTNET_01"
+      },
+      {
+        "targetCode": "YXJK_NGINX_ERRORNUM_OUTNET_01"
+      },
+      {
+        "targetCode": "YXJK_NGINX_INTERFACE_NORMALNUM_OUTNET"
+      },
+      {
+        "targetCode": "YXJK_NGINX_INTERFACE_ERRORNUM_OUTNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G129_3",
+    "url": "/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_GATEWAY_ALLFLOW_INNET"
+      },
+      {
+        "targetCode": "YXJK_GATEWAY_ALLFLOAD_INNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G129_4",
+    "url": "/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_GATEWAY_ALLFLOW_OUTNET"
+      },
+      {
+        "targetCode": "YXJK_GATEWAY_ALLFLOAD_OUTNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G129_5",
+    "url": "/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_DATABASE_NUM_INNET",
+        "replaceParams": [
+          {
+            "paramName": "${business_name}",
+            "paramValue": "信息发布"
+          }
+        ]
+      },
+      {
+        "targetCode": "YXJK_DATABASE_NORMALNUM_INNET_01",
+        "replaceParams": [
+          {
+            "paramName": "${business_name}",
+            "paramValue": "信息发布"
+          }
+        ]
+      },
+      {
+        "targetCode": "YXJK_DATABASE_ERRORNUM_INNET_01",
+        "replaceParams": [
+          {
+            "paramName": "${business_name}",
+            "paramValue": "信息发布"
+          }
+        ]
+      }
+    ]
+  },
+
+  {
+    "apiNo": "G130_1",
+    "url": "/px-busmonitoraudit-management/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_REGISTRY_INTERFACE_NORMALNUM_OUTNET"
+      },
+      {
+        "targetCode": "YXJK_REGISTRY_INTERFACE_ERRORNUM_OUTNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G130_2",
+    "url": "/px-busmonitoraudit-management/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_BASEMODULE_NORMALNUM_INNET"
+      },
+      {
+        "targetCode": "YXJK_BASEMODULE_ERRORNUM_INNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G130_3",
+    "url": "/px-busmonitoraudit-management/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_KAFKA_INTERFACE_NORMALNUM_INNET"
+      },
+      {
+        "targetCode": "YXJK_KAFKA_INTERFACE_ERRORNUM_INNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G130_4",
+    "url": "/px-busmonitoraudit-management/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_KAFKA_INTERFACE_NORMALNUM_OUTNET"
+      },
+      {
+        "targetCode": "YXJK_KAFKA_INTERFACE_ERRORNUM_OUTNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G130_5",
+    "url": "/px-busmonitoraudit-management/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_REDIS_INTERFACE_NORMALNUM_INNET"
+      },
+      {
+        "targetCode": "YXJK_REDIS_INTERFACE_ERRORNUM_INNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G130_6",
+    "url": "/px-busmonitoraudit-management/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_REDIS_INTERFACE_NORMALNUM_OUTNET"
+      },
+      {
+        "targetCode": "YXJK_REDIS_INTERFACE_ERRORNUM_OUTNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G130_7",
+    "url": "/px-busmonitoraudit-management/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_OSS_INTERFACE_NORMALNUM_INNET"
+      },
+      {
+        "targetCode": "YXJK_OSS_INTERFACE_ERRORNUM_INNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G130_8",
+    "url": "/px-busmonitoraudit-management/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_OSS_INTERFACE_NORMALNUM_OUTNET"
+      },
+      {
+        "targetCode": "YXJK_OSS_INTERFACE_ERRORNUM_OUTNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G130_9",
+    "url": "/px-busmonitoraudit-management/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_ROCKETMQ_INTERFACE_NORMALNUM_INNET"
+      },
+      {
+        "targetCode": "YXJK_ROCKETMQ_INTERFACE_ERRORNUM_INNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G130_10",
+    "url": "/px-busmonitoraudit-management/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_ROCKETMQ_INTERFACE_NORMALNUM_OUTNET"
+      },
+      {
+        "targetCode": "YXJK_ROCKETMQ_INTERFACE_ERRORNUM_OUTNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G130_11",
+    "url": "/px-busmonitoraudit-management/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_ES_INTERFACE_NORMALNUM_INNET"
+      },
+      {
+        "targetCode": "YXJK_ES_INTERFACE_ERRORNUM_INNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G130_12",
+    "url": "/px-busmonitoraudit-management/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_ES_INTERFACE_NUM_INNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G130_13",
+    "url": "/px-busmonitoraudit-management/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_ES_INTERFACE_NORMALNUM_OUTNET"
+      },
+      {
+        "targetCode": "YXJK_ES_INTERFACE_ERRORNUM_OUTNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G130_14",
+    "url": "/px-busmonitoraudit-management/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_ES_INTERFACE_NUM_OUTNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G130_15",
+    "url": "/px-busmonitoraudit-management/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_LOGSTASH_INTERFACE_NORMALNUM_INNET"
+      },
+      {
+        "targetCode": "YXJK_LOGSTASH_INTERFACE_ERRORNUM_INNET"
+      }
+    ]
+  },
+  {
+    "apiNo": "G130_16",
+    "url": "/px-busmonitoraudit-management/commonMonitor/queryTargetDataByCodes",
+    "param": [
+      {
+        "targetCode": "YXJK_LOGSTASH_INTERFACE_NORMALNUM_OUTNET"
+      },
+      {
+        "targetCode": "YXJK_LOGSTASH_INTERFACE_ERRORNUM_OUTNET"
+      }
+    ]
+  },
+
+
+  {
+    "apiNo": "G131",
+    "url": "/pxf-common-static/image/leftIcon/left/基础设置-1.png",
+    "param": {}
+  },
+
+
+  {
+    "apiNo": "G132_1",
+    "url":"/px-common-habit/system/info/gateway/bases",
+    "param":{}
+
+  },
+  {
+    "apiNo": "G132_2",
+    "url":"/px-common-habit/system/info/gateway/bases",
+    "param":{}
+
+  },
+
+  {
+    "apiNo": "G133_1",
+    "url":"/px-common-gateway/px-gateway/systemTime/getSystemTime",
+    "param": {}
+  },
+  {
+    "apiNo": "G133_2",
+    "url":"/px-common-gateway/px-gateway/systemTime/getSystemTime",
+    "param": {}
+  },
+
+
+  {
+    "apiNo": "G134_1",
+    "url":"/BmYxGatewayRealtimeInfos/queryCount",
+    "param": {
+      "networkEnvironment": "1"
+    }
+  },
+  {
+    "apiNo": "G134_2",
+    "url":"/BmYxGatewayRealtimeInfos/queryCount",
+    "param": {
+      "networkEnvironment": "1"
+    }
+  },
+  {
+    "apiNo": "G134_3",
+    "url":"/BmYxGatewayRealtimeInfos/queryCount",
+    "param": {
+      "networkEnvironment": "2"
+    }
+  },
+  {
+    "apiNo": "G134_4",
+    "url":"/BmYxGatewayRealtimeInfos/queryCount",
+    "param": {
+      "networkEnvironment": "2"
+    }
+  },
+
+
+  {
+    "apiNo": "G135_1",
+    "url":"/BmYxMicroserviceRealtimeInfos/queryCount",
+    "param": {
+      "networkEnvironment": "1"
+    }
+  },
+  {
+    "apiNo": "G135_2",
+    "url":"/BmYxMicroserviceRealtimeInfos/queryCount",
+    "param": {
+      "networkEnvironment": "2"
+    }
+  },
+
+  {
+    "apiNo": "G136_1",
+    "url":"/px-basesystem-systemmonitor/queryApplicationsInfo",
+    "param": {
+    }
+  },
+  {
+    "apiNo": "G136_2",
+    "url":"/px-basesystem-systemmonitor/queryApplicationsInfo",
+    "param": {
+    }
+  },
+
+  {
+    "apiNo": "G137_1",
+    "url":"/px-common-monitor/healthCheck/kafkaStatus",
+    "param": {
+    }
+  },
+  {
+    "apiNo": "G137_2",
+    "url":"/px-common-monitor/healthCheck/kafkaStatus",
+    "param": {
+    }
+  },
+
+  {
+    "apiNo": "G138_1",
+    "url":"/px-common-monitor/healthCheck/ossStatus",
+    "param": {
+    }
+  },
+  {
+    "apiNo": "G138_2",
+    "url":"/px-common-monitor/healthCheck/ossStatus",
+    "param": {
+    }
+  },
+
+  {
+    "apiNo": "G139_1",
+    "url":"/px-common-monitor/healthCheck/mqStatus",
+    "param": {
+    }
+  },
+  {
+    "apiNo": "G139_2",
+    "url":"/px-common-monitor/healthCheck/mqStatus",
+    "param": {
+    }
+  },
+
+  {
+    "apiNo": "G140_1",
+    "url":"/px-common-monitor/healthCheck/esStatus",
+    "param": {
+    }
+  },
+  {
+    "apiNo": "G140_2",
+    "url":"/px-common-monitor/healthCheck/esStatus",
+    "param": {
+    }
+  },
+
+  {
+    "apiNo": "G141_1",
+    "url":"/px-common-monitor/healthCheck/logstashStatus",
+    "param": {
+    }
+  },
+  {
+    "apiNo": "G141_2",
+    "url":"/px-common-monitor/healthCheck/logstashStatus",
+    "param": {
+    }
+  },
+
+  {
+    "apiNo": "G142",
+    "url":"/bmMorefieldsQuery/databaseSecondInfo",
+    "param": {
+      "networkEnvironment": "1",
+      "moduleMark": "信息发布"
+    }
+  }
+
+
+
+]

BIN
lib/common-packet-process-1.0.2-RELEASE.jar


BIN
lib/dlsc-common-crypto-1.0.0-SNAPSHOT.jar


BIN
lib/px-common-defense-oauth-client-web-2.4.2-RELEASE.jar


BIN
lib/px-common-defense-oauth-common-2.4.2-RELEASE.jar


BIN
lib/sgsm-1.0.jar


+ 170 - 0
pom.xml

@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.springframework.boot</groupId>
+		<artifactId>spring-boot-starter-parent</artifactId>
+		<version>2.7.3</version>
+		<relativePath/> <!-- lookup parent from repository -->
+	</parent>
+	<groupId>cn.dulx</groupId>
+	<artifactId>dc</artifactId>
+	<version>0.0.1-SNAPSHOT</version>
+	<name>general_query</name>
+	<description>Demo project for Spring Boot</description>
+	<properties>
+		<java.version>1.8</java.version>
+
+		<!-- 开放平台 SDK -->
+		<oauth-client.version>2.4.2-RELEASE</oauth-client.version>
+		<oauth-crypto.version>1.0.0-SNAPSHOT</oauth-crypto.version>
+
+		<!--		开放平台入参加密的包-->
+		<process-client.version>1.0.2-RELEASE</process-client.version>
+		<!--		<encryptor-starter.version>1.7.7-RELEASE</encryptor-starter.version>-->
+		<sgsm.version>1.0</sgsm.version>
+
+		<!-- 开放平台 SDK 依赖的 commons 工具包 -->
+		<commons-codec.version>1.15</commons-codec.version>
+		<commons-lang3.version>3.12.0</commons-lang3.version>
+		<commons-collections4.version>4.4</commons-collections4.version>
+		<commons-io.version>2.11.0</commons-io.version>
+
+		<skipTests>true</skipTests>
+	</properties>
+	<dependencies>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-test</artifactId>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.projectlombok</groupId>
+			<artifactId>lombok</artifactId>
+			<optional>true</optional>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-web</artifactId>
+		</dependency>
+
+		<!--		入参加密所使用的依赖包-->
+		<dependency>
+			<groupId>com.alibaba</groupId>
+			<artifactId>fastjson</artifactId>
+			<version>1.2.83</version>
+		</dependency>
+		<dependency>
+			<groupId>org.bouncycastle</groupId>
+			<artifactId>bcprov-jdk16</artifactId>
+			<version>1.46</version>
+		</dependency>
+
+		<!-- 开放平台 SDK 依赖的 commons 工具包 -->
+		<dependency>
+			<groupId>commons-codec</groupId>
+			<artifactId>commons-codec</artifactId>
+			<version>${commons-codec.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.commons</groupId>
+			<artifactId>commons-lang3</artifactId>
+			<version>${commons-lang3.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.commons</groupId>
+			<artifactId>commons-collections4</artifactId>
+			<version>${commons-collections4.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-io</groupId>
+			<artifactId>commons-io</artifactId>
+			<version>${commons-io.version}</version>
+		</dependency>
+
+		<!-- 开放平台 SDK -->
+		<dependency>
+			<groupId>com.sgcc.dlsc</groupId>
+			<artifactId>px-common-defense-oauth-client-web</artifactId>
+			<version>${oauth-client.version}</version>
+			<scope>system</scope>
+			<systemPath>${pom.basedir}/lib/px-common-defense-oauth-client-web-${oauth-client.version}.jar
+			</systemPath>
+		</dependency>
+		<dependency>
+			<groupId>com.sgcc.dlsc</groupId>
+			<artifactId>px-common-defense-oauth-common</artifactId>
+			<version>${oauth-client.version}</version>
+			<scope>system</scope>
+			<systemPath>${pom.basedir}/lib/px-common-defense-oauth-common-${oauth-client.version}.jar</systemPath>
+		</dependency>
+		<dependency>
+			<groupId>com.sgcc.dlsc</groupId>
+			<artifactId>dlsc-common-crypto</artifactId>
+			<version>${oauth-crypto.version}</version>
+			<scope>system</scope>
+			<systemPath>${pom.basedir}/lib/dlsc-common-crypto-${oauth-crypto.version}.jar</systemPath>
+		</dependency>
+
+		<!--		开放平台入参加密的包-->
+		<dependency>
+			<groupId>com.sgcc.dlsc</groupId>
+			<artifactId>common-packet-process</artifactId>
+			<version>${process-client.version}</version>
+			<scope>system</scope>
+			<systemPath>${pom.basedir}/lib/common-packet-process-${process-client.version}.jar</systemPath>
+		</dependency>
+		<dependency>
+			<groupId>com.sgcc.dlsc</groupId>
+			<artifactId>sgsm</artifactId>
+			<version>${sgsm.version}</version>
+			<scope>system</scope>
+			<systemPath>${pom.basedir}/lib/sgsm-${sgsm.version}.jar</systemPath>
+		</dependency>
+
+		<!--		GSON-->
+		<dependency>
+			<groupId>com.google.code.gson</groupId>
+			<artifactId>gson</artifactId>
+			<version>2.9.1</version>
+		</dependency>
+
+		<!--		Jackson -->
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-databind</artifactId>
+			<version>2.15.2</version>
+		</dependency>
+
+		<dependency>
+			<groupId>com.github.sisyphsu</groupId>
+			<artifactId>dateparser</artifactId>
+			<version>1.0.11</version>
+		</dependency>
+	</dependencies>
+
+
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.springframework.boot</groupId>
+				<artifactId>spring-boot-maven-plugin</artifactId>
+				<configuration>
+					<!--引入外部jar包 并配置  无此项外部jar打包时无法引入包中  -->
+					<includeSystemScope>true</includeSystemScope>
+				</configuration>
+			</plugin>
+		</plugins>
+		<finalName>general_query</finalName>
+	</build>
+
+</project>

+ 269 - 0
src/main/java/cn/dulx/dc/DcApplication.java

@@ -0,0 +1,269 @@
+package cn.dulx.dc;
+
+import cn.dulx.dc.constant.HistoryConfig;
+import cn.dulx.dc.entity.HistoryConfigBean;
+import cn.dulx.dc.service.*;
+import cn.dulx.dc.util.GsonUtil;
+import com.alibaba.fastjson.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.boot.Banner;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.ApplicationContext;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
+import java.time.temporal.ChronoUnit;
+import java.util.*;
+
+@SpringBootApplication
+@Slf4j
+@Component
+public class DcApplication implements CommandLineRunner {
+
+    @Resource
+    private  GeneralService generalService;
+
+    @Resource
+    private ApplicationContext context;
+
+    // 存储配置的成员变量
+    private List<Map<String, Object>> configList;
+
+
+    public static void main(String[] args) {
+        SpringApplication springApplication = new SpringApplication(DcApplication.class);
+        springApplication.setBannerMode(Banner.Mode.OFF);
+        springApplication.run(args);
+    }
+
+    @Override
+    public void run(String... args) throws Exception {
+        // 判断publishTime和当前日期之间相差是否大于指定天数,避免云乔一直用
+        // 设定发布时间为6月12日  更新到8月20日
+        String publishTime = "2024-05-08";
+        LocalDate publishDate = LocalDate.parse(publishTime);
+        LocalDate now = LocalDate.now();
+        if (ChronoUnit.DAYS.between(publishDate, now) > 365) {
+            System.exit(0);
+        }
+
+        System.out.println("=============================");
+        System.out.println("                             ");
+        System.out.println("       SZ通用接口获取工具V1.0  ");
+        System.out.println("           20250106          ");
+        System.out.println("=============================");
+
+        Scanner scanner = new Scanner(System.in);
+        System.out.println("请输入访问密钥: ");
+        String pwd = scanner.nextLine();
+
+        // 形成正确密钥: admin + 当前月日,如admin0531
+        String correctPwd = "admin" + LocalDate.now().format(DateTimeFormatter.ofPattern("MMdd"));
+        if (!pwd.equals(correctPwd)) {
+            System.out.println("密钥错误");
+            exit();
+        }
+
+
+
+        // 读取config_api.json
+        this.initApiConfig();
+
+        boolean validInput = false; // 控制输入,判断输入是否正确,不正确则重新输入
+
+        LocalDate date = null;
+
+        while (!validInput) {
+            System.out.print("请输入查询日期(例如2023-05-07),不输入直接按回车则按接口默认取值日期(昨天、今天、上月、当月)进行查询: ");
+            String input = scanner.nextLine();
+
+            if (!input.equals("")) {
+                DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+                try {
+                    date = LocalDate.parse(input, dateFormatter);
+                    validInput = true;
+                } catch (DateTimeParseException e) {
+                    System.out.println("日期格式错误,请重新输入!");
+                }
+            } else {
+                System.out.println("未输入日期,按接口默认取值日期规则进行查询");
+                validInput = true;
+            }
+        }
+
+        validInput = false;
+        String[] str = new String[0];
+
+        while (!validInput) {
+            System.out.print("请输入接口编号(多个接口编号用英文逗号分隔,例如:127_1,128),不填直接回车则取全部接口:");
+            String inputIds = scanner.nextLine();
+
+            if (inputIds.equals("")) {
+                validInput = true;
+                System.out.println("未输入接口编号,默认取全部接口");
+            } else {
+                try {
+                    validInput = true;
+                    str = inputIds.split(",");
+                } catch (Exception e) {
+                    System.out.println("接口编号格式错误,请重新输入!");
+                }
+//                inputIds = inputIds.replaceAll("\\s+", "");
+//
+//                if (inputIds.matches("\\d+(,\\d+)*")) {
+//                    validInput = true;
+//                    numbers = inputIds.split(",");
+//                } else {
+//                    System.out.println("接口编号格式错误,请重新输入!");
+//                }
+            }
+        }
+
+        validInput = false;
+        String inputFolderName = "";
+
+        while (!validInput) {
+
+            System.out.print("请输入保存的文件夹名,不填直接回车则默认以当前时间命名:");
+            inputFolderName = scanner.nextLine();
+
+            if (inputFolderName.equals("")) {
+                String name = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
+                System.out.println("未输入文件夹名,默认以当前时间命名: " + name);
+                validInput = true;
+                inputFolderName = name;
+            } else {
+                if (!inputFolderName.matches("[<>:\"/\\\\|?*]")) {
+                    validInput = true;
+                } else {
+                    System.out.println("文件名格式错误,请重新输入!");
+                }
+            }
+        }
+
+        List<Map<String, Object>> taskList = new ArrayList<>();
+
+        if (str.length == 0) {
+            // 查询全部接口
+            taskList = configList;
+        } else {
+            for (String number : str) {
+                try {
+                    String api = "G" + number;
+                    taskList.add(getConfigByApiNo(api));
+
+                } catch (Exception e) {
+                    System.out.println("编号为" + number + "的接口不存在");
+                    log.error("编号为" + number + "的接口不存在");
+                }
+            }
+        }
+
+        System.out.println("开始执行...");
+        start(taskList, date, inputFolderName);
+        System.out.println("执行完毕");
+
+        exit();
+    }
+
+    public void exit() {
+        System.out.println("按回车键退出...");
+        Scanner scanner = new Scanner(System.in);
+        scanner.nextLine();
+        System.exit(0);
+    }
+
+
+
+
+
+    public void start(List<Map<String, Object>> taskList, LocalDate date, String folderName) {
+        for (Map<String, Object> api : taskList) {
+            generalService.setUrl(api.get("url").toString());
+            generalService.setApiNo(api.get("apiNo").toString());
+            try {
+                if (date != null) {
+                    DateTimeFormatter formatter;
+                    if (isMonthPeriod(api.get("apiNo").toString())) {
+                        // 格式化date 为 2023-05
+                        formatter = DateTimeFormatter.ofPattern("yyyy-MM");
+                    } else {
+                        // 格式化date 为 2023-05-01
+                        formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+                    }
+                    generalService.exec(date.format(formatter), folderName, generalService.getApiNo(), api.get("param"));
+                } else {
+                    generalService.exec(folderName, generalService.getApiNo(), api.get("param"));
+                }
+            } catch (Exception e) {
+                System.out.println(api.get("apiNo").toString() + " 执行异常, 详情请查看日志");
+                log.error("apiNo: {} 执行异常", api.get("apiNo").toString(), e);
+            }
+        }
+    }
+
+
+
+    public boolean isMonthPeriod(String apiNo) {
+        String[] strArr = new String[] {"G03", "G04", "G08", "G09", "G18", "G19", "G27", "G28", "G29", "G30", "G31", "G36", "G85", "G88", "G89", "G96", "G97", "G98", "G99", "G100", "G107", "G125"};
+        return Arrays.asList(strArr).contains(apiNo);
+    }
+
+
+
+    // 初始化配置方法
+    public void initApiConfig() {
+        try {
+            // 读取 JSON 文件
+            ObjectMapper objectMapper = new ObjectMapper();
+            configList = objectMapper.readValue(
+                    new File("config_api.json"),
+                    List.class
+            );
+            System.out.println("配置已成功加载!");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    // 获得所有接口号
+    public List<String> getAllApiNo() {
+        List<String> apiNos = new ArrayList<>();
+        if (configList != null) {
+            for (Map<String, Object> config : configList) {
+                String apiNo = (String) config.get("apiNo");
+                if (apiNo != null) {
+                    apiNos.add(apiNo);
+                }
+            }
+        }
+        return apiNos;
+    }
+    // 根据 apiNo 查找特定配置的方法
+    public Map<String, Object> getConfigByApiNo(String apiNo) {
+        if (configList == null) {
+            throw new IllegalStateException("配置尚未初始化,请先调用 initApiConfig 方法。");
+        }
+        for (Map<String, Object> config : configList) {
+            if (apiNo.equals(config.get("apiNo"))) {
+                return config;
+            }
+        }
+        return null; // 未找到返回 null
+    }
+}

+ 14 - 0
src/main/java/cn/dulx/dc/bean/ApiResponse.java

@@ -0,0 +1,14 @@
+package cn.dulx.dc.bean;
+
+import lombok.Data;
+
+/**
+ * @author admin
+ */
+@Data
+public class ApiResponse<T> {
+    private int status;
+    private String message;
+    private T data;
+    private boolean success;
+}

+ 16 - 0
src/main/java/cn/dulx/dc/bean/ApiResponseList.java

@@ -0,0 +1,16 @@
+package cn.dulx.dc.bean;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author admin
+ */
+@Data
+public class ApiResponseList<T> {
+    private int status;
+    private String message;
+    private List<T> data;
+    private boolean success;
+}

+ 15 - 0
src/main/java/cn/dulx/dc/bean/ApiResult.java

@@ -0,0 +1,15 @@
+package cn.dulx.dc.bean;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * api返回结果、请求时间、响应时间
+ */
+@Data
+public class ApiResult {
+    private String result;
+    private Date dataRequest;
+    private Date dataResponse;
+}

+ 10 - 0
src/main/java/cn/dulx/dc/bean/BusinessDate.java

@@ -0,0 +1,10 @@
+package cn.dulx.dc.bean;
+
+import lombok.Data;
+
+@Data
+public class BusinessDate {
+    private int year;
+    private int month;
+    private int day;
+}

+ 7 - 0
src/main/java/cn/dulx/dc/bean/Callback.java

@@ -0,0 +1,7 @@
+package cn.dulx.dc.bean;
+
+import java.util.HashMap;
+
+public interface Callback {
+    HashMap<String, Object> call();
+}

+ 31 - 0
src/main/java/cn/dulx/dc/config/OAuth2ClientAutoConfiguration.java

@@ -0,0 +1,31 @@
+package cn.dulx.dc.config;
+
+import com.sgcc.dlsc.defense.oauth.client.resource.OAuth2ProtectedResourceDetails;
+import com.sgcc.dlsc.defense.oauth.client.token.grant.client.ClientCredentialsResourceDetails;
+import com.sgcc.dlsc.defense.oauth.client.web.OAuth2RestTemplate;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * 开放平台 SDK 自动配置类.
+ *
+ * @author DoctorDeng
+ * @version 1.0.0
+ * @date 2022/1/11 13:43
+ */
+@Configuration
+public class OAuth2ClientAutoConfiguration {
+
+	@Bean
+	@ConfigurationProperties("oauth.client")
+	public OAuth2ProtectedResourceDetails clientCredentialsResourceDetails() {
+		return new ClientCredentialsResourceDetails();
+	}
+
+	@Bean(name = "OAuth2RestTemplate")
+	public OAuth2RestTemplate oAuth2RestTemplate() {
+		return new OAuth2RestTemplate(clientCredentialsResourceDetails());
+	}
+
+}

+ 25 - 0
src/main/java/cn/dulx/dc/config/RestTemplateConfiguration.java

@@ -0,0 +1,25 @@
+package cn.dulx.dc.config;
+
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.client.ClientHttpRequestFactory;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.web.client.RestTemplate;
+
+@Configuration
+public class RestTemplateConfiguration {
+
+    @Bean(name = "CommonRestTemplate")
+    public RestTemplate restTemplate(ClientHttpRequestFactory factory){
+        return new RestTemplate(factory);
+    }
+
+    @Bean
+    public ClientHttpRequestFactory simpleClientHttpRequestFactory(){
+        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
+        factory.setConnectTimeout(15000);
+        factory.setReadTimeout(5000);
+        return factory;
+    }
+}

+ 10 - 0
src/main/java/cn/dulx/dc/constant/GeneratorType.java

@@ -0,0 +1,10 @@
+package cn.dulx.dc.constant;
+
+public final class GeneratorType {
+    public static final String HYDRO = "010000";
+    public static final String THERMAL = "020000";
+    public static final String NUCLEAR = "030000";
+    public static final String WIND = "040000";
+    public static final String SOLAR = "050000";
+    public static final String OTHER = "200000";
+}

+ 10 - 0
src/main/java/cn/dulx/dc/constant/HistoryConfig.java

@@ -0,0 +1,10 @@
+package cn.dulx.dc.constant;
+
+public final class HistoryConfig {
+    public static String atcDataVersion = null;
+    public static String atcLineName = null;
+    public static String atcYears = null;
+    public static String atcLineCode = null;
+    public static String atcLineType = null;
+    public static String unit = null;
+}

+ 14 - 0
src/main/java/cn/dulx/dc/constant/InterFaceSleep.java

@@ -0,0 +1,14 @@
+package cn.dulx.dc.constant;
+
+public final class InterFaceSleep {
+    // 每个接口改变入参重新调用该接口取数据时的休眠时长
+    public static final int interfaceSleep = 23;
+    // 云端通用接口发送数据时的休眠时长
+    public static final int cloudSleep = 23;
+    public static final int interfaceSleep1 = 23;
+    public static final int interfaceSleep2 = 23;
+    public static final int interfaceSleep3 = 23;
+    public static final int interfaceSleep4 = 23;
+    public static final int interfaceSleep13 = 23;
+    public static final int interfaceSleep123 = 23;
+}

+ 76 - 0
src/main/java/cn/dulx/dc/constant/Market.java

@@ -0,0 +1,76 @@
+package cn.dulx.dc.constant;
+
+import java.util.Objects;
+
+/**
+ * @author admin
+ */
+
+public enum Market {
+    PDBJL("吉林", "PDBJL"),
+    PDBLJ("黑龙江","PDBLJ"),
+    PDBLN("辽宁", "PDBLN"),
+    PDBMD("蒙东", "PDBMD"),
+    PHBBJ("首都", "PHBBJ"),
+    PHBHB("河北", "PHBHB"),
+    PHBJB("冀北", "PHBJB"),
+    PHBSD("山东", "PHBSD"),
+    PHBTJ("天津", "PHBTJ"),
+    PHDAH("安徽", "PHDAH"),
+    PHDFJ("福建", "PHDFJ"),
+    PHDSH("上海", "PHDSH"),
+    PHDJS("江苏", "PHDJS"),
+    PHZHB("湖北", "PHZHB"),
+    PHZHE("河南", "PHZHE"),
+    PHZHN("湖南", "PHZHN"),
+    PHZJX("江西", "PHZJX"),
+    PSGCC("总部", "PSGCC"),
+    PSGDB("东北", "PSGDB"),
+    PSGHB("华北", "PSGHB"),
+    PSGHD("华东", "PSGHD"),
+    PSGXB("西北", "PSGXB"),
+    PSGXN("西南", "PSGXN"),
+    PXBGS("甘肃", "PXBGS"),
+    PXBNX("宁夏", "PXBNX"),
+    PXBQH("青海", "PXBQH"),
+    PXBSX("陕西", "PXBSX"),
+    PXBXJ("新疆", "PXBXJ"),
+    PXNCQ("重庆", "PXNCQ"),
+    PXNSC("四川", "PXNSC"),
+    PXNXZ("西藏", "PXNXZ"),
+    PHBSX("山西", "PHBSX"),
+    PHDZJ("浙江", "PHDZJ"),
+    PSGHZ("华中", "PSGHZ"),
+    PSGQW("全网", "PSGQW"),
+    PSGSJ("省间", "PSGSJ");
+
+    private final String name;
+    private final String value;
+
+    Market(String name, String value) {
+        this.name = name;
+        this.value = value;
+    }
+
+    @Override
+    public String toString() {
+        return this.value;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public String getValue() {
+        return this.value;
+    }
+
+    public static Market getByValue(String value) {
+        for (Market type : values()) {
+            if (Objects.equals(type.getValue(), value)) {
+                return type;
+            }
+        }
+        return null;
+    }
+}

+ 6 - 0
src/main/java/cn/dulx/dc/constant/MembersType.java

@@ -0,0 +1,6 @@
+package cn.dulx.dc.constant;
+
+public final class MembersType {
+    public static final String PRODUCE = "10";
+    public static final String SOLD = "30";
+}

+ 14 - 0
src/main/java/cn/dulx/dc/constant/PeriodType.java

@@ -0,0 +1,14 @@
+package cn.dulx.dc.constant;
+
+public final class PeriodType {
+    public static final int PER_SECOND = 1; // 1秒
+    public static final int PER_FIVE_SECONDS = 5; // 5秒
+    public static final int PER_TEN_SECONDS = 10; // 10秒
+    public static final int PER_MINUTE = 60; // 1分钟
+    public static final int PER_TWO_MINUTES = 60 * 2; // 2分钟
+    public static final int PER_THREE_MINUTES = 60 * 3; // 3分钟
+    public static final int PER_FIVE_MINUTE = 5 * 60; // 5分钟
+    public static final int DAILY = 60 * 30; // 1小时  临时改30分钟
+    public static final int WEEKLY = 60 * 60 * 24; // 24小时
+    public static final int MONTHLY = 60 * 60 * 1; // 1小时
+}

+ 7 - 0
src/main/java/cn/dulx/dc/constant/Signal.java

@@ -0,0 +1,7 @@
+package cn.dulx.dc.constant;
+
+public class Signal {
+    public static volatile boolean interrupt = false;
+    public static volatile boolean commonServiceRefreshFinished = false;
+    public static volatile boolean realtimeServiceRefreshFinished = false;
+}

+ 6 - 0
src/main/java/cn/dulx/dc/constant/UserType.java

@@ -0,0 +1,6 @@
+package cn.dulx.dc.constant;
+
+public final class UserType {
+    public static final String DIRECT = "1";
+    public static final String RETAIL = "2";
+}

+ 13 - 0
src/main/java/cn/dulx/dc/entity/HistoryConfigBean.java

@@ -0,0 +1,13 @@
+package cn.dulx.dc.entity;
+
+import lombok.Data;
+
+@Data
+public class HistoryConfigBean {
+    private String atcDataVersion;
+    private String atcLineName;
+    private String atcYears;
+    private String atcLineCode;
+    private String atcLineType;
+    private String unit;
+}

+ 70 - 0
src/main/java/cn/dulx/dc/service/BaseService.java

@@ -0,0 +1,70 @@
+package cn.dulx.dc.service;
+
+
+import cn.dulx.dc.bean.ApiResult;
+import cn.dulx.dc.constant.InterFaceSleep;
+import cn.dulx.dc.util.FileOperate;
+import cn.dulx.dc.util.GsonUtil;
+import cn.dulx.dc.util.HttpUtil;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author admin
+ */
+@Service
+@Slf4j
+@Data
+public abstract class BaseService {
+    // 接口名称
+    private String apiNo;
+    // 接口地址
+    private String url;
+
+    // 每个接口改变入参重新调用该接口取数据时的休眠时长
+    private int interfaceSleep = InterFaceSleep.interfaceSleep;
+
+    // 保存json文件的文件夹
+    private String folderName;
+
+    public BaseService() { }
+
+    public abstract HashMap<String, Object> initParam() throws IOException;
+
+    /**
+     * 保存到json文件, 用于查数
+     * @param apiResult 新平台接口返回值
+     * @param param 参数
+     */
+    public void saveToJson(ApiResult apiResult, Map<String, Object> param, String folderName, String filename) throws IOException {
+        FileOperate.writeFile(folderName, filename + "_param.json", GsonUtil.objectToJson(param), false);
+        FileOperate.writeFile(folderName, filename + "_result.json", apiResult.getResult(), false);
+    }
+
+    /**
+     * 执行
+     */
+    public void exec(String folderName, String filename) throws Exception {
+        HashMap<String, Object> map = initParam();
+
+        ApiResult result = HttpUtil.post(getUrl(), map);
+
+        saveToJson(result, map, folderName, filename);
+    }
+
+    public void exec(String date, String folderName, String filename) throws Exception {
+        HashMap<String, Object> map = initParam();
+
+        map.put("date", date);
+
+        ApiResult result = HttpUtil.post(getUrl(), map);
+
+        saveToJson(result, map, folderName, filename);
+    }
+}

+ 160 - 0
src/main/java/cn/dulx/dc/service/GeneralService.java

@@ -0,0 +1,160 @@
+package cn.dulx.dc.service;
+
+
+import cn.dulx.dc.bean.ApiResult;
+import cn.dulx.dc.constant.InterFaceSleep;
+import cn.dulx.dc.util.FileOperate;
+import cn.dulx.dc.util.GsonUtil;
+import cn.dulx.dc.util.HttpUtil;
+
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+
+
+/**
+ * @author admin
+ */
+@Service
+@Slf4j
+@Data
+public class GeneralService {
+    // 接口名称
+    private String apiNo;
+    // 接口地址
+    private String url;
+
+    // 每个接口改变入参重新调用该接口取数据时的休眠时长
+    private int interfaceSleep = InterFaceSleep.interfaceSleep;
+
+    // 保存json文件的文件夹
+    private String folderName;
+
+    public GeneralService() { }
+
+
+    private static final ObjectMapper objectMapper = new ObjectMapper();
+
+    /**
+     * 构造入参
+     *
+     */
+    public static Object initParam(String json) {
+        try {
+            JsonNode rootNode = objectMapper.readTree(json);
+
+            if (rootNode.isObject()) {
+                // 如果是 JSON 对象,转为 Map
+                return objectMapper.convertValue(rootNode, new TypeReference<Map<String, Object>>() {});
+            } else if (rootNode.isArray()) {
+                // 如果是 JSON 数组,转为 List
+                return objectMapper.convertValue(rootNode, new TypeReference<List<Object>>() {});
+            } else {
+                // 如果是其他类型(字符串、数字等)
+                return rootNode.asText();
+            }
+        } catch (Exception e) {
+            throw new RuntimeException("JSON 解析失败: " + e.getMessage(), e);
+        }
+    }
+
+    /**
+     * 保存到json文件, 用于查数
+     * @param apiResult 新平台接口返回值
+     * @param param 参数
+     */
+    public void saveToJson(ApiResult apiResult, Map<String, Object> param, String folderName, String filename) throws IOException {
+        FileOperate.writeFile(folderName, filename + "_param.json", GsonUtil.objectToJson(param), false);
+        FileOperate.writeFile(folderName, filename + "_result.json", apiResult.getResult(), false);
+    }
+
+    /**
+     * 将 List 转换为 JSON 格式并保存
+     * 保存到json文件, 用于查数
+     * @param apiResult 新平台接口返回值
+     * @param param 参数
+     */
+    public void saveToJson(ApiResult apiResult, List<Object> param, String folderName, String filename) throws IOException {
+        FileOperate.writeFile(folderName, filename + "_param.json", GsonUtil.objectToJson(param), false);
+        FileOperate.writeFile(folderName, filename + "_result.json", apiResult.getResult(), false);
+    }
+
+    /**
+     * 用户不输入日期 执行
+     * @param folderName 保存的文件夹名称
+     * @param filename 保存的文件名称
+     * @throws Exception 异常
+     */
+    public void exec(String folderName, String filename, Object param) throws Exception {
+
+        if (param instanceof Map) {
+            // 处理 Map 类型的 param
+            HashMap<String, Object> map = (HashMap<String, Object>) param;
+            ApiResult result = HttpUtil.post(getUrl(), map);
+            saveToJson(result, map, folderName, filename);
+        } else if (param instanceof List) {
+            // 处理 List 类型的 param
+            List<Object> list = (List<Object>) param;
+            ApiResult result = HttpUtil.post(getUrl(), list);
+            saveToJson(result, list, folderName, filename);
+        } else {
+            // 如果不是 Map 或 List,抛出异常
+            throw new IllegalArgumentException("Unsupported param type: " + param.getClass().getName());
+        }
+
+    }
+
+    /**
+     * 用户输入日期 执行
+     * @param date 用户输入的日期
+     * @param folderName 保存的文件夹名称
+     * @param filename 保存的文件名称
+     * @throws Exception 异常
+     */
+    public void exec(String date, String folderName, String filename, Object param) throws Exception {
+        if (param instanceof Map) {
+            // 处理 Map 类型的 param
+            HashMap<String, Object> map = (HashMap<String, Object>) param;
+            // 替换日期参数
+            map.put("date", date);
+            ApiResult result = HttpUtil.post(getUrl(), map);
+            saveToJson(result, map, folderName, filename);
+        } else if (param instanceof List) {
+            // 处理 List 类型的 param
+            List<Object> list = (List<Object>) param;
+            // 替换日期参数
+            for (Object item : list) {
+                if (item instanceof Map) {
+                    ((Map<String, Object>) item).put("date", date);
+                }
+            }
+            ApiResult result = HttpUtil.post(getUrl(), list);
+            saveToJson(result, list, folderName, filename);
+        } else {
+            // 如果不是 Map 或 List,抛出异常
+            throw new IllegalArgumentException("Unsupported param type: " + param.getClass().getName());
+        }
+
+//        HashMap<String, Object> map = initParam(param);
+//
+//        map.put("date", date);
+//
+//        ApiResult result = HttpUtil.post(getUrl(), map);
+//
+//        saveToJson(result, map, folderName, filename);
+    }
+}

+ 223 - 0
src/main/java/cn/dulx/dc/util/DateTimeUtil.java

@@ -0,0 +1,223 @@
+package cn.dulx.dc.util;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.time.Duration;
+import java.time.LocalDateTime;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
+
+public class DateTimeUtil {
+    public static int getCurrentYear() {
+        Calendar calendar = Calendar.getInstance();
+        return calendar.get(Calendar.YEAR);
+    }
+
+    public static int getCurrentMonth() {
+        Calendar calendar = Calendar.getInstance();
+        return calendar.get(Calendar.MONTH) + 1;
+    }
+
+    public static int getCurrentDay() {
+        Calendar calendar = Calendar.getInstance();
+        return calendar.get(Calendar.DAY_OF_MONTH);
+    }
+
+    /**
+     * 增加或减少天数
+     * @param date 起始日期
+     * @param num 天数,增加为正,减少为负
+     * @return 新日期
+     */
+    public static Date addDay(Date date, int num) {
+        Calendar startDT = Calendar.getInstance();
+        startDT.setTime(date);
+        startDT.add(Calendar.DAY_OF_MONTH, num);
+        return startDT.getTime();
+    }
+
+    public static String[] getYearMonth() {
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
+        Calendar calendar = Calendar.getInstance();
+        String dateStr = dateFormat.format(calendar.getTime());
+        return dateStr.split("-");
+    }
+
+    public static String[] getYearLastMonth() {
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1);
+        String dateStr = dateFormat.format(calendar.getTime());
+        return dateStr.split("-");
+    }
+
+    public static String[] getYearLastSpecifiedMonth(int num) {
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - num);
+        String dateStr = dateFormat.format(calendar.getTime());
+        return dateStr.split("-");
+    }
+
+    public static String[] getYearMonthYesterday() {
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.HOUR_OF_DAY, -24);
+        String dateStr = dateFormat.format(calendar.getTime());
+        return dateStr.split("-");
+    }
+
+    public static String[] getYearMonthTwoDaysAgo() {
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.HOUR_OF_DAY, -24 * 2);
+        String dateStr = dateFormat.format(calendar.getTime());
+        return dateStr.split("-");
+    }
+
+    public static String[] getYearMonthToday() {
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Calendar calendar = Calendar.getInstance();
+        String dateStr = dateFormat.format(calendar.getTime());
+        return dateStr.split("-");
+    }
+
+    public static String[] getYearMonthLastSpecifiedDay(int num) {
+        //获取当前日期
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        Date today = new Date();
+        String endDate = sdf.format(today); //当前日期
+        //获取num天前日期
+        Calendar theCa = Calendar.getInstance();
+        theCa.setFirstDayOfWeek(Calendar.MONDAY);
+        theCa.setTime(today);
+        theCa.add(Calendar.DATE, -num); //最后一个数字可改,num天的意思
+        Date start = theCa.getTime();
+        String startDate = sdf.format(start); //三十天之前日期
+        return startDate.split("-");
+    }
+
+    /**
+     * 格式化日期到"年-月-日"格式
+     *
+     * @param date
+     * @return
+     */
+    public static String formatDateToYMD(Date date) {
+        String pattern = "yyyy-MM-dd";
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
+        return simpleDateFormat.format(date);
+    }
+
+    /**
+     * 获取当前日期的周数
+     *
+     * @return
+     */
+    public static String getCurrentWeekDate() {
+//        Date date = new Date();
+//        Calendar cal = Calendar.getInstance();
+//        cal.setFirstDayOfWeek(Calendar.MONDAY);//设置周一为一周的第一天
+//        cal.setTime(date);
+//        int weekNum = cal.get(Calendar.WEEK_OF_YEAR);
+//        int year = cal.get(Calendar.YEAR);
+//
+//        return year + "-W" + String.format("%02d", weekNum);
+
+        Calendar cl = Calendar.getInstance();
+        cl.setTime(new Date());
+        int week = cl.get(Calendar.WEEK_OF_YEAR);
+        cl.add(Calendar.DAY_OF_MONTH, -7);
+        int year = cl.get(Calendar.YEAR);
+        if (week < cl.get(Calendar.WEEK_OF_YEAR)) {
+            year += 1;
+        }
+
+        return year + "-W" + String.format("%02d", week);
+    }
+
+    /**
+     * 获取当前日期上一周的周数
+     *
+     * @return
+     */
+    public static String getLastWeekDate() {
+//        Date date = new Date();
+//        Calendar cal = Calendar.getInstance();
+//        cal.setFirstDayOfWeek(Calendar.MONDAY);
+//        cal.setTime(date);
+//        // -7天
+//        cal.set(Calendar.HOUR_OF_DAY, -24 * 7);
+//        int weekNum = cal.get(Calendar.WEEK_OF_YEAR);
+//        int year = cal.get(Calendar.YEAR);
+//
+//        return year + "-W" + String.format("%02d", weekNum);
+
+        Calendar cl = Calendar.getInstance();
+        cl.setTime(new Date());
+        cl.set(Calendar.HOUR_OF_DAY, -24 * 7);
+        int week = cl.get(Calendar.WEEK_OF_YEAR);
+        cl.add(Calendar.DAY_OF_MONTH, -7);
+        int year = cl.get(Calendar.YEAR);
+        if (week < cl.get(Calendar.WEEK_OF_YEAR)) {
+            year += 1;
+        }
+
+        return year + "-W" + String.format("%02d", week);
+    }
+
+    public static String getLastSpecifiedWeekDate(int num) {
+//        Date date = new Date();
+//        Calendar cal = Calendar.getInstance();
+//        cal.setFirstDayOfWeek(Calendar.MONDAY);
+//        cal.setTime(date);
+//        // -7天
+//        cal.set(Calendar.HOUR_OF_DAY, -24 * 7 * num);
+//        int weekNum = cal.get(Calendar.WEEK_OF_YEAR);
+//        int year = cal.get(Calendar.YEAR);
+//
+//        return year + "-W" + String.format("%02d", weekNum);
+        Calendar cl = Calendar.getInstance();
+        cl.setTime(new Date());
+        cl.set(Calendar.HOUR_OF_DAY, -24 * 7 * num);
+        int week = cl.get(Calendar.WEEK_OF_YEAR);
+        cl.add(Calendar.DAY_OF_MONTH, -7);
+        int year = cl.get(Calendar.YEAR);
+        if (week < cl.get(Calendar.WEEK_OF_YEAR)) {
+            year += 1;
+        }
+
+        return year + "-W" + String.format("%02d", week);
+    }
+
+    public static boolean isMoreThanNDays(Date date1, Date date2, int n) {
+        long diffInMilliseconds = Math.abs(date2.getTime() - date1.getTime());
+        long diffInDays = TimeUnit.MILLISECONDS.toDays(diffInMilliseconds);
+        return diffInDays > n;
+    }
+
+    /**
+     * 获取下一个整点时刻的时间差
+     * @return 分钟
+     */
+    public static long getInitialDelay() {
+        LocalDateTime now = LocalDateTime.now();
+
+        int minute = now.getMinute();
+
+        LocalDateTime nextTime;
+        if (minute < 15) {
+            nextTime = now.withMinute(15).withSecond(0).withNano(0);
+        } else if (minute < 30) {
+            nextTime = now.withMinute(30).withSecond(0).withNano(0);
+        } else if (minute < 45) {
+            nextTime = now.withMinute(45).withSecond(0).withNano(0);
+        } else {
+            nextTime = now.plusHours(1).withMinute(0).withSecond(0).withNano(0);
+        }
+
+        // 计算下一个整点时刻和当前时间的时间差
+        return Duration.between(now, nextTime).toMillis() / 1000 / 60;
+    }
+}

+ 50 - 0
src/main/java/cn/dulx/dc/util/EncryptUtil.java

@@ -0,0 +1,50 @@
+package cn.dulx.dc.util;
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.sgcc.dlsc.packet.encryption.SM2;
+import com.sgcc.dlsc.packet.encryption.SM3;
+import com.sgcc.dlsc.packet.encryption.SM4;
+import com.sgitg.sgcc.sm.SM2Utils;
+import org.bouncycastle.util.Strings;
+import org.bouncycastle.util.encoders.Hex;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class EncryptUtil {
+
+    public static JSONObject getSmValue1(JSONObject param) {
+        String s = JSONObject.toJSONString(param, SerializerFeature.WriteMapNullValue);
+        String sm4Key = new SM4().generateKeyOrIV();
+        Map<String, String> encrypt = new HashMap<>();
+        SM2 sm2 = new SM2();
+        SM3 sm3 = new SM3();
+        SM4 sm4 = new SM4();
+        Map<String, String> map = getSm2Key();
+        String sm3Digest = sm3.SM3Digest(s);
+        String encryptBySM4ECB = sm2.encryptBySM2(s + sm3Digest, map.get("pubKey"));
+        String encryptBySM2 = sm4.encryptBySM4ECB(map.get("priKey"), sm4Key);
+        encrypt.put("sm4", encryptBySM4ECB);
+        encrypt.put("sm2", encryptBySM2);
+        JSONObject result = new JSONObject();
+        result.put("publicKey",sm4Key);
+        result.put("authKey",encrypt);
+        return result;
+    }
+
+    private static Map<String, String> getSm2Key(){
+        Map<String, String> map = new HashMap<String, String>();
+        SM2Utils sm2Utils = new SM2Utils();
+        byte[] bytes = sm2Utils.SG_generateKeyPair();
+        String key = Strings.fromUTF8ByteArray(Hex.encode(bytes));
+        //sm2私钥
+        String priKey = key.substring(0, 64);
+        //sm2公钥
+        String pubKey = key.substring(64);
+        map.put("priKey", priKey);
+        map.put("pubKey", pubKey);
+        return map;
+    }
+
+}

+ 128 - 0
src/main/java/cn/dulx/dc/util/FileOperate.java

@@ -0,0 +1,128 @@
+package cn.dulx.dc.util;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.io.FileSystemResource;
+
+import java.io.*;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Objects;
+
+/**
+ * @author admin
+ */
+public class FileOperate {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(FileOperate.class);
+
+    /**
+     * 写入本地文件
+     *
+     * @param path        文件路径
+     * @param filename    文件名
+     * @param content     内容
+     * @param splitByDate 是否按日期分割文件夹
+     */
+    public static void writeFile(String path, String filename, String content, Boolean splitByDate) throws IOException {
+        if (splitByDate) {
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+
+            // 文件目录 以日期分割
+            path = Paths.get(path, format.format(new Date())).toString();
+        }
+
+        // 若目录不存在,创建目录
+        isFolderExist(path);
+        path = Paths.get(path, filename).toString();
+        isFileExist(path);
+
+        File file = new File(path);
+        if (!file.exists()) {
+            boolean result = file.createNewFile();
+            if (!result) {
+                throw new IOException("结果文件创建失败");
+            }
+        }
+
+        // 写文件
+        FileSystemResource resource = new FileSystemResource(path);
+
+//        FileWriter fileWriter = (new FileWriter(resource.getFile(), false));
+//        fileWriter.write(content);
+//        fileWriter.close();
+
+        BufferedWriter out = new BufferedWriter
+                (new OutputStreamWriter(Files.newOutputStream(Paths.get(resource.getPath())), StandardCharsets.UTF_8));
+        out.write(content);
+        out.close();
+    }
+
+    public static String readJsonFile(String path, String filename) throws IOException {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+
+        // 以日期分割
+        path = Paths.get(path, format.format(new Date())).toString();
+        isFolderExist(path);
+
+        path = Paths.get(path, filename).toString();
+        isFileExist(path);
+
+        FileSystemResource resource = new FileSystemResource(path);
+        InputStreamReader isr = new InputStreamReader(Files.newInputStream(resource.getFile().toPath()), StandardCharsets.UTF_8);
+        BufferedReader reader = new BufferedReader(isr);
+
+        String content = "";
+        StringBuilder builder = new StringBuilder();
+
+        while ((content = reader.readLine()) != null) {
+            builder.append(content);
+        }
+
+        return builder.toString();
+    }
+
+    private static void isFolderExist(String path) throws IOException {
+        File folder = new File(path);
+        if (!folder.exists() && !folder.isDirectory()) {
+            boolean result = folder.mkdirs();
+            if (!result) {
+                throw new IOException("结果文件目录创建失败");
+            }
+        }
+    }
+
+    private static void isFileExist(String path) throws IOException {
+        File file = new File(path);
+        if (!file.exists()) {
+            boolean result = file.createNewFile();
+            if (!result) {
+                throw new IOException("结果文件创建失败");
+            }
+        }
+    }
+
+    /**
+     * 删除某路径下的超过3天的文件
+     * @param path 文件路径
+     */
+    public static void deleteOldFile(String path) {
+        File file = new File(path);
+        File[] tempList = file.listFiles();
+
+        for (int i = 0; i < Objects.requireNonNull(tempList).length; i++) {
+            if (tempList[i].isFile()) {
+                long lastModified = tempList[i].lastModified();
+                Date date = new Date(lastModified);
+
+                if (DateTimeUtil.isMoreThanNDays(new Date(), date, 3)) {
+                    tempList[i].delete();
+                }
+            }
+        }
+    }
+}

+ 150 - 0
src/main/java/cn/dulx/dc/util/GsonUtil.java

@@ -0,0 +1,150 @@
+package cn.dulx.dc.util;
+
+import cn.dulx.dc.bean.ApiResponse;
+import cn.dulx.dc.bean.ApiResponseList;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonObject;
+import com.google.gson.reflect.TypeToken;
+
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Map;
+
+public class GsonUtil {
+    private static final Gson gson;
+
+    static {
+        GsonBuilder gsonBuilder = new GsonBuilder();
+//        // https://blog.csdn.net/qq_24598601/article/details/109444926
+//        gsonBuilder.registerTypeAdapter(Date.class, new CustomDateAdapter(2, 2, Locale.US));
+        // handle 2022-10-26T00:00:00
+//        gsonBuilder.registerTypeAdapter(Date.class, new DateDeserializer01());
+        // handle 2022-10-25
+//        gsonBuilder.registerTypeAdapter(Date.class, new DateDeserializer02());
+        gson = gsonBuilder.create();
+    }
+
+    private GsonUtil() {
+    }
+
+    /**
+     * 对象转成json
+     *
+     * @param object
+     * @return json
+     */
+    public static String objectToJson(Object object) {
+        String json = null;
+        if (gson != null) {
+            json = gson.toJson(object);
+        }
+        return json;
+    }
+
+    /**
+     * string转JsonObject
+     * @param json
+     * @return
+     */
+    public static JsonObject jsonToObject(String json) {
+        if (gson != null) {
+            return gson.fromJson(json, JsonObject.class);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Json转成对象
+     *
+     * @param json
+     * @param cls
+     * @return 对象
+     */
+    public static <T> T gsonToBean(String json, Class<T> cls) {
+        T t = null;
+        if (gson != null) {
+            t = gson.fromJson(json, cls);
+        }
+        return t;
+    }
+
+    /**
+     * json转成list<T>
+     * https://www.cnblogs.com/Marydon20170307/p/16054020.html
+     * 上文有讲解,封装会错误,对于列表从json反序列化成对象,不能按照下面方式封装!!!!杜立新
+     * @param json
+     * @param cls
+     * @return list<T>
+     */
+    //    public static <T> List<T> gsonToList(String json, Class<T> cls) {
+    //        List<T> list = null;
+    //        if (gson != null) {
+    //            list = gson.fromJson(json, new TypeToken<List<T>>() {
+    //            }.getType());
+    //        }
+    //        return list;
+    //    }
+
+    /**
+     * json转成ApiResponse<T>
+     *
+     * @param json
+     * @param cls
+     * @return ApiResponse<T>
+     */
+    public static <T> ApiResponse<T> gsonToApiResponse(String json, Type type) {
+        ApiResponse<T> response = null;
+        if (gson != null) {
+            response = gson.fromJson(json, type);
+        }
+        return response;
+    }
+
+    /**
+     * json转成ApiResponseList<T>
+     *
+     * @param json
+     * @param type
+     * @return ApiResponseList<T>
+     */
+    public static <T> ApiResponseList<T> gsonToApiResponseList(String json, Type type) {
+        ApiResponseList<T> response = null;
+        if (gson != null) {
+            response = gson.fromJson(json, type);
+        }
+        return response;
+    }
+
+
+    /**
+     * json转成list中有map的
+     *
+     * @param json
+     * @return List<Map < String, T>>
+     */
+    public static <T> List<Map<String, T>> gsonToListMaps(String json) {
+        List<Map<String, T>> list = null;
+        if (gson != null) {
+            list = gson.fromJson(json, new TypeToken<List<Map<String, T>>>() {
+            }.getType());
+        }
+        return list;
+    }
+
+    /**
+     * json转成map的
+     *
+     * @param json
+     * @return Map<String, T>
+     */
+    public static <T> Map<String, T> gsonToMaps(String json) {
+        Map<String, T> map = null;
+        if (gson != null) {
+            map = gson.fromJson(json, new TypeToken<Map<String, T>>() {
+            }.getType());
+        }
+        return map;
+    }
+}

+ 128 - 0
src/main/java/cn/dulx/dc/util/HttpUtil.java

@@ -0,0 +1,128 @@
+package cn.dulx.dc.util;
+
+import cn.dulx.dc.bean.ApiResult;
+import cn.dulx.dc.constant.InterFaceSleep;
+import com.sgcc.dlsc.defense.oauth.client.web.OAuth2RestTemplate;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+@Component
+@Slf4j
+public class HttpUtil {
+
+    @Resource(name = "OAuth2RestTemplate")
+    private OAuth2RestTemplate r1;
+
+    @Resource(name = "CommonRestTemplate")
+    private RestTemplate r2;
+
+    @Value("${app.get-token}")
+    private boolean getToken;
+
+    private static String apiHost;
+
+    private static RestTemplate restTemplate;
+
+    @PostConstruct
+    public void init() {
+        if (getToken) {
+            apiHost = "http://pmos.sgcc.com.cn";
+            restTemplate = r1;
+        } else {
+//            apiHost = "http://101.43.241.202:5005";
+//            apiHost = "https://mock.goco.xyz/mock/6305c734a66529001783c208/BPX_MOCK";
+            apiHost = "http://127.0.0.1:5005";
+            restTemplate = r2;
+        }
+    }
+
+    public static ApiResult post(String url, HashMap<String, Object> param) {
+
+        url = apiHost + url;
+
+//        log.info("请求地址: {}, 参数: {}", url, GsonUtil.objectToJson(param));
+
+        Date dataRequest = new Date();
+        ResponseEntity<HashMap> response = restTemplate.postForEntity(url, param, HashMap.class);
+        Date dataResponse = new Date();
+
+        try{
+            Thread.sleep(InterFaceSleep.interfaceSleep);    // 有些接口会改变入参重复调用,因此设置休眠
+        } catch (Exception e) {
+            log.error("重复调用接口时休眠错误");
+        }
+
+//        log.info("响应response: {}, body: {}", GsonUtil.objectToJson(response), GsonUtil.objectToJson(response.getBody()));
+
+        ApiResult apiResult = new ApiResult();
+        apiResult.setResult(GsonUtil.objectToJson(response.getBody()));
+        apiResult.setDataRequest(dataRequest);
+        apiResult.setDataResponse(dataResponse);
+
+        return apiResult;
+    }
+
+    public static ApiResult post(String url, List<Object> param) {
+
+        url = apiHost + url;
+
+//        log.info("请求地址: {}, 参数: {}", url, GsonUtil.objectToJson(param));
+
+        Date dataRequest = new Date();
+        ResponseEntity<HashMap> response = restTemplate.postForEntity(url, param, HashMap.class);
+        Date dataResponse = new Date();
+
+        try{
+            Thread.sleep(InterFaceSleep.interfaceSleep);    // 有些接口会改变入参重复调用,因此设置休眠
+        } catch (Exception e) {
+            log.error("重复调用接口时休眠错误");
+        }
+
+//        log.info("响应response: {}, body: {}", GsonUtil.objectToJson(response), GsonUtil.objectToJson(response.getBody()));
+
+        ApiResult apiResult = new ApiResult();
+        apiResult.setResult(GsonUtil.objectToJson(response.getBody()));
+        apiResult.setDataRequest(dataRequest);
+        apiResult.setDataResponse(dataResponse);
+
+        return apiResult;
+    }
+
+    public static ApiResult get(String url, HashMap<String, Object> param) {
+
+        if (! url.startsWith("http")) {
+            url = apiHost + url;
+        }
+
+
+//        log.info("请求地址: {}, 参数: {}", url, GsonUtil.objectToJson(param));
+
+        Date dataRequest = new Date();
+        ResponseEntity<HashMap> response = restTemplate.getForEntity(url, HashMap.class, param);
+        Date dataResponse = new Date();
+
+        try{
+            Thread.sleep(InterFaceSleep.interfaceSleep);    // 有些接口会改变入参重复调用,因此设置休眠
+        } catch (Exception e) {
+            log.error("重复调用接口时休眠错误");
+        }
+
+//        log.info("响应response: {}, body: {}", GsonUtil.objectToJson(response), GsonUtil.objectToJson(response.getBody()));
+
+        ApiResult apiResult = new ApiResult();
+        apiResult.setResult(GsonUtil.objectToJson(response.getBody()));
+        apiResult.setDataRequest(dataRequest);
+        apiResult.setDataResponse(dataResponse);
+
+        return apiResult;
+    }
+}

+ 17 - 0
src/main/java/cn/dulx/dc/util/IdUtil.java

@@ -0,0 +1,17 @@
+package cn.dulx.dc.util;
+
+import java.util.UUID;
+
+public class IdUtil {
+    public static String simpleUUID(){
+        return UUID.randomUUID().toString().replace("-", "");
+    }
+
+    public static String simpleUUID(boolean hyphen){
+        if (hyphen) {
+            return UUID.randomUUID().toString();
+        } else {
+            return UUID.randomUUID().toString().replace("-", "");
+        }
+    }
+}

+ 22 - 0
src/main/java/cn/dulx/dc/util/ReflectUtil.java

@@ -0,0 +1,22 @@
+package cn.dulx.dc.util;
+
+import java.lang.reflect.Method;
+
+public class ReflectUtil {
+    /**
+     * 参数instance可以随便传需要的对象实例,methodName是类的public方法名
+     * @param instance 对象示例
+     * @param methodName 方法名
+     * @param tClass 返回值类型
+     * @return
+     * @param <T>
+     */
+    public static <T> T getMethodO(Object instance, String methodName, Class<T> tClass) {
+        try {
+            Method get = instance.getClass().getMethod(methodName);
+            return tClass.cast(get.invoke(instance));
+        } catch (Exception e) {
+            return null;
+        }
+    }
+}

+ 73 - 0
src/main/java/cn/dulx/dc/util/StringUtil.java

@@ -0,0 +1,73 @@
+package cn.dulx.dc.util;
+
+import cn.dulx.dc.bean.BusinessDate;
+import com.github.sisyphsu.dateparser.DateParserUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Calendar;
+import java.util.Date;
+
+public class StringUtil {
+    private static final Logger LOGGER = LoggerFactory.getLogger(FileOperate.class);
+
+    //往字符串数组追加新数据
+    public static String[] insert(String[] arr, String str) {
+        int size = arr.length;  //获取数组长度
+        String[] tmp = new String[size + 1];  //新建临时字符串数组,在原来基础上长度加一
+        for (int i = 0; i < size; i++){  //先遍历将原来的字符串数组数据添加到临时字符串数组
+            tmp[i] = arr[i];
+        }
+        tmp[size] = str;  //在最后添加上需要追加的数据
+        return tmp;  //返回拼接完成的字符串数组
+    }
+
+    /**
+     * 解析日期时间字符串,兼容多种日期格式
+     * @param businessDateStr 日期时间字符串
+     * @return BusinessDate对象
+     */
+    public static BusinessDate parseBusinessDate(String businessDateStr) {
+        Calendar c = DateParserUtils.parseCalendar(businessDateStr);
+        BusinessDate businessDate = new BusinessDate();
+        businessDate.setYear(c.get(Calendar.YEAR));
+        businessDate.setMonth(c.get(Calendar.MONTH) + 1);
+        businessDate.setDay(c.get(Calendar.DAY_OF_MONTH));
+        return businessDate;
+    }
+
+    public static String getMD5(String data) {
+        try {
+            byte[] bytesOfMessage = data.getBytes(StandardCharsets.UTF_8);
+
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            byte[] theMD5digest = md.digest(bytesOfMessage);
+
+            return bytesToHex(theMD5digest);
+        } catch (Exception e) {
+            LOGGER.error("{} MD5异常", data, e);
+            return "";
+        }
+    }
+
+    public static String bytesToHex(byte[] bytes) {
+        StringBuilder md5str = new StringBuilder();
+        // 把数组每一字节换成16进制连成md5字符串
+        int digital;
+        for (byte aByte : bytes) {
+            digital = aByte;
+
+            if (digital < 0) {
+                digital += 256;
+            }
+            if (digital < 16) {
+                md5str.append("0");
+            }
+            md5str.append(Integer.toHexString(digital));
+        }
+        return md5str.toString().toUpperCase();
+    }
+}

+ 43 - 0
src/main/resources/application.yml

@@ -0,0 +1,43 @@
+app:
+  get-token: true # 是否获取新平台认证Token
+
+logging:
+  config: classpath:logback-spring.xml
+
+spring:
+  profiles:
+    active: prod
+
+oauth:
+  client:
+    # 应用 ID, 可在开放平台查看.
+    appId: _yhEkh9sbH6AvuzYQcnQz
+    # 应用密钥, 可在开放平台查看.
+    appSecret: WqcSMmOKviENeVfijIARiGAtOayCWAagnFaq
+    # 开放平台获取访问令牌的 URI, 一般将 IP 和 端口修改为新一代电力交易平台地址即可.
+    #    accessTokenUri: http://192.168.206.243:22002/px-common-defense/oauth/token
+    #    accessTokenUri: http://sjnw.natapp1.cc/px-common-defense/oauth/token
+    accessTokenUri: http://pmos.sgcc.com.cn/px-common-defense/oauth/token
+    # SM4 算法 key, 可在开放平台查看.
+    key: a76684aa89074a020a120889cb0e2093
+    # SM4 算法 iv, 可在开放平台查看.
+    iv: 5d7a37a37090101fe29476d7eed34447
+    # SM2 算法私钥, 可在开放平台查看.
+    privateKey: 629c72dcbf87bb3418eadeec8823b4fb062e40548540be09f646157e133d8b6d
+    # SM2 算法公钥, 可在开放平台查看.
+    publicKey: 045930ecf86df3065dc3ca47386310d68cabed17d96b5ff6385e450fa91a7c18466e2d6863af3831f9517a9d971de88c50dc497a1e786ed6b3c20c769eaf45c018
+
+#    # 应用 ID, 可在开放平台查看.
+#    appId: 4qFubeipRvkmHnBMhinRG
+#    # 应用密钥, 可在开放平台查看.
+#    appSecret: cLBeKyvCYQmsUYUyrHWGsXArujmuUvOdpwFd
+#    # 开放平台获取访问令牌的 URI, 一般将 IP 和 端口修改为新一代电力交易平台地址即可.
+#    accessTokenUri: http://pmos.sgcc.com.cn/px-common-defense/oauth/token
+#    # SM4 算法 key, 可在开放平台查看.
+#    key: 1832da35ee605d8da7e585a02802bc73
+#    # SM4 算法 iv, 可在开放平台查看.
+#    iv: 8b2dbc541ec7512f32b90a3b0912db13
+#    # SM2 算法私钥, 可在开放平台查看.
+#    privateKey: 6def518b53a4058978b2a8eb1d84b978e4e189df2cc3b5c3429a5989b8003981
+#    # SM2 算法公钥, 可在开放平台查看.
+#    publicKey: 04122a0074d1687dff8de4120d44a91ba098bbc94a78dd322b564c5ced7b78cec3a41cedd5106e2df8ba6f4f2a32f5a58574d17fd21cfa10f98384e4217106fc9c

+ 242 - 0
src/main/resources/logback-spring.xml

@@ -0,0 +1,242 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+scan : 当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true。
+scanPeriod : 设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。
+debug : 当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。-->
+<configuration scan="true" scanPeriod="60 seconds" debug="false">
+
+    <!-- 日志存放路径 -->
+    <property name="log.path" value="logs" />
+    <!-- 日志输出格式 -->
+    <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
+
+    <!-- 输出到控制台 -->
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+    </appender>
+
+    <!-- 输出到文件 -->
+    <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
+<!--        <file>${log.path}/info.log</file>-->
+        <!-- 循环政策:基于时间创建日志文件 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 日志文件名格式 -->
+            <fileNamePattern>${log.path}/info/info.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern>
+            <!-- 日志最大的历史 30天 -->
+            <maxHistory>30</maxHistory>
+            <cleanHistoryOnStart>false</cleanHistoryOnStart>
+            <timeBasedFileNamingAndTriggeringPolicy
+                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <!--文件达到50MB时会被压缩和切割 -->
+                <maxFileSize>50MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <!-- 过滤的级别 -->
+            <level>INFO</level>
+            <!-- 匹配时的操作:接收(记录) -->
+            <onMatch>ACCEPT</onMatch>
+            <!-- 不匹配时的操作:拒绝(不记录) -->
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <appender name="file_warn" class="ch.qos.logback.core.rolling.RollingFileAppender">
+<!--        <file>${log.path}/warn.log</file>-->
+        <!-- 循环政策:基于时间创建日志文件 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 日志文件名格式 -->
+            <fileNamePattern>${log.path}/warn/warn.%d{yyyy-MM-dd}.log</fileNamePattern>
+            <!-- 日志最大的历史 60天 -->
+            <maxHistory>60</maxHistory>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <!-- 过滤的级别 -->
+            <level>WARN</level>
+            <!-- 匹配时的操作:接收(记录) -->
+            <onMatch>ACCEPT</onMatch>
+            <!-- 不匹配时的操作:拒绝(不记录) -->
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
+<!--        <file>${log.path}/error.log</file>-->
+        <!-- 循环政策:基于时间创建日志文件 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 日志文件名格式 -->
+            <fileNamePattern>${log.path}/error/error.%d{yyyy-MM-dd}.log</fileNamePattern>
+            <!-- 日志最大的历史 60天 -->
+            <maxHistory>60</maxHistory>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <!-- 过滤的级别 -->
+            <level>ERROR</level>
+            <!-- 匹配时的操作:接收(记录) -->
+            <onMatch>ACCEPT</onMatch>
+            <!-- 不匹配时的操作:拒绝(不记录) -->
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!-- 开发环境 -->
+    <springProfile name="dev">
+        <!--  当前项目自己的包,debug级别  -->
+        <logger name="cn.dulx" level="debug" />
+        <!--  spring的日志,warn级别  -->
+        <logger name="org.springframework" level="warn" />
+
+        <!--  其他包,info级别  -->
+        <root level="info">
+            <appender-ref ref="console" />
+        </root>
+    </springProfile>
+
+    <!-- 测试环境+生产环境 -->
+    <springProfile name="test,prod">
+        <!--  当前项目自己的包,info级别  -->
+        <logger name="cn.dulx" level="info" />
+
+        <!--  其他,warn级别      -->
+        <root level="warn">
+            <appender-ref ref="file_info" />
+            <appender-ref ref="file_warn" />
+            <appender-ref ref="file_error" />
+        </root>
+    </springProfile>
+
+</configuration>
+
+<!--<?xml version="1.0" encoding="UTF-8"?>-->
+<!--<configuration scan="true" scanPeriod="60 seconds">-->
+<!--    &lt;!&ndash; 都说spring boot使用日志需要引入这个,但是我引入了之后总是打印两份日志,所以我去除了,并不影响使用 &ndash;&gt;-->
+<!--    &lt;!&ndash; <include resource="org/springframework/boot/logging/logback/base.xml"/> &ndash;&gt;-->
+<!--    &lt;!&ndash; 控制台设置 &ndash;&gt;-->
+<!--    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">-->
+<!--        <encoder>-->
+<!--            <pattern>${CONSOLE_LOG_PATTERN}</pattern>-->
+<!--        </encoder>-->
+<!--    </appender>-->
+<!--    &lt;!&ndash; INFO &ndash;&gt;-->
+<!--    <appender name="infoAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">-->
+<!--        &lt;!&ndash; 文件路径 ,注意LOG_PATH是默认值,-->
+<!--            它的配置对应application.properties里的logging.path值&ndash;&gt;-->
+<!--&lt;!&ndash;        <file>${LOG_PATH}/info/info.log</file>&ndash;&gt;-->
+<!--        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">-->
+<!--            &lt;!&ndash; 文件名称 &ndash;&gt;-->
+<!--            <fileNamePattern>${LOG_PATH}/info/info-%d{yyyy-MM-dd}.log-->
+<!--            </fileNamePattern>-->
+<!--            &lt;!&ndash; 文件最大保存历史数量 &ndash;&gt;-->
+<!--            <MaxHistory>30</MaxHistory>-->
+<!--        </rollingPolicy>-->
+<!--        <encoder>-->
+<!--            <pattern>${FILE_LOG_PATTERN}</pattern>-->
+<!--        </encoder>-->
+<!--        <filter class="ch.qos.logback.classic.filter.LevelFilter">-->
+<!--            <level>INFO</level>-->
+<!--            <onMatch>ACCEPT</onMatch>-->
+<!--            <onMismatch>DENY</onMismatch>-->
+<!--        </filter>-->
+<!--    </appender>-->
+
+<!--    &lt;!&ndash; DEBUG &ndash;&gt;-->
+<!--    <appender name="debugAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">-->
+<!--        &lt;!&ndash; 文件路径 ,注意LOG_PATH是默认值,-->
+<!--            它的配置对应application.properties里的logging.path值&ndash;&gt;-->
+<!--&lt;!&ndash;        <file>${LOG_PATH}/debug/debug.log</file>&ndash;&gt;-->
+<!--        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">-->
+<!--            &lt;!&ndash; 文件名称 &ndash;&gt;-->
+<!--            <fileNamePattern>${LOG_PATH}/debug/debug-%d{yyyy-MM-dd}.log</fileNamePattern>-->
+<!--            &lt;!&ndash; 文件最大保存历史数量 &ndash;&gt;-->
+<!--            <MaxHistory>30</MaxHistory>-->
+<!--        </rollingPolicy>-->
+<!--        <encoder>-->
+<!--            <pattern>${FILE_LOG_PATTERN}</pattern>-->
+<!--        </encoder>-->
+<!--        <filter class="ch.qos.logback.classic.filter.LevelFilter">-->
+<!--            <level>DEBUG</level>-->
+<!--            <onMatch>ACCEPT</onMatch>-->
+<!--            <onMismatch>DENY</onMismatch>-->
+<!--        </filter>-->
+<!--    </appender>-->
+<!--    &lt;!&ndash; WARN &ndash;&gt;-->
+<!--    <appender name="warnAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">-->
+<!--        &lt;!&ndash; 文件路径 ,注意LOG_PATH是默认值,-->
+<!--            它的配置对应application.properties里的logging.path值&ndash;&gt;-->
+<!--&lt;!&ndash;        <file>${LOG_PATH}/warn/warn.log</file>&ndash;&gt;-->
+<!--        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">-->
+<!--            &lt;!&ndash; 文件名称 &ndash;&gt;-->
+<!--            <fileNamePattern>${LOG_PATH}/warn/warn-%d{yyyy-MM-dd}.log-->
+<!--            </fileNamePattern>-->
+<!--            &lt;!&ndash; 文件最大保存历史数量 &ndash;&gt;-->
+<!--            <MaxHistory>30</MaxHistory>-->
+<!--        </rollingPolicy>-->
+<!--        <encoder>-->
+<!--            <pattern>${FILE_LOG_PATTERN}</pattern>-->
+<!--        </encoder>-->
+<!--        <filter class="ch.qos.logback.classic.filter.LevelFilter">-->
+<!--            <level>WARN</level>-->
+<!--            <onMatch>ACCEPT</onMatch>-->
+<!--            <onMismatch>DENY</onMismatch>-->
+<!--        </filter>-->
+<!--    </appender>-->
+
+<!--    &lt;!&ndash; ERROR &ndash;&gt;-->
+<!--    <appender name="errorAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">-->
+<!--        &lt;!&ndash; 文件路径 ,注意LOG_PATH是默认值,-->
+<!--            它的配置对应application.properties里的logging.path值&ndash;&gt;-->
+<!--&lt;!&ndash;        <file>${LOG_PATH}/error/error.log</file>&ndash;&gt;-->
+<!--        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">-->
+<!--            &lt;!&ndash; 文件名称 &ndash;&gt;-->
+<!--            <fileNamePattern>${LOG_PATH}/error/error-%d{yyyy-MM-dd}.log-->
+<!--            </fileNamePattern>-->
+<!--            &lt;!&ndash; 文件最大保存历史数量 &ndash;&gt;-->
+<!--            <MaxHistory>30</MaxHistory>-->
+<!--        </rollingPolicy>-->
+<!--        <encoder>-->
+<!--            <pattern>${FILE_LOG_PATTERN}</pattern>-->
+<!--        </encoder>-->
+<!--        <filter class="ch.qos.logback.classic.filter.LevelFilter">-->
+<!--            <level>ERROR</level>-->
+<!--            <onMatch>ACCEPT</onMatch>-->
+<!--            <onMismatch>DENY</onMismatch>-->
+<!--        </filter>-->
+<!--    </appender>-->
+<!--    <logger name="org.springframework" additivity="false">-->
+<!--        <level value="ERROR" />-->
+<!--        <appender-ref ref="STDOUT" />-->
+<!--        <appender-ref ref="errorAppender" />-->
+<!--    </logger>-->
+
+<!--    &lt;!&ndash; 由于启动的时候,以下两个包下打印debug级别日志很多 ,所以调到ERROR&ndash;&gt;-->
+<!--    <logger name="org.apache.tomcat.util" additivity="false">-->
+<!--        <level value="ERROR"/>-->
+<!--        <appender-ref ref="STDOUT"/>-->
+<!--        <appender-ref ref="errorAppender"/>-->
+<!--    </logger>-->
+
+<!--    &lt;!&ndash; 默认spring boot导入hibernate很多的依赖包,启动的时候,会有hibernate相关的内容,直接去除 &ndash;&gt;-->
+<!--    <logger name="org.hibernate.validator" additivity="false">-->
+<!--        <level value="ERROR"/>-->
+<!--        <appender-ref ref="STDOUT"/>-->
+<!--        <appender-ref ref="errorAppender"/>-->
+<!--    </logger>-->
+<!--    <root level="DEBUG">-->
+<!--        <appender-ref ref="STDOUT"/>-->
+<!--        <appender-ref ref="infoAppender"/>-->
+<!--        <appender-ref ref="debugAppender"/>-->
+<!--        <appender-ref ref="warnAppender"/>-->
+<!--        <appender-ref ref="errorAppender"/>-->
+<!--    </root>-->
+<!--</configuration>-->

+ 64 - 0
src/test/java/cn/dulx/dc/DcApplicationTests.java

@@ -0,0 +1,64 @@
+package cn.dulx.dc;
+
+import cn.dulx.dc.bean.BusinessDate;
+import cn.dulx.dc.util.DateTimeUtil;
+import cn.dulx.dc.util.FileOperate;
+import cn.dulx.dc.util.StringUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.Calendar;
+import java.util.Date;
+
+@SpringBootTest(classes = Test.class)
+@Slf4j
+class DcApplicationTests {
+
+	@Test
+	void contextLoads() {
+	}
+
+
+	@Test
+	void dateTimeTest() {
+//		String[] yearMonth = DateTimeUtil.getYearMonth();
+//		for (String item : yearMonth) {
+//			System.out.println(item);
+//		}
+
+//		System.out.println(DateTimeUtil.getLastWeekDate());
+//		System.out.println(DateTimeUtil.getCurrentWeekDate());
+
+//		System.out.println(DateTimeUtil.getCurrentDay());
+
+//		BusinessDate businessDate = StringUtil.parseBusinessDate("2023-01-02");
+//		System.out.println(businessDate.getYear());
+//		System.out.println(businessDate.getMonth());
+//		System.out.println(businessDate.getDay());
+//
+//		BusinessDate businessDate1 = StringUtil.parseBusinessDate("2023-02");
+//		System.out.println(businessDate1.getYear());
+//		System.out.println(businessDate1.getMonth());
+//		System.out.println(businessDate1.getDay());
+//
+//		BusinessDate businessDate2 = StringUtil.parseBusinessDate("2023-5");
+//		System.out.println(businessDate2.getYear());
+//		System.out.println(businessDate2.getMonth());
+//		System.out.println(businessDate2.getDay());
+//
+//		BusinessDate businessDate3 = StringUtil.parseBusinessDate("2023-02-13T00:00:00");
+//		System.out.println(businessDate3.getYear());
+//		System.out.println(businessDate3.getMonth());
+//		System.out.println(businessDate3.getDay());
+
+//		Date date = new Date();
+//		Calendar cal = Calendar.getInstance();
+//		cal.setFirstDayOfWeek(Calendar.MONDAY);//设置周一为一周的第一天
+//		cal.setTime(date);
+//		int num = cal.get(Calendar.WEEK_OF_YEAR);
+//		System.out.println(num);
+
+		FileOperate.deleteOldFile("datalog");
+	}
+}