Browse Source

万达设备台账信息同步开发

weiyizhong 3 years ago
commit
54e1c65512
52 changed files with 2684 additions and 0 deletions
  1. 6 0
      Dockerfile
  2. 13 0
      docker/Dockerfile
  3. 6 0
      docker/deploy.sh
  4. 4 0
      docker/entrypoint.sh
  5. 6 0
      docker/persagy-sync-data.yml
  6. 70 0
      docker/pipeline.txt
  7. 128 0
      pom.xml
  8. 18 0
      src/main/java/com/persagy/SyncDataBinlogApplication.java
  9. 231 0
      src/main/java/com/persagy/binlog/BinlogClientRunner.java
  10. 123 0
      src/main/java/com/persagy/binlog/BinlogClientRunnerCopy.java
  11. 138 0
      src/main/java/com/persagy/business/HandlerData.java
  12. 14 0
      src/main/java/com/persagy/ccontinue/IPositionHandler.java
  13. 23 0
      src/main/java/com/persagy/ccontinue/config/SyncConfig.java
  14. 41 0
      src/main/java/com/persagy/ccontinue/entity/BinlogPosition.java
  15. 37 0
      src/main/java/com/persagy/ccontinue/impl/DefaultPositionHandler.java
  16. 11 0
      src/main/java/com/persagy/ccontinue/mapper/BinlogPositionMapper.java
  17. 29 0
      src/main/java/com/persagy/ccontinue/service/BinlogPositionService.java
  18. 46 0
      src/main/java/com/persagy/configuration/MyBatisPlusConfig.java
  19. 217 0
      src/main/java/com/persagy/entity/HydomcAsset.java
  20. 103 0
      src/main/java/com/persagy/entity/HydomcAssetspec.java
  21. 146 0
      src/main/java/com/persagy/entity/RwdObjectWd.java
  22. 20 0
      src/main/java/com/persagy/entity/UUIDBaseEntity.java
  23. 55 0
      src/main/java/com/persagy/entity/VhydomcAssetRelationRwd.java
  24. 78 0
      src/main/java/com/persagy/entity/VhydomcClassspec.java
  25. 84 0
      src/main/java/com/persagy/entity/VhydomcClassspecvalue.java
  26. 46 0
      src/main/java/com/persagy/entity/VhydomcClassstructure.java
  27. 49 0
      src/main/java/com/persagy/entity/VhydomcRelationProjectid.java
  28. 66 0
      src/main/java/com/persagy/entity/VhydomcRwdRelation.java
  29. 41 0
      src/main/java/com/persagy/enumeration/OperationStatus.java
  30. 9 0
      src/main/java/com/persagy/mapper/HydomcAssetMapper.java
  31. 9 0
      src/main/java/com/persagy/mapper/HydomcAssetspecMapper.java
  32. 9 0
      src/main/java/com/persagy/mapper/RwdObjectWdMapper.java
  33. 9 0
      src/main/java/com/persagy/mapper/VhydomcAssetRelationRwdMapper.java
  34. 9 0
      src/main/java/com/persagy/mapper/VhydomcClassspecMapper.java
  35. 9 0
      src/main/java/com/persagy/mapper/VhydomcClassspecvalueMapper.java
  36. 9 0
      src/main/java/com/persagy/mapper/VhydomcClassstructureMapper.java
  37. 9 0
      src/main/java/com/persagy/mapper/VhydomcRelationProjectidMapper.java
  38. 9 0
      src/main/java/com/persagy/mapper/VhydomcRwdRelationMapper.java
  39. 13 0
      src/main/java/com/persagy/service/HydomcAssetService.java
  40. 12 0
      src/main/java/com/persagy/service/HydomcAssetspecService.java
  41. 9 0
      src/main/java/com/persagy/service/VhydomcRelationProjectidService.java
  42. 296 0
      src/main/java/com/persagy/utils/CacheUtil.java
  43. 28 0
      src/main/java/com/persagy/utils/JsonUtil.java
  44. 62 0
      src/main/resources/application.yml
  45. 39 0
      src/main/resources/sql/rwd/v_hydomc_asset_relation_rwd.sql
  46. 13 0
      src/main/resources/sql/rwd/v_hydomc_binlog_position.sql
  47. 153 0
      src/main/resources/sql/rwd/v_hydomc_classspec.sql
  48. 28 0
      src/main/resources/sql/rwd/v_hydomc_classstructure.sql
  49. 12 0
      src/main/resources/sql/rwd/v_hydomc_relation_projectid.sql
  50. 35 0
      src/main/resources/sql/rwd/v_hydomc_rwd_relation.sql
  51. 36 0
      src/main/resources/sql/wd/hydomc_asset.sql
  52. 18 0
      src/main/resources/sql/wd/hydomc_assetspec.sql

+ 6 - 0
Dockerfile

@@ -0,0 +1,6 @@
+#FROM openjdk:8-jdk-alpine 文件下载会出现空指针错误
+FROM java:8
+RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime	&& echo 'Asia/Shanghai' > /etc/timezone
+COPY ./target/persagy-syncData.jar persagy-syncData.jar
+ENTRYPOINT ["java", "-jar", "/persagy-syncData.jar"]
+EXPOSE 9980

+ 13 - 0
docker/Dockerfile

@@ -0,0 +1,13 @@
+#FROM openjdk:8-jdk-alpine 文件下载会出现空指针错误
+FROM java:8
+ARG WORKER_HOME
+RUN apt-get install -y --no-install-recommends tzdata && rm -rf /var/lib/apt/lists/*
+RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime	&& echo 'Asia/Shanghai' > /etc/timezone
+RUN mkdir -p $WORKER_HOME/config
+COPY *.jar $WORKER_HOME/
+COPY entrypoint.sh $WORKER_HOME/
+COPY ./config/*.jks $WORKER_HOME/config/
+#EXPOSE 9931
+WORKDIR $WORKER_HOME
+RUN ls
+ENTRYPOINT ["sh","./entrypoint.sh"]

+ 6 - 0
docker/deploy.sh

@@ -0,0 +1,6 @@
+#!/bin/bash
+docker stop persagy-sync-data
+docker rm  persagy-sync-data
+docker rmi persagy-sync-data
+docker-compose --env-file ./docker/.env -f ./docker/persagy-sync-data.yml up -d
+docker logout labisenlin.persagy.com

+ 4 - 0
docker/entrypoint.sh

@@ -0,0 +1,4 @@
+#!/bin/bash
+echo "entrypoint run..."
+#注意此处目录为 pipeline 中定义的目录
+java -jar -Xms2048m -Xmx2048m -Dfile.encoding=utf-8 persagy-sync-data.jar

+ 6 - 0
docker/persagy-sync-data.yml

@@ -0,0 +1,6 @@
+version: '3'
+services:
+  zkt-control:
+    image: labisenlin.persagy.com/library/persagy-sync-data:${tag}
+    container_name: persagy-sync-data
+    restart: always

+ 70 - 0
docker/pipeline.txt

@@ -0,0 +1,70 @@
+pipeline { //pipeline 顶层
+    //any 在任何可用的agent上执行Pipeline或stage
+    agent any
+    //environment 自定义的环境变量
+    environment {
+    	//本项目此三个变量值如下,修改jenkins打包即可,其余不动
+        //PROGRAM_ID=integrated-eureka
+        //APPLICATION_NAME=integrated-eureka
+        //PROJECT_JAR_PATH=integrated-eureka
+
+        PROGRAM_ID = "$PROGRAM_ID"     							//项目名称
+        APPLICATION_NAME = "$APPLICATION_NAME"     				//项目应用名-镜像名称
+        WORKSPACE = "/root/jenkins"    							//jenkins home 宿主机路径
+        PROJECT_JAR_PATH = "$PROJECT_JAR_PATH"					//项目打包后所在相对路径
+        PROJECT_ROOT_PATH = "persagy-sync-data"									//项目根路径名称
+        WORKER_HOME = "/root/$APPLICATION_NAME"   				//项目运行所在路径-容器内的路径
+        DEPLOY_FILE_PATH = "docker"				//部署文件所在路径
+        MAVEN_PACKAGE_PATH = "$WORKSPACE/workspace/$PROGRAM_ID"		//maven打包根路径
+        IMAGE_REPOSITORY_PREFIX="labisenlin.persagy.com"
+        DOCKER_IMAGE = "$IMAGE_REPOSITORY_PREFIX/$IMAGE_REPOSITORY_PROJECT/$APPLICATION_NAME:$VERSION"	//镜像全路径
+        BACKUP_PATH = "$JENKINS_HOME/program-backup/$PROGRAM_ID/$VERSION"	//备份路径
+    }
+    //不允许并行执行Pipeline,可用于防止同时访问共享资源等
+    options {
+        disableConcurrentBuilds()
+    }
+    stages {
+        //部署流程一:从SVN或者Git上拉取项目程序代码
+        stage('git checkout') {
+            steps {
+                checkout([$class: 'GitSCM', branches: [[name: '*/$GIT_BRANCH']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'weiyizhong', url: 'http://39.106.8.246:3003/weiyizhong/persagy-sync-data.git']]])
+            }
+        }
+        //部署流程二:Java程序进行maven打包
+        stage('maven build') {
+            steps {
+                sh 'cd $WORKSPACE'
+                sh 'mvn clean install -Dmaven.test.skip=true -f $MAVEN_PACKAGE_PATH/pom.xml'
+            }
+        }
+        //部署流程三:根据项目dockerfile创建项目的docker镜像
+        stage('image buid') {
+            steps {
+                sh 'chmod -R +x ./$DEPLOY_FILE_PATH/'
+                sh 'rm -rf ./$DEPLOY_FILE_PATH/*.jar && cp ./target/*.jar ./$DEPLOY_FILE_PATH'
+                sh 'docker build -f ./Dockerfile --build-arg WORKER_HOME=$WORKER_HOME -t $DOCKER_IMAGE ./$DEPLOY_FILE_PATH'
+            }
+        }
+        //部署流程四:项目推送到本地私有仓库
+        stage('repository push') {
+            steps {
+                //-H tcp://192.168.64.16:9999
+                sh 'docker login $IMAGE_REPOSITORY_PREFIX -u $DOCKER_USERNAME -p $DOCKER_PASSWORD'
+                sh 'docker push  $DOCKER_IMAGE'
+                //只打镜像的话,将其打开
+                sh 'docker logout $IMAGE_REPOSITORY_PREFIX'
+                sh 'docker rmi $DOCKER_IMAGE'
+            }
+        }
+        //部署流程五:项目版本本地备份
+        stage('backup') {
+            steps {
+                sh 'rm -rf $BACKUP_PATH/'
+                sh 'mkdir -p  $BACKUP_PATH/'
+                sh 'cp ./persagy-sync-data/target/*.jar $BACKUP_PATH/'
+            }
+        }
+
+    }
+}

+ 128 - 0
pom.xml

@@ -0,0 +1,128 @@
+<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>com.persagy</groupId>
+    <artifactId>persagy-sync-data</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.1.3.RELEASE</version>
+    </parent>
+
+    <dependencies>
+
+        <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+            <version>3.3.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.3.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
+            <version>3.1.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+        <groupId>com.baomidou</groupId>
+        <artifactId>mybatis-plus</artifactId>
+        <version>3.3.0</version>
+        </dependency>
+
+        <dependency>
+        <groupId>org.projectlombok</groupId>
+        <artifactId>lombok</artifactId>
+        </dependency>
+
+        <dependency>
+        <groupId>log4j</groupId>
+        <artifactId>log4j</artifactId>
+        <version>1.2.17</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.shyiko</groupId>
+            <artifactId>mysql-binlog-connector-java</artifactId>
+            <version>0.16.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.49</version>
+        </dependency>
+
+    </dependencies>
+
+
+
+    <build>
+        <finalName>persagy-sync-data</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.3.4.RELEASE</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <!-- jar包plugin-->
+            <plugin>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                        <configuration>
+                            <!-- 添加core 修饰方便其它兄弟项目依赖此项目  -->
+                            <classifier>core</classifier>
+                            <includes>
+                                <include>**/com/persagy/entity/</include>
+                                <include>**/com/persagy/dao/</include>
+                                <include>**/com/persagy/mapper/</include>
+                            </includes>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>3.0.0-M5</version>
+                <configuration>
+                    <testFailureIgnore>true</testFailureIgnore>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 18 - 0
src/main/java/com/persagy/SyncDataBinlogApplication.java

@@ -0,0 +1,18 @@
+package com.persagy;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableAsync;
+
+/**
+ *  启动类代码
+ */
+@EnableAsync
+@SpringBootApplication
+public class SyncDataBinlogApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(SyncDataBinlogApplication.class);
+    }
+
+}

+ 231 - 0
src/main/java/com/persagy/binlog/BinlogClientRunner.java

@@ -0,0 +1,231 @@
+package com.persagy.binlog;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.shyiko.mysql.binlog.BinaryLogClient;
+import com.github.shyiko.mysql.binlog.event.*;
+import com.persagy.ccontinue.entity.BinlogPosition;
+import com.persagy.business.HandlerData;
+import com.persagy.ccontinue.service.BinlogPositionService;
+import com.persagy.configuration.MyBatisPlusConfig;
+import com.persagy.entity.RwdObjectWd;
+import com.persagy.mapper.RwdObjectWdMapper;
+import com.persagy.utils.CacheUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.annotation.Order;
+import org.springframework.scheduling.annotation.Async;
+
+import java.io.Serializable;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@Configuration
+@Order(1000)
+public class BinlogClientRunner implements CommandLineRunner {
+    @Autowired
+    private HandlerData handlerData;
+
+    @Autowired
+    private BinlogPositionService binlogPositionService;
+
+    @Autowired
+    private RwdObjectWdMapper rwdObjectWdMapper;
+
+
+    @Value("${binlog.host}")
+    private String host;
+
+    @Value("${binlog.port}")
+    private int port;
+
+    @Value("${binlog.user}")
+    private String user;
+
+    @Value("${binlog.password}")
+    private String password;
+
+    // binlog server_id
+    @Value("${server.id}")
+    private long serverId;
+
+    // 指定监听的数据表
+    @Value("${binlog.database.table}")
+    private String database_table;
+
+    // 指定监听的数据表
+    @Value("${binlog.database.table-format}")
+    private String tableFormat;
+
+    @Async
+    @Override
+    public void run(String... args) throws Exception {
+        // 获取监听数据表数组
+        List<String> databaseList = Arrays.asList(database_table.split(","));
+        //获取position的位置(创建client时,读取当前记录的postion),和查看是否是第一次启动,为空表示第一次启动
+        BinlogPosition binlogPosition = binlogPositionService.getPosition();
+        //先全量把数据同步一下再,增量同步数据
+        //查询数据
+        //表示需要同步到中台去的数据,先将监听表的infos字段信息查询出来
+        if(binlogPosition.getPosition()==null){
+            /**开始全量同步数据=======================================*/
+            log.info("开始全量同步数据=======================================");
+            for (String databaseTableName:databaseList
+            ) {
+                String tableName = databaseTableName.substring(databaseTableName.indexOf(".")+1);
+                MyBatisPlusConfig.myTableName.set(tableName);
+                //先查询有多少条数据
+                QueryWrapper<RwdObjectWd> rwdObjectWdQueryWrapperCount = new QueryWrapper<>();
+                rwdObjectWdQueryWrapperCount.in("class_code", CacheUtil.classCodeCacheList);
+                Integer totalCount =  rwdObjectWdMapper.selectCount(rwdObjectWdQueryWrapperCount);
+                if(totalCount==null || totalCount==0){
+                    continue;
+                }
+                //分页查询
+                //计算会分多少页
+                int pageSize = 200;
+                int pageTotal = totalCount/ pageSize;
+                for (int i = 0; i <= pageTotal; i++) {
+                    //参数一是当前页,参数二是每页个数
+                    IPage<RwdObjectWd> rwdObjectWdPage = new Page<>(i, pageSize);
+                    QueryWrapper<RwdObjectWd> rwdObjectWdQueryWrapperOrder = new QueryWrapper<>();
+                    rwdObjectWdQueryWrapperOrder.orderByAsc("id");
+                    rwdObjectWdPage =  rwdObjectWdMapper.selectPage(rwdObjectWdPage,rwdObjectWdQueryWrapperOrder);
+                    List<RwdObjectWd> rwdObjectWds = rwdObjectWdPage.getRecords();
+                    for (RwdObjectWd rwdObjectWd:rwdObjectWds
+                    ) {
+                        try {
+                            handlerData.handlerDataToWd(tableFormat,null,tableName,"insert",rwdObjectWd);
+                        } catch (Exception e) {
+                            log.error("全量同步数据失败:{}",e);
+                        }
+                    }
+                    log.info(tableName+"同步第"+i+"页,数量"+rwdObjectWds.size());
+                }
+            }
+            if(binlogPosition==null){
+                binlogPosition = new BinlogPosition();
+            }
+            binlogPosition.setServerId(serverId);
+
+        }
+
+
+        /**开始增量同步数据=======================================*/
+        log.info("开始增量同步数据=======================================");
+        HashMap<Long, String> tableMap = new HashMap<Long, String>();
+        // 创建binlog监听客户端
+        BinaryLogClient client = new BinaryLogClient(host, port, user, password);
+        client.setServerId(serverId);
+
+        if (binlogPosition != null &&
+                binlogPosition.getBinlogName() != null &&
+                binlogPosition.getPosition() != null) {
+            client.setBinlogFilename(binlogPosition.getBinlogName());
+            client.setBinlogPosition(binlogPosition.getPosition());
+        }
+
+        client.registerEventListener((event -> {
+            // binlog事件
+            EventData data = event.getData();
+            if (data != null) {
+                if (data instanceof TableMapEventData) {
+                    TableMapEventData tableMapEventData = (TableMapEventData) data;
+                    tableMap.put(tableMapEventData.getTableId(), tableMapEventData.getDatabase() + "." + tableMapEventData.getTable());
+                }
+                // update数据
+                if (data instanceof UpdateRowsEventData) {
+                    UpdateRowsEventData updateRowsEventData = (UpdateRowsEventData) data;
+                    String tableName = tableMap.get(updateRowsEventData.getTableId());
+                    if (tableName != null && databaseList.contains(tableName)) {
+                        String eventKey = tableName + ".update";
+                        log.info("监听数据库更新数据:{}",eventKey);
+                        for (Map.Entry<Serializable[], Serializable[]> row : updateRowsEventData.getRows()) {
+                            List<Serializable> entries = Arrays.asList(row.getValue());
+                            try {
+                                handlerData.handlerDataToWd(tableFormat,entries,tableName,"update",null);
+                            } catch (Exception e) {
+                                log.error("同步数据失败:{}",e);
+                            }
+                            saveBinlogPosition(event);
+                        }
+                    }
+                }
+                // insert数据
+                else if (data instanceof WriteRowsEventData) {
+                    WriteRowsEventData writeRowsEventData = (WriteRowsEventData) data;
+                    String tableName = tableMap.get(writeRowsEventData.getTableId());
+                    if (tableName != null && databaseList.contains(tableName)) {
+                        String eventKey = tableName + ".insert";
+                        log.info("监听数据库插入数据:{}",eventKey);
+                        for (Serializable[] row : writeRowsEventData.getRows()) {
+                            List<Serializable> entries = Arrays.asList(row);
+                            try {
+                                handlerData.handlerDataToWd(tableFormat,entries,tableName,"insert",null);
+                            } catch (Exception e) {
+                                log.error("同步数据失败:{}",e);
+                            }
+                            saveBinlogPosition(event);
+                        }
+                    }
+                }
+                // delete数据
+                else if (data instanceof DeleteRowsEventData) {
+                    DeleteRowsEventData deleteRowsEventData = (DeleteRowsEventData) data;
+                    String tableName = tableMap.get(deleteRowsEventData.getTableId());
+                    if (tableName != null && databaseList.contains(tableName)) {
+                        String eventKey = tableName + ".delete";
+                        for (Serializable[] row : deleteRowsEventData.getRows()) {
+                            System.out.println("delete======");
+                        }
+                    }
+                }
+            }
+        }));
+        client.connect();
+    }
+
+    private void saveBinlogPosition(Event event) {
+        BinlogPosition binlogPositionSave = new BinlogPosition();
+        //处理rotate事件,这里会替换调binlog fileName
+        if (event.getHeader().getEventType().equals(EventType.ROTATE)) {
+            RotateEventData rotateEventData = (RotateEventData) event.getData();
+            binlogPositionSave.setBinlogName(rotateEventData.getBinlogFilename());
+            binlogPositionSave.setPosition(rotateEventData.getBinlogPosition());
+            binlogPositionSave.setServerId(event.getHeader().getServerId());
+        } else {
+            //统一处理事件对应的binlog position
+            binlogPositionSave = binlogPositionService.getPosition();
+            if(binlogPositionSave==null){
+                binlogPositionSave = new BinlogPosition();
+            }
+            EventHeaderV4 eventHeaderV4 = (EventHeaderV4) event.getHeader();
+            binlogPositionSave.setPosition(eventHeaderV4.getPosition());
+//            binlogPositionSave.setBinlogName(event)
+            binlogPositionSave.setServerId(event.getHeader().getServerId());
+        }
+        //将最新的配置保存到Redis中
+        log.info("保存的数据{}", JSON.toJSONString(binlogPositionSave));
+        binlogPositionService.saveOrUpdate(binlogPositionSave);
+    }
+
+    private static long getRandomServerId() {
+        try {
+            return SecureRandom.getInstanceStrong().nextLong();
+        } catch (NoSuchAlgorithmException e) {
+//            return RandomUtils.nextLong();
+        }
+        return 0L;
+    }
+
+}

+ 123 - 0
src/main/java/com/persagy/binlog/BinlogClientRunnerCopy.java

@@ -0,0 +1,123 @@
+//package com.persagy.cn.binlog;
+//
+//import com.alibaba.fastjson.JSON;
+//import com.alibaba.fastjson.JSONObject;
+//import com.github.shyiko.mysql.binlog.BinaryLogClient;
+//import com.github.shyiko.mysql.binlog.event.*;
+//import com.persagy.cn.business.HandlerData;
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.beans.factory.annotation.Value;
+//import org.springframework.boot.CommandLineRunner;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.core.annotation.Order;
+//import org.springframework.scheduling.annotation.Async;
+//
+//import java.io.Serializable;
+//import java.util.Arrays;
+//import java.util.HashMap;
+//import java.util.List;
+//import java.util.Map;
+//
+///**
+// * @Author : weiyizhong
+// * @Description: binlog监听
+// * @Date : 2021/9/15  10:37
+// * @Modified By :
+// */
+//@Slf4j
+//@Configuration
+//@Order(1000)
+//public class BinlogClientRunner  implements CommandLineRunner {
+//
+//    @Autowired
+//    private HandlerData handlerData;
+//
+//    @Value("${binlog.host}")
+//    private String host;
+//
+//    @Value("${binlog.port}")
+//    private int port;
+//
+//    @Value("${binlog.user}")
+//    private String user;
+//
+//    @Value("${binlog.password}")
+//    private String password;
+//
+//    // binlog server_id
+//    @Value("${server.id}")
+//    private long serverId;
+//
+//    // 指定监听的数据表
+//    @Value("${binlog.database.table}")
+//    private String database_table;
+//
+//    // 指定监听的数据表
+//    @Value("${binlog.database.table-format}")
+//    private String tableFormat;
+//
+//
+//    @Async
+//    @Override
+//    public void run(String... args) throws Exception {
+//        // 获取监听数据表数组
+//        List<String> databaseList = Arrays.asList(database_table.split(","));
+//        HashMap<Long, String> tableMap = new HashMap<Long, String>();
+//        // 创建binlog监听客户端
+//        BinaryLogClient client = new BinaryLogClient(host, port, user, password);
+//        client.setServerId(serverId);
+////        client.setBinlogFilename("mysql-bin.000053");
+////        client.setBinlogPosition(0);
+//        client.registerEventListener((event -> {
+//            // binlog事件
+//            EventData data = event.getData();
+//            if (data != null) {
+//                if (data instanceof TableMapEventData) {
+//                    TableMapEventData tableMapEventData = (TableMapEventData) data;
+//                    tableMap.put(tableMapEventData.getTableId(), tableMapEventData.getDatabase() + "." + tableMapEventData.getTable());
+//                }
+//                // update数据
+//                if (data instanceof UpdateRowsEventData) {
+//                    UpdateRowsEventData updateRowsEventData = (UpdateRowsEventData) data;
+//                    String tableName = tableMap.get(updateRowsEventData.getTableId());
+//                    if (tableName != null && databaseList.contains(tableName)) {
+//                        String eventKey = tableName + ".update";
+//                        log.info("监听数据库更新数据:{}",eventKey);
+//                        for (Map.Entry<Serializable[], Serializable[]> row : updateRowsEventData.getRows()) {
+//                            List<Serializable> entries = Arrays.asList(row.getValue());
+//                            handlerData.handlerDataToWd(tableFormat,entries,tableName,"update");
+//                        }
+//                    }
+//                }
+//                // insert数据
+//                else if (data instanceof WriteRowsEventData) {
+//                    WriteRowsEventData writeRowsEventData = (WriteRowsEventData) data;
+//                    String tableName = tableMap.get(writeRowsEventData.getTableId());
+//                    if (tableName != null && databaseList.contains(tableName)) {
+//                        String eventKey = tableName + ".insert";
+//                        log.info("监听数据库插入数据:{}",eventKey);
+//                        for (Serializable[] row : writeRowsEventData.getRows()) {
+//                            List<Serializable> entries = Arrays.asList(row);
+//                            handlerData.handlerDataToWd(tableFormat,entries,tableName,"insert");
+//                        }
+//                    }
+//                }
+//                // delete数据
+//                else if (data instanceof DeleteRowsEventData) {
+//                    DeleteRowsEventData deleteRowsEventData = (DeleteRowsEventData) data;
+//                    String tableName = tableMap.get(deleteRowsEventData.getTableId());
+//                    if (tableName != null && databaseList.contains(tableName)) {
+//                        String eventKey = tableName + ".delete";
+//                        for (Serializable[] row : deleteRowsEventData.getRows()) {
+//                            System.out.println("delete======");
+//                        }
+//                    }
+//                }
+//            }
+//        }));
+//        client.connect();
+//        client.disconnect();
+//    }
+//
+//}

+ 138 - 0
src/main/java/com/persagy/business/HandlerData.java

@@ -0,0 +1,138 @@
+package com.persagy.business;
+
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.persagy.entity.HydomcAsset;
+import com.persagy.entity.HydomcAssetspec;
+import com.persagy.entity.RwdObjectWd;
+import com.persagy.enumeration.OperationStatus;
+import com.persagy.service.HydomcAssetService;
+import com.persagy.service.HydomcAssetspecService;
+import com.persagy.utils.CacheUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.util.ObjectUtils;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 插入数据处理逻辑
+ */
+@Slf4j
+@Component
+public class HandlerData {
+
+    @Autowired
+    private CacheUtil cacheUtil;
+
+    @Autowired
+    private HydomcAssetService hydomcAssetService;
+
+    @Autowired
+    private HydomcAssetspecService hydomcAssetspecService;
+
+
+
+    /**
+     * @desc 插入数据解析逻辑
+     * @param row
+     * @param format
+     * @return
+     */
+    public  void  handlerDataToWd(String format,List row ,String dataBaseTableName,String operationStatus,RwdObjectWd rwdObjectWd) throws Exception{
+        Map<HydomcAsset,List<HydomcAssetspec>> dataMap =  cacheUtil.handleData(format,row,dataBaseTableName, rwdObjectWd);
+        if(ObjectUtils.isEmpty(dataMap)){
+            log.info("没有需要插入更新的数据=============");
+            return;
+        }
+        if(OperationStatus.getName(1).equals(operationStatus)){
+            //表示插入
+            for (Map.Entry<HydomcAsset,List<HydomcAssetspec>> data : dataMap.entrySet()) {
+                //保存主表参数表,设备信息主表HYDOMC_ASSET
+                HydomcAsset hydomcAsset = data.getKey();
+                hydomcAsset.setDatastatus(operationStatus);
+                hydomcAssetService.save(hydomcAsset);
+                //保存设备参数信息表,设备参数信息HYDOMC_ASSETSPEC
+                List<HydomcAssetspec> hydomcAssetspecs =  data.getValue();
+                for (HydomcAssetspec hydomcAssetspec:hydomcAssetspecs ) {
+                    if(hydomcAssetspec.getAlnvalue()==null && hydomcAssetspec.getNumvalue()==null){
+                        //设置信息点为删除状态
+                        hydomcAssetspec.setDatastatus("delete");
+                    }else {
+                        hydomcAssetspec.setDatastatus(operationStatus);
+                    }
+                }
+                hydomcAssetspecService.saveBatch(hydomcAssetspecs);
+            }
+        }else if(OperationStatus.getName(2).equals(operationStatus)){
+            //表示更新,或者删除
+            RwdObjectWd rwd = cacheUtil.getEquipId(format,row);
+            if(rwd.getValid()==1){
+                //表示,有效,只是更新数据
+                for (Map.Entry<HydomcAsset,List<HydomcAssetspec>> data : dataMap.entrySet()) {
+                    //保存主表参数表,设备信息主表HYDOMC_ASSET
+                    HydomcAsset hydomcAsset = data.getKey();
+                    hydomcAsset.setDatastatus(operationStatus);
+                    UpdateWrapper<HydomcAsset> updateHydomcAssetWrapper = new UpdateWrapper<>();
+                    updateHydomcAssetWrapper.eq("SBYBM",hydomcAsset.getSbybm());
+                    hydomcAssetService.update(hydomcAsset,updateHydomcAssetWrapper);
+                    //保存设备参数信息表,设备参数信息HYDOMC_ASSETSPEC
+                    List<HydomcAssetspec> hydomcAssetspecs =  data.getValue();
+                    for (HydomcAssetspec hydomcAssetspec:hydomcAssetspecs
+                         ) {
+                        hydomcAssetspec.setDatastatus(operationStatus);
+                        if(hydomcAssetspec.getAlnvalue()==null && hydomcAssetspec.getNumvalue()==null){
+                            hydomcAssetspec.setDatastatus("delete");
+                        }
+                        UpdateWrapper<HydomcAssetspec> updateWrapper = new UpdateWrapper<>();
+                        updateWrapper.eq("SITEID",hydomcAssetspec.getSiteid());
+                        updateWrapper.eq("SBYBM",hydomcAssetspec.getSbybm());
+                        updateWrapper.eq("CLASSSTRUCTUREID",hydomcAssetspec.getClassstructureid());
+                        updateWrapper.eq("ASSETATTRID",hydomcAssetspec.getAssetattrid());
+                        hydomcAssetspecService.update(hydomcAssetspec,updateWrapper);
+                    }
+                }
+
+            }else {
+                //表示,逻辑删除,数据已经删除,下面的所有信息点的状态都应该是删除
+                operationStatus = "delete";
+                for (Map.Entry<HydomcAsset,List<HydomcAssetspec>> data : dataMap.entrySet()) {
+                    //保存主表参数表,设备信息主表HYDOMC_ASSET
+                    HydomcAsset hydomcAsset = data.getKey();
+                    hydomcAsset.setDatastatus(operationStatus);
+                    UpdateWrapper<HydomcAsset> updateHydomcAssetWrapper = new UpdateWrapper<>();
+                    updateHydomcAssetWrapper.eq("SBYBM",hydomcAsset.getSbybm());
+                    hydomcAssetService.update(hydomcAsset,updateHydomcAssetWrapper);
+                    //保存设备参数信息表,设备参数信息HYDOMC_ASSETSPEC
+                    List<HydomcAssetspec> hydomcAssetspecs =  data.getValue();
+                    for (HydomcAssetspec hydomcAssetspec:hydomcAssetspecs
+                         ) {
+                        hydomcAssetspec.setDatastatus(operationStatus);
+                        UpdateWrapper<HydomcAssetspec> updateWrapper = new UpdateWrapper<>();
+                        updateWrapper.eq("SITEID",hydomcAssetspec.getSiteid());
+                        updateWrapper.eq("SBYBM",hydomcAssetspec.getSbybm());
+                        updateWrapper.eq("CLASSSTRUCTUREID",hydomcAssetspec.getClassstructureid());
+                        updateWrapper.eq("ASSETATTRID",hydomcAssetspec.getAssetattrid());
+                        hydomcAssetspecService.update(hydomcAssetspec,updateWrapper);
+                    }
+                }
+            }
+
+        }else {
+            //表示删除,但是已经确认中台那边没有物理删除数据的操作,只有逻辑删除的操作,因此这只是留了一个口子,不做任何业务操作
+        }
+    }
+
+
+
+    public static void main(String[] args) {
+        String localId = "20.60.60.60.25.0155";
+        System.out.println(localId.substring(0,localId.length()-5));
+        String tableName = "rwd_object_wd_pj4403070003";
+        System.out.println(tableName.substring(tableName.indexOf("pj")));
+    }
+
+
+
+}

+ 14 - 0
src/main/java/com/persagy/ccontinue/IPositionHandler.java

@@ -0,0 +1,14 @@
+package com.persagy.ccontinue;
+
+import com.persagy.ccontinue.entity.BinlogPosition;
+import com.persagy.ccontinue.config.SyncConfig;
+
+/**
+ * 处理binlog位点信息接口,实现该接口创建自定义位点处理类
+ */
+public interface IPositionHandler {
+
+    BinlogPosition getPosition(SyncConfig syncConfig);
+
+    void savePosition(SyncConfig syncConfig, BinlogPosition binlogPosition);
+}

+ 23 - 0
src/main/java/com/persagy/ccontinue/config/SyncConfig.java

@@ -0,0 +1,23 @@
+package com.persagy.ccontinue.config;
+
+import lombok.Data;
+
+@Data
+public class SyncConfig {
+    /**
+     * mysql的host配置
+     */
+    String host;
+    /**
+     * mysql的port配置
+     */
+    Integer port;
+    /**
+     * mysql的userName配置
+     */
+    String userName;
+    /**
+     * mysql的password配置
+     */
+    String password;
+}

+ 41 - 0
src/main/java/com/persagy/ccontinue/entity/BinlogPosition.java

@@ -0,0 +1,41 @@
+package com.persagy.ccontinue.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+/**
+ * 记录当前监听位置的事件
+ *
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("v_hydomc_binlog_position")
+public class BinlogPosition {
+    /***
+     * 主键id,自增
+     */
+    @TableId(value="id")
+    private long id;
+
+    /**
+     * binlog文件的名字
+     */
+    @TableField(value="binlog_name")
+    private String binlogName;
+
+    /**
+     * binlog文件的位置
+     */
+    @TableField(value="position")
+    private Long position;
+    /**
+     * binlog的服务id
+     */
+    @TableField(value="server_id")
+    private Long serverId;
+}

+ 37 - 0
src/main/java/com/persagy/ccontinue/impl/DefaultPositionHandler.java

@@ -0,0 +1,37 @@
+package com.persagy.ccontinue.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.persagy.ccontinue.IPositionHandler;
+import com.persagy.ccontinue.config.SyncConfig;
+import com.persagy.ccontinue.entity.BinlogPosition;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * 默认的端点续传存储器(需要借助分布式存储——此处可以保存到Redis中)
+ */
+public class DefaultPositionHandler implements IPositionHandler {
+
+    private Map<String, String> cache = new ConcurrentHashMap<>();
+
+    @Override
+    public BinlogPosition getPosition(SyncConfig syncConfig) {
+        return JSON.parseObject(cache.get(generateKey(syncConfig)), BinlogPosition.class);
+    }
+
+    @Override
+    public void savePosition(SyncConfig syncConfig, BinlogPosition binlogPosition) {
+        cache.put(generateKey(syncConfig), JSON.toJSONString(binlogPosition));
+    }
+
+
+    /**
+     * @param syncConfig 参数配置
+     * @return 生成的key
+     */
+    private String generateKey(SyncConfig syncConfig) {
+        return syncConfig.getHost() + ":" + syncConfig.getPort();
+    }
+
+}

+ 11 - 0
src/main/java/com/persagy/ccontinue/mapper/BinlogPositionMapper.java

@@ -0,0 +1,11 @@
+package com.persagy.ccontinue.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.ccontinue.entity.BinlogPosition;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface BinlogPositionMapper extends BaseMapper<BinlogPosition> {
+}
+

+ 29 - 0
src/main/java/com/persagy/ccontinue/service/BinlogPositionService.java

@@ -0,0 +1,29 @@
+package com.persagy.ccontinue.service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.persagy.ccontinue.entity.BinlogPosition;
+import com.persagy.ccontinue.mapper.BinlogPositionMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+
+@Service
+public class BinlogPositionService extends ServiceImpl<BinlogPositionMapper, BinlogPosition> {
+
+
+    /**
+     * 查询binlog记录
+     * @return
+     */
+    public BinlogPosition getPosition() {
+        List<BinlogPosition> binlogPositions =  list();
+        if(CollectionUtils.isEmpty(binlogPositions)){
+            return null;
+        }
+        List<BinlogPosition> binlogPositionsDesc = list();
+        binlogPositionsDesc.sort((a, b) -> Long.compare(b.getId(), a.getId()));
+        return  binlogPositionsDesc.get(0);
+    }
+
+}

+ 46 - 0
src/main/java/com/persagy/configuration/MyBatisPlusConfig.java

@@ -0,0 +1,46 @@
+package com.persagy.configuration;
+import com.baomidou.mybatisplus.core.parser.ISqlParser;
+import com.baomidou.mybatisplus.extension.parsers.DynamicTableNameParser;
+import com.baomidou.mybatisplus.extension.parsers.ITableNameHandler;
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import org.apache.ibatis.reflection.MetaObject;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.*;
+
+/**
+ * @Description myBatisPlus的配置类
+ * @createTime 2020年06月28日 15:39:00
+ */
+@Configuration
+public class MyBatisPlusConfig {
+
+    public static ThreadLocal<String> myTableName = new ThreadLocal<>();
+
+    @Bean
+    public PaginationInterceptor paginationInterceptor() {
+        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
+        //分页查询上限重新赋值
+        paginationInterceptor.setLimit(100000);
+
+        // 创建SQL解析器集合
+        List<ISqlParser> sqlParserList = new ArrayList<>();
+
+        // 动态表名SQL解析器
+        DynamicTableNameParser dynamicTableNameParser = new DynamicTableNameParser();
+        Map<String, ITableNameHandler> tableNameHandlerMap = new HashMap<>();
+        //增加一个销账月表表名过滤器
+        tableNameHandlerMap.put("rwd_object_wd", new ITableNameHandler() {
+            @Override
+            public String dynamicTableName(MetaObject metaObject, String sql, String tableName) {
+                return myTableName.get();//返回null不会替换 注意 多租户过滤会将它一块过滤不会替换@SqlParser(filter=true) 可不会替换
+            }
+        });
+
+        dynamicTableNameParser.setTableNameHandlerMap(tableNameHandlerMap);
+        sqlParserList.add(dynamicTableNameParser);
+        paginationInterceptor.setSqlParserList(sqlParserList);
+        return paginationInterceptor;
+    }
+}

+ 217 - 0
src/main/java/com/persagy/entity/HydomcAsset.java

@@ -0,0 +1,217 @@
+package com.persagy.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/***
+ * 设备信息主表HYDOMC_ASSET
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("hydomc_asset")
+public class HydomcAsset extends Model<HydomcAsset> implements Serializable {
+
+    /***
+     * 设备编码,主键  无其他主键可采用设备编码为主键,但要确保唯一(工程信息化设备原码)
+     */
+    @TableId(value="SBYBM")
+    private String sbybm;
+
+    /***
+     * 广场id,项目唯一id,可采用租赁系统广场id,同步后不可更改
+     */
+    @TableField(value="SITEID")
+    private String siteid;
+
+    /***
+     * 设备名称
+     */
+    @TableField(value="description")
+    private String description;
+
+    /***
+     * 设备安装位置,详细设备安装位置,格式:楼体-楼层-区域
+     */
+    @TableField(value="wzqy")
+    private String wzqy;
+
+    /***
+     * 设备服务区域,设备/系统服务范围
+     */
+    @TableField(value="fwqy")
+    private String fwqy;
+
+    /***
+     * 设备型号,厂商设备型号
+     */
+    @TableField(value="sbxh")
+    private String sbxh;
+
+    /***
+     * 设备分类,对接设备分类id,同步后不可更改
+     */
+    @TableField(value="CLASSSTRUCTUREID")
+    private String classstructureid;
+
+    /***
+     * 设备状态,运行中/报废 默认都为运行中
+     */
+    @TableField(value="STATUS")
+    private String status;
+
+    /***
+     * 设备序号,同类设备的序号,即第几台设备:第几台电梯
+     */
+    @TableField(value="sbxhh")
+    private String sbxhh;
+
+    /***
+     * 厂家设备序列号,厂家编码
+     */
+    @TableField(value="CJSBXH")
+    private String cjsbxh;
+
+    /***
+     * 生产商,生产商公司供方管理系统编码code
+     */
+    @TableField(value="MANUFACTURER")
+    private String manufacturer;
+
+    /***
+     * 供应商,供应商公司供方管理系统编码code
+     */
+    @TableField(value="VENDOR")
+    private String vendor;
+
+    /***
+     * 服务商,服务商公司供方管理系统编码code
+     */
+    @TableField(value="FWS")
+    private String fws;
+
+    /***
+     * 采购金额,填写人民币元
+     */
+    @TableField(value="PURCHASEPRICE")
+    private Double purchaseprice;
+
+    /***
+     * 折旧/使用年限,按年填写如3年半则填写 3.5
+     */
+    @TableField(value="ZJSYNX")
+    private Double zjsynx;
+
+    /***
+     * 生产日期/出厂日期 年/月/日
+     */
+    @TableField(value="SCRQ")
+    private Date scrq;
+
+    /***
+     * 采购日期
+     */
+    @TableField(value="CGRQ")
+    private Date cgrq;
+
+    /***
+     * 安装日期
+     */
+    @TableField(value="AZDATE")
+    private Date azdate;
+
+    /***
+     * 启用日期
+     */
+    @TableField(value="INSTALLDATE")
+    private Date installdate;
+
+    /***
+     * 质保开始日期
+     */
+    @TableField(value="ZBKSRQ")
+    private Date zbksrq;
+
+    /***
+     * 质保结束日期
+     */
+    @TableField(value="ZBJSRQ")
+    private Date zbjsrq;
+
+    /***
+     * 中修周期,单位为月
+     */
+    @TableField(value="ZXZQ")
+    private Double zxzq;
+
+    /***
+     * 大修周期,单位为月
+     */
+    @TableField(value="DXZQ")
+    private Double dxzq;
+
+    /***
+     * 物业类型 自持/销售/合作方
+     */
+    @TableField(value="WYLX")
+    private String wylx;
+
+    /***
+     * 设备管理归属,商管/百货/大歌星/超市/影院/大酒楼/其他
+     */
+    @TableField(value="SBGLGS")
+    private String sbglgs;
+
+    /***
+     * 慧云设备编码
+     */
+    @TableField(value="HYSBBM")
+    private String hysbbm;
+
+    /***
+     * 是否慧云使用,是/否    缺省为 是
+     */
+    @TableField(value="SFHYSY")
+    private String sfhysy;
+
+    /***
+     * 是否是主力店 缺省为 否
+     */
+    @TableField(value="SFZLD")
+    private String sfzld;
+
+    /***
+     * 备注
+     */
+    @TableField(value="MARK")
+    private String mark;
+
+    /***
+     * 变更人员的万信账号
+     */
+    @TableField(value="CTX")
+    private String ctx;
+
+    /***
+     * 数据状态,update/delete 当数据状态为delete时,设备状态需改为报废
+     */
+    @TableField(value="DATASTATUS")
+    private String datastatus;
+
+    /***
+     * 数据更新时间 增量字段
+     */
+    @TableField(value="CHANGEDATE")
+    private Date changedate;
+
+
+
+}

+ 103 - 0
src/main/java/com/persagy/entity/HydomcAssetspec.java

@@ -0,0 +1,103 @@
+package com.persagy.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/***
+ * 设备参数信息HYDOMC_ASSETSPEC
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("hydomc_assetspec")
+public class HydomcAssetspec  extends UUIDBaseEntity<HydomcAssetspec> implements Serializable {
+
+    /***
+     * 设备编码,主键  无其他主键可采用设备编码为主键,但要确保唯一(工程信息化设备原码)
+     */
+    @TableField(value="SBYBM")
+    private String sbybm;
+
+    /***
+     * 广场id,项目唯一id,可采用租赁系统广场id,同步后不可更改
+     */
+    @TableField(value="SITEID")
+    private String siteid;
+
+    /***
+     * 设备分类,对接设备分类id,同步后不可更改
+     */
+    @TableField(value="CLASSSTRUCTUREID")
+    private String classstructureid;
+
+    /***
+     * 设备分类名称
+     */
+    @TableField(value="CLASSQC")
+    private String classqc;
+
+    /***
+     *设备参数id
+     */
+    @TableField(value="ASSETATTRID")
+    private String assetattrid;
+
+    /***
+     * 设备参数名称
+     */
+    @TableField(value="CSDESC")
+    private String csdesc;
+
+    /***
+     * 设备参数类型
+     */
+    @TableField(value="DATATYPE")
+    private String datatype;
+
+    /***
+     * 设备参数单位编码
+     */
+    @TableField(value="MEASUREUNITID")
+    private String measureunitid;
+
+    /***
+     * 设备参数单位名称
+     */
+    @TableField(value="CSJLDW")
+    private String csjldw;
+
+    /***
+     * 设备参数数字值
+     */
+    @TableField(value="NUMVALUE")
+    private Double numvalue;
+
+    /***
+     * 设备参数文本值
+     */
+    @TableField(value="ALNVALUE")
+    private String alnvalue;
+
+    /***
+     * 数据状态
+     */
+    @TableField(value="DATASTATUS")
+    private String datastatus;
+
+    /***
+     * 设备参数单位编码
+     */
+    @TableField(value="CHANGEDATE")
+    private Date changedate;
+
+
+
+}

+ 146 - 0
src/main/java/com/persagy/entity/RwdObjectWd.java

@@ -0,0 +1,146 @@
+package com.persagy.entity;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.annotation.JSONField;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.JdbcType;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/***
+ * 设备信息主表HYDOMC_ASSET
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@ToString
+@TableName(autoResultMap = true)
+public class RwdObjectWd  implements Serializable {
+
+    /**
+     * 主键id
+     */
+    @TableId(value="id")
+    private String id;
+
+    /**
+     * 对象名称
+     */
+    @TableField(value="name")
+    private String name;
+
+    /**
+     * 对象本地编码
+     */
+    @JSONField(name="local_id")
+    @TableField(value="local_id")
+    private String localId;
+
+    /**
+     * 对象本地名称
+     */
+    @JSONField(name="local_name")
+    @TableField(value="local_name")
+    private String localName;
+
+    /**
+     * 集团编码
+     */
+    @JSONField(name="group_code")
+    private String groupCode;
+
+    /**
+     * 项目id
+     */
+    @JSONField(name="project_id")
+    @TableField(value="project_id")
+    private String projectId;
+
+    /**
+     * 对象类别
+     */
+    @JSONField(name="obj_type")
+    private String objType;
+
+    /**
+     * 对象类型编码
+     */
+    @JSONField(name="class_code")
+    @TableField(value="class_code")
+    private String classCode;
+
+    /**
+     * 编组
+     */
+    @JSONField(name="grouping")
+    private Integer grouping;
+
+    /**
+     * 是否有效
+     */
+    @JSONField(name="valid")
+    @TableField(value="valid")
+    private Integer valid;
+
+    /**
+     * 信息点
+     */
+    @JSONField(name="infos")
+    @TableField(value="infos", jdbcType = JdbcType.VARCHAR,typeHandler = FastjsonTypeHandler.class)
+    private JSONObject infos;
+
+    /**
+     * 虚点清单
+     */
+    @JSONField(name="virtual_info_codes")
+    private String virtualInfoCodes;
+
+    /**
+     * 创建时间
+     */
+    @JSONField(name="create_time")
+    @TableField(value="create_time")
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    @JSONField(name="update_time")
+    @TableField(value="update_time")
+    private Date updateTime;
+
+    /**
+     * 创建人
+     */
+    @JSONField(name="create_user")
+    private String createUser;
+
+    /**
+     * 更新人
+     */
+    @JSONField(name="update_user")
+    private String updateUser;
+
+    /**
+     * 创建应用
+     */
+    @JSONField(name="createApp")
+    private String create_app;
+
+    /**
+     * 最后更新应用
+     */
+    @JSONField(name="update_app")
+    private String updateApp;
+
+
+}

+ 20 - 0
src/main/java/com/persagy/entity/UUIDBaseEntity.java

@@ -0,0 +1,20 @@
+package com.persagy.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+
+import java.util.UUID;
+
+/**
+ * uuid生成类
+ */
+@Data
+public class UUIDBaseEntity<T> extends Model {
+    /***
+     * 主键,没有任何业务意义,唯一即可
+     */
+    @TableId(value="ASSETSPECID",type = IdType.INPUT)
+    private String assetspecid = UUID.randomUUID().toString().replace("-", "");
+}

+ 55 - 0
src/main/java/com/persagy/entity/VhydomcAssetRelationRwd.java

@@ -0,0 +1,55 @@
+package com.persagy.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/***
+ * 万达-中台设备信息主表字段映射关系表
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("v_hydomc_asset_relation_rwd")
+public class VhydomcAssetRelationRwd  implements Serializable {
+
+    /***
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 万达字段描述
+     */
+    @TableField(value = "wd_remark")
+    private String wdRemark;
+
+    /**
+     * 万达code
+     */
+    @TableField(value = "wd_code")
+    private String wdCode;
+
+
+    /**
+     * 中台字段描述
+     */
+    @TableField(value = "rwd_remark")
+    private String rwdRemark;
+
+    /**
+     * 中台code
+     */
+    @TableField(value = "rwd_code")
+    private String rwdCode;
+
+
+
+}

+ 78 - 0
src/main/java/com/persagy/entity/VhydomcClassspec.java

@@ -0,0 +1,78 @@
+package com.persagy.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/***
+ * 设备参数信息V_HYDOMC_CLASSSPEC
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("v_hydomc_classspec")
+public class VhydomcClassspec extends Model<VhydomcClassspec> implements Serializable {
+
+    /***
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 设备分类id
+     */
+    @TableField(value = "CLASSSTRUCTUREID")
+    private String classstructureid;
+
+    /**
+     * 设备分类名称
+     */
+    @TableField(value = "CLASSQC")
+    private String classqc;
+
+    /**
+     * 设备参数id
+     */
+    @TableField(value = "assetattrid")
+    private String assetattrid;
+
+    /**
+     * 设备参数名称
+     */
+    @TableField(value = "CSDESC")
+    private String csdesc;
+
+    /**
+     * 设备参数类型
+     */
+    @TableField(value = "DATATYPE")
+    private String datatype;
+
+    /**
+     * 设备参数单位编码
+     */
+    @TableField(value = "MEASUREUNITID")
+    private String measureunitid;
+
+    /**
+     * 设备参数单位名称
+     */
+    @TableField(value = "CSJLDW")
+    private String csjldw;
+
+    /**
+     * 设备参数单位名称
+     */
+    @TableField(value = "RWDCODE")
+    private String rwdcode;
+
+
+}

+ 84 - 0
src/main/java/com/persagy/entity/VhydomcClassspecvalue.java

@@ -0,0 +1,84 @@
+package com.persagy.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/***
+ * 设备参数信息V_HYDOMC_CLASSSPEC
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("v_hydomc_classspecvalue")
+public class VhydomcClassspecvalue extends Model<VhydomcClassspecvalue> implements Serializable {
+
+
+    /***
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 设备分类id
+     */
+    @TableField(value = "CLASSSTRUCTUREID")
+    private String classstructureid;
+
+    /**
+     * 设备分类名称
+     */
+    @TableField(value = "CLASSQC")
+    private String classqc;
+
+    /**
+     * 设备参数id
+     */
+    @TableField(value = "assetattrid")
+    private String assetattrid;
+
+    /**
+     * 设备参数名称
+     */
+    @TableField(value = "CSDESC")
+    private String csdesc;
+
+    /**
+     * 设备参数类型
+     */
+    @TableField(value = "DATATYPE")
+    private String datatype;
+
+    /**
+     * 设备参数单位编码
+     */
+    @TableField(value = "MEASUREUNITID")
+    private String measureunitid;
+
+    /**
+     * 设备参数单位名称
+     */
+    @TableField(value = "CSJLDW")
+    private String csjldw;
+
+    /**
+     * 设备参数数字值
+     */
+    @TableField(value = "NUMVALUE")
+    private String numvalue;
+
+    /**
+     * 设备参数文本值
+     */
+    @TableField(value = "ALNVALUE")
+    private String alnvalue;
+
+}

+ 46 - 0
src/main/java/com/persagy/entity/VhydomcClassstructure.java

@@ -0,0 +1,46 @@
+package com.persagy.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/***
+ * 设备参数信息V_HYDOMC_CLASSSPEC
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("v_hydomc_classstructure")
+public class VhydomcClassstructure  extends Model<VhydomcClassstructure> implements Serializable {
+
+    /**
+     * 设备分类id
+     */
+    @TableId(value = "CLASSSTRUCTUREID")
+    private String classstructureid;
+
+    /**
+     * 设备分类名称
+     */
+    @TableField(value = "CLASSQC")
+    private String classqc;
+
+    /**
+     * 设备单位编码
+     */
+    @TableField(value = "JLDW")
+    private String jldw;
+
+    /**
+     * 设备单位名称
+     */
+    @TableField(value = "JLDWDESC")
+    private String jldwdesc;
+
+}

+ 49 - 0
src/main/java/com/persagy/entity/VhydomcRelationProjectid.java

@@ -0,0 +1,49 @@
+package com.persagy.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/***
+ * 中台与万达的项目关系转换表
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("v_hydomc_relation_projectid")
+public class VhydomcRelationProjectid implements Serializable {
+
+    /***
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 博锐中台项目(广场)id
+     */
+    @TableField(value = "project_id")
+    private String projectId;
+
+    /**
+     * 万达广场id
+     */
+    @TableField(value = "wd_project_id")
+    private String wdProjectId;
+
+    /**
+     * 描述
+     */
+    @TableField(value = "remark")
+    private String remark;
+
+
+
+
+}

+ 66 - 0
src/main/java/com/persagy/entity/VhydomcRwdRelation.java

@@ -0,0 +1,66 @@
+package com.persagy.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/***
+ * 中台与万达的项目关系转换表
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("v_hydomc_rwd_relation")
+public class VhydomcRwdRelation  extends Model<VhydomcRwdRelation> implements Serializable {
+
+
+    /***
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 设备分类id
+     */
+    @TableField(value = "CLASSSTRUCTUREID")
+    private String classstructureid;
+
+    /**
+     * 博锐类型编码
+     */
+    @TableField(value = "class_code")
+    private String classCode;
+
+    /**
+     * 设备分类名称
+     */
+    @TableField(value = "CLASSQC")
+    private String classqc;
+
+    /**
+     * 万达字典设备编码
+     */
+    @TableField(value = "wd_classifcation_code")
+    private String wdClassifcationCode;
+
+    /**
+     * 慧云设备类型名称
+     */
+    @TableField(value = "huiyun_device_name")
+    private String huiyun_device_name;
+
+    /**
+     * 构件分类编码(为空表示不需要二级判断)
+     */
+    @TableField(value = "local_id")
+    private String localId;
+
+}

+ 41 - 0
src/main/java/com/persagy/enumeration/OperationStatus.java

@@ -0,0 +1,41 @@
+package com.persagy.enumeration;
+
+/**
+ * 操作状态
+ */
+public enum OperationStatus {
+    INSERT("insert", 1), UPDATE("update", 2),DELETE("delete", 3);
+    // 成员变量
+    private String name;
+    private int index;
+    // 构造方法
+    private OperationStatus(String name, int index) {
+        this.name = name;
+        this.index = index;
+    }
+    // 普通方法
+    public static String getName(int index) {
+        for (OperationStatus c : OperationStatus.values()) {
+            if (c.getIndex() == index) {
+                return c.name;
+            }
+        }
+        return null;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getIndex() {
+        return index;
+    }
+
+    public void setIndex(int index) {
+        this.index = index;
+    }
+}

+ 9 - 0
src/main/java/com/persagy/mapper/HydomcAssetMapper.java

@@ -0,0 +1,9 @@
+package com.persagy.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.entity.HydomcAsset;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface HydomcAssetMapper extends BaseMapper<HydomcAsset> {
+}

+ 9 - 0
src/main/java/com/persagy/mapper/HydomcAssetspecMapper.java

@@ -0,0 +1,9 @@
+package com.persagy.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.entity.HydomcAssetspec;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface HydomcAssetspecMapper  extends BaseMapper<HydomcAssetspec> {
+}

+ 9 - 0
src/main/java/com/persagy/mapper/RwdObjectWdMapper.java

@@ -0,0 +1,9 @@
+package com.persagy.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.entity.RwdObjectWd;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface RwdObjectWdMapper  extends BaseMapper<RwdObjectWd> {
+}

+ 9 - 0
src/main/java/com/persagy/mapper/VhydomcAssetRelationRwdMapper.java

@@ -0,0 +1,9 @@
+package com.persagy.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.entity.VhydomcAssetRelationRwd;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface VhydomcAssetRelationRwdMapper extends BaseMapper<VhydomcAssetRelationRwd> {
+}

+ 9 - 0
src/main/java/com/persagy/mapper/VhydomcClassspecMapper.java

@@ -0,0 +1,9 @@
+package com.persagy.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.entity.VhydomcClassspec;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface VhydomcClassspecMapper   extends BaseMapper<VhydomcClassspec> {
+}

+ 9 - 0
src/main/java/com/persagy/mapper/VhydomcClassspecvalueMapper.java

@@ -0,0 +1,9 @@
+package com.persagy.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.entity.VhydomcClassspecvalue;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface VhydomcClassspecvalueMapper  extends BaseMapper<VhydomcClassspecvalue> {
+}

+ 9 - 0
src/main/java/com/persagy/mapper/VhydomcClassstructureMapper.java

@@ -0,0 +1,9 @@
+package com.persagy.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.entity.VhydomcClassstructure;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface VhydomcClassstructureMapper   extends BaseMapper<VhydomcClassstructure> {
+}

+ 9 - 0
src/main/java/com/persagy/mapper/VhydomcRelationProjectidMapper.java

@@ -0,0 +1,9 @@
+package com.persagy.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.entity.VhydomcRelationProjectid;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface VhydomcRelationProjectidMapper  extends BaseMapper<VhydomcRelationProjectid> {
+}

+ 9 - 0
src/main/java/com/persagy/mapper/VhydomcRwdRelationMapper.java

@@ -0,0 +1,9 @@
+package com.persagy.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.entity.VhydomcRwdRelation;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface VhydomcRwdRelationMapper extends BaseMapper<VhydomcRwdRelation> {
+}

+ 13 - 0
src/main/java/com/persagy/service/HydomcAssetService.java

@@ -0,0 +1,13 @@
+package com.persagy.service;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.persagy.entity.HydomcAsset;
+import com.persagy.mapper.HydomcAssetMapper;
+import org.springframework.stereotype.Service;
+
+@Service
+@DS(value = "wd")
+public class HydomcAssetService extends ServiceImpl<HydomcAssetMapper, HydomcAsset> {
+
+}

+ 12 - 0
src/main/java/com/persagy/service/HydomcAssetspecService.java

@@ -0,0 +1,12 @@
+package com.persagy.service;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.persagy.entity.HydomcAssetspec;
+import com.persagy.mapper.HydomcAssetspecMapper;
+import org.springframework.stereotype.Service;
+
+@Service
+@DS(value = "wd")
+public class HydomcAssetspecService extends ServiceImpl<HydomcAssetspecMapper, HydomcAssetspec> {
+}

+ 9 - 0
src/main/java/com/persagy/service/VhydomcRelationProjectidService.java

@@ -0,0 +1,9 @@
+package com.persagy.service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.persagy.entity.VhydomcRelationProjectid;
+import com.persagy.mapper.VhydomcRelationProjectidMapper;
+
+
+public class VhydomcRelationProjectidService extends ServiceImpl<VhydomcRelationProjectidMapper, VhydomcRelationProjectid> {
+}

+ 296 - 0
src/main/java/com/persagy/utils/CacheUtil.java

@@ -0,0 +1,296 @@
+package com.persagy.utils;
+
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.configuration.MyBatisPlusConfig;
+import com.persagy.service.HydomcAssetService;
+import com.persagy.service.HydomcAssetspecService;
+import com.persagy.entity.*;
+import com.persagy.mapper.*;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.util.ObjectUtils;
+import org.springframework.util.StringUtils;
+
+import javax.annotation.PostConstruct;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Component
+public class CacheUtil {
+    /**
+     *  中台与万达的项目关系转换表缓存
+     * */
+    public static Map<String, VhydomcRelationProjectid> vhydomcRelationProjectidMap = new HashMap<>();
+
+    /**
+     *  万达-中台中间关系表缓存,主表驱动关系
+     * */
+    public static Map<String, VhydomcRwdRelation> vhydomcRwdRelationMap = new HashMap<>();
+    /**
+     *  万达-中台中间关系表缓存,主表驱动关系
+     * */
+    public static Map<String,VhydomcRwdRelation> vhydomcRwdRelationLocalIdMap = new HashMap<>();
+
+    /**
+     *  万达设备分类V_HYDOMC_CLASSSTRUCTURE缓存
+     * */
+    public static Map<String, VhydomcClassstructure> vhydomcClassstructureMap = new HashMap<>();
+
+    /**
+     *  v_hydomc_asset_relation_rwd map
+     * */
+    public static Map<String,String> vhydomcAssetRelationRwdMap = new HashMap<>();
+
+    /**
+     *  设备参数信息V_HYDOMC_CLASSSPEC map
+     * */
+    public static Map<String, List<VhydomcClassspec>>  vhydomcClassspecMap = new HashMap<>();
+
+    /**
+     * 缓存要同步的classCode,供启动的时第一次全量同步用
+     * */
+    public  static List<String> classCodeCacheList = new ArrayList<>();
+
+    @Autowired
+    private VhydomcRelationProjectidMapper vhydomcRelationProjectidMapper;
+
+    @Autowired
+    private VhydomcRwdRelationMapper vhydomcRwdRelationMapper;
+
+    @Autowired
+    private VhydomcClassstructureMapper vhydomcClassstructureMapper;
+
+    @Autowired
+    private VhydomcAssetRelationRwdMapper vhydomcAssetRelationRwdMapper;
+
+    @Autowired
+    private RwdObjectWdMapper rwdObjectWdMapper;
+
+    @Autowired
+    private HydomcAssetService hydomcAssetService;
+
+    @Autowired
+    private VhydomcClassspecMapper vhydomcClassspecMapper;
+
+
+    @Autowired
+    private HydomcAssetspecService hydomcAssetspecService;
+
+
+    @PostConstruct
+    private void init() {
+        log.info("初始化缓存数据开始===========");
+
+        List<VhydomcRelationProjectid>  vhydomcRelationProjectids = vhydomcRelationProjectidMapper.selectList(null);
+        for (VhydomcRelationProjectid vhydomcRelationProjectid:vhydomcRelationProjectids
+        ) {
+            vhydomcRelationProjectidMap.put(vhydomcRelationProjectid.getProjectId().toLowerCase(),vhydomcRelationProjectid);
+        }
+        log.info("中台与万达的项目id关系缓存===={}",vhydomcRelationProjectidMap);
+
+        List<VhydomcRwdRelation>  vhydomcRwdRelations = vhydomcRwdRelationMapper.selectList(null);
+        for (VhydomcRwdRelation vhydomcRwdRelation:vhydomcRwdRelations
+        ) {
+            if(StringUtils.isEmpty(vhydomcRwdRelation.getLocalId())){
+                vhydomcRwdRelationMap.put(vhydomcRwdRelation.getClassCode(),vhydomcRwdRelation);
+            }else {
+                vhydomcRwdRelationLocalIdMap.put(vhydomcRwdRelation.getLocalId(),vhydomcRwdRelation);
+                vhydomcRwdRelationMap.put(vhydomcRwdRelation.getClassCode()+"_"+vhydomcRwdRelation.getLocalId(),vhydomcRwdRelation);
+            }
+            classCodeCacheList.add(vhydomcRwdRelation.getClassCode());
+        }
+        log.info("万达-中台中间关系表缓存======={}",vhydomcRwdRelationMap);
+
+        List<VhydomcClassstructure>  vhydomcClassstructures = vhydomcClassstructureMapper.selectList(null);
+        for (VhydomcClassstructure vhydomcClassstructure:vhydomcClassstructures
+        ) {
+            vhydomcClassstructureMap.put(vhydomcClassstructure.getClassstructureid(),vhydomcClassstructure);
+        }
+        log.info("万达设备分类V_HYDOMC_CLASSSTRUCTURE缓存======={}",vhydomcClassstructureMap);
+
+        List<VhydomcAssetRelationRwd> vhydomcAssetRelationRwds =  vhydomcAssetRelationRwdMapper.selectList(null);
+        for (VhydomcAssetRelationRwd vhydomcAssetRelationRwd:vhydomcAssetRelationRwds
+        ) {
+            vhydomcAssetRelationRwdMap.put(vhydomcAssetRelationRwd.getWdCode(),vhydomcAssetRelationRwd.getRwdCode());
+        }
+        log.info("万达主表设备参数字段转换配置============{}",vhydomcAssetRelationRwdMap);
+
+        List<VhydomcClassspec> vhydomcClassspecs =  vhydomcClassspecMapper.selectList(null);
+        vhydomcClassspecMap = vhydomcClassspecs.stream().collect(Collectors.groupingBy(VhydomcClassspec::getClassstructureid));
+        log.info("万达设备参数信息表配置============{}",vhydomcClassspecMap);
+
+        log.info("初始化缓存数据结束===========");
+    }
+
+    public Map<HydomcAsset,List<HydomcAssetspec>> handleData(String format,List row ,String dataBaseTableName,RwdObjectWd rwdObjectWdQuery){
+        //查询组装数据
+        RwdObjectWd rwd ;
+        if(row!=null){
+             rwd = getEquipId(format,row);
+        }else {
+            rwd = rwdObjectWdQuery;
+        }
+        //万达与中台数据种间关系表驱动查询数据判断
+        if( StringUtils.isEmpty(rwd.getClassCode()) || !vhydomcRwdRelationMap.containsKey(rwd.getClassCode()) ){
+            log.info("监听插入数据classCode={}为空或者万达中台关系表中没有配置该对应的因此该条数据不需要同步",rwd.getClassCode());
+            return null;
+        }
+        //表示需要同步到中台去的数据,先将监听表的infos字段信息查询出来
+        String tableName = dataBaseTableName.substring(dataBaseTableName.indexOf(".")+1);
+        MyBatisPlusConfig.myTableName.set(tableName);
+        RwdObjectWd rwdObjectWd = rwdObjectWdMapper.selectById(rwd.getId());
+        //获取万达的广场id
+        String wdProjectId = vhydomcRelationProjectidMap.get(tableName.substring(tableName.indexOf("pj"))).getWdProjectId();
+
+        //获取万达中台关系表
+        String relationKey = rwdObjectWd.getClassCode();
+        if(!StringUtils.isEmpty(rwdObjectWd.getLocalId()) && vhydomcRwdRelationLocalIdMap.containsKey(rwdObjectWd.getLocalId().substring(0,rwdObjectWd.getLocalId().length()-5))){
+            relationKey = relationKey+"_"+ rwdObjectWd.getLocalId().substring(0,rwdObjectWd.getLocalId().length()-5);
+        }
+        VhydomcRwdRelation vhydomcRwdRelation= vhydomcRwdRelationMap.get(relationKey);
+        //拿到万达分类id
+        String classstructureid = vhydomcRwdRelation.getClassstructureid();
+        //信息点&值
+        JSONObject infosObject = ObjectUtils.isEmpty(rwdObjectWd.getInfos())?new JSONObject():rwdObjectWd.getInfos();
+        HydomcAsset hydomcAsset = assemHydomcAsset(wdProjectId, infosObject);
+
+        //获取万达设备参数配置信息表
+        List<VhydomcClassspec> vhydomcClassspecs =  vhydomcClassspecMap.get(classstructureid);
+        List<HydomcAssetspec> hydomcAssetspecs = assemHydomcAssetspec(wdProjectId, classstructureid, infosObject, vhydomcClassspecs);
+        Map<HydomcAsset,List<HydomcAssetspec>> maps = new HashMap<>();
+        maps.put(hydomcAsset,hydomcAssetspecs);
+        return maps;
+    }
+
+    public  RwdObjectWd getEquipId(String format,List row ){
+        JSONObject jsonObject =  JsonUtil.transformationDataToObject(format,row);
+        RwdObjectWd rwdObjectWd =  JSONObject.parseObject(jsonObject.toString()).toJavaObject(RwdObjectWd.class);
+        return rwdObjectWd;
+    }
+
+
+    /**
+     * @desc 组装设备参数信息表,设备参数信息HYDOMC_ASSETSPEC
+     * @param wdProjectId
+     * @param classstructureid
+     * @param infosObject
+     * @param vhydomcClassspecs
+     * @return
+     */
+    private List<HydomcAssetspec> assemHydomcAssetspec(String wdProjectId, String classstructureid, JSONObject infosObject, List<VhydomcClassspec> vhydomcClassspecs) {
+        List<HydomcAssetspec> hydomcAssetspecLists = new ArrayList<>();
+        for (VhydomcClassspec vhydomcClassspec:vhydomcClassspecs
+        ) {
+            HydomcAssetspec hydomcAssetspec = new HydomcAssetspec();
+            //广场id
+            hydomcAssetspec.setSiteid(wdProjectId);
+            //设备编码
+            hydomcAssetspec.setSbybm(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("SBYBM")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("SBYBM")));
+            //设备分类id
+            hydomcAssetspec.setClassstructureid(classstructureid);
+            //设备分类名称
+            hydomcAssetspec.setClassqc(vhydomcClassspec.getClassqc());
+            //设备参数id
+            hydomcAssetspec.setAssetattrid(vhydomcClassspec.getAssetattrid());
+            //设备参数名称
+            hydomcAssetspec.setCsdesc(vhydomcClassspec.getCsdesc());
+            //设备参数类型
+            hydomcAssetspec.setDatatype(vhydomcClassspec.getDatatype());
+            //设备参数单位编码
+            hydomcAssetspec.setMeasureunitid(vhydomcClassspec.getMeasureunitid());
+            //设备参数单位名称
+            hydomcAssetspec.setCsjldw(vhydomcClassspec.getCsjldw());
+            //设备参数数值
+            try {
+                hydomcAssetspec.setNumvalue(infosObject.get(vhydomcClassspec.getRwdcode())==null?null:Double.parseDouble(String.valueOf(infosObject.get(vhydomcClassspec.getRwdcode()))));
+            } catch (NumberFormatException e) {
+                hydomcAssetspec.setAlnvalue(infosObject.get(vhydomcClassspec.getRwdcode())==null?null:String.valueOf(infosObject.get(vhydomcClassspec.getRwdcode())));
+                log.error("万达设备参数信息表,设备参数数字值设置失败,因为不是数值型:{}",e);
+            }
+
+            //数据状态
+//            hydomcAssetspec.setDatastatus("insert");
+            //数据更新时间
+            hydomcAssetspec.setChangedate(new Date());
+            //添加到集合
+            hydomcAssetspecLists.add(hydomcAssetspec);
+        }
+        return hydomcAssetspecLists;
+    }
+
+    /**
+     * @desc 组装设备信息主表,设备信息主表HYDOMC_ASSET
+     * @param wdProjectId
+     * @param infosObject
+     * @return
+     */
+    private HydomcAsset assemHydomcAsset(String wdProjectId, JSONObject infosObject) {
+        //填充主表数据
+        HydomcAsset hydomcAsset = new HydomcAsset();
+        //广场id填充
+        hydomcAsset.setSiteid(wdProjectId);
+        //设备编码
+        hydomcAsset.setSbybm(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("SBYBM")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("SBYBM")));
+        //设备名称
+        hydomcAsset.setDescription(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("description")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("description")));
+        //设备安装位置
+        hydomcAsset.setWzqy(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("wzqy")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("wzqy")));
+        //设备服务区域
+        hydomcAsset.setFwqy(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("fwqy")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("fwqy")));
+        //设备型号
+        hydomcAsset.setSbxh(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("sbxh")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("sbxh")));
+        //设备分类
+        hydomcAsset.setClassstructureid(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("CLASSSTRUCTUREID")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("CLASSSTRUCTUREID")));
+        //设备状态
+        hydomcAsset.setStatus(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("STATUS")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("STATUS")));
+        //设备序号
+        hydomcAsset.setSbxhh(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("sbxhh")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("sbxhh")));
+        //厂家设备序列号
+        hydomcAsset.setCjsbxh(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("CJSBXH")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("CJSBXH")));
+        //生产商
+        hydomcAsset.setManufacturer(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("MANUFACTURER")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("MANUFACTURER")));
+        //供应商
+        hydomcAsset.setVendor(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("VENDOR")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("VENDOR")));
+        //服务商
+        hydomcAsset.setFws(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("FWS")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("FWS")));
+        //采购金额
+        hydomcAsset.setPurchaseprice(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("PURCHASEPRICE")))?null:Double.parseDouble(String.valueOf(infosObject.get(vhydomcAssetRelationRwdMap.get("PURCHASEPRICE")))));
+        //折旧/使用年限
+        hydomcAsset.setZjsynx(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("ZJSYNX")))?null:Double.parseDouble(String.valueOf(infosObject.get(vhydomcAssetRelationRwdMap.get("ZJSYNX")))));
+        //生产日期/出厂日期
+        hydomcAsset.setScrq(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("SCRQ")))?null:(Date)infosObject.get(vhydomcAssetRelationRwdMap.get("SCRQ")));
+        //采购日期
+        hydomcAsset.setCgrq(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("CGRQ")))?null:(Date)infosObject.get(vhydomcAssetRelationRwdMap.get("CGRQ")));
+        //安装日期
+        hydomcAsset.setAzdate(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("AZDATE")))?null:(Date)infosObject.get(vhydomcAssetRelationRwdMap.get("AZDATE")));
+        //启用日期
+        hydomcAsset.setInstalldate(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("INSTALLDATE")))?null:(Date)infosObject.get(vhydomcAssetRelationRwdMap.get("INSTALLDATE")));
+        //质保开始日期
+        hydomcAsset.setZbksrq(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("ZBKSRQ")))?null:(Date)infosObject.get(vhydomcAssetRelationRwdMap.get("ZBKSRQ")));
+        //质保结束日期
+        hydomcAsset.setZbjsrq(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("ZBJSRQ")))?null:(Date)infosObject.get(vhydomcAssetRelationRwdMap.get("ZBJSRQ")));
+        //中修周期
+        hydomcAsset.setZxzq(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("ZXZQ")))?null:Double.parseDouble(String.valueOf(infosObject.get(vhydomcAssetRelationRwdMap.get("ZXZQ")))));
+        //大修周期
+        hydomcAsset.setDxzq(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("DXZQ")))?null:Double.parseDouble(String.valueOf(infosObject.get(vhydomcAssetRelationRwdMap.get("DXZQ")))));
+        //物业类型
+        hydomcAsset.setWylx(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("WYLX")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("WYLX")));
+        //设备管理归属
+        hydomcAsset.setSbglgs(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("SBGLGS")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("SBGLGS")));
+        //慧云设备编码
+        hydomcAsset.setHysbbm(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("HYSBBM")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("HYSBBM")));
+        //是否慧云使用
+        hydomcAsset.setSfhysy(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("SFHYSY")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("SFHYSY")));
+        //是否是主力店
+        hydomcAsset.setSfzld(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("SFZLD")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("SFZLD")));
+        //备注
+        hydomcAsset.setMark(ObjectUtils.isEmpty(infosObject.get(vhydomcAssetRelationRwdMap.get("MARK")))?null:(String)infosObject.get(vhydomcAssetRelationRwdMap.get("MARK")));
+//        //数据状态
+//        hydomcAsset.setDatastatus(dataStatus);
+        //数据更新时间
+        hydomcAsset.setChangedate(new Date());
+        return hydomcAsset;
+    }
+}

+ 28 - 0
src/main/java/com/persagy/utils/JsonUtil.java

@@ -0,0 +1,28 @@
+package com.persagy.utils;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+
+/**
+ * json 工具类
+ */
+public class JsonUtil {
+
+
+    /**
+     * @desc 将binlog日志解析的数据映射成实体类
+     * @param message
+     * @return
+     */
+    public static JSONObject transformationDataToObject(String format ,List message) {
+        JSONObject resultObject = new JSONObject();
+        JSONObject json = JSON.parseObject(format);
+        for (String key : json.keySet()) {
+            resultObject.put(key, message.get(json.getInteger(key)));
+        }
+
+        return resultObject;
+    }
+}

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

@@ -0,0 +1,62 @@
+server:
+  id: 1
+# binlog配置
+binlog:
+  host: 39.102.43.179
+  port: 9934
+  user: root
+  password: brzj123456
+  # 指定监听的表
+  database:
+    table: calendar-center.rwd_object_wd_pj4403070003
+    ###,calendar-center.rwd_object_wd_pj4311030001
+    # 指定监听的表结构
+    table-format: "{\"id\":\"0\",\"class_code\":\"7\",\"valid\":\"9\"}"
+#    table-format: "{\"id\":\"0\",\"name\":\"1\",\"local_id\":\"2\",\"local_name\":\"3\",\"group_code\":\"4\",\"project_id\":\"5\",\"obj_type\":\"6\",\"class_code\":\"7\",\"grouping\":\"8\",\"valid\":\"9\",\"infos\":\"10\",\"virtual_info_codes\":\"11\",\"create_time\":\"12\",\"update_time\":\"13\",\"create_user\":\"14\",\"update_user\":\"15\",\"create_app\":\"16\",\"update_app\":\"17\"}"
+
+spring:
+  main:
+    ##禁用web端口
+    web-application-type: none
+  datasource:
+    hikari:
+      minimum-idle: 4
+      maximum-pool-size: 16
+      connection-timeout: 10000
+      idle-timeout: 30000
+      connection-init-sql: set names utf8mb4
+    dynamic:
+      primary: rwd
+      datasource:
+        wd:
+          driver-class-name: com.mysql.cj.jdbc.Driver
+          url: jdbc:mysql://39.102.43.179:9934/control-center?useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
+          username: root
+          password: brzj123456
+        rwd:
+          driver-class-name: com.mysql.cj.jdbc.Driver
+          url: jdbc:mysql://39.102.43.179:9934/calendar-center?useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
+          username: root
+          password: brzj123456
+
+pagehelper:
+  reasonable: true
+  support-methods-arguments: true
+  params: count=countSql
+  row-bounds-with-count: true
+  helper-dialect: mysql
+###mybatis-plus的配置
+mybatis-plus:
+  mapper-locations: classpath:mapper/*.xml            # 配置mapper.xml路径
+  check-config-location: true                         # 检查xml文件是否存在
+  configuration:
+    map-underscore-to-camel-case: true                # 开启驼峰命名法
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+  type-aliases-package: com.study.construct.entity    # 实体类存放位置
+
+logging:
+  level:
+    com.datasource: debug
+
+mybatis:
+  executor-type: simple

+ 39 - 0
src/main/resources/sql/rwd/v_hydomc_asset_relation_rwd.sql

@@ -0,0 +1,39 @@
+-- 创建万达设备信息主表HYDOMC_ASSET,需要同步数据的主表(基础公共信息点)
+CREATE TABLE `v_hydomc_asset_relation_rwd` (
+  `id` bigint(12) NOT NULL AUTO_INCREMENT,
+  `wd_remark` varchar(40) DEFAULT NULL COMMENT '描述',
+  `wd_code` varchar(40) DEFAULT NULL COMMENT '万达编码',
+  `rwd_remark` varchar(255) DEFAULT NULL COMMENT '描述信息',
+  `rwd_code` varchar(40) DEFAULT NULL COMMENT '中台编码 ',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='万达-中台设备信息主表字段映射关系表';
+
+-- wd初始化数据,中台与万达的转换字段对应表数据
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (2, '设备编码', 'SBYBM', '工程信息化编码', 'wD_gongchengxinxihua');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (3, '设备名称', 'description', '工程设备名称', 'wD_shebeimingcheng');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (4, '设备安装位置', 'wzqy', '设备所在空间关系', '');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (5, '设备服务区域', 'fwqy', '设备服务空间关系', 'wD_equipfuwuquyu');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (6, '设备型号', 'sbxh', '设备型号', 'specification');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (7, '设备分类', 'CLASSSTRUCTUREID', '设备分类', 'wD_shebeifenlei');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (8, '设备状态', 'STATUS', '设备状态', 'equipstatus');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (9, '设备序号', 'sbxhh', '设备序号', 'wD_equipnumber');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (10, '厂家设备序列号', 'CJSBXH', '厂家设备序列号', 'wD_serialnum');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (11, '生产商', 'MANUFACTURER', '生产商', 'manufacturer');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (12, '供应商', 'VENDOR', '供应商', 'supplier');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (13, '服务商', 'FWS', '服务商', 'maintainer');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (14, '采购金额', 'PURCHASEPRICE', '采购金额', 'purchasePrice');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (15, '折旧/使用年限', 'ZJSYNX', '折旧/使用年限', 'wD_servicelife');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (16, '生产日期/出厂日期', 'SCRQ', '生产日期/出厂日期', 'wD_productdate');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (17, '采购日期', 'CGRQ', '采购日期', 'PurchaseDate');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (18, '安装日期', 'AZDATE', '安装日期', 'InstallDate');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (19, '启用日期', 'INSTALLDATE', '启用日期', 'wD_enabledate');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (20, '质保开始日期', 'ZBKSRQ', '质保开始日期', 'wD_warrantystartdate');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (21, '质保结束日期', 'ZBJSRQ', '质保结束日期', 'wD_warrantyenddate');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (22, '中修周期', 'ZXZQ', '中修周期', 'wD_mediumrepaircycle');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (23, '大修周期', 'DXZQ', '大修周期', 'wD_overhaulcycle');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (24, '物业类型', 'WYLX', '物业类型', 'wD_propertytype');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (25, '设备管理归属', 'SBGLGS', '设备管理归属', 'wD_equipmanageownership');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (26, '慧云设备编码', 'HYSBBM', '慧云本地编码', 'wD_huiyunbendibianma');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (27, '是否慧云使用', 'SFHYSY', '是否慧云使用', 'wD_huiyunuse');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (28, '是否是主力店', 'SFZLD', '是否是主力店', 'wD_mainstore');
+INSERT INTO `v_hydomc_asset_relation_rwd` VALUES (29, '备注', 'MARK', '', '');

+ 13 - 0
src/main/resources/sql/rwd/v_hydomc_binlog_position.sql

@@ -0,0 +1,13 @@
+-- binlog 位置记录表
+CREATE TABLE `v_hydomc_binlog_position` (
+  `id` bigint(255) NOT NULL AUTO_INCREMENT,
+  `binlog_name` varchar(255) DEFAULT NULL COMMENT 'binglog文件名',
+  `position` bigint(255) DEFAULT NULL COMMENT 'binglog位置信息',
+  `server_id` bigint(255) DEFAULT NULL COMMENT '监听数据库的serverId',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
+
+-- 需要初始化数据
+-- 先查看mysql的binglogs日志文件名
+--  执行,show binary logs; 取mysql-bin.xxxx 角标最大的那个即可
+INSERT INTO `v_hydomc_binlog_position`( `binlog_name`) VALUES ( "mysql-bin.xxxx");

+ 153 - 0
src/main/resources/sql/rwd/v_hydomc_classspec.sql

@@ -0,0 +1,153 @@
+-- 万达特有设备信息点对照表
+CREATE TABLE `v_hydomc_classspec` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `CLASSSTRUCTUREID` varchar(40) DEFAULT NULL COMMENT '设备分类id',
+  `CLASSQC` varchar(40) DEFAULT NULL COMMENT '设备分类名称',
+  `ASSETATTRID` varchar(40) DEFAULT NULL COMMENT '设备参数id',
+  `CSDESC` varchar(40) DEFAULT NULL COMMENT '设备参数名称',
+  `DATATYPE` varchar(40) DEFAULT NULL COMMENT '设备参数类型',
+  `MEASUREUNITID` varchar(40) DEFAULT NULL COMMENT '设备参数单位编码',
+  `CSJLDW` varchar(40) DEFAULT NULL COMMENT '设备参数单位名称',
+  `RWDCODE` varchar(255) DEFAULT NULL COMMENT '中台的信息点字段',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='设备参数信息V_HYDOMC_CLASSSPEC';
+
+
+-- 初始化数据
+INSERT INTO `v_hydomc_classspec` VALUES (276, '1507', '电梯系统/扶梯/人行步道', '1106', '输送能力', '字母数字', '1009', '人/小时', 'rateddeliverycap');
+INSERT INTO `v_hydomc_classspec` VALUES (277, '1507', '电梯系统/扶梯/人行步道', '1018', '是否变频', '字母数字', '', '', 'wD_shifoubianpin');
+INSERT INTO `v_hydomc_classspec` VALUES (278, '1507', '电梯系统/扶梯/人行步道', '1015', '倾斜度', '字母数字', '1007', '度', 'wD_qingxiedu');
+INSERT INTO `v_hydomc_classspec` VALUES (279, '1507', '电梯系统/扶梯/人行步道', '1013', '名义宽度', '字母数字', '1004', '毫米', 'wD_mingyikuandu');
+INSERT INTO `v_hydomc_classspec` VALUES (280, '1507', '电梯系统/扶梯/人行步道', '1006', '功率', '数字', '1002', '千瓦', 'ratedp');
+INSERT INTO `v_hydomc_classspec` VALUES (281, '1507', '电梯系统/扶梯/人行步道', '1004', '额定速度', '数字', '1003', '米/秒', 'ratednonloadv');
+INSERT INTO `v_hydomc_classspec` VALUES (282, '1507', '电梯系统/扶梯/人行步道', '1003', '额定电压', '数字', '1005', '伏', 'ratedu');
+INSERT INTO `v_hydomc_classspec` VALUES (283, '1507', '电梯系统/扶梯/人行步道', '1114', '提升高度', '字母数字', '1008', '米', 'wD_tishenggaodu');
+INSERT INTO `v_hydomc_classspec` VALUES (284, '1506', '电梯系统/扶梯/自动扶梯', '1006', '功率', '数字', '1002', '千瓦', 'ratedp');
+INSERT INTO `v_hydomc_classspec` VALUES (285, '1506', '电梯系统/扶梯/自动扶梯', '1114', '提升高度', '字母数字', '1008', '米', 'wD_tishenggaodu');
+INSERT INTO `v_hydomc_classspec` VALUES (286, '1506', '电梯系统/扶梯/自动扶梯', '1106', '输送能力', '字母数字', '1009', '人/小时', 'rateddeliverycap');
+INSERT INTO `v_hydomc_classspec` VALUES (287, '1506', '电梯系统/扶梯/自动扶梯', '1046', '是否有变频设备', '字母数字', '', '', 'wD_shifoubianpinequip');
+INSERT INTO `v_hydomc_classspec` VALUES (288, '1506', '电梯系统/扶梯/自动扶梯', '1018', '是否变频', '字母数字', '', '', 'wD_shifoubianpin');
+INSERT INTO `v_hydomc_classspec` VALUES (289, '1506', '电梯系统/扶梯/自动扶梯', '1015', '倾斜度', '字母数字', '1007', '度', 'wD_qingxiedu');
+INSERT INTO `v_hydomc_classspec` VALUES (290, '1506', '电梯系统/扶梯/自动扶梯', '1013', '名义宽度', '字母数字', '1004', '毫米', 'wD_mingyikuandu');
+INSERT INTO `v_hydomc_classspec` VALUES (291, '1506', '电梯系统/扶梯/自动扶梯', '1004', '额定速度', '数字', '1003', '米/秒', 'ratednonloadv');
+INSERT INTO `v_hydomc_classspec` VALUES (292, '1506', '电梯系统/扶梯/自动扶梯', '1003', '额定电压', '数字', '1005', '伏', 'ratedu');
+INSERT INTO `v_hydomc_classspec` VALUES (293, '1504', '电梯系统/直梯/观光电梯', '1006', '功率', '数字', '1002', '千瓦', 'ratedp');
+INSERT INTO `v_hydomc_classspec` VALUES (294, '1504', '电梯系统/直梯/观光电梯', '1004', '额定速度', '数字', '1003', '米/秒', 'wD_edingsudu');
+INSERT INTO `v_hydomc_classspec` VALUES (295, '1504', '电梯系统/直梯/观光电梯', '1003', '额定电压', '数字', '1005', '伏', 'ratedu');
+INSERT INTO `v_hydomc_classspec` VALUES (296, '1504', '电梯系统/直梯/观光电梯', '1009', '轿厢尺寸', '字母数字', '1028', '毫米*毫米', 'wD_jiaoxiangchicun');
+INSERT INTO `v_hydomc_classspec` VALUES (297, '1504', '电梯系统/直梯/观光电梯', '1010', '控制方式', '字母数字', '', '', 'wD_ctrltype');
+INSERT INTO `v_hydomc_classspec` VALUES (298, '1504', '电梯系统/直梯/观光电梯', '1023', '拖动方式', '字母数字', '', '', 'wD_tuodongfangshi');
+INSERT INTO `v_hydomc_classspec` VALUES (299, '1504', '电梯系统/直梯/观光电梯', '1021', '厅轿门开门方式', '字母数字', '', '', 'wD_tingjiaomenkaimenfangshi');
+INSERT INTO `v_hydomc_classspec` VALUES (300, '1504', '电梯系统/直梯/观光电梯', '1001', '层数', '数字', '1006', '层', 'wD_cengshu');
+INSERT INTO `v_hydomc_classspec` VALUES (301, '1504', '电梯系统/直梯/观光电梯', '1046', '是否有变频设备', '字母数字', '', '', 'wD_shifoubianpinequip');
+INSERT INTO `v_hydomc_classspec` VALUES (302, '1504', '电梯系统/直梯/观光电梯', '1026', '站数', '数字', '1011', '站', 'wD_zhanshu');
+INSERT INTO `v_hydomc_classspec` VALUES (303, '1504', '电梯系统/直梯/观光电梯', '1025', '载重', '数字', '1001', '千克', 'wD_zaizhong');
+INSERT INTO `v_hydomc_classspec` VALUES (304, '1504', '电梯系统/直梯/观光电梯', '1022', '厅轿门形式', '字母数字', '', '', 'wD_tingjiaomenxingshi');
+INSERT INTO `v_hydomc_classspec` VALUES (305, '1503', '电梯系统/直梯/货梯', '1001', '层数', '数字', '1006', '层', 'wD_cengshu');
+INSERT INTO `v_hydomc_classspec` VALUES (306, '1503', '电梯系统/直梯/货梯', '1003', '额定电压', '数字', '1005', '伏', 'ratedu');
+INSERT INTO `v_hydomc_classspec` VALUES (307, '1503', '电梯系统/直梯/货梯', '1004', '额定速度', '数字', '1003', '米/秒', 'wD_edingsudu');
+INSERT INTO `v_hydomc_classspec` VALUES (308, '1503', '电梯系统/直梯/货梯', '1006', '功率', '数字', '1002', '千瓦', 'ratedp');
+INSERT INTO `v_hydomc_classspec` VALUES (309, '1503', '电梯系统/直梯/货梯', '1009', '轿厢尺寸', '字母数字', '1028', '毫米*毫米', 'wD_jiaoxiangchicun');
+INSERT INTO `v_hydomc_classspec` VALUES (310, '1503', '电梯系统/直梯/货梯', '1010', '控制方式', '字母数字', '', '', 'wD_ctrltype');
+INSERT INTO `v_hydomc_classspec` VALUES (311, '1503', '电梯系统/直梯/货梯', '1021', '厅轿门开门方式', '字母数字', '', '', 'wD_tingjiaomenkaimenfangshi');
+INSERT INTO `v_hydomc_classspec` VALUES (312, '1503', '电梯系统/直梯/货梯', '1022', '厅轿门形式', '字母数字', '', '', 'wD_tingjiaomenxingshi');
+INSERT INTO `v_hydomc_classspec` VALUES (313, '1503', '电梯系统/直梯/货梯', '1023', '拖动方式', '字母数字', '', '', 'wD_tuodongfangshi');
+INSERT INTO `v_hydomc_classspec` VALUES (314, '1503', '电梯系统/直梯/货梯', '1025', '载重', '数字', '1001', '千克', 'wD_zaizhong');
+INSERT INTO `v_hydomc_classspec` VALUES (315, '1503', '电梯系统/直梯/货梯', '1026', '站数', '数字', '1011', '站', 'wD_zhanshu');
+INSERT INTO `v_hydomc_classspec` VALUES (316, '1503', '电梯系统/直梯/货梯', '1046', '是否有变频设备', '字母数字', '', '', 'wD_shifoubianpinequip');
+INSERT INTO `v_hydomc_classspec` VALUES (317, '1502', '电梯系统/直梯/客梯', '1001', '层数', '数字', '1006', '层', 'wD_cengshu');
+INSERT INTO `v_hydomc_classspec` VALUES (318, '1502', '电梯系统/直梯/客梯', '1003', '额定电压', '数字', '1005', '伏', 'ratedu');
+INSERT INTO `v_hydomc_classspec` VALUES (319, '1502', '电梯系统/直梯/客梯', '1004', '额定速度', '数字', '1003', '米/秒', 'wD_edingsudu');
+INSERT INTO `v_hydomc_classspec` VALUES (320, '1502', '电梯系统/直梯/客梯', '1006', '功率', '数字', '1002', '千瓦', 'ratedp');
+INSERT INTO `v_hydomc_classspec` VALUES (321, '1502', '电梯系统/直梯/客梯', '1009', '轿厢尺寸', '字母数字', '1028', '毫米*毫米', 'wD_jiaoxiangchicun');
+INSERT INTO `v_hydomc_classspec` VALUES (322, '1502', '电梯系统/直梯/客梯', '1046', '是否有变频设备', '字母数字', '', '', 'wD_shifoubianpinequip');
+INSERT INTO `v_hydomc_classspec` VALUES (323, '1502', '电梯系统/直梯/客梯', '1021', '厅轿门开门方式', '字母数字', '', '', 'wD_tingjiaomenkaimenfangshi');
+INSERT INTO `v_hydomc_classspec` VALUES (324, '1502', '电梯系统/直梯/客梯', '1022', '厅轿门形式', '字母数字', '', '', 'wD_tingjiaomenxingshi');
+INSERT INTO `v_hydomc_classspec` VALUES (325, '1502', '电梯系统/直梯/客梯', '1023', '拖动方式', '字母数字', '', '', 'wD_tuodongfangshi');
+INSERT INTO `v_hydomc_classspec` VALUES (326, '1502', '电梯系统/直梯/客梯', '1025', '载重', '数字', '1001', '千克', 'wD_zaizhong');
+INSERT INTO `v_hydomc_classspec` VALUES (327, '1502', '电梯系统/直梯/客梯', '1026', '站数', '数字', '1011', '站', 'wD_zhanshu');
+INSERT INTO `v_hydomc_classspec` VALUES (328, '1502', '电梯系统/直梯/客梯', '1010', '控制方式', '字母数字', '', '', 'wD_ctrltype');
+INSERT INTO `v_hydomc_classspec` VALUES (329, '1639', '给排水/给水泵', '1006', '功率', '数字', '1002', '千瓦', 'ratedp');
+INSERT INTO `v_hydomc_classspec` VALUES (330, '1639', '给排水/给水泵', '1046', '是否有变频设备', '字母数字', '', '', 'wD_shifoubianpinequip');
+INSERT INTO `v_hydomc_classspec` VALUES (331, '1639', '给排水/给水泵', '1049', '电压', '数字', '1005', '伏', 'ratedu');
+INSERT INTO `v_hydomc_classspec` VALUES (332, '1639', '给排水/给水泵', '1130', '转速', '数字', '1032', '转/分钟', 'wD_rpm');
+INSERT INTO `v_hydomc_classspec` VALUES (333, '1639', '给排水/给水泵', '1109', '水泵安装形式', '字母数字', '', '', 'installtype');
+INSERT INTO `v_hydomc_classspec` VALUES (334, '1639', '给排水/给水泵', '1123', '扬程', '数字', '1008', '米', 'ratedhead');
+INSERT INTO `v_hydomc_classspec` VALUES (335, '1639', '给排水/给水泵', '1129', '重量', '数字', '1001', '千克', 'wD_weight');
+INSERT INTO `v_hydomc_classspec` VALUES (336, '1639', '给排水/给水泵', '1077', '流量', '数字', '1025', '立方米/小时', 'ratedflow');
+INSERT INTO `v_hydomc_classspec` VALUES (337, '1514', '供配电系统/高压配电柜/变压器', '1093', '容量', '数字', '1024', '千伏安', 'ratedcap');
+INSERT INTO `v_hydomc_classspec` VALUES (338, '1514', '供配电系统/高压配电柜/变压器', '1062', '高压侧电压', '数字', '1023', '千伏', 'huratedu');
+INSERT INTO `v_hydomc_classspec` VALUES (339, '1702', '空调系统/锅炉', '1006', '功率', '数字', '1002', '千瓦', 'wD_shigonggonglv');
+INSERT INTO `v_hydomc_classspec` VALUES (340, '1702', '空调系统/锅炉', '1173', '额定效率', '数字', '1002', '千瓦', 'designeff');
+INSERT INTO `v_hydomc_classspec` VALUES (341, '1702', '空调系统/锅炉', '1067', '锅炉形式', '字母数字', '', '', 'wD_boilerform');
+INSERT INTO `v_hydomc_classspec` VALUES (342, '1702', '空调系统/锅炉', '1044', '出水温度', '数字', '1040', '摄氏度', 'wD_shejichushuiwendu');
+INSERT INTO `v_hydomc_classspec` VALUES (343, '1702', '空调系统/锅炉', '1128', '制热量', '数字', '1002', '千瓦', 'wD_zhireliang');
+INSERT INTO `v_hydomc_classspec` VALUES (344, '1702', '空调系统/锅炉', '1090', '燃料类型', '字母数字', '', '', 'wD_fueltype');
+INSERT INTO `v_hydomc_classspec` VALUES (345, '1712', '空调系统/空调末端/新风机组', '1127', '制冷量', '数字', '1002', '千瓦', 'designcoolp');
+INSERT INTO `v_hydomc_classspec` VALUES (346, '1712', '空调系统/空调末端/新风机组', '1060', '风量', '数字', '1025', '立方米/小时', 'maxfreshairflow');
+INSERT INTO `v_hydomc_classspec` VALUES (347, '1712', '空调系统/空调末端/新风机组', '1128', '制热量', '数字', '1002', '千瓦', 'designheatp');
+INSERT INTO `v_hydomc_classspec` VALUES (348, '1712', '空调系统/空调末端/新风机组', '1070', '机外余压', '数字', '1029', '兆帕(Mpa)', 'designexcesspress');
+INSERT INTO `v_hydomc_classspec` VALUES (349, '1712', '空调系统/空调末端/新风机组', '1110', '水流量', '数字', '1022', '千克/秒', 'designchillwaterflow');
+INSERT INTO `v_hydomc_classspec` VALUES (350, '1712', '空调系统/空调末端/新风机组', '1002', '电机功率', '数字', '1002', '千瓦', 'ratedp');
+INSERT INTO `v_hydomc_classspec` VALUES (351, '1920', '空调系统/空调末端/组合式空调机组', '1002', '电机功率', '数字', '1002', '千瓦', 'ratedp');
+INSERT INTO `v_hydomc_classspec` VALUES (352, '1920', '空调系统/空调末端/组合式空调机组', '1127', '制冷量', '数字', '1002', '千瓦', 'summerdesigncoolp');
+INSERT INTO `v_hydomc_classspec` VALUES (353, '1920', '空调系统/空调末端/组合式空调机组', '1060', '风量', '数字', '1025', '立方米/小时', 'summerdesignsupplyairflow');
+INSERT INTO `v_hydomc_classspec` VALUES (354, '1920', '空调系统/空调末端/组合式空调机组', '1174', '类型(单冷/冷热)', '字母数字', '', '', 'wD_lengreleixing');
+INSERT INTO `v_hydomc_classspec` VALUES (355, '1920', '空调系统/空调末端/组合式空调机组', '1176', '新风量', '数字', '1025', '立方米/小时', 'wD_freshairFlow');
+INSERT INTO `v_hydomc_classspec` VALUES (356, '1920', '空调系统/空调末端/组合式空调机组', '1128', '制热量', '数字', '1002', '千瓦', 'designheatp');
+INSERT INTO `v_hydomc_classspec` VALUES (357, '1700', '空调系统/冷(热)水机组/压缩式离心冷水机组', '1075', '冷量', '数字', '1002', '千瓦', 'ratedcool');
+INSERT INTO `v_hydomc_classspec` VALUES (358, '1700', '空调系统/冷(热)水机组/压缩式离心冷水机组', '1076', '冷却方式', '字母数字', '', '', 'wD_lengquefangshi');
+INSERT INTO `v_hydomc_classspec` VALUES (359, '1700', '空调系统/冷(热)水机组/压缩式离心冷水机组', '1126', '制冷剂', '字母数字', '', '', 'refrigeranttype');
+INSERT INTO `v_hydomc_classspec` VALUES (360, '1700', '空调系统/冷(热)水机组/压缩式离心冷水机组', '1121', '压缩机结构型式', '字母数字', '', '', 'wD_yasuojijiegouxingshi');
+INSERT INTO `v_hydomc_classspec` VALUES (361, '1700', '空调系统/冷(热)水机组/压缩式离心冷水机组', '1175', '额定COP', '数字', '', '', 'ratedcop');
+INSERT INTO `v_hydomc_classspec` VALUES (362, '1700', '空调系统/冷(热)水机组/压缩式离心冷水机组', '1097', '是否热泵', '字母数字', '', '', 'wD_shifourebeng');
+INSERT INTO `v_hydomc_classspec` VALUES (363, '1700', '空调系统/冷(热)水机组/压缩式离心冷水机组', '1049', '电压', '数字', '1005', '伏', 'ratedu');
+INSERT INTO `v_hydomc_classspec` VALUES (364, '1700', '空调系统/冷(热)水机组/压缩式离心冷水机组', '1047', '电流', '数字', '1015', '安', 'ratedi');
+INSERT INTO `v_hydomc_classspec` VALUES (365, '1700', '空调系统/冷(热)水机组/压缩式离心冷水机组', '1018', '是否变频', '字母数字', '', '', 'wD_shifoubianpin');
+INSERT INTO `v_hydomc_classspec` VALUES (366, '1700', '空调系统/冷(热)水机组/压缩式离心冷水机组', '1103', '输入功率', '数字', '1002', '千瓦', 'wD_inputgonglv');
+INSERT INTO `v_hydomc_classspec` VALUES (367, '1771', '空调系统/冷(热)水机组/压缩式螺杆冷水机组', '1097', '是否热泵', '字母数字', '', '', 'wD_shifourebeng');
+INSERT INTO `v_hydomc_classspec` VALUES (368, '1771', '空调系统/冷(热)水机组/压缩式螺杆冷水机组', '1103', '输入功率', '数字', '1002', '千瓦', 'wD_inputgonglv');
+INSERT INTO `v_hydomc_classspec` VALUES (369, '1771', '空调系统/冷(热)水机组/压缩式螺杆冷水机组', '1121', '压缩机结构型式', '字母数字', '', '', 'wD_yasuojijiegouxingshi');
+INSERT INTO `v_hydomc_classspec` VALUES (370, '1771', '空调系统/冷(热)水机组/压缩式螺杆冷水机组', '1126', '制冷剂', '字母数字', '', '', 'refrigeranttype');
+INSERT INTO `v_hydomc_classspec` VALUES (371, '1771', '空调系统/冷(热)水机组/压缩式螺杆冷水机组', '1175', '额定COP', '数字', '', '', 'ratedcop');
+INSERT INTO `v_hydomc_classspec` VALUES (372, '1771', '空调系统/冷(热)水机组/压缩式螺杆冷水机组', '1018', '是否变频', '字母数字', '', '', 'wD_shifoubianpin');
+INSERT INTO `v_hydomc_classspec` VALUES (373, '1771', '空调系统/冷(热)水机组/压缩式螺杆冷水机组', '1047', '电流', '数字', '1015', '安', 'ratedi');
+INSERT INTO `v_hydomc_classspec` VALUES (374, '1771', '空调系统/冷(热)水机组/压缩式螺杆冷水机组', '1049', '电压', '数字', '1005', '伏', 'ratedu');
+INSERT INTO `v_hydomc_classspec` VALUES (375, '1771', '空调系统/冷(热)水机组/压缩式螺杆冷水机组', '1076', '冷却方式', '字母数字', '', '', 'wD_lengquefangshi');
+INSERT INTO `v_hydomc_classspec` VALUES (376, '1771', '空调系统/冷(热)水机组/压缩式螺杆冷水机组', '1075', '冷量', '数字', '1002', '千瓦', 'ratedcool');
+INSERT INTO `v_hydomc_classspec` VALUES (377, '1704', '空调系统/冷冻水泵', '1130', '转速', '数字', '1032', '转/分钟', 'wD_rpm');
+INSERT INTO `v_hydomc_classspec` VALUES (378, '1704', '空调系统/冷冻水泵', '1129', '重量', '数字', '1076', '公斤', 'wD_weight');
+INSERT INTO `v_hydomc_classspec` VALUES (379, '1704', '空调系统/冷冻水泵', '1109', '水泵安装形式', '字母数字', '', '', 'installtype');
+INSERT INTO `v_hydomc_classspec` VALUES (380, '1704', '空调系统/冷冻水泵', '1077', '流量', '数字', '1025', '立方米/小时', 'ratedflow');
+INSERT INTO `v_hydomc_classspec` VALUES (381, '1704', '空调系统/冷冻水泵', '1049', '电压', '数字', '1005', '伏', 'ratedu');
+INSERT INTO `v_hydomc_classspec` VALUES (382, '1704', '空调系统/冷冻水泵', '1046', '是否有变频设备', '字母数字', '', '', 'wD_shifoubianpinequip');
+INSERT INTO `v_hydomc_classspec` VALUES (383, '1704', '空调系统/冷冻水泵', '1006', '功率', '数字', '1002', '千瓦', 'ratedp');
+INSERT INTO `v_hydomc_classspec` VALUES (384, '1704', '空调系统/冷冻水泵', '1123', '扬程', '数字', '1008', '米', 'ratedhead');
+INSERT INTO `v_hydomc_classspec` VALUES (385, '1703', '空调系统/冷却水泵', '1006', '功率', '数字', '1002', '千瓦', 'ratedp');
+INSERT INTO `v_hydomc_classspec` VALUES (386, '1703', '空调系统/冷却水泵', '1130', '转速', '数字', '1032', '转/分钟', 'wD_rpm');
+INSERT INTO `v_hydomc_classspec` VALUES (387, '1703', '空调系统/冷却水泵', '1129', '重量', '数字', '1076', '公斤', 'wD_weight');
+INSERT INTO `v_hydomc_classspec` VALUES (388, '1703', '空调系统/冷却水泵', '1123', '扬程', '数字', '1008', '米', 'ratedhead');
+INSERT INTO `v_hydomc_classspec` VALUES (389, '1703', '空调系统/冷却水泵', '1109', '水泵安装形式', '字母数字', '', '', 'installtype');
+INSERT INTO `v_hydomc_classspec` VALUES (390, '1703', '空调系统/冷却水泵', '1046', '是否有变频设备', '字母数字', '', '', 'wD_shifoubianpinequip');
+INSERT INTO `v_hydomc_classspec` VALUES (391, '1703', '空调系统/冷却水泵', '1049', '电压', '数字', '1005', '伏', 'ratedu');
+INSERT INTO `v_hydomc_classspec` VALUES (392, '1703', '空调系统/冷却水泵', '1077', '流量', '数字', '1025', '立方米/小时', 'ratedflow');
+INSERT INTO `v_hydomc_classspec` VALUES (393, '1705', '空调系统/冷却塔', '1006', '功率', '数字', '1002', '千瓦', 'ratedp');
+INSERT INTO `v_hydomc_classspec` VALUES (394, '1705', '空调系统/冷却塔', '1045', '处理水量', '数字', '1025', '立方米/小时', 'ratedwaterflow');
+INSERT INTO `v_hydomc_classspec` VALUES (395, '1705', '空调系统/冷却塔', '1046', '是否有变频设备', '字母数字', '', '', 'wD_shifoubianpinequip');
+INSERT INTO `v_hydomc_classspec` VALUES (396, '1705', '空调系统/冷却塔', '1088', '频率', '数字', '1021', '赫兹', 'wD_FanWorkFreq');
+INSERT INTO `v_hydomc_classspec` VALUES (397, '1705', '空调系统/冷却塔', '1076', '冷却方式', '字母数字', '', '', 'wD_lengquefangshi');
+INSERT INTO `v_hydomc_classspec` VALUES (398, '1705', '空调系统/冷却塔', '1059', '风机余压', '数字', '1030', '帕', 'wD_fengjiyuya');
+INSERT INTO `v_hydomc_classspec` VALUES (399, '1444', '空调系统/热力板块/热力循环泵', '1077', '流量', '数字', '1025', '立方米/小时', 'ratedflow');
+INSERT INTO `v_hydomc_classspec` VALUES (400, '1444', '空调系统/热力板块/热力循环泵', '1046', '是否有变频设备', '字母数字', '', '', 'wD_shifoubianpinequip');
+INSERT INTO `v_hydomc_classspec` VALUES (401, '1444', '空调系统/热力板块/热力循环泵', '1006', '功率', '数字', '1002', '千瓦', 'ratedp');
+INSERT INTO `v_hydomc_classspec` VALUES (402, '1444', '空调系统/热力板块/热力循环泵', '1123', '扬程', '数字', '1008', '米', 'ratedhead');
+INSERT INTO `v_hydomc_classspec` VALUES (403, '1659', '消防水系统/喷淋泵', '1006', '功率', '数字', '1002', '千瓦', 'ratedp');
+INSERT INTO `v_hydomc_classspec` VALUES (404, '1659', '消防水系统/喷淋泵', '1049', '电压', '数字', '1005', '伏', 'ratedu');
+INSERT INTO `v_hydomc_classspec` VALUES (405, '1659', '消防水系统/喷淋泵', '1077', '流量', '数字', '1025', '立方米/小时', 'ratedhead');
+INSERT INTO `v_hydomc_classspec` VALUES (406, '1659', '消防水系统/喷淋泵', '1109', '水泵安装形式', '字母数字', '', '', 'installtype');
+INSERT INTO `v_hydomc_classspec` VALUES (407, '1659', '消防水系统/喷淋泵', '1123', '扬程', '数字', '1008', '米', 'ratedflow');
+INSERT INTO `v_hydomc_classspec` VALUES (408, '1659', '消防水系统/喷淋泵', '1130', '转速', '数字', '1032', '转/分钟', 'wD_rpm');
+INSERT INTO `v_hydomc_classspec` VALUES (409, '1659', '消防水系统/喷淋泵', '1129', '重量', '数字', '1001', '千克', 'wD_weight');
+INSERT INTO `v_hydomc_classspec` VALUES (410, '1908', '消防水系统/消火栓泵', '1077', '流量', '数字', '1025', '立方米/小时', 'ratedhead');
+INSERT INTO `v_hydomc_classspec` VALUES (411, '1908', '消防水系统/消火栓泵', '1006', '功率', '数字', '1002', '千瓦', 'ratedp');
+INSERT INTO `v_hydomc_classspec` VALUES (412, '1908', '消防水系统/消火栓泵', '1123', '扬程', '数字', '1008', '米', 'ratedflow');

+ 28 - 0
src/main/resources/sql/rwd/v_hydomc_classstructure.sql

@@ -0,0 +1,28 @@
+-- wd分类表
+CREATE TABLE `v_hydomc_classstructure` (
+  `CLASSSTRUCTUREID` varchar(40) NOT NULL COMMENT '设备分类id',
+  `CLASSQC` varchar(40) NOT NULL COMMENT '设备分类名称',
+  `JLDW` varchar(40) DEFAULT NULL COMMENT '设备单位编码',
+  `JLDWDESC` varchar(40) NOT NULL COMMENT '设备单位名称',
+  PRIMARY KEY (`CLASSSTRUCTUREID`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='万达设备分类V_HYDOMC_CLASSSTRUCTURE';
+
+-- 初始化信息
+INSERT INTO `v_hydomc_classstructure` VALUES ('1444', '空调系统/热力板块/热力循环泵', '1043', '台');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1502', '电梯系统/直梯/客梯', '1004', '部');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1503', '电梯系统/直梯/货梯', '1004', '部');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1504', '电梯系统/直梯/观光电梯', '1004', '部');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1506', '电梯系统/扶梯/自动扶梯', '1004', '部');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1507', '电梯系统/扶梯/人行步道', '1004', '部');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1514', '供配电系统/高压配电柜/变压器', '1043', '台');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1639', '给排水/给水泵', '1043', '台');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1659', '消防水系统/喷淋泵', '1043', '台');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1700', '空调系统/冷(热)水机组/压缩式离心冷水机组', '1043', '台');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1702', '空调系统/锅炉', '1043', '台');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1703', '空调系统/冷却水泵', '1043', '台');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1704', '空调系统/冷冻水泵', '1043', '台');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1705', '空调系统/冷却塔', '1043', '台');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1712', '空调系统/空调末端/新风机组', '1043', '台');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1771', '空调系统/冷(热)水机组/压缩式螺杆冷水机组', '1043', '台');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1908', '消防水系统/消火栓泵', '1043', '台');
+INSERT INTO `v_hydomc_classstructure` VALUES ('1920', '空调系统/空调末端/组合式空调机组', '1043', '台');

+ 12 - 0
src/main/resources/sql/rwd/v_hydomc_relation_projectid.sql

@@ -0,0 +1,12 @@
+-- 万达中台广场id转换表
+CREATE TABLE `v_hydomc_relation_projectid` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `project_id` varchar(40) DEFAULT NULL COMMENT '博锐中台项目(广场)id',
+  `wd_project_id` varchar(40) DEFAULT NULL COMMENT '万达广场id',
+  `remark` varchar(255) DEFAULT NULL,
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
+
+-- 初始化信息
+INSERT INTO `v_hydomc_relation_projectid` VALUES (1, 'Pj4403070003', '1003090', '龙岗万达');
+INSERT INTO `v_hydomc_relation_projectid` VALUES (2, 'Pj4311030001', '1002697', '永州万达');

+ 35 - 0
src/main/resources/sql/rwd/v_hydomc_rwd_relation.sql

@@ -0,0 +1,35 @@
+-- 关系表,主驱动表
+CREATE TABLE `v_hydomc_rwd_relation` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `CLASSSTRUCTUREID` varchar(80) NOT NULL COMMENT '设备分类id',
+  `class_code` varchar(40) NOT NULL COMMENT '类型编码',
+  `CLASSQC` varchar(40) DEFAULT NULL COMMENT '设备分类名称',
+  `wd_classifcation_code` varchar(40) DEFAULT NULL COMMENT '万达字典设备编码',
+  `huiyun_device_name` varchar(40) DEFAULT NULL COMMENT '慧云设备类型名称',
+  `local_id` varchar(40) DEFAULT NULL COMMENT '构件分类编码(为空表示不需要二级判断)',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='万达-中台中间关系表';
+
+-- 初始化数据
+INSERT INTO `v_hydomc_rwd_relation` VALUES (139, '1639', 'WSDWPP', '给水泵', 'DWP', '生活给水泵', '');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (140, '1444', 'ACCHHP', '空调系统/热力板块/热力循环泵', 'HWP', '热力循环水泵', '');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (141, '1702', 'ACCHCB', '锅炉', 'GLRMGL', '燃煤锅炉', '');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (142, '1702', 'ACCHGB', '锅炉', 'GSB', '燃气锅炉', '');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (143, '1702', 'ACCHGB', '锅炉', 'GSB', '燃气锅炉', '');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (144, '1702', 'ACCHBF', '锅炉', 'GLSWZRLGL', '生物质燃料锅炉', '');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (145, '1702', 'ACCHEB', '锅炉', 'GLDRGL', '电热锅炉', '');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (146, '1771', 'ACCCSC', '压缩式螺杆冷水机组', 'CHUSC', '螺杆式冷水机组', '');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (147, '1700', 'ACCCCC', '压缩式离心冷水机组', 'CHUCC', '离心式冷水机组', '');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (148, '1705', 'ACCCOT', '冷却塔', 'CTW', '冷却塔', '');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (149, '1704', 'ACCCCP', '冷冻水泵', 'CHWP', '冷冻水泵', '');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (150, '1703', 'ACCCOP', '冷却水泵', 'CWP', '冷却水泵', '');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (151, '1920', 'ACATAH', '组合式空调机组', 'AHU', '组合式空调机组', '');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (152, '1712', 'ACATFU', '新风机组', 'FAU', '新风机组', '');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (153, '1514', 'SETDTF', '变压器', 'TFM', '变压器', '');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (154, '1503', 'SEELEL', '货梯', 'LIFT', '直梯', '20.50.10.10');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (155, '1502', 'SEELEL', '客梯', 'LIFT', '直梯', '20.50.10.20');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (156, '1504', 'SEELEL', '观光电梯', 'LIFT', '直梯', '20.50.10.30');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (157, '1506', 'SEELES', '自动扶梯', 'ESCLT', '扶梯', '20.50.50');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (158, '1507', 'SEELES', '人行步道', 'ESCLT', '扶梯', '20.50.60');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (159, '1659', 'FFFSSP', '喷淋泵', 'GLPLJYB', '喷淋加压泵', '');
+INSERT INTO `v_hydomc_rwd_relation` VALUES (160, '1908', 'FFFSPM', '消火栓泵', 'GLXHSJYB', '消火栓稳压泵', '');

+ 36 - 0
src/main/resources/sql/wd/hydomc_asset.sql

@@ -0,0 +1,36 @@
+-- 同步万达数据主表,设备信息主表HYDOMC_ASSET
+CREATE TABLE `hydomc_asset` (
+  `SBYBM` varchar(80) NOT NULL COMMENT '设备编码,主键  无其他主键可采用设备编码为主键,但要确保唯一(工程信息化设备原码)',
+  `SITEID` varchar(40) NOT NULL COMMENT '广场id,项目唯一id,可采用租赁系统广场id,同步后不可更改',
+  `description` varchar(400) DEFAULT NULL COMMENT '设备名称',
+  `wzqy` varchar(100) DEFAULT NULL COMMENT '设备安装位置,详细设备安装位置,格式:楼体-楼层-区域',
+  `fwqy` varchar(100) DEFAULT NULL COMMENT '设备服务区域,设备/系统服务范围',
+  `sbxh` varchar(100) DEFAULT NULL COMMENT '设备型号,厂商设备型号',
+  `CLASSSTRUCTUREID` varchar(40) DEFAULT NULL COMMENT '设备分类,对接设备分类id,同步后不可更改',
+  `STATUS` varchar(40) DEFAULT NULL COMMENT '设备状态,运行中/报废 默认都为运行中',
+  `sbxhh` varchar(40) DEFAULT NULL COMMENT '设备序号,同类设备的序号,即第几台设备:第几台电梯',
+  `CJSBXH` varchar(100) DEFAULT NULL COMMENT '厂家设备序列号,厂家编码',
+  `MANUFACTURER` varchar(40) DEFAULT NULL COMMENT '生产商,生产商公司供方管理系统编码code',
+  `VENDOR` varchar(40) DEFAULT NULL COMMENT '供应商,供应商公司供方管理系统编码code',
+  `FWS` varchar(40) DEFAULT NULL COMMENT '服务商,服务商公司供方管理系统编码code',
+  `PURCHASEPRICE` double(10,2) DEFAULT NULL COMMENT '采购金额,填写人民币元',
+  `ZJSYNX` double(10,2) DEFAULT NULL COMMENT '折旧/使用年限,按年填写如3年半则填写 3.5',
+  `SCRQ` datetime DEFAULT NULL COMMENT '生产日期/出厂日期 年/月/日',
+  `CGRQ` datetime DEFAULT NULL COMMENT '采购日期',
+  `AZDATE` datetime DEFAULT NULL COMMENT '安装日期',
+  `INSTALLDATE` datetime DEFAULT NULL COMMENT '启用日期',
+  `ZBKSRQ` datetime DEFAULT NULL COMMENT '质保开始日期',
+  `ZBJSRQ` datetime DEFAULT NULL COMMENT '质保结束日期',
+  `ZXZQ` double(10,0) DEFAULT NULL COMMENT '中修周期,单位为月',
+  `DXZQ` double(10,0) DEFAULT NULL COMMENT '大修周期,单位为月',
+  `WYLX` varchar(100) DEFAULT NULL COMMENT '物业类型 自持/销售/合作方',
+  `SBGLGS` varchar(40) DEFAULT NULL COMMENT '设备管理归属,商管/百货/大歌星/超市/影院/大酒楼/其他',
+  `HYSBBM` varchar(40) DEFAULT NULL COMMENT '慧云设备编码',
+  `SFHYSY` varchar(40) DEFAULT NULL COMMENT '是否慧云使用,是/否    缺省为 是',
+  `SFZLD` varchar(100) DEFAULT NULL COMMENT '是否是主力店 缺省为 否',
+  `MARK` varchar(100) DEFAULT NULL COMMENT '备注',
+  `CTX` varchar(100) DEFAULT NULL COMMENT '变更人员的万信账号',
+  `DATASTATUS` varchar(40) DEFAULT NULL COMMENT '数据状态,update/delete 当数据状态为delete时,设备状态需改为报废',
+  `CHANGEDATE` datetime DEFAULT NULL COMMENT '数据更新时间 增量字段',
+  PRIMARY KEY (`SBYBM`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='设备信息主表HYDOMC_ASSET';

+ 18 - 0
src/main/resources/sql/wd/hydomc_assetspec.sql

@@ -0,0 +1,18 @@
+-- 同步万达数据设备信息表,设备信息主表HYDOMC_ASSET
+CREATE TABLE `hydomc_assetspec` (
+  `ASSETSPECID` varchar(80) NOT NULL COMMENT '主键',
+  `SBYBM` varchar(80) NOT NULL COMMENT '设备编码,主键  无其他主键可采用设备编码为主键,但要确保唯一(工程信息化设备原码)',
+  `SITEID` varchar(40) NOT NULL COMMENT '广场id,项目唯一id,可采用租赁系统广场id,同步后不可更改',
+  `CLASSSTRUCTUREID` varchar(40) DEFAULT NULL COMMENT '设备分类,对接设备分类id,同步后不可更改',
+  `CLASSQC` varchar(40) DEFAULT NULL COMMENT '设备分类名称',
+  `ASSETATTRID` varchar(40) DEFAULT NULL COMMENT '设备参数id',
+  `CSDESC` varchar(100) DEFAULT NULL COMMENT '设备参数名称',
+  `DATATYPE` varchar(40) DEFAULT NULL COMMENT '设备参数类型',
+  `MEASUREUNITID` varchar(40) DEFAULT NULL COMMENT '设备参数单位编码',
+  `CSJLDW` varchar(100) DEFAULT NULL COMMENT '设备参数单位名称',
+  `NUMVALUE` double(30,2) DEFAULT NULL COMMENT '设备参数数字值',
+  `ALNVALUE` varchar(300) DEFAULT NULL COMMENT '设备参数文本值',
+  `DATASTATUS` varchar(40) DEFAULT NULL COMMENT '数据状态',
+  `CHANGEDATE` datetime DEFAULT NULL COMMENT '数据更新时间',
+  PRIMARY KEY (`ASSETSPECID`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='设备信息主表HYDOMC_ASSET';