Commit 6522b5e0 authored by wuqinghua's avatar wuqinghua

2021/12/7 吴卿华 1修改一级关系图展示形状为圆形 2修改颜色生成算法

parent 9f85871b
package com.example.gajz.transferrelationship;
import org.junit.Test;
import java.awt.*;
import java.util.Random;
public class TEST {
public static void main(String[] args) {
}
@Test
public void RandomHexColor_test() {
Random random = new Random();
float hue = random.nextFloat();
float saturation = (random.nextInt(7000) + 4000) / 10000f;
float luminance = 1f;
Color color = Color.getHSBColor(hue, saturation, luminance);
System.out.println(color);
System.out.println("#" + Integer.toHexString((color.getRGB() & 0xffffff) | 0x1000000).substring(1));
//红色
String red;
//绿色
String green;
//蓝色
String blue;
//生成红色颜色代码
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 color1 = "0x"+red+green+blue;
System.out.println(color1);
}
}
package com.example.gajz.transferrelationship.neo4j; package com.example.gajz.transferrelationship.neo4j;
import java.awt.*;
import java.util.Random; import java.util.Random;
public class Colour { public class Colour {
public String getColour(){ public String getColour(){
//红色 // //红色
String red; // String red;
//绿色 // //绿色
String green; // String green;
//蓝色 // //蓝色
String blue; // String blue;
//生成随机对象 //生成随机对象
Random random = new Random(); Random random = new Random();
//生成红色颜色代码 // //生成红色颜色代码
red = Integer.toHexString(random.nextInt(256)).toUpperCase(); // red = Integer.toHexString(random.nextInt(256)).toUpperCase();
//生成绿色颜色代码 // //生成绿色颜色代码
green = Integer.toHexString(random.nextInt(256)).toUpperCase(); // green = Integer.toHexString(random.nextInt(256)).toUpperCase();
//生成蓝色颜色代码 // //生成蓝色颜色代码
blue = Integer.toHexString(random.nextInt(256)).toUpperCase(); // blue = Integer.toHexString(random.nextInt(256)).toUpperCase();
//判断红色代码的位数 // //判断红色代码的位数
red = red.length()==1 ? "0" + red : red ; // red = red.length()==1 ? "0" + red : red ;
//判断绿色代码的位数 // //判断绿色代码的位数
green = green.length()==1 ? "0" + green : green ; // green = green.length()==1 ? "0" + green : green ;
//判断蓝色代码的位数 // //判断蓝色代码的位数
blue = blue.length()==1 ? "0" + blue : blue ; // blue = blue.length()==1 ? "0" + blue : blue ;
//生成十六进制颜色值 // //生成十六进制颜色值
String color = "0x"+red+green+blue; // String color = "0x"+red+green+blue;
return color;
float hue = random.nextFloat();
float saturation = (random.nextInt(7000) + 4000) / 10000f;
float luminance = 1f;
Color color1= Color.getHSBColor(hue, saturation, luminance);
String cos="0x" + Integer.toHexString((color1.getRGB() & 0xffffff) | 0x1000000).substring(1);
return cos;
} }
} }
...@@ -2,22 +2,35 @@ package com.example.gajz.transferrelationship.neo4j; ...@@ -2,22 +2,35 @@ package com.example.gajz.transferrelationship.neo4j;
import com.example.gajz.redis.ConFigRedis; import com.example.gajz.redis.ConFigRedis;
import redis.clients.jedis.Jedis; import redis.clients.jedis.Jedis;
import java.util.HashMap; import java.util.*;
import java.util.Set;
public class test { public class test {
public static void main(String[] args) { public static void main(String[] args) {
int START = 1;
int END = 100;
Random random = new Random();
for (int idx = 1; idx <= 1; ++idx){
showRandomInteger(START, END, random);
}
}
HashMap hashMap=new HashMap(); private static void showRandomInteger(int aStart, int aEnd, Random aRandom){
hashMap.put("1","111"); if ( aStart > aEnd ) {
hashMap.put("2","222"); throw new IllegalArgumentException("Start cannot exceed End.");
hashMap.put("3","333"); }
hashMap.put("4","444"); //get the range, casting to long to avoid overflow problems
long range = (long)aEnd - (long)aStart + 1;
// compute a fraction of the range, 0 <= frac < range
long fraction = (long)(range * aRandom.nextDouble());
int randomNumber = (int)(fraction + aStart);
log("Generated : " + randomNumber);
}
private static void log(String aMessage){
System.out.println(aMessage);
}
System.out.println(hashMap.size());
}
} }
...@@ -273,8 +273,8 @@ public class CalculationCenterPoint { ...@@ -273,8 +273,8 @@ public class CalculationCenterPoint {
CenterPointVo centerPointVo1=new CenterPointVo(); CenterPointVo centerPointVo1=new CenterPointVo();
centerPointVo1.setBankCardNo(transferCardVoList.get(p).getBankCardNo()); centerPointVo1.setBankCardNo(transferCardVoList.get(p).getBankCardNo());
centerPointVo1.setName(transferCardVoList.get(p).getName()); centerPointVo1.setName(transferCardVoList.get(p).getName());
centerPointVo1.setX((int)(Math.random()*2000)); centerPointVo1.setX((int)(Math.random()*1000));
centerPointVo1.setY((int)(Math.random()*2000)); centerPointVo1.setY((int)(Math.random()*1000));
temporaryList.add(centerPointVo1); temporaryList.add(centerPointVo1);
repeat.put(transferCardVoList.get(p).getBankCardNo(),1); repeat.put(transferCardVoList.get(p).getBankCardNo(),1);
} }
...@@ -294,11 +294,8 @@ public class CalculationCenterPoint { ...@@ -294,11 +294,8 @@ public class CalculationCenterPoint {
subordinateList.add(temporary.get(x)); subordinateList.add(temporary.get(x));
} }
} }
} }
return centerPointVoList; return centerPointVoList;
} }
......
...@@ -36,6 +36,7 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -36,6 +36,7 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
/**HugeGraph*/ /**HugeGraph*/
@Autowired @Autowired
HugeCollectionProperties hugeCollectionProperties; HugeCollectionProperties hugeCollectionProperties;
@Autowired @Autowired
CalculationCenterPoint calculationCenterPoint; CalculationCenterPoint calculationCenterPoint;
...@@ -85,48 +86,50 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -85,48 +86,50 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
public List diagramSpot() { public List diagramSpot() {
// Jedis conn = ConFigRedis.getConn(); // Jedis conn = ConFigRedis.getConn();
/**已经存在的点 会存储到map里面*/ /**已经存在的点 会存储到map里面*/
HashMap hashMap = new HashMap(); HashMap hashMap=new HashMap();
/**存储已经查找到的中心点下级 防止重复*/
HashMap centerPointMap = new HashMap();
//查询转账人(中心点)信息 //查询转账人(中心点)信息
List<TransferCardVo> transferCardVos = transferRelationshipMapper.selectTransferCard(); List<TransferCardVo> transferCardVos = transferRelationshipMapper.selectTransferCard();
/**----------------------------------计算中心点位置 开始------------------------------------*/ /**----------------------------------计算中心点位置 开始------------------------------------*/
/**计算中心点方法*/ /**计算中心点方法*/
List<CenterPointVo> centerPointVoList = calculationCenterPoint.CenterPointMethod(transferCardVos); List<CenterPointVo> centerPointVoList = calculationCenterPoint.CenterPointMethod(transferCardVos);
// System.out.println(centerPointVoList.size());
/**----------------------------------计算中心点位置 结束------------------------------------*/ /**----------------------------------计算中心点位置 结束------------------------------------*/
List list=new ArrayList(); List list=new ArrayList();
int centerPointX = 0; int centerPointX = 0;
int centerPointY = 0; int centerPointY = 0;
//重复次数
int repeatFrequency = 0;
//存储所有大圆的四角X Y轴数据 //存储所有大圆的四角X Y轴数据
HashMap xyMap = new HashMap(); HashMap xyMap = new HashMap();
/** 中心点*/ /** 中心点*/
for (int i=0;i<centerPointVoList.size();i++){ for (int i=0;i<transferCardVos.size();i++){
//是否重叠 //是否重叠
boolean overlap=false; boolean overlap=false;
if (!overlap){ if (!overlap){
centerPointVoList.get(i).setX(centerPointVoList.get(i).getX()+20); centerPointVoList.get(i).setX(centerPointVoList.get(i).getX()+20);
centerPointVoList.get(i).setY(centerPointVoList.get(i).getY()+20); centerPointVoList.get(i).setY(centerPointVoList.get(i).getY());
} }
//生成颜色 //生成颜色
Colour colour=new Colour(); Colour colour=new Colour();
String code=colour.getColour(); String code=colour.getColour();
Test test=new Test(); Test test=new Test();
test.setId(centerPointVoList.get(i).getBankCardNo()); test.setId(transferCardVos.get(i).getBankCardNo());
test.setX(centerPointVoList.get(i).getX()); test.setX((int)(Math.random()*5000));
test.setY(centerPointVoList.get(i).getY()); test.setY((int)(Math.random()*5000));
test.setName(centerPointVoList.get(i).getName()); test.setName(transferCardVos.get(i).getName());
test.setColor(code); test.setColor(code);
centerPointX=test.getX(); centerPointX=test.getX();
centerPointY=test.getY(); centerPointY=test.getY();
/** -----------------------------去掉被转账人对应中心点重复出现点 代码--------------------------------*/ /** -----------------------------去掉被转账人对应中心点重复出现点 代码--------------------------------*/
/**查询被转账人全部信息*/ /**查询被转账人全部信息*/
List<com.example.gajz.transferrelationship.bean.param.data> transfer = transferRelationshipMapper.transferRelationship(centerPointVoList.get(i).getBankCardNo()); List<com.example.gajz.transferrelationship.bean.param.data> transfer = transferRelationshipMapper.transferRelationship(transferCardVos.get(i).getBankCardNo());
/**将没有重复的值 存储到这个list里面*/ /**将没有重复的值 存储到这个list里面*/
List<com.example.gajz.transferrelationship.bean.param.data> dataList=new ArrayList<>(); List<com.example.gajz.transferrelationship.bean.param.data> dataList=new ArrayList<>();
for (int p=0;p<transfer.size();p++){ for (int p=0;p<transfer.size();p++){
Object target = hashMap.get(transfer.get(p).getTarget()); Object target = hashMap.get(transfer.get(p).getTarget());
/**判断此中心点是否是因为碰撞第一次生成下级数据 如果不是第一次就设置防重复map失效*/
if (repeatFrequency!=0){
target = null;
}
if (target==null){ if (target==null){
com.example.gajz.transferrelationship.bean.param.data data=new com.example.gajz.transferrelationship.bean.param.data(); com.example.gajz.transferrelationship.bean.param.data data=new com.example.gajz.transferrelationship.bean.param.data();
data.setName(transfer.get(p).getName()); data.setName(transfer.get(p).getName());
...@@ -144,7 +147,7 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -144,7 +147,7 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
} }
/**每圈点数 动态变化 */ /**每圈点数 动态变化 */
int base = 8; int base = 40;
/**总数*/ /**总数*/
int total = dataList.size(); int total = dataList.size();
/**循环次数*/ /**循环次数*/
...@@ -154,10 +157,10 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -154,10 +157,10 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
/**算大圈半径专用 总数*/ /**算大圈半径专用 总数*/
int bigTotal = dataList.size(); int bigTotal = dataList.size();
/**算大圈半径专用 每圈点数*/ /**算大圈半径专用 每圈点数*/
int bigBase = 8; int bigBase = 20;
for (int n=1;bigTotal>0;n++){ for (int n=1;bigTotal>0;n++){
bigTotal = bigTotal-bigBase; bigTotal = bigTotal-bigBase;
bigBase = bigBase+20; bigBase = bigBase+50;
} }
/** 大圆最后一圈半径 每份多少点数 */ /** 大圆最后一圈半径 每份多少点数 */
int bigPointsPerShare = bigBase/4; int bigPointsPerShare = bigBase/4;
...@@ -181,12 +184,16 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -181,12 +184,16 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
}else { }else {
for (int p=0;p<i;p++){ for (int p=0;p<i;p++){
int zX = (int) xyMap.get(p + "zX"); int zX = (int) xyMap.get(p + "zX");
int zY = (int) xyMap.get(p + "zY");
int yX = (int) xyMap.get(p + "yX"); 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 sY = (int) xyMap.get(p + "sY");
int xX = (int) xyMap.get(p + "xX");
int xY = (int) xyMap.get(p + "xY"); int xY = (int) xyMap.get(p + "xY");
if(((zX>(centerPointX-fullCircleRadius)&&zX>(centerPointX+fullCircleRadius)) ||(yX<(centerPointX-fullCircleRadius)&&yX<(centerPointX+fullCircleRadius))) 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)))){ ((sY>(centerPointY-fullCircleRadius)&&sY>(centerPointY+fullCircleRadius)) ||(xY<(centerPointY-fullCircleRadius)&&xY<(centerPointY+fullCircleRadius)))){
if (p==i-1) { if (p==i-1) {
xyMap.put(i + "zX", (centerPointX-fullCircleRadius)); //圆左X轴 xyMap.put(i + "zX", (centerPointX-fullCircleRadius)); //圆左X轴
xyMap.put(i + "zY", centerPointY); //圆左Y轴 xyMap.put(i + "zY", centerPointY); //圆左Y轴
...@@ -201,8 +208,12 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -201,8 +208,12 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
// conn.set(test.getId(),position); // conn.set(test.getId(),position);
list.add(test); list.add(test);
overlap=true; overlap=true;
repeatFrequency=0;
} }
}else { }else {
//设置碰撞次数
repeatFrequency++;
//设置已经碰撞
overlap=false; overlap=false;
break; break;
} }
...@@ -213,15 +224,17 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -213,15 +224,17 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
continue; continue;
} }
/**圆圈层数 每循环一次 就是一圈*/ /**圆圈层数 每循环一次 就是一圈*/
for (int y=1;total>0;y++){ for (int y=1;total>0;y++){
/**点之间 x轴y轴间隔距离*/ /**点之间 x轴y轴间隔距离*/
int distance=2; int distance=2;
/**圆分成四份 每份多少点数*/ /**圆分成四份 每份多少点数*/
int pointsPerShare = base/4; float pointsPerShare = base/4;
/**每份点数 / 90度 算出每个点数的度数*/
float number=90/pointsPerShare;
int eachDegree = (int)Math.ceil(number);
/**小圆半径 点数X距离*/ /**小圆半径 点数X距离*/
int circleRadius = pointsPerShare * distance; int circleRadius = (int) (pointsPerShare * distance);
/**右下角逐渐递减*/ /**右下角逐渐递减*/
int lowerRight = 0; int lowerRight = 0;
/**左下角逐渐递减*/ /**左下角逐渐递减*/
...@@ -234,33 +247,57 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -234,33 +247,57 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
for (int t=0;t<base;t++){ for (int t=0;t<base;t++){
Test test1=new Test(); Test test1=new Test();
if (t<pointsPerShare){ if (t<pointsPerShare){
//算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree);
//Y轴
int a= (int) (circleRadius*Math.sin(Adegrees));
//X轴
int b= (int) (circleRadius*Math.cos(Adegrees));
test1.setId(dataList.get(numberCycles).getTarget()); test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName()); test1.setName(dataList.get(numberCycles).getName());
test1.setX((distance*t)+centerPointX); test1.setX(centerPointX+b);
test1.setY((centerPointY-circleRadius)+(distance*t)); test1.setY(centerPointY-a);
test1.setColor(code); test1.setColor(code);
test1.setSize(pointSize); test1.setSize(pointSize);
}else if (t<=pointsPerShare*2){ }else if (t<=pointsPerShare*2){
//算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree);
//Y轴
int a= (int) (circleRadius*Math.sin(Adegrees));
//X轴
int b= (int) (circleRadius*Math.cos(Adegrees));
test1.setId(dataList.get(numberCycles).getTarget()); test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName()); test1.setName(dataList.get(numberCycles).getName());
test1.setX((centerPointX+circleRadius)-(distance*lowerRight)); test1.setX(centerPointX+b);
test1.setY(centerPointY+(lowerRight*distance)); test1.setY(centerPointY-a);
test1.setColor(code); test1.setColor(code);
test1.setSize(pointSize); test1.setSize(pointSize);
lowerRight++; lowerRight++;
}else if (t<=pointsPerShare*3){ }else if (t<=pointsPerShare*3){
//算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree);
//Y轴
int a= (int) (circleRadius*Math.sin(Adegrees));
//X轴
int b= (int) (circleRadius*Math.cos(Adegrees));
test1.setId(dataList.get(numberCycles).getTarget()); test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName()); test1.setName(dataList.get(numberCycles).getName());
test1.setX((centerPointX-circleRadius)+(distance*lowerLeft)); test1.setX(centerPointX+b);
test1.setY(centerPointY+(distance*lowerLeft)); test1.setY(centerPointY-a);
test1.setColor(code); test1.setColor(code);
test1.setSize(pointSize); test1.setSize(pointSize);
lowerLeft++; lowerLeft++;
}else if (t<=pointsPerShare*4){ }else if (t<=pointsPerShare*4){
//算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree);
//Y轴
int a= (int) (circleRadius*Math.sin(Adegrees));
//X轴
int b= (int) (circleRadius*Math.cos(Adegrees));
test1.setId(dataList.get(numberCycles).getTarget()); test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName()); test1.setName(dataList.get(numberCycles).getName());
test1.setX(centerPointX-(distance*upperLeft)); test1.setX(centerPointX+b);
test1.setY((centerPointY-circleRadius)+(distance*upperLeft)); test1.setY(centerPointY-a);
test1.setColor(code); test1.setColor(code);
test1.setSize(pointSize); test1.setSize(pointSize);
upperLeft++; upperLeft++;
...@@ -272,40 +309,64 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -272,40 +309,64 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
numberCycles++; numberCycles++;
} }
total=total-base; total=total-base;
base = base+20; base = base+(y*45);
continue; continue;
} }
if (base>0){ if (base>0){
for (int t=0;numberCycles<dataList.size();t++){ for (int t=0;numberCycles<dataList.size();t++){
Test test1=new Test(); Test test1=new Test();
if (t<pointsPerShare){ if (t<pointsPerShare){
//算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree);
//Y轴
int a= (int) (circleRadius*Math.sin(Adegrees));
//X轴
int b= (int) (circleRadius*Math.cos(Adegrees));
test1.setId(dataList.get(numberCycles).getTarget()); test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName()); test1.setName(dataList.get(numberCycles).getName());
test1.setX((distance*t)+centerPointX); test1.setX(centerPointX+b);
test1.setY((centerPointY-circleRadius)+(distance*t)); test1.setY(centerPointY-a);
test1.setColor(code); test1.setColor(code);
test1.setSize(pointSize); test1.setSize(pointSize);
}else if (t<=pointsPerShare*2){ }else if (t<=pointsPerShare*2){
//算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree);
//Y轴
int a= (int) (circleRadius*Math.sin(Adegrees));
//X轴
int b= (int) (circleRadius*Math.cos(Adegrees));
test1.setId(dataList.get(numberCycles).getTarget()); test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName()); test1.setName(dataList.get(numberCycles).getName());
test1.setX((centerPointX+circleRadius)-(distance*lowerRight)); test1.setX(centerPointX+b);
test1.setY(centerPointY+(lowerRight*distance)); test1.setY(centerPointY-a);
test1.setColor(code); test1.setColor(code);
test1.setSize(pointSize); test1.setSize(pointSize);
lowerRight++; lowerRight++;
}else if (t<=pointsPerShare*3){ }else if (t<=pointsPerShare*3){
//算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree);
//Y轴
int a= (int) (circleRadius*Math.sin(Adegrees));
//X轴
int b= (int) (circleRadius*Math.cos(Adegrees));
test1.setId(dataList.get(numberCycles).getTarget()); test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName()); test1.setName(dataList.get(numberCycles).getName());
test1.setX((centerPointX-circleRadius)+(distance*lowerLeft)); test1.setX(centerPointX+b);
test1.setY(centerPointY+(distance*lowerLeft)); test1.setY(centerPointY-a);
test1.setColor(code); test1.setColor(code);
test1.setSize(pointSize); test1.setSize(pointSize);
lowerLeft++; lowerLeft++;
}else if (t<=pointsPerShare*4){ }else if (t<=pointsPerShare*4){
//算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree);
//Y轴
int a= (int) (circleRadius*Math.sin(Adegrees));
//X轴
int b= (int) (circleRadius*Math.cos(Adegrees));
test1.setId(dataList.get(numberCycles).getTarget()); test1.setId(dataList.get(numberCycles).getTarget());
test1.setName(dataList.get(numberCycles).getName()); test1.setName(dataList.get(numberCycles).getName());
test1.setX(centerPointX-(distance*upperLeft)); test1.setX(centerPointX+b);
test1.setY((centerPointY-circleRadius)+(distance*upperLeft)); test1.setY(centerPointY-a);
test1.setColor(code); test1.setColor(code);
test1.setSize(pointSize); test1.setSize(pointSize);
upperLeft++; upperLeft++;
...@@ -313,7 +374,7 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -313,7 +374,7 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
// /** 将其他点 X Y轴拼接 并存入Redis中*/ // /** 将其他点 X Y轴拼接 并存入Redis中*/
// String position=test1.getX()+"Y"+test1.getY(); // String position=test1.getX()+"Y"+test1.getY();
// conn.set(test1.getId(),position); // conn.set(test1.getId(),position);
list.add(test1); // list.add(test1);
numberCycles++; numberCycles++;
} }
break; break;
...@@ -321,6 +382,7 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -321,6 +382,7 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
} }
} }
// conn.close(); // conn.close();
// System.out.println(list.size());
return list; return list;
} }
...@@ -339,25 +401,25 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -339,25 +401,25 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
/**先查询用户信息是转账人还是被转账人 之后将数据存入list中 如果两个都没有就返回null*/ /**先查询用户信息是转账人还是被转账人 之后将数据存入list中 如果两个都没有就返回null*/
List<SearchRelationshipVo> searchRelationshipVos = new ArrayList<>(); List<SearchRelationshipVo> searchRelationshipVos = new ArrayList<>();
if (searchRelationshipVos1.size()!=0||searchRelationshipVos2.size()!=0){ if (searchRelationshipVos1.size()!=0||searchRelationshipVos2.size()!=0){
if (searchRelationshipVos1.size()!=0){ if (searchRelationshipVos1.size()!=0){
for (int i=0;i<searchRelationshipVos1.size();i++) { for (int i=0;i<searchRelationshipVos1.size();i++) {
SearchRelationshipVo searchRelationshipVo = new SearchRelationshipVo(); SearchRelationshipVo searchRelationshipVo = new SearchRelationshipVo();
searchRelationshipVo.setName(searchRelationshipVos1.get(i).getName()); searchRelationshipVo.setName(searchRelationshipVos1.get(i).getName());
searchRelationshipVo.setRelationship(searchRelationshipVos1.get(i).getRelationship()); searchRelationshipVo.setRelationship(searchRelationshipVos1.get(i).getRelationship());
searchRelationshipVo.setTransferTimes(searchRelationshipVos1.get(i).getTransferTimes()); searchRelationshipVo.setTransferTimes(searchRelationshipVos1.get(i).getTransferTimes());
searchRelationshipVo.setCardNumber(searchRelationshipVos1.get(i).getCardNumber()); searchRelationshipVo.setCardNumber(searchRelationshipVos1.get(i).getCardNumber());
searchRelationshipVos.add(searchRelationshipVo); searchRelationshipVos.add(searchRelationshipVo);
} }
}else{ }else{
for (int i=0;i<searchRelationshipVos2.size();i++) { for (int i=0;i<searchRelationshipVos2.size();i++) {
SearchRelationshipVo searchRelationshipVo = new SearchRelationshipVo(); SearchRelationshipVo searchRelationshipVo = new SearchRelationshipVo();
searchRelationshipVo.setName(searchRelationshipVos2.get(i).getName()); searchRelationshipVo.setName(searchRelationshipVos2.get(i).getName());
searchRelationshipVo.setRelationship(searchRelationshipVos2.get(i).getRelationship()); searchRelationshipVo.setRelationship(searchRelationshipVos2.get(i).getRelationship());
searchRelationshipVo.setTransferTimes(searchRelationshipVos2.get(i).getTransferTimes()); searchRelationshipVo.setTransferTimes(searchRelationshipVos2.get(i).getTransferTimes());
searchRelationshipVo.setCardNumber(searchRelationshipVos2.get(i).getCardNumber()); searchRelationshipVo.setCardNumber(searchRelationshipVos2.get(i).getCardNumber());
searchRelationshipVos.add(searchRelationshipVo); searchRelationshipVos.add(searchRelationshipVo);
}
} }
}
}else { }else {
return new Result(ResultCode.SUCCESS); return new Result(ResultCode.SUCCESS);
} }
...@@ -365,109 +427,109 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -365,109 +427,109 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
List<SearchRelationshipVo> searchRelationshipVoList = new ArrayList<>(); List<SearchRelationshipVo> searchRelationshipVoList = new ArrayList<>();
/**创建map 将已经查询出来的下级存入map中 防止相互转账进入死循环*/ /**创建map 将已经查询出来的下级存入map中 防止相互转账进入死循环*/
HashMap hashMap=new HashMap(); HashMap hashMap=new HashMap();
//转账人 //转账人
for (int i = 0; i < searchRelationshipVos.size(); i++) { for (int i = 0; i < searchRelationshipVos.size(); i++) {
SearchRelationshipVo searchRelationshipVo = new SearchRelationshipVo(); SearchRelationshipVo searchRelationshipVo = new SearchRelationshipVo();
searchRelationshipVo.setName(searchRelationshipVos.get(i).getName()); searchRelationshipVo.setName(searchRelationshipVos.get(i).getName());
searchRelationshipVo.setRelationship(searchRelationshipVos.get(i).getRelationship()); searchRelationshipVo.setRelationship(searchRelationshipVos.get(i).getRelationship());
searchRelationshipVo.setTransferTimes(searchRelationshipVos.get(i).getTransferTimes()); searchRelationshipVo.setTransferTimes(searchRelationshipVos.get(i).getTransferTimes());
searchRelationshipVo.setCardNumber(searchRelationshipVos.get(i).getCardNumber()); searchRelationshipVo.setCardNumber(searchRelationshipVos.get(i).getCardNumber());
//存入map //存入map
hashMap.put(searchRelationshipVos.get(i).getCardNumber(),searchRelationshipVos.get(i).getCardNumber()); hashMap.put(searchRelationshipVos.get(i).getCardNumber(),searchRelationshipVos.get(i).getCardNumber());
/** 查询下级数据*/ /** 查询下级数据*/
List<SearchRelationshipVo> searchRelationshipVoSubordinateList = transferRelationshipMapper.querySubordinate(searchRelationshipVos.get(i).getCardNumber()); List<SearchRelationshipVo> searchRelationshipVoSubordinateList = transferRelationshipMapper.querySubordinate(searchRelationshipVos.get(i).getCardNumber());
/**判断是否有下级 如果有给true*/ /**判断是否有下级 如果有给true*/
if (searchRelationshipVoSubordinateList.size()!=0){ if (searchRelationshipVoSubordinateList.size()!=0){
searchRelationshipVo.setSubordinate(true); searchRelationshipVo.setSubordinate(true);
}else { }else {
searchRelationshipVo.setSubordinate(false); 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);
} }
searchRelationshipVoList.add(searchRelationshipVo); for (int r = 0; r < 1; ) {
if (searchRelationshipVoSubordinateList.size() != 0) { //临时存储查询出来的参数
/**存放下级参数list*/ List<SearchRelationshipVo> list1 = new ArrayList<>();
List<SearchRelationshipVo> list = new ArrayList<>(); for (int y = 0; y < list.size(); y++) {
for (int n = 0; n < searchRelationshipVoSubordinateList.size(); n++) { List<SearchRelationshipVo> searchRelationshipVoSubordinateList1 = transferRelationshipMapper.querySubordinate(list.get(y).getCardNumber());
SearchRelationshipVo searchRelationshipSubordinateVo = new SearchRelationshipVo(); if (searchRelationshipVoSubordinateList1.size() != 0) {
searchRelationshipSubordinateVo.setName(searchRelationshipVoSubordinateList.get(n).getName()); for (int l=0;l<searchRelationshipVoSubordinateList1.size();l++) {
searchRelationshipSubordinateVo.setCardNumber(searchRelationshipVoSubordinateList.get(n).getCardNumber()); /**根据下级卡号 对比map 如果已经有值代表已经查询出过此卡号 跳过此次循环开启下一圈*/
searchRelationshipSubordinateVo.setTransferTimes(searchRelationshipVoSubordinateList.get(n).getTransferTimes()); Object number = hashMap.get(searchRelationshipVoSubordinateList1.get(l).getCardNumber());
searchRelationshipSubordinateVo.setRelationship(searchRelationshipVos.get(i).getCardNumber()); if (number==null) {
List<SearchRelationshipVo> searchRelationshipVoSubordinateList1 = transferRelationshipMapper.querySubordinate(searchRelationshipVoSubordinateList.get(n).getCardNumber()); SearchRelationshipVo searchRelationshipSubordinateVo = new SearchRelationshipVo();
/**判断是否有下级 如果有给true*/ searchRelationshipSubordinateVo.setName(searchRelationshipVoSubordinateList1.get(l).getName());
if (searchRelationshipVoSubordinateList1.size()!=0){ searchRelationshipSubordinateVo.setCardNumber(searchRelationshipVoSubordinateList1.get(l).getCardNumber());
searchRelationshipSubordinateVo.setSubordinate(true); searchRelationshipSubordinateVo.setRelationship(list.get(y).getCardNumber());
}else { searchRelationshipSubordinateVo.setTransferTimes(searchRelationshipVoSubordinateList1.get(l).getTransferTimes());
searchRelationshipSubordinateVo.setSubordinate(false); List<SearchRelationshipVo> searchRelationshipVoSubordinateList2 = transferRelationshipMapper.querySubordinate(searchRelationshipVoSubordinateList1.get(l).getCardNumber());
} if (searchRelationshipVoSubordinateList2.size()!=0){
//存放数据 searchRelationshipSubordinateVo.setSubordinate(true);
searchRelationshipVoList.add(searchRelationshipSubordinateVo); }else {
//存入map searchRelationshipSubordinateVo.setSubordinate(false);
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());
} }
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();
} }
//清空上一级的参数
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随机数 RelationalAlgorithm relationalAlgorithm=new RelationalAlgorithm();
int intFlag = (int)(Math.random() * 1000000); //生成Redis随机数
//开启redis int intFlag = (int)(Math.random() * 1000000);
Jedis redis = ConFigRedis.getConn(); //开启redis
int o=0; Jedis redis = ConFigRedis.getConn();
for (int i=0;i<searchRelationshipVoList.size();i++){ int o=0;
if (searchRelationshipVoList.get(i).getSubordinate()){ for (int i=0;i<searchRelationshipVoList.size();i++){
redis.set(intFlag+"cardnumbe"+o++,searchRelationshipVoList.get(i).getCardNumber()); if (searchRelationshipVoList.get(i).getSubordinate()){
} redis.set(intFlag+"cardnumbe"+o++,searchRelationshipVoList.get(i).getCardNumber());
} }
//关闭redis }
redis.close(); //关闭redis
List list = relationalAlgorithm.searchPresentation(searchRelationshipVoList,intFlag); redis.close();
return new Result(ResultCode.SUCCESS,list); List list = relationalAlgorithm.searchPresentation(searchRelationshipVoList,intFlag);
return new Result(ResultCode.SUCCESS,list);
}catch (Exception e){ }catch (Exception e){
return new Result(ResultCode.FAIL); return new Result(ResultCode.FAIL);
} }
...@@ -732,87 +794,87 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -732,87 +794,87 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
superiorList.add(searchRelationshipSubordinateVo); superiorList.add(searchRelationshipSubordinateVo);
//向防止重复map添加已经查询到的上级卡号 //向防止重复map添加已经查询到的上级卡号
hashMap1.put(searchRelationshipSubordinateVo.getCardNumber(),searchRelationshipSubordinateVo.getCardNumber()); hashMap1.put(searchRelationshipSubordinateVo.getCardNumber(),searchRelationshipSubordinateVo.getCardNumber());
for (int b=0;b<1;) { for (int b=0;b<1;) {
for (int a = 0; a < superiorList.size(); a++) { for (int a = 0; a < superiorList.size(); a++) {
//存放查询出来的上级信息 //存放查询出来的上级信息
List<SearchRelationshipVo> superior=new ArrayList<>(); List<SearchRelationshipVo> superior=new ArrayList<>();
//循环查询出来的上级信息 之后将查出来的上级信息存入到list中 //循环查询出来的上级信息 之后将查出来的上级信息存入到list中
for (int m=0;m<superiorList.size();m++){ for (int m=0;m<superiorList.size();m++){
//查询上级转账人方法 //查询上级转账人方法
List<SearchRelationshipVo> superior1 = transferRelationshipMapper.querySuperior(superiorList.get(m).getCardNumber()); List<SearchRelationshipVo> superior1 = transferRelationshipMapper.querySuperior(superiorList.get(m).getCardNumber());
for (int j=0;j<superior1.size();j++){ for (int j=0;j<superior1.size();j++){
superior.add(superior1.get(j)); superior.add(superior1.get(j));
} }
} }
//清空list数据 //清空list数据
superiorList.clear(); superiorList.clear();
//判断上级是否是转账人 如果是 就直接返回数据 //判断上级是否是转账人 如果是 就直接返回数据
for (int h = 0; h < superior.size(); h++) { for (int h = 0; h < superior.size(); h++) {
if (superior.get(h).getCardNumber().equals(transferAssociationParam.getTransfer())) { if (superior.get(h).getCardNumber().equals(transferAssociationParam.getTransfer())) {
List<SearchRelationshipVo> searchRelationshipVoList2 = transferLocation.transferLocation(transferAssociationList); List<SearchRelationshipVo> searchRelationshipVoList2 = transferLocation.transferLocation(transferAssociationList);
return new Result(ResultCode.SUCCESS, searchRelationshipVoList2); return new Result(ResultCode.SUCCESS, searchRelationshipVoList2);
} }
} }
//循环对比查询出来的上级与所有list存储的下级做对比 //循环对比查询出来的上级与所有list存储的下级做对比
for (int k = 0; k < searchRelationshipVoList.size(); k++) { for (int k = 0; k < searchRelationshipVoList.size(); k++) {
for (int n = 0; n < superior.size(); n++) { for (int n = 0; n < superior.size(); n++) {
//对比 //对比
if (superior.get(n).getCardNumber().equals(searchRelationshipVoList.get(k).getCardNumber())) { if (superior.get(n).getCardNumber().equals(searchRelationshipVoList.get(k).getCardNumber())) {
SearchRelationshipVo searchRelationshipSubordinateVo1 = new SearchRelationshipVo(); SearchRelationshipVo searchRelationshipSubordinateVo1 = new SearchRelationshipVo();
searchRelationshipSubordinateVo1.setCardNumber(superior.get(n).getCardNumber()); searchRelationshipSubordinateVo1.setCardNumber(superior.get(n).getCardNumber());
searchRelationshipSubordinateVo1.setName(superior.get(n).getName()); searchRelationshipSubordinateVo1.setName(superior.get(n).getName());
searchRelationshipSubordinateVo1.setX((int) (Math.random() * 2000)); searchRelationshipSubordinateVo1.setX((int) (Math.random() * 2000));
searchRelationshipSubordinateVo1.setY((int) (Math.random() * 800)); searchRelationshipSubordinateVo1.setY((int) (Math.random() * 800));
searchRelationshipSubordinateVo1.setColor(colour.getColour()); searchRelationshipSubordinateVo1.setColor(colour.getColour());
searchRelationshipSubordinateVo1.setSize(10); searchRelationshipSubordinateVo1.setSize(10);
searchRelationshipSubordinateVo1.setHierarchy(searchRelationshipVoList.get(k).getHierarchy()); searchRelationshipSubordinateVo1.setHierarchy(searchRelationshipVoList.get(k).getHierarchy());
searchRelationshipSubordinateVo1.setSubordinateQuantity(searchRelationshipVoList.get(k).getSubordinateQuantity()); searchRelationshipSubordinateVo1.setSubordinateQuantity(searchRelationshipVoList.get(k).getSubordinateQuantity());
Object Number = hashMap1.get(superior.get(n).getCardNumber()); Object Number = hashMap1.get(superior.get(n).getCardNumber());
if (Number==null){ if (Number==null){
//添加被转账人信息 //添加被转账人信息
transferAssociationList.add(searchRelationshipSubordinateVo1); transferAssociationList.add(searchRelationshipSubordinateVo1);
//向防止重复map添加已经查询到的上级卡号 //向防止重复map添加已经查询到的上级卡号
hashMap1.put(superior.get(n).getCardNumber(), superior.get(n).getCardNumber()); hashMap1.put(superior.get(n).getCardNumber(), superior.get(n).getCardNumber());
} }
superiorList.add(searchRelationshipSubordinateVo1); superiorList.add(searchRelationshipSubordinateVo1);
} }
} }
} }
} }
} }
}
} }
} }
} }
} }
//清空上一级的参数 }
list.clear(); //清空上一级的参数
if (list1.size() == 0) { list.clear();
r++; if (list1.size() == 0) {
} r++;
//将新查询出来下一级的参数放入list当中 }
for (int v = 0; v < list1.size(); v++) { //将新查询出来下一级的参数放入list当中
/**循环完成后 判断只让有下级的人进入下次循环*/ for (int v = 0; v < list1.size(); v++) {
if (list1.get(v).getSubordinate()) { /**循环完成后 判断只让有下级的人进入下次循环*/
SearchRelationshipVo searchRelationshipSubordinateVo = new SearchRelationshipVo(); if (list1.get(v).getSubordinate()) {
searchRelationshipSubordinateVo.setCardNumber(list1.get(v).getCardNumber()); SearchRelationshipVo searchRelationshipSubordinateVo = new SearchRelationshipVo();
list.add(searchRelationshipSubordinateVo); searchRelationshipSubordinateVo.setCardNumber(list1.get(v).getCardNumber());
} list.add(searchRelationshipSubordinateVo);
} }
list1.clear();
} }
list1.clear();
} }
} }
for (int p = 0; p < searchRelationshipVoList.size(); p++) { }
if (searchRelationshipVoList.get(p).getCardNumber() == transferAssociationParam.getPayee()) { for (int p = 0; p < searchRelationshipVoList.size(); p++) {
List<SearchRelationshipVo> searchRelationshipVoList2 = transferLocation.transferLocation(searchRelationshipVoList); if (searchRelationshipVoList.get(p).getCardNumber() == transferAssociationParam.getPayee()) {
return new Result(ResultCode.SUCCESS, searchRelationshipVoList2); List<SearchRelationshipVo> searchRelationshipVoList2 = transferLocation.transferLocation(searchRelationshipVoList);
} return new Result(ResultCode.SUCCESS, searchRelationshipVoList2);
} }
//如果没有 就返回null
return new Result(ResultCode.SUCCESS, null);
} }
//如果没有 就返回null
return new Result(ResultCode.SUCCESS, null);
}
/** /**
...@@ -887,20 +949,20 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -887,20 +949,20 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
List<TransferRelationship> transferRelationshipList=new ArrayList(); List<TransferRelationship> transferRelationshipList=new ArrayList();
for (int k=0;k<list.size();k++){ for (int k=0;k<list.size();k++){
TransferRelationship transferRelationship=new TransferRelationship(); TransferRelationship transferRelationship=new TransferRelationship();
for (int n=0;n<transferAssociationParam.size();n++){ for (int n=0;n<transferAssociationParam.size();n++){
if (list.get(k).getSource().getId().equals(transferAssociationParam.get(n).getCardNumber())){ if (list.get(k).getSource().getId().equals(transferAssociationParam.get(n).getCardNumber())){
Source source=new Source(); Source source=new Source();
String o= String.valueOf(n); String o= String.valueOf(n);
source.setId(o); source.setId(o);
transferRelationship.setSource(source); transferRelationship.setSource(source);
} }
if (list.get(k).getTarget().getId().equals(transferAssociationParam.get(n).getCardNumber())){ if (list.get(k).getTarget().getId().equals(transferAssociationParam.get(n).getCardNumber())){
Target target=new Target(); Target target=new Target();
String o= String.valueOf(n); String o= String.valueOf(n);
target.setId(o); target.setId(o);
transferRelationship.setTarget(target); transferRelationship.setTarget(target);
} }
} }
transferRelationship.setTransferTimes(list.get(k).getTransferTimes()); transferRelationship.setTransferTimes(list.get(k).getTransferTimes());
transferRelationshipList.add(transferRelationship); transferRelationshipList.add(transferRelationship);
} }
...@@ -952,7 +1014,7 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -952,7 +1014,7 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
transferAssociationList.add(TransferRelationship.class.cast(o)); transferAssociationList.add(TransferRelationship.class.cast(o));
} }
} }
/**将已经获取到的关系数据放入新list当中返回*/ /**将已经获取到的关系数据放入新list当中返回*/
List<EchartsTrBetweenTwoPersonsVo> echartsTrBetweenTwoPersonsVosList=new ArrayList<>(); List<EchartsTrBetweenTwoPersonsVo> echartsTrBetweenTwoPersonsVosList=new ArrayList<>();
for (int i=0;i<transferAssociationList.size();i++){ for (int i=0;i<transferAssociationList.size();i++){
EchartsTrBetweenTwoPersonsVo echartsTrBetweenTwoPersonsVo=new EchartsTrBetweenTwoPersonsVo(); EchartsTrBetweenTwoPersonsVo echartsTrBetweenTwoPersonsVo=new EchartsTrBetweenTwoPersonsVo();
...@@ -973,7 +1035,7 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -973,7 +1035,7 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
lineStyle line=new lineStyle(); lineStyle line=new lineStyle();
line.setCurveness(curveValue); line.setCurveness(curveValue);
echartsTrBetweenTwoPersonsVosList.get(p).setLineStyle(line); echartsTrBetweenTwoPersonsVosList.get(p).setLineStyle(line);
curveValue=curveValue+0.01; curveValue=curveValue+0.01;
}else { }else {
lineStyle line=new lineStyle(); lineStyle line=new lineStyle();
line.setCurveness(curveValue); line.setCurveness(curveValue);
......
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