Commit f9bd15b9 authored by wuqinghua's avatar wuqinghua

2021/12/10 吴卿华

parent f856f26a
...@@ -49,9 +49,6 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -49,9 +49,6 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
public List<data> edge() { public List<data> edge() {
List<com.example.gajz.transferrelationship.bean.param.data> edge = transferRelationshipMapper.edge(); List<com.example.gajz.transferrelationship.bean.param.data> edge = transferRelationshipMapper.edge();
List transList=new ArrayList<>(); List transList=new ArrayList<>();
// System.out.println(edge.size()+"边");
// //获取redis连接
// Jedis conn = ConFigRedis.getConn();
for (int i=0;i<edge.size();i++){ for (int i=0;i<edge.size();i++){
TransferRelationship transferRelationship=new TransferRelationship(); TransferRelationship transferRelationship=new TransferRelationship();
Source source=new Source(); Source source=new Source();
...@@ -73,7 +70,6 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -73,7 +70,6 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
transferRelationship.setTransferTimes(transferTimes); transferRelationship.setTransferTimes(transferTimes);
transList.add(transferRelationship); transList.add(transferRelationship);
} }
// conn.close();
return transList; return transList;
} }
...@@ -84,7 +80,6 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -84,7 +80,6 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
*/ */
@Override @Override
public List diagramSpot() { public List diagramSpot() {
// Jedis conn = ConFigRedis.getConn();
/**已经存在的点 会存储到map里面*/ /**已经存在的点 会存储到map里面*/
HashMap hashMap=new HashMap(); HashMap hashMap=new HashMap();
//查询转账人(中心点)信息 //查询转账人(中心点)信息
...@@ -104,10 +99,6 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -104,10 +99,6 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
for (int i=0;i<transferCardVos.size();i++){ for (int i=0;i<transferCardVos.size();i++){
//是否重叠 //是否重叠
boolean overlap=false; boolean overlap=false;
// if (!overlap){
// centerPointVoList.get(i).setX(centerPointVoList.get(i).getX()+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();
...@@ -122,40 +113,16 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -122,40 +113,16 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
/** -----------------------------去掉被转账人对应中心点重复出现点 代码--------------------------------*/ /** -----------------------------去掉被转账人对应中心点重复出现点 代码--------------------------------*/
/**查询被转账人全部信息*/ /**查询被转账人全部信息*/
List<com.example.gajz.transferrelationship.bean.param.data> transfer = transferRelationshipMapper.transferRelationship(transferCardVos.get(i).getBankCardNo()); 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());
/**判断此中心点是否是因为碰撞第一次生成下级数据 如果不是第一次就设置防重复map失效*/
if (repeatFrequency!=0){
target = null;
}
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){ if (transfer.size()==0||transfer.size()<=100){
test.setSize(2); test.setSize(2);
}else if (dataList.size()>=100){ }else if (transfer.size()>=100){
test.setSize(2); test.setSize(2);
} }
/**每圈点数 动态变化 */
int base = 40;
/**总数*/
int total = dataList.size();
/**循环次数*/
int numberCycles =0;
/** -----------------------计算大图四个角的XY轴代码-----------------------*/ /** -----------------------计算大图四个角的XY轴代码-----------------------*/
/**算大圈半径专用 总数*/ /**算大圈半径专用 总数*/
int bigTotal = dataList.size(); int bigTotal = transfer.size();
/**算大圈半径专用 每圈点数*/ /**算大圈半径专用 每圈点数*/
int bigBase = 20; int bigBase = 20;
for (int n=1;bigTotal>0;n++){ for (int n=1;bigTotal>0;n++){
...@@ -176,20 +143,13 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -176,20 +143,13 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
xyMap.put(i+"sY",(centerPointY-fullCircleRadius)); //圆上Y轴 xyMap.put(i+"sY",(centerPointY-fullCircleRadius)); //圆上Y轴
xyMap.put(i+"xX",centerPointX); //圆下X轴 xyMap.put(i+"xX",centerPointX); //圆下X轴
xyMap.put(i+"xY",(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(test); list.add(test);
overlap=true; overlap=true;
}else { }else {
for (int p=0;p<i;p++){ for (int p=0;p<i;p++){
double zX = (double) xyMap.get(p + "zX"); double zX = (double) xyMap.get(p + "zX");
double zY = (double) xyMap.get(p + "zY");
double yX = (double) xyMap.get(p + "yX"); double yX = (double) xyMap.get(p + "yX");
double yY = (double) xyMap.get(p + "yY");
double sX = (double) xyMap.get(p + "sX");
double sY = (double) xyMap.get(p + "sY"); double sY = (double) xyMap.get(p + "sY");
double xX = (double) xyMap.get(p + "xX");
double xY = (double) xyMap.get(p + "xY"); double xY = (double) 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)))
|| ||
...@@ -224,18 +184,33 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -224,18 +184,33 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
continue; continue;
} }
/**将没有重复的值 存储到这个list里面*/
List<com.example.gajz.transferrelationship.bean.param.data> dataList=new ArrayList<>();
/**循环下级数据 将下级数据存入list中*/
for (int p=0;p<transfer.size();p++){
Object targets = hashMap.get(transfer.get(p).getTarget());
if (targets==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());
}
}
/**循环次数*/
int numberCycles =0;
/**每圈点数 动态变化 */
int base = 40;
/**总数*/
int total = dataList.size();
/**圆圈层数 每循环一次 就是一圈*/ /**圆圈层数 每循环一次 就是一圈*/
for (int y=1;total>0;y++){ for (int y=1;total>0;y++){
/**点之间 x轴y轴间隔距离*/
int distance=2;
/**圆分成四份 每份多少点数*/ /**圆分成四份 每份多少点数*/
float pointsPerShare = base; float pointsPerShare = base;
/**每份点数 / 90度 算出每个点数的度数*/ /**每份点数 / 90度 算出每个点数的度数*/
double eachDegree=360/pointsPerShare; double eachDegree=360/pointsPerShare;
// double eachDegree = (int)Math.ceil(number);
/**小圆半径 点数X距离*/ /**小圆半径 点数X距离*/
// double circleRadius = (double) (pointsPerShare * distance/4);
double circleRadius=15*y; double circleRadius=15*y;
/**点大小*/ /**点大小*/
double pointSize =1; double pointSize =1;
...@@ -262,10 +237,12 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -262,10 +237,12 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
continue; continue;
} }
if (base>0){ if (base>0){
/**每份点数 / 90度 算出每个点数的度数*/
double eachDegrees=90/pointsPerShare;
for (int t=0;numberCycles<dataList.size();t++){ for (int t=0;numberCycles<dataList.size();t++){
Test test1=new Test(); Test test1=new Test();
//算出A角度数 (每份点数-t)* 每点度数 //算出A角度数 (每份点数-t)* 每点度数
int Adegrees = (int) ((pointsPerShare-t) * eachDegree); double Adegrees = (double) ((pointsPerShare-t) * eachDegrees);
//Y轴 //Y轴
double a= (double) (circleRadius*Math.sin(Adegrees)); double a= (double) (circleRadius*Math.sin(Adegrees));
//X轴 //X轴
...@@ -283,8 +260,6 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -283,8 +260,6 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
} }
} }
} }
// conn.close();
// System.out.println(list.size());
return list; return list;
} }
......
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