Commit 375cf55a authored by wuqinghua's avatar wuqinghua

2022/1/14 吴卿华

parent 9ff72a72
package com.example.gajz.config; package com.example.gajz.config;
import org.neo4j.cypher.internal.frontend.v2_3.ast.functions.Str;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
......
...@@ -37,4 +37,6 @@ public class Colour { ...@@ -37,4 +37,6 @@ public class Colour {
String cos="0x" + Integer.toHexString((color1.getRGB() & 0xffffff) | 0x1000000).substring(1); String cos="0x" + Integer.toHexString((color1.getRGB() & 0xffffff) | 0x1000000).substring(1);
return cos; return cos;
} }
} }
package com.example.gajz.transferrelationship.config;
import java.util.Random;
/**
* 位置生成测试工具类
*/
public class PositionConfig {
public static void main(String[] args) {
Random random = new Random();
// int r = random.nextInt(500)+400; // random.nextInt(100)只能生成[0,100)
for (int i=0;i<10;i++){
/**(数据类型)(最小值+Math.random()*(最大值-最小值+1))*/
int r = (int) (300+Math.random()*(600-300+1));
System.out.println(r);
}
}
}
...@@ -3,7 +3,6 @@ import com.alibaba.excel.EasyExcel; ...@@ -3,7 +3,6 @@ import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener; import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.example.gajz.config.TimeConFig;
import com.example.gajz.result.Result; import com.example.gajz.result.Result;
import com.example.gajz.result.ResultCode; import com.example.gajz.result.ResultCode;
import com.example.gajz.transferrelationship.bean.excel.abcExcie; import com.example.gajz.transferrelationship.bean.excel.abcExcie;
......
...@@ -145,4 +145,11 @@ public interface TransferRelationshipMapper { ...@@ -145,4 +145,11 @@ public interface TransferRelationshipMapper {
* @return * @return
*/ */
List<data> correlationPoint(String bankCardNo); List<data> correlationPoint(String bankCardNo);
/**
* 查询被转账人 多人转账关系数据方法
* @param bankCardNo
* @return
*/
List<TransferCardVo> selectmanyPeoples(String bankCardNo);
} }
...@@ -8,7 +8,6 @@ import com.example.gajz.transferrelationship.config.Colour; ...@@ -8,7 +8,6 @@ import com.example.gajz.transferrelationship.config.Colour;
import com.example.gajz.transferrelationship.dao.TransferRelationshipMapper; import com.example.gajz.transferrelationship.dao.TransferRelationshipMapper;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis; import redis.clients.jedis.Jedis;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
......
...@@ -7,7 +7,6 @@ import com.example.gajz.transferrelationship.bean.vo.TransferCardVo; ...@@ -7,7 +7,6 @@ import com.example.gajz.transferrelationship.bean.vo.TransferCardVo;
import com.example.gajz.transferrelationship.config.Colour; import com.example.gajz.transferrelationship.config.Colour;
import com.example.gajz.transferrelationship.dao.TransferRelationshipMapper; import com.example.gajz.transferrelationship.dao.TransferRelationshipMapper;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import redis.clients.jedis.Jedis; import redis.clients.jedis.Jedis;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -76,20 +75,20 @@ public class DispersionDiagram { ...@@ -76,20 +75,20 @@ public class DispersionDiagram {
// List<CenterPointVo> centerPointVoList = calculationCenterPoint.CenterPointMethod(transferCardVos); // List<CenterPointVo> centerPointVoList = calculationCenterPoint.CenterPointMethod(transferCardVos);
/**----------------------------------计算中心点位置 结束------------------------------------*/ /**----------------------------------计算中心点位置 结束------------------------------------*/
/**---------------------------------查询拥有多人转账关系的点 开始--------------------------------*/ /**---------------------------------查询拥有多人转账关系的点 开始--------------------------------*/
List<TransferCardVo> transferCardVos1 = transferRelationshipMapper.selectmanyPeople(); // List<TransferCardVo> transferCardVos1 = transferRelationshipMapper.selectmanyPeople();
for (int i=0;i<transferCardVos1.size();i++){ // for (int i=0;i<transferCardVos1.size();i++){
//生成颜色 //// //生成颜色
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(transferCardVos1.get(i).getBankCardNo()); //// test.setId(transferCardVos1.get(i).getBankCardNo());
test.setName(transferCardVos1.get(i).getName()); //// test.setName(transferCardVos1.get(i).getName());
test.setColor(code); //// test.setColor(code);
test.setSize(7); //// test.setSize(7);
test.setX((float)(Math.random()*numberRanges)); //// test.setX((float)(Math.random()*numberRanges));
test.setY((float)(Math.random()*numberRanges)); //// test.setY((float)(Math.random()*numberRanges));
list.add(test); //// list.add(test);
} //// }
/**---------------------------------查询拥有多人转账关系的点 结束--------------------------------*/ /**---------------------------------查询拥有多人转账关系的点 结束--------------------------------*/
double centerPointX = 0; double centerPointX = 0;
...@@ -98,8 +97,10 @@ public class DispersionDiagram { ...@@ -98,8 +97,10 @@ public class DispersionDiagram {
HashMap xyMap = new HashMap(); HashMap xyMap = new HashMap();
/** 中心点*/ /** 中心点*/
for (int i=0;i<transferCardVos.size();i++){ for (int i=0;i<transferCardVos.size();i++){
//存储已经生成的点
hashMap.put(transferCardVos.get(i).getBankCardNo(),"1");
//是否重叠 //是否重叠
boolean overlap=false; // boolean overlap=false;
//生成颜色 //生成颜色
Colour colour=new Colour(); Colour colour=new Colour();
String code=colour.getColour(); String code=colour.getColour();
...@@ -109,17 +110,60 @@ public class DispersionDiagram { ...@@ -109,17 +110,60 @@ public class DispersionDiagram {
test.setY((float)(Math.random()*numberRanges)); test.setY((float)(Math.random()*numberRanges));
test.setName(transferCardVos.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(transferCardVos.get(i).getBankCardNo()); List<TransferCardVo> transferCardVos1 =transferRelationshipMapper.selectmanyPeoples(transferCardVos.get(i).getBankCardNo());
/** -----------------------------------------------------------------------------------------*/ /** -----------------------------------------------------------------------------------------*/
if (transfer.size()==0||transfer.size()<=100){ //范围最小值
int minimum = 0;
//范围最大值
int maximum = 0;
if (transferCardVos1.size()==0||transferCardVos1.size()<=50){
test.setSize(10); test.setSize(10);
}else if (transfer.size()>=100){ minimum=100;
test.setSize(transfer.size()/100); maximum=200;
}else if (transferCardVos1.size()>50&&transferCardVos1.size()<=100){
test.setSize(15);
minimum=300;
maximum=300;
}else if (transferCardVos1.size()>100&&transferCardVos1.size()<=200){
test.setSize(20);
minimum=300;
maximum=450;
}else if (transferCardVos1.size()>200){
test.setSize(25);
minimum=300;
maximum=500;
} }
list.add(test); list.add(test);
/**生成只跟中心点有关系的数据 合并成一个点*/
/**查询被转账人全部信息*/
List<com.example.gajz.transferrelationship.bean.param.data> transfer = transferRelationshipMapper.transferRelationship(transferCardVos.get(i).getBankCardNo());
if (transfer.size()!=0){
Test testg=new Test();
testg.setSize(20);
testg.setX((int) ((test.getX()-minimum)+Math.random()*((test.getX()+maximum)-(test.getX()-minimum)+1)));
testg.setY((int) ((test.getY()-minimum)+Math.random()*((test.getY()+maximum)-(test.getY()-minimum)+1)));
testg.setColor(code);
testg.setId(transfer.get(0).getTarget());
testg.setName("单人转账关系总人数:"+transfer.size());
list.add(testg);
}
for (int n=0;n<transferCardVos1.size();n++){
Object isNot = hashMap.get(transferCardVos1.get(n).getBankCardNo());
if (isNot==null){
Test tests=new Test();
tests.setId(transferCardVos1.get(n).getBankCardNo());
tests.setName(transferCardVos1.get(n).getName());
tests.setColor(code);
tests.setSize(10);
tests.setX((int) ((test.getX()-minimum)+Math.random()*((test.getX()+maximum)-(test.getX()-minimum)+1)));
tests.setY((int) ((test.getY()-minimum)+Math.random()*((test.getY()+maximum)-(test.getY()-minimum)+1)));
list.add(tests);
hashMap.put(transferCardVos1.get(n).getBankCardNo(),"1");
}
}
/** -----------------------计算大图四个角的XY轴代码-----------------------*/ /** -----------------------计算大图四个角的XY轴代码-----------------------*/
// /**算大圈半径专用 总数*/ // /**算大圈半径专用 总数*/
// int bigTotal = transfer.size(); // int bigTotal = transfer.size();
......
...@@ -87,10 +87,10 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ ...@@ -87,10 +87,10 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
*/ */
@Override @Override
public List diagramSpot(DiagramSpotParam diagramSpotParam) { public List diagramSpot(DiagramSpotParam diagramSpotParam) {
if (diagramSpotParam.getDrawingNumber()==1){ /**分散图形算法 */ if (diagramSpotParam.getDrawingNumber()==0){ /**分散图形算法 */
List list = dispersionDiagram.dispersionDiagram(diagramSpotParam.getNumerical()); List list = dispersionDiagram.dispersionDiagram(diagramSpotParam.getNumerical());
return list; return list;
}else if (diagramSpotParam.getDrawingNumber()==0){ /**圆形图形算法*/ }else if (diagramSpotParam.getDrawingNumber()==1){ /**圆形图形算法*/
List list = circularAlgorithm.circularAlgorithm(diagramSpotParam.getNumerical()); List list = circularAlgorithm.circularAlgorithm(diagramSpotParam.getNumerical());
return list; return list;
} }
......
...@@ -189,4 +189,15 @@ ...@@ -189,4 +189,15 @@
group by a.end_card_no HAVING count(end_card_no)>1 group by a.end_card_no HAVING count(end_card_no)>1
</select> </select>
<!--查询被转账人 多人转账关系数据方法-->
<select id="selectmanyPeoples" resultType="com.example.gajz.transferrelationship.bean.vo.TransferCardVo">
select name,bankCardNo from (
select end_account_name as name,end_card_no as bankCardNo,bank_card_no from (
select count(id),end_account_name,bank_card_no,end_card_no from abc_statement
where bank_card_no is not null and end_card_no is not null
GROUP BY bank_card_no, end_card_no ) a
group by a.end_card_no HAVING count(end_card_no)>1 )b
where b.bank_card_no=#{bankCardNo}
</select>
</mapper> </mapper>
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