Bladeren bron

故障图谱项目

xuYongJian 2 jaren geleden
commit
555a38dbff
46 gewijzigde bestanden met toevoegingen van 2496 en 0 verwijderingen
  1. 40 0
      .gitignore
  2. 317 0
      insert_neo4j/pom.xml
  3. 180 0
      insert_neo4j/src/main/java/bean/InputValue.java
  4. 106 0
      insert_neo4j/src/main/java/cdc/NeoCdc.java
  5. 69 0
      insert_neo4j/src/main/java/cdc/NeoCsv.java
  6. 121 0
      insert_neo4j/src/main/resources/log4j.properties
  7. 18 0
      insert_neo4j/src/main/resources/新增ups关系.csv
  8. 12 0
      insert_neo4j/src/test/java/Test.java
  9. 131 0
      neo4j_metro/pom.xml
  10. 15 0
      neo4j_metro/src/main/java/neo4j/Neo4jDemoApplication.java
  11. 148 0
      neo4j_metro/src/main/java/neo4j/bean/InputValue.java
  12. 22 0
      neo4j_metro/src/main/java/neo4j/bean/RuleResult.java
  13. 160 0
      neo4j_metro/src/main/java/neo4j/controller/MetroController.java
  14. 173 0
      neo4j_metro/src/main/java/neo4j/controller/dev/EquipmentController.java
  15. 31 0
      neo4j_metro/src/main/java/neo4j/model/dev/Equipment.java
  16. 31 0
      neo4j_metro/src/main/java/neo4j/model/dev/Location.java
  17. 31 0
      neo4j_metro/src/main/java/neo4j/model/dev/Operation.java
  18. 31 0
      neo4j_metro/src/main/java/neo4j/model/dev/Phenomenon.java
  19. 33 0
      neo4j_metro/src/main/java/neo4j/model/dev/Reason.java
  20. 27 0
      neo4j_metro/src/main/java/neo4j/model/test/Device.java
  21. 27 0
      neo4j_metro/src/main/java/neo4j/model/test/Feature.java
  22. 27 0
      neo4j_metro/src/main/java/neo4j/model/test/MetroSystem.java
  23. 36 0
      neo4j_metro/src/main/java/neo4j/relation/dev/EquLoc.java
  24. 36 0
      neo4j_metro/src/main/java/neo4j/relation/dev/LocRea.java
  25. 36 0
      neo4j_metro/src/main/java/neo4j/relation/dev/OpeRea.java
  26. 36 0
      neo4j_metro/src/main/java/neo4j/relation/dev/PheOpe.java
  27. 37 0
      neo4j_metro/src/main/java/neo4j/relation/test/DeviceFeature.java
  28. 30 0
      neo4j_metro/src/main/java/neo4j/relation/test/FeatureInfoGroupByDevice.java
  29. 29 0
      neo4j_metro/src/main/java/neo4j/relation/test/FeatureSystem.java
  30. 36 0
      neo4j_metro/src/main/java/neo4j/relation/test/SystemDevice.java
  31. 29 0
      neo4j_metro/src/main/java/neo4j/repository/dev/EquLocRepository.java
  32. 22 0
      neo4j_metro/src/main/java/neo4j/repository/dev/EquipmentRepository.java
  33. 30 0
      neo4j_metro/src/main/java/neo4j/repository/dev/LocReaRepository.java
  34. 22 0
      neo4j_metro/src/main/java/neo4j/repository/dev/LocationRepository.java
  35. 28 0
      neo4j_metro/src/main/java/neo4j/repository/dev/OpeReaRepository.java
  36. 30 0
      neo4j_metro/src/main/java/neo4j/repository/dev/OperationRepository.java
  37. 28 0
      neo4j_metro/src/main/java/neo4j/repository/dev/PheOpeRepository.java
  38. 28 0
      neo4j_metro/src/main/java/neo4j/repository/dev/PhenomenonRepository.java
  39. 28 0
      neo4j_metro/src/main/java/neo4j/repository/dev/ReasonRepository.java
  40. 29 0
      neo4j_metro/src/main/java/neo4j/repository/test/DeviceFeatureRepository.java
  41. 41 0
      neo4j_metro/src/main/java/neo4j/repository/test/DeviceRepository.java
  42. 32 0
      neo4j_metro/src/main/java/neo4j/repository/test/FeatureRepository.java
  43. 21 0
      neo4j_metro/src/main/java/neo4j/repository/test/SystemDeviceRepository.java
  44. 35 0
      neo4j_metro/src/main/java/neo4j/repository/test/SystemRepository.java
  45. 4 0
      neo4j_metro/src/main/resources/application.properties
  46. 63 0
      pom.xml

+ 40 - 0
.gitignore

@@ -0,0 +1,40 @@
+# Compiled class file
+*.class
+
+# Eclipse
+.project
+.classpath
+.settings/
+
+# Intellij
+*.ipr
+*.iml
+*.iws
+.idea/
+
+# Maven
+target/
+
+# Gradle
+build
+.gradle
+
+# Log file
+*.log
+log/
+
+# out
+**/out/
+
+# Mac
+.DS_Store
+
+# others
+*.jar
+*.war
+*.zip
+*.tar
+*.tar.gz
+*.pid
+*.orig
+temp/

+ 317 - 0
insert_neo4j/pom.xml

@@ -0,0 +1,317 @@
+<?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">
+    <parent>
+        <artifactId>sunwin_metro</artifactId>
+        <groupId>org.sunwin</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>flink_1.20</artifactId>
+    <properties>
+        <skipTests>true</skipTests>
+        <flink.version>1.12.0</flink.version>
+        <java.version>1.8</java.version>
+        <scala.binary.version>2.12</scala.binary.version>
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
+        <cdh.version>cdh5.16.2</cdh.version>
+        <hbase.version>1.2.0</hbase.version>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <zookeeper.version>3.4.8</zookeeper.version>
+        <lombok.version>1.18.12</lombok.version>
+        <junit.jupiter.version>5.4.1</junit.jupiter.version>
+        <kudu.version>1.14.0</kudu.version>
+        <flink-function.verion>1.0-SNAPSHOT</flink-function.verion>
+        <mockito.version>1.10.19</mockito.version>
+        <log4j2.version>2.13.3</log4j2.version>
+        <caffeine.version>2.8.8</caffeine.version>
+        <drools.version>7.4.1.Final</drools.version>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>com.ejlchina</groupId>
+            <artifactId>okhttps-gson</artifactId>
+            <version>3.1.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-cep_${scala.binary.version}</artifactId>
+            <version>${flink.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-shaded-hadoop-2-uber</artifactId>
+            <version>2.8.3-10.0</version>
+        </dependency>
+
+
+
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
+            <version>${flink.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-runtime-web_${scala.binary.version}</artifactId>
+            <version>${flink.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-core</artifactId>
+            <version>${flink.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-statebackend-rocksdb_${scala.binary.version}</artifactId>
+            <version>${flink.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-clients_${scala.binary.version}</artifactId>
+            <version>${flink.version}</version>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.ahocorasick</groupId>
+            <artifactId>ahocorasick</artifactId>
+            <version>0.4.0</version>
+        </dependency>
+
+
+        <dependency>
+            <groupId>joda-time</groupId>
+            <artifactId>joda-time</artifactId>
+            <version>2.3</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-core</artifactId>
+            <version>2.6.7</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-recipes</artifactId>
+            <version>2.13.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.kudu</groupId>
+            <artifactId>kudu-client</artifactId>
+            <version>${kudu.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.kudu</groupId>
+            <artifactId>kudu-test-utils</artifactId>
+            <version>${kudu.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.ben-manes.caffeine</groupId>
+            <artifactId>caffeine</artifactId>
+            <version>${caffeine.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <version>${mockito.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>${lombok.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>8.0.22</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-csv</artifactId>
+            <version>${flink.version}</version>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-table-api-java-bridge_${scala.binary.version}</artifactId>
+            <version>${flink.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-table-planner-blink_${scala.binary.version}</artifactId>
+            <version>${flink.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-table-common</artifactId>
+            <version>${flink.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-json</artifactId>
+            <version>${flink.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba.ververica</groupId>
+            <artifactId>flink-connector-mysql-cdc</artifactId>
+            <version>1.2.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-connector-jdbc_${scala.binary.version}</artifactId>
+            <version>${flink.version}</version>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-migrationsupport</artifactId>
+            <version>${junit.jupiter.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+            <version>${log4j2.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
+            <version>${log4j2.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-slf4j-impl</artifactId>
+            <version>${log4j2.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+
+        <dependency>
+            <artifactId>flink-connector-kudu_2.11</artifactId>
+            <groupId>org.colloh.kudu.connector</groupId>
+            <version>1.2.1</version>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.apache.hive</groupId>
+            <artifactId>hive-exec</artifactId>
+            <version>3.1.2</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>log4j-core</artifactId>
+                    <groupId>org.apache.logging.log4j</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>log4j-1.2-api</artifactId>
+                    <groupId>org.apache.logging.log4j</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>log4j-slf4j-impl</artifactId>
+                    <groupId>org.apache.logging.log4j</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>log4j-web</artifactId>
+                    <groupId>org.apache.logging.log4j</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.antlr</groupId>
+            <artifactId>ST4</artifactId>
+            <version>4.0.8</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <!-- mysql Github 连接工具 -->
+        <dependency>
+            <groupId>pro.husk</groupId>
+            <artifactId>mysql</artifactId>
+            <version>1.4.1-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <!-- 自动生成数据库文档的插件 对象数据库中所有表 -->
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>cn.smallbun.screw</groupId>
+                <artifactId>screw-maven-plugin</artifactId>
+                <!-- 这里的版本号可以用最新的,我现在1.0.4就是最新的 -->
+                <version>1.0.5</version>
+                <dependencies>
+                    <!-- HikariCP -->
+                    <dependency>
+                        <groupId>com.zaxxer</groupId>
+                        <artifactId>HikariCP</artifactId>
+                        <version>3.4.5</version>
+                    </dependency>
+                    <!--mysql driver-->
+                    <dependency>
+                        <groupId>mysql</groupId>
+                        <artifactId>mysql-connector-java</artifactId>
+                        <version>8.0.20</version>
+                    </dependency>
+                </dependencies>
+                <configuration>
+                    <!--username-->
+                    <username>root</username>
+                    <!--password-->
+                    <password>root</password>
+                    <!--driver-->
+                    <driverClassName>com.mysql.cj.jdbc.Driver</driverClassName>
+                    <!--jdbc url-->
+                    <jdbcUrl>jdbc:mysql://192.168.20.61:3306/swbd?characterEncoding=utf-8</jdbcUrl>
+                    <!--生成文件类型,有HTML	WORD MD-->
+                    <fileType>WORD</fileType>
+                    <!--打开文件输出目录-->
+                    <openOutputDir>false</openOutputDir>
+                    <!--生成模板-->
+                    <produceType>freemarker</produceType>
+                    <!--文档名称 为空时:将采用[数据库名称-描述-版本号]作为文档名称-->
+                    <fileName>测试文档名称</fileName>
+                    <!--描述-->
+                    <description>数据库文档生成</description>
+                    <!--版本-->
+                    <version>${project.version}</version>
+                    <!--标题-->
+                    <title>数据库文档</title>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 180 - 0
insert_neo4j/src/main/java/bean/InputValue.java

@@ -0,0 +1,180 @@
+package bean;
+
+import com.alibaba.fastjson.JSON;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.Serializable;
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @program: sunwin_metro
+ * @description: 解析输入参数bean
+ * @author: xuYJ
+ * @create: 2021-06-22 10:31
+ **/
+public class InputValue implements Serializable {
+    /**
+     * 故障现象
+     */
+    private String phenomenonName;
+    /**
+     * 故障操作
+     */
+    private String operationName;
+    /**
+     * 发现故障原因
+     */
+    private String reasonName;
+    /**
+     * 故障解决方式
+     */
+    private String reasonSolve;
+    /**
+     * 故障发生的部位
+     */
+    private String locationName;
+    /**
+     * 故障发生的部位 英文简称
+     */
+    private String locationAbbreviation;
+    /**
+     * 故障系统
+     */
+    private String equipmentName;
+    /**
+     * 故障系统 英文简称
+     */
+    private String equipmentAbbreviation;
+
+    public InputValue(String phenomenonName, String operationName, String reasonName, String reasonSolve, String locationName, String locationAbbreviation, String equipmentName, String equipmentAbbreviation) {
+        this.phenomenonName = phenomenonName;
+        this.operationName = operationName;
+        this.reasonName = reasonName;
+        this.reasonSolve = reasonSolve;
+        this.locationName = locationName;
+        this.locationAbbreviation = locationAbbreviation;
+        this.equipmentName = equipmentName;
+        this.equipmentAbbreviation = equipmentAbbreviation;
+    }
+
+    public InputValue() {
+    }
+
+    public String getPhenomenonName() {
+        return phenomenonName;
+    }
+
+    public void setPhenomenonName(String phenomenonName) {
+        this.phenomenonName = phenomenonName;
+    }
+
+    public String getOperationName() {
+        return operationName;
+    }
+
+    public void setOperationName(String operationName) {
+        this.operationName = operationName;
+    }
+
+    public String getReasonName() {
+        return reasonName;
+    }
+
+    public void setReasonName(String reasonName) {
+        this.reasonName = reasonName;
+    }
+
+    public String getReasonSolve() {
+        return reasonSolve;
+    }
+
+    public void setReasonSolve(String reasonSolve) {
+        this.reasonSolve = reasonSolve;
+    }
+
+    public String getLocationName() {
+        return locationName;
+    }
+
+    public void setLocationName(String locationName) {
+        this.locationName = locationName;
+    }
+
+    public String getLocationAbbreviation() {
+        return locationAbbreviation;
+    }
+
+    public void setLocationAbbreviation(String locationAbbreviation) {
+        this.locationAbbreviation = locationAbbreviation;
+    }
+
+    public String getEquipmentName() {
+        return equipmentName;
+    }
+
+    public void setEquipmentName(String equipmentName) {
+        this.equipmentName = equipmentName;
+    }
+
+    public String getEquipmentAbbreviation() {
+        return equipmentAbbreviation;
+    }
+
+    public void setEquipmentAbbreviation(String equipmentAbbreviation) {
+        this.equipmentAbbreviation = equipmentAbbreviation;
+    }
+
+    @Override
+    public String toString() {
+        return "InputValue{" +
+                "phenomenonName='" + phenomenonName + '\'' +
+                ", operationName='" + operationName + '\'' +
+                ", reasonName='" + reasonName + '\'' +
+                ", reasonSolve='" + reasonSolve + '\'' +
+                ", locationName='" + locationName + '\'' +
+                ", locationAbbreviation='" + locationAbbreviation + '\'' +
+                ", equipmentName='" + equipmentName + '\'' +
+                ", equipmentAbbreviation='" + equipmentAbbreviation + '\'' +
+                '}';
+    }
+
+    public static void main(String[] args) throws IllegalAccessException {
+        InputValue inputValue = new InputValue(
+                "         停电时,逆变不工作       ",
+                "       打开机盖,将其取出充电,用一段时间后无故障           ",
+                "蓄电池电压过低",
+                "拆下蓄电池,先进行均衡充电(所有蓄电池并联进行充电) ,若仍不成功,则只有更换蓄电池",
+                "蓄电池",
+                "battery",
+                "不间断应急电源",
+                "ups"
+        );
+        System.out.println(JSON.toJSONString(inputValue));
+        objectToTrim(inputValue);
+        System.out.println(JSON.toJSONString(inputValue));
+    }
+    public static void objectToTrim(Object obj) throws IllegalAccessException {
+        Map<String,String> map = new HashMap<>(16);
+        Field[] declaredFields = obj.getClass().getDeclaredFields();
+        for (Field field:declaredFields){
+            String type = field.getType().getCanonicalName();
+            if (StringUtils.equals("java.lang.String", type)){
+                field.setAccessible(true);
+                Object object = field.get(obj);
+                if (object != null) {
+                    String trim = object.toString().replace(" ","");
+                    map.put(field.getName(),trim);
+                }
+            }
+        }
+        for (Field field:declaredFields){
+            if (map.get(field.getName())!=null){
+                String s = map.get(field.getName());
+                field.setAccessible(true);
+                field.set(obj,s);
+            }
+        }
+    }
+}

+ 106 - 0
insert_neo4j/src/main/java/cdc/NeoCdc.java

@@ -0,0 +1,106 @@
+package cdc;
+
+import bean.InputValue;
+import com.alibaba.fastjson.JSON;
+import com.ejlchina.okhttps.GsonMsgConvertor;
+import com.ejlchina.okhttps.HTTP;
+import org.apache.flink.api.common.functions.RichMapFunction;
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.streaming.api.datastream.DataStream;
+import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
+import org.apache.flink.table.api.EnvironmentSettings;
+import org.apache.flink.table.api.Table;
+import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;
+import org.apache.flink.types.Row;
+import java.util.HashMap;
+
+/**
+ * @program: sunwin_metro
+ * @description: 根据mysql cdc 同步 mysql数据库中的表信息 构建neo4j图谱
+ * @author: xuYJ
+ * @create: 2021-06-23 09:20
+ **/
+public class NeoCdc {
+    public static void main(String[] args) throws Exception {
+        EnvironmentSettings build = EnvironmentSettings.newInstance()
+                .useBlinkPlanner()
+                .inStreamingMode()
+                .build();
+
+        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
+        env.setParallelism(1);
+        StreamTableEnvironment tableEnv = StreamTableEnvironment.create(env, build);
+        //源表用来同步mysql表
+        String source =
+                "CREATE TABLE failure_binlog (" +
+                        "   phenomenon_name STRING ," +
+                        "   operation_name STRING," +
+                        "   reason_name STRING," +
+                        "   reason_solve STRING," +
+                        "   location_name STRING," +
+                        "   location_abbreviation STRING," +
+                        "   equipment_name STRING," +
+                        "   equipment_abbreviation STRING" +
+                        ") WITH (" +
+                        "'connector' = 'mysql-cdc'," +
+                        "'hostname' = '192.168.20.61'," +
+                        "'port' = '3306'," +
+                        "'username' = 'root'," +
+                        "'password' = 'root'," +
+                        "'database-name' = 'URTDB'," +
+                        "'table-name' = 'metro_failure'" +
+                        ")";
+        tableEnv.executeSql(source);
+        Table testSink = tableEnv.from("failure_binlog");
+        //用 Row 对象接受mysql新增/更新/删除 数据
+        DataStream<Tuple2<Boolean, Row>> stream = tableEnv.toRetractStream(testSink, Row.class);
+        stream.map(new RichMapFunction<Tuple2<Boolean, Row>, String>() {
+            HTTP http;
+            long l;
+            @Override
+            public void open(Configuration parameters) throws Exception {
+                super.open(parameters);
+                http = HTTP.builder()
+                        .baseUrl("http://localhost:8080")
+                        .addMsgConvertor(new GsonMsgConvertor())
+                        .build();
+                l = System.currentTimeMillis();
+            }
+
+            @Override
+            public String map(Tuple2<Boolean, Row> tuple2) throws Exception {
+                if(tuple2.f0){
+                    if(!"INSERT".equals(tuple2.f1.getKind().toString())){
+                        return  "该数据库操作为更新操作,暂时不处理: "+tuple2.toString();
+                    }else {
+                   //row 转化成 bean
+                    InputValue inputValue = new InputValue(
+                            String.valueOf(tuple2.f1.getField(0)),
+                            String.valueOf(tuple2.f1.getField(1)),
+                            String.valueOf(tuple2.f1.getField(2)),
+                            String.valueOf(tuple2.f1.getField(3)),
+                            String.valueOf(tuple2.f1.getField(4)),
+                            String.valueOf(tuple2.f1.getField(5)),
+                            String.valueOf(tuple2.f1.getField(6)),
+                            String.valueOf(tuple2.f1.getField(7)));
+                    InputValue.objectToTrim(inputValue);
+                    HashMap<String, String> param = new HashMap<>(16);
+                    param.put("Content-Type","application/json;charset=UTF-8");
+                        return http.sync("/rest/v1.0.1/database/insertRes")
+                                .addHeader(param)
+                                .bodyType("json")
+                                //设置请求体json格式
+                                .setBodyPara(JSON.toJSONString(inputValue))
+                                .post()
+                                .getBody()
+                                .toString();
+                    }
+                }else {
+                    return "该数据库操作为删除操作,暂时不处理: "+tuple2.toString();
+                }
+            }
+        }).print();
+        env.execute("cdc");
+    }
+}

+ 69 - 0
insert_neo4j/src/main/java/cdc/NeoCsv.java

@@ -0,0 +1,69 @@
+package cdc;
+
+import bean.InputValue;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.chinaway.http.client.HttpClientResponse;
+import com.chinaway.http.client.model.Response;
+import com.ejlchina.okhttps.GsonMsgConvertor;
+import com.ejlchina.okhttps.HTTP;
+import org.apache.flink.api.common.functions.RichMapFunction;
+import org.apache.flink.api.java.ExecutionEnvironment;
+import org.apache.flink.api.java.io.CsvReader;
+import org.apache.flink.api.java.operators.DataSource;
+import org.apache.flink.configuration.Configuration;
+
+import java.util.HashMap;
+
+/**
+ * @program: sunwin_metro
+ * @description: 从csv读取故障列表输出到neo4j 构建neo4j图谱
+ * @author: xuYJ
+ * @create: 2021-06-23 09:20
+ **/
+public class NeoCsv {
+    public static void main(String[] args) throws Exception {
+        ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+        env.setParallelism(1);
+        DataSource<InputValue> source = env.readCsvFile("C:\\Users\\daoda\\Desktop\\地铁项目\\新增ups关系.csv")
+                .ignoreFirstLine()
+                .pojoType(InputValue.class, "phenomenonName", "operationName", "reasonName", "reasonSolve", "locationName", "locationAbbreviation", "equipmentName", "equipmentAbbreviation");
+        source.map(new RichMapFunction<InputValue, String>() {
+            HTTP http;
+            long l;
+
+            @Override
+            public void open(Configuration parameters) throws Exception {
+                super.open(parameters);
+                http = HTTP.builder()
+                        .baseUrl("http://localhost:8080")
+                        .addMsgConvertor(new GsonMsgConvertor())
+                        .build();
+                l = System.currentTimeMillis();
+            }
+
+            @Override
+            public String map(InputValue inputValue) throws Exception {
+                InputValue.objectToTrim(inputValue);
+                HashMap<String, String> param = new HashMap<>(16);
+                param.put("Content-Type", "application/json;charset=UTF-8");
+                //同步
+                return http.sync("/rest/v1.0.1/database/insertRes")
+                        .addHeader(param)
+                        .bodyType("json")
+                        //设置请求体json格式
+                        .setBodyPara(JSON.toJSONString(inputValue))
+                        .post()
+                        .getBody()
+                        .toString();
+
+            }
+
+            @Override
+            public void close() throws Exception {
+                System.out.println("花费时间 = " + (System.currentTimeMillis() - l));
+                super.close();
+            }
+        }).print();
+    }
+}

+ 121 - 0
insert_neo4j/src/main/resources/log4j.properties

@@ -0,0 +1,121 @@
+log4j.rootLogger=INFO,CONSOLE
+#DEBUG,CONSOLE,FILE,ROLLING_FILE,MAIL,DATABASE
+#子log日志是否传输到父log内
+log4j.addivity.org.apache=false
+#log4j.logger.org.apache.flink=INFO
+###################
+# 控制台(测试环境)
+###################
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.Threshold=INFO
+log4j.appender.CONSOLE.Target=System.out
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} -%-10p -%m  - %c -%-4r - [%t] %c %x%n
+#log4j.appender.CONSOLE.layout.ConversionPattern=[start]%d{DATE}[DATE]%n%p[PRIORITY]%n%x[NDC]%n%t[THREAD] n%c[CATEGORY]%n%m[MESSAGE]%n%n
+
+
+###################
+# 不滚动。默认生成一个日志文件
+###################
+log4j.logger.akka=INFO
+log4j.logger.org.apache.kafka=INFO
+log4j.logger.org.apache.hadoop=INFO
+log4j.logger.org.apache.zookeeper=INFO
+# Log all infos in the given file
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.file=${log.file}
+log4j.appender.file.append=true
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} -%-10p -%m  - %c -%-4r - [%t] %c %x%n
+# Suppress the irrelevant (wrong) warnings from the Netty channel handler
+#log4j.logger.org.apache.flink.shaded.akka.org.jboss.netty.channel.DefaultChannelPipeline=ERROR,file
+
+########################
+# 按照日志大小滚动
+########################
+log4j.appender.ROLLING_FILE=org.apache.log4j.RollingFileAppender
+log4j.appender.ROLLING_FILE.Threshold=INFO
+#集群存放地址
+log4j.appender.ROLLING_FILE.File=${log.file}
+#本地存放地址
+#log4j.appender.ROLLING_FILE.File=./logs/${log4j.type}/info.log
+log4j.appender.ROLLING_FILE.Append=true
+log4j.appender.ROLLING_FILE.MaxFileSize=10KB
+log4j.appender.ROLLING_FILE.MaxBackupIndex=1
+log4j.appender.ROLLING_FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.ROLLING_FILE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} -%-10p -%m  - %c -%-4r - [%t] %c %x%n
+
+########################
+# 按照时间滚动
+########################
+#每一天产生1个日志文件
+log4j.appender.DailyRolling=org.apache.log4j.DailyRollingFileAppender
+#定义日志存放路径
+log4j.appender.DailyRolling.File=${log.file}
+#日志文件是否追加
+log4j.appender.DailyRolling.Append=true
+#定义的时间格式,如果时间定义到分钟(mm)就是每分钟生成一个日志文件,而这里定义的这个格式就是日志名后缀
+#每分钟
+log4j.appender.DailyRolling.DatePattern='_'yyyy-MM-dd-HH
+#log4j.appender.file3.DatePattern='_'yyyy-MM-dd-HH    每小时
+#log4j.appender.file3.DatePattern='_'yyyy-MM-dd	每天
+#log4j.appender.file3.DatePattern='_'yyyy-MM-dd-a	每半天
+#日志输出级别
+log4j.appender.DailyRolling.Threshold=INFO
+#日志编码
+#log4j.appender.DailyRolling.Encoding=UTF-8
+#日志中输出的日志的格式
+log4j.appender.DailyRolling.layout=org.apache.log4j.PatternLayout
+#定义的日志格式
+log4j.appender.DailyRolling.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} -%-10p -%m  - %c -%-4r - [%t] %c %x%n
+#log4j.logger.org.apache.flink.shaded.akka.org.jboss.netty.channel.DefaultChannelPipeline=ERROR,DailyRolling
+
+
+
+log4j.appender.SOCKET=org.apache.log4j.RollingFileAppender
+log4j.appender.SOCKET.RemoteHost=localhost
+log4j.appender.SOCKET.Port=5001
+log4j.appender.SOCKET.LocationInfo=true
+# Set up for Log Facter 5
+log4j.appender.SOCKET.layout=org.apache.log4j.PatternLayout
+log4j.appender.SOCET.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} -%-10p -%m  - %c -%-4r - [%t] %c %x%n
+
+########################
+# Log Factor 5 Appender
+########################
+log4j.appender.LF5_APPENDER=org.apache.log4j.lf5.LF5Appender
+log4j.appender.LF5_APPENDER.MaxNumberOfRecords=2000
+
+
+########################
+# SMTP Appender
+#######################
+log4j.appender.MAIL=org.apache.log4j.net.SMTPAppender
+#日志的错误级别
+log4j.appender.MAIL.Threshold=ERROR
+#缓存文件大小,日志达到10K时发送Email
+log4j.appender.MAIL.BufferSize=10
+#发送邮件的服务器
+log4j.appender.MAIL.SMTPHost=smtp.163.com
+#邮件主题
+log4j.appender.MAIL.Subject=solr5Product
+#发送邮件箱的用户
+log4j.appender.MAIL.SMTPUsername=boryoukane@163.com
+#发送邮件箱的密码
+log4j.appender.MAIL.SMTPPassword=QBPBRCJCLWSRJJGF
+#发送邮件箱
+log4j.appender.MAIL.From=boryoukane@163.com
+#接受邮件箱
+log4j.appender.MAIL.To=boryoukane@163.com
+#发送邮件的格式
+log4j.appender.MAIL.layout = org.apache.log4j.HTMLLayout
+log4j.appender.MAIL.layout.LocationInfo = TRUE
+
+
+
+log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.A1.File=SampleMessages.log4j
+log4j.appender.A1.DatePattern=yyyyMMdd-HH'.log4j'
+log4j.appender.A1.layout=org.apache.log4j.xml.XMLLayout
+
+

+ 18 - 0
insert_neo4j/src/main/resources/新增ups关系.csv

@@ -0,0 +1,18 @@
+phenomenonName,operationName,reasonName,reasonSolve,locationName,locationAbbreviation,equipmentName,equipmentAbbreviation
+停电时,逆变不工作,打开机盖,将其取出充电,用一段时间后无故障,蓄电池电压过低,拆下蓄电池,先进行均衡充电(所有蓄电池并联进行充电) ,若仍不成功,则只有更换蓄电池,蓄电池,battery,不间断应急电源,ups
+停电时,逆变不工作 ,打开机盖,将其取出充电,用一段时间后故障依旧,充电回路有故障,用万用表电压档检测充电回路中的三端可调稳压块 LM317,其输入电压正常, 但输出端电压仅为 14.3v,重新调整均无反应。故判断 LM317 损坏。更换之,重新启动,拆掉蓄电池,将充电电压调至 27v 时,故障随即排除,电路,circuit,不间断应急电源,ups
+市电工作正常,带正常负载后备工作时间严重不足,1.对输出接插件进行清除,排除漏电可能。 2.对 UPS进行长时间充电,充电后开机故障仍存在。 3.用万用表检测电池组电压,为 48V正常。 4.检查充电回路,正常。5.检查逆变控制回路,正常。 6.用万用表和电流表按照下图接法检查电池的电性能, 发现电池组电性能下降,充电回路有故障,用万用表电压档检测充电回路中的三端可调稳压块 LM317,其输入电压正常, 但输出端电压仅为 14.3v,重新调整均无反应。故判断 LM317 损坏。更换之,重新启动,拆掉蓄电池,将充电电压调至 27v 时,故障随即排除,电路,circuit,不间断应急电源,ups
+市电工作正常,带正常负载后备工作时间严重不足,1.对输出接插件进行清除,排除漏电可能。 2.对 UPS进行长时间充电,充电后开机故障仍存在。 3.用万用表检测电池组电压,为 48V正常。 4.检查充电回路,正常。5.检查逆变控制回路,正常。 6.用万用表和电流表按照下图接法检查电池的电性能, 发现电池组电性能下降,输出接插受潮灰尘侵入造成漏电现象,对输出接插件进行清除,排除漏电可能,接插件,connectors,不间断应急电源,ups
+市电工作正常,带正常负载后备工作时间严重不足,1.对输出接插件进行清除,排除漏电可能。 2.对 UPS进行长时间充电,充电后开机故障仍存在。 3.用万用表检测电池组电压,为 48V正常。 4.检查充电回路,正常。5.检查逆变控制回路,正常。 6.用万用表和电流表按照下图接法检查电池的电性能, 发现电池组电性能下降,逆变控制回路有故障,检查维修逆变器控制回路,电路,circuit,不间断应急电源,ups
+市电工作正常,带正常负载后备工作时间严重不足,1.对输出接插件进行清除,排除漏电可能。 2.对 UPS进行长时间充电,充电后开机故障仍存在。 3.用万用表检测电池组电压,为 48V正常。 4.检查充电回路,正常。5.检查逆变控制回路,正常。 6.用万用表和电流表按照下图接法检查电池的电性能, 发现电池组电性能下降,蓄电池电压过低,拆下蓄电池,先进行均衡充电(所有蓄电池并联进行充电) ,若仍不成功,则只有更换蓄电池,蓄电池,battery,不间断应急电源,ups
+市电工作正常,带正常负载后备工作时间严重不足,1.对输出接插件进行清除,排除漏电可能。 2.对 UPS进行长时间充电,充电后开机故障仍存在。 3.用万用表检测电池组电压,为 48V正常。 4.检查充电回路,正常。5.检查逆变控制回路,正常。 6.用万用表和电流表按照下图接法检查电池的电性能, 发现电池组电性能下降,逆变控制回路散热风扇损坏而造成的,更换散热风扇,风扇,fan,不间断应急电源,ups
+市电未中断,但 UPS会绿灯闪烁,蜂鸣器每 4 秒鸣叫一声,首先检查断路器是否弹开?如已弹开,可用手将其按复位即可。其次,当市电波动并超出 UPS的输入规格,则 UPS会自动转至电池供电(绿灯闪烁,蜂鸣器每 4 秒鸣叫一声),市电波动异常,等待一段时间后仍不正常,检查维修市电模块,电路,circuit,不间断应急电源,ups
+市电一中断, UPS即中断输出,导致计算机当机,检查蓄电池电压/是否因为停电放过电,蓄电池异常,维修蓄电池/更换蓄电池,蓄电池,battery,不间断应急电源,ups
+MTUPS绿灯亮,红灯闪,同时蜂鸣器 1 秒 2 叫,检查负载,UPS过载,卸掉部分负载,再使用,负载,load,不间断应急电源,ups
+MTUPS红灯闪,同时蜂鸣器 2 秒 1 叫,检查电池和负载,电池深度放电,立即关闭负载及 UPS,待市电恢复正常时再开机,并持续充电 10H 以上,蓄电池,battery,不间断应急电源,ups
+MTUPS绿灯亮,红灯闪,同时蜂鸣器 2 秒 3 叫,检查ups充电电路和电池,蓄电池充电电路异常,检查维修电路,电路,circuit,不间断应急电源,ups
+MTUPS绿灯亮,红灯闪,同时蜂鸣器 2 秒 3 叫,检查ups充电电路和电池,蓄电池异常,维修蓄电池/更换蓄电池,蓄电池,battery,不间断应急电源,ups
+MTUPS红灯亮,蜂鸣器长鸣,检查负载,结果异常,UPS过载,卸掉部分负载,再使用,负载,load,不间断应急电源,ups
+稳压电源市电供电正常时,逆变时有输出,但输出电压偏高至275V,检查电源的高压保护电路和市电稳压电路,市电稳压电路异常,市电电压的高低取决于继电器 S3~S8的吸合状态。先用万用表逐一检测,发现继电器 S3的线圈已烧断,故 S3不吸合,使得 220V市电电压完全加在 T3 的第 3、4 根抽头间, 从而导致输出电压偏高。 更换 T3,开机运行,故障排除。 在实际工作中,考虑到该稳压电源直接接在交流稳压器上使用, 又无同规格的继电器可代换,将 S3中的第①、③短接即可,电路,circuit,不间断应急电源,ups
+稳压电源市电供电正常时,逆变时有输出,但输出电压偏高至275V,检查电源的高压保护电路和市电稳压电路,高压保护电路异常,首先用万用表测得电压比较器,在使用时要定期检查高压保护电路是否正常,电路,circuit,不间断应急电源,ups
+当市电中断时,逆变器不工作,红色指示灯长亮,检查电池电压,蓄电池电压过低,拆下蓄电池,先进行均衡充电(所有蓄电池并联进行充电) ,若仍不成功,则只有更换蓄电池,蓄电池,battery,不间断应急电源,ups

+ 12 - 0
insert_neo4j/src/test/java/Test.java

@@ -0,0 +1,12 @@
+/**
+ * @program: sunwin_metro
+ * @description:
+ * @author: xuYJ
+ * @create: 2021-06-24 17:45
+ **/
+public class Test {
+    public static void main(String[] args) {
+        //检测代码运行环境
+        System.out.println(  System.getProperty("os.name").toLowerCase().startsWith("win"));
+    }
+}

+ 131 - 0
neo4j_metro/pom.xml

@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Neo4j dependency -->
+<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">
+    <parent>
+        <artifactId>sunwin_metro</artifactId>
+        <groupId>org.sunwin</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>neo4j_metro</artifactId>
+
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+
+    <dependencies>
+        <!-- http 客戶端 -->
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.9</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpmime</artifactId>
+            <version>4.5.3</version>
+        </dependency>
+        <!-- The client -->
+        <dependency>
+            <groupId>io.prometheus</groupId>
+            <artifactId>simpleclient</artifactId>
+            <version>0.10.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>io.prometheus</groupId>
+            <artifactId>simpleclient_pushgateway</artifactId>
+            <version>0.10.0</version>
+        </dependency>
+        <!-- 数据库链接池 -->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-dbcp2</artifactId>
+            <version>2.1.1</version>
+        </dependency>
+        <!-- 依赖 impala-->
+        <dependency>
+            <groupId>com.cloudera.impala</groupId>
+            <artifactId>ImpalaJDBC41</artifactId>
+            <version>2.6.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.neo4j.driver</groupId>
+            <artifactId>neo4j-java-driver</artifactId>
+            <version>4.0.1</version>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-neo4j</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.neo4j</groupId>
+            <artifactId>neo4j-ogm-http-driver</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.junit.vintage</groupId>
+                    <artifactId>junit-vintage-engine</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <!--读写excel-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+            <version>2.2.4</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+            <version>3.17</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+
+            <version>3.17</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.ververica</groupId>
+            <artifactId>flink-connector-mysql-cdc</artifactId>
+            <version>1.2.0</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 15 - 0
neo4j_metro/src/main/java/neo4j/Neo4jDemoApplication.java

@@ -0,0 +1,15 @@
+package neo4j;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * @author jamie.shi
+ */
+@SpringBootApplication
+public class Neo4jDemoApplication {
+    public static void main(String[] args) {
+        SpringApplication.run(Neo4jDemoApplication.class, args);
+    }
+
+}

+ 148 - 0
neo4j_metro/src/main/java/neo4j/bean/InputValue.java

@@ -0,0 +1,148 @@
+package neo4j.bean;
+
+import com.alibaba.fastjson.JSON;
+import lombok.Data;
+
+/**
+ * @program: sunwin_metro
+ * @description: 解析输入参数bean
+ * @author: xuYJ
+ * @create: 2021-06-22 10:31
+ **/
+@Data
+public class InputValue {
+    /**
+     * 故障现象
+     */
+    private String phenomenonName;
+    /**
+     * 故障操作
+     */
+    private String operationName;
+    /**
+     * 发现故障原因
+     */
+    private String reasonName;
+    /**
+     * 故障解决方式
+     */
+    private String reasonSolve;
+    /**
+     * 故障发生的部位
+     */
+    private String locationName;
+    /**
+     * 故障发生的部位 英文简称
+     */
+    private String locationAbbreviation;
+    /**
+     * 故障系统
+     */
+    private String equipmentName;
+    /**
+     * 故障系统 英文简称
+     */
+    private String equipmentAbbreviation;
+
+    public InputValue(String phenomenonName, String operationName, String reasonName, String reasonSolve, String locationName, String locationAbbreviation, String equipmentName, String equipmentAbbreviation) {
+        this.phenomenonName = phenomenonName;
+        this.operationName = operationName;
+        this.reasonName = reasonName;
+        this.reasonSolve = reasonSolve;
+        this.locationName = locationName;
+        this.locationAbbreviation = locationAbbreviation;
+        this.equipmentName = equipmentName;
+        this.equipmentAbbreviation = equipmentAbbreviation;
+    }
+
+    public String getPhenomenonName() {
+        return phenomenonName;
+    }
+
+    public void setPhenomenonName(String phenomenonName) {
+        this.phenomenonName = phenomenonName;
+    }
+
+    public String getOperationName() {
+        return operationName;
+    }
+
+    public void setOperationName(String operationName) {
+        this.operationName = operationName;
+    }
+
+    public String getReasonName() {
+        return reasonName;
+    }
+
+    public void setReasonName(String reasonName) {
+        this.reasonName = reasonName;
+    }
+
+    public String getReasonSolve() {
+        return reasonSolve;
+    }
+
+    public void setReasonSolve(String reasonSolve) {
+        this.reasonSolve = reasonSolve;
+    }
+
+    public String getLocationName() {
+        return locationName;
+    }
+
+    public void setLocationName(String locationName) {
+        this.locationName = locationName;
+    }
+
+    public String getLocationAbbreviation() {
+        return locationAbbreviation;
+    }
+
+    public void setLocationAbbreviation(String locationAbbreviation) {
+        this.locationAbbreviation = locationAbbreviation;
+    }
+
+    public String getEquipmentName() {
+        return equipmentName;
+    }
+
+    public void setEquipmentName(String equipmentName) {
+        this.equipmentName = equipmentName;
+    }
+
+    public String getEquipmentAbbreviation() {
+        return equipmentAbbreviation;
+    }
+
+    public void setEquipmentAbbreviation(String equipmentAbbreviation) {
+        this.equipmentAbbreviation = equipmentAbbreviation;
+    }
+
+    @Override
+    public String toString() {
+        return "InputValue{" +
+                "phenomenonName='" + phenomenonName + '\'' +
+                ", operationName='" + operationName + '\'' +
+                ", reasonName='" + reasonName + '\'' +
+                ", reasonSolve='" + reasonSolve + '\'' +
+                ", locationName='" + locationName + '\'' +
+                ", locationAbbreviation='" + locationAbbreviation + '\'' +
+                ", equipmentName='" + equipmentName + '\'' +
+                ", equipmentAbbreviation='" + equipmentAbbreviation + '\'' +
+                '}';
+    }
+
+    public static void main(String[] args) {
+        System.out.println(JSON.toJSONString(new InputValue(
+                "停电时,逆变不工作",
+                "打开机盖,将其取出充电,用一段时间后无故障",
+                "蓄电池电压过低",
+                "拆下蓄电池,先进行均衡充电(所有蓄电池并联进行充电) ,若仍不成功,则只有更换蓄电池",
+                "蓄电池",
+                "battery",
+                "不间断应急电源",
+                "ups"
+        )));
+    }
+}

+ 22 - 0
neo4j_metro/src/main/java/neo4j/bean/RuleResult.java

@@ -0,0 +1,22 @@
+package neo4j.bean;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author Administrator
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class RuleResult {
+
+    private String id;
+
+    private String name;
+
+    private int voltage;
+    private int current;
+
+}

+ 160 - 0
neo4j_metro/src/main/java/neo4j/controller/MetroController.java

@@ -0,0 +1,160 @@
+package neo4j.controller;
+
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import neo4j.model.test.Device;
+import neo4j.model.test.MetroSystem;
+import neo4j.relation.test.FeatureInfoGroupByDevice;
+import neo4j.relation.test.FeatureSystem;
+import neo4j.repository.test.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.*;
+
+/**
+ * @author xuYJ
+ */
+@RestController
+@RequestMapping("/rest/v1.0.1/database")
+public class MetroController {
+    ExecutorService executor = Executors.newCachedThreadPool();
+    @Autowired
+    DeviceRepository deviceService;
+
+    @Autowired
+    SystemRepository systemService;
+
+    @Autowired
+    FeatureRepository featureService;
+
+    @Autowired
+    SystemDeviceRepository sysDevService;
+
+    @Autowired
+    DeviceFeatureRepository devFeaService;
+
+
+
+    @RequestMapping("/getSysDevRes")
+    public String getSysDevRes() {
+        return JSON.toJSONString(sysDevService.findSystemDevices());
+    }
+
+    /**
+     * 查询设备 -> 设备属性 关系
+     */
+    @RequestMapping("/getDevFeaRes")
+    public String getDevFeaRes(@RequestParam(value = "deviceName",required = false) String deviceName) {
+        if (null != deviceName && !"".equals(deviceName) && !deviceName.isEmpty()) {
+            return JSONArray.toJSONString(devFeaService.findDeviceFeatures(deviceName), SerializerFeature.DisableCircularReferenceDetect);
+        } else {
+            return JSONArray.toJSONString(devFeaService.findDeviceFeatures(),SerializerFeature.DisableCircularReferenceDetect);
+        }
+    }
+
+    /**
+     * 查询系统名
+     */
+    @RequestMapping("/getSystemInfo")
+    public String getSystemInfo(@RequestParam(value = "systemName") String systemName) throws ExecutionException, InterruptedException {
+        long l = System.currentTimeMillis();
+        FutureTask<Integer> task =null;
+        task = new FutureTask<>(() -> {
+            Thread.sleep(10000);
+            return 10;
+        });
+        executor.execute(task);
+
+        FutureTask<Integer> task2 =null;
+        task2 = new FutureTask<>(() -> {
+            Thread.sleep(10000);
+            return 10;
+        });
+        executor.execute(task2);
+        Integer integer = task.get();
+        Integer integer1 = task2.get();
+
+        return JSON.toJSONString(systemService.findByName(systemName));
+    }
+
+    /**
+     * 查询设备名信息
+     */
+    @RequestMapping("/getDeviceInfo")
+    public String getDeviceInfo(@RequestParam(value = "deviceName") String deviceName) {
+        return JSON.toJSONString(deviceService.findByName(deviceName));
+    }
+
+    /**
+     * 查询地铁系统名
+     */
+    @RequestMapping("/getDevices")
+    public String getSystemDevice(@RequestParam(value = "systemName") String systemName) {
+        List<Device> devices = deviceService.findDevices(systemName);
+        return JSONArray.toJSONString(devices);
+    }
+
+    /**
+     * 查询设备关系,根据设备属性
+     */
+    @RequestMapping("/getDeviceRes")
+    public Map<String, List<Device>> getDevicesRes(@RequestParam(value = "featureName", required = false) String featureName) {
+        List<FeatureInfoGroupByDevice> groupByFeature;
+        HashMap<String, List<Device>> result = new HashMap<>(16);
+        if (null != featureName && !"".equals(featureName) && !featureName.isEmpty()) {
+            groupByFeature = deviceService.findFeatureInfoGroupByDeviceWithName(featureName);
+            groupByFeature.forEach(featureInfoGroupByDevice -> result.put(featureInfoGroupByDevice.getFeatureName(), featureInfoGroupByDevice.getDevices()));
+        } else {
+            groupByFeature = deviceService.findFeatureInfoGroupByDevice();
+            groupByFeature.forEach(featureInfoGroupByDevice -> result.put(featureInfoGroupByDevice.getFeatureName(), featureInfoGroupByDevice.getDevices()));
+        }
+
+        return result;
+    }
+
+    /**
+     * 查询系统关系,根据设备属性
+     */
+    @RequestMapping("/getSystemRes")
+    public Map<String, List<MetroSystem>> getSystemRes(@RequestParam(value = "featureName", required = false) String featureName) {
+        List<FeatureSystem> groupByFeature;
+        HashMap<String, List<MetroSystem>> result = new HashMap<>(16);
+        if (null != featureName && !"".equals(featureName) && !featureName.isEmpty()) {
+            groupByFeature = systemService.findFeatureBySys(featureName);
+            groupByFeature.forEach(featureInfoGroupByDevice -> result.put(featureInfoGroupByDevice.getFeatureName(), featureInfoGroupByDevice.getMetroSystems()));
+        } else {
+            groupByFeature = systemService.findFeatureBySys();
+            groupByFeature.forEach(featureInfoGroupByDevice -> result.put(featureInfoGroupByDevice.getFeatureName(), featureInfoGroupByDevice.getMetroSystems()));
+        }
+        return result;
+    }
+
+
+    /**
+     * 根据设备名查询所有属性
+     */
+    @RequestMapping("/getFeatures")
+    public String getFeatures(@RequestParam(value = "deviceName", required = false) String deviceName) {
+        if (null != deviceName && !"".equals(deviceName) && !deviceName.isEmpty()) {
+            return JSONArray.toJSONString(featureService.findFeature(deviceName));
+        } else {
+            return JSONArray.toJSONString(featureService.findFeature());
+        }
+    }
+
+    /**
+     * 根据属性名查询所有属性信息
+     */
+    @RequestMapping("/getFeatureInfo")
+    public String getFeatureInfo(@RequestParam(value = "featureName") String featureName) {
+        return JSONArray.toJSONString(featureService.findByName(featureName));
+
+    }
+
+}

+ 173 - 0
neo4j_metro/src/main/java/neo4j/controller/dev/EquipmentController.java

@@ -0,0 +1,173 @@
+package neo4j.controller.dev;
+
+
+import neo4j.model.dev.*;
+import neo4j.repository.dev.*;
+import neo4j.bean.InputValue;
+
+import neo4j.relation.dev.EquLoc;
+import neo4j.relation.dev.LocRea;
+import neo4j.relation.dev.OpeRea;
+import neo4j.relation.dev.PheOpe;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
+
+/**
+ * @author xuYJ
+ */
+@RestController
+@RequestMapping("/rest/v1.0.1/database")
+public class EquipmentController {
+    @Autowired
+    EquipmentRepository equipmentService;
+    @Autowired
+    ReasonRepository reasonService;
+    @Autowired
+    LocationRepository locationService;
+    @Autowired
+    OperationRepository operationService;
+    @Autowired
+    PhenomenonRepository phenomenonService;
+    @Autowired
+    PheOpeRepository pheOpeService;
+    @Autowired
+    OpeReaRepository opeReaService;
+    @Autowired
+    LocReaRepository locReaService;
+    @Autowired
+    EquLocRepository equLocService;
+
+
+    @RequestMapping("/delete")
+    public void getFeatureInfo() {
+        List<Phenomenon> byName = phenomenonService.findByName("停电时,逆变不工作");
+        for (Phenomenon phenomenon : byName) {
+            phenomenonService.delete(phenomenon);
+        }
+        List<Operation> byName1 = operationService.findByName("打开机盖,将其取出充电,用一段时间后无故障");
+        for (Operation operation : byName1) {
+            operationService.delete(operation);
+        }
+
+        List<Reason> byName2 = reasonService.findByName("蓄电池电压过低");
+        for (Reason reason : byName2) {
+            reasonService.delete(reason);
+        }
+    }
+
+    /**
+     *新增故障图谱数据
+     */
+    @PostMapping(value = "/insertRes", produces = "application/json;charset=UTF-8")
+    public String insertRes(@RequestBody InputValue inputValue) {
+        List<Phenomenon> phenomenon = phenomenonService.findByName(inputValue.getPhenomenonName());
+        if (phenomenon.isEmpty()) {
+            //找到实体中最大的 abbreviation
+            List<String> abbreviation = phenomenonService.findAbbreviation();
+            abbreviation.sort((o1, o2) -> {
+                Integer reason1 = Integer.valueOf(o1.replaceAll("phenomenon", ""));
+                Integer reason2 = Integer.valueOf(o2.replaceAll("phenomenon", ""));
+                return reason1 - reason2;
+            });
+            String num = abbreviation.get(abbreviation.size() - 1).replaceAll("phenomenon", "").trim();
+            String phenomenonAbbreviation = "phenomenon"+(Integer.parseInt(num)+1);
+            phenomenonService.save(new Phenomenon(inputValue.getPhenomenonName(), phenomenonAbbreviation));
+        } else {
+            System.out.println("故障现象实体已存在");
+        }
+
+        //验证设备系统实体是否存在
+        Equipment equipment = equipmentService.findByName(inputValue.getEquipmentName());
+        if (null == equipment) {
+            equipmentService.save(new Equipment(inputValue.getEquipmentName(), inputValue.getEquipmentAbbreviation()));
+        } else {
+            System.out.println("设备系统实体存在");
+        }
+
+        Location location = locationService.findByName(inputValue.getLocationName());
+        if (null == location) {
+            locationService.save(new Location(inputValue.getLocationName(), inputValue.getLocationAbbreviation()));
+        } else {
+            System.out.println("故障发生的部位实体已存在");
+        }
+
+        List<Reason> reason = reasonService.findByName(inputValue.getReasonName());
+        if (reason.isEmpty()) {
+            //找到实体中最大的 abbreviation
+            List<String> abbreviation = reasonService.findAbbreviation();
+            abbreviation.sort((o1, o2) -> {
+                Integer reason1 = Integer.valueOf(o1.replaceAll("reason", ""));
+                Integer reason2 = Integer.valueOf(o2.replaceAll("reason", ""));
+                return reason1 - reason2;
+            });
+            String num = abbreviation.get(abbreviation.size() - 1).replaceAll("reason", "").trim();
+            String reasonAbbreviation =  "reason"+(Integer.parseInt(num)+1);
+            //实体不存在,新增实体
+            reasonService.save(new Reason(inputValue.getReasonName(), reasonAbbreviation, inputValue.getReasonSolve()));
+        } else {
+            System.out.println("故障原因实体已存在");
+        }
+
+        List<Operation> operation = operationService.findByName(inputValue.getOperationName());
+        if (operation.isEmpty()) {
+            //找到实体中最大的 abbreviation
+            List<String> abbreviation = operationService.findAbbreviation();
+            abbreviation.sort((o1, o2) -> {
+                Integer reason1 = Integer.valueOf(o1.replaceAll("operation", ""));
+                Integer reason2 = Integer.valueOf(o2.replaceAll("operation", ""));
+                return reason1 - reason2;
+            });
+            String num = abbreviation.get(abbreviation.size() - 1).replaceAll("operation", "").trim();
+            String operationAbbreviation = "operation"+(Integer.parseInt(num)+1);
+            //实体不存在,新增实体
+            operationService.save(new Operation(inputValue.getOperationName(), operationAbbreviation));
+        } else {
+            System.out.println("故障操作实体已存在");
+        }
+            Phenomenon phenomenon1 = phenomenonService.findByName(inputValue.getPhenomenonName()).get(0);
+            equipment = equipmentService.findByName(inputValue.getEquipmentName());
+            Operation operation1 = operationService.findByName(inputValue.getOperationName()).get(0);
+            Reason reason1 = reasonService.findByName(inputValue.getReasonName()).get(0);
+            location = locationService.findByName(inputValue.getLocationName());
+            int count=0;
+            List<PheOpe> res1 = pheOpeService.getRes(phenomenon1.getAbbreviation(), operation1.getAbbreviation());
+            if(res1.isEmpty()){
+                PheOpe res11 = pheOpeService.createRes(phenomenon1.getAbbreviation(), operation1.getAbbreviation(),"建议操作");
+                System.out.println("res1 = " + res11);
+            }else {
+                System.out.println("建议操作关系已存在");
+                count++;
+            }
+            List<OpeRea> res2 = opeReaService.getRes(operation1.getAbbreviation(), reason1.getAbbreviation());
+            if(res2.isEmpty()){
+                OpeRea res21 = opeReaService.createRes(operation1.getAbbreviation(), reason1.getAbbreviation(),"发现故障原因");
+                System.out.println("res2 = " + res21);
+            }else {
+                System.out.println("发现故障原因关系已存在" );
+                count++;
+            }
+            List<LocRea> res3 = locReaService.getRes(location.getAbbreviation(), reason1.getAbbreviation());
+            if(res3.isEmpty()){
+                LocRea res31 = locReaService.createRes(location.getAbbreviation(), reason1.getAbbreviation(),"隐患故障点");
+                System.out.println("res3 = " + res31);
+            }else {
+                System.out.println("隐患故障点关系已存在");
+                count++;
+            }
+            List<EquLoc> res4 = equLocService.getRes(equipment.getAbbreviation(), location.getAbbreviation());
+            if(res4.isEmpty()){
+                EquLoc res41 = equLocService.createRes(equipment.getAbbreviation(), location.getAbbreviation(),"故障部位");
+                System.out.println("res4 = " + res41);
+            }else {
+                System.out.println("故障部位关系已存在");
+                count++;
+            }
+        System.out.println("---------------------------") ;
+            if(count==4){
+             return "新增关系重复";
+            }
+            return "关系新增成功";
+        }
+}

+ 31 - 0
neo4j_metro/src/main/java/neo4j/model/dev/Equipment.java

@@ -0,0 +1,31 @@
+package neo4j.model.dev;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.neo4j.ogm.annotation.GeneratedValue;
+import org.neo4j.ogm.annotation.Id;
+import org.neo4j.ogm.annotation.NodeEntity;
+
+/**
+ * @program: neo4j-demo
+ * @description: 设备系统实体
+ * @author: kane
+ * @create: 2020-05-27 10:29
+ **/
+@NodeEntity
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Equipment {
+    @Id
+    @GeneratedValue
+    private Long id;
+    private String name;
+    private String abbreviation;
+
+    public Equipment(String name, String abbreviation) {
+        this.name = name;
+        this.abbreviation = abbreviation;
+    }
+}

+ 31 - 0
neo4j_metro/src/main/java/neo4j/model/dev/Location.java

@@ -0,0 +1,31 @@
+package neo4j.model.dev;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.neo4j.ogm.annotation.GeneratedValue;
+import org.neo4j.ogm.annotation.Id;
+import org.neo4j.ogm.annotation.NodeEntity;
+
+/**
+ * @program: neo4j-demo
+ * @description: 设备系统子部件实体
+ * @author: kane
+ * @create: 2020-05-27 10:29
+ **/
+@NodeEntity
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Location {
+    @Id
+    @GeneratedValue
+    private Long id;
+    private String name;
+    private String abbreviation;
+
+    public Location(String name, String abbreviation) {
+        this.name = name;
+        this.abbreviation = abbreviation;
+    }
+}

+ 31 - 0
neo4j_metro/src/main/java/neo4j/model/dev/Operation.java

@@ -0,0 +1,31 @@
+package neo4j.model.dev;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.neo4j.ogm.annotation.GeneratedValue;
+import org.neo4j.ogm.annotation.Id;
+import org.neo4j.ogm.annotation.NodeEntity;
+
+/**
+ * @program: neo4j-demo
+ * @description: 故障现象对应实体
+ * @author: kane
+ * @create: 2020-05-27 10:29
+ **/
+@NodeEntity
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Operation {
+    @Id
+    @GeneratedValue
+    private Long id;
+    private String name;
+    private String abbreviation;
+
+    public Operation(String name, String abbreviation) {
+        this.name = name;
+        this.abbreviation = abbreviation;
+    }
+}

+ 31 - 0
neo4j_metro/src/main/java/neo4j/model/dev/Phenomenon.java

@@ -0,0 +1,31 @@
+package neo4j.model.dev;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.neo4j.ogm.annotation.GeneratedValue;
+import org.neo4j.ogm.annotation.Id;
+import org.neo4j.ogm.annotation.NodeEntity;
+
+/**
+ * @program: neo4j-demo
+ * @description: 故障现象实体
+ * @author: kane
+ * @create: 2020-05-27 10:29
+ **/
+@NodeEntity
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Phenomenon {
+    @Id
+    @GeneratedValue
+    private Long id;
+    private String name;
+    private String abbreviation;
+
+    public Phenomenon(String name, String abbreviation) {
+        this.name = name;
+        this.abbreviation = abbreviation;
+    }
+}

+ 33 - 0
neo4j_metro/src/main/java/neo4j/model/dev/Reason.java

@@ -0,0 +1,33 @@
+package neo4j.model.dev;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.neo4j.ogm.annotation.GeneratedValue;
+import org.neo4j.ogm.annotation.Id;
+import org.neo4j.ogm.annotation.NodeEntity;
+
+/**
+ * @program: neo4j-demo
+ * @description: 故障原因实体
+ * @author: kane
+ * @create: 2020-05-27 10:29
+ **/
+@NodeEntity
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Reason {
+    @Id
+    @GeneratedValue
+    private Long id;
+    private String name;
+    private String abbreviation;
+    private String solve;
+
+    public Reason(String name, String abbreviation, String solve) {
+        this.name = name;
+        this.abbreviation = abbreviation;
+        this.solve = solve;
+    }
+}

+ 27 - 0
neo4j_metro/src/main/java/neo4j/model/test/Device.java

@@ -0,0 +1,27 @@
+package neo4j.model.test;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.neo4j.ogm.annotation.GeneratedValue;
+import org.neo4j.ogm.annotation.Id;
+import org.neo4j.ogm.annotation.NodeEntity;
+
+/**
+ * @program: neo4j-demo
+ * @description: person
+ * @author: Jamie.shi
+ * @create: 2020-05-27 10:29
+ **/
+@NodeEntity
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Device {
+    @Id
+    @GeneratedValue
+    private Long id;
+    private String name;
+    private String abbreviation;
+
+}

+ 27 - 0
neo4j_metro/src/main/java/neo4j/model/test/Feature.java

@@ -0,0 +1,27 @@
+package neo4j.model.test;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.neo4j.ogm.annotation.GeneratedValue;
+import org.neo4j.ogm.annotation.Id;
+import org.neo4j.ogm.annotation.NodeEntity;
+
+/**
+ * @program: neo4j-demo
+ * @description: 设备属性
+ * @author: xuYJ
+ * @create: 2021-03-17 13:41
+ **/
+@NodeEntity
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Feature {
+    @Id
+    @GeneratedValue
+    private Long id;
+    private String abbreviation;
+    private String name;
+    private String type ;
+}

+ 27 - 0
neo4j_metro/src/main/java/neo4j/model/test/MetroSystem.java

@@ -0,0 +1,27 @@
+package neo4j.model.test;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.neo4j.ogm.annotation.GeneratedValue;
+import org.neo4j.ogm.annotation.Id;
+import org.neo4j.ogm.annotation.NodeEntity;
+
+/**
+ * @program: neo4j-demo
+ * @description: person
+ * @author: Jamie.shi
+ * @create: 2020-05-27 10:29
+ **/
+@NodeEntity
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class MetroSystem {
+    @Id
+    @GeneratedValue
+    private Long id;
+    private String name;
+    private String abbreviation;
+
+}

+ 36 - 0
neo4j_metro/src/main/java/neo4j/relation/dev/EquLoc.java

@@ -0,0 +1,36 @@
+package neo4j.relation.dev;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import neo4j.model.dev.Equipment;
+import neo4j.model.dev.Location;
+import org.neo4j.ogm.annotation.*;
+
+/**
+ * @program: neo4j-demo
+ * @description:
+ * @author: Jamie.shi
+ * @create: 2020-05-27 10:43
+ **/
+@RelationshipEntity(type = "故障部位")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class EquLoc {
+    @Id
+    @GeneratedValue
+    private Long id;
+    private String property;
+
+    @StartNode
+    private Equipment equipment;
+    @EndNode
+    private Location location;
+
+    public EquLoc(Equipment equipment, Location location, String property) {
+        this.equipment = equipment;
+        this.location = location;
+        this.property = property;
+    }
+}

+ 36 - 0
neo4j_metro/src/main/java/neo4j/relation/dev/LocRea.java

@@ -0,0 +1,36 @@
+package neo4j.relation.dev;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import neo4j.model.dev.Location;
+import neo4j.model.dev.Reason;
+import org.neo4j.ogm.annotation.*;
+
+/**
+ * @program: neo4j-demo
+ * @description:
+ * @author: Jamie.shi
+ * @create: 2020-05-27 10:43
+ **/
+@RelationshipEntity(type = "隐患故障点")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class LocRea {
+    @Id
+    @GeneratedValue
+    private Long id;
+    private String property;
+
+    @StartNode
+    private Location location;
+    @EndNode
+    private Reason reason;
+
+    public LocRea(Location location, Reason reason, String property) {
+        this.reason = reason;
+        this.location = location;
+        this.property = property;
+    }
+}

+ 36 - 0
neo4j_metro/src/main/java/neo4j/relation/dev/OpeRea.java

@@ -0,0 +1,36 @@
+package neo4j.relation.dev;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import neo4j.model.dev.Operation;
+import neo4j.model.dev.Reason;
+import org.neo4j.ogm.annotation.*;
+
+/**
+ * @program: neo4j-demo
+ * @description: 发现故障原因 ( 故障操作 -> 故障原因)
+ * @author: kane
+ * @create: 2021-05-27 10:43
+ **/
+@RelationshipEntity(type = "发现故障原因")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class OpeRea {
+    @Id
+    @GeneratedValue
+    private Long id;
+    private String property;
+
+    @StartNode
+    private Operation operation;
+    @EndNode
+    private Reason reason;
+
+    public OpeRea(Operation operation, Reason reason, String property) {
+        this.operation = operation;
+        this.reason = reason;
+        this.property = property;
+    }
+}

+ 36 - 0
neo4j_metro/src/main/java/neo4j/relation/dev/PheOpe.java

@@ -0,0 +1,36 @@
+package neo4j.relation.dev;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import neo4j.model.dev.Operation;
+import neo4j.model.dev.Phenomenon;
+import org.neo4j.ogm.annotation.*;
+
+/**
+ * @program: neo4j-demo
+ * @description: 建议操作关系 ( 故障现象 -> 故障操作)
+ * @author: kane
+ * @create: 2021-05-27 10:43
+ **/
+@RelationshipEntity(type = "建议操作")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class PheOpe {
+    @Id
+    @GeneratedValue
+    private Long id;
+    private String property;
+
+    @StartNode
+    private Phenomenon phenomenon;
+    @EndNode
+    private Operation operation;
+
+    public PheOpe(Phenomenon phenomenon, Operation operation, String property) {
+        this.phenomenon = phenomenon;
+        this.operation = operation;
+        this.property = property;
+    }
+}

+ 37 - 0
neo4j_metro/src/main/java/neo4j/relation/test/DeviceFeature.java

@@ -0,0 +1,37 @@
+package neo4j.relation.test;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import neo4j.model.test.Device;
+import neo4j.model.test.Feature;
+import org.neo4j.ogm.annotation.*;
+
+/**
+ * @program: neo4j-demo
+ * @description:
+ * @author: Jamie.shi
+ * @create: 2020-05-27 10:43
+ **/
+@RelationshipEntity
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class DeviceFeature {
+    @Id
+    @GeneratedValue
+    private Long id;
+    private String property;
+
+    @StartNode
+    private Device device;
+    @EndNode
+    private Feature feature;
+
+    public DeviceFeature(Device device, Feature feature, String property) {
+        this.device = device;
+        this.feature = feature;
+        this.property = property;
+    }
+
+}

+ 30 - 0
neo4j_metro/src/main/java/neo4j/relation/test/FeatureInfoGroupByDevice.java

@@ -0,0 +1,30 @@
+package neo4j.relation.test;
+
+import lombok.Data;
+import neo4j.model.test.Device;
+import org.springframework.data.neo4j.annotation.QueryResult;
+
+import java.util.List;
+
+
+/**
+ * <p>
+ * 按照设备属性分组的设备关系
+ * </p>
+ *
+ * @author yangkai.shen
+ * @date Created in 2018-12-24 19:18
+ */
+@Data
+@QueryResult
+public class FeatureInfoGroupByDevice {
+    /**
+     * 设备属性名称
+     */
+    private String featureName;
+
+    /**
+     * 设备名
+     */
+    private List<Device> devices;
+}

+ 29 - 0
neo4j_metro/src/main/java/neo4j/relation/test/FeatureSystem.java

@@ -0,0 +1,29 @@
+package neo4j.relation.test;
+
+import lombok.Data;
+import neo4j.model.test.MetroSystem;
+import org.springframework.data.neo4j.annotation.QueryResult;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 属性 -> 系统关系
+ * </p>
+ *
+ * @author kane
+
+ */
+@Data
+@QueryResult
+public class FeatureSystem {
+    /**
+     * 设备属性
+     */
+    private String featureName;
+
+    /**
+     * 地铁系统
+     */
+    private List<MetroSystem> metroSystems;
+}

+ 36 - 0
neo4j_metro/src/main/java/neo4j/relation/test/SystemDevice.java

@@ -0,0 +1,36 @@
+package neo4j.relation.test;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import neo4j.model.test.Device;
+import neo4j.model.test.MetroSystem;
+import org.neo4j.ogm.annotation.*;
+
+/**
+ * @program: neo4j-demo
+ * @description:
+ * @author: Jamie.shi
+ * @create: 2020-05-27 10:43
+ **/
+@RelationshipEntity
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class SystemDevice {
+    @Id
+    @GeneratedValue
+    private Long id;
+    private String property;
+
+    @StartNode
+    private MetroSystem metroSystem;
+    @EndNode
+    private Device device;
+
+    public SystemDevice(MetroSystem metroSystem, Device device, String property) {
+        this.metroSystem = metroSystem;
+        this.device = device;
+        this.property = property;
+    }
+}

+ 29 - 0
neo4j_metro/src/main/java/neo4j/repository/dev/EquLocRepository.java

@@ -0,0 +1,29 @@
+package neo4j.repository.dev;
+import neo4j.relation.dev.EquLoc;
+import org.springframework.data.neo4j.annotation.Query;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+import java.util.List;
+
+/**
+ * @program: neo4j-demo
+ * @description: 系统 -> 故障部位关系
+ * @author: xuYJ
+ * @create: 2021-03-17 15:40
+ **/
+public interface EquLocRepository extends Neo4jRepository<EquLoc, Long> {
+    /**
+     * 为两个已经存在的节点添加关系
+     * @param start -- 起始节点
+     * @param end   -- 终止节点
+     */
+    @Query("match(a),(b) where a.abbreviation = {0} and b.abbreviation = {1} "
+            + " create p = (a)-[r: 故障部位 {property:{2}}  ] -> (b) return p ")
+    EquLoc createRes(String start, String end ,String res);
+
+    /**
+     * 查询关系是否存在
+     */
+    @Query("match p = (n)-[r:故障部位]- (b) where n.abbreviation={0} and b.abbreviation={1} return p")
+    List<EquLoc> getRes(String equ, String loc );
+}

+ 22 - 0
neo4j_metro/src/main/java/neo4j/repository/dev/EquipmentRepository.java

@@ -0,0 +1,22 @@
+package neo4j.repository.dev;
+
+import neo4j.model.dev.Equipment;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+import org.springframework.data.repository.query.Param;
+
+/**
+ * @program: neo4j-demo
+ * @description:
+ * @author: kane
+ * @create: 2020-05-27 10:37
+ **/
+public interface EquipmentRepository extends Neo4jRepository<Equipment, Long> {
+
+    /**
+     * 根据名字查找
+     * @param name
+     * @return
+     */
+    Equipment findByName(@Param("name") String name);
+
+}

+ 30 - 0
neo4j_metro/src/main/java/neo4j/repository/dev/LocReaRepository.java

@@ -0,0 +1,30 @@
+package neo4j.repository.dev;
+
+import neo4j.relation.dev.LocRea;
+import org.springframework.data.neo4j.annotation.Query;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+import java.util.List;
+
+/**
+ * @program: neo4j-demo
+ * @description: 系统 -> 故障部位关系
+ * @author: xuYJ
+ * @create: 2021-03-17 15:40
+ **/
+public interface LocReaRepository extends Neo4jRepository<LocRea, Long> {
+    /**
+     * 为两个已经存在的节点添加关系
+     * @param start -- 起始节点
+     * @param end   -- 终止节点
+     */
+    @Query("match(a),(b) where a.abbreviation = {0} and b.abbreviation = {1} "
+            + " create p = (a)-[r: 隐患故障点 {property:{2}} ] -> (b) return p ")
+    LocRea createRes(String start, String end ,String res);
+
+    /**
+     * 查询关系是否存在
+     */
+    @Query("match p = (n)-[r:隐患故障点]- (b) where n.abbreviation={0} and b.abbreviation={1} return p")
+    List<LocRea> getRes(String loc, String rea );
+}

+ 22 - 0
neo4j_metro/src/main/java/neo4j/repository/dev/LocationRepository.java

@@ -0,0 +1,22 @@
+package neo4j.repository.dev;
+
+import neo4j.model.dev.Location;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+import org.springframework.data.repository.query.Param;
+
+/**
+ * @program: neo4j-demo
+ * @description:
+ * @author: kane
+ * @create: 2020-05-27 10:37
+ **/
+public interface LocationRepository extends Neo4jRepository<Location, Long> {
+
+    /**
+     * 根据名字查找
+     * @param name
+     * @return
+     */
+    Location findByName(@Param("name") String name);
+
+}

+ 28 - 0
neo4j_metro/src/main/java/neo4j/repository/dev/OpeReaRepository.java

@@ -0,0 +1,28 @@
+package neo4j.repository.dev;
+
+import neo4j.relation.dev.OpeRea;
+import org.springframework.data.neo4j.annotation.Query;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+import java.util.List;
+
+/**
+ * @program: neo4j-demo
+ * @description:  发现故障原因 ( 故障操作 -> 故障原因)
+ * @author: xuYJ
+ * @create: 2021-03-17 15:40
+ **/
+public interface OpeReaRepository extends Neo4jRepository<OpeRea, Long> {
+    /**
+     * 为两个已经存在的节点添加关系
+     */
+    @Query("match(a),(b) where a.abbreviation = {0} and b.abbreviation = {1} "
+            + " create p = (a)-[r: 发现故障原因 {property:{2}} ] -> (b) return p ")
+    OpeRea createRes(String start, String end ,String res );
+
+    /**
+     * 查询关系是否存在
+     */
+    @Query("match p = (n)-[r:发现故障原因]- (b) where n.abbreviation={0} and b.abbreviation={1} return p")
+    List<OpeRea> getRes(String ope, String rea );
+}

+ 30 - 0
neo4j_metro/src/main/java/neo4j/repository/dev/OperationRepository.java

@@ -0,0 +1,30 @@
+package neo4j.repository.dev;
+
+import neo4j.model.dev.Operation;
+import org.springframework.data.neo4j.annotation.Query;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
+
+/**
+ * @program: neo4j-demo
+ * @description:
+ * @author: kane
+ * @create: 2020-05-27 10:37
+ **/
+public interface OperationRepository extends Neo4jRepository<Operation, Long> {
+
+    /**
+     * 根据名字查找
+     * @param name
+     * @return
+     */
+    List<Operation> findByName(@Param("name") String name);
+
+    /**
+     * 查询所有 abbreviation
+     */
+    @Query("MATCH (n:Operation) RETURN n.abbreviation ")
+    List<String> findAbbreviation();
+}

+ 28 - 0
neo4j_metro/src/main/java/neo4j/repository/dev/PheOpeRepository.java

@@ -0,0 +1,28 @@
+package neo4j.repository.dev;
+
+import neo4j.relation.dev.PheOpe;
+import org.springframework.data.neo4j.annotation.Query;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+import java.util.List;
+
+/**
+ * @program: neo4j-demo
+ * @description:  建议操作关系 ( 故障现象 -> 故障操作)
+ * @author: xuYJ
+ * @create: 2021-03-17 15:40
+ **/
+public interface PheOpeRepository extends Neo4jRepository<PheOpe, Long> {
+    /**
+     * 为两个已经存在的节点添加关系
+     */
+    @Query("match(a),(b) where a.abbreviation = {0} and b.abbreviation = {1} "
+            + " create p = (a)-[r: 建议操作 {property:{2}} ] -> (b) return p ")
+    PheOpe createRes(String start, String end ,String res);
+
+    /**
+     * 查询关系是否存在
+     */
+    @Query("match p = (n)-[r:建议操作]- (b) where n.abbreviation={0} and b.abbreviation={1} return p")
+    List<PheOpe> getRes(String phe, String ope );
+}

+ 28 - 0
neo4j_metro/src/main/java/neo4j/repository/dev/PhenomenonRepository.java

@@ -0,0 +1,28 @@
+package neo4j.repository.dev;
+
+import neo4j.model.dev.Phenomenon;
+import org.springframework.data.neo4j.annotation.Query;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
+
+/**
+ * @program: neo4j-demo
+ * @description:
+ * @author: kane
+ * @create: 2020-05-27 10:37
+ **/
+public interface PhenomenonRepository extends Neo4jRepository<Phenomenon, Long> {
+
+    /**
+     * 根据名字查找
+     */
+    List<Phenomenon> findByName(@Param("name") String name);
+
+    /**
+     * 查询所有 abbreviation
+     */
+    @Query("MATCH (n:Phenomenon) RETURN n.abbreviation ")
+    List<String> findAbbreviation();
+}

+ 28 - 0
neo4j_metro/src/main/java/neo4j/repository/dev/ReasonRepository.java

@@ -0,0 +1,28 @@
+package neo4j.repository.dev;
+
+import neo4j.model.dev.Reason;
+import org.springframework.data.neo4j.annotation.Query;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
+
+/**
+ * @program: neo4j-demo
+ * @description:
+ * @author: kane
+ * @create: 2020-05-27 10:37
+ **/
+public interface ReasonRepository extends Neo4jRepository<Reason, Long> {
+
+    /**
+     * 根据名字查找
+     */
+    List<Reason> findByName(@Param("name") String name);
+
+    /**
+     * 查询所有 abbreviation
+     */
+    @Query("MATCH (n:Reason) RETURN n.abbreviation ")
+    List<String> findAbbreviation();
+}

+ 29 - 0
neo4j_metro/src/main/java/neo4j/repository/test/DeviceFeatureRepository.java

@@ -0,0 +1,29 @@
+package neo4j.repository.test;
+
+
+import neo4j.relation.test.DeviceFeature;
+import org.springframework.data.neo4j.annotation.Query;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+
+import java.util.List;
+
+/**
+ * @program: neo4j-demo
+ * @description: 系统->设备关系
+ * @author: xuYJ
+ * @create: 2021-03-17 15:40
+ **/
+public interface DeviceFeatureRepository extends Neo4jRepository<DeviceFeature, Long> {
+    /**
+     * 返回某设备所有设备属性
+     */
+    @Query("MATCH p=(a)-[r:DeviceFeature]->(b) WHERE a.name= {name} RETURN p")
+    List<DeviceFeature> findDeviceFeatures(String name);
+
+    /**
+     * 返回所有设备所有设备属性
+     */
+    @Query("MATCH p=(a)-[r:DeviceFeature]->(b)  RETURN p")
+    List<DeviceFeature> findDeviceFeatures();
+}

+ 41 - 0
neo4j_metro/src/main/java/neo4j/repository/test/DeviceRepository.java

@@ -0,0 +1,41 @@
+package neo4j.repository.test;
+
+
+import neo4j.model.test.Device;
+import neo4j.relation.test.FeatureInfoGroupByDevice;
+import org.springframework.data.neo4j.annotation.Query;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
+
+/**
+ * @program: neo4j-demo
+ * @description: 朋友关系
+ * @author: Jamie.shi
+ * @create: 2020-05-27 11:28
+ **/
+public interface DeviceRepository extends Neo4jRepository<Device, Long> {
+    /**
+     * 返回某系统下所有设备
+     */
+    @Query("MATCH p =(n:MetroSystem)-[r:SystemDevice]->(m:Device) WHERE n.name=$ name RETURN m")
+    List<Device> findDevices(String name);
+
+    /**
+     * 根据名字查找
+     */
+    Device findByName(@Param("name") String name);
+
+    /**
+     * 查询满足 (设备)-[属性]-(设备属性)-[属性]-(设备) 关系的 设备
+     */
+    @Query("match (s:Device)-[:DeviceFeature]->(l:Feature)<-[:DeviceFeature]-(:Device) with l.name as featureName,collect(distinct s) as devices return featureName,devices")
+    List<FeatureInfoGroupByDevice> findFeatureInfoGroupByDevice();
+
+    /**
+     * 查询满足 (设备)-[属性]-(设备属性)-[属性]-(设备) 关系的 设备
+     */
+    @Query("match (s:Device)-[:DeviceFeature]->(l:Feature)<-[:DeviceFeature]-(:Device) with l.name as featureName,collect(distinct s) as devices WHERE l.name=$ name return featureName,devices")
+    List<FeatureInfoGroupByDevice> findFeatureInfoGroupByDeviceWithName(String name);
+}

+ 32 - 0
neo4j_metro/src/main/java/neo4j/repository/test/FeatureRepository.java

@@ -0,0 +1,32 @@
+package neo4j.repository.test;
+
+import neo4j.model.test.Feature;
+import org.springframework.data.neo4j.annotation.Query;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+import java.util.List;
+
+/**
+ * @program: neo4j-demo
+ * @description:
+ * @author: kane
+ * @create: 2020-05-27 10:37
+ **/
+public interface FeatureRepository extends Neo4jRepository<Feature, Long> {
+    /**
+     * 根据名字查找
+     */
+    Feature findByName(String name);
+
+    /**
+     * 返回某设备下所有设备属性
+     */
+    @Query("MATCH p =(n:Device)-[r:DeviceFeature]->(m:Feature) WHERE n.name=$name RETURN m")
+    List<Feature> findFeature(String name);
+
+    /**
+     * 返回某系统下所有设备
+     */
+    @Query("MATCH p =(n:Device)-[r:DeviceFeature]->(m:Feature) with collect(distinct m) as features RETURN features")
+    List<Feature> findFeature();
+}

+ 21 - 0
neo4j_metro/src/main/java/neo4j/repository/test/SystemDeviceRepository.java

@@ -0,0 +1,21 @@
+package neo4j.repository.test;
+
+import neo4j.relation.test.SystemDevice;
+import org.springframework.data.neo4j.annotation.Query;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+import java.util.List;
+
+/**
+ * @program: neo4j-demo
+ * @description: 系统->设备关系
+ * @author: xuYJ
+ * @create: 2021-03-17 15:40
+ **/
+public interface SystemDeviceRepository extends Neo4jRepository<SystemDevice, Long> {
+    /**
+     * 返回某系统下所有设备关系
+     */
+    @Query("MATCH p=(MetroSystem)-[r:SystemDevice]-(Device) RETURN p")
+    List<SystemDevice> findSystemDevices();
+}

+ 35 - 0
neo4j_metro/src/main/java/neo4j/repository/test/SystemRepository.java

@@ -0,0 +1,35 @@
+package neo4j.repository.test;
+
+import neo4j.model.test.MetroSystem;
+import neo4j.relation.test.FeatureSystem;
+import org.springframework.data.neo4j.annotation.Query;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
+
+/**
+ * @program: neo4j-demo
+ * @description:
+ * @author: kane
+ * @create: 2020-05-27 10:37
+ **/
+public interface SystemRepository extends Neo4jRepository<MetroSystem, Long> {
+
+    /**
+     * 根据名字查找
+     */
+    MetroSystem findByName(@Param("name") String name);
+
+    /**
+     * 查询系统和设备属性关系,(系统)-[子设备]-(设备)-[属性]-(设备属性)
+     */
+    @Query("match ((s:MetroSystem)-[:SystemDevice]->(:Device)-[:DeviceFeature]->(t:Feature))with t.name as featureName,collect(distinct s) as metroSystems return featureName,metroSystems")
+    List<FeatureSystem> findFeatureBySys();
+
+    /**
+     * 查询系统和设备属性关系,(系统)-[子设备]-(设备)-[属性]-(设备属性)
+     */
+    @Query("match ((s:MetroSystem)-[:SystemDevice]->(:Device)-[:DeviceFeature]->(t:Feature))with t.name as featureName,collect(distinct s) as metroSystems WHERE t.name=$ name return featureName,metroSystems")
+    List<FeatureSystem> findFeatureBySys(String name);
+}

+ 4 - 0
neo4j_metro/src/main/resources/application.properties

@@ -0,0 +1,4 @@
+
+spring.data.neo4j.uri=http://192.168.20.61:7474
+spring.data.neo4j.username=neo4j
+spring.data.neo4j.password=sw12345

+ 63 - 0
pom.xml

@@ -0,0 +1,63 @@
+<?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>org.sunwin</groupId>
+    <artifactId>sunwin_metro</artifactId>
+    <packaging>pom</packaging>
+    <version>1.0-SNAPSHOT</version>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.3.0.RELEASE</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <modules>
+        <module>neo4j_metro</module>
+        <module>insert_neo4j</module>
+    </modules>
+
+<dependencies>
+    <!-- 日志pom -->
+    <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-api</artifactId>
+        <version>1.7.25</version>
+        <scope>provided</scope>
+    </dependency>
+    <dependency>
+        <groupId>log4j</groupId>
+        <artifactId>log4j</artifactId>
+        <version>1.2.17</version>
+        <scope>provided</scope>
+    </dependency>
+
+    <!-- fastJson -->
+    <dependency>
+        <groupId>com.alibaba</groupId>
+        <artifactId>fastjson</artifactId>
+        <version>1.2.73</version>
+    </dependency>
+
+    <dependency>
+        <groupId>commons-lang</groupId>
+        <artifactId>commons-lang</artifactId>
+        <version>2.6</version>
+    </dependency>
+
+    <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>4.10</version>
+    </dependency>
+
+    <dependency>
+        <groupId>com.chinaway</groupId>
+        <artifactId>sw-http-client</artifactId>
+        <version>1.1-test</version>
+    </dependency>
+
+</dependencies>
+</project>