Commit 34926d24 authored by zhuxiang's avatar zhuxiang
Browse files

首页-信息查询接口

parent 4a0790bf
......@@ -80,4 +80,10 @@ public class CaseController extends BaseController {
public Result draw(@RequestBody CaseDTO caseDTO) {
return Result.data(caseService.draw(caseDTO));
}
@ApiOperation(value = "画布-信息查询")
@GetMapping("/query/info/{caseId}")
public Result info(@PathVariable int caseId) {
return Result.data(caseService.info(caseId));
}
}
......@@ -24,6 +24,6 @@ public interface ExcelDataMapper extends BaseMapper<ExcelDataEntity> {
List<AssociationVO> selectFinancialTransactions(@Param("userName") String userName, @Param("caseId") String caseId);
List<ExcelDataEntity> queryListByPayUserList(@Param("userList") List<String> userList,
List<ExcelDataVO> queryListByPayUserList(@Param("userList") List<String> userList,
@Param("caseId") int caseId);
}
......@@ -13,4 +13,10 @@ public class ExcelDataVO extends ExcelDataEntity {
private String fileName;
private String filePath;
private String label;
private int nodeNum;
private String accountType;
}
......@@ -7,6 +7,8 @@ public class NodeVO {
private String node;
private int degree;
public NodeVO(String node) {
this.node = node;
}
......
......@@ -5,6 +5,7 @@ import com.platform.model.dto.CaseDTO;
import com.platform.model.dto.ExcelDataDTO;
import com.platform.model.entity.CaseEntity;
import com.platform.model.vo.CaseVO;
import com.platform.model.vo.ExcelDataVO;
import com.platform.model.vo.GraphVO;
import java.util.List;
......@@ -56,4 +57,6 @@ public interface CaseService extends IService<CaseEntity> {
* @return GraphVO
*/
GraphVO draw(CaseDTO caseDTO);
List<ExcelDataVO> info(int caseId);
}
......@@ -19,28 +19,26 @@ public interface ExcelDataService extends IService<ExcelDataEntity> {
List<ExcelDataVO> queryByCaseId(String id);
/**
*
* @param fileId
* @return
*/
List<ExcelDataEntity> queryListByFileId(String fileId,String caseId);
List<ExcelDataEntity> queryListByFileId(String fileId, String caseId);
/**
*
* @param fileId
* @return
*/
boolean deleteByFileId(String fileId);
/**
*
* @param
* @return
*/
List<ExcelDataEntity> queryListByCaseIdAndPayUserName(String caseId,String payUserName);
List<ExcelDataEntity> queryListByCaseIdAndPayUserName(String caseId, String payUserName);
/**
* 查看案件所有的人员
*
* @param id
* @return
*/
......@@ -48,7 +46,7 @@ public interface ExcelDataService extends IService<ExcelDataEntity> {
List<ExcelDataEntity> queryList(CaseDTO caseDTO);
List<ExcelDataEntity> queryListByPayUserList(List<String> userList,int caseId);
List<ExcelDataVO> queryListByPayUserList(List<String> userList, int caseId);
List<AssociationVO> selectFinancialTransactions(String userName, String caseId);
}
......@@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class CaseServiceImpl extends ServiceImpl<CaseMapper, CaseEntity> implements CaseService {
......@@ -310,6 +311,54 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CaseEntity> impleme
return graph;
}
@Override
public List<ExcelDataVO> info(int caseId) {
// 使用Set去重
Set<String> uniqueNodes = new HashSet<>();
// 使用Map来统计每个人关联的节点数量
Map<String, Integer> nodeDegreeMap = new HashMap<>();
CaseDTO caseDTO = new CaseDTO();
caseDTO.setId(caseId);
List<ExcelDataEntity> excelDataEntityList = excelDataService.queryList(caseDTO);
// 遍历结果集
for (ExcelDataEntity excelDataEntity : excelDataEntityList) {
String payer = excelDataEntity.getPayUserName();
String payee = excelDataEntity.getPayeeName();
if (StringUtils.isEmpty(payee) || StringUtils.isEmpty(payer)) {
continue;
}
// 添加节点
uniqueNodes.add(payer);
uniqueNodes.add(payee);
// 更新每个人关联的节点数量
nodeDegreeMap.put(payer, nodeDegreeMap.getOrDefault(payer, 0) + 1);
nodeDegreeMap.put(payee, nodeDegreeMap.getOrDefault(payee, 0) + 1);
}
//查看每个人的账号类型
List<String> userNameList = new ArrayList<>(uniqueNodes);
List<ExcelDataVO> excelDataEntityListNew = excelDataService.queryListByPayUserList(userNameList, caseId);
//根据用户名分组
List<ExcelDataVO> groupedObjects = excelDataEntityListNew.stream()
.collect(Collectors.groupingBy(ExcelDataVO::getPayUserName))
.values().stream()
.map(list -> list.get(0)) // 保留每组的第一个对象
.collect(Collectors.toList());
groupedObjects.forEach(excelDataVO -> {
//获取节点数量
int nodeNum = nodeDegreeMap.get(excelDataVO.getPayUserName());
excelDataVO.setNodeNum(nodeNum);
if (excelDataVO.getRemark().contains("微信")) {
excelDataVO.setAccountType("微信");
} else if (StringUtils.isNotEmpty(excelDataVO.getExternalChannel())) {
excelDataVO.setAccountType("银联");
}
});
return groupedObjects;
}
// 节点过滤逻辑
private boolean shouldIncludeNode(String node, CaseDTO caseDTO) {
if (caseDTO.getPrincipal() == null) {
......
......@@ -62,12 +62,12 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
}
@Override
public List<ExcelDataEntity> queryListByPayUserList(List<String> userList, int caseId) {
public List<ExcelDataVO> queryListByPayUserList(List<String> userList, int caseId) {
return baseMapper.queryListByPayUserList(userList, caseId);
}
@Override
public List<AssociationVO> selectFinancialTransactions(String userName, String caseId) {
return baseMapper.selectFinancialTransactions(userName,caseId);
return baseMapper.selectFinancialTransactions(userName, caseId);
}
}
......@@ -5,13 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.platform.mapper.GroupDetailMapper;
import com.platform.model.dto.GroupDetailDTO;
import com.platform.model.entity.ExcelDataEntity;
import com.platform.model.entity.GroupDetailEntity;
import com.platform.model.entity.GroupEntity;
import com.platform.model.vo.EdgeVO;
import com.platform.model.vo.GraphVO;
import com.platform.model.vo.GroupDetailVO;
import com.platform.model.vo.NodeVO;
import com.platform.model.vo.*;
import com.platform.service.ExcelDataService;
import com.platform.service.GroupDetailService;
import com.platform.service.GroupService;
......@@ -77,12 +73,12 @@ public class GroupDetailServiceImpl extends ServiceImpl<GroupDetailMapper, Group
//根据团体id查看团体明细
List<String> userList = baseMapper.queryUserList(groupId);
if (CollUtil.isNotEmpty(userList)) {
List<ExcelDataEntity> excelDataEntityList = excelDataService.queryListByPayUserList(userList, groupEntity.getCaseId());
List<ExcelDataVO> excelDataEntityList = excelDataService.queryListByPayUserList(userList, groupEntity.getCaseId());
// 遍历结果集
for (ExcelDataEntity excelDataEntity : excelDataEntityList) {
String payer = excelDataEntity.getPayUserName();
String payee = excelDataEntity.getPayeeName();
double amount = excelDataEntity.getAmount();
for (ExcelDataVO excelDataVO : excelDataEntityList) {
String payer = excelDataVO.getPayUserName();
String payee = excelDataVO.getPayeeName();
double amount = excelDataVO.getAmount();
if (StringUtils.isEmpty(payee) || StringUtils.isEmpty(payer)) {
continue;
......
......@@ -56,19 +56,26 @@
direction
</select>
<select id="queryListByPayUserList" resultType="com.platform.model.entity.ExcelDataEntity">
<select id="queryListByPayUserList" resultType="com.platform.model.vo.ExcelDataVO">
select
pay_user_name payUserName,
payee_name payeeName,
amount amount
ed.pay_user_name,
ed.payee_name payeeName,
ed.remark,
ed.external_channel,
ed.amount,
u.label
from
excel_data
excel_data ed
left join
user u
on
ed.pay_user_name = u.user_name
where
use_flag = 1
ed.use_flag = 1
and
case_id = #{caseId}
ed.case_id = #{caseId}
and
pay_user_name in
ed.pay_user_name in
<foreach collection="userList" item="userName" open="(" separator="," close=")">
#{userName}
</foreach>
......
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