Commit 17032a4c authored by wuqinghua's avatar wuqinghua

2021/11/20 吴卿华 新增Redis多人查看 优化速度 修改单人转账关系图未知姓名问题

parent 71137e05
......@@ -11,4 +11,5 @@ public class Source {
private String id;
}
......@@ -11,4 +11,5 @@ public class Target {
private String id;
}
......@@ -49,4 +49,10 @@ public class Dot {
*/
private String relationship;
/**
* RedisId
*/
private int RedisId;
}
......@@ -82,8 +82,8 @@ public class TransferRelationshipController {
*/
@ResponseBody
@RequestMapping("/personalTransferRelationship")
public Result personalTransferRelationship(){
Result result = transferRelationshipService.personalTransferRelationship();
public Result personalTransferRelationship(int RedisId){
Result result = transferRelationshipService.personalTransferRelationship(RedisId);
return result;
}
......
......@@ -14,7 +14,7 @@ public class RelationalAlgorithm {
/**
* 转账关系图 关系图搜索 展示图算法
*/
public List searchPresentation(List<SearchRelationshipVo> searchRelationshipVos){
public List searchPresentation(List<SearchRelationshipVo> searchRelationshipVos,int intFlag){
/**----------------------------公共使用值------------------------------*/
/**存放中心点list*/
List<Dot> centerPointList=new ArrayList<>();
......@@ -61,6 +61,7 @@ public class RelationalAlgorithm {
dot.setColor(code);
dot.setRelationship(centerPointList.get(i).getRelationship());
dot.setTransferTimes(centerPointList.get(i).getTransferTimes());
dot.setRedisId(intFlag);
centerPointX=dot.getX();
centerPointY=dot.getY();
/**---------------------------------------------------------------------*/
......
......@@ -2,6 +2,7 @@ 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.Dot;
import com.example.gajz.transferrelationship.bean.param.TransferAssociationParam;
import com.example.gajz.transferrelationship.bean.vo.SearchRelationshipVo;
import java.util.List;
......@@ -71,7 +72,7 @@ public interface TransferRelationshipService {
* 关系图搜索 单人转账关系 转账信息信息查询接口
* @return
*/
Result personalTransferRelationship();
Result personalTransferRelationship(int RedisId);
/**
* 查询两人转账关系 关系 (关系图) 接口
......
......@@ -314,7 +314,7 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
}
/**
* 关系图搜索 单人转账关系(关联关系)接口
* 关系图搜索 单人转账关系(生成点)接口 (二级页面)
* @param cardnumbe
* @return
*/
......@@ -443,19 +443,19 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
}
}
RelationalAlgorithm relationalAlgorithm=new RelationalAlgorithm();
//生成Redis随机数
int intFlag = (int)(Math.random() * 1000000);
//开启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.set(intFlag+"cardnumbe"+o++,searchRelationshipVoList.get(i).getCardNumber());
}
}
//关闭redis
redis.close();
List list = relationalAlgorithm.searchPresentation(searchRelationshipVoList);
List list = relationalAlgorithm.searchPresentation(searchRelationshipVoList,intFlag);
return new Result(ResultCode.SUCCESS,list);
}catch (Exception e){
return new Result(ResultCode.FAIL);
......@@ -805,16 +805,18 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
/**
* 关系图搜索 单人转账关系 转账信息信息查询接口
* 个人关系图 (转账关系) 搜索接口 (二级页面)
* @return
*/
@Override
public Result personalTransferRelationship(){
public Result personalTransferRelationship(int RedisId){
Jedis redis = ConFigRedis.getConn();
List list=new ArrayList();
for (int i=0;i<i+1;i++){
//获取redis
String cardnumbe= redis.get("cardnumbe" + i);
String cardnumbe= redis.get(RedisId+"cardnumbe" + i);
//删除redis kye
redis.del(String.valueOf(RedisId+"cardnumbe" + i));
if (cardnumbe!=null){
/**
* 查询单人转账关系
......@@ -834,9 +836,11 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
list.add(transferRelationship);
}
}else {
redis.close();
return new Result(ResultCode.SUCCESS,list);
}
}
redis.close();
return new Result(ResultCode.SUCCESS);
}
......@@ -848,7 +852,7 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
*/
@Override
public Result trBetweenTwoPersons(List<SearchRelationshipVo> transferAssociationParam) {
List list=new ArrayList();
List<TransferRelationship> 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());
......@@ -869,6 +873,27 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
}
}
}
List<TransferRelationship> transferRelationshipList=new ArrayList();
for (int k=0;k<list.size();k++){
TransferRelationship transferRelationship=new TransferRelationship();
for (int n=0;n<transferAssociationParam.size();n++){
if (list.get(k).getSource().getId().equals(transferAssociationParam.get(n).getCardNumber())){
Source source=new Source();
String o= String.valueOf(n);
source.setId(o);
transferRelationship.setSource(source);
}
if (list.get(k).getTarget().getId().equals(transferAssociationParam.get(n).getCardNumber())){
Target target=new Target();
String o= String.valueOf(n);
target.setId(o);
transferRelationship.setTarget(target);
}
}
transferRelationship.setTransferTimes(list.get(k).getTransferTimes());
transferRelationshipList.add(transferRelationship);
}
return new Result(ResultCode.SUCCESS,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