15810770710@163.com 3 سال پیش
والد
کامیت
8cb10fc92a
28فایلهای تغییر یافته به همراه2115 افزوده شده و 0 حذف شده
  1. 118 0
      .mvn/wrapper/MavenWrapperDownloader.java
  2. 2 0
      .mvn/wrapper/maven-wrapper.properties
  3. 10 0
      HELP.md
  4. 98 0
      cg-casb.properties
  5. 0 0
      logs/error/error.log
  6. 79 0
      logs/source/source.log
  7. 310 0
      mvnw
  8. 182 0
      mvnw.cmd
  9. 199 0
      pom.xml
  10. 13 0
      src/main/java/com/jkcredit/traffic/record/TrafficRecordApplication.java
  11. 32 0
      src/main/java/com/jkcredit/traffic/record/action/TrafficRecordsAction.java
  12. 33 0
      src/main/java/com/jkcredit/traffic/record/config/SparkSessionConfig.java
  13. 40 0
      src/main/java/com/jkcredit/traffic/record/config/ThreadPoolConfig.java
  14. 15 0
      src/main/java/com/jkcredit/traffic/record/constant/CommonConstant.java
  15. 35 0
      src/main/java/com/jkcredit/traffic/record/model/CommonResponseObject.java
  16. 35 0
      src/main/java/com/jkcredit/traffic/record/model/MonthResult.java
  17. 16 0
      src/main/java/com/jkcredit/traffic/record/service/TrafficRecordsAnalyseService.java
  18. 87 0
      src/main/java/com/jkcredit/traffic/record/service/TrafficRecordsAnalyseServiceImpl.java
  19. 228 0
      src/main/java/com/jkcredit/traffic/record/test/AsyncPushTask.java
  20. 125 0
      src/main/java/com/jkcredit/traffic/record/test/CipherSuiteUtilsTest.java
  21. 84 0
      src/main/java/com/jkcredit/traffic/record/test/SparkTool.java
  22. 42 0
      src/main/java/com/jkcredit/traffic/record/test/Test.java
  23. 63 0
      src/main/java/com/jkcredit/traffic/record/util/CsvUtil.java
  24. 160 0
      src/main/java/com/jkcredit/traffic/record/util/DivideDataUtil.java
  25. 25 0
      src/main/java/com/jkcredit/traffic/record/util/FileUtil.java
  26. 22 0
      src/main/resources/application.yml
  27. BIN
      src/main/resources/lib/cipher-suite-jni-release-2.2.18.jar
  28. 62 0
      src/main/resources/logback-spring.xml

+ 118 - 0
.mvn/wrapper/MavenWrapperDownloader.java

@@ -0,0 +1,118 @@
+/*
+ * Copyright 2007-present the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.net.*;
+import java.io.*;
+import java.nio.channels.*;
+import java.util.Properties;
+
+public class MavenWrapperDownloader {
+
+    private static final String WRAPPER_VERSION = "0.5.6";
+    /**
+     * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
+     */
+    private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+            + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
+
+    /**
+     * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
+     * use instead of the default one.
+     */
+    private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
+            ".mvn/wrapper/maven-wrapper.properties";
+
+    /**
+     * Path where the maven-wrapper.jar will be saved to.
+     */
+    private static final String MAVEN_WRAPPER_JAR_PATH =
+            ".mvn/wrapper/maven-wrapper.jar";
+
+    /**
+     * Name of the property which should be used to override the default download url for the wrapper.
+     */
+    private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
+
+    public static void main(String args[]) {
+        System.out.println("- Downloader started");
+        File baseDirectory = new File(args[0]);
+        System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
+
+        // If the maven-wrapper.properties exists, read it and check if it contains a custom
+        // wrapperUrl parameter.
+        File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
+        String url = DEFAULT_DOWNLOAD_URL;
+        if (mavenWrapperPropertyFile.exists()) {
+            FileInputStream mavenWrapperPropertyFileInputStream = null;
+            try {
+                mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
+                Properties mavenWrapperProperties = new Properties();
+                mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
+                url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
+            } catch (IOException e) {
+                System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
+            } finally {
+                try {
+                    if (mavenWrapperPropertyFileInputStream != null) {
+                        mavenWrapperPropertyFileInputStream.close();
+                    }
+                } catch (IOException e) {
+                    // Ignore ...
+                }
+            }
+        }
+        System.out.println("- Downloading from: " + url);
+
+        File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
+        if (!outputFile.getParentFile().exists()) {
+            if (!outputFile.getParentFile().mkdirs()) {
+                System.out.println(
+                        "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
+            }
+        }
+        System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
+        try {
+            downloadFileFromURL(url, outputFile);
+            System.out.println("Done");
+            System.exit(0);
+        } catch (Throwable e) {
+            System.out.println("- Error downloading");
+            e.printStackTrace();
+            System.exit(1);
+        }
+    }
+
+    private static void downloadFileFromURL(String urlString, File destination) throws Exception {
+        if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
+            String username = System.getenv("MVNW_USERNAME");
+            char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
+            Authenticator.setDefault(new Authenticator() {
+                @Override
+                protected PasswordAuthentication getPasswordAuthentication() {
+                    return new PasswordAuthentication(username, password);
+                }
+            });
+        }
+        URL website = new URL(urlString);
+        ReadableByteChannel rbc;
+        rbc = Channels.newChannel(website.openStream());
+        FileOutputStream fos = new FileOutputStream(destination);
+        fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+        fos.close();
+        rbc.close();
+    }
+
+}

+ 2 - 0
.mvn/wrapper/maven-wrapper.properties

@@ -0,0 +1,2 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

+ 10 - 0
HELP.md

@@ -0,0 +1,10 @@
+# Getting Started
+
+### Reference Documentation
+For further reference, please consider the following sections:
+
+* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
+* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.5.0/maven-plugin/reference/html/)
+* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.5.0/maven-plugin/reference/html/#build-image)
+* [Spring Data Elasticsearch (Access+Driver)](https://docs.spring.io/spring-boot/docs/2.5.0/reference/htmlsingle/#boot-features-elasticsearch)
+

+ 98 - 0
cg-casb.properties

@@ -0,0 +1,98 @@
+# 插件名称
+SDK_NAME=AOEClient-V1.1.14-1602657903071
+SDK_ID=1316268763997278209
+
+# 插件版本
+VERSION=V1.1.14
+
+#协议http/https
+PROTOCOL=https
+
+# 服务端IP
+HOST=10.254.8.16
+
+# 服务端端口
+PORT=443
+
+# TOKEN获取地址
+UIM_TOKEN_PATH=/uim/v1/token
+
+# 密管平台派生接口地址
+KMS_SDK_DERIVE_PATH=/kms/v1/sdk/derive
+
+# 策略服务地址
+SEM_AOE_PATH=/sem/v1/aoe
+
+# 插件用户名
+USER_NAME=1316268763997278209
+
+# 插件用户密码
+USER_SECRET=WOpxP2V7E8glo6UO0xNhabOy+5U9BCkfCcSvWdZEw2F3tOf+6acwSt+h48K+3GDM
+
+# 证书名称
+CERTIFICATE_NAME=1602657903664_795246d73fb875a5409a7db0446dff4d.p12
+
+# 证书密码
+CERTIFICATE_SECRET=1EZNhlsshVJ72txupKZQu0lkUTgXnF5EUSL0E209ycBkjHXHe6bR8HM7Wx7yyPos
+
+
+# 驱动列表
+DRIVER_LIST=
+
+# KMS模式
+KMS_OPTIONS=1
+
+# 是否开启密钥缓存
+CACHE_SWITCH=on
+
+# 密钥缓存数
+CACHE_KEY_NUM=50.0
+
+# 密钥使用次数,超过次数后更新此密钥
+ENCRYPT_KEY_COUNT=0
+
+# 加密密钥使用时间,单位:秒,超过时间后更新此密钥
+ENCRYPT_KEY_EXPIRE=0
+
+# 解密密钥使用时间,单位:秒,超过时间后更新此密钥
+DECRYPT_KEY_EXPIRE=0
+
+# 策略轮询周期
+STRATEGY_PERIOD=180
+
+# BATCH_SIZE代表小组分组的记录数
+BATCH_SIZE=50000
+
+# mongo代理目标IP
+MONGODB_IP=
+
+# mongo数据源获取地址
+MONGODB_INFO_PATH=/sem/v1/proxy/list-mongo-db
+
+# mongo策略获取地址
+MONGODB_STRATEGY_PATH=/sem/v1/proxy/list-mongo-strategy
+
+# mongo Netty proxy 数量
+MONGODB_PROXY_SERVICE_NUM=16
+
+# mongo 定时更新所有策略,单位毫秒,默认60秒
+MONGODB_UPDATE_STRATEGY_INTERVAL=20000
+
+#linux版本库名称
+LINUX_LIB_NAME=libCSCipherJNI-release-2.2.7.so
+
+#windows版本库名称
+WIN_LIB_NAME=libCSCipherJNI-release-2.2.7.dll
+
+#sdk日志级别
+CS_LOG_FLAG=2
+
+# 日志路径
+LOG_PATH=/home/jkxy-01/services/casb/logs/1316268763997278209
+
+# SDK根目录
+SDK_BASE_PATH=/home/jkxy-01/services/casb/CipherSuiteSdk_linux
+
+# 插件根目录
+AOE_BASE_PATH=
+

+ 0 - 0
logs/error/error.log


+ 79 - 0
logs/source/source.log

@@ -0,0 +1,79 @@
+2021-07-29 14:27:35,323 [main] INFO  [c.jkcredit.traffic.record.TrafficRecordApplication] StartupInfoLogger.java:55 - Starting TrafficRecordApplication using Java 1.8.0_281 on xusonglindeiMac.local with PID 62375 (/Users/jkxy/Desktop/project/traffic-record/target/classes started by jkxy in /Users/jkxy/Desktop/project/traffic-record)
+2021-07-29 14:27:35,333 [main] INFO  [c.jkcredit.traffic.record.TrafficRecordApplication] SpringApplication.java:660 - No active profile set, falling back to default profiles: default
+2021-07-29 14:27:36,472 [main] INFO  [o.s.boot.web.embedded.tomcat.TomcatWebServer] TomcatWebServer.java:108 - Tomcat initialized with port(s): 28081 (http)
+2021-07-29 14:27:36,484 [main] INFO  [org.apache.coyote.http11.Http11NioProtocol] DirectJDKLog.java:173 - Initializing ProtocolHandler ["http-nio-28081"]
+2021-07-29 14:27:36,485 [main] INFO  [org.apache.catalina.core.StandardService] DirectJDKLog.java:173 - Starting service [Tomcat]
+2021-07-29 14:27:36,485 [main] INFO  [org.apache.catalina.core.StandardEngine] DirectJDKLog.java:173 - Starting Servlet engine: [Apache Tomcat/9.0.39]
+2021-07-29 14:27:36,608 [main] INFO  [o.a.c.core.ContainerBase.[Tomcat].[localhost].[/]] DirectJDKLog.java:173 - Initializing Spring embedded WebApplicationContext
+2021-07-29 14:27:36,608 [main] INFO  [o.s.b.w.s.c.ServletWebServerApplicationContext] ServletWebServerApplicationContext.java:289 - Root WebApplicationContext: initialization completed in 1116 ms
+2021-07-29 14:27:40,173 [main] INFO  [org.apache.spark.SparkContext] Logging.scala:54 - Running Spark version 2.3.1
+2021-07-29 14:27:40,400 [main] INFO  [org.apache.spark.SparkContext] Logging.scala:54 - Submitted application: DataExtract
+2021-07-29 14:27:40,499 [main] INFO  [org.apache.spark.SecurityManager] Logging.scala:54 - Changing view acls to: jkxy
+2021-07-29 14:27:40,500 [main] INFO  [org.apache.spark.SecurityManager] Logging.scala:54 - Changing modify acls to: jkxy
+2021-07-29 14:27:40,501 [main] INFO  [org.apache.spark.SecurityManager] Logging.scala:54 - Changing view acls groups to: 
+2021-07-29 14:27:40,502 [main] INFO  [org.apache.spark.SecurityManager] Logging.scala:54 - Changing modify acls groups to: 
+2021-07-29 14:27:40,503 [main] INFO  [org.apache.spark.SecurityManager] Logging.scala:54 - SecurityManager: authentication disabled; ui acls disabled; users  with view permissions: Set(jkxy); groups with view permissions: Set(); users  with modify permissions: Set(jkxy); groups with modify permissions: Set()
+2021-07-29 14:27:40,748 [main] INFO  [org.apache.spark.util.Utils] Logging.scala:54 - Successfully started service 'sparkDriver' on port 53509.
+2021-07-29 14:27:40,767 [main] INFO  [org.apache.spark.SparkEnv] Logging.scala:54 - Registering MapOutputTracker
+2021-07-29 14:27:40,786 [main] INFO  [org.apache.spark.SparkEnv] Logging.scala:54 - Registering BlockManagerMaster
+2021-07-29 14:27:40,789 [main] INFO  [o.apache.spark.storage.BlockManagerMasterEndpoint] Logging.scala:54 - Using org.apache.spark.storage.DefaultTopologyMapper for getting topology information
+2021-07-29 14:27:40,790 [main] INFO  [o.apache.spark.storage.BlockManagerMasterEndpoint] Logging.scala:54 - BlockManagerMasterEndpoint up
+2021-07-29 14:27:40,797 [main] INFO  [org.apache.spark.storage.DiskBlockManager] Logging.scala:54 - Created local directory at /private/var/folders/29/x4tp3v8j7md8dtgsqxqzxgh00000gn/T/blockmgr-f46729b5-3407-4370-8fe3-b3c6184e6fcb
+2021-07-29 14:27:40,821 [main] INFO  [org.apache.spark.storage.memory.MemoryStore] Logging.scala:54 - MemoryStore started with capacity 3.0 GB
+2021-07-29 14:27:40,835 [main] INFO  [org.apache.spark.SparkEnv] Logging.scala:54 - Registering OutputCommitCoordinator
+2021-07-29 14:27:40,903 [main] INFO  [org.spark_project.jetty.util.log] Log.java:192 - Logging initialized @6894ms
+2021-07-29 14:27:40,965 [main] INFO  [org.spark_project.jetty.server.Server] Server.java:346 - jetty-9.3.z-SNAPSHOT
+2021-07-29 14:27:40,980 [main] INFO  [org.spark_project.jetty.server.Server] Server.java:414 - Started @6972ms
+2021-07-29 14:27:40,999 [main] INFO  [org.spark_project.jetty.server.AbstractConnector] AbstractConnector.java:278 - Started ServerConnector@489e47f7{HTTP/1.1,[http/1.1]}{0.0.0.0:4040}
+2021-07-29 14:27:41,000 [main] INFO  [org.apache.spark.util.Utils] Logging.scala:54 - Successfully started service 'SparkUI' on port 4040.
+2021-07-29 14:27:41,017 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@49f40c00{/jobs,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,018 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@4b31a708{/jobs/json,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,019 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@11e355ca{/jobs/job,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,020 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@e11ecfa{/jobs/job/json,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,020 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@485e13d7{/stages,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,021 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@43984213{/stages/json,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,022 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@2ff7a73{/stages/stage,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,023 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@3a790e40{/stages/stage/json,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,024 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@43acd79e{/stages/pool,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,024 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@1e1b061{/stages/pool/json,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,025 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@38f77cd9{/storage,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,026 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@4a8e6e89{/storage/json,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,026 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@6fbb4061{/storage/rdd,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,027 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@63d5874f{/storage/rdd/json,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,027 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@60c73e58{/environment,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,028 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@5984feef{/environment/json,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,028 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@6c0905f6{/executors,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,029 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@23a918c7{/executors/json,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,030 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@7a45d714{/executors/threadDump,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,030 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@4483d35{/executors/threadDump/json,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,036 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@204abeff{/static,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,036 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@3ebe4ccc{/,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,038 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@6ed043d3{/api,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,039 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@44af588b{/jobs/job/kill,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,040 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@3d19d85{/stages/stage/kill,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,042 [main] INFO  [org.apache.spark.ui.SparkUI] Logging.scala:54 - Bound SparkUI to 0.0.0.0, and started at http://192.168.50.155:4040
+2021-07-29 14:27:41,138 [main] INFO  [org.apache.spark.executor.Executor] Logging.scala:54 - Starting executor ID driver on host localhost
+2021-07-29 14:27:41,161 [main] INFO  [org.apache.spark.util.Utils] Logging.scala:54 - Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 53510.
+2021-07-29 14:27:41,161 [main] INFO  [o.a.spark.network.netty.NettyBlockTransferService] Logging.scala:54 - Server created on 192.168.50.155:53510
+2021-07-29 14:27:41,163 [main] INFO  [org.apache.spark.storage.BlockManager] Logging.scala:54 - Using org.apache.spark.storage.RandomBlockReplicationPolicy for block replication policy
+2021-07-29 14:27:41,194 [main] INFO  [org.apache.spark.storage.BlockManagerMaster] Logging.scala:54 - Registering BlockManager BlockManagerId(driver, 192.168.50.155, 53510, None)
+2021-07-29 14:27:41,199 [dispatcher-event-loop-0] INFO  [o.apache.spark.storage.BlockManagerMasterEndpoint] Logging.scala:54 - Registering block manager 192.168.50.155:53510 with 3.0 GB RAM, BlockManagerId(driver, 192.168.50.155, 53510, None)
+2021-07-29 14:27:41,201 [main] INFO  [org.apache.spark.storage.BlockManagerMaster] Logging.scala:54 - Registered BlockManager BlockManagerId(driver, 192.168.50.155, 53510, None)
+2021-07-29 14:27:41,202 [main] INFO  [org.apache.spark.storage.BlockManager] Logging.scala:54 - Initialized BlockManager: BlockManagerId(driver, 192.168.50.155, 53510, None)
+2021-07-29 14:27:41,215 [main] INFO  [o.s.jetty.server.handler.ContextHandler] ContextHandler.java:781 - Started o.s.j.s.ServletContextHandler@56e9a474{/metrics/json,null,AVAILABLE,@Spark}
+2021-07-29 14:27:41,452 [main] INFO  [org.apache.spark.scheduler.EventLoggingListener] Logging.scala:54 - Logging events to file:/tmp/spark-events/local-1627540061122
+2021-07-29 14:27:42,139 [main] INFO  [org.apache.coyote.http11.Http11NioProtocol] DirectJDKLog.java:173 - Starting ProtocolHandler ["http-nio-28081"]
+2021-07-29 14:27:42,149 [main] INFO  [o.s.boot.web.embedded.tomcat.TomcatWebServer] TomcatWebServer.java:220 - Tomcat started on port(s): 28081 (http) with context path ''
+2021-07-29 14:27:42,158 [main] INFO  [c.jkcredit.traffic.record.TrafficRecordApplication] StartupInfoLogger.java:61 - Started TrafficRecordApplication in 7.523 seconds (JVM running for 8.15)
+2021-07-29 14:28:10,630 [Thread-14] INFO  [org.apache.spark.SparkContext] Logging.scala:54 - Invoking stop() from shutdown hook
+2021-07-29 14:28:10,643 [Thread-14] INFO  [org.spark_project.jetty.server.AbstractConnector] AbstractConnector.java:318 - Stopped Spark@489e47f7{HTTP/1.1,[http/1.1]}{0.0.0.0:4040}
+2021-07-29 14:28:10,645 [Thread-14] INFO  [org.apache.spark.ui.SparkUI] Logging.scala:54 - Stopped Spark web UI at http://192.168.50.155:4040
+2021-07-29 14:28:10,657 [dispatcher-event-loop-0] INFO  [org.apache.spark.MapOutputTrackerMasterEndpoint] Logging.scala:54 - MapOutputTrackerMasterEndpoint stopped!
+2021-07-29 14:28:10,664 [Thread-14] INFO  [org.apache.spark.storage.memory.MemoryStore] Logging.scala:54 - MemoryStore cleared
+2021-07-29 14:28:10,665 [Thread-14] INFO  [org.apache.spark.storage.BlockManager] Logging.scala:54 - BlockManager stopped
+2021-07-29 14:28:10,665 [Thread-14] INFO  [org.apache.spark.storage.BlockManagerMaster] Logging.scala:54 - BlockManagerMaster stopped
+2021-07-29 14:28:10,669 [dispatcher-event-loop-1] INFO  [o.a.s.s.OutputCommitCoordinator$OutputCommitCoordinatorEndpoint] Logging.scala:54 - OutputCommitCoordinator stopped!
+2021-07-29 14:28:10,671 [Thread-14] INFO  [org.apache.spark.SparkContext] Logging.scala:54 - Successfully stopped SparkContext
+2021-07-29 14:28:10,672 [Thread-14] INFO  [org.apache.spark.util.ShutdownHookManager] Logging.scala:54 - Shutdown hook called
+2021-07-29 14:28:10,673 [Thread-14] INFO  [org.apache.spark.util.ShutdownHookManager] Logging.scala:54 - Deleting directory /private/var/folders/29/x4tp3v8j7md8dtgsqxqzxgh00000gn/T/spark-a5af9290-4cf2-4c1c-8973-4e67376f2278
+2021-07-29 14:28:10,690 [SpringContextShutdownHook] INFO  [org.apache.spark.SparkContext] Logging.scala:54 - SparkContext already stopped.

+ 310 - 0
mvnw

@@ -0,0 +1,310 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+#   JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+#   M2_HOME - location of maven2's installed home dir
+#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
+#     e.g. to debug Maven itself, use
+#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+  if [ -f /etc/mavenrc ] ; then
+    . /etc/mavenrc
+  fi
+
+  if [ -f "$HOME/.mavenrc" ] ; then
+    . "$HOME/.mavenrc"
+  fi
+
+fi
+
+# OS specific support.  $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+  CYGWIN*) cygwin=true ;;
+  MINGW*) mingw=true;;
+  Darwin*) darwin=true
+    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+    if [ -z "$JAVA_HOME" ]; then
+      if [ -x "/usr/libexec/java_home" ]; then
+        export JAVA_HOME="`/usr/libexec/java_home`"
+      else
+        export JAVA_HOME="/Library/Java/Home"
+      fi
+    fi
+    ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+  if [ -r /etc/gentoo-release ] ; then
+    JAVA_HOME=`java-config --jre-home`
+  fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+  ## resolve links - $0 may be a link to maven's home
+  PRG="$0"
+
+  # need this for relative symlinks
+  while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+      PRG="$link"
+    else
+      PRG="`dirname "$PRG"`/$link"
+    fi
+  done
+
+  saveddir=`pwd`
+
+  M2_HOME=`dirname "$PRG"`/..
+
+  # make it fully qualified
+  M2_HOME=`cd "$M2_HOME" && pwd`
+
+  cd "$saveddir"
+  # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME=`cygpath --unix "$M2_HOME"`
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+  [ -n "$CLASSPATH" ] &&
+    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME="`(cd "$M2_HOME"; pwd)`"
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+  javaExecutable="`which javac`"
+  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+    # readlink(1) is not available as standard on Solaris 10.
+    readLink=`which readlink`
+    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+      if $darwin ; then
+        javaHome="`dirname \"$javaExecutable\"`"
+        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+      else
+        javaExecutable="`readlink -f \"$javaExecutable\"`"
+      fi
+      javaHome="`dirname \"$javaExecutable\"`"
+      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+      JAVA_HOME="$javaHome"
+      export JAVA_HOME
+    fi
+  fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+  if [ -n "$JAVA_HOME"  ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+      # IBM's JDK on AIX uses strange locations for the executables
+      JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+      JAVACMD="$JAVA_HOME/bin/java"
+    fi
+  else
+    JAVACMD="`which java`"
+  fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+  echo "Error: JAVA_HOME is not defined correctly." >&2
+  echo "  We cannot execute $JAVACMD" >&2
+  exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+  echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+  if [ -z "$1" ]
+  then
+    echo "Path not specified to find_maven_basedir"
+    return 1
+  fi
+
+  basedir="$1"
+  wdir="$1"
+  while [ "$wdir" != '/' ] ; do
+    if [ -d "$wdir"/.mvn ] ; then
+      basedir=$wdir
+      break
+    fi
+    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+    if [ -d "${wdir}" ]; then
+      wdir=`cd "$wdir/.."; pwd`
+    fi
+    # end of workaround
+  done
+  echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+  if [ -f "$1" ]; then
+    echo "$(tr -s '\n' ' ' < "$1")"
+  fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+  exit 1;
+fi
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Found .mvn/wrapper/maven-wrapper.jar"
+    fi
+else
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
+    fi
+    if [ -n "$MVNW_REPOURL" ]; then
+      jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+    else
+      jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+    fi
+    while IFS="=" read key value; do
+      case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
+      esac
+    done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Downloading from: $jarUrl"
+    fi
+    wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
+    if $cygwin; then
+      wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
+    fi
+
+    if command -v wget > /dev/null; then
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Found wget ... using wget"
+        fi
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+            wget "$jarUrl" -O "$wrapperJarPath"
+        else
+            wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
+        fi
+    elif command -v curl > /dev/null; then
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Found curl ... using curl"
+        fi
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+            curl -o "$wrapperJarPath" "$jarUrl" -f
+        else
+            curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
+        fi
+
+    else
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Falling back to using Java to download"
+        fi
+        javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+        # For Cygwin, switch paths to Windows format before running javac
+        if $cygwin; then
+          javaClass=`cygpath --path --windows "$javaClass"`
+        fi
+        if [ -e "$javaClass" ]; then
+            if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+                if [ "$MVNW_VERBOSE" = true ]; then
+                  echo " - Compiling MavenWrapperDownloader.java ..."
+                fi
+                # Compiling the Java class
+                ("$JAVA_HOME/bin/javac" "$javaClass")
+            fi
+            if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+                # Running the downloader
+                if [ "$MVNW_VERBOSE" = true ]; then
+                  echo " - Running MavenWrapperDownloader.java ..."
+                fi
+                ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
+            fi
+        fi
+    fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+if [ "$MVNW_VERBOSE" = true ]; then
+  echo $MAVEN_PROJECTBASEDIR
+fi
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME=`cygpath --path --windows "$M2_HOME"`
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+  [ -n "$CLASSPATH" ] &&
+    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+  $MAVEN_OPTS \
+  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 182 - 0
mvnw.cmd

@@ -0,0 +1,182 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements.  See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership.  The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License.  You may obtain a copy of the License at
+@REM
+@REM    https://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied.  See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM     e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+
+FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+    IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Found %WRAPPER_JAR%
+    )
+) else (
+    if not "%MVNW_REPOURL%" == "" (
+        SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+    )
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Couldn't find %WRAPPER_JAR%, downloading it ...
+        echo Downloading from: %DOWNLOAD_URL%
+    )
+
+    powershell -Command "&{"^
+		"$webclient = new-object System.Net.WebClient;"^
+		"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+		"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+		"}"^
+		"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
+		"}"
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Finished downloading %WRAPPER_JAR%
+    )
+)
+@REM End of extension
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
+
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
+
+exit /B %ERROR_CODE%

+ 199 - 0
pom.xml

@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.4.0</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>com.jkcredit.traffic.record</groupId>
+    <artifactId>traffic-record</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>traffic-record</name>
+    <description>Demo project for Spring Boot</description>
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>1.18.10</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.scala-lang</groupId>
+            <artifactId>scala-library</artifactId>
+            <version>2.11.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.spark</groupId>
+            <artifactId>spark-core_2.11</artifactId>
+            <version>2.3.1</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>netty-all</artifactId>
+                    <groupId>io.netty</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>netty-buffer</artifactId>
+                    <groupId>io.netty</groupId>
+                </exclusion>
+                <exclusion>
+                    <groupId>io.netty</groupId>
+                    <artifactId>netty</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.spark</groupId>
+            <artifactId>spark-sql_2.11</artifactId>
+            <version>2.3.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.spark</groupId>
+            <artifactId>spark-hive_2.11</artifactId>
+            <version>2.3.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.spark</groupId>
+            <artifactId>spark-network-common_2.11</artifactId>
+            <version>2.3.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-all</artifactId>
+            <version>4.1.17.Final</version>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.janino</groupId>
+            <artifactId>janino</artifactId>
+            <version>3.0.8</version>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-buffer</artifactId>
+            <version>4.1.17.Final</version>
+        </dependency>
+        <dependency>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>okhttp</artifactId>
+            <version>4.7.1</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.70</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.7.15</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>netty-all</artifactId>
+                    <groupId>io.netty</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>netty-buffer</artifactId>
+                    <groupId>io.netty</groupId>
+                </exclusion>
+                <exclusion>
+                    <groupId>io.netty</groupId>
+                    <artifactId>netty</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+<!--        <dependency>-->
+<!--            <groupId>org.springframework.boot</groupId>-->
+<!--            <artifactId>spring-boot-starter-data-redis</artifactId>-->
+<!--            <version>2.4.4</version>-->
+<!--        </dependency>-->
+        <dependency>
+            <groupId>com.ciphergateway</groupId>
+            <artifactId>libCSCipher</artifactId>
+            <version>2.2.18</version>
+            <!--            <scope>system</scope>-->
+            <!--            &lt;!&ndash; systemPath配置为cipher-suite-jni-release-2.2.3.jar文件的绝对路径 &ndash;&gt;-->
+            <!--            <systemPath>${project.basedir}/src/main/resources/lib/cipher-suite-jni-release-2.2.18.jar</systemPath>-->
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty</artifactId>
+            <version>3.9.9.Final</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+<!--            <plugin>-->
+<!--                <groupId>org.springframework.boot</groupId>-->
+<!--                <artifactId>spring-boot-maven-plugin</artifactId>-->
+<!--                <configuration>-->
+<!--                    <excludes>-->
+<!--                        <exclude>-->
+<!--                            <groupId>org.projectlombok</groupId>-->
+<!--                            <artifactId>lombok</artifactId>-->
+<!--                        </exclude>-->
+<!--                    </excludes>-->
+<!--                </configuration>-->
+<!--            </plugin>-->
+            <!--设置应用 Main 参数启动依赖查找的地址指向外部 lib 文件夹-->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <addClasspath>true</addClasspath>
+                            <classpathPrefix>lib/</classpathPrefix>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+            <!--设置 SpringBoot 打包插件不包含任何 Jar 依赖包-->
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <includes>
+                        <include>
+                            <groupId>nothing</groupId>
+                            <artifactId>nothing</artifactId>
+                        </include>
+                    </includes>
+                </configuration>
+            </plugin>
+            <!--设置将 lib 拷贝到应用 Jar 外面-->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-dependencies</id>
+                        <phase>prepare-package</phase>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 13 - 0
src/main/java/com/jkcredit/traffic/record/TrafficRecordApplication.java

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

+ 32 - 0
src/main/java/com/jkcredit/traffic/record/action/TrafficRecordsAction.java

@@ -0,0 +1,32 @@
+package com.jkcredit.traffic.record.action;
+
+import com.jkcredit.traffic.record.model.CommonResponseObject;
+import com.jkcredit.traffic.record.service.TrafficRecordsAnalyseService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@RestController
+@Slf4j
+@RequestMapping("/api")
+public class TrafficRecordsAction {
+    @Autowired
+    TrafficRecordsAnalyseService service;
+
+    @PostMapping("/push")
+    public CommonResponseObject pushTrafficRecords(@RequestParam String path) {
+        return service.pushTrafficRecords(path);
+    }
+
+    @PostMapping("/pushErrorRecords")
+    public CommonResponseObject pushErrorRecords(@RequestParam String path) {
+        return service.pushErrorRecords(path);
+    }
+}

+ 33 - 0
src/main/java/com/jkcredit/traffic/record/config/SparkSessionConfig.java

@@ -0,0 +1,33 @@
+package com.jkcredit.traffic.record.config;
+
+import org.apache.spark.SparkConf;
+import org.apache.spark.sql.SparkSession;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@Configuration
+public class SparkSessionConfig {
+    private static String APP_NAME ="DataExtract";
+
+    @Bean
+    public SparkSession getSparkSession() {
+        SparkConf sparkConf = new SparkConf();
+        sparkConf.set("spark.driver.allowMultipleContexts", "true");
+        sparkConf.set("spark.eventLog.enabled", "true");
+        sparkConf.set("spark.serializer", "org.apache.spark.serializer.KryoSerializer");
+        sparkConf.set("spark.hadoop.validateOutputSpecs", "false");
+        sparkConf.set("hive.mapred.supports.subdirectories", "true");
+        sparkConf.set("mapreduce.input.fileinputformat.input.dir.recursive", "true");
+
+        return SparkSession.builder()
+                .appName(APP_NAME)
+                .master("local")
+                .config(sparkConf)
+                .getOrCreate();
+    }
+}

+ 40 - 0
src/main/java/com/jkcredit/traffic/record/config/ThreadPoolConfig.java

@@ -0,0 +1,40 @@
+package com.jkcredit.traffic.record.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableAsync;
+
+import java.util.concurrent.*;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@Configuration
+@EnableAsync
+public class ThreadPoolConfig {
+//    @Value("${thread.pool.coreSize}")
+//    private Integer coreSize;
+//
+//    @Value("${thread.pool.maximumPoolSize}")
+//    private Integer maximumPoolSize;
+//
+//    @Value("${thread.pool.queueSize}")
+//    private Integer queueSize;
+
+//    @Bean("mainThreadPoolExecutor")
+//    public ThreadPoolExecutor mainThreadPoolExecutor() {
+//        LinkedBlockingDeque<Runnable> deque = new LinkedBlockingDeque<>(queueSize);
+//
+//        return new ThreadPoolExecutor(coreSize,
+//                maximumPoolSize, 10,
+//                TimeUnit.MINUTES, deque);
+//    }
+
+    @Bean
+    public ExecutorService executorService() {
+        return Executors.newWorkStealingPool();
+    }
+
+}

+ 15 - 0
src/main/java/com/jkcredit/traffic/record/constant/CommonConstant.java

@@ -0,0 +1,15 @@
+package com.jkcredit.traffic.record.constant;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+public class CommonConstant {
+    public static final String SUCCESS_CODE = "200";
+    public static final String SUCCESS_MESSAGE = "请求成功,开始处理";
+    public static final String ERROR_CODE_FILE_NOT_EXIST = "501";
+    public static final String ERROR_MESSAGE_FILE_NOT_EXIST = "文件不存在,请检查文件夹路径";
+    public static final String ERROR_CODE_EXCEPTION = "500";
+    public static final String ERROR_MESSAGE_EXCEPTION = "处理失败";
+
+}

+ 35 - 0
src/main/java/com/jkcredit/traffic/record/model/CommonResponseObject.java

@@ -0,0 +1,35 @@
+package com.jkcredit.traffic.record.model;
+
+import com.jkcredit.traffic.record.constant.CommonConstant;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@Data
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+public class CommonResponseObject implements Serializable {
+    private static final long serialVersionUID = 426198091527213137L;
+    private String code;
+    private String message;
+
+    public CommonResponseObject success() {
+        this.code = CommonConstant.SUCCESS_CODE;
+        this.message = CommonConstant.SUCCESS_MESSAGE;
+        return this;
+    }
+
+    public CommonResponseObject failed() {
+        this.code = CommonConstant.ERROR_CODE_EXCEPTION;
+        this.code = CommonConstant.ERROR_MESSAGE_EXCEPTION;
+        return this;
+    }
+}

+ 35 - 0
src/main/java/com/jkcredit/traffic/record/model/MonthResult.java

@@ -0,0 +1,35 @@
+package com.jkcredit.traffic.record.model;
+
+import lombok.Data;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@Data
+public class MonthResult implements Serializable {
+    private static final long serialVersionUID = 9114381989127166629L;
+    String month;
+    String vehicleid;
+    String max_exTime;
+    String sum_travel_time;
+    String max_travel_time;
+    String sum_feemileage;
+    String sum_fee;
+    String sum_weight_mileage;
+    String exTimes_count;
+    String axlecount;
+    String vehicletype;
+    String travel_provinces_count;
+    String transtime_count;
+
+    @Override
+    public String toString() {
+        return  month + "," + vehicleid + "," + max_exTime + "," + sum_travel_time + "," +max_travel_time + ","
+                + sum_feemileage + "," +sum_fee + "," + sum_weight_mileage + "," + exTimes_count + "," + axlecount
+                + "," + vehicletype + "," + travel_provinces_count + "," + transtime_count;
+    }
+}

+ 16 - 0
src/main/java/com/jkcredit/traffic/record/service/TrafficRecordsAnalyseService.java

@@ -0,0 +1,16 @@
+package com.jkcredit.traffic.record.service;
+
+import com.jkcredit.traffic.record.model.CommonResponseObject;
+import com.jkcredit.traffic.record.model.MonthResult;
+
+import java.util.List;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+public interface TrafficRecordsAnalyseService {
+    CommonResponseObject pushTrafficRecords(String filePath);
+
+    CommonResponseObject pushErrorRecords(String filePath);
+}

+ 87 - 0
src/main/java/com/jkcredit/traffic/record/service/TrafficRecordsAnalyseServiceImpl.java

@@ -0,0 +1,87 @@
+package com.jkcredit.traffic.record.service;
+
+import com.alibaba.fastjson.JSON;
+import com.jkcredit.traffic.record.constant.CommonConstant;
+import com.jkcredit.traffic.record.model.CommonResponseObject;
+import com.jkcredit.traffic.record.model.MonthResult;
+import com.jkcredit.traffic.record.test.AsyncPushTask;
+import com.jkcredit.traffic.record.util.CsvUtil;
+import com.jkcredit.traffic.record.util.FileUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.spark.sql.SparkSession;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@Service
+@Slf4j
+public class TrafficRecordsAnalyseServiceImpl implements TrafficRecordsAnalyseService {
+    @Autowired
+    SparkSession sparkSession;
+    @Autowired
+    AsyncPushTask asyncPushTask;
+
+    @Override
+    public CommonResponseObject pushTrafficRecords(String filePath) {
+        List<File> files = new ArrayList<>();
+        File folder = new File(filePath);
+        File[] tempList = folder.listFiles();
+        if (tempList.length == 0) {
+            return new CommonResponseObject(CommonConstant.ERROR_CODE_FILE_NOT_EXIST,
+                    CommonConstant.ERROR_MESSAGE_FILE_NOT_EXIST);
+        }
+
+        for (int i = 0; i < tempList.length; i++) {
+            if (tempList[i].isFile() && tempList[i].getName().split("\\.")[1].equals("csv")) {
+                files.add(tempList[i]);
+            }
+        }
+
+        for (int i = 0; i < files.size(); i++) {
+            String fileName = folder.getName() + "_" + i;
+            asyncPushTask.push(fileName, files.get(i).getAbsolutePath());
+        }
+
+        return new CommonResponseObject().success();
+    }
+
+    @Override
+    public CommonResponseObject pushErrorRecords(String filePath) {
+        List<File> files = new ArrayList<>();
+        File folder = new File(filePath);
+        File[] tempList = folder.listFiles();
+        if (tempList.length == 0) {
+            return new CommonResponseObject(CommonConstant.ERROR_CODE_FILE_NOT_EXIST,
+                    CommonConstant.ERROR_MESSAGE_FILE_NOT_EXIST);
+        }
+
+        for (int i = 0; i < tempList.length; i++) {
+            if (tempList[i].isFile() && tempList[i].getName().split("\\.")[1].equals("csv")) {
+                files.add(tempList[i]);
+            }
+        }
+
+        for (int i = 0; i < files.size(); i++) {
+            List<String> errorRecords = CsvUtil.readCsv(files.get(i).getAbsolutePath());
+            List<MonthResult> monthResults = new ArrayList<>();
+            for (String record : errorRecords) {
+                MonthResult monthResult = JSON.toJavaObject(JSON.parseObject(record), MonthResult.class);
+                monthResults.add(monthResult);
+            }
+            try {
+                asyncPushTask.pushRecords(monthResults);
+            } catch (Exception e) {
+                log.error("推送异常数据失败:", e);
+                return new CommonResponseObject().failed();
+            }
+        }
+        return new CommonResponseObject().success();
+    }
+}

+ 228 - 0
src/main/java/com/jkcredit/traffic/record/test/AsyncPushTask.java

@@ -0,0 +1,228 @@
+package com.jkcredit.traffic.record.test;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.ciphergateway.ciphersuite.CipherSuiteException;
+import com.ciphergateway.ciphersuite.CipherSuiteMacException;
+import com.ciphergateway.ciphersuite.CipherSuiteUtils;
+import com.jkcredit.traffic.record.constant.CommonConstant;
+import com.jkcredit.traffic.record.model.CommonResponseObject;
+import com.jkcredit.traffic.record.model.MonthResult;
+import com.jkcredit.traffic.record.service.TrafficRecordsAnalyseService;
+import com.jkcredit.traffic.record.util.DivideDataUtil;
+import com.jkcredit.traffic.record.util.FileUtil;
+import lombok.extern.slf4j.Slf4j;
+import okhttp3.*;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.Encoders;
+import org.apache.spark.sql.SparkSession;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.AsyncResult;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+
+import javax.xml.bind.DatatypeConverter;
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.SocketTimeoutException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@Service
+@Slf4j
+public class AsyncPushTask {
+    @Autowired
+    SparkSession sparkSession;
+
+    @Value("${recordsPush.url}")
+    private String recordsPushUrl;
+    @Value("${recordsEncrypt.keyId}")
+    private String keyId;
+    @Value("${recordsEncrypt.metadata}")
+    private String metadata;
+    @Value("${recordsEncrypt.ivStr}")
+    private String ivStr;
+    @Value("${recordsEncrypt.algorithm}")
+    private String algorithm;
+    @Value("${errorRecords.path}")
+    private String errorRecordsPath;
+
+    private static final String MEDIA_TYPE = "application/json;charset=UTF-8";
+    private OkHttpClient okHttpClient = new OkHttpClient.Builder().build();
+
+    @Async
+    public Future<String> pushRecords(List<MonthResult> resultList) throws InterruptedException {
+        MediaType mediaType = MediaType.parse(MEDIA_TYPE);
+        RequestBody requestBody = RequestBody.create(mediaType, JSON.toJSONString(resultList));
+
+        Request okRequest = new Request.Builder()
+                .post(requestBody)
+                .url(recordsPushUrl)
+                .build();
+        OkHttpClient client = okHttpClient.newBuilder()
+                .connectTimeout(10000, TimeUnit.MILLISECONDS)
+                .readTimeout(10000, TimeUnit.MILLISECONDS)
+                .writeTimeout(10000, TimeUnit.MILLISECONDS)
+                .build();
+        String responseContext = "";
+        List<MonthResult> errorList = new ArrayList<>();
+        try {
+            Long startTime = System.currentTimeMillis();
+            Response response = client.newCall(okRequest).execute();
+            log.info("pushRecords -- costTime:{}", System.currentTimeMillis()-startTime);
+            if (response.body() != null) {
+                responseContext = response.body().string();
+            }
+            log.info("pushRecords -- responseContext:{}", responseContext);
+            response.close();
+        } catch (SocketTimeoutException ste) {
+            ste.printStackTrace();
+            errorList = resultList;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        CommonResponseObject responseObject = JSON.toJavaObject(JSON.parseObject(responseContext), CommonResponseObject.class);
+        if (!responseObject.getCode().equals(CommonConstant.SUCCESS_CODE)) {
+            JSONArray responseErrorArray = JSON.parseArray(responseObject.getMessage());
+            errorList = responseErrorArray.toJavaList(MonthResult.class);
+        }
+        List<String> errorData = new ArrayList<>();
+        for (MonthResult monthResult : errorList) {
+            errorData.add(monthResult.toString());
+        }
+        // 异常数据写入本地文件
+        FileUtil.INSTANCE.addAll(errorData);
+        FileUtil.INSTANCE.write(errorRecordsPath+System.currentTimeMillis()+".csv");
+        return new AsyncResult<>("推送完成");
+    }
+
+    @Async
+    public void push(String value, String filePath) {
+        List<MonthResult> results = getMonthResult(value, filePath);
+        // 数据加密分区间
+        List<MonthResult> maskResults = new ArrayList<>();
+        for (MonthResult monthResult : results) {
+            // 车牌号加密;
+            String encryptPlateNumber = vehicleIdEncrypt(monthResult.getVehicleid());
+            if (StringUtils.isBlank(encryptPlateNumber)) {
+                // todo
+                log.info(JSON.toJSONString(monthResult));
+                continue;
+            }
+            maskResults.add(divideData(monthResult));
+        }
+        results = null;
+
+        int times;
+        if (maskResults.size() % 10000 != 0 ) {
+            times = (maskResults.size() / 10000) + 1;
+        } else {
+            times = maskResults.size() / 10000;
+        }
+        List<List<MonthResult>> partResultsList = new ArrayList<>();
+        for (int i = 0; i < times; i++) {
+            List<MonthResult> partResults;
+            if (i == times-1) {
+                partResults = maskResults.subList(i*10000, maskResults.size());
+            } else {
+                partResults = maskResults.subList(i*10000, (i+1)*10000);
+            }
+            partResultsList.add(partResults);
+        }
+        // todo 此处需要考虑异步
+        for (List<MonthResult> partResults : partResultsList) {
+            try {
+                pushRecords(partResults);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    private List<MonthResult> getMonthResult(String i, String filePath) {
+        Dataset<MonthResult> monthResultDataset = sparkSession
+                .read()
+                .option("header", true)
+                .csv(filePath)
+                .toDF("month", "vehicleid", "max_exTime", "sum_travel_time", "max_travel_time", "sum_feemileage",
+                        "sum_fee", "sum_weight_mileage","exTimes_count", "axlecount", "vehicletype",
+                        "travel_provinces_count", "transtime_count")
+                .as(Encoders.bean(MonthResult.class))
+                .coalesce(36);
+        String tempViewName = "monthDataset" + i;
+        monthResultDataset.createOrReplaceTempView(tempViewName);
+
+        Dataset<MonthResult> rows = sparkSession.sql("select * from " + tempViewName + " where sum_travel_time < 2678400 "+
+                "and max_travel_time < 604800 and sum_feemileage < 89280000 and sum_weight_mileage < 89280000 and exTimes_count < 1200" )
+                .as(Encoders.bean(MonthResult.class));
+//        rows.write().csv("/Users/jkxy/Desktop/outPut/test" + System.currentTimeMillis());
+        List<MonthResult> results = rows.javaRDD().collect();
+        sparkSession.sqlContext().dropTempTable(tempViewName);
+        return results;
+    }
+
+    /**
+     * 对vehicle_id字段进行加密
+     * @param vehicleId 待加密vehicleId
+     * @return 加密后vehicleId
+     */
+    private String vehicleIdEncrypt(String vehicleId) {
+        try {
+            byte[] plainData = vehicleId.getBytes("UTF-8");
+            byte[] iv = ivStr.getBytes("UTF-8");
+            Long startTime = System.currentTimeMillis();
+            // 加密
+            byte[] cipherData = CipherSuiteUtils.encrypt(plainData, algorithm, keyId, metadata, iv);
+            log.info("encrypt result: " + DatatypeConverter.printHexBinary(cipherData));
+            log.info("encrypt success. time:" + (System.currentTimeMillis() - startTime) + "ms.");
+            return DatatypeConverter.printHexBinary(cipherData);
+        } catch (UnsupportedEncodingException ue) {
+            ue.printStackTrace();
+            log.error("UnsupportedEncodingException:", ue);
+            return "";
+        } catch (CipherSuiteException cse) {
+            cse.printStackTrace();
+            log.error("CipherSuiteException:", cse);
+            return "";
+        } catch (CipherSuiteMacException csme) {
+            csme.printStackTrace();
+            log.error("CipherSuiteMacException:", csme);
+            return "";
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("Exception:", e);
+            return "";
+        } catch (Error error) {
+            error.printStackTrace();
+            log.error("Error:", error);
+            return "";
+        }
+    }
+
+    /**
+     * 对数据脱敏,分区间
+     * @param monthResult 待脱敏月结果数据
+     * @return 脱敏后月结果数据
+     */
+    private MonthResult divideData(MonthResult monthResult) {
+        monthResult.setExTimes_count(DivideDataUtil.divideExTimesCount(monthResult.getExTimes_count()));
+        monthResult.setSum_fee(DivideDataUtil.divideSumFee(monthResult.getSum_fee()));
+        monthResult.setSum_travel_time(DivideDataUtil.divideSumTravelTime(monthResult.getSum_travel_time()));
+        monthResult.setMax_travel_time(DivideDataUtil.divideMaxTravelTime(monthResult.getMax_travel_time()));
+        monthResult.setSum_feemileage(DivideDataUtil.divideSumFeeMileage(monthResult.getSum_feemileage()));
+        monthResult.setSum_weight_mileage(DivideDataUtil.divideSumWeightMileage(monthResult.getSum_weight_mileage()));
+        return monthResult;
+    }
+}

+ 125 - 0
src/main/java/com/jkcredit/traffic/record/test/CipherSuiteUtilsTest.java

@@ -0,0 +1,125 @@
+package com.jkcredit.traffic.record.test;
+
+import com.ciphergateway.ciphersuite.*;
+
+import javax.xml.bind.DatatypeConverter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+
+/**
+ * @ClassName : CipherSuiteUtilsTest
+ * @Description : 密码套件工具测试
+ * @Author : bcx
+ * @Date: 2020-05-13 14:03
+ */
+public class CipherSuiteUtilsTest {
+
+
+    public static void main(String[] args) throws Exception {
+        Scanner scanner = new Scanner(System.in);
+        List<String> algorithmList = new ArrayList<String>();
+        for (AlgorithmEnum algorithmEnum : AlgorithmEnum.values()) {
+            algorithmList.add(algorithmEnum.name());
+        }
+        System.out.println("请选择算法:");
+        int index = 1;
+        for (String algorithm : algorithmList) {
+            System.out.println("【" + (index++) + "】 " + algorithm);
+        }
+
+
+        int algorithmIndex = scanner.nextInt();
+        if (algorithmIndex > algorithmList.size() || algorithmIndex < 1) {
+            System.out.println("算法序号不合法");
+            return;
+        }
+        String algorithm = algorithmList.get(algorithmIndex - 1);
+
+        System.out.println("请输入密钥索引:");
+        String keyId = scanner.next();
+
+        System.out.println("algorithm: " + algorithm);
+        System.out.println("keyId: " + keyId);
+
+
+        String plainStr = null;
+        int precision = 5;
+        int scale = 2;
+
+        if ("SM4_ECB".equals(algorithm) || "SM4_ECB_V2".equals(algorithm) || "SM4_CTR".equals(algorithm) || "SM4_GCM".equals(algorithm) || "SM4_CBC".equals(algorithm) || "SM3".equals(algorithm) || "SM2".equals(algorithm) || "AES_ECB".equals(algorithm) || "AES_CTR".equals(algorithm) || "AES_GCM".equals(algorithm) || "AES_CBC".equals(algorithm) || "RSA".equals(algorithm)) {
+            plainStr = "Hello World";
+        } else if ("FPE_EMAIL".equals(algorithm)) {
+            plainStr = "hello@163.com";
+        } else if ("FPE_PHONE_NUM".equals(algorithm)) {
+            plainStr = "13581690000";
+        } else if ("FPE_OFFICER_CARD".equals(algorithm)) {
+            plainStr = "军字第00111206号";
+        } else if ("FPE_ID_CARD".equals(algorithm)) {
+            plainStr = "110103201206200910";
+        } else if ("FPE_PASSPORT".equals(algorithm)) {
+            plainStr = "E12345678";
+        } else if ("FPE_IDENTIFICATION".equals(algorithm)) {//未知证件
+            plainStr = "110103201206200910";
+        } else if ("FPE_NUMBER".equals(algorithm)) {
+            plainStr = "123.45";
+        } else if ("FPE_NUMBER_TWEAK".equals(algorithm)) {
+            plainStr = "123.45";
+        } else {
+            System.out.println("算法不合法");
+            return;
+        }
+
+        System.out.println("plainData: " + plainStr);
+
+        byte[] plainData = plainStr.getBytes("UTF-8");
+
+        String ivStr = "123456789abcdefg";
+        System.out.println("iv: " + ivStr);
+        byte[] iv = ivStr.getBytes("UTF-8");
+
+        String metadata = "ABCDBF";
+        System.out.println("metadata: " + metadata);
+
+        if ("FPE_NUMBER".equals(algorithm) || "FPE_NUMBER_TWEAK".equals(algorithm)) {
+            System.out.println("precision:" + precision);
+            System.out.println("scale:" + scale);
+        }
+
+        long beginTime = System.currentTimeMillis();
+
+        if ("FPE_NUMBER".equals(algorithm) || "FPE_NUMBER_TWEAK".equals(algorithm)) {
+            byte[] cipherData_fpe = CipherSuiteUtils.fpeNumberEncrypt(plainData, algorithm, keyId, metadata, iv, precision, scale);
+            System.out.println("encrypt result: " + new String(cipherData_fpe));
+            byte[] decryptData_fpe = CipherSuiteUtils.fpeNumberDecrypt(cipherData_fpe, algorithm, keyId, metadata, iv, precision, scale);
+            System.out.println("decrypt result: " + new String(decryptData_fpe));
+            long endTime = System.currentTimeMillis() - beginTime;
+            if (plainStr.equals(new String(decryptData_fpe))) {
+                System.out.println("encrypt and decrypt success. time:" + endTime + "ms.");
+            }
+        } else if ("SM3".equals(algorithm)) {
+            byte[] digestData = CipherSuiteUtils.digest(plainData, algorithm, keyId, metadata);
+            System.out.println("digest result: " + DatatypeConverter.printHexBinary(digestData));
+            long endTime = System.currentTimeMillis() - beginTime;
+            System.out.println("SM3 digest success. time:" + endTime + "ms.");
+        } else {
+            // 加密
+            byte[] cipherData = CipherSuiteUtils.encrypt(plainData, algorithm, keyId, metadata, iv);
+            if (algorithm.startsWith("FPE")) {
+                System.out.println("encrypt result: " + new String(cipherData));
+            } else {
+                System.out.println("encrypt result: " + DatatypeConverter.printHexBinary(cipherData));
+            }
+
+            // 解密
+            byte[] decryptData = CipherSuiteUtils.decrypt(cipherData, algorithm, keyId, metadata, iv);
+            System.out.println("decrypt result: " + new String(decryptData));
+
+            long endTime = System.currentTimeMillis() - beginTime;
+            if (plainStr.equals(new String(decryptData))) {
+                System.out.println("encrypt and decrypt success. time:" + endTime + "ms.");
+            }
+        }
+
+    }
+}

+ 84 - 0
src/main/java/com/jkcredit/traffic/record/test/SparkTool.java

@@ -0,0 +1,84 @@
+package com.jkcredit.traffic.record.test;
+
+import com.jkcredit.traffic.record.model.MonthResult;
+import org.apache.spark.SparkConf;
+import org.apache.spark.api.java.JavaSparkContext;
+import org.apache.spark.sql.*;
+import org.apache.spark.sql.expressions.Window;
+import org.apache.spark.sql.types.LongType;
+import org.apache.spark.sql.types.StructType;
+import scala.reflect.ClassTag;
+
+import java.util.List;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+
+public class SparkTool {
+
+    public static String appName ="DataExtract";
+    private static JavaSparkContext jsc = null;
+    private static SparkSession spark = null;
+
+    private static void initSpark() {
+        if (jsc == null || spark == null) {
+
+            SparkConf sparkConf = new SparkConf();
+            sparkConf.set("spark.driver.allowMultipleContexts", "true");
+            sparkConf.set("spark.eventLog.enabled", "true");
+            sparkConf.set("spark.serializer", "org.apache.spark.serializer.KryoSerializer");
+            sparkConf.set("spark.hadoop.validateOutputSpecs", "false");
+            sparkConf.set("hive.mapred.supports.subdirectories", "true");
+            sparkConf.set("mapreduce.input.fileinputformat.input.dir.recursive", "true");
+
+            spark = SparkSession.builder().appName(appName).master("local").config(sparkConf).getOrCreate();
+            jsc = new JavaSparkContext(spark.sparkContext());
+        }
+
+    }
+
+    public static JavaSparkContext getJsc() {
+        if (jsc == null) {
+            initSpark();
+        }
+        return jsc;
+    }
+
+    public static SparkSession getSession() {
+        if (spark == null ) {
+            initSpark();
+        }
+        return spark;
+
+    }
+
+
+    public static void main(String[] args) {
+        getSession();
+        /**
+         * val monthDataset: Dataset[monthResult] = spark.read.option("header", true).csv(month_path).toDF("month", "vehicleid",
+         *       "max_exTime", "sum_travel_time", "max_travel_time", "sum_feemileage", "sum_fee", "sum_weight_mileage",
+         *       "exTimes_count", "axlecount", "vehicletype", "travel_provinces_count", "transtime_count").as[monthResult].coalesce(36)
+         */
+        Dataset<MonthResult> monthResultDataset = spark
+                .read()
+                .option("header", true)
+                .csv("/Users/jkxy/Desktop/test/part-00000-4b3bccbf-a8ad-4bfe-b9a4-31e455238c9c-c000.csv")
+                .toDF("month", "vehicleid", "max_exTime", "sum_travel_time", "max_travel_time", "sum_feemileage",
+                        "sum_fee", "sum_weight_mileage","exTimes_count", "axlecount", "vehicletype",
+                        "travel_provinces_count", "transtime_count")
+                .as(Encoders.bean(MonthResult.class))
+                .coalesce(36);
+        monthResultDataset.createOrReplaceTempView("monthDataset");
+
+        // 110
+        Dataset<MonthResult> rows = spark.sql("select * from monthDataset where sum_travel_time < 2678400 "+
+                "and max_travel_time < 604800 and sum_feemileage < 89280000 and sum_weight_mileage < 89280000 and exTimes_count < 1200" )
+                .as(Encoders.bean(MonthResult.class));
+        List<MonthResult> results = rows.javaRDD().collect();
+        spark.sqlContext().dropTempTable("monthDataset");
+        spark.stop();
+    }
+}

+ 42 - 0
src/main/java/com/jkcredit/traffic/record/test/Test.java

@@ -0,0 +1,42 @@
+package com.jkcredit.traffic.record.test;
+
+import com.ciphergateway.ciphersuite.CipherSuiteException;
+import com.ciphergateway.ciphersuite.CipherSuiteMacException;
+import com.ciphergateway.ciphersuite.CipherSuiteUtils;
+
+import javax.xml.bind.DatatypeConverter;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+public class Test {
+    public static void main(String[] args) {
+        String keyId = "1349736097415958529";
+        String algorithm = "SM3";
+        String plainStr = "Hello World";
+        int precision = 5;
+        int scale = 2;
+        String metadata = "ABCDBF";
+        String ivStr = "123456789abcdefg";
+        try {
+            byte[] plainData = plainStr.getBytes("UTF-8");
+            byte[] iv = ivStr.getBytes("UTF-8");
+            byte[] digestData = CipherSuiteUtils.digest(plainData, algorithm, keyId, metadata);
+//            byte[] cipherData = CipherSuiteUtils.encrypt(plainData, algorithm, keyId, metadata, iv);
+//            System.out.println("encrypt result: " + DatatypeConverter.printHexBinary(cipherData));
+        } catch (UnsupportedEncodingException ue) {
+            ue.printStackTrace();
+        } catch (CipherSuiteException cse) {
+            cse.printStackTrace();
+        } catch (CipherSuiteMacException csme) {
+            csme.printStackTrace();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+
+
+    }
+}

+ 63 - 0
src/main/java/com/jkcredit/traffic/record/util/CsvUtil.java

@@ -0,0 +1,63 @@
+package com.jkcredit.traffic.record.util;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+@Slf4j
+public class CsvUtil {
+    public static void writeCsv(List<String> list, String filePath){
+        try {
+            Long start = System.currentTimeMillis();
+            File file=new File(filePath);
+            FileOutputStream fos=new FileOutputStream(file,true);
+            OutputStreamWriter osw=new OutputStreamWriter(fos, "UTF-8");
+            BufferedWriter bw=new BufferedWriter(osw);
+            for (String line : list) {
+                bw.write(line+"\n");
+            }
+            //注意关闭的先后顺序,先打开的后关闭,后打开的先关闭
+            bw.close();
+            osw.close();
+            fos.close();
+            long end = System.currentTimeMillis();
+            System.out.println("完成"+filePath+"入库,耗时:" + (end - start) +" ms");
+        } catch (Exception e){
+            e.printStackTrace();
+            log.error("writeCsv:", e);
+        }
+    }
+
+    public static List<String> readCsv(String filepath) {
+        File csv = new File(filepath); // CSV文件路径
+        csv.setReadable(true);//设置可读
+        csv.setWritable(true);//设置可写
+        BufferedReader br = null;
+        try {
+            br = new BufferedReader(new FileReader(csv));
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        }
+        String line = "";
+        String everyLine = "";
+        ArrayList<String> allString = new ArrayList<>();
+        try {
+            while ((line = br.readLine()) != null) // 读取到的内容给line变量
+            {
+                everyLine = line;
+                System.out.println(everyLine);
+                allString.add(everyLine);
+            }
+            System.out.println("csv表格中所有行数:" + allString.size());
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return allString;
+    }
+}

+ 160 - 0
src/main/java/com/jkcredit/traffic/record/util/DivideDataUtil.java

@@ -0,0 +1,160 @@
+package com.jkcredit.traffic.record.util;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+public class DivideDataUtil {
+    /**
+     * 出行次数
+     * 0-100/5/20;100-300/10/20;300-600/20/15;600-1000/50/8;1000以上/1
+     * @param exTimesCount 出行次数
+     * @return 脱敏后出行次数区间
+     */
+    public static String divideExTimesCount(String exTimesCount) {
+        String result = "A";
+        int times = Integer.parseInt(exTimesCount.split("\\.")[0]);
+
+        if (times < 100) {
+            result = result + (times/5 +1);
+        } else if (times < 300) {
+            result = result + ((times-100)/10 + 1 + 20);
+        } else if (times < 600) {
+            result = result + ((times-300)/20 + 1 + 20 + 20);
+        } else if (times < 1000) {
+            result = result + ((times-600)/50 + 1 + 20 + 20 + 15);
+        } else {
+            result = result + (1 + 20 + 20 + 15 + 8);
+        }
+        return result;
+    }
+
+    /**
+     * 出行消费总金额,第一个区间是0;第二个区间:(0,2000],第三个区间:(2000,4000]
+     * @param sumFee 0/1; 0-10000/2000/5; 10000-100000/3000/30; 100000-500000/16000/25; 500000-1000000/25000/20; 1000000-8000000/500000/14; 8000000以上/1
+     * @return 脱敏后出行消费总金额区间
+     */
+    public static String divideSumFee(String sumFee) {
+        String result = "B";
+        long fee = Long.parseLong(sumFee.split("\\.")[0]);
+        if (fee == 0) {
+            result = result + "0";
+            return result;
+        }
+        fee = fee - 1;
+        if (fee < 10000) {
+            result = result + (fee/2000 + 1);
+        } else if (fee < 100000) {
+            result = result + ((fee-10000)/3000 + 1 + 5);
+        } else if (fee <= 500000) {
+            result = result + ((fee-100000)/16000 + 1 + 5 + 30);
+        } else if (fee <= 1000000) {
+            result = result + ((fee-500000)/25000 + 1 + 5 + 30 + 25);
+        } else if (fee <= 8000000) {
+            result = result + ((fee-1000000)/500000 + 1 + 5 + 30 + 25 + 20);
+        } else {
+            result = result + (1 + 1 + 5 + 30 + 25 + 20 + 14);
+        }
+        return result;
+    }
+
+    /**
+     * 出行总时长
+     * @param sumTravelTime 0-3600/1800/2; 3600-68400/3600/18; 68400-608400/36000/15; 608400-2595600/86400/23; 2595600以上/1
+     * @return 脱敏后出行总时长区间
+     */
+    public static String divideSumTravelTime(String sumTravelTime) {
+        String result = "C";
+        long travelTime = Long.parseLong(sumTravelTime.split("\\.")[0]);
+        if (travelTime < 3600) {
+            result = result + (travelTime/1800 + 1);
+        } else if (travelTime < 68400) {
+            result = result + ((travelTime-3600)/3600 + 1 + 2);
+        } else if (travelTime < 608400) {
+            result = result + ((travelTime-68400)/36000 + 1 + 2 + 18);
+        } else if (travelTime < 2595600) {
+            result = result + ((travelTime-608400)/86400 + 1 + 2 + 18 + 15);
+        } else {
+            result = result + (1 + 2 + 18 + 15 + 23);
+        }
+        return result;
+    }
+
+    /**
+     * 最长出行时长
+     * @param maxTravelTime 0-12000/1000/12; 12000-612000/20000/30; 612000以上/1个
+     * @return 脱敏后最长出行时长区间
+     */
+    public static String divideMaxTravelTime(String maxTravelTime) {
+        String result = "D";
+        long travelTime = Long.parseLong(maxTravelTime.split("\\.")[0]);
+        if (travelTime < 12000) {
+            result = result + (travelTime/1000 +1);
+        } else if (travelTime < 612000) {
+            result = result + ((travelTime-12000)/20000 + 1 + 12);
+        } else {
+            result = result + (1 + 12 + 30);
+        }
+        return result;
+    }
+
+    /**
+     * 出行总里程
+     * @param sumFeeMileage 0-200000/50000/4; 200000-1000000/100000/8; 1000000-5000000/200000/20;
+     *                      5000000-10000000/500000/10; 10000000-40000000/1000000/30; 40000000-80000000/1000600/25; 8000000以上;1
+     * @return 脱敏后出行总里程区间
+     */
+    public static String divideSumFeeMileage(String sumFeeMileage) {
+        String result = "E";
+        long feeMileage = Long.parseLong(sumFeeMileage.split("\\.")[0]);
+        if (feeMileage < 200000) {
+            result = result + (feeMileage/50000 +1);
+        } else if (feeMileage < 1000000) {
+            result = result + ((feeMileage-200000)/100000 + 1 + 4);
+        } else if (feeMileage < 5000000) {
+            result = result + ((feeMileage-1000000)/200000 + 1 + 4 + 8);
+        } else if (feeMileage < 10000000) {
+            result = result + ((feeMileage-5000000)/500000 + 1 + 4 + 8 + 20);
+        } else if (feeMileage < 40000000) {
+            result = result + ((feeMileage-10000000)/1000000 + 1 + 4 + 8 + 20 + 10);
+        } else if (feeMileage < 80000000) {
+            result = result + ((feeMileage-40000000)/1600000 + 1 + 4 + 8 + 20 + 10 + 30);
+        } else {
+            result = result + (1 + 4 + 8 + 20 + 10 + 30 + 25);
+        }
+        return result;
+    }
+
+    /**
+     * 负重出行总里程
+     * @param sumWeightMileage 0/1; 0-200000/50000/4; 200000-1000000/100000/8; 1000000-5000000/200000/20;
+     *                        5000000-10000000/500000/10; 10000000-40000000/1000000/30; 40000000-80000000/1600000/25;
+     *                         80000000以上/1
+     * @return 脱敏后负重出行总里程区间
+     */
+    public static String divideSumWeightMileage(String sumWeightMileage) {
+        String result = "F";
+        long weightMileage = Long.parseLong(sumWeightMileage.split("\\.")[0]);
+        if (weightMileage == 0) {
+            result = result + "0";
+            return result;
+        }
+        weightMileage = weightMileage - 1;
+        if (weightMileage <= 200000) {
+            result = result + (weightMileage/50000 +1);
+        } else if (weightMileage <= 1000000) {
+            result = result + ((weightMileage - 200000)/100000 + 1 + 4);
+        } else if (weightMileage <= 5000000) {
+            result = result + ((weightMileage - 1000000)/200000 + 1 + 4 + 8);
+        } else if (weightMileage <= 10000000) {
+            result = result + ((weightMileage - 5000000)/500000 + 1 + 4 + 8 + 20);
+        } else if (weightMileage <= 40000000) {
+            result = result + ((weightMileage - 10000000)/1000000 + 1 + 4 + 8 + 20 + 10);
+        } else if (weightMileage <= 80000000) {
+            result = result + ((weightMileage - 40000000)/1600000 + 1 + 4 + 8 + 20 + 10 + 30);
+        } else {
+            result = result + (1 + 1 + 4 + 8 + 20 + 10 + 30 + 25);
+        }
+        return result;
+    }
+}

+ 25 - 0
src/main/java/com/jkcredit/traffic/record/util/FileUtil.java

@@ -0,0 +1,25 @@
+package com.jkcredit.traffic.record.util;
+
+
+
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @author xusonglin
+ * @version V1.0
+ **/
+public enum FileUtil {
+    INSTANCE;
+
+    public static LinkedList<String> linkedList = new LinkedList<>();
+
+    public void addAll(List<String> list) {
+        linkedList.addAll(list);
+    }
+
+    public void write(String path) {
+        CsvUtil.writeCsv(linkedList, path);
+    }
+}

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

@@ -0,0 +1,22 @@
+spring:
+  application:
+    name: traffic-record
+#  redis:
+#    host: 127.0.0.1
+#    port: 6379
+thread:
+  pool:
+    coreSize: 20
+    maximumPoolSize: 40
+    queueSize: 100
+server:
+  port: 28081
+recordsPush:
+  url: http://127.0.0.1:8086/recordStorage
+recordsEncrypt:
+  keyId: 1316275955873878017
+  metadata: JKCredit
+  ivStr: dbdca8e8316fdee2
+  algorithm: SM4_CBC
+errorRecords:
+  path: /Users/jkxy/Desktop/test/output/

BIN
src/main/resources/lib/cipher-suite-jni-release-2.2.18.jar


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

@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration debug="false" scan="false">
+    <springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
+    <property name="log.path" value="logs"/>
+    <!-- 彩色日志格式 -->
+    <property name="CONSOLE_LOG_PATTERN"
+              value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
+    <!-- 彩色日志依赖的渲染类 -->
+    <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
+    <conversionRule conversionWord="wex"
+                    converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
+    <conversionRule conversionWord="wEx"
+                    converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
+    <!-- Console log output -->
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>${CONSOLE_LOG_PATTERN}</pattern>
+        </encoder>
+    </appender>
+
+    <!-- Log file error output -->
+    <appender name="errorLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${log.path}/error/error.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${log.path}/error/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>50MB</maxFileSize>
+            <maxHistory>30</maxHistory>
+        </rollingPolicy>
+        <encoder>
+            <pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+            <level>ERROR</level>
+        </filter>
+    </appender>
+
+    <!-- Log file debug output -->
+    <appender name="sourceLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <!-- 过滤器,只记录WARN级别的日志 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>INFO</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+        <file>${log.path}/source/source.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${log.path}/source/source-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>50MB</maxFileSize>
+            <maxHistory>30</maxHistory>
+        </rollingPolicy>
+        <encoder>
+            <pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <!-- Level: FATAL 0  ERROR 3  WARN 4  INFO 6  DEBUG 7 -->
+    <root level="INFO">
+        <appender-ref ref="console"/>
+        <appender-ref ref="sourceLog"/>
+        <appender-ref ref="errorLog"/>
+    </root>
+</configuration>