From bd10af974c3dd89a346b6432bbf1b9fa6c875ead Mon Sep 17 00:00:00 2001
From: Bbt <2568197607@qq.com>
Date: Wed, 23 Oct 2024 15:39:45 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E7=89=88=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 38 ++
.idea/.gitignore | 8 +
.idea/dataSources.xml | 12 +
.idea/easyCodeTableSetting.xml | 484 ++++++++++++++++++
.idea/encodings.xml | 8 +
.idea/kotlinc.xml | 6 +
.idea/misc.xml | 14 +
.idea/mybatisx/templates.xml | 76 +++
.idea/uiDesigner.xml | 124 +++++
.idea/vcs.xml | 6 +
pom.xml | 116 +++++
.../com/watu/SySaveRecordApplication.java | 18 +
src/main/java/com/watu/config/RootConfig.java | 26 +
.../java/com/watu/config/SchuedingConfig.java | 115 +++++
.../com/watu/mapper/TbBuildInfoMapper.java | 18 +
.../com/watu/mapper/TbDeviceInfoMapper.java | 18 +
.../com/watu/mapper/TbLayerInfoMapper.java | 18 +
.../com/watu/mapper/TbPlaceInfoMapper.java | 18 +
.../watu/mapper/TransitDoorRecordMapper.java | 18 +
.../watu/mapper/TransitUserRecordMapper.java | 18 +
src/main/java/com/watu/pojo/TbBuildInfo.java | 119 +++++
src/main/java/com/watu/pojo/TbDeviceInfo.java | 193 +++++++
src/main/java/com/watu/pojo/TbLayerInfo.java | 99 ++++
src/main/java/com/watu/pojo/TbPlaceInfo.java | 203 ++++++++
.../java/com/watu/pojo/TransitDoorRecord.java | 174 +++++++
.../java/com/watu/pojo/TransitUserRecord.java | 194 +++++++
.../java/com/watu/service/FileProcessor.java | 182 +++++++
.../com/watu/service/TbBuildInfoService.java | 13 +
.../com/watu/service/TbDeviceInfoService.java | 13 +
.../com/watu/service/TbLayerInfoService.java | 13 +
.../com/watu/service/TbPlaceInfoService.java | 13 +
.../service/TransitDoorRecordService.java | 13 +
.../service/TransitUserRecordService.java | 13 +
.../service/impl/TbBuildInfoServiceImpl.java | 22 +
.../service/impl/TbDeviceInfoServiceImpl.java | 22 +
.../service/impl/TbLayerInfoServiceImpl.java | 22 +
.../service/impl/TbPlaceInfoServiceImpl.java | 22 +
.../impl/TransitDoorRecordServiceImpl.java | 22 +
.../impl/TransitUserRecordServiceImpl.java | 22 +
src/main/resources/application.yml | 39 ++
src/main/resources/logback-spring.xml | 73 +++
.../resources/mapper/TbBuildInfoMapper.xml | 42 ++
.../resources/mapper/TbDeviceInfoMapper.xml | 67 +++
.../resources/mapper/TbLayerInfoMapper.xml | 35 ++
.../resources/mapper/TbPlaceInfoMapper.xml | 70 +++
.../mapper/TransitDoorRecordMapper.xml | 60 +++
.../mapper/TransitUserRecordMapper.xml | 67 +++
47 files changed, 2986 insertions(+)
create mode 100644 .gitignore
create mode 100644 .idea/.gitignore
create mode 100644 .idea/dataSources.xml
create mode 100644 .idea/easyCodeTableSetting.xml
create mode 100644 .idea/encodings.xml
create mode 100644 .idea/kotlinc.xml
create mode 100644 .idea/misc.xml
create mode 100644 .idea/mybatisx/templates.xml
create mode 100644 .idea/uiDesigner.xml
create mode 100644 .idea/vcs.xml
create mode 100644 pom.xml
create mode 100644 src/main/java/com/watu/SySaveRecordApplication.java
create mode 100644 src/main/java/com/watu/config/RootConfig.java
create mode 100644 src/main/java/com/watu/config/SchuedingConfig.java
create mode 100644 src/main/java/com/watu/mapper/TbBuildInfoMapper.java
create mode 100644 src/main/java/com/watu/mapper/TbDeviceInfoMapper.java
create mode 100644 src/main/java/com/watu/mapper/TbLayerInfoMapper.java
create mode 100644 src/main/java/com/watu/mapper/TbPlaceInfoMapper.java
create mode 100644 src/main/java/com/watu/mapper/TransitDoorRecordMapper.java
create mode 100644 src/main/java/com/watu/mapper/TransitUserRecordMapper.java
create mode 100644 src/main/java/com/watu/pojo/TbBuildInfo.java
create mode 100644 src/main/java/com/watu/pojo/TbDeviceInfo.java
create mode 100644 src/main/java/com/watu/pojo/TbLayerInfo.java
create mode 100644 src/main/java/com/watu/pojo/TbPlaceInfo.java
create mode 100644 src/main/java/com/watu/pojo/TransitDoorRecord.java
create mode 100644 src/main/java/com/watu/pojo/TransitUserRecord.java
create mode 100644 src/main/java/com/watu/service/FileProcessor.java
create mode 100644 src/main/java/com/watu/service/TbBuildInfoService.java
create mode 100644 src/main/java/com/watu/service/TbDeviceInfoService.java
create mode 100644 src/main/java/com/watu/service/TbLayerInfoService.java
create mode 100644 src/main/java/com/watu/service/TbPlaceInfoService.java
create mode 100644 src/main/java/com/watu/service/TransitDoorRecordService.java
create mode 100644 src/main/java/com/watu/service/TransitUserRecordService.java
create mode 100644 src/main/java/com/watu/service/impl/TbBuildInfoServiceImpl.java
create mode 100644 src/main/java/com/watu/service/impl/TbDeviceInfoServiceImpl.java
create mode 100644 src/main/java/com/watu/service/impl/TbLayerInfoServiceImpl.java
create mode 100644 src/main/java/com/watu/service/impl/TbPlaceInfoServiceImpl.java
create mode 100644 src/main/java/com/watu/service/impl/TransitDoorRecordServiceImpl.java
create mode 100644 src/main/java/com/watu/service/impl/TransitUserRecordServiceImpl.java
create mode 100644 src/main/resources/application.yml
create mode 100644 src/main/resources/logback-spring.xml
create mode 100644 src/main/resources/mapper/TbBuildInfoMapper.xml
create mode 100644 src/main/resources/mapper/TbDeviceInfoMapper.xml
create mode 100644 src/main/resources/mapper/TbLayerInfoMapper.xml
create mode 100644 src/main/resources/mapper/TbPlaceInfoMapper.xml
create mode 100644 src/main/resources/mapper/TransitDoorRecordMapper.xml
create mode 100644 src/main/resources/mapper/TransitUserRecordMapper.xml
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5ff6309
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,38 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..35410ca
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
new file mode 100644
index 0000000..24093e5
--- /dev/null
+++ b/.idea/dataSources.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ mysql.8
+ true
+ com.mysql.cj.jdbc.Driver
+ jdbc:mysql://192.168.0.10:55306/syry
+ $ProjectFileDir$
+
+
+
\ No newline at end of file
diff --git a/.idea/easyCodeTableSetting.xml b/.idea/easyCodeTableSetting.xml
new file mode 100644
index 0000000..2933dae
--- /dev/null
+++ b/.idea/easyCodeTableSetting.xml
@@ -0,0 +1,484 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..63574ec
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
new file mode 100644
index 0000000..2d95299
--- /dev/null
+++ b/.idea/kotlinc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..132404b
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/mybatisx/templates.xml b/.idea/mybatisx/templates.xml
new file mode 100644
index 0000000..2f0fc97
--- /dev/null
+++ b/.idea/mybatisx/templates.xml
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..2b63946
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..f8b5d24
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,116 @@
+
+
+ 4.0.0
+
+
+ spring-boot-starter-parent
+ org.springframework.boot
+ 2.3.9.RELEASE
+
+
+
+ com.watu
+ SY-saverecord
+ 1.0-SNAPSHOT
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+ com.alibaba
+ fastjson
+ 1.2.80
+
+
+
+ commons-io
+ commons-io
+ 2.11.0
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ 2.15.2
+
+
+
+
+
+ com.baomidou
+ mybatis-plus
+ 3.4.1
+
+
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+ 3.4.1
+
+
+
+
+ mysql
+ mysql-connector-java
+ 5.1.47
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ true
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-redis
+ 2.4.0
+
+
+ org.projectlombok
+ lombok
+ 1.18.28
+
+
+ commons-lang
+ commons-lang
+ 2.6
+
+
+ cn.hutool
+ hutool-all
+ 5.8.18
+
+
+
+ com.github.ben-manes.caffeine
+ caffeine
+ 2.9.0
+
+
+ org.apache.commons
+ commons-lang3
+ 3.6
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/watu/SySaveRecordApplication.java b/src/main/java/com/watu/SySaveRecordApplication.java
new file mode 100644
index 0000000..1f53a00
--- /dev/null
+++ b/src/main/java/com/watu/SySaveRecordApplication.java
@@ -0,0 +1,18 @@
+package com.watu;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+/*
+ * @User $USER
+ * @Time $DATE $TIME
+ *
+ */
+@SpringBootApplication
+@EnableScheduling
+public class SySaveRecordApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(SySaveRecordApplication.class, args);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/watu/config/RootConfig.java b/src/main/java/com/watu/config/RootConfig.java
new file mode 100644
index 0000000..b53c678
--- /dev/null
+++ b/src/main/java/com/watu/config/RootConfig.java
@@ -0,0 +1,26 @@
+package com.watu.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author 杜俊岩
+ * @Date 2023/12/22 17:46
+ * @Version 1.0
+ */
+@Data
+@Component
+@ConfigurationProperties(prefix = "root")
+public class RootConfig {
+ private String path;
+ private String nephropathic;
+ private String base64path;
+ private String lyypath;
+ private String ip;
+ private String port;
+ private String cron;
+ private String ftpflag;
+ private String twoeyflag;
+ private String scmsflag;
+}
diff --git a/src/main/java/com/watu/config/SchuedingConfig.java b/src/main/java/com/watu/config/SchuedingConfig.java
new file mode 100644
index 0000000..13c2199
--- /dev/null
+++ b/src/main/java/com/watu/config/SchuedingConfig.java
@@ -0,0 +1,115 @@
+package com.watu.config;
+
+import com.alibaba.fastjson.JSON;
+import com.watu.service.FileProcessor;
+import com.watu.service.TbDeviceInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.stream.Collectors;
+
+/**
+ * @Author 杜俊岩
+ * @Date 2023/12/22 17:46
+ * @Version 1.0
+ */
+@Component
+public class SchuedingConfig {
+
+ @Autowired
+ private StringRedisTemplate redisTemplate;
+ @Autowired
+ private FileProcessor fileProcessor;
+ @Autowired
+ private RootConfig rootConfig;
+ @Autowired
+ private TbDeviceInfoService tbDeviceInfoService;
+
+ private final ExecutorService executorService = Executors.newFixedThreadPool(10);
+ private final ConcurrentHashMap processedFiles = new ConcurrentHashMap<>();
+
+
+ /**
+ * @description
+ * @author 杜俊岩
+ * @param[1] null
+ * @throws
+ * @time 2024/10/23 11:03
+ * 定时更新设备信息
+ */
+ @Scheduled(initialDelay = 1000, fixedRate = 30000)
+ public void updateDeviceInfo() {
+ //TODO
+ String redisKey = "deviceChannels";
+ List list = tbDeviceInfoService.list();
+ Map devicemap = list.stream()
+ .collect(Collectors.toMap(
+ TbDeviceInfo::getGbsChannelNo,
+ JSON::toJSONString,
+ (existing, replacement) -> {
+ return existing;
+ }
+ ));
+ redisTemplate.opsForHash().putAll(redisKey, devicemap);
+ System.out.println("定时更新设备信息成功");
+ }
+
+
+
+ /**
+ * @description
+ * @author 杜俊岩
+ * @param[1] null
+ * @throws
+ * @time 2024/10/22 11:30
+ * 定时检测指定文件夹下的人脸或者bcp文件,判断是否符合规范解析bcp存入mysql数据库
+ */
+ @Scheduled(cron = "0 0/5 * * * ?")
+ public void checkFaceOrBcp(){
+ //TODO
+ System.out.println("定时检测指定文件夹下的人脸或者bcp文件,判断是否符合规范解析bcp存入mysql数据库");
+ File dir = new File(rootConfig.getPath());
+ List newFiles = new ArrayList<>();
+ findFilesRecursively(dir, newFiles);
+ if (!newFiles.isEmpty()) {
+ executorService.submit(() -> fileProcessor.processV4Files(newFiles));
+ } else {
+// log.info("没有新文件");
+ }
+ }
+
+ private void findFilesRecursively(File dir, List newFiles) {
+ File[] files = dir.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ if (file.isDirectory()) {
+ findFilesRecursively(file, newFiles);
+ } else {
+ String filePath = file.getAbsolutePath();
+ if (file.getName().endsWith(".bcp") || processedFiles.putIfAbsent(filePath, true) == null){
+ String fileName = file.getName();
+ String[] parts = fileName.split("_");
+ if (parts.length > 1) {
+ if ("WT".equals(parts[1])) {
+ newFiles.add(file);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+
+
+}
diff --git a/src/main/java/com/watu/mapper/TbBuildInfoMapper.java b/src/main/java/com/watu/mapper/TbBuildInfoMapper.java
new file mode 100644
index 0000000..60f6a3a
--- /dev/null
+++ b/src/main/java/com/watu/mapper/TbBuildInfoMapper.java
@@ -0,0 +1,18 @@
+package com.watu.mapper;
+
+import com.watu.pojo.TbBuildInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author 章北海
+* @description 针对表【tb_build_info(楼栋信息表)】的数据库操作Mapper
+* @createDate 2024-10-23 11:43:32
+* @Entity com.watu.pojo.TbBuildInfo
+*/
+public interface TbBuildInfoMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/src/main/java/com/watu/mapper/TbDeviceInfoMapper.java b/src/main/java/com/watu/mapper/TbDeviceInfoMapper.java
new file mode 100644
index 0000000..502503d
--- /dev/null
+++ b/src/main/java/com/watu/mapper/TbDeviceInfoMapper.java
@@ -0,0 +1,18 @@
+package com.watu.mapper;
+
+import com.watu.pojo.TbDeviceInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author 章北海
+* @description 针对表【tb_device_info(智能设备信息表)】的数据库操作Mapper
+* @createDate 2024-10-23 11:43:32
+* @Entity com.watu.pojo.TbDeviceInfo
+*/
+public interface TbDeviceInfoMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/src/main/java/com/watu/mapper/TbLayerInfoMapper.java b/src/main/java/com/watu/mapper/TbLayerInfoMapper.java
new file mode 100644
index 0000000..cc888ec
--- /dev/null
+++ b/src/main/java/com/watu/mapper/TbLayerInfoMapper.java
@@ -0,0 +1,18 @@
+package com.watu.mapper;
+
+import com.watu.pojo.TbLayerInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author 章北海
+* @description 针对表【tb_layer_info(楼层管理表)】的数据库操作Mapper
+* @createDate 2024-10-23 11:43:32
+* @Entity com.watu.pojo.TbLayerInfo
+*/
+public interface TbLayerInfoMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/src/main/java/com/watu/mapper/TbPlaceInfoMapper.java b/src/main/java/com/watu/mapper/TbPlaceInfoMapper.java
new file mode 100644
index 0000000..ad254d2
--- /dev/null
+++ b/src/main/java/com/watu/mapper/TbPlaceInfoMapper.java
@@ -0,0 +1,18 @@
+package com.watu.mapper;
+
+import com.watu.pojo.TbPlaceInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author 章北海
+* @description 针对表【tb_place_info(场所信息表)】的数据库操作Mapper
+* @createDate 2024-10-23 11:43:32
+* @Entity com.watu.pojo.TbPlaceInfo
+*/
+public interface TbPlaceInfoMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/src/main/java/com/watu/mapper/TransitDoorRecordMapper.java b/src/main/java/com/watu/mapper/TransitDoorRecordMapper.java
new file mode 100644
index 0000000..a0de37c
--- /dev/null
+++ b/src/main/java/com/watu/mapper/TransitDoorRecordMapper.java
@@ -0,0 +1,18 @@
+package com.watu.mapper;
+
+import com.watu.pojo.TransitDoorRecord;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author 章北海
+* @description 针对表【transit_door_record(门禁记录表)】的数据库操作Mapper
+* @createDate 2024-10-23 11:43:32
+* @Entity com.watu.pojo.TransitDoorRecord
+*/
+public interface TransitDoorRecordMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/src/main/java/com/watu/mapper/TransitUserRecordMapper.java b/src/main/java/com/watu/mapper/TransitUserRecordMapper.java
new file mode 100644
index 0000000..da331aa
--- /dev/null
+++ b/src/main/java/com/watu/mapper/TransitUserRecordMapper.java
@@ -0,0 +1,18 @@
+package com.watu.mapper;
+
+import com.watu.pojo.TransitUserRecord;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author 章北海
+* @description 针对表【transit_user_record(人脸记录表)】的数据库操作Mapper
+* @createDate 2024-10-23 11:43:32
+* @Entity com.watu.pojo.TransitUserRecord
+*/
+public interface TransitUserRecordMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/src/main/java/com/watu/pojo/TbBuildInfo.java b/src/main/java/com/watu/pojo/TbBuildInfo.java
new file mode 100644
index 0000000..beacbbb
--- /dev/null
+++ b/src/main/java/com/watu/pojo/TbBuildInfo.java
@@ -0,0 +1,119 @@
+package com.watu.pojo;
+
+
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+
+/**
+* 楼栋信息表
+* @TableName tb_build_info
+*/
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName(value="tb_build_info")
+public class TbBuildInfo implements Serializable {
+
+ /**
+ * 主键
+ */
+ private Long id;
+ /**
+ * 单位编码
+ */
+ private String placeCode;
+ /**
+ * 单位名称
+ */
+ private String placeName;
+ /**
+ * 楼栋编码
+ */
+ private String buildingCode;
+ /**
+ * 楼栋名称
+ */
+ private String buildingName;
+ /**
+ * 楼栋类型
+ */
+ private Integer buildingType;
+ /**
+ * 楼栋经度
+ */
+ private BigDecimal longitude;
+ /**
+ * 楼栋维度
+ */
+ private BigDecimal latitude;
+ /**
+ * 建筑面积
+ */
+ private String floorAcreage;
+ /**
+ * 楼栋地址
+ */
+ private String buildingAddress;
+ /**
+ * 楼层数量
+ */
+ private Integer layerNum;
+ /**
+ * 户室数量
+ */
+ private Integer homeNum;
+ /**
+ * 创建时间
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private Date createTime;
+ /**
+ * 创建者
+ */
+ private Integer createBy;
+ /**
+ * 更新时间
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private Date updateTime;
+ /**
+ * 更新者
+ */
+ private Integer updateBy;
+ /**
+ * 0:不活跃,1:活跃
+ */
+ private Integer isActive;
+ /**
+ *
+ */
+ private String c1;
+ /**
+ *
+ */
+ private String c2;
+ /**
+ *
+ */
+ private String c3;
+ /**
+ *
+ */
+ private String c4;
+ /**
+ *
+ */
+ private String c5;
+
+
+}
diff --git a/src/main/java/com/watu/pojo/TbDeviceInfo.java b/src/main/java/com/watu/pojo/TbDeviceInfo.java
new file mode 100644
index 0000000..dc58a1d
--- /dev/null
+++ b/src/main/java/com/watu/pojo/TbDeviceInfo.java
@@ -0,0 +1,193 @@
+package com.watu.pojo;
+
+
+import java.io.Serializable;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+* 智能设备信息表
+* @TableName tb_device_info
+*/
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName(value="tb_device_info")
+public class TbDeviceInfo implements Serializable {
+
+ /**
+ * 主键
+ */
+ private Long id;
+ /**
+ * 通道国标编码
+ */
+ private String gbsChannelNo;
+ /**
+ * 场所编码
+ */
+ private String placeCode;
+ /**
+ * 场所名称
+ */
+ private String placeName;
+ /**
+ * 楼栋编码
+ */
+ private String buildingCode;
+ /**
+ * 楼栋名称
+ */
+ private String buildingName;
+ /**
+ * 楼层编码
+ */
+ private String layerCode;
+ /**
+ * 楼层名称
+ */
+ private String layerName;
+ /**
+ * 设备编码
+ */
+ private String deviceCode;
+ /**
+ * 设备名称
+ */
+ private String deviceName;
+ /**
+ * 设备类型
+ */
+ private Integer deviceType;
+ /**
+ * 安装位置
+ */
+ private String deviceAddress;
+ /**
+ * 设备方位
+ */
+ private Integer orientation;
+ /**
+ * 设备SN编号
+ */
+ private String deviceSn;
+ /**
+ * 设备品牌
+ */
+ private String deviceBrand;
+ /**
+ * 设备ip
+ */
+ private String deviceIp;
+ /**
+ * 设备端口
+ */
+ private Integer devicePort;
+ /**
+ * 设备MAC
+ */
+ private String deviceMac;
+ /**
+ * 设备IMEI
+ */
+ private String deviceImei;
+ /**
+ * 设备经度
+ */
+ private BigDecimal longitude;
+ /**
+ * 设备纬度
+ */
+ private BigDecimal latitude;
+ /**
+ * U3D经度
+ */
+ private BigDecimal u3dLongitude;
+ /**
+ * U3D纬度
+ */
+ private BigDecimal u3dLatitude;
+ /**
+ * 设备高度
+ */
+ private String deviceHeight;
+ /**
+ * 设备厂家
+ */
+ private String manufactor;
+ /**
+ * 设备登陆帐号
+ */
+ private String account;
+ /**
+ * 设备登陆密码
+ */
+ private String password;
+ /**
+ * 进出方向
+ */
+ private Integer direction;
+ /**
+ * RTSP流地址
+ */
+ private String rtspAddress;
+ /**
+ * 是否卡口设备
+ */
+ private Integer isDoorwayVideo;
+ /**
+ * 通道号
+ */
+ private Integer channelNo;
+ /**
+ * 创建时间
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private Date createTime;
+ /**
+ * 创建者
+ */
+ private Integer createBy;
+ /**
+ * 更新时间
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private Date updateTime;
+ /**
+ * 更新者
+ */
+ private Integer updateBy;
+ /**
+ * 0:不活跃,1:活跃
+ */
+ private Integer isActive;
+ /**
+ *
+ */
+ private String c1;
+ /**
+ *
+ */
+ private String c2;
+ /**
+ *
+ */
+ private String c3;
+ /**
+ *
+ */
+ private String c4;
+ /**
+ *
+ */
+ private String c5;
+
+
+}
diff --git a/src/main/java/com/watu/pojo/TbLayerInfo.java b/src/main/java/com/watu/pojo/TbLayerInfo.java
new file mode 100644
index 0000000..db85306
--- /dev/null
+++ b/src/main/java/com/watu/pojo/TbLayerInfo.java
@@ -0,0 +1,99 @@
+package com.watu.pojo;
+
+
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+import java.util.Date;
+
+
+/**
+* 楼层管理表
+* @TableName tb_layer_info
+*/
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName(value="tb_layer_info")
+public class TbLayerInfo implements Serializable {
+
+ /**
+ * 主键
+ */
+ private Integer id;
+ /**
+ * 单位编码
+ */
+ private String placeCode;
+ /**
+ * 单位名称
+ */
+ private String placeName;
+ /**
+ * 楼栋编码
+ */
+ private String buildingCode;
+ /**
+ * 楼栋名称
+ */
+ private String buildingName;
+ /**
+ * 楼层编码
+ */
+ private String layerCode;
+ /**
+ * 楼层名称
+ */
+ private String layerName;
+ /**
+ * 创建时间
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private Date createTime;
+ /**
+ * 创建者
+ */
+ private Integer createBy;
+ /**
+ * 更新时间
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private Date updateTime;
+ /**
+ * 更新者
+ */
+ private Integer updateBy;
+ /**
+ * 0:不活跃,1:活跃
+ */
+ private Integer isActive;
+ /**
+ *
+ */
+ private String c1;
+ /**
+ *
+ */
+ private String c2;
+ /**
+ *
+ */
+ private String c3;
+ /**
+ *
+ */
+ private String c4;
+ /**
+ *
+ */
+ private String c5;
+
+
+
+}
diff --git a/src/main/java/com/watu/pojo/TbPlaceInfo.java b/src/main/java/com/watu/pojo/TbPlaceInfo.java
new file mode 100644
index 0000000..48adc16
--- /dev/null
+++ b/src/main/java/com/watu/pojo/TbPlaceInfo.java
@@ -0,0 +1,203 @@
+package com.watu.pojo;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+
+/**
+* 场所信息表
+* @TableName tb_place_info
+*/
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName(value="tb_place_info")
+public class TbPlaceInfo implements Serializable {
+
+ /**
+ * 主键
+ */
+
+ private Long id;
+ /**
+ * 单位编码
+ */
+ private String placeCode;
+ /**
+ * 单位名称
+ */
+ private String placeName;
+ /**
+ * 场所平面图
+ */
+ private String placePic;
+ /**
+ * 小区地图
+ */
+ private String placeMap;
+ /**
+ * 场所类别
+ */
+ private Integer placeCategory;
+ /**
+ * 场所类型
+ */
+ private Integer placeType;
+ /**
+ * 场所性质
+ */
+ private Integer placeNature;
+ /**
+ * 占地面积
+ */
+ private String coversAcreage;
+ /**
+ * 建筑面积
+ */
+ private String structureAcreage;
+ /**
+ * 建成时间
+ */
+ private String neighBulitTime;
+ /**
+ * 启用时间
+ */
+ private String activeuseTime;
+ /**
+ * 接入状态
+ */
+ private Integer accessType;
+ /**
+ * 绿化率
+ */
+ private String afforestationRate;
+ /**
+ * 容积率
+ */
+ private String plotRate;
+ /**
+ * 经度
+ */
+ private BigDecimal longitude;
+ /**
+ * 纬度
+ */
+ private BigDecimal latitude;
+ /**
+ * 场所标准地址
+ */
+ private String placeAddress;
+ /**
+ * 省编码
+ */
+ private String provinceCode;
+ /**
+ * 省名称
+ */
+ private String provinceName;
+ /**
+ * 城市编码
+ */
+ private String cityCode;
+ /**
+ * 城市名称
+ */
+ private String cityName;
+ /**
+ * 区域编码
+ */
+ private String areaCode;
+ /**
+ * 区域名称
+ */
+ private String areaName;
+ /**
+ * 街道/乡镇编码
+ */
+ private String streetCode;
+ /**
+ * 街道/乡镇名称
+ */
+ private String streetName;
+ /**
+ * 社区/村编码
+ */
+ private String blockCode;
+ /**
+ * 社区/村名称
+ */
+ private String blockName;
+ /**
+ * 警务区编码
+ */
+ private String policeDistrictCode;
+ /**
+ * 责任民警姓名
+ */
+ private String policeName;
+ /**
+ * 警员编号
+ */
+ private String policeNo;
+ /**
+ * 责任民警电话
+ */
+ private String policePhone;
+ /**
+ * 责任民警照片
+ */
+ private String policePic;
+ /**
+ * 创建时间
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private Date createTime;
+ /**
+ * 创建者
+ */
+ private Integer createBy;
+ /**
+ * 更新时间
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private Date updateTime;
+ /**
+ * 更新者
+ */
+ private Integer updateBy;
+ /**
+ * 0:不活跃,1:活跃
+ */
+ private Integer isActive;
+ /**
+ *
+ */
+ private String c1;
+ /**
+ *
+ */
+ private String c2;
+ /**
+ *
+ */
+ private String c3;
+ /**
+ *
+ */
+ private String c4;
+ /**
+ *
+ */
+ private String c5;
+
+
+
+}
diff --git a/src/main/java/com/watu/pojo/TransitDoorRecord.java b/src/main/java/com/watu/pojo/TransitDoorRecord.java
new file mode 100644
index 0000000..6176186
--- /dev/null
+++ b/src/main/java/com/watu/pojo/TransitDoorRecord.java
@@ -0,0 +1,174 @@
+package com.watu.pojo;
+
+
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+* 门禁记录表
+* @TableName transit_door_record
+*/
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName(value="transit_door_record")
+public class TransitDoorRecord implements Serializable {
+
+ /**
+ * 主键
+ */
+ private Long id;
+ /**
+ * 开门时间(分区)
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private Date partitionField;
+ /**
+ * 单位编码
+ */
+ private String placeCode;
+ /**
+ * 单位名称
+ */
+ private String placeName;
+ /**
+ * 楼栋编码
+ */
+ private String buildingCode;
+ /**
+ * 楼栋名称
+ */
+ private String buildingName;
+ /**
+ * 楼层编码
+ */
+ private String layerCode;
+ /**
+ * 楼层名称
+ */
+ private String layerName;
+ /**
+ * 设备名称
+ */
+ private String deviceName;
+ /**
+ * 设备编码
+ */
+ private String deviceCode;
+ /**
+ * 视频监控编码
+ */
+ private String gbsChannelNo;
+ /**
+ * 安装位置
+ */
+ private String deviceAddress;
+ /**
+ * 设备ip
+ */
+ private String deviceIp;
+ /**
+ * 姓名
+ */
+ private String userName;
+ /**
+ * 联系电话
+ */
+ private String phone;
+ /**
+ * 证件号码
+ */
+ private String idcard;
+ /**
+ * 进出方向
+ */
+ private Integer direction;
+ /**
+ * 人脸图
+ */
+ private String personPic;
+ /**
+ * 记录唯一标识
+ */
+ private String recordId;
+ /**
+ * 数据来源唯一ID
+ */
+ private String sourceId;
+ /**
+ * 人脸小图唯一ID
+ */
+ private String personImageId;
+ /**
+ * 卡号/人脸编码
+ */
+ private String cardNo;
+ /**
+ * 门禁类型
+ */
+ private String cardType;
+ /**
+ * 开门结果
+ */
+ private String openResult;
+ /**
+ * 开门时间
+ */
+ private Long passTime;
+ /**
+ * 创建时间
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private Date createTime;
+ /**
+ * 创建者
+ */
+ private Integer createBy;
+ /**
+ * 更新时间
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private Date updateTime;
+ /**
+ * 更新者
+ */
+ private Integer updateBy;
+ /**
+ * 0:不活跃,1:活跃
+ */
+ private Integer isActive;
+ /**
+ *
+ */
+ private String c1;
+ /**
+ *
+ */
+ private String c2;
+ /**
+ *
+ */
+ private String c3;
+ /**
+ *
+ */
+ private String c4;
+ /**
+ *
+ */
+ private String c5;
+ /**
+ *
+ */
+ private String c6;
+
+
+}
diff --git a/src/main/java/com/watu/pojo/TransitUserRecord.java b/src/main/java/com/watu/pojo/TransitUserRecord.java
new file mode 100644
index 0000000..7a9fc53
--- /dev/null
+++ b/src/main/java/com/watu/pojo/TransitUserRecord.java
@@ -0,0 +1,194 @@
+package com.watu.pojo;
+
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+import java.util.Date;
+
+
+/**
+* 人脸记录表
+* @TableName transit_user_record
+*/
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName(value="transit_user_record")
+public class TransitUserRecord implements Serializable {
+
+ /**
+ * 主键
+ */
+ private Long id;
+ /**
+ * 抓拍时间(分区)
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private Date partitionField;
+ /**
+ * 场所编码
+ */
+ private String placeCode;
+ /**
+ * 场所名称
+ */
+ private String placeName;
+ /**
+ * 楼栋编码
+ */
+ private String buildingCode;
+ /**
+ * 楼栋名称
+ */
+ private String buildingName;
+ /**
+ * 楼层编码
+ */
+ private String layerCode;
+ /**
+ * 楼层名称
+ */
+ private String layerName;
+ /**
+ * 设备编码
+ */
+ private String deviceCode;
+ /**
+ * 设备名称
+ */
+ private String deviceName;
+ /**
+ * 通道国标编码
+ */
+ private String gbsChannelNo;
+ /**
+ * 安装位置
+ */
+ private String deviceAddress;
+ /**
+ * 设备ip
+ */
+ private String deviceIp;
+ /**
+ * 全景图
+ */
+ private String globalPic;
+ /**
+ * 人脸图
+ */
+ private String personPic;
+ /**
+ * 常口库标准照片
+ */
+ private String userStandardPic;
+ /**
+ * 人员姓名
+ */
+ private String userName;
+ /**
+ * 档案编号
+ */
+ private String dossierCode;
+ /**
+ * 证件号码
+ */
+ private String idCard;
+ /**
+ * 联系电话
+ */
+ private String phone;
+ /**
+ * 记录唯一标识
+ */
+ private String recordId;
+ /**
+ * 人车与人体同拍关联ID
+ */
+ private String userVehicleBodyRecordId;
+ /**
+ * 数据来源唯一ID
+ */
+ private String sourceId;
+ /**
+ * 人脸小图唯一ID
+ */
+ private String personImageId;
+ /**
+ * 人脸大图唯一ID
+ */
+ private String globalImageId;
+ /**
+ * 相似度
+ */
+ private String similarity;
+ /**
+ * 是否已比对人脸
+ */
+ private Integer isCompare;
+ /**
+ * 进出方向
+ */
+ private Integer direction;
+ /**
+ * 抓拍时间
+ */
+ private Long passTime;
+ /**
+ * 轴系坐标
+ */
+ private String axis;
+ /**
+ * 数据来源
+ */
+ private Integer dataSrc;
+ /**
+ * 创建时间
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private Date createTime;
+ /**
+ * 创建者
+ */
+ private Integer createBy;
+ /**
+ * 更新时间
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ private Date updateTime;
+ /**
+ * 更新者
+ */
+ private Integer updateBy;
+ /**
+ * 0:不活跃,1:活跃
+ */
+ private Integer isActive;
+ /**
+ *
+ */
+ private String c1;
+ /**
+ *
+ */
+ private String c2;
+ /**
+ *
+ */
+ private String c3;
+ /**
+ *
+ */
+ private String c4;
+ /**
+ *
+ */
+ private String c5;
+
+
+}
diff --git a/src/main/java/com/watu/service/FileProcessor.java b/src/main/java/com/watu/service/FileProcessor.java
new file mode 100644
index 0000000..cede0d0
--- /dev/null
+++ b/src/main/java/com/watu/service/FileProcessor.java
@@ -0,0 +1,182 @@
+package com.watu.service;
+
+import com.alibaba.fastjson.JSON;
+import com.watu.pojo.TbDeviceInfo;
+import com.watu.pojo.TransitDoorRecord;
+import com.watu.pojo.TransitUserRecord;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.nio.charset.StandardCharsets;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Author 杜俊岩
+ * @Date 2024/10/22 11:34
+ * @Version 1.0
+ */
+@Log4j2
+@Service
+public class FileProcessor {
+
+ @Autowired
+ private TransitDoorRecordService transitDoorRecordService;
+ @Autowired
+ private TransitUserRecordService transitUserRecordService;
+ @Autowired
+ private StringRedisTemplate redisTemplate;
+
+ private static final SimpleDateFormat ymd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+ public void processV4Files(List files) {
+ log.info("检测到4.0版本文件: {}", files.size());
+ files.forEach(file -> {
+ try {
+ String name = file.getName();
+ FileInputStream inputStream = new FileInputStream(file);
+ byte[] buffer = new byte[(int) file.length()];
+ inputStream.read(buffer);
+ String data = new String(buffer, StandardCharsets.UTF_8);
+ if (name.contains("DoorEvent")) {
+ savedoorrecord(data);
+ }else if (name.contains("FaceCapture")) {
+ saveuserrecord(data);
+ }
+ log.info("处理4.0版本文件成功: {}", file.getName());
+ } catch (Exception e) {
+ log.error("处理4.0版本文件失败: {}", file.getName(), e);
+ }
+ });
+ }
+
+
+ /**
+ * @description
+ * @author 杜俊岩
+ * @param[1] null
+ * @throws
+ * @time 2024/10/22 14:22
+ * 生成门禁通行记录
+ */
+ public void savedoorrecord(String data){
+ //TODO
+ TransitDoorRecord transitDoorRecord = new TransitDoorRecord();
+ String[] split = data.split(",");
+ long nowtime = System.currentTimeMillis();
+ //通过bcp的内容填充字段
+ //根据国标编码查询设备
+ String deviceinfostring= (String) redisTemplate.opsForHash().get("deviceChannels", split[1]);
+ TbDeviceInfo deviceInfo = JSON.parseObject(deviceinfostring, TbDeviceInfo.class);
+ transitDoorRecord.setDeviceCode(deviceInfo.getDeviceCode());
+ transitDoorRecord.setDeviceName(deviceInfo.getDeviceName());
+ transitDoorRecord.setPlaceCode(deviceInfo.getPlaceCode());
+ transitDoorRecord.setPlaceName(deviceInfo.getPlaceName());
+ transitDoorRecord.setBuildingCode(deviceInfo.getBuildingCode());
+ transitDoorRecord.setBuildingName(deviceInfo.getBuildingName());
+ transitDoorRecord.setLayerCode(deviceInfo.getLayerCode());
+ transitDoorRecord.setLayerName(deviceInfo.getLayerName());
+ transitDoorRecord.setGbsChannelNo(deviceInfo.getGbsChannelNo());
+ transitDoorRecord.setDeviceAddress(deviceInfo.getDeviceAddress());
+ transitDoorRecord.setDeviceIp(deviceInfo.getDeviceIp());
+ transitDoorRecord.setDirection(deviceInfo.getDirection());
+
+ //从报文中获取
+ Long sendtime = Long.parseLong(split[2]);
+ transitDoorRecord.setPersonPic(split[14]);
+ transitDoorRecord.setUserName(split[7]);
+ transitDoorRecord.setOpenResult(split[12]);
+ transitDoorRecord.setCardType(split[19]);
+ transitDoorRecord.setPassTime(sendtime);
+ transitDoorRecord.setPartitionField(new Date(sendtime * 1000));
+ transitDoorRecord.setCreateTime(new Date(nowtime));
+ transitDoorRecord.setUpdateTime(new Date(nowtime));
+ transitDoorRecord.setIsActive(1);
+
+ }
+
+ /**
+ * @description
+ * @author 杜俊岩
+ * @param[1] null
+ * @throws
+ * @time 2024/10/22 14:23
+ * 生成人脸通行记录
+ */
+ public void saveuserrecord(String data){
+ //TODO
+ TransitUserRecord transitUserRecord = new TransitUserRecord();
+ try {
+ String[] split = data.split(",");
+ long nowtime = System.currentTimeMillis();
+ //通过bcp的内容填充字段
+ //根据国标编码查询设备
+ String deviceinfostring= (String) redisTemplate.opsForHash().get("deviceChannels", split[1]);
+ TbDeviceInfo deviceInfo = JSON.parseObject(deviceinfostring, TbDeviceInfo.class);
+ transitUserRecord.setDeviceCode(deviceInfo.getDeviceCode());
+ transitUserRecord.setDeviceName(deviceInfo.getDeviceName());
+ transitUserRecord.setPlaceCode(deviceInfo.getPlaceCode());
+ transitUserRecord.setPlaceName(deviceInfo.getPlaceName());
+ transitUserRecord.setBuildingCode(deviceInfo.getBuildingCode());
+ transitUserRecord.setBuildingName(deviceInfo.getBuildingName());
+ transitUserRecord.setLayerCode(deviceInfo.getLayerCode());
+ transitUserRecord.setLayerName(deviceInfo.getLayerName());
+ transitUserRecord.setGbsChannelNo(deviceInfo.getGbsChannelNo());
+ transitUserRecord.setDeviceAddress(deviceInfo.getDeviceAddress());
+ transitUserRecord.setDeviceIp(deviceInfo.getDeviceIp());
+ transitUserRecord.setDirection(deviceInfo.getDirection());
+
+ //从报文中获取
+ Long sendtime = Long.parseLong(split[2]);
+ transitUserRecord.setGlobalPic(split[5]);
+ transitUserRecord.setPersonPic(split[6]);
+ transitUserRecord.setIdCard(split[7]);
+ transitUserRecord.setUserName(split[8]);
+ transitUserRecord.setPassTime(sendtime);
+ transitUserRecord.setPartitionField(new Date(sendtime * 1000));
+ transitUserRecord.setCreateTime(new Date(nowtime));
+ transitUserRecord.setUpdateTime(new Date(nowtime));
+ transitUserRecord.setIsActive(1);
+
+ //添加数据库
+ transitUserRecordService.save(transitUserRecord);
+ log.info("处理人脸通行记录成功: {}", data);
+ } catch (Exception e) {
+ log.error("处理人脸通行记录失败", e);
+ }
+ }
+
+
+ /**
+ * @description
+ * @author 杜俊岩
+ * @param[1] null
+ * @throws
+ * @time 2024/10/23 14:59
+ * 公共方法将base64转为图片存入服务器中
+ */
+ public String creatpic(String base64){
+ //TODO
+ return null;
+ }
+
+ /**
+ * @description
+ * @author 杜俊岩
+ * @param[1] null
+ * @throws
+ * @time 2024/10/23 15:13
+ * 公共方法,时间戳转yyyy-MM-dd HH:mm:ss格式
+ */
+ public String getDateStr(long sendTime){
+ Long time = sendTime * 1000;
+ Date date = new Date(time);
+ return ymd.format(date);
+ }
+
+}
diff --git a/src/main/java/com/watu/service/TbBuildInfoService.java b/src/main/java/com/watu/service/TbBuildInfoService.java
new file mode 100644
index 0000000..a22ca47
--- /dev/null
+++ b/src/main/java/com/watu/service/TbBuildInfoService.java
@@ -0,0 +1,13 @@
+package com.watu.service;
+
+import com.watu.pojo.TbBuildInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author 章北海
+* @description 针对表【tb_build_info(楼栋信息表)】的数据库操作Service
+* @createDate 2024-10-23 11:43:32
+*/
+public interface TbBuildInfoService extends IService {
+
+}
diff --git a/src/main/java/com/watu/service/TbDeviceInfoService.java b/src/main/java/com/watu/service/TbDeviceInfoService.java
new file mode 100644
index 0000000..2add99c
--- /dev/null
+++ b/src/main/java/com/watu/service/TbDeviceInfoService.java
@@ -0,0 +1,13 @@
+package com.watu.service;
+
+import com.watu.pojo.TbDeviceInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author 章北海
+* @description 针对表【tb_device_info(智能设备信息表)】的数据库操作Service
+* @createDate 2024-10-23 11:43:32
+*/
+public interface TbDeviceInfoService extends IService {
+
+}
diff --git a/src/main/java/com/watu/service/TbLayerInfoService.java b/src/main/java/com/watu/service/TbLayerInfoService.java
new file mode 100644
index 0000000..4d2ddf2
--- /dev/null
+++ b/src/main/java/com/watu/service/TbLayerInfoService.java
@@ -0,0 +1,13 @@
+package com.watu.service;
+
+import com.watu.pojo.TbLayerInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author 章北海
+* @description 针对表【tb_layer_info(楼层管理表)】的数据库操作Service
+* @createDate 2024-10-23 11:43:32
+*/
+public interface TbLayerInfoService extends IService {
+
+}
diff --git a/src/main/java/com/watu/service/TbPlaceInfoService.java b/src/main/java/com/watu/service/TbPlaceInfoService.java
new file mode 100644
index 0000000..9ddecce
--- /dev/null
+++ b/src/main/java/com/watu/service/TbPlaceInfoService.java
@@ -0,0 +1,13 @@
+package com.watu.service;
+
+import com.watu.pojo.TbPlaceInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author 章北海
+* @description 针对表【tb_place_info(场所信息表)】的数据库操作Service
+* @createDate 2024-10-23 11:43:32
+*/
+public interface TbPlaceInfoService extends IService {
+
+}
diff --git a/src/main/java/com/watu/service/TransitDoorRecordService.java b/src/main/java/com/watu/service/TransitDoorRecordService.java
new file mode 100644
index 0000000..03c1340
--- /dev/null
+++ b/src/main/java/com/watu/service/TransitDoorRecordService.java
@@ -0,0 +1,13 @@
+package com.watu.service;
+
+import com.watu.pojo.TransitDoorRecord;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author 章北海
+* @description 针对表【transit_door_record(门禁记录表)】的数据库操作Service
+* @createDate 2024-10-23 11:43:32
+*/
+public interface TransitDoorRecordService extends IService {
+
+}
diff --git a/src/main/java/com/watu/service/TransitUserRecordService.java b/src/main/java/com/watu/service/TransitUserRecordService.java
new file mode 100644
index 0000000..8a96cac
--- /dev/null
+++ b/src/main/java/com/watu/service/TransitUserRecordService.java
@@ -0,0 +1,13 @@
+package com.watu.service;
+
+import com.watu.pojo.TransitUserRecord;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author 章北海
+* @description 针对表【transit_user_record(人脸记录表)】的数据库操作Service
+* @createDate 2024-10-23 11:43:32
+*/
+public interface TransitUserRecordService extends IService {
+
+}
diff --git a/src/main/java/com/watu/service/impl/TbBuildInfoServiceImpl.java b/src/main/java/com/watu/service/impl/TbBuildInfoServiceImpl.java
new file mode 100644
index 0000000..ba08859
--- /dev/null
+++ b/src/main/java/com/watu/service/impl/TbBuildInfoServiceImpl.java
@@ -0,0 +1,22 @@
+package com.watu.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.watu.pojo.TbBuildInfo;
+import com.watu.service.TbBuildInfoService;
+import com.watu.mapper.TbBuildInfoMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author 章北海
+* @description 针对表【tb_build_info(楼栋信息表)】的数据库操作Service实现
+* @createDate 2024-10-23 11:43:32
+*/
+@Service
+public class TbBuildInfoServiceImpl extends ServiceImpl
+ implements TbBuildInfoService{
+
+}
+
+
+
+
diff --git a/src/main/java/com/watu/service/impl/TbDeviceInfoServiceImpl.java b/src/main/java/com/watu/service/impl/TbDeviceInfoServiceImpl.java
new file mode 100644
index 0000000..f1bb2d1
--- /dev/null
+++ b/src/main/java/com/watu/service/impl/TbDeviceInfoServiceImpl.java
@@ -0,0 +1,22 @@
+package com.watu.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.watu.pojo.TbDeviceInfo;
+import com.watu.service.TbDeviceInfoService;
+import com.watu.mapper.TbDeviceInfoMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author 章北海
+* @description 针对表【tb_device_info(智能设备信息表)】的数据库操作Service实现
+* @createDate 2024-10-23 11:43:32
+*/
+@Service
+public class TbDeviceInfoServiceImpl extends ServiceImpl
+ implements TbDeviceInfoService{
+
+}
+
+
+
+
diff --git a/src/main/java/com/watu/service/impl/TbLayerInfoServiceImpl.java b/src/main/java/com/watu/service/impl/TbLayerInfoServiceImpl.java
new file mode 100644
index 0000000..2101c68
--- /dev/null
+++ b/src/main/java/com/watu/service/impl/TbLayerInfoServiceImpl.java
@@ -0,0 +1,22 @@
+package com.watu.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.watu.pojo.TbLayerInfo;
+import com.watu.service.TbLayerInfoService;
+import com.watu.mapper.TbLayerInfoMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author 章北海
+* @description 针对表【tb_layer_info(楼层管理表)】的数据库操作Service实现
+* @createDate 2024-10-23 11:43:32
+*/
+@Service
+public class TbLayerInfoServiceImpl extends ServiceImpl
+ implements TbLayerInfoService{
+
+}
+
+
+
+
diff --git a/src/main/java/com/watu/service/impl/TbPlaceInfoServiceImpl.java b/src/main/java/com/watu/service/impl/TbPlaceInfoServiceImpl.java
new file mode 100644
index 0000000..c22758b
--- /dev/null
+++ b/src/main/java/com/watu/service/impl/TbPlaceInfoServiceImpl.java
@@ -0,0 +1,22 @@
+package com.watu.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.watu.pojo.TbPlaceInfo;
+import com.watu.service.TbPlaceInfoService;
+import com.watu.mapper.TbPlaceInfoMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author 章北海
+* @description 针对表【tb_place_info(场所信息表)】的数据库操作Service实现
+* @createDate 2024-10-23 11:43:32
+*/
+@Service
+public class TbPlaceInfoServiceImpl extends ServiceImpl
+ implements TbPlaceInfoService{
+
+}
+
+
+
+
diff --git a/src/main/java/com/watu/service/impl/TransitDoorRecordServiceImpl.java b/src/main/java/com/watu/service/impl/TransitDoorRecordServiceImpl.java
new file mode 100644
index 0000000..7453c2f
--- /dev/null
+++ b/src/main/java/com/watu/service/impl/TransitDoorRecordServiceImpl.java
@@ -0,0 +1,22 @@
+package com.watu.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.watu.pojo.TransitDoorRecord;
+import com.watu.service.TransitDoorRecordService;
+import com.watu.mapper.TransitDoorRecordMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author 章北海
+* @description 针对表【transit_door_record(门禁记录表)】的数据库操作Service实现
+* @createDate 2024-10-23 11:43:32
+*/
+@Service
+public class TransitDoorRecordServiceImpl extends ServiceImpl
+ implements TransitDoorRecordService{
+
+}
+
+
+
+
diff --git a/src/main/java/com/watu/service/impl/TransitUserRecordServiceImpl.java b/src/main/java/com/watu/service/impl/TransitUserRecordServiceImpl.java
new file mode 100644
index 0000000..ef2c561
--- /dev/null
+++ b/src/main/java/com/watu/service/impl/TransitUserRecordServiceImpl.java
@@ -0,0 +1,22 @@
+package com.watu.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.watu.pojo.TransitUserRecord;
+import com.watu.service.TransitUserRecordService;
+import com.watu.mapper.TransitUserRecordMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author 章北海
+* @description 针对表【transit_user_record(人脸记录表)】的数据库操作Service实现
+* @createDate 2024-10-23 11:43:32
+*/
+@Service
+public class TransitUserRecordServiceImpl extends ServiceImpl
+ implements TransitUserRecordService{
+
+}
+
+
+
+
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
new file mode 100644
index 0000000..24d5288
--- /dev/null
+++ b/src/main/resources/application.yml
@@ -0,0 +1,39 @@
+server:
+ port: 7987
+spring:
+ profiles:
+ include: pro
+ active: test
+ application:
+ name: packetpars-service
+ main:
+ banner-mode: off
+ datasource:
+ driverClassName: com.mysql.jdbc.Driver
+# url: jdbc:mysql://1.94.45.26:10007/watu4?serverTimezone=GMT%2B8&useSSL=false&useUnicode=true&characterEncoding=utf8&max_allowed_packet=1048576
+# url: jdbc:mysql://127.0.0.1:55306/watu4?serverTimezone=GMT%2B8&useSSL=false&useUnicode=true&characterEncoding=utf8&max_allowed_packet=1048576
+# url: jdbc:mysql://192.168.0.11:55306/watu4?serverTimezone=GMT%2B8&useSSL=false&useUnicode=true&characterEncoding=utf8&max_allowed_packet=1048576
+ url: jdbc:mysql://192.168.0.38:55306/watu4?serverTimezone=GMT%2B8&useSSL=false&useUnicode=true&characterEncoding=utf8&max_allowed_packet=1048576
+ username: root
+ password: '!QAZ1qaz'
+ redis:
+ database: 15
+# host: 1.94.45.26
+ host: 192.168.0.38
+# host: 127.0.0.1
+# port: 10052
+ port: 26379
+ password: livegbs@2019
+mybatis-plus:
+ type-aliases-package: com.hikvsion.pojo #别名
+ configuration:
+ map-underscore-to-camel-case: true #驼峰映射
+ global-config:
+ db-config:
+ id-type: auto #id生成策略
+ banner: off
+logging:
+ config: classpath:logback-spring.xml
+ level:
+ root: info
+ org.apache.kafka: error
diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml
new file mode 100644
index 0000000..ce384e3
--- /dev/null
+++ b/src/main/resources/logback-spring.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+ ${CONSOLE_LOG_PATTERN}
+
+ UTF-8
+
+
+
+
+
+ ${LOG_PATH}/info/info.%d{yyyy-MM-dd}.log
+ 2
+
+
+
+ ${FILE_LOG_PATTERN}
+ UTF-8
+
+
+ INFO
+ ACCEPT
+ DENY
+
+
+
+
+ ${LOG_PATH}/error/error.%d{yyyy-MM-dd}.log
+ 2
+
+
+
+ ${FILE_LOG_PATTERN}
+ UTF-8
+
+
+ ERROR
+ ACCEPT
+ DENY
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/mapper/TbBuildInfoMapper.xml b/src/main/resources/mapper/TbBuildInfoMapper.xml
new file mode 100644
index 0000000..5f26191
--- /dev/null
+++ b/src/main/resources/mapper/TbBuildInfoMapper.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,place_code,place_name,
+ building_code,building_name,building_type,
+ longitude,latitude,floor_acreage,
+ building_address,layer_num,home_num,
+ create_time,create_by,update_time,
+ update_by,is_active,c1,
+ c2,c3,c4,
+ c5
+
+
diff --git a/src/main/resources/mapper/TbDeviceInfoMapper.xml b/src/main/resources/mapper/TbDeviceInfoMapper.xml
new file mode 100644
index 0000000..565464f
--- /dev/null
+++ b/src/main/resources/mapper/TbDeviceInfoMapper.xml
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,gbs_channel_no,place_code,
+ place_name,building_code,building_name,
+ layer_code,layer_name,device_code,
+ device_name,device_type,device_address,
+ orientation,device_sn,device_brand,
+ device_ip,device_port,device_mac,
+ device_imei,longitude,latitude,
+ u3d_longitude,u3d_latitude,device_height,
+ manufactor,account,password,
+ direction,rtsp_address,is_doorway_video,
+ channel_no,create_time,create_by,
+ update_time,update_by,is_active,
+ c1,c2,c3,
+ c4,c5
+
+
diff --git a/src/main/resources/mapper/TbLayerInfoMapper.xml b/src/main/resources/mapper/TbLayerInfoMapper.xml
new file mode 100644
index 0000000..81c8e65
--- /dev/null
+++ b/src/main/resources/mapper/TbLayerInfoMapper.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,place_code,place_name,
+ building_code,building_name,layer_code,
+ layer_name,create_time,create_by,
+ update_time,update_by,is_active,
+ c1,c2,c3,
+ c4,c5
+
+
diff --git a/src/main/resources/mapper/TbPlaceInfoMapper.xml b/src/main/resources/mapper/TbPlaceInfoMapper.xml
new file mode 100644
index 0000000..813b782
--- /dev/null
+++ b/src/main/resources/mapper/TbPlaceInfoMapper.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,place_code,place_name,
+ place_pic,place_map,place_category,
+ place_type,place_nature,covers_acreage,
+ structure_acreage,neigh_bulit_time,activeuse_time,
+ access_type,afforestation_rate,plot_rate,
+ longitude,latitude,place_address,
+ province_code,province_name,city_code,
+ city_name,area_code,area_name,
+ street_code,street_name,block_code,
+ block_name,police_district_code,police_name,
+ police_no,police_phone,police_pic,
+ create_time,create_by,update_time,
+ update_by,is_active,c1,
+ c2,c3,c4,
+ c5
+
+
diff --git a/src/main/resources/mapper/TransitDoorRecordMapper.xml b/src/main/resources/mapper/TransitDoorRecordMapper.xml
new file mode 100644
index 0000000..88891ad
--- /dev/null
+++ b/src/main/resources/mapper/TransitDoorRecordMapper.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,partition_field,place_code,
+ place_name,building_code,building_name,
+ layer_code,layer_name,device_name,
+ device_code,gbs_channel_no,device_address,
+ device_ip,user_name,phone,
+ idcard,direction,person_pic,
+ record_id,source_id,person_image_id,
+ card_no,card_type,open_result,
+ pass_time,create_time,create_by,
+ update_time,update_by,is_active,
+ c1,c2,c3,
+ c4,c5,c6
+
+
diff --git a/src/main/resources/mapper/TransitUserRecordMapper.xml b/src/main/resources/mapper/TransitUserRecordMapper.xml
new file mode 100644
index 0000000..c5725e9
--- /dev/null
+++ b/src/main/resources/mapper/TransitUserRecordMapper.xml
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,partition_field,place_code,
+ place_name,building_code,building_name,
+ layer_code,layer_name,device_code,
+ device_name,gbs_channel_no,device_address,
+ device_ip,global_pic,person_pic,
+ user_standard_pic,user_name,dossier_code,
+ id_card,phone,record_id,
+ user_vehicle_body_record_id,source_id,person_image_id,
+ global_image_id,similarity,is_compare,
+ direction,pass_time,axis,
+ data_src,create_time,create_by,
+ update_time,update_by,is_active,
+ c1,c2,c3,
+ c4,c5
+
+