Commit 6a758e9e authored by wuqinghua's avatar wuqinghua

2021/11/16 吴卿华 增加echarts双人转账关系图接口 修改双人转账关系图显示位置

parent 4cb08521
package com.example.gajz.transferrelationship.bean.echarts;
import lombok.Data;
import lombok.ToString;
/**
* echarts 关系图
*/
@Data
@ToString
public class lineStyle {
/**
* 关系线曲度
*/
private double curveness;
}
package com.example.gajz.transferrelationship.bean.vo;
import lombok.Data;
import lombok.ToString;
/**
* echarts 双人转账关系图 关系 生成接口 返回值封装类
*/
@Data
@ToString
public class EchartsTrBetweenTwoPersonsVo {
/**
* 转账人
*/
private String source;
/**
* 收款人
*/
private String target;
/**
* 关系线曲度
*/
private com.example.gajz.transferrelationship.bean.echarts.lineStyle lineStyle;
}
......@@ -78,4 +78,18 @@ public interface TransferRelationshipService {
* @return
*/
Result trBetweenTwoPersons(List<SearchRelationshipVo> transferAssociationParam);
/**
* echarts 双人转账关系图 点 生成接口
* @param transferAssociationParam
* @return
*/
Result echartsTransferAssociation(TransferAssociationParam transferAssociationParam);
/**
* echarts 双人转账关系图 关系 生成接口
* @param transferAssociationParam
* @return
*/
Result echartsTrBetweenTwoPersons(List<SearchRelationshipVo> transferAssociationParam);
}
......@@ -3,6 +3,7 @@ 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.echarts.lineStyle;
import com.example.gajz.transferrelationship.bean.excel.abcExcie;
import com.example.gajz.transferrelationship.bean.param.TransferAssociationParam;
import com.example.gajz.transferrelationship.bean.vo.*;
......@@ -870,4 +871,81 @@ public class TransferRelationshipServiceImpl implements TransferRelationshipServ
}
return new Result(ResultCode.SUCCESS,list);
}
/**
* echarts 双人转账关系图 点 生成接口
* @param transferAssociationParam
* @return
*/
@Override
public Result echartsTransferAssociation(TransferAssociationParam transferAssociationParam) {
Result result = this.transferAssociation(transferAssociationParam);
Object obj = result.getData();
/**将有关系的数据放入这个list中 */
List<SearchRelationshipVo> transferAssociationList = new ArrayList<>();
if (obj instanceof ArrayList<?>) {
for (Object o : (List<?>) obj) {
transferAssociationList.add(SearchRelationshipVo.class.cast(o));
}
}
List<EchartsUserVo> list=new ArrayList<>();
for (int i=0;i<transferAssociationList.size();i++){
EchartsUserVo echartsUserVo=new EchartsUserVo();
echartsUserVo.setY(transferAssociationList.get(i).getY());
echartsUserVo.setX(transferAssociationList.get(i).getX());
echartsUserVo.setName(transferAssociationList.get(i).getCardNumber());
list.add(echartsUserVo);
}
return new Result(ResultCode.SUCCESS,list);
}
/**
* echarts 双人转账关系图 关系 生成接口
* @param transferAssociationParam
* @return
*/
@Override
public Result echartsTrBetweenTwoPersons(List<SearchRelationshipVo> transferAssociationParam) {
Result result = this.trBetweenTwoPersons(transferAssociationParam);
Object obj = result.getData();
/**将有关系的数据放入这个list中 */
List<TransferRelationship> transferAssociationList = new ArrayList<>();
if (obj instanceof ArrayList<?>) {
for (Object o : (List<?>) obj) {
transferAssociationList.add(TransferRelationship.class.cast(o));
}
}
/**将已经获取到的关系数据放入新list当中返回*/
List<EchartsTrBetweenTwoPersonsVo> echartsTrBetweenTwoPersonsVosList=new ArrayList<>();
for (int i=0;i<transferAssociationList.size();i++){
EchartsTrBetweenTwoPersonsVo echartsTrBetweenTwoPersonsVo=new EchartsTrBetweenTwoPersonsVo();
echartsTrBetweenTwoPersonsVo.setSource(transferAssociationList.get(i).getSource().getId());
echartsTrBetweenTwoPersonsVo.setTarget(transferAssociationList.get(i).getTarget().getId());
echartsTrBetweenTwoPersonsVosList.add(echartsTrBetweenTwoPersonsVo);
}
/**计算转账关系曲线*/
for (int p=0;p<echartsTrBetweenTwoPersonsVosList.size();p++){
//转账共有几人
int frequency=0;
//曲线值
double curveValue=0.01;
for (int k=0;k<echartsTrBetweenTwoPersonsVosList.size();k++){
if (echartsTrBetweenTwoPersonsVosList.get(p).getSource().equals(echartsTrBetweenTwoPersonsVosList.get(k).getSource())){
frequency++;
if (frequency>2){
lineStyle line=new lineStyle();
line.setCurveness(curveValue);
echartsTrBetweenTwoPersonsVosList.get(p).setLineStyle(line);
curveValue=curveValue+0.01;
}else {
lineStyle line=new lineStyle();
line.setCurveness(curveValue);
echartsTrBetweenTwoPersonsVosList.get(p).setLineStyle(line);
}
}
}
}
return new Result(ResultCode.SUCCESS,echartsTrBetweenTwoPersonsVosList);
}
}
......@@ -96,8 +96,10 @@
<!--查询搜索人关联下一级数据-->
<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
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>
<!--查询转账人-->
......@@ -138,7 +140,8 @@
<!--查询上级转账人方法-->
<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
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>
......
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