Commit fa8898b2 authored by wuqinghua's avatar wuqinghua

吴卿华-2021/11/11 公安经侦代码

parents
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if (mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if (mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if (!outputFile.getParentFile().exists()) {
if (!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>gajz</artifactId>
<version>0.0.1</version>
<name>gajz</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- mybatis数据库依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.5</version>
</dependency>
<!--数据库连接池依赖 druid数据库连接池 阿里巴巴-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.8</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.19</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
</dependency>
<!--接口参数校验依赖-->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.7.Final</version>
</dependency>
<!--百度图数据库 HugeGraph-Client 依赖-->
<dependency>
<groupId>com.baidu.hugegraph</groupId>
<artifactId>hugegraph-client</artifactId>
<version>1.9.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!--Springboot热部署-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<!--easyExcel依赖-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>2.2.7</version>
</dependency>
<!-- Neo4j dependency -->
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>3.2.6</version>
</dependency>
<dependency>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>4.3.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
<!--Redis-->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.0.0</version>
</dependency>
<!-- 整合redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<!-- <version>3.5.1</version> -->
<configuration>
<compilerArgs>
<!-- 过期的方法的警告-->
<arg>-Xlint:deprecation</arg>
</compilerArgs>
<compilerArguments>
<!-- 是否输出所有的编译信息(包括类的加载等)-->
<!--<verbose />-->
<!-- 解决maven命令编译报错,因为rt.jar 和jce.jar在jre的lib下面,不在jdk的lib下面,
导致maven找不到(java7以后会出现这个问题),将这2个jar包拷贝到jdk的lib下面估计也好使-->
<bootclasspath>${java.home}\lib\rt.jar;${java.home}\lib\jce.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
</project>
package com.example.gajz;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class GajzApplication {
public static void main(String[] args) {
SpringApplication.run(GajzApplication.class, args);
System.out.println("启动完成");
}
}
package com.example.gajz.redis;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
/**
* redis连接池
* @author lenovo
*/
public class ConFigRedis {
private static JedisPool pool = null;
/**
* 获取jedis连接池
* */
public static JedisPool getPool(){
if(pool == null){
//创建jedis连接池配置
JedisPoolConfig config = new JedisPoolConfig();
//最大连接数
config.setMaxTotal(100);
//最大空闲连接
config.setMaxIdle(20);
//创建redis连接池
/**服务器*/
// pool = new JedisPool(config,"127.0.0.1",6379,30000,"1qaz2wsx3edc");
/**本地*/
pool = new JedisPool(config,"127.0.0.1",6379,30000);
}
return pool;
}
/**
* 获取jedis连接
* */
public static Jedis getConn()
{
return getPool().getResource();
}
}
package com.example.gajz.result;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data //提供getter、setter方法
@NoArgsConstructor //无参构造
public class Result {
private boolean success;
private Integer code;
private String message;
private Object data;
//不需要返回数据时使用
public Result(ResultCode code) {
this.success = code.success;
this.code = code.code;
this.message = code.message;
}
public Result(ResultCode code,Object data) {
this.success = code.success;
this.code = code.code;
this.message = code.message;
this.data = data;
}
public Result(Integer code,String message,boolean success) {
this.code = code;
this.message = message;
this.success = success;
}
/*
* 调用ResultCode类封装常用的返回数据
*/
public static Result SUCCESS(){
return new Result(ResultCode.SUCCESS);
}
public static Result ERROR(){
return new Result(ResultCode.SERVER_ERROR);
}
public static Result FAIL(){
return new Result(ResultCode.FAIL);
}
}
package com.example.gajz.result;
/**
* 公共的返回码
* 返回码code:
* 成功:200
* 失败:500
* 未登录:10002
* 未授权:10003
* 抛出异常:99999
*/
public enum ResultCode {
SUCCESS(true,200,"成功"),
//---系统错误返回码-----
FAIL(false,500,"失败"),
UNAUTHENTICATED(false,10002,"您还未登录"),
UNAUTHORISE(false,10003,"权限不足"),
SERVER_ERROR(false,99999,"抱歉,系统繁忙,请稍后重试!"),
//---用户操作返回码 2xxxx----
MOBILEORPASSWORDERROR(false,20001,"用户名或密码错误");
//---企业操作返回码 3xxxx----
//---权限操作返回码----
//---其他操作返回码----
//操作是否成功
boolean success;
//操作代码
int code;
//提示信息
String message;
ResultCode(boolean success,int code, String message){
this.success = success;
this.code = code;
this.message = message;
}
public boolean success() {
return success;
}
public int code() {
return code;
}
public String message() {
return message;
}
}
package com.example.gajz.transferrelationship.bean.dto;
import lombok.Data;
import lombok.ToString;
/**
* @author lenovo
*/
@Data
@ToString
public class Source {
private String id;
}
package com.example.gajz.transferrelationship.bean.dto;
import lombok.Data;
import lombok.ToString;
/**
* @author lenovo
*/
@Data
@ToString
public class Target {
private String id;
}
package com.example.gajz.transferrelationship.bean.dto;
import lombok.Data;
import lombok.ToString;
/**
* @author lenovo
*/
@Data
@ToString
public class TransferRelationship {
private Source source;
private Target target;
private TransferTimes TransferTimes;
}
package com.example.gajz.transferrelationship.bean.dto;
import lombok.Data;
import lombok.ToString;
/**
* 转账次数
*/
@Data
@ToString
public class TransferTimes {
/**
* 转账次数
*/
private int transferTimes;
/**
* 线大小
*/
private double lineSize;
}
package com.example.gajz.transferrelationship.bean.dto;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
public class data {
private String id;
private String name;
private String source;
}
package com.example.gajz.transferrelationship.bean.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import lombok.ToString;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.time.DateTimeException;
import java.util.Date;
/**
* 转账关系图Excel封装类
*/
@Data
@ToString
public class abcExcie {
/**
* 主键
*/
@ExcelProperty(value = "id",index = 0)
private int id;
/**
* 身份证号
*/
@ExcelProperty(value = "id_card",index = 1)
private String id_card;
/**
* 手机号
*/
@ExcelProperty(value = "mobile",index = 2)
private String mobile;
/**
* 本端账户名
*/
@ExcelProperty(value = "bank_account_name",index = 3)
private String bank_account_name;
/**
* 本端账号
*/
@ExcelProperty(value = "bank_account_no",index = 4)
private String bank_account_no;
/**
* 本端卡号
*/
@ExcelProperty(value = "bank_card_no",index = 5)
private String bank_card_no;
/**
* 曾用卡号
*/
@ExcelProperty(value = "temp_a",index = 6)
private String temp_a;
/**
* 本端账户开户行
*/
@ExcelProperty(value = "bank_name",index = 7)
private String bank_name;
/**
* 是否属资金池,0是1否
*/
@ExcelProperty(value = "is_capital_pool",index = 8)
private int is_capital_pool;
/**
* 交易时间
*/
@ExcelProperty(value = "trade_date",index = 9)
private String trade_date;
/**
* 记账时间
*/
@ExcelProperty(value = "trade_time",index = 10)
private String trade_time;
/**
* 收付标志,0收1支
*/
@ExcelProperty(value = "payment_mark",index = 11)
private int payment_mark;
/**
* 借方发生额(支出)
*/
@ExcelProperty(value = "temp_c",index = 12)
private BigDecimal temp_c;
/**
* 贷方发生额(收入)
*/
@ExcelProperty(value = "temp_d",index = 13)
private BigDecimal temp_d;
/**
* 交易金额
*/
@ExcelProperty(value = "pay_amount",index = 14)
private BigDecimal pay_amount;
/**
* 余额
*/
@ExcelProperty(value = "balance",index = 15)
private BigDecimal balance;
/**
* 目的、用途
*/
@ExcelProperty(value = "purpose",index = 16)
private int purpose;
/**
* 分红性质类别
*/
@ExcelProperty(value = "bonus",index = 17)
private int bonus;
/**
* 其他交易性质
*/
@ExcelProperty(value = "trade_nature",index = 18)
private int trade_nature;
/**
* 审计备注列1
*/
@ExcelProperty(value = "temp_f",index = 19)
private String temp_f;
/**
* 审计备注列2
*/
@ExcelProperty(value = "temp_g",index = 20)
private String temp_g;
/**
* 对端户名
*/
@ExcelProperty(value = "end_account_name",index = 21)
private String end_account_name;
/**
* 对端卡号
*/
@ExcelProperty(value = "end_card_no",index = 22)
private String end_card_no;
/**
* 对端开户行
*/
@ExcelProperty(value = "end_bank_name",index = 23)
private String end_bank_name;
/**
* 交易摘要
*/
@ExcelProperty(value = "remark",index = 24)
private String remark;
/**
* 交易备注
*/
@ExcelProperty(value = "comment",index = 25)
private String comment;
/**
* 交易场所
*/
@ExcelProperty(value = "treade_place",index = 26)
private String treade_place;
}
package com.example.gajz.transferrelationship.bean.param;
import lombok.Data;
import lombok.ToString;
/**
* 关系图 点参数封装类
*/
@Data
@ToString
public class Dot {
/**
* 圆点 转账人 接收人卡号
*/
private String id;
/**
* 圆点 转账人 接收人姓名
*/
private String name;
/**
* 圆点颜色
*/
private String color;
/**
* 圆点x轴
*/
private int x;
/**
* 圆点y轴
*/
private int y;
/**
* 圆点大小
*/
private double size;
/**
* 转账次数
*/
private int TransferTimes;
/**
* 上级卡号
*/
private String relationship;
}
package com.example.gajz.transferrelationship.bean.param;
import lombok.Data;
import lombok.ToString;
/**
* 查询两人转账关系 (关系图) 接口参数封装类
*/
@Data
@ToString
public class TransferAssociationParam {
/**
* 转账人
*/
private String transfer;
/**
* 收款人
*/
private String payee;
}
package com.example.gajz.transferrelationship.bean.param;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
public class data {
/**
* 转账人
*/
private String source;
/**
* 收款人
*/
private String target;
/**
* 收款人姓名
*/
private String name;
/**
* 转账次数
*/
private int transferTimes;
}
package com.example.gajz.transferrelationship.bean.vo;
import lombok.Data;
import lombok.ToString;
/**
* echarts转账人 接收人 返回值封装类
* @author lenovo
*/
@Data
@ToString
public class EchartsUserVo {
/**
* 点 id
*/
private String name;
/**
* x轴
*/
private int x;
/**
* y轴
*/
private int y;
}
package com.example.gajz.transferrelationship.bean.vo;
import com.example.gajz.transferrelationship.bean.dto.data;
import lombok.Data;
import lombok.ToString;
/**
* @author lenovo
*/
@Data
@ToString
public class RelationshipVo {
private data data;
// private String group;
// private String classes;
}
package com.example.gajz.transferrelationship.bean.vo;
import lombok.Data;
import lombok.ToString;
/**
* 关系图搜索接口返回值封装类
*/
@Data
@ToString
public class SearchRelationshipVo {
/**
* 转账关系
*/
private String relationship;
/**
* 姓名
*/
private String name;
/**
* 卡号
*/
private String cardNumber;
/**
* 是否拥有下级
*/
private Boolean subordinate;
/**
* 转账次数
*/
private int transferTimes;
/**
* 圆点颜色
*/
private String color;
/**
* 圆点大小
*/
private int size;
/**
* x轴
*/
private int x;
/**
* y轴
*/
private int y;
/**
* 层级
*/
private int hierarchy;
/**
* 下级数量
*/
private int subordinateQuantity;
}
package com.example.gajz.transferrelationship.bean.vo;
import lombok.Data;
import lombok.ToString;
/**
*
* @author lenovo
*/
@Data
@ToString
public class Test {
/**
* 圆点 转账人 接收人卡号
*/
private String id;
/**
* 圆点 转账人 接收人姓名
*/
private String name;
/**
* 圆点颜色
*/
private String color;
/**
* 圆点x轴
*/
private int x;
/**
* 圆点y轴
*/
private int y;
/**
* 圆点大小
*/
private double size;
}
package com.example.gajz.transferrelationship.bean.vo;
import lombok.Data;
import lombok.ToString;
/**
* 转账卡号返回值封装类
* @author lenovo
*/
@Data
@ToString
public class TransferCardVo {
/**
* 卡号
*/
private String bankCardNo;
/**
* 姓名
*/
private String name;
}
package com.example.gajz.transferrelationship.bean.vo;
import lombok.Data;
import lombok.ToString;
/**
* 转账关系封装类
* @author lenovo
*/
@Data
@ToString
public class TransferRelationshipVo {
private com.example.gajz.transferrelationship.bean.param.data data;
}
package com.example.gajz.transferrelationship.bean.vo;
import lombok.Data;
/**
* 被转账人信息封装类
* @author lenovo
*/
@Data
public class TransferredPersonVo {
/**
* id
*/
private int id;
/**
* 转账人卡号
*/
private long bankCardNo;
/**
* 被转账人卡号
*/
private String endCardNo;
/**
* 转账次数(集合个数)
*/
private String number;
}
package com.example.gajz.transferrelationship.bean.vo;
import lombok.Data;
import lombok.ToString;
/**
* 查询单人转账关系返回值封装类
*/
@Data
@ToString
public class personalTransferRelationshipVo {
/**
* 转账人
*/
private String source;
/**
* 收款人
*/
private String target;
/**
* 转账次数
*/
private int transferTimes;
}
package com.example.gajz.transferrelationship.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.example.gajz.result.Result;
import com.example.gajz.result.ResultCode;
import com.example.gajz.transferrelationship.bean.dto.data;
import com.example.gajz.transferrelationship.bean.excel.abcExcie;
import com.example.gajz.transferrelationship.bean.param.TransferAssociationParam;
import com.example.gajz.transferrelationship.bean.vo.SearchRelationshipVo;
import com.example.gajz.transferrelationship.service.TransferRelationshipService;
import org.apache.poi.openxml4j.util.ZipSecureFile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* @author lenovo
*/
@CrossOrigin(origins = "*")
@Controller
public class TransferRelationshipController {
@Autowired
TransferRelationshipService transferRelationshipService;
/**
* 转账关系
*/
@ResponseBody
@RequestMapping("/edge")
private List<data> edge(){
List<data> edge = transferRelationshipService.edge();
return edge;
}
/**
* 点
*/
@ResponseBody
@RequestMapping("/diagramSpot")
private List diagramSpot(){
List list = transferRelationshipService.diagramSpot();
return list;
}
/**
* 关系图 搜索接口
* @param name
* @return
*/
@ResponseBody
@RequestMapping("/pointSearch")
private Result pointSearch(String name){
Result result = transferRelationshipService.pointSearch(name);
return result;
}
/**
* 关系图搜索 单人转账关系(关联关系) (点)接口
* @param cardnumbe
* @return
*/
@ResponseBody
@RequestMapping("/searchRelationship")
private Result searchRelationship(String cardnumbe){
Result result = transferRelationshipService.searchRelationship(cardnumbe);
return result;
}
/**
* 关系图搜索 单人转账关系 转账信息信息查询接口
* @return
*/
@ResponseBody
@RequestMapping("/personalTransferRelationship")
public Result personalTransferRelationship(){
Result result = transferRelationshipService.personalTransferRelationship();
return result;
}
/**
* 关系图搜索 点击查询某一个点的具体位置
*/
@ResponseBody
@RequestMapping("/specificLocation")
private Result specificLocation(String id){
Result result = transferRelationshipService.specificLocation(id);
return result;
}
/**
* 查询两人转账关系 点 (关系图) 接口
* @param transferAssociationParam
* @return
*/
@ResponseBody
@RequestMapping("/transferAssociation")
private Result transferAssociation(TransferAssociationParam transferAssociationParam){
Result result = transferRelationshipService.transferAssociation(transferAssociationParam);
return result;
}
/**
* 查询两人转账关系 关系 (关系图) 接口
* @param transferAssociationParam
* @return
*/
@ResponseBody
@RequestMapping("/trBetweenTwoPersons")
private Result trBetweenTwoPersons(@RequestBody List<SearchRelationshipVo> transferAssociationParam){
Result result = transferRelationshipService.trBetweenTwoPersons(transferAssociationParam);
return result;
}
/**
* 关系导入
*/
@ResponseBody
@RequestMapping("/transferRelationshipFile")
private Result saveSerialNo(MultipartFile file,int Accumulate) throws IOException {
//判断是否清空之前数据 0是清空 1是累加
if (Accumulate==0){
//清空关系图数据表
transferRelationshipService.emptyTransferRelationship();
}
/**
* 存储员工对象
*/
List<abcExcie> eSerialsList = new ArrayList<>();
ZipSecureFile.setMinInflateRatio(-1.0d);
EasyExcel.read(file.getInputStream(),
abcExcie.class,
new AnalysisEventListener<abcExcie>() {
//easyExcel每次从Excel中读取一行数据就会调用一次invoke方法
@Override
public void invoke(abcExcie serialEntity, AnalysisContext analysisContext) {
abcExcie abcexcie = new abcExcie();
//id
abcexcie.setId(serialEntity.getId());
//身份证号
abcexcie.setId_card(serialEntity.getId_card());
//手机号
abcexcie.setMobile(serialEntity.getMobile());
//本端账户名
abcexcie.setBank_account_name(serialEntity.getBank_account_name());
//本端账号
abcexcie.setBank_account_no(serialEntity.getBank_account_no());
//本端卡号
abcexcie.setBank_card_no(serialEntity.getBank_card_no());
//曾用卡号
abcexcie.setTemp_a(serialEntity.getTemp_a());
//本端账户开户行
abcexcie.setBank_name(serialEntity.getBank_name());
//是否属资金池,0是1否
abcexcie.setIs_capital_pool(serialEntity.getIs_capital_pool());
//交易时间
abcexcie.setTrade_date(serialEntity.getTrade_date());
//记账时间
abcexcie.setTrade_time(serialEntity.getTrade_time());
//收付标志,0收1支
abcexcie.setPayment_mark(serialEntity.getPayment_mark());
//借方发生额(支出)
abcexcie.setTemp_c(serialEntity.getTemp_c());
//贷方发生额(收入)
abcexcie.setTemp_d(serialEntity.getTemp_d());
//交易金额
abcexcie.setPay_amount(serialEntity.getPay_amount());
//余额
abcexcie.setBalance(serialEntity.getBalance());
//目的、用途
abcexcie.setPurpose(serialEntity.getPurpose());
//分红性质类别
abcexcie.setBonus(serialEntity.getBonus());
//其他交易性质
abcexcie.setTrade_nature(serialEntity.getTrade_nature());
//审计备注列1
abcexcie.setTemp_f(serialEntity.getTemp_f());
//审计备注列2
abcexcie.setTemp_g(serialEntity.getTemp_g());
//对端户名
abcexcie.setEnd_account_name(serialEntity.getEnd_account_name());
//对端卡号
abcexcie.setEnd_card_no(serialEntity.getEnd_card_no());
//对端开户行
abcexcie.setEnd_bank_name(serialEntity.getEnd_bank_name());
//交易摘要
abcexcie.setRemark(serialEntity.getRemark());
//交易备注
abcexcie.setComment(serialEntity.getComment());
//交易场所
abcexcie.setTreade_place(serialEntity.getTreade_place());
eSerialsList.add(abcexcie);
}
//easyExcel在将Excel表中数据读取完毕后,最终执行此方法
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
int t=0;
int quantityPerServing =1000; //每份1w次插入数据
for (int s=0;t<=eSerialsList.size();){
List<abcExcie> eSerialsList1 = new ArrayList<>();
for (int i=0;t<quantityPerServing;t++){
if (t<eSerialsList.size()){
abcExcie abcExcie=new abcExcie();
//身份证号
abcExcie.setId_card(eSerialsList.get(t).getId_card());
//手机号
abcExcie.setMobile(eSerialsList.get(t).getMobile());
//本端账户名
abcExcie.setBank_account_name(eSerialsList.get(t).getBank_account_name());
//本端账号
abcExcie.setBank_account_no(eSerialsList.get(t).getBank_account_no());
//本端卡号
abcExcie.setBank_card_no(eSerialsList.get(t).getBank_card_no());
//曾用卡号
abcExcie.setTemp_a(eSerialsList.get(t).getTemp_a());
//本端账户开户行
abcExcie.setBank_name(eSerialsList.get(t).getBank_name());
//是否属资金池,0是1否
abcExcie.setIs_capital_pool(eSerialsList.get(t).getIs_capital_pool());
//交易时间
abcExcie.setTrade_date(eSerialsList.get(t).getTrade_date());
//记账时间
if (!"1899/12/31 0:00:00".equals(eSerialsList.get(t).getTrade_time())){
abcExcie.setTrade_time(eSerialsList.get(t).getTrade_time());
}else {
abcExcie.setTrade_time(null);
}
//收付标志,0收1支
abcExcie.setPayment_mark(eSerialsList.get(t).getPayment_mark());
//借方发生额(支出)
abcExcie.setTemp_c(eSerialsList.get(t).getTemp_c());
//贷方发生额(收入)
abcExcie.setTemp_d(eSerialsList.get(t).getTemp_d());
//交易金额
abcExcie.setPay_amount(eSerialsList.get(t).getPay_amount());
//余额
abcExcie.setBalance(eSerialsList.get(t).getBalance());
//目的、用途
abcExcie.setPurpose(eSerialsList.get(t).getPurpose());
//分红性质类别
abcExcie.setBonus(eSerialsList.get(t).getBonus());
//其他交易性质
abcExcie.setTrade_nature(eSerialsList.get(t).getTrade_nature());
//审计备注列1
abcExcie.setTemp_f(eSerialsList.get(t).getTemp_f());
//审计备注列2
abcExcie.setTemp_g(eSerialsList.get(t).getTemp_g());
//对端户名
abcExcie.setEnd_account_name(eSerialsList.get(t).getEnd_account_name());
//对端卡号
abcExcie.setEnd_card_no(eSerialsList.get(t).getEnd_card_no());
//对端开户行
abcExcie.setEnd_bank_name(eSerialsList.get(t).getEnd_bank_name());
//交易摘要
abcExcie.setRemark(eSerialsList.get(t).getRemark());
//交易备注
abcExcie.setComment(eSerialsList.get(t).getComment());
//交易场所
abcExcie.setTreade_place(eSerialsList.get(t).getTreade_place());
eSerialsList1.add(abcExcie);
}
}
transferRelationshipService.insertTransferRelationship(eSerialsList1);
quantityPerServing=quantityPerServing+1000;
}
}
}).sheet().doRead();//sheet()参数指定,默认读取第一张工作表
return new Result(ResultCode.SUCCESS,eSerialsList);
}
}
package com.example.gajz.transferrelationship.dao;
import com.example.gajz.transferrelationship.bean.excel.abcExcie;
import com.example.gajz.transferrelationship.bean.vo.SearchRelationshipVo;
import com.example.gajz.transferrelationship.bean.vo.TransferCardVo;
import com.example.gajz.transferrelationship.bean.vo.personalTransferRelationshipVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author lenovo
*/
@Mapper
public interface TransferRelationshipMapper {
/**
* 查询全部转账卡号方法
* @return
*/
List<TransferCardVo> selectTransferCard();
/**
* 转账关系
* @return
*/
List<com.example.gajz.transferrelationship.bean.param.data> edge();
/**
* 查询被转账人全部信息
* @return
* @param bankCardNo
*/
List<com.example.gajz.transferrelationship.bean.param.data> transferRelationship(String bankCardNo);
/**
* 查询转账记录
* @param cardNumber
* @param fullName
*/
List<SearchRelationshipVo> transferRecord(String cardNumber, String fullName);
/**
* 查询搜索人被转账记录
* @param cardNumber
* @param fullName
* @return
*/
List<SearchRelationshipVo> transferredRecord(String cardNumber, String fullName);
/**
* 查询搜索人信息 转账人
* @param cardnumbe
* @return
*/
List<SearchRelationshipVo> personalInformationTransferor(String cardnumbe);
/**
* 查询搜索人信息 被转账人
* @param cardnumbe
* @return
*/
List<SearchRelationshipVo> personalInformationTransferredPerson(String cardnumbe);
/**
* 清空关系图数据表
*/
void emptyTransferRelationship();
/**
* excel数据导入数据库
* @param eSerialsList
*/
void insertTransferRelationship(List<abcExcie> eSerialsList);
/**
*查询搜索人关联下一级数据
* @param cardNumber
* @return
*/
List<SearchRelationshipVo> querySubordinate(String cardNumber);
/**
* 查询转账人
* @param cardNumber
* @param fullName
* @return
*/
List<SearchRelationshipVo> queryTransferor(String cardNumber, String fullName);
/**
* 查询被转账人
* @param cardNumber
* @param fullName
* @return
*/
List<SearchRelationshipVo> queryTheTransferredPerson(String cardNumber, String fullName);
/**
* 查询单人转账关系
* @param cardnumbe
*/
List<personalTransferRelationshipVo> personalTransferRelationship(String cardnumbe);
/**
* 查询上级转账人方法
* @param cardNumbe
* @return
*/
List<SearchRelationshipVo> querySuperior(String cardNumbe);
/**
* 查询两人转账关系 关系 (关系图) 接口
* @param cardNumber
* @return
*/
List<personalTransferRelationshipVo> trBetweenTwoPersons(String cardNumber);
}
package com.example.gajz.transferrelationship.file;
/**
* Project Name:cscm-base-vipshop
* File Name:SqlHelper.java
* Package Name:cn.ivg.controller
* Date:2019年7月28日上午12:45:08
* Copyright (c) 2019, bluemobi All Rights Reserved.
*
*/
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.ibatis.io.Resources;
/*
* 使用java以及jdbc执行sql脚本的工具示例代码
*/
public class SqlTest {
public static void main(String[] args) throws IOException {
String path = Resources.getResourceAsFile("D:\\abc_statement.sql").getAbsolutePath();
String sql = getText(path);
List<String> sqlarr = getSql(sql);
for (String string : sqlarr) {
System.out.println(string);
}
try {
SqlTest.execute(getConn(), sqlarr);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void execute(Connection conn, List<String> sqlFile) throws Exception {
Statement stmt = null;
stmt = conn.createStatement();
for (String sql : sqlFile) {
sql = sql.trim();
if (sql != null && !sql.equals(""))
stmt.addBatch(sql);
}
int[] rows = stmt.executeBatch();
System.out.println("Row count:" + Arrays.toString(rows));
conn.close();
}
private static Connection getConn() {
String url = "jdbc:mysql://localhost:3306/ga?serverTimezone=UTC";
String username = "root";
String password = "123456";
String driver = "com.mysql.jdbc.Driver";
Connection conn = null;
try {
Class.forName(driver); // classLoader,加载对应驱动
conn = DriverManager.getConnection(url, username, password);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return conn;
}
/*
* getText方法吧path路径里面的文件按行读数来放入一个大的String里面去 并在换行的时候加入\r\n
*/
public static String getText(String path) {
File file = new File(path);
if (!file.exists() || file.isDirectory()) {
return null;
}
StringBuilder sb = new StringBuilder();
try {
FileInputStream fis = new FileInputStream(path);
InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
BufferedReader br = new BufferedReader(isr);
String temp = null;
temp = br.readLine();
boolean flag = true;
while (temp != null) {
if (temp.length() >= 2) {
String str1 = temp.substring(0, 1);
String str2 = temp.substring(0, 2);
if (str1.equals("#") || str2.equals("--") || str2.equals("//")) {
temp = br.readLine();
continue;
}
if (str2.equals("/*")) {// 因为/**/是注释有/*时,直到遇到*/才开始添加
flag = false;
}
if (str2.equals("*/")) {
flag = true;
temp = "";
}
if (flag) {
sb.append(temp + "\r\n");
}
}
temp = br.readLine();
}
br.close();
} catch (Exception e) {
e.printStackTrace();
}
return sb.toString();
}
/*
* getSqlArray方法 从文件的sql字符串中分析出能够独立执行的sql语句并返回
*/
public static List<String> getSql(String sql) {
String s = sql;
s = s.replaceAll("\r\n", "\r");
s = s.replaceAll("\r", "\n");
List<String> ret = new ArrayList<String>();
String[] sqlarry = s.split(";"); // 用;把所有的语句都分开成一个个单独的句子
sqlarry = filter(sqlarry);
ret = Arrays.asList(sqlarry);
return ret;
}
public static String[] filter(String[] ss) {
List<String> strs = new ArrayList<String>();
for (String s : ss) {
if (s != null && !s.equals("")) {
strs.add(s);
}
}
String[] result = new String[strs.size()];
for (int i = 0; i < strs.size(); i++) {
result[i] = strs.get(i).toString();
}
return result;
}
}
\ No newline at end of file
package com.example.gajz.transferrelationship.file;
import java.io.*;
import java.sql.*;
/**
* 读取指定文件下sql脚本,执行到数据库
* 朱行读取分批处理批量插入数据库
*/
public class TestReadFile {
public static void main(String[] args) {
System.err.println("begin");
long start = System.currentTimeMillis();
String path = "D:\\abc_statement.sql";
getData(path);
System.err.print((System.currentTimeMillis() - start) / 1000);
}
private static void getData(String path) {
//读取文件
BufferedReader reader;
Connection conn = null;
Statement pst = null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
conn = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/ga?serverTimezone=UTC", "root", "123456");
pst = conn.createStatement();
reader = new BufferedReader(new InputStreamReader(new FileInputStream(path), "UTF-8"));
String line;
int i = 0;
while ((line = reader.readLine()) != null) {
pst.addBatch(line);
/* System.out.println("-----------------------");
System.out.println(line);
System.out.println("-----------------------");*/
if (i % 100 == 0) {
System.out.println("执行了:" + i);
pst.executeBatch();
}
i += 1;
}
reader.close();
// 执行批量更新
pst.executeBatch();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (pst != null) {
pst.close();
}
if (conn != null) {
conn.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
package com.example.gajz.transferrelationship.hugegraphclient;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.driver.SchemaManager;
import com.baidu.hugegraph.structure.constant.T;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import com.example.gajz.transferrelationship.thread.*;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* HugeGraph
* @author lenovo
*/
@Service
public class HugeCollectionProperties {
/**
* 创建转账人 集合顶点 转账人集合关系方法
*/
public void createCollectionProperties(List<TransferredPersonVo> transferredPersonVos){
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
try {
//创建属性
SchemaManager schema = hugeClient.schema();
schema.propertyKey("卡号").asText().ifNotExist().create();
schema.propertyKey("转账次数").asText().ifNotExist().create();
//创建集合顶点
/**设置顶点名称*/
schema.vertexLabel("单独转账交易人数")
/**设置主键为传入*/
.useCustomizeNumberId()
/**设置顶点属性*/
.properties("转账次数")
/**判断设置顶点 如果已经存在就不创建*/
.ifNotExist().create();
//创建转账人顶点
/**设置顶点名称*/
schema.vertexLabel("转账人")
/**设置主键为传入*/
.useCustomizeNumberId()
/**判断设置顶点 如果已经存在就不创建*/
.ifNotExist().create();
//创建边
/**设置边名称*/
schema.edgeLabel("转账")
/**起点顶点*/
.sourceLabel("转账人")
/**终点顶点*/
.targetLabel("单独转账交易人数")
/**边参数*/
.properties("转账次数")
.ifNotExist()
.create();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferredPersonVos.size();i++){
/**添加集合顶点数据*/
Vertex aggregate = graph.addVertex(
/**设置ID*/
T.id, transferredPersonVos.get(i).getId(),
T.label, "单独转账交易人数",
/**设置转账次数*/
"转账次数", transferredPersonVos.get(i).getNumber());
/**添加转账人顶点数据*/
Vertex transferor = graph.addVertex(
/**设置ID*/
T.id, transferredPersonVos.get(i).getBankCardNo(),
T.label, "转账人");
//创建转账关系
transferor.addEdge("转账", aggregate, "转账次数", transferredPersonVos.get(i).getNumber());
}
hugeClient.close();
}catch (Exception e){
hugeClient.close();
}
}
/**
* 创建多条收款人顶点方法
*/
public void createMultiplePayees(List<TransferredPersonVo> multiplePayeesList){
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("收款人导入开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
try {
//创建属性
SchemaManager schema = hugeClient.schema();
schema.propertyKey("收款次数").asText().ifNotExist().create();
//创建集合顶点
/**设置顶点名称*/
schema.vertexLabel("收款人")
/**设置主键为传入*/
.useCustomizeStringId()
/**设置顶点属性*/
.properties("收款次数")
/**判断设置顶点 如果已经存在就不创建*/
.ifNotExist().create();
hugeClient.close();
//每个线程执行多少条
int numberExecution=(multiplePayeesList.size()/12)+1;
//导入线程1
ThreadsMultipleVerticesOne transferAccountsOne=new ThreadsMultipleVerticesOne();
transferAccountsOne.ThreadsMultipleVerticesOneList(multiplePayeesList.subList(0,numberExecution));
Thread ThreadOne = new Thread(transferAccountsOne);
ThreadOne.start();
//导入线程2
ThreadsMultipleVerticesTwo transferAccountsTwo=new ThreadsMultipleVerticesTwo();
transferAccountsTwo.ThreadsMultipleVerticesTwoList(multiplePayeesList.subList(numberExecution,numberExecution*2));
Thread ThreadTwo = new Thread(transferAccountsTwo);
ThreadTwo.start();
//导入线程3
ThreadsMultipleVerticesThree transferAccountsThree=new ThreadsMultipleVerticesThree();
transferAccountsThree.ThreadsMultipleVerticesThreeList(multiplePayeesList.subList(numberExecution*2,numberExecution*3));
Thread ThreadThree = new Thread(transferAccountsThree);
ThreadThree.start();
//导入线程4
ThreadsMultipleVerticesFour transferAccountsFour=new ThreadsMultipleVerticesFour();
transferAccountsFour.ThreadsMultipleVerticesFourList(multiplePayeesList.subList(numberExecution*3,numberExecution*4));
Thread ThreadFour = new Thread(transferAccountsFour);
ThreadFour.start();
//导入线程5
ThreadsMultipleVerticesFive transferAccountsFive=new ThreadsMultipleVerticesFive();
transferAccountsFive.ThreadsMultipleVerticesFiveList(multiplePayeesList.subList(numberExecution*4,numberExecution*5));
Thread ThreadFive = new Thread(transferAccountsFive);
ThreadFive.start();
//导入线程6
ThreadsMultipleVerticesSix transferAccountsSix=new ThreadsMultipleVerticesSix();
transferAccountsSix.ThreadsMultipleVerticesSixList(multiplePayeesList.subList(numberExecution*5,numberExecution*6));
Thread ThreadSix = new Thread(transferAccountsSix);
ThreadSix.start();
//导入线程7
ThreadsMultipleVerticesSeven transferAccountsSeven=new ThreadsMultipleVerticesSeven();
transferAccountsSeven.ThreadsMultipleVerticesSevenList(multiplePayeesList.subList(numberExecution*6,numberExecution*7));
Thread ThreadSeven = new Thread(transferAccountsSeven);
ThreadSeven.start();
//导入线程8
ThreadsMultipleVerticesEight transferAccountsEight=new ThreadsMultipleVerticesEight();
transferAccountsEight.ThreadsMultipleVerticesEightList(multiplePayeesList.subList(numberExecution*7,numberExecution*8));
Thread ThreadEight = new Thread(transferAccountsEight);
ThreadEight.start();
//导入线程9
ThreadsMultipleVerticesNine transferAccountsNine=new ThreadsMultipleVerticesNine();
transferAccountsNine.ThreadsMultipleVerticesNineList(multiplePayeesList.subList(numberExecution*8,numberExecution*9));
Thread ThreadNine = new Thread(transferAccountsNine);
ThreadNine.start();
//导入线程10
ThreadsMultipleVerticesTen transferAccountsTen=new ThreadsMultipleVerticesTen();
transferAccountsTen.ThreadsMultipleVerticesTenList(multiplePayeesList.subList(numberExecution*9,numberExecution*10));
Thread ThreadTen = new Thread(transferAccountsTen);
ThreadTen.start();
//线程11
ThreadsMultipleVerticesEleven threadsMultipleVerticesEleven=new ThreadsMultipleVerticesEleven();
threadsMultipleVerticesEleven.ThreadsMultipleVerticesElevenList(multiplePayeesList.subList(numberExecution*10,numberExecution*11));
Thread ThreadEleven = new Thread(threadsMultipleVerticesEleven);
ThreadEleven.start();
//线程12
ThreadsMultipleVerticesTwelve threadsMultipleVerticesTwelve=new ThreadsMultipleVerticesTwelve();
threadsMultipleVerticesTwelve.ThreadsMultipleVerticesTwelveList(multiplePayeesList.subList(numberExecution*11,multiplePayeesList.size()));
Thread ThreadTwelve = new Thread(threadsMultipleVerticesTwelve);
ThreadTwelve.start();
//等待线程
ThreadOne.join();
ThreadTwo.join();
ThreadThree.join();
ThreadFour.join();
ThreadFive.join();
ThreadSix.join();
ThreadSeven.join();
ThreadEight.join();
ThreadNine.join();
ThreadTen.join();
ThreadEleven.join();
ThreadTwelve.join();
System.out.println("收款人导入结束"+df.format(new Date()));
}catch (Exception e){
hugeClient.close();
}
}
/**
* 创建 转账人与收款人边
* @param transferCollectionList
*/
public void transferCollectionRelationship(List<TransferredPersonVo> transferCollectionList){
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("转账关系导入开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
try {
//创建属性
SchemaManager schema = hugeClient.schema();
//创建边
/**设置边名称*/
schema.edgeLabel("多人转账")
/**起点顶点*/
.sourceLabel("转账人")
/**终点顶点*/
.targetLabel("收款人")
/**边参数*/
.properties("转账次数")
.ifNotExist()
.create();
hugeClient.close();
// GraphManager graph = hugeClient.graph();
//每个线程执行多少条
int numberExecution=transferCollectionList.size()/20;
//线程1
TransferAccountsOne transferAccountsOne=new TransferAccountsOne();
transferAccountsOne.TransferAccountsOneList(transferCollectionList.subList(0,numberExecution));
Thread ThreadOne = new Thread(transferAccountsOne);
ThreadOne.start();
//线程2
TransferAccountsTwo transferAccountsTwo=new TransferAccountsTwo();
transferAccountsTwo.TransferAccountsTwoList(transferCollectionList.subList(numberExecution,numberExecution*2));
Thread ThreadTwo = new Thread(transferAccountsTwo);
ThreadTwo.start();
//线程3
TransferAccountsThree transferAccountsThree=new TransferAccountsThree();
transferAccountsThree.TransferAccountsThreeList(transferCollectionList.subList(numberExecution*2,numberExecution*3));
Thread ThreadThree = new Thread(transferAccountsThree);
ThreadThree.start();
//线程4
TransferAccountsFour transferAccountsFour=new TransferAccountsFour();
transferAccountsFour.TransferAccountsFourList(transferCollectionList.subList(numberExecution*3,numberExecution*4));
Thread ThreadFour = new Thread(transferAccountsFour);
ThreadFour.start();
//线程5
TransferAccountsFive transferAccountsFive=new TransferAccountsFive();
transferAccountsFive.TransferAccountsFiveList(transferCollectionList.subList(numberExecution*4,numberExecution*5));
Thread ThreadFive = new Thread(transferAccountsFive);
ThreadFive.start();
//线程6
TransferAccountsSix transferAccountsSix=new TransferAccountsSix();
transferAccountsSix.TransferAccountsSixList(transferCollectionList.subList(numberExecution*5,numberExecution*6));
Thread ThreadSix = new Thread(transferAccountsSix);
ThreadSix.start();
//线程7
TransferAccountsSeven transferAccountsSeven=new TransferAccountsSeven();
transferAccountsSeven.TransferAccountsSevenList(transferCollectionList.subList(numberExecution*6,numberExecution*7));
Thread ThreadSeven = new Thread(transferAccountsSeven);
ThreadSeven.start();
//线程8
TransferAccountsEight transferAccountsEight=new TransferAccountsEight();
transferAccountsEight.TransferAccountsEightList(transferCollectionList.subList(numberExecution*7,numberExecution*8));
Thread ThreadEight = new Thread(transferAccountsEight);
ThreadEight.start();
//线程9
TransferAccountsNine transferAccountsNine=new TransferAccountsNine();
transferAccountsNine.TransferAccountsNineList(transferCollectionList.subList(numberExecution*8,numberExecution*9));
Thread ThreadNine = new Thread(transferAccountsNine);
ThreadNine.start();
//线程10
TransferAccountsTen transferAccountsTen=new TransferAccountsTen();
transferAccountsTen.TransferAccountsTenList(transferCollectionList.subList(numberExecution*9,numberExecution*10));
Thread ThreadTen = new Thread(transferAccountsTen);
ThreadTen.start();
//线程11
TransferAccountsEleven transferAccountsEleven=new TransferAccountsEleven();
transferAccountsEleven.TransferAccountsElevenList(transferCollectionList.subList(numberExecution*10,numberExecution*11));
Thread ThreadEleven = new Thread(transferAccountsEleven);
ThreadEleven.start();
//线程12
TransferAccountsTwelve transferAccountsTwelve=new TransferAccountsTwelve();
transferAccountsTwelve.TransferAccountsTwelveList(transferCollectionList.subList(numberExecution*11,numberExecution*12));
Thread ThreadTwelve = new Thread(transferAccountsTwelve);
ThreadTwelve.start();
//线程13
TransferAccountsThirteen transferAccountsThirteen=new TransferAccountsThirteen();
transferAccountsThirteen.TransferAccountsThirteenList(transferCollectionList.subList(numberExecution*12,numberExecution*13));
Thread ThreadThirteen = new Thread(transferAccountsThirteen);
ThreadThirteen.start();
//线程14
TransferAccountsFourteen transferAccountsFourteen=new TransferAccountsFourteen();
transferAccountsFourteen.TransferAccountsFourteenList(transferCollectionList.subList(numberExecution*13,numberExecution*14));
Thread ThreadFourteen = new Thread(transferAccountsFourteen);
ThreadFourteen.start();
//线程15
TransferAccountsFifteen transferAccountsFifteen=new TransferAccountsFifteen();
transferAccountsFifteen.TransferAccountsFifteenList(transferCollectionList.subList(numberExecution*14,numberExecution*15));
Thread ThreadFifteen = new Thread(transferAccountsFifteen);
ThreadFifteen.start();
//线程16
TransferAccountsSixteen transferAccountsSixteen=new TransferAccountsSixteen();
transferAccountsSixteen.TransferAccountsSixteenList(transferCollectionList.subList(numberExecution*15,numberExecution*16));
Thread ThreadSixteen = new Thread(transferAccountsSixteen);
ThreadSixteen.start();
//线程17
TransferAccountsSeventeen transferAccountsSeventeen=new TransferAccountsSeventeen();
transferAccountsSeventeen.TransferAccountsSeventeenList(transferCollectionList.subList(numberExecution*16,numberExecution*17));
Thread ThreadSeventeen = new Thread(transferAccountsSeventeen);
ThreadSeventeen.start();
//线程18
TransferAccountsEighteen transferAccountsEighteen=new TransferAccountsEighteen();
transferAccountsEighteen.TransferAccountsEighteenList(transferCollectionList.subList(numberExecution*17,numberExecution*18));
Thread ThreadEighteen = new Thread(transferAccountsEighteen);
ThreadEighteen.start();
//线程19
TransferAccountsNineteen transferAccountsNineteen=new TransferAccountsNineteen();
transferAccountsNineteen.TransferAccountsNineteenList(transferCollectionList.subList(numberExecution*18,numberExecution*19));
Thread ThreadNineteen = new Thread(transferAccountsNineteen);
ThreadNineteen.start();
//线程20
TransferAccountsTwenty transferAccountsTwenty=new TransferAccountsTwenty();
transferAccountsTwenty.TransferAccountsTwentyList(transferCollectionList.subList(numberExecution*19,transferCollectionList.size()));
Thread ThreadTwenty = new Thread(transferAccountsTwenty);
ThreadTwenty.start();
//等待线程
ThreadOne.join();
ThreadTwo.join();
ThreadThree.join();
ThreadFour.join();
ThreadFive.join();
ThreadSix.join();
ThreadSeven.join();
ThreadEight.join();
ThreadNine.join();
ThreadTen.join();
ThreadEleven.join();
ThreadTwelve.join();
ThreadThirteen.join();
ThreadFourteen.join();
ThreadFifteen.join();
ThreadSixteen.join();
ThreadSeventeen.join();
ThreadEighteen.join();
ThreadNineteen.join();
ThreadTwenty.join();
System.out.println("转账关系导入结束"+df.format(new Date()));
}catch (Exception e){
System.out.println(e);
hugeClient.close();
}
}
}
\ No newline at end of file
package com.example.gajz.transferrelationship.hugegraphclient;
import com.baidu.hugegraph.driver.*;
import com.baidu.hugegraph.structure.constant.T;
import com.baidu.hugegraph.structure.graph.Vertex;
import java.io.IOException;
/**
* @author lenovo
*/
public class SingleExample {
public static void main(String[] args) throws IOException {
// If connect failed will throw a exception.
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
try {
SchemaManager schema = hugeClient.schema();
//删除顶点
// schema.propertyKey("姓名").remove();
// schema.propertyKey("卡号").remove();
// schema.propertyKey("转账次数").remove();
// schema.propertyKey("转账金额").remove();
//创建属性
// schema.propertyKey("姓名").asText().ifNotExist().create();
// schema.propertyKey("卡号").asText().ifNotExist().create();
// schema.propertyKey("转账次数").asText().ifNotExist().create();
// schema.propertyKey("转账金额").asText().ifNotExist().create();
schema.propertyKey("name").asText().ifNotExist().create();
schema.propertyKey("age").asInt().ifNotExist().create();
schema.propertyKey("city").asText().ifNotExist().create();
schema.propertyKey("weight").asDouble().ifNotExist().create();
schema.propertyKey("lang").asText().ifNotExist().create();
schema.propertyKey("date").asDate().ifNotExist().create();
schema.propertyKey("price").asInt().ifNotExist().create();
schema.vertexLabel("person")
.properties("name", "age", "city")
.primaryKeys("name")
.ifNotExist()
.create();
schema.vertexLabel("software")
.properties("name", "lang", "price")
.primaryKeys("name")
.ifNotExist()
.create();
schema.indexLabel("personByCity")
.onV("person")
.by("city")
.secondary()
.ifNotExist()
.create();
schema.indexLabel("personByAgeAndCity")
.onV("person")
.by("age", "city")
.secondary()
.ifNotExist()
.create();
schema.indexLabel("softwareByPrice")
.onV("software")
.by("price")
.range()
.ifNotExist()
.create();
schema.edgeLabel("knows")
.sourceLabel("person")
.targetLabel("person")
.properties("date", "weight")
.ifNotExist()
.create();
schema.edgeLabel("created")
.sourceLabel("person").targetLabel("software")
.properties("date", "weight")
.ifNotExist()
.create();
schema.indexLabel("createdByDate")
.onE("created")
.by("date")
.secondary()
.ifNotExist()
.create();
schema.indexLabel("createdByWeight")
.onE("created")
.by("weight")
.range()
.ifNotExist()
.create();
schema.indexLabel("knowsByWeight")
.onE("knows")
.by("weight")
.range()
.ifNotExist()
.create();
GraphManager graph = hugeClient.graph();
Vertex marko = graph.addVertex(T.label, "person", "name", "marko",
"age", 29, "city", "Beijing");
Vertex vadas = graph.addVertex(T.label, "person", "name", "vadas",
"age", 27, "city", "Hongkong");
Vertex lop = graph.addVertex(T.label, "software", "name", "lop",
"lang", "java", "price", 328);
Vertex josh = graph.addVertex(T.label, "person", "name", "josh",
"age", 32, "city", "Beijing");
Vertex ripple = graph.addVertex(T.label, "software", "name", "ripple",
"lang", "java", "price", 199);
Vertex peter = graph.addVertex(T.label, "person", "name", "peter",
"age", 35, "city", "Shanghai");
//
marko.addEdge("knows", vadas, "date", "2016-01-10", "weight", 0.5);
// marko.addEdge("knows", josh, "date", "2013-02-20", "weight", 1.0);
// marko.addEdge("created", lop, "date", "2017-12-10", "weight", 0.4);
// josh.addEdge("created", lop, "date", "2009-11-11", "weight", 0.4);
// josh.addEdge("created", ripple, "date", "2017-12-10", "weight", 1.0);
// peter.addEdge("created", lop, "date", "2017-03-24", "weight", 0.2);
// GremlinManager gremlin = hugeClient.gremlin();
// System.out.println("==== Path ====");
// ResultSet resultSet = gremlin.gremlin("g.V().outE().path()").execute();
// Iterator<Result> results = resultSet.iterator();
// results.forEachRemaining(result -> {
// System.out.println(result.getObject().getClass());
// Object object = result.getObject();
// if (object instanceof Vertex) {
// System.out.println(((Vertex) object).id());
// } else if (object instanceof Edge) {
// System.out.println(((Edge) object).id());
// } else if (object instanceof Path) {
// List<Object> elements = ((Path) object).objects();
// elements.forEach(element -> {
// System.out.println(element.getClass());
// System.out.println(element);
// });
// } else {
// System.out.println(object);
// }
// });
hugeClient.close();
}catch (Exception e){
hugeClient.close();
}
}
}
package com.example.gajz.transferrelationship.hugegraphclient;
public class test {
public static void main(String[] args) {
Test2 test2 = new Test2();
Test3 test3=new Test3();
test2.ts2(1);
Thread thread = new Thread(test2);
Thread thread1 = new Thread(test3);
thread.start();
thread1.start();
}
}
class Test2 implements Runnable {
private int t2;
public void ts2(int s){
t2=s;
}
@Override
public void run() {
for (int i = 0; i < 1000; i++) {
System.out.println("------Test2"+this.t2);
}
}
}
class Test3 implements Runnable {
@Override
public void run() {
for (int i=0;i<1000;i++){
System.out.println("Test3------");
}
}
}
package com.example.gajz.transferrelationship.neo4j;
import java.util.Random;
public class Colour {
public String getColour(){
//红色
String red;
//绿色
String green;
//蓝色
String blue;
//生成随机对象
Random random = new Random();
//生成红色颜色代码
red = Integer.toHexString(random.nextInt(256)).toUpperCase();
//生成绿色颜色代码
green = Integer.toHexString(random.nextInt(256)).toUpperCase();
//生成蓝色颜色代码
blue = Integer.toHexString(random.nextInt(256)).toUpperCase();
//判断红色代码的位数
red = red.length()==1 ? "0" + red : red ;
//判断绿色代码的位数
green = green.length()==1 ? "0" + green : green ;
//判断蓝色代码的位数
blue = blue.length()==1 ? "0" + blue : blue ;
//生成十六进制颜色值
String color = "0x"+red+green+blue;
return color;
}
}
package com.example.gajz.transferrelationship.neo4j;
import com.baidu.hugegraph.structure.constant.T;
import com.example.gajz.transferrelationship.bean.vo.TransferCardVo;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import com.example.gajz.transferrelationship.dao.TransferRelationshipMapper;
import org.neo4j.driver.AuthTokens;
import org.neo4j.driver.Driver;
import org.neo4j.driver.GraphDatabase;
import org.neo4j.driver.Result;
import org.neo4j.driver.Session;
import org.neo4j.driver.Transaction;
import org.neo4j.driver.TransactionWork;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import static org.neo4j.driver.Values.parameters;
public class HelloWorldExample implements AutoCloseable {
private final Driver driver;
public HelloWorldExample( String uri, String user, String password ) {
driver = GraphDatabase.driver( uri, AuthTokens.basic( user, password ) );
}
@Override
public void close() throws Exception
{
driver.close();
}
public void printGreeting( final String message )
{
try ( Session session = driver.session() )
{
String greeting = session.writeTransaction( new TransactionWork<String>()
{
@Override
public String execute( Transaction tx )
{
Result result = tx.run( "CREATE (a:Greeting) " +
"SET a.message = $message " +
"RETURN a.message + ', from node ' + id(a)",
parameters( "message", message ) );
return result.single().get( 0 ).asString();
}
} );
System.out.println( greeting );
}
}
public static void main(List<TransferredPersonVo> args) throws Exception {
try ( HelloWorldExample greeter = new HelloWorldExample( "bolt://localhost:7687", "neo4j", "123456" ) ) {
System.out.println(args.size());
for (int i=0;i<args.size();i++){
System.out.println(i);
greeter.printGreeting( args.get(i).getEndCardNo());
}
}
}
}
\ No newline at end of file
package com.example.gajz.transferrelationship.neo4j;
import com.example.gajz.redis.ConFigRedis;
import redis.clients.jedis.Jedis;
public class test {
public static void main(String[] args) {
Jedis conn = ConFigRedis.getConn();
conn.flushAll();
}
}
package com.example.gajz.transferrelationship.relationalalgorithm;
import com.example.gajz.transferrelationship.bean.param.Dot;
import com.example.gajz.transferrelationship.bean.vo.SearchRelationshipVo;
import com.example.gajz.transferrelationship.neo4j.Colour;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* 转账关系图
*/
public class RelationalAlgorithm {
/**
* 转账关系图 关系图搜索 展示图算法
*/
public List searchPresentation(List<SearchRelationshipVo> searchRelationshipVos){
/**----------------------------公共使用值------------------------------*/
/**存放中心点list*/
List<Dot> centerPointList=new ArrayList<>();
/**已经存在的点 会存储到map里面*/
HashMap hashMap=new HashMap();
//查询转账人(中心点)信息
List list=new ArrayList();
int centerPointX = 0;
int centerPointY = 0;
//存储所有大圆的四角X Y轴数据
HashMap xyMap = new HashMap();
/**---------------------------------------------------------------------*/
/**将有下级的点存入中心点list集合中*/
for (int i=0;i<searchRelationshipVos.size();i++){
if (searchRelationshipVos.get(i).getSubordinate()){
Dot dot=new Dot();
dot.setId(searchRelationshipVos.get(i).getCardNumber());
dot.setRelationship(searchRelationshipVos.get(i).getRelationship());
dot.setName(searchRelationshipVos.get(i).getName());
dot.setTransferTimes(searchRelationshipVos.get(i).getTransferTimes());
dot.setRelationship(searchRelationshipVos.get(i).getRelationship());
centerPointList.add(dot);
}
}
// System.out.println("共有"+centerPointList.size()+"个中心点");
/**循环中心点*/
for (int i=0;i<centerPointList.size();i++){
//是否重叠
boolean overlap=false;
//生成颜色
Colour colour=new Colour();
String code=colour.getColour();
/**----------------------------中心点赋值------------------------------*/
Dot dot=new Dot();
dot.setId(centerPointList.get(i).getId());
int position=1000;
if (searchRelationshipVos.size()>10000){
position=(searchRelationshipVos.size()/5);
}
dot.setX((int)(Math.random()*position)); //随机生成X轴
dot.setY((int)(Math.random()*position)); //随机生成Y轴
dot.setName(centerPointList.get(i).getName());
dot.setColor(code);
dot.setRelationship(centerPointList.get(i).getRelationship());
dot.setTransferTimes(centerPointList.get(i).getTransferTimes());
centerPointX=dot.getX();
centerPointY=dot.getY();
/**---------------------------------------------------------------------*/
/**----------------------------将中心点下级存入list中 获取中心点下级数据-----------------------------*/
/**将没有重复的值 存储到这个list里面*/
List<Dot> dataList=new ArrayList<>();
/**循环出中心点下级*/
for (int x=0;x<searchRelationshipVos.size();x++){
if (centerPointList.get(i).getId()==searchRelationshipVos.get(x).getRelationship()&&
!searchRelationshipVos.get(x).getSubordinate()){
// Object target = hashMap.get(searchRelationshipVos.get(i).getCardNumber());
// if (target==null){
Dot dot1=new Dot();
dot1.setName(searchRelationshipVos.get(x).getName());
dot1.setId(searchRelationshipVos.get(x).getCardNumber());
dot1.setTransferTimes(searchRelationshipVos.get(x).getTransferTimes());
dot1.setRelationship(searchRelationshipVos.get(x).getRelationship());
dataList.add(dot1);
// hashMap.put(searchRelationshipVos.get(x).getCardNumber(),searchRelationshipVos.get(x).getCardNumber());
// }
}
}
// System.out.println("卡号:"+centerPointList.get(i).getId());
// System.out.println("下级数量:"+dataList.size());
/**-------------------------------------------------------------------------------*/
/**
* 判断中心点大小
*/
if (dataList.size()==0||dataList.size()<=100){
dot.setSize(2);
}else if (dataList.size()>=100){
dot.setSize(2);
}
/**每圈点数 动态变化 */
int base = 8;
/**总数*/
int total = dataList.size();
/**循环次数*/
int numberCycles =0;
/** -----------------------计算大图四个角的XY轴代码-----------------------*/
/**算大圈半径专用 总数*/
int bigTotal = dataList.size();
/**算大圈半径专用 每圈点数*/
int bigBase = 8;
for (int n=1;bigTotal>0;n++){
bigTotal = bigTotal-bigBase;
bigBase = bigBase+20;
}
/** 大圆最后一圈半径 每份多少点数 */
int bigPointsPerShare = bigBase/4;
/**大圆最后一圈半径 相等于大圈半径 点数*距离 */
int fullCircleRadius =bigPointsPerShare*2;
/** -------------------------------------------------------------------*/
if (i==0){
xyMap.put(i+"zX",(centerPointX-fullCircleRadius)); //圆左X轴
xyMap.put(i+"yX",(centerPointX+fullCircleRadius)); //圆右X轴
xyMap.put(i+"sY",(centerPointY-fullCircleRadius)); //圆上Y轴
xyMap.put(i+"xY",(centerPointY+fullCircleRadius)); //圆下Y轴
// /** 将中心点X Y轴拼接 并存入Redis中*/
// String position=test.getX()+"Y"+test.getY();
// conn.set(test.getId(),position);
list.add(dot);
overlap=true;
}else {
for (int p=0;p<i;p++){
int zX = (int) xyMap.get(p + "zX");
int yX = (int) xyMap.get(p + "yX");
int sY = (int) xyMap.get(p + "sY");
int xY = (int) xyMap.get(p + "xY");
if( ((zX>(centerPointX-fullCircleRadius)&&zX>(centerPointX+fullCircleRadius)) ||(yX<(centerPointX-fullCircleRadius)&&yX<(centerPointX+fullCircleRadius)))
||
((sY>(centerPointY-fullCircleRadius)&&sY>(centerPointY+fullCircleRadius)) ||(xY<(centerPointY-fullCircleRadius)&&xY<(centerPointY+fullCircleRadius))) ){
if (p==i-1) {
xyMap.put(i + "zX", (centerPointX-fullCircleRadius)); //圆左X轴
xyMap.put(i + "zY", centerPointY); //圆左Y轴
xyMap.put(i + "yX", (centerPointX+fullCircleRadius)); //圆右X轴
xyMap.put(i + "yY", centerPointY); //圆右Y轴
xyMap.put(i + "sX", centerPointX); //圆上X轴
xyMap.put(i + "sY", (centerPointY-fullCircleRadius)); //圆上Y轴
xyMap.put(i + "xX", centerPointX); //圆下X轴
xyMap.put(i + "xY", (centerPointY+fullCircleRadius)); //圆下Y轴
/** 将中心点X Y轴拼接 并存入Redis中*/
// String position=test.getX()+"Y"+test.getY();
// conn.set(test.getId(),position);
list.add(dot);
overlap=true;
}
}else {
overlap=false;
break;
}
}
}
if (!overlap){
i--;
continue;
}
/**圆圈层数 每循环一次 就是一圈*/
for (int y=1;total>0;y++){
/**点之间 x轴y轴间隔距离*/
int distance=2;
/**圆分成四份 每份多少点数*/
int pointsPerShare = base/4;
/**小圆半径 点数X距离*/
int circleRadius = pointsPerShare * distance;
/**右下角逐渐递减*/
int lowerRight = 0;
/**左下角逐渐递减*/
int lowerLeft = 0;
/**左上角逐渐递减*/
int upperLeft = 0;
/**点大小*/
double pointSize =1;
if (base<=total){
for (int t=0;t<base;t++){
Dot test1=new Dot();
if (t<pointsPerShare){
test1.setId(dataList.get(numberCycles).getId());
test1.setName(dataList.get(numberCycles).getName());
test1.setX((distance*t)+centerPointX);
test1.setY((centerPointY-circleRadius)+(distance*t));
test1.setColor(code);
test1.setSize(pointSize);
test1.setRelationship(dataList.get(numberCycles).getRelationship());
test1.setTransferTimes(dataList.get(numberCycles).getTransferTimes());
}else if (t<=pointsPerShare*2){
test1.setId(dataList.get(numberCycles).getId());
test1.setName(dataList.get(numberCycles).getName());
test1.setX((centerPointX+circleRadius)-(distance*lowerRight));
test1.setY(centerPointY+(lowerRight*distance));
test1.setColor(code);
test1.setSize(pointSize);
test1.setRelationship(dataList.get(numberCycles).getRelationship());
test1.setTransferTimes(dataList.get(numberCycles).getTransferTimes());
lowerRight++;
}else if (t<=pointsPerShare*3){
test1.setId(dataList.get(numberCycles).getId());
test1.setName(dataList.get(numberCycles).getName());
test1.setX((centerPointX-circleRadius)+(distance*lowerLeft));
test1.setY(centerPointY+(distance*lowerLeft));
test1.setColor(code);
test1.setSize(pointSize);
test1.setRelationship(dataList.get(numberCycles).getRelationship());
test1.setTransferTimes(dataList.get(numberCycles).getTransferTimes());
lowerLeft++;
}else if (t<=pointsPerShare*4){
test1.setId(dataList.get(numberCycles).getId());
test1.setName(dataList.get(numberCycles).getName());
test1.setX(centerPointX-(distance*upperLeft));
test1.setY((centerPointY-circleRadius)+(distance*upperLeft));
test1.setColor(code);
test1.setSize(pointSize);
test1.setRelationship(dataList.get(numberCycles).getRelationship());
test1.setTransferTimes(dataList.get(numberCycles).getTransferTimes());
upperLeft++;
}
// /** 将其他点 X Y轴拼接 并存入Redis中*/
// String position=test1.getX()+"Y"+test1.getY();
// conn.set(test1.getId(),position);
list.add(test1);
numberCycles++;
}
total=total-base;
base = base+20;
continue;
}
if (base>0){
for (int t=0;numberCycles<dataList.size();t++){
Dot test1=new Dot();
if (t<pointsPerShare){
test1.setId(dataList.get(numberCycles).getId());
test1.setRelationship(dataList.get(numberCycles).getRelationship());
test1.setName(dataList.get(numberCycles).getName());
test1.setX((distance*t)+centerPointX);
test1.setY((centerPointY-circleRadius)+(distance*t));
test1.setColor(code);
test1.setSize(pointSize);
test1.setTransferTimes(dataList.get(numberCycles).getTransferTimes());
}else if (t<=pointsPerShare*2){
test1.setId(dataList.get(numberCycles).getId());
test1.setRelationship(dataList.get(numberCycles).getRelationship());
test1.setName(dataList.get(numberCycles).getName());
test1.setX((centerPointX+circleRadius)-(distance*lowerRight));
test1.setY(centerPointY+(lowerRight*distance));
test1.setColor(code);
test1.setSize(pointSize);
test1.setTransferTimes(dataList.get(numberCycles).getTransferTimes());
lowerRight++;
}else if (t<=pointsPerShare*3){
test1.setId(dataList.get(numberCycles).getId());
test1.setRelationship(dataList.get(numberCycles).getRelationship());
test1.setName(dataList.get(numberCycles).getName());
test1.setX((centerPointX-circleRadius)+(distance*lowerLeft));
test1.setY(centerPointY+(distance*lowerLeft));
test1.setColor(code);
test1.setSize(pointSize);
test1.setTransferTimes(dataList.get(numberCycles).getTransferTimes());
lowerLeft++;
}else if (t<=pointsPerShare*4){
test1.setId(dataList.get(numberCycles).getId());
test1.setRelationship(dataList.get(numberCycles).getRelationship());
test1.setName(dataList.get(numberCycles).getName());
test1.setX(centerPointX-(distance*upperLeft));
test1.setY((centerPointY-circleRadius)+(distance*upperLeft));
test1.setColor(code);
test1.setSize(pointSize);
test1.setTransferTimes(dataList.get(numberCycles).getTransferTimes());
upperLeft++;
}
// /** 将其他点 X Y轴拼接 并存入Redis中*/
// String position=test1.getX()+"Y"+test1.getY();
// conn.set(test1.getId(),position);
list.add(test1);
numberCycles++;
}
break;
}
}
}
return list;
}
}
package com.example.gajz.transferrelationship.relationalalgorithm;
import com.example.gajz.transferrelationship.bean.vo.SearchRelationshipVo;
import com.example.gajz.transferrelationship.dao.TransferRelationshipMapper;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* 双人转账关系图 位置生成类
*/
@Component
public class TransferLocation {
@Resource
TransferRelationshipMapper transferRelationshipMapper;
public static TransferLocation test;
@PostConstruct
public void init(){
test= this;
test.transferRelationshipMapper=transferRelationshipMapper;
}
/**
* 双人转账关系 位置生成方法
* @param transferAssociationList
* @return
*/
public List<SearchRelationshipVo> transferLocation(List<SearchRelationshipVo> transferAssociationList){
System.out.println("111");
/**-----------------------------------层级排序----------------------------------------*/
List<SearchRelationshipVo> searchRelationshipVoList=new ArrayList<>();
int Hierarchy=1;
for (int k=0;k<1;){
int m=0;
for (int f=0;f<transferAssociationList.size();f++){
if (transferAssociationList.get(f).getHierarchy()==Hierarchy){
searchRelationshipVoList.add(transferAssociationList.get(f));
m++;
}
}
if (m==0){
break;
}
Hierarchy++;
}
/**-----------------------------------层级排序----------------------------------------*/
/**
* 最终返回数据list
*/
List<SearchRelationshipVo> searList=new ArrayList<>();
/**
* 将已经查询到的下级数据存入map中 防止重复
*/
HashMap hashMap=new HashMap();
//查询下级
for (int i=0;i<searchRelationshipVoList.size();i++){
/**
* 存放下级参数list
*/
List<SearchRelationshipVo> parameterList=new ArrayList<>();
/**获取中心点 (上一级)*/
String cardNumber = searchRelationshipVoList.get(i).getCardNumber();
hashMap.put(cardNumber, cardNumber);
/** 查询下级数据*/
List<SearchRelationshipVo> querySubordinateList = test.transferRelationshipMapper.querySubordinate(cardNumber);
/**循环做对比 查找出下级数据*/
for (int n=0;n<querySubordinateList.size();n++){
for (int p=0;p<searchRelationshipVoList.size();p++){
Object CardNumber = hashMap.get(searchRelationshipVoList.get(p).getCardNumber());
if (CardNumber==null) {
if (querySubordinateList.get(n).getCardNumber().equals(searchRelationshipVoList.get(p).getCardNumber())) {
/** 存放下级数据封装类*/
SearchRelationshipVo searchRelationshipVo=new SearchRelationshipVo();
searchRelationshipVo.setCardNumber(searchRelationshipVoList.get(p).getCardNumber());
searchRelationshipVo.setColor(searchRelationshipVoList.get(p).getColor());
searchRelationshipVo.setSize(searchRelationshipVoList.get(p).getSize());
searchRelationshipVo.setName(searchRelationshipVoList.get(p).getName());
searchRelationshipVo.setHierarchy(searchRelationshipVoList.get(p).getHierarchy());
//将已经查询到的下级存入map中 下次循环做对比 防止重复
hashMap.put(searchRelationshipVoList.get(p).getCardNumber(), searchRelationshipVoList.get(p).getCardNumber());
parameterList.add(searchRelationshipVo);
}
}
}
}
/**每圈点数 动态变化 */
int base = 8;
/**总数*/
int total = parameterList.size();
//判断上级卡号是否是转账人 如果是就设置初始xy轴
if (searchRelationshipVoList.get(i).getHierarchy()==1){
searchRelationshipVoList.get(i).setY((int) (Math.random() * 200));
searchRelationshipVoList.get(i).setX((int) (Math.random() * 200));
searList.add(searchRelationshipVoList.get(i));
int centerPointX=searchRelationshipVoList.get(i).getX();
int centerPointY=searchRelationshipVoList.get(i).getY();
/**循环次数*/
int numberCycles =0;
/**循环下级点数 计算下级X Y轴位置*/
for (int y=1;total>0;y++){
/**点之间 x轴y轴间隔距离*/
int distance=30;
/**圆分成两份 */
int pointsPerShare = base/2;
/**小圆半径 点数X距离*/
int circleRadius = 100;
/**右上逐渐递增*/
int lowerRight = 0;
if (base<=total){
for (int t=0;t<base;t++){
SearchRelationshipVo searchRelationship=new SearchRelationshipVo();
if (t<pointsPerShare){
searchRelationship.setX(centerPointX+circleRadius);
searchRelationship.setY(centerPointY-(distance*lowerRight));
searchRelationship.setName(parameterList.get(numberCycles).getName());
searchRelationship.setColor(parameterList.get(numberCycles).getColor());
searchRelationship.setHierarchy(parameterList.get(numberCycles).getHierarchy());
searchRelationship.setCardNumber(parameterList.get(numberCycles).getCardNumber());
searchRelationship.setSize(parameterList.get(numberCycles).getSize());
searList.add(searchRelationship);
lowerRight++;
}else if (t<=pointsPerShare*2){
searchRelationship.setX(centerPointX+circleRadius);
searchRelationship.setY(centerPointY+(lowerRight*distance));
searchRelationship.setName(parameterList.get(numberCycles).getName());
searchRelationship.setColor(parameterList.get(numberCycles).getColor());
searchRelationship.setHierarchy(parameterList.get(numberCycles).getHierarchy());
searchRelationship.setCardNumber(parameterList.get(numberCycles).getCardNumber());
searchRelationship.setSize(parameterList.get(numberCycles).getSize());
searList.add(searchRelationship);
lowerRight++;
}
numberCycles++;
}
total=total-base;
base = base+20;
continue;
}
if (base>0){
for (int t=0;numberCycles<parameterList.size();t++){
SearchRelationshipVo searchRelationship=new SearchRelationshipVo();
if (t<pointsPerShare){
searchRelationship.setX(centerPointX+circleRadius);
searchRelationship.setY(centerPointY-(lowerRight*distance));
searchRelationship.setName(parameterList.get(numberCycles).getName());
searchRelationship.setColor(parameterList.get(numberCycles).getColor());
searchRelationship.setCardNumber(parameterList.get(numberCycles).getCardNumber());
searchRelationship.setHierarchy(parameterList.get(numberCycles).getHierarchy());
searchRelationship.setSize(parameterList.get(numberCycles).getSize());
lowerRight++;
}else if (t<=pointsPerShare*2){
searchRelationship.setX(centerPointX+circleRadius);
searchRelationship.setY(centerPointY+(lowerRight*distance));
searchRelationship.setName(parameterList.get(numberCycles).getName());
searchRelationship.setColor(parameterList.get(numberCycles).getColor());
searchRelationship.setHierarchy(parameterList.get(numberCycles).getHierarchy());
searchRelationship.setCardNumber(parameterList.get(numberCycles).getCardNumber());
searchRelationship.setSize(parameterList.get(numberCycles).getSize());
searList.add(searchRelationship);
lowerRight++;
}
searList.add(searchRelationship);
numberCycles++;
}
break;
}
}
}else {
/**循环返回值封装类 对比下一级卡号 获取X Y轴*/
for (int f=0;f<searList.size();f++){
/**中心点对比已经存储好的返回值 获取X Y轴*/
if (cardNumber.equals(searList.get(f).getCardNumber())){
int centerPointX = searList.get(f).getX();
int centerPointY = searList.get(f).getY();
/**循环次数*/
int numberCycles =0;
/**循环下级点数 计算下级X Y轴位置*/
for (int y=1;total>0;y++){
/**点之间 x轴y轴间隔距离*/
int distance=30;
/**圆分成两份 */
int pointsPerShare = base/2;
/**半径*/
int circleRadius = 300;
/**右下角逐渐递减*/
int lowerRight = 0;
if (base<=total){
for (int t=0;t<base;t++){
SearchRelationshipVo searchRelationship=new SearchRelationshipVo();
if (t<pointsPerShare){
searchRelationship.setX(centerPointX+circleRadius);
searchRelationship.setY(centerPointY-(lowerRight*distance));
searchRelationship.setName(parameterList.get(numberCycles).getName());
searchRelationship.setColor(parameterList.get(numberCycles).getColor());
searchRelationship.setHierarchy(parameterList.get(numberCycles).getHierarchy());
searchRelationship.setCardNumber(parameterList.get(numberCycles).getCardNumber());
searchRelationship.setSize(parameterList.get(numberCycles).getSize());
searList.add(searchRelationship);
lowerRight++;
}else if (t<=pointsPerShare*2){
searchRelationship.setX(centerPointX+circleRadius);
searchRelationship.setY(centerPointY+(lowerRight*distance));
searchRelationship.setName(parameterList.get(numberCycles).getName());
searchRelationship.setColor(parameterList.get(numberCycles).getColor());
searchRelationship.setHierarchy(parameterList.get(numberCycles).getHierarchy());
searchRelationship.setCardNumber(parameterList.get(numberCycles).getCardNumber());
searchRelationship.setSize(parameterList.get(numberCycles).getSize());
searList.add(searchRelationship);
lowerRight++;
}
numberCycles++;
}
total=total-base;
base = base+20;
continue;
}
if (base>0){
for (int t=0;numberCycles<parameterList.size();t++){
SearchRelationshipVo searchRelationship=new SearchRelationshipVo();
if (t<pointsPerShare){
searchRelationship.setX(centerPointX+circleRadius);
searchRelationship.setY(centerPointY-(lowerRight*distance));
searchRelationship.setName(parameterList.get(numberCycles).getName());
searchRelationship.setColor(parameterList.get(numberCycles).getColor());
searchRelationship.setHierarchy(parameterList.get(numberCycles).getHierarchy());
searchRelationship.setCardNumber(parameterList.get(numberCycles).getCardNumber());
searchRelationship.setSize(parameterList.get(numberCycles).getSize());
lowerRight++;
}else if (t<=pointsPerShare*2){
searchRelationship.setX(centerPointX+circleRadius);
searchRelationship.setY(centerPointY+(lowerRight*distance));
searchRelationship.setName(parameterList.get(numberCycles).getName());
searchRelationship.setColor(parameterList.get(numberCycles).getColor());
searchRelationship.setHierarchy(parameterList.get(numberCycles).getHierarchy());
searchRelationship.setCardNumber(parameterList.get(numberCycles).getCardNumber());
searchRelationship.setSize(parameterList.get(numberCycles).getSize());
searList.add(searchRelationship);
lowerRight++;
}
searList.add(searchRelationship);
numberCycles++;
}
break;
}
}
break;
}
}
}
}
return searList;
}
}
package com.example.gajz.transferrelationship.service;
import com.example.gajz.result.Result;
import com.example.gajz.transferrelationship.bean.dto.data;
import com.example.gajz.transferrelationship.bean.excel.abcExcie;
import com.example.gajz.transferrelationship.bean.param.TransferAssociationParam;
import com.example.gajz.transferrelationship.bean.vo.SearchRelationshipVo;
import java.util.List;
/**
* @author lenovo
*/
public interface TransferRelationshipService {
/**
* 边
* @return
*/
List<data> edge();
/**
* 点
* @return
*/
List diagramSpot();
/**
* 关系图搜索 单人转账关系(关联关系)接口
* @param cardnumbe
* @return
*/
Result searchRelationship(String cardnumbe);
/**
* 转账关系图 信息搜索接口 查询某一个点的具体位置
* @param id
* @return
*/
Result specificLocation(String id);
/**
* 清空关系图数据表
*/
void emptyTransferRelationship();
/**
* excel数据导入数据库
* @param eSerialsList
*/
void insertTransferRelationship(List<abcExcie> eSerialsList);
/**
* 关系图 搜索接口
* @param name
* @return
*/
Result pointSearch(String name);
/**
* 查询两人转账关系 (关系图) 接口
* @param transferAssociationParam
* @return
*/
Result transferAssociation(TransferAssociationParam transferAssociationParam);
/**
* 关系图搜索 单人转账关系 转账信息信息查询接口
* @return
*/
Result personalTransferRelationship();
/**
* 查询两人转账关系 关系 (关系图) 接口
* @return
*/
Result trBetweenTwoPersons(List<SearchRelationshipVo> transferAssociationParam);
}
package com.example.gajz.transferrelationship.service.serviceImpl;
import com.example.gajz.redis.ConFigRedis;
import com.example.gajz.result.Result;
import com.example.gajz.result.ResultCode;
import com.example.gajz.transferrelationship.bean.dto.*;
import com.example.gajz.transferrelationship.bean.excel.abcExcie;
import com.example.gajz.transferrelationship.bean.param.TransferAssociationParam;
import com.example.gajz.transferrelationship.bean.vo.*;
import com.example.gajz.transferrelationship.dao.TransferRelationshipMapper;
import com.example.gajz.transferrelationship.hugegraphclient.HugeCollectionProperties;
import com.example.gajz.transferrelationship.neo4j.Colour;
import com.example.gajz.transferrelationship.relationalalgorithm.RelationalAlgorithm;
import com.example.gajz.transferrelationship.relationalalgorithm.TransferLocation;
import com.example.gajz.transferrelationship.service.TransferRelationshipService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import redis.clients.jedis.Jedis;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* @author lenovo
*/
@Validated
@Service
public class TransferRelationshipServiceImpl implements TransferRelationshipService {
@Autowired
TransferRelationshipMapper transferRelationshipMapper;
/**HugeGraph*/
@Autowired
HugeCollectionProperties hugeCollectionProperties;
/**
* 转账关系
* @return
*/
@Override
public List<data> edge() {
List<com.example.gajz.transferrelationship.bean.param.data> edge = transferRelationshipMapper.edge();
List transList=new ArrayList<>();
// System.out.println(edge.size()+"边");
// //获取redis连接
// Jedis conn = ConFigRedis.getConn();
for (int i=0;i<edge.size();i++){
TransferRelationship transferRelationship=new TransferRelationship();
Source source=new Source();
source.setId(edge.get(i).getSource());
Target target=new Target();
target.setId(edge.get(i).getTarget());
/**
* 转账次数
*/
TransferTimes transferTimes=new TransferTimes();
if (edge.get(i).getTransferTimes()>2){
transferTimes.setLineSize(1);
}else {
transferTimes.setLineSize(0.5);
}
transferTimes.setTransferTimes(edge.get(i).getTransferTimes());
transferRelationship.setSource(source);
transferRelationship.setTarget(target);
transferRelationship.setTransferTimes(transferTimes);
transList.add(transferRelationship);
}
// conn.close();
return transList;
}
/**
* 点
*/
@Override
public List diagramSpot() {
// Jedis conn = ConFigRedis.getConn();
/**已经存在的点 会存储到map里面*/
HashMap hashMap=new HashMap();
//查询转账人(中心点)信息
List<TransferCardVo> transferCardVos = transferRelationshipMapper.selectTransferCard();
List list=new ArrayList();
int centerPointX = 0;
int centerPointY = 0;
//存储所有大圆的四角X Y轴数据
HashMap xyMap = new HashMap();
/** 中心点*/
for (int i=0;i<transferCardVos.size();i++){
//是否重叠
boolean overlap=false;
//生成颜色
Colour colour=new Colour();
String code=colour.getColour();
Test test=new Test();
test.setId(transferCardVos.get(i).getBankCardNo());
test.setX((int)(Math.random()*3000));
test.setY((int)(Math.random()*3000));
test.setName(transferCardVos.get(i).getName());
test.setColor(code);
centerPointX=test.getX();
centerPointY=test.getY();
/** -----------------------------去掉被转账人对应中心点重复出现点 代码--------------------------------*/
/**查询被转账人全部信息*/
List<com.example.gajz.transferrelationship.bean.param.data> transfer = transferRelationshipMapper.transferRelationship(transferCardVos.get(i).getBankCardNo());
/**将没有重复的值 存储到这个list里面*/
List<com.example.gajz.transferrelationship.bean.param.data> dataList=new ArrayList<>();
for (int p=0;p<transfer.size();p++){
Object target = hashMap.get(transfer.get(p).getTarget());
if (target==null){
com.example.gajz.transferrelationship.bean.param.data data=new com.example.gajz.transferrelationship.bean.param.data();
data.setName(transfer.get(p).getName());
data.setTarget(transfer.get(p).getTarget());
data.setTransferTimes(transfer.get(p).getTransferTimes());
dataList.add(data);
hashMap.put(transfer.get(p).getTarget(),transfer.get(p).getTarget());
}
}
/** -----------------------------------------------------------------------------------------*/
if (dataList.size()==0||dataList.size()<=100){
test.setSize(2);
}else if (dataList.size()>=100){
test.setSize(2);
}
/**每圈点数 动态变化 */
int base = 8;
/**总数*/
int total = dataList.size();
/**循环次数*/
int numberCycles =0;
/** -----------------------计算大图四个角的XY轴代码-----------------------*/
/**算大圈半径专用 总数*/
int bigTotal = dataList.size();
/**算大圈半径专用 每圈点数*/
int bigBase = 8;
for (int n=1;bigTotal>0;n++){
bigTotal = bigTotal-bigBase;
bigBase = bigBase+20;
}
/** 大圆最后一圈半径 每份多少点数 */
int bigPointsPerShare = bigBase/4;
/**大圆最后一圈半径 相等于大圈半径 点数*距离 */
int fullCircleRadius =bigPointsPerShare*2;
/** -------------------------------------------------------------------*/
if (i==0){
xyMap.put(i+"zX",(centerPointX-fullCircleRadius)); //圆左X轴
xyMap.put(i+"zY",centerPointY); //圆左Y轴
xyMap.put(i+"yX",(centerPointX+fullCircleRadius)); //圆右X轴
xyMap.put(i+"yY",centerPointY); //圆右Y轴
xyMap.put(i+"sX",centerPointX); //圆上X轴
xyMap.put(i+"sY",(centerPointY-fullCircleRadius)); //圆上Y轴
xyMap.put(i+"xX",centerPointX); //圆下X轴
xyMap.put(i+"xY",(centerPointY+fullCircleRadius)); //圆下Y轴
// /** 将中心点X Y轴拼接 并存入Redis中*/
// String position=test.getX()+"Y"+test.getY();
// conn.set(test.getId(),position);
list.add(test);
overlap=true;
}else {
for (int p=0;p<i;p++){
int zX = (int) xyMap.get(p + "zX");
int zY = (int) xyMap.get(p + "zY");
int yX = (int) xyMap.get(p + "yX");
int yY = (int) xyMap.get(p + "yY");
int sX = (int) xyMap.get(p + "sX");
int sY = (int) xyMap.get(p + "sY");
int xX = (int) xyMap.get(p + "xX");
int xY = (int) xyMap.get(p + "xY");
if( ((zX>(centerPointX-fullCircleRadius)&&zX>(centerPointX+fullCircleRadius)) ||(yX<(centerPointX-fullCircleRadius)&&yX<(centerPointX+fullCircleRadius)))
||
((sY>(centerPointY-fullCircleRadius)&&sY>(centerPointY+fullCircleRadius)) ||(xY<(centerPointY-fullCircleRadius)&&xY<(centerPointY+fullCircleRadius))) ){
if (p==i-1) {
xyMap.put(i + "zX", (centerPointX-fullCircleRadius)); //圆左X轴
xyMap.put(i + "zY", centerPointY); //圆左Y轴
xyMap.put(i + "yX", (centerPointX+fullCircleRadius)); //圆右X轴
xyMap.put(i + "yY", centerPointY); //圆右Y轴
xyMap.put(i + "sX", centerPointX); //圆上X轴
xyMap.put(i + "sY", (centerPointY-fullCircleRadius)); //圆上Y轴
xyMap.put(i + "xX", centerPointX); //圆下X轴
xyMap.put(i + "xY", (centerPointY+fullCircleRadius)); //圆下Y轴
/** 将中心点X Y轴拼接 并存入Redis中*/
// String position=test.getX()+"Y"+test.getY();
// conn.set(test.getId(),position);
list.add(test);
overlap=true;
}
}else {
overlap=false;
break;
}
}
}
if (!overlap){
i--;
continue;
}
/**圆圈层数 每循环一次 就是一圈*/
for (int y=1;total>0;y++){
/**点之间 x轴y轴间隔距离*/
int distance=2;
/**圆分成四份 每份多少点数*/
int pointsPerShare = base/4;
/**小圆半径 点数X距离*/
int circleRadius = pointsPerShare * distance;
/**右下角逐渐递减*/
int lowerRight = 0;
/**左下角逐渐递减*/
int lowerLeft = 0;
/**左上角逐渐递减*/
int upperLeft = 0;
/**点大小*/
double pointSize =1;
if (base<=total){
for (int t=0;t<base;t++){
Test test1=new Test();
if (t<pointsPerShare){
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX((distance*t)+centerPointX);
test1.setY((centerPointY-circleRadius)+(distance*t));
test1.setColor(code);
test1.setSize(pointSize);
}else if (t<=pointsPerShare*2){
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX((centerPointX+circleRadius)-(distance*lowerRight));
test1.setY(centerPointY+(lowerRight*distance));
test1.setColor(code);
test1.setSize(pointSize);
lowerRight++;
}else if (t<=pointsPerShare*3){
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX((centerPointX-circleRadius)+(distance*lowerLeft));
test1.setY(centerPointY+(distance*lowerLeft));
test1.setColor(code);
test1.setSize(pointSize);
lowerLeft++;
}else if (t<=pointsPerShare*4){
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX(centerPointX-(distance*upperLeft));
test1.setY((centerPointY-circleRadius)+(distance*upperLeft));
test1.setColor(code);
test1.setSize(pointSize);
upperLeft++;
}
// /** 将其他点 X Y轴拼接 并存入Redis中*/
// String position=test1.getX()+"Y"+test1.getY();
// conn.set(test1.getId(),position);
list.add(test1);
numberCycles++;
}
total=total-base;
base = base+20;
continue;
}
if (base>0){
for (int t=0;numberCycles<dataList.size();t++){
Test test1=new Test();
if (t<pointsPerShare){
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX((distance*t)+centerPointX);
test1.setY((centerPointY-circleRadius)+(distance*t));
test1.setColor(code);
test1.setSize(pointSize);
}else if (t<=pointsPerShare*2){
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX((centerPointX+circleRadius)-(distance*lowerRight));
test1.setY(centerPointY+(lowerRight*distance));
test1.setColor(code);
test1.setSize(pointSize);
lowerRight++;
}else if (t<=pointsPerShare*3){
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX((centerPointX-circleRadius)+(distance*lowerLeft));
test1.setY(centerPointY+(distance*lowerLeft));
test1.setColor(code);
test1.setSize(pointSize);
lowerLeft++;
}else if (t<=pointsPerShare*4){
test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName());
test1.setX(centerPointX-(distance*upperLeft));
test1.setY((centerPointY-circleRadius)+(distance*upperLeft));
test1.setColor(code);
test1.setSize(pointSize);
upperLeft++;
}
// /** 将其他点 X Y轴拼接 并存入Redis中*/
// String position=test1.getX()+"Y"+test1.getY();
// conn.set(test1.getId(),position);
list.add(test1);
numberCycles++;
}
break;
}
}
}
// conn.close();
return list;
}
/**
* 关系图搜索 单人转账关系(关联关系)接口
* @param cardnumbe
* @return
*/
@Override
public Result searchRelationship(String cardnumbe) {
try {
//查询搜索人信息 转账人
List<SearchRelationshipVo> searchRelationshipVos1 = transferRelationshipMapper.personalInformationTransferor(cardnumbe);
//查询搜索人信息 被转账人
List<SearchRelationshipVo> searchRelationshipVos2 = transferRelationshipMapper.personalInformationTransferredPerson(cardnumbe);
/**先查询用户信息是转账人还是被转账人 之后将数据存入list中 如果两个都没有就返回null*/
List<SearchRelationshipVo> searchRelationshipVos = new ArrayList<>();
if (searchRelationshipVos1.size()!=0||searchRelationshipVos2.size()!=0){
if (searchRelationshipVos1.size()!=0){
for (int i=0;i<searchRelationshipVos1.size();i++) {
SearchRelationshipVo searchRelationshipVo = new SearchRelationshipVo();
searchRelationshipVo.setName(searchRelationshipVos1.get(i).getName());
searchRelationshipVo.setRelationship(searchRelationshipVos1.get(i).getRelationship());
searchRelationshipVo.setTransferTimes(searchRelationshipVos1.get(i).getTransferTimes());
searchRelationshipVo.setCardNumber(searchRelationshipVos1.get(i).getCardNumber());
searchRelationshipVos.add(searchRelationshipVo);
}
}else{
for (int i=0;i<searchRelationshipVos2.size();i++) {
SearchRelationshipVo searchRelationshipVo = new SearchRelationshipVo();
searchRelationshipVo.setName(searchRelationshipVos2.get(i).getName());
searchRelationshipVo.setRelationship(searchRelationshipVos2.get(i).getRelationship());
searchRelationshipVo.setTransferTimes(searchRelationshipVos2.get(i).getTransferTimes());
searchRelationshipVo.setCardNumber(searchRelationshipVos2.get(i).getCardNumber());
searchRelationshipVos.add(searchRelationshipVo);
}
}
}else {
return new Result(ResultCode.SUCCESS);
}
//存放数据list
List<SearchRelationshipVo> searchRelationshipVoList = new ArrayList<>();
/**创建map 将已经查询出来的下级存入map中 防止相互转账进入死循环*/
HashMap hashMap=new HashMap();
//转账人
for (int i = 0; i < searchRelationshipVos.size(); i++) {
SearchRelationshipVo searchRelationshipVo = new SearchRelationshipVo();
searchRelationshipVo.setName(searchRelationshipVos.get(i).getName());
searchRelationshipVo.setRelationship(searchRelationshipVos.get(i).getRelationship());
searchRelationshipVo.setTransferTimes(searchRelationshipVos.get(i).getTransferTimes());
searchRelationshipVo.setCardNumber(searchRelationshipVos.get(i).getCardNumber());
//存入map
hashMap.put(searchRelationshipVos.get(i).getCardNumber(),searchRelationshipVos.get(i).getCardNumber());
/** 查询下级数据*/
List<SearchRelationshipVo> searchRelationshipVoSubordinateList = transferRelationshipMapper.querySubordinate(searchRelationshipVos.get(i).getCardNumber());
/**判断是否有下级 如果有给true*/
if (searchRelationshipVoSubordinateList.size()!=0){
searchRelationshipVo.setSubordinate(true);
}else {
searchRelationshipVo.setSubordinate(false);
}
searchRelationshipVoList.add(searchRelationshipVo);
if (searchRelationshipVoSubordinateList.size() != 0) {
/**存放下级参数list*/
List<SearchRelationshipVo> list = new ArrayList<>();
for (int n = 0; n < searchRelationshipVoSubordinateList.size(); n++) {
SearchRelationshipVo searchRelationshipSubordinateVo = new SearchRelationshipVo();
searchRelationshipSubordinateVo.setName(searchRelationshipVoSubordinateList.get(n).getName());
searchRelationshipSubordinateVo.setCardNumber(searchRelationshipVoSubordinateList.get(n).getCardNumber());
searchRelationshipSubordinateVo.setTransferTimes(searchRelationshipVoSubordinateList.get(n).getTransferTimes());
searchRelationshipSubordinateVo.setRelationship(searchRelationshipVos.get(i).getCardNumber());
List<SearchRelationshipVo> searchRelationshipVoSubordinateList1 = transferRelationshipMapper.querySubordinate(searchRelationshipVoSubordinateList.get(n).getCardNumber());
/**判断是否有下级 如果有给true*/
if (searchRelationshipVoSubordinateList1.size()!=0){
searchRelationshipSubordinateVo.setSubordinate(true);
}else {
searchRelationshipSubordinateVo.setSubordinate(false);
}
//存放数据
searchRelationshipVoList.add(searchRelationshipSubordinateVo);
//存入map
hashMap.put(searchRelationshipVoSubordinateList.get(n).getCardNumber(),searchRelationshipVoSubordinateList.get(n).getCardNumber());
list.add(searchRelationshipSubordinateVo);
}
for (int r = 0; r < 1; ) {
//临时存储查询出来的参数
List<SearchRelationshipVo> list1 = new ArrayList<>();
for (int y = 0; y < list.size(); y++) {
List<SearchRelationshipVo> searchRelationshipVoSubordinateList1 = transferRelationshipMapper.querySubordinate(list.get(y).getCardNumber());
if (searchRelationshipVoSubordinateList1.size() != 0) {
for (int l=0;l<searchRelationshipVoSubordinateList1.size();l++) {
/**根据下级卡号 对比map 如果已经有值代表已经查询出过此卡号 跳过此次循环开启下一圈*/
Object number = hashMap.get(searchRelationshipVoSubordinateList1.get(l).getCardNumber());
if (number==null) {
SearchRelationshipVo searchRelationshipSubordinateVo = new SearchRelationshipVo();
searchRelationshipSubordinateVo.setName(searchRelationshipVoSubordinateList1.get(l).getName());
searchRelationshipSubordinateVo.setCardNumber(searchRelationshipVoSubordinateList1.get(l).getCardNumber());
searchRelationshipSubordinateVo.setRelationship(list.get(y).getCardNumber());
searchRelationshipSubordinateVo.setTransferTimes(searchRelationshipVoSubordinateList1.get(l).getTransferTimes());
List<SearchRelationshipVo> searchRelationshipVoSubordinateList2 = transferRelationshipMapper.querySubordinate(searchRelationshipVoSubordinateList1.get(l).getCardNumber());
if (searchRelationshipVoSubordinateList2.size()!=0){
searchRelationshipSubordinateVo.setSubordinate(true);
}else {
searchRelationshipSubordinateVo.setSubordinate(false);
}
searchRelationshipVoList.add(searchRelationshipSubordinateVo);
list1.add(searchRelationshipSubordinateVo);
//存入map
hashMap.put(searchRelationshipVoSubordinateList1.get(l).getCardNumber(), searchRelationshipVoSubordinateList1.get(l).getCardNumber());
}
}
}
}
//清空上一级的参数
list.clear();
if (list1.size() == 0) {
r++;
}
//将新查询出来下一级的参数放入list当中
for (int v = 0; v < list1.size(); v++) {
/**循环完成后 判断只让有下级的人进入下次循环*/
if (list1.get(v).getSubordinate()){
SearchRelationshipVo searchRelationshipSubordinateVo = new SearchRelationshipVo();
searchRelationshipSubordinateVo.setCardNumber(list1.get(v).getCardNumber());
list.add(searchRelationshipSubordinateVo);
}
}
list1.clear();
}
}
}
RelationalAlgorithm relationalAlgorithm=new RelationalAlgorithm();
//开启redis
Jedis redis = ConFigRedis.getConn();
//清空之前全部数据
redis.flushAll();
int o=0;
for (int i=0;i<searchRelationshipVoList.size();i++){
if (searchRelationshipVoList.get(i).getSubordinate()){
redis.set("cardnumbe"+o++,searchRelationshipVoList.get(i).getCardNumber());
}
}
//关闭redis
redis.close();
List list = relationalAlgorithm.searchPresentation(searchRelationshipVoList);
return new Result(ResultCode.SUCCESS,list);
}catch (Exception e){
return new Result(ResultCode.FAIL);
}
}
/**
* 转账关系图 信息搜索接口 查询某一个点的具体位置
* @param id
* @return
*/
@Override
public Result specificLocation(String id) {
try {
EchartsUserVo echartsUserVo=new EchartsUserVo();
Jedis conn = ConFigRedis.getConn();
String position = conn.get(id);
/**
* 截取X
*/
String x = StringUtils.substringBefore(position, "Y");
/**
* 截取Y
*/
String Y = position.substring(x.length()+1, position.length());
echartsUserVo.setName(id);
echartsUserVo.setX(Integer.parseInt(x));
echartsUserVo.setY(Integer.parseInt(Y));
return new Result(ResultCode.SUCCESS,echartsUserVo);
}catch (Exception e){
return new Result(ResultCode.FAIL);
}
}
/**
* 清空关系图数据表
*/
@Override
public void emptyTransferRelationship() {
transferRelationshipMapper.emptyTransferRelationship();
}
/**
* excel数据导入数据库
* @param eSerialsList
*/
@Override
public void insertTransferRelationship(List<abcExcie> eSerialsList) {
transferRelationshipMapper.insertTransferRelationship(eSerialsList);
}
/**
* 关系图 搜索接口
* @param name
* @return
*/
@Override
public Result pointSearch(String name) {
try {
boolean numeric = StringUtils.isNumeric(name);
String cardNumber = null;
String fullName = null;
if (numeric) {
cardNumber = name;
} else {
fullName = name;
}
//查询转账人
List<SearchRelationshipVo> searchRelationshipVos = this.transferRelationshipMapper.queryTransferor(cardNumber, fullName);
//查询被转账人
List<SearchRelationshipVo> searchRelationshipVos1 = this.transferRelationshipMapper.queryTheTransferredPerson(cardNumber, fullName);
List<SearchRelationshipVo> searchRelationshipVoList = new ArrayList<>();
HashMap hashMap=new HashMap();
if (searchRelationshipVos.size() != 0 || searchRelationshipVos1.size() != 0 ) {
if (searchRelationshipVos.size() != 0) {
for (int i = 0; i < searchRelationshipVos.size(); i++) {
if (hashMap.get(searchRelationshipVos.get(i).getCardNumber())==null){
SearchRelationshipVo searchRelationshipVo = new SearchRelationshipVo();
searchRelationshipVo.setName(searchRelationshipVos.get(i).getName());
searchRelationshipVo.setRelationship(searchRelationshipVos.get(i).getRelationship());
searchRelationshipVo.setCardNumber(searchRelationshipVos.get(i).getCardNumber());
searchRelationshipVoList.add(searchRelationshipVo);
hashMap.put(searchRelationshipVos.get(i).getCardNumber(),searchRelationshipVos.get(i).getCardNumber());
}
}
}
if (searchRelationshipVos1.size() != 0) {
for (int n = 0; n < searchRelationshipVos1.size(); n++) {
if (hashMap.get(searchRelationshipVos1.get(n).getCardNumber())==null) {
SearchRelationshipVo searchRelationshipVo = new SearchRelationshipVo();
searchRelationshipVo.setName(searchRelationshipVos1.get(n).getName());
searchRelationshipVo.setRelationship(searchRelationshipVos1.get(n).getRelationship());
searchRelationshipVo.setCardNumber(searchRelationshipVos1.get(n).getCardNumber());
searchRelationshipVoList.add(searchRelationshipVo);
}
}
}
return new Result(ResultCode.SUCCESS, searchRelationshipVoList);
}
if (searchRelationshipVos.size() != 0)
return new Result(ResultCode.SUCCESS, searchRelationshipVos);
return new Result(ResultCode.SUCCESS, searchRelationshipVos1);
} catch (Exception e) {
return new Result(ResultCode.FAIL);
}
}
/**
* 查询两人转账关系 (生成点)(关系图) 接口
* @param transferAssociationParam
* @return
*/
@Override
public Result transferAssociation(TransferAssociationParam transferAssociationParam) {
//点 X Y轴生成类
TransferLocation transferLocation=new TransferLocation();
//层级
int Hierarchy=1;
//生成颜色
Colour colour=new Colour();
//查询搜索人信息 转账人
List<SearchRelationshipVo> searchRelationshipVos = transferRelationshipMapper.personalInformationTransferor(transferAssociationParam.getTransfer());
//查询搜索人信息 被转账人
List<SearchRelationshipVo> searchRelationshipVos1 = transferRelationshipMapper.personalInformationTransferredPerson(transferAssociationParam.getTransfer());
//将查询出来的转账人数据放入list中
List<SearchRelationshipVo> searchRelationshipVoList1 = new ArrayList<>();
SearchRelationshipVo searchRelationshipVo1 = new SearchRelationshipVo();
/** 创建map 存放已经查询到的上级卡号 用于判断卡号是否已经重复查询*/
HashMap hashMap1=new HashMap();
//判断 是转账人列查询出来的 还是被转账人列查询出来的
if (searchRelationshipVos.size() != 0) {
for (int i = 0; i < searchRelationshipVos.size(); i++) {
searchRelationshipVo1.setCardNumber(searchRelationshipVos.get(i).getCardNumber());
searchRelationshipVo1.setName(searchRelationshipVos.get(i).getName());
searchRelationshipVo1.setRelationship(searchRelationshipVos.get(i).getRelationship());
searchRelationshipVo1.setSubordinate(searchRelationshipVos.get(i).getSubordinate());
searchRelationshipVo1.setTransferTimes(searchRelationshipVos.get(i).getTransferTimes());
searchRelationshipVoList1.add(searchRelationshipVo1);
}
} else {
for (int i = 0; i < searchRelationshipVos1.size(); i++) {
searchRelationshipVo1.setCardNumber(searchRelationshipVos1.get(i).getCardNumber());
searchRelationshipVo1.setName(searchRelationshipVos1.get(i).getName());
searchRelationshipVo1.setRelationship(searchRelationshipVos1.get(i).getRelationship());
searchRelationshipVo1.setSubordinate(searchRelationshipVos1.get(i).getSubordinate());
searchRelationshipVo1.setTransferTimes(searchRelationshipVos1.get(i).getTransferTimes());
searchRelationshipVoList1.add(searchRelationshipVo1);
}
}
/**将有关系的数据放入这个list中 最终返回这个list*/
List<SearchRelationshipVo> transferAssociationList = new ArrayList<>();
/** 存放下级关系数据*/
List<SearchRelationshipVo> searchRelationshipVoList = new ArrayList<>();
/**创建map 将已经查询出来的下级存入map中 防止相互转账进入死循环*/
HashMap hashMap = new HashMap();
//转账人
for (int i = 0; i < searchRelationshipVoList1.size(); i++) {
SearchRelationshipVo searchRelationshipVo = new SearchRelationshipVo();
searchRelationshipVo.setName(searchRelationshipVoList1.get(i).getName());
searchRelationshipVo.setRelationship(searchRelationshipVoList1.get(i).getRelationship());
searchRelationshipVo.setTransferTimes(searchRelationshipVoList1.get(i).getTransferTimes());
searchRelationshipVo.setX(-300);
searchRelationshipVo.setY(600);
searchRelationshipVo.setColor(colour.getColour());
searchRelationshipVo.setSize(20);
searchRelationshipVo.setHierarchy(Hierarchy);
searchRelationshipVo.setCardNumber(searchRelationshipVoList1.get(i).getCardNumber());
//层级递增
Hierarchy++;
//存入map
hashMap.put(searchRelationshipVoList1.get(i).getCardNumber(), searchRelationshipVoList1.get(i).getCardNumber());
/** 查询下级数据*/
List<SearchRelationshipVo> searchRelationshipVoSubordinateList = transferRelationshipMapper.querySubordinate(searchRelationshipVoList1.get(i).getCardNumber());
searchRelationshipVo.setSubordinateQuantity(searchRelationshipVoSubordinateList.size());
/**判断是否有下级 如果有给true*/
if (searchRelationshipVoSubordinateList.size() != 0) {
searchRelationshipVo.setSubordinate(true);
} else {
searchRelationshipVo.setSubordinate(false);
}
searchRelationshipVoList.add(searchRelationshipVo);
transferAssociationList.add(searchRelationshipVo);
if (searchRelationshipVoSubordinateList.size() != 0) {
/**存放下级参数list*/
List<SearchRelationshipVo> list = new ArrayList<>();
for (int n = 0; n < searchRelationshipVoSubordinateList.size(); n++) {
SearchRelationshipVo searchRelationshipSubordinateVo = new SearchRelationshipVo();
searchRelationshipSubordinateVo.setName(searchRelationshipVoSubordinateList.get(n).getName());
searchRelationshipSubordinateVo.setCardNumber(searchRelationshipVoSubordinateList.get(n).getCardNumber());
searchRelationshipSubordinateVo.setTransferTimes(searchRelationshipVoSubordinateList.get(n).getTransferTimes());
searchRelationshipSubordinateVo.setRelationship(searchRelationshipVos.get(i).getCardNumber());
searchRelationshipSubordinateVo.setHierarchy(Hierarchy);
//查询下级
List<SearchRelationshipVo> searchRelationshipVoSubordinateList1 = transferRelationshipMapper.querySubordinate(searchRelationshipVoSubordinateList.get(n).getCardNumber());
searchRelationshipSubordinateVo.setSubordinateQuantity(searchRelationshipVoSubordinateList1.size());
/**判断这一层中是否有被转账人 如果有就存入list中 结束循环*/
if (searchRelationshipVoSubordinateList.get(n).getCardNumber().equals(transferAssociationParam.getPayee())) {
searchRelationshipSubordinateVo.setSubordinate(false);
searchRelationshipSubordinateVo.setX((int)(Math.random()*2000));
searchRelationshipSubordinateVo.setY((int)(Math.random()*800));
searchRelationshipSubordinateVo.setColor(colour.getColour());
searchRelationshipSubordinateVo.setSize(10);
transferAssociationList.add(searchRelationshipSubordinateVo);
List<SearchRelationshipVo> searchRelationshipVoList2 = transferLocation.transferLocation(transferAssociationList);
return new Result(ResultCode.SUCCESS, searchRelationshipVoList2);
}
/**判断是否有下级 如果有给true*/
if (searchRelationshipVoSubordinateList1.size() != 0) {
searchRelationshipSubordinateVo.setSubordinate(true);
} else {
searchRelationshipSubordinateVo.setSubordinate(false);
}
//存放数据
searchRelationshipVoList.add(searchRelationshipSubordinateVo);
//存入map
hashMap.put(searchRelationshipVoSubordinateList.get(n).getCardNumber(), searchRelationshipVoSubordinateList.get(n).getCardNumber());
list.add(searchRelationshipSubordinateVo);
}
for (int r = 0; r < 1; ) {
Hierarchy++;
//临时存储查询出来的参数
List<SearchRelationshipVo> list1 = new ArrayList<>();
for (int y = 0; y < list.size(); y++) {
//查询下级数据
List<SearchRelationshipVo> searchRelationshipVoSubordinateList1 = transferRelationshipMapper.querySubordinate(list.get(y).getCardNumber());
if (searchRelationshipVoSubordinateList1.size() != 0) {
for (int l = 0; l < searchRelationshipVoSubordinateList1.size(); l++) {
/**根据下级卡号 对比map 如果已经有值代表已经查询出过此卡号 跳过此次循环开启下一圈*/
Object number = hashMap.get(searchRelationshipVoSubordinateList1.get(l).getCardNumber());
if (number == null) {
SearchRelationshipVo searchRelationshipSubordinateVo = new SearchRelationshipVo();
searchRelationshipSubordinateVo.setSubordinateQuantity(searchRelationshipVoSubordinateList1.size());
searchRelationshipSubordinateVo.setName(searchRelationshipVoSubordinateList1.get(l).getName());
searchRelationshipSubordinateVo.setCardNumber(searchRelationshipVoSubordinateList1.get(l).getCardNumber());
searchRelationshipSubordinateVo.setRelationship(list.get(y).getCardNumber());
searchRelationshipSubordinateVo.setTransferTimes(searchRelationshipVoSubordinateList1.get(l).getTransferTimes());
searchRelationshipSubordinateVo.setHierarchy(Hierarchy);
List<SearchRelationshipVo> searchRelationshipVoSubordinateList2 = transferRelationshipMapper.querySubordinate(searchRelationshipVoSubordinateList1.get(l).getCardNumber());
searchRelationshipSubordinateVo.setSubordinateQuantity(searchRelationshipVoSubordinateList2.size());
if (searchRelationshipVoSubordinateList2.size() != 0) {
searchRelationshipSubordinateVo.setSubordinate(true);
} else {
searchRelationshipSubordinateVo.setSubordinate(false);
}
searchRelationshipVoList.add(searchRelationshipSubordinateVo);
list1.add(searchRelationshipSubordinateVo);
//存入map
hashMap.put(searchRelationshipVoSubordinateList1.get(l).getCardNumber(), searchRelationshipVoSubordinateList1.get(l).getCardNumber());
/**
* 判断这一层中是否有被转账人 如果有就存入返回值list中 如果进入此判断 代表已经找到被转账人 之后从被转账人往上循环推进
*/
if (searchRelationshipSubordinateVo.getCardNumber().equals(transferAssociationParam.getPayee())) {
searchRelationshipSubordinateVo.setX(2300);
searchRelationshipSubordinateVo.setY(600);
searchRelationshipSubordinateVo.setColor(colour.getColour());
searchRelationshipSubordinateVo.setSize(20);
searchRelationshipSubordinateVo.setHierarchy(Hierarchy);
//添加被转账人信息
transferAssociationList.add(searchRelationshipSubordinateVo);
//存放需要查询上级的人的卡号 List
List<SearchRelationshipVo> superiorList = new ArrayList<>();
superiorList.add(searchRelationshipSubordinateVo);
//向防止重复map添加已经查询到的上级卡号
hashMap1.put(searchRelationshipSubordinateVo.getCardNumber(),searchRelationshipSubordinateVo.getCardNumber());
for (int b=0;b<1;) {
for (int a = 0; a < superiorList.size(); a++) {
//查询上级转账人方法
List<SearchRelationshipVo> superior = transferRelationshipMapper.querySuperior(superiorList.get(a).getCardNumber());
//清空list数据
superiorList.clear();
//判断上级是否是转账人 如果是 就直接返回数据
for (int h = 0; h < superior.size(); h++) {
if (superior.get(h).getCardNumber().equals(transferAssociationParam.getTransfer())) {
List<SearchRelationshipVo> searchRelationshipVoList2 = transferLocation.transferLocation(transferAssociationList);
return new Result(ResultCode.SUCCESS, searchRelationshipVoList2);
}
}
//循环对比查询出来的上级与所有list存储的下级做对比
for (int k = 0; k < searchRelationshipVoList.size(); k++) {
for (int n = 0; n < superior.size(); n++) {
//对比
if (superior.get(n).getCardNumber().equals(searchRelationshipVoList.get(k).getCardNumber())) {
SearchRelationshipVo searchRelationshipSubordinateVo1 = new SearchRelationshipVo();
searchRelationshipSubordinateVo1.setCardNumber(superior.get(n).getCardNumber());
searchRelationshipSubordinateVo1.setName(superior.get(n).getName());
searchRelationshipSubordinateVo1.setX((int) (Math.random() * 2000));
searchRelationshipSubordinateVo1.setY((int) (Math.random() * 800));
searchRelationshipSubordinateVo1.setColor(colour.getColour());
searchRelationshipSubordinateVo1.setSize(10);
searchRelationshipSubordinateVo1.setHierarchy(searchRelationshipVoList.get(k).getHierarchy());
searchRelationshipSubordinateVo1.setSubordinateQuantity(searchRelationshipVoList.get(k).getSubordinateQuantity());
Object Number = hashMap1.get(superior.get(n).getCardNumber());
if (Number==null){
//添加被转账人信息
transferAssociationList.add(searchRelationshipSubordinateVo1);
}
//向防止重复map添加已经查询到的上级卡号
hashMap1.put(superior.get(n).getCardNumber(), superior.get(n).getCardNumber());
superiorList.add(searchRelationshipSubordinateVo1);
}
}
}
}
}
}
}
}
}
}
//清空上一级的参数
list.clear();
if (list1.size() == 0) {
r++;
}
//将新查询出来下一级的参数放入list当中
for (int v = 0; v < list1.size(); v++) {
/**循环完成后 判断只让有下级的人进入下次循环*/
if (list1.get(v).getSubordinate()) {
SearchRelationshipVo searchRelationshipSubordinateVo = new SearchRelationshipVo();
searchRelationshipSubordinateVo.setCardNumber(list1.get(v).getCardNumber());
list.add(searchRelationshipSubordinateVo);
}
}
list1.clear();
}
}
}
for (int p = 0; p < searchRelationshipVoList.size(); p++) {
if (searchRelationshipVoList.get(p).getCardNumber() == transferAssociationParam.getPayee()) {
List<SearchRelationshipVo> searchRelationshipVoList2 = transferLocation.transferLocation(searchRelationshipVoList);
return new Result(ResultCode.SUCCESS, searchRelationshipVoList2);
}
}
//如果没有 就返回null
return new Result(ResultCode.SUCCESS, null);
}
/**
* 关系图搜索 单人转账关系 转账信息信息查询接口
* @return
*/
@Override
public Result personalTransferRelationship(){
Jedis redis = ConFigRedis.getConn();
List list=new ArrayList();
for (int i=0;i<i+1;i++){
//获取redis
String cardnumbe= redis.get("cardnumbe" + i);
if (cardnumbe!=null){
/**
* 查询单人转账关系
*/
List<personalTransferRelationshipVo> personalTransferRelationshipVos = transferRelationshipMapper.personalTransferRelationship(cardnumbe);
for (int n=0;n<personalTransferRelationshipVos.size();n++){
TransferRelationship transferRelationship=new TransferRelationship();
Source source=new Source();
source.setId(personalTransferRelationshipVos.get(n).getSource());
Target target=new Target();
target.setId(personalTransferRelationshipVos.get(n).getTarget());
TransferTimes transferTimes=new TransferTimes();
transferTimes.setTransferTimes(personalTransferRelationshipVos.get(n).getTransferTimes());
transferRelationship.setSource(source);
transferRelationship.setTarget(target);
transferRelationship.setTransferTimes(transferTimes);
list.add(transferRelationship);
}
}else {
return new Result(ResultCode.SUCCESS,list);
}
}
return new Result(ResultCode.SUCCESS);
}
/**
* 查询两人转账关系 关系 (关系图) 接口
* @param transferAssociationParam
* @return
*/
@Override
public Result trBetweenTwoPersons(List<SearchRelationshipVo> transferAssociationParam) {
List list=new ArrayList();
for (int i=0;i<transferAssociationParam.size();i++){
if (!"个人".equals(transferAssociationParam.get(i).getRelationship())){
List<personalTransferRelationshipVo> personalTransferRelationshipVos = transferRelationshipMapper.trBetweenTwoPersons(transferAssociationParam.get(i).getCardNumber());
for (int n=0;n<personalTransferRelationshipVos.size();n++){
TransferRelationship transferRelationship=new TransferRelationship();
Source source=new Source();
source.setId(personalTransferRelationshipVos.get(n).getSource());
Target target=new Target();
target.setId(personalTransferRelationshipVos.get(n).getTarget());
TransferTimes transferTimes=new TransferTimes();
transferTimes.setTransferTimes(personalTransferRelationshipVos.get(n).getTransferTimes());
transferRelationship.setSource(source);
transferRelationship.setTarget(target);
transferRelationship.setTransferTimes(transferTimes);
if (!personalTransferRelationshipVos.get(n).getSource().equals(personalTransferRelationshipVos.get(n).getTarget())){
list.add(transferRelationship);
}
}
}
}
return new Result(ResultCode.SUCCESS,list);
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.constant.T;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 收款人顶点数据导入线程8
* @author lenovo
*/
public class ThreadsMultipleVerticesEight implements Runnable{
List<TransferredPersonVo> transferredPersonList;
public void ThreadsMultipleVerticesEightList(List<TransferredPersonVo> transferredPersonVos){
this.transferredPersonList=transferredPersonVos;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("顶点数据导入线程8开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferredPersonList.size();i++){
/**添加收款人顶点数据*/
graph.addVertex(
/**设置ID*/
T.id, transferredPersonList.get(i).getEndCardNo(),
T.label, "收款人",
/**设置收款次数*/
"收款次数", transferredPersonList.get(i).getNumber());
}
System.out.println("顶点数据导入线程8结束"+df.format(new Date()));
// hugeClient.close();
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.constant.T;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 收款人顶点数据导入线程11
* @author lenovo
*/
public class ThreadsMultipleVerticesEleven implements Runnable{
List<TransferredPersonVo> transferredPersonList;
public void ThreadsMultipleVerticesElevenList(List<TransferredPersonVo> transferredPersonVos){
this.transferredPersonList=transferredPersonVos;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("顶点数据导入线程11开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferredPersonList.size();i++){
/**添加收款人顶点数据*/
graph.addVertex(
/**设置ID*/
T.id, transferredPersonList.get(i).getEndCardNo(),
T.label, "收款人",
/**设置收款次数*/
"收款次数", transferredPersonList.get(i).getNumber());
}
System.out.println("顶点数据导入线程11结束"+df.format(new Date()));
hugeClient.close();
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.constant.T;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 收款人顶点数据导入线程5
* @author lenovo
*/
public class ThreadsMultipleVerticesFive implements Runnable{
List<TransferredPersonVo> transferredPersonList;
public void ThreadsMultipleVerticesFiveList(List<TransferredPersonVo> transferredPersonVos){
this.transferredPersonList=transferredPersonVos;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("顶点数据导入线程5开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferredPersonList.size();i++){
/**添加收款人顶点数据*/
graph.addVertex(
/**设置ID*/
T.id, transferredPersonList.get(i).getEndCardNo(),
T.label, "收款人",
/**设置收款次数*/
"收款次数", transferredPersonList.get(i).getNumber());
}
System.out.println("顶点数据导入线程5结束"+df.format(new Date()));
// hugeClient.close();
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.constant.T;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 收款人顶点数据导入线程4
* @author lenovo
*/
public class ThreadsMultipleVerticesFour implements Runnable{
List<TransferredPersonVo> transferredPersonList;
public void ThreadsMultipleVerticesFourList(List<TransferredPersonVo> transferredPersonVos){
this.transferredPersonList=transferredPersonVos;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("顶点数据导入线程4开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferredPersonList.size();i++){
/**添加收款人顶点数据*/
graph.addVertex(
/**设置ID*/
T.id, transferredPersonList.get(i).getEndCardNo(),
T.label, "收款人",
/**设置收款次数*/
"收款次数", transferredPersonList.get(i).getNumber());
}
System.out.println("顶点数据导入线程4结束"+df.format(new Date()));
// hugeClient.close();
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.constant.T;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 收款人顶点数据导入线程9
* @author lenovo
*/
public class ThreadsMultipleVerticesNine implements Runnable{
List<TransferredPersonVo> transferredPersonList;
public void ThreadsMultipleVerticesNineList(List<TransferredPersonVo> transferredPersonVos){
this.transferredPersonList=transferredPersonVos;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("顶点数据导入线程9开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferredPersonList.size();i++){
/**添加收款人顶点数据*/
graph.addVertex(
/**设置ID*/
T.id, transferredPersonList.get(i).getEndCardNo(),
T.label, "收款人",
/**设置收款次数*/
"收款次数", transferredPersonList.get(i).getNumber());
}
System.out.println("顶点数据导入线程9结束"+df.format(new Date()));
// hugeClient.close();
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.constant.T;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 收款人顶点数据导入线程1
* @author lenovo
*/
public class ThreadsMultipleVerticesOne implements Runnable{
List<TransferredPersonVo> transferredPersonList;
public void ThreadsMultipleVerticesOneList(List<TransferredPersonVo> transferredPersonVos){
this.transferredPersonList=transferredPersonVos;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("顶点数据导入线程1开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferredPersonList.size();i++){
/**添加收款人顶点数据*/
graph.addVertex(
/**设置ID*/
T.id, transferredPersonList.get(i).getEndCardNo(),
T.label, "收款人",
/**设置收款次数*/
"收款次数", transferredPersonList.get(i).getNumber());
}
System.out.println("顶点数据导入线程1结束"+df.format(new Date()));
// hugeClient.close();
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.constant.T;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 收款人顶点数据导入线程7
* @author lenovo
*/
public class ThreadsMultipleVerticesSeven implements Runnable{
List<TransferredPersonVo> transferredPersonList;
public void ThreadsMultipleVerticesSevenList(List<TransferredPersonVo> transferredPersonVos){
this.transferredPersonList=transferredPersonVos;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("顶点数据导入线程7开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferredPersonList.size();i++){
/**添加收款人顶点数据*/
graph.addVertex(
/**设置ID*/
T.id, transferredPersonList.get(i).getEndCardNo(),
T.label, "收款人",
/**设置收款次数*/
"收款次数", transferredPersonList.get(i).getNumber());
}
System.out.println("顶点数据导入线程7结束"+df.format(new Date()));
// hugeClient.close();
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.constant.T;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 收款人顶点数据导入线程6
* @author lenovo
*/
public class ThreadsMultipleVerticesSix implements Runnable{
List<TransferredPersonVo> transferredPersonList;
public void ThreadsMultipleVerticesSixList(List<TransferredPersonVo> transferredPersonVos){
this.transferredPersonList=transferredPersonVos;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("顶点数据导入线程6开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferredPersonList.size();i++){
/**添加收款人顶点数据*/
graph.addVertex(
/**设置ID*/
T.id, transferredPersonList.get(i).getEndCardNo(),
T.label, "收款人",
/**设置收款次数*/
"收款次数", transferredPersonList.get(i).getNumber());
}
System.out.println("顶点数据导入线程6结束"+df.format(new Date()));
// hugeClient.close();
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.constant.T;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 收款人顶点数据导入线程10
* @author lenovo
*/
public class ThreadsMultipleVerticesTen implements Runnable{
List<TransferredPersonVo> transferredPersonList;
public void ThreadsMultipleVerticesTenList(List<TransferredPersonVo> transferredPersonVos){
this.transferredPersonList=transferredPersonVos;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("顶点数据导入线程10开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferredPersonList.size();i++){
/**添加收款人顶点数据*/
graph.addVertex(
/**设置ID*/
T.id, transferredPersonList.get(i).getEndCardNo(),
T.label, "收款人",
/**设置收款次数*/
"收款次数", transferredPersonList.get(i).getNumber());
}
System.out.println("顶点数据导入线程10结束"+df.format(new Date()));
hugeClient.close();
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.constant.T;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 收款人顶点数据导入线程3
* @author lenovo
*/
public class ThreadsMultipleVerticesThree implements Runnable{
List<TransferredPersonVo> transferredPersonList;
public void ThreadsMultipleVerticesThreeList(List<TransferredPersonVo> transferredPersonVos){
this.transferredPersonList=transferredPersonVos;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("顶点数据导入线程3开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferredPersonList.size();i++){
/**添加收款人顶点数据*/
graph.addVertex(
/**设置ID*/
T.id, transferredPersonList.get(i).getEndCardNo(),
T.label, "收款人",
/**设置收款次数*/
"收款次数", transferredPersonList.get(i).getNumber());
}
System.out.println("顶点数据导入线程3结束"+df.format(new Date()));
// hugeClient.close();
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.constant.T;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 收款人顶点数据导入线程12
* @author lenovo
*/
public class ThreadsMultipleVerticesTwelve implements Runnable{
List<TransferredPersonVo> transferredPersonList;
public void ThreadsMultipleVerticesTwelveList(List<TransferredPersonVo> transferredPersonVos){
this.transferredPersonList=transferredPersonVos;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("顶点数据导入线程12开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferredPersonList.size();i++){
/**添加收款人顶点数据*/
graph.addVertex(
/**设置ID*/
T.id, transferredPersonList.get(i).getEndCardNo(),
T.label, "收款人",
/**设置收款次数*/
"收款次数", transferredPersonList.get(i).getNumber());
}
System.out.println("顶点数据导入线程12结束"+df.format(new Date()));
hugeClient.close();
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.constant.T;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 收款人顶点数据导入线程2
* @author lenovo
*/
public class ThreadsMultipleVerticesTwo implements Runnable{
List<TransferredPersonVo> transferredPersonList;
public void ThreadsMultipleVerticesTwoList(List<TransferredPersonVo> transferredPersonVos){
this.transferredPersonList=transferredPersonVos;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("顶点数据导入线程2开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferredPersonList.size();i++){
/**添加收款人顶点数据*/
graph.addVertex(
/**设置ID*/
T.id, transferredPersonList.get(i).getEndCardNo(),
T.label, "收款人",
/**设置收款次数*/
"收款次数", transferredPersonList.get(i).getNumber());
}
System.out.println("顶点数据导入线程2结束"+df.format(new Date()));
// hugeClient.close();
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 导入转账关系8号线程
* @author lenovo
*/
public class TransferAccountsEight implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsEightList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程8开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程8结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 导入转账关系18号线程
* @author lenovo
*/
public class TransferAccountsEighteen implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsEighteenList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程18开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程18结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 导入转账关系11号线程
* @author lenovo
*/
public class TransferAccountsEleven implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsElevenList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程11开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程11结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 导入转账关系15号线程
* @author lenovo
*/
public class TransferAccountsFifteen implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsFifteenList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程15开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程15结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @author lenovo
*/
public class TransferAccountsFive implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsFiveList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程5开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程5结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @author lenovo
*/
public class TransferAccountsFour implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsFourList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程4开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程4结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 导入转账关系14号线程
* @author lenovo
*/
public class TransferAccountsFourteen implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsFourteenList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程14开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程14结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 导入转账关系9号线程
* @author lenovo
*/
public class TransferAccountsNine implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsNineList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程9开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程9结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 导入转账关系19号线程
* @author lenovo
*/
public class TransferAccountsNineteen implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsNineteenList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程19开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程19结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @author lenovo
*/
public class TransferAccountsOne implements Runnable {
List<TransferredPersonVo> transferList;
public void TransferAccountsOneList(List<TransferredPersonVo> transferCollectionList){
System.out.println(transferCollectionList.size());
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程1开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程1结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 导入转账关系7号线程
* @author lenovo
*/
public class TransferAccountsSeven implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsSevenList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程7开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程7结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 导入转账关系17号线程
* @author lenovo
*/
public class TransferAccountsSeventeen implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsSeventeenList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程17开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程17结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 线程6
* @author lenovo
*/
public class TransferAccountsSix implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsSixList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程6开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程6结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 导入转账关系16号线程
* @author lenovo
*/
public class TransferAccountsSixteen implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsSixteenList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程16开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程16结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 导入转账关系10号线程
* @author lenovo
*/
public class TransferAccountsTen implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsTenList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程10开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程10结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 导入转账关系13号线程
* @author lenovo
*/
public class TransferAccountsThirteen implements Runnable {
List<TransferredPersonVo> transferList;
public void TransferAccountsThirteenList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程13开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程13结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @author lenovo
*/
public class TransferAccountsThree implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsThreeList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程3开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程3结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 导入转账关系12号线程
* @author lenovo
*/
public class TransferAccountsTwelve implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsTwelveList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程12开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程12结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 导入转账关系20号线程
* @author lenovo
*/
public class TransferAccountsTwenty implements Runnable{
List<TransferredPersonVo> transferList;
public void TransferAccountsTwentyList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程20开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程20结束"+df.format(new Date()));
}
}
package com.example.gajz.transferrelationship.thread;
import com.baidu.hugegraph.driver.GraphManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.example.gajz.transferrelationship.bean.vo.TransferredPersonVo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @author lenovo
*/
public class TransferAccountsTwo implements Runnable {
List<TransferredPersonVo> transferList;
public void TransferAccountsTwoList(List<TransferredPersonVo> transferCollectionList){
this.transferList=transferCollectionList;
}
@Override
public void run() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("线程2开始"+df.format(new Date()));
HugeClient hugeClient = HugeClient.builder("http://36.148.1.253:8289","hugegraph2")
/*** 默认未开启用户权限*/
.configUser("**", "**")
.build();
GraphManager graph = hugeClient.graph();
for (int i=0;i<transferList.size();i++){
Vertex transferor = graph.getVertex(transferList.get(i).getBankCardNo());
Vertex payee = graph.getVertex(transferList.get(i).getEndCardNo());
//创建转账关系
transferor.addEdge("多人转账", payee, "转账次数", transferList.get(i).getNumber());
}
hugeClient.close();
System.out.println("线程2结束"+df.format(new Date()));
}
}
#配置文件信息
spring.thymeleaf.prefix=classpath:/static/
spring.thymeleaf.suffix=.html
#整合mybatis
mybatis.mapper-locations=classpath:/mapper/*.xml
mybatis.type-aliases-package=com.example.boot.bean
logging.level.com.example.pas.dao=debug
#服务器 端口
server.port=8090
#设置单个文件大小
spring.servlet.multipart.max-file-size= 50MB
#设置单次请求文件的总大小
spring.servlet.multipart.max-request-size= 50MB
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/ga?serverTimezone=UTC
username: root
password: 123456
#druid连接池配置
type: com.alibaba.druid.pool.DruidDataSource
druid:
#初始化时建立物理连接的个数
initial-size: 30
#最小连接池数量
min-idle: 30
#最大连接池数量 maxIdle已经不再使用
max-active: 50
#获取连接时最大等待时间,单位毫秒
max-wait: 60000
#申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
test-while-idle: true
#既作为检测的间隔时间又作为testWhileIdel执行的依据
time-between-eviction-runs-millis: 60000
#销毁线程时检测当前连接的最后活动时间和当前时间差大于该值时,关闭当前连接
min-evictable-idle-time-millis: 30000
#用来检测连接是否有效的sql 必须是一个查询语句
#mysql中为 select 'x'
#oracle中为 select 1 from dual
validation-query: select 'x'
#申请连接时会执行validationQuery检测连接是否有效,开启会降低性能,默认为true
test-on-borrow: false
#归还连接时会执行validationQuery检测连接是否有效,开启会降低性能,默认为true
test-on-return: false
#当数据库抛出不可恢复的异常时,抛弃该连接
exception-sorter: true
#是否缓存preparedStatement,mysql5.5+建议开启
pool-prepared-statements: true
#当值大于0时poolPreparedStatements会自动修改为true
max-pool-prepared-statement-per-connection-size: 20
#配置扩展插件
filters: stat,wall,slf4j
#通过connectProperties属性来打开mergeSql功能;慢SQL记录
connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
#合并多个DruidDataSource的监控数据
use-global-data-source-stat: true
#设置访问druid监控页的账号和密码,默认没有
stat-view-servlet:
login-username: admin
login-password: admin
# 日志的方式打印sql
#logging:
## level:
## com.example.demo.mapper: DEBUG
${AnsiColor.BRIGHT_YELLOW}
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
| | \\\ - /// | |
| \_| ''\---/'' | |
\ .-\__ `-` ___/-. /
___`. .' /--.--\ `. . __
."" '< `.___\_<|>_/___.' >'"".
| | : `- \`.;`\ _ /`;.`/ - ` : | |
\ \ `-. \_ __\ /__ _/ .-` / /
======`-.____`-.___\_____/___.-`____.-'======
`=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// 佛祖保佑 永无BUG //
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.gajz.transferrelationship.dao.TransferRelationshipMapper">
<!--查询全部转账卡号方法(中心点)-->
<select id="selectTransferCard" resultType="com.example.gajz.transferrelationship.bean.vo.TransferCardVo">
SELECT bank_card_no as bankCardNo,bank_account_name as name FROM abc_statement where bank_card_no is not null and bank_card_no != '' group by bank_card_no
</select>
<!--查询转账关系-->
<select id="edge" resultType="com.example.gajz.transferrelationship.bean.param.data">
select bank_card_no as source,end_card_no as target,count(id) as transferTimes from abc_statement where end_card_no is not null
group by source ,target
</select>
<!--查询被转账人全部信息-->
<select id="transferRelationship" resultType="com.example.gajz.transferrelationship.bean.param.data">
select distinct end_account_name as name,end_card_no as target from abc_statement where bank_card_no=#{bankCardNo}
HAVING end_card_no not in
(select distinct bank_card_no from abc_statement where bank_card_no is not null and end_card_no is not null)
</select>
<!--关系图搜索接口 查询搜索人转账关系-->
<select id="transferRecord" resultType="com.example.gajz.transferrelationship.bean.vo.SearchRelationshipVo">
select "转账" as relationship,end_account_name as name,end_card_no as cardNumber from abc_statement
where 1=1
<if test="fullName!=null and fullName!=''">
and bank_account_name=#{fullName}
</if>
<if test="cardNumber!=null and cardNumber!=''">
and bank_card_no=#{cardNumber}
</if>
and end_account_name is not null and end_card_no is not null group by end_card_no
</select>
<!--查询搜索人被转账记录-->
<select id="transferredRecord" resultType="com.example.gajz.transferrelationship.bean.vo.SearchRelationshipVo">
select "被转账" as relationship,bank_card_no as cardNumber,bank_account_name as name from abc_statement
where 1=1
<if test="fullName!=null and fullName!=''">
and end_account_name=#{fullName}
</if>
<if test="cardNumber!=null and cardNumber!=''">
and end_card_no=#{cardNumber}
</if>
and bank_card_no is not null and bank_account_name is not null group by bank_card_no
</select>
<!--查询搜索人信息 转账人-->
<select id="personalInformationTransferor" resultType="com.example.gajz.transferrelationship.bean.vo.SearchRelationshipVo">
select "个人" as relationship,bank_account_name as name,bank_card_no as cardNumber
from abc_statement where bank_card_no=#{cardnumbe}
and bank_card_no is not null and bank_account_name is not null group by bank_card_no
</select>
<!--查询搜索人信息 被转账人-->
<select id="personalInformationTransferredPerson" resultType="com.example.gajz.transferrelationship.bean.vo.SearchRelationshipVo">
select distinct end_account_name as name,end_card_no as cardNumber from abc_statement
where end_card_no=#{cardnumbe}
HAVING end_card_no not in
(select distinct bank_card_no from abc_statement where bank_card_no is not null and end_card_no is not null)
</select>
<!--清空关系图数据表-->
<delete id="emptyTransferRelationship">
truncate table abc_statement
</delete>
<!--excel数据导入数据库-->
<insert id="insertTransferRelationship" parameterType="java.util.List">
insert into abc_statement (
id_card,mobile,bank_account_name,bank_account_no,bank_card_no,temp_a,bank_name,is_capital_pool,
trade_date,trade_time,
payment_mark,temp_c,temp_d,pay_amount,balance,purpose,bonus,trade_nature,temp_f,temp_g,end_account_name,
end_card_no,end_bank_name,remark,comment,treade_place)
values
<foreach collection="list" item="lists" index= "index" separator=",">
(
#{lists.id_card},#{lists.mobile},#{lists.bank_account_name},
#{lists.bank_account_no},#{lists.bank_card_no},#{lists.temp_a},
#{lists.bank_name},#{lists.is_capital_pool},
#{lists.trade_date},#{lists.trade_time},
#{lists.payment_mark},#{lists.temp_c},
#{lists.temp_d},#{lists.pay_amount},#{lists.balance},
#{lists.purpose},#{lists.bonus},#{lists.trade_nature},
#{lists.temp_f},#{lists.temp_g},#{lists.end_account_name},
#{lists.end_card_no},#{lists.end_bank_name},#{lists.remark},
#{lists.comment},#{lists.treade_place}
)
</foreach>
</insert>
<!--查询搜索人关联下一级数据-->
<select id="querySubordinate" resultType="com.example.gajz.transferrelationship.bean.vo.SearchRelationshipVo">
select end_account_name as name,end_card_no as cardNumber,count(end_card_no) as transferTimes
from abc_statement where end_account_name is not null and end_card_no is not null and
bank_card_no=#{cardNumber} group by end_card_no
</select>
<!--查询转账人-->
<select id="queryTransferor" resultType= "com.example.gajz.transferrelationship.bean.vo.SearchRelationshipVo">
select "个人" as relationship,bank_account_name as name,bank_card_no as cardNumber
from abc_statement where 1=1
<if test="fullName!=null and fullName!=''">
and bank_account_name=#{fullName}
</if>
<if test="cardNumber!=null and cardNumber!=''">
and bank_card_no=#{cardNumber}
</if>
and bank_card_no is not null and bank_account_name is not null group by bank_card_no
</select>
<!--查询被转账人-->
<select id="queryTheTransferredPerson" resultType= "com.example.gajz.transferrelationship.bean.vo.SearchRelationshipVo">
select "个人" as relationship,end_account_name as name,end_card_no as cardNumber
from abc_statement where 1=1
<if test="fullName!=null and fullName!=''">
and end_account_name=#{fullName}
</if>
<if test="cardNumber!=null and cardNumber!=''">
and end_card_no=#{cardNumber}
</if>
and end_account_name is not null and end_card_no is not null group by end_card_no
</select>
<!--查询单人转账关系-->
<select id="personalTransferRelationship" resultType="com.example.gajz.transferrelationship.bean.vo.personalTransferRelationshipVo">
select bank_card_no as source,end_card_no as target,count(id) as transferTimes from abc_statement where end_card_no is not null
and bank_card_no=#{cardnumbe}
group by source ,target
</select>
<!--查询上级转账人方法-->
<select id="querySuperior" resultType="com.example.gajz.transferrelationship.bean.vo.SearchRelationshipVo">
select bank_account_name as name ,bank_card_no as cardNumber from abc_statement where end_card_no=#{cardNumbe} and bank_card_no is not null
group by bank_card_no
</select>
<!--查询两人转账关系 关系 (关系图) 方法-->
<select id="trBetweenTwoPersons" resultType="com.example.gajz.transferrelationship.bean.vo.personalTransferRelationshipVo">
select bank_card_no as source,end_card_no as target,count(id) as transferTimes from abc_statement where end_card_no=#{cardNumbe} and bank_card_no is not null
group by bank_card_no
</select>
</mapper>
package com.example.gajz;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class GajzApplicationTests {
@Test
void contextLoads() {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment