Commit 0efd4ac4 authored by zhuxiang's avatar zhuxiang
Browse files

优化

parent 10ba665e
......@@ -2,7 +2,6 @@ package com.platform.controller;
import com.platform.model.dto.NodeDTO;
import com.platform.model.resp.Result;
import com.platform.page.TableDataInfo;
import com.platform.service.NodeService;
import org.springframework.web.bind.annotation.*;
......@@ -16,9 +15,8 @@ public class NodeController extends BaseController {
private NodeService nodeService;
@PostMapping("/mchRelationUser")
public TableDataInfo mchRelationUser(@RequestBody NodeDTO nodeDTO) {
startPage(nodeDTO.getPageNum(), nodeDTO.getPageSize());
return getDataTable(nodeService.mchRelationUser(nodeDTO));
public Result mchRelationUser(@RequestBody NodeDTO nodeDTO) {
return Result.data(nodeService.mchRelationUser(nodeDTO));
}
@DeleteMapping("/delete")
......
......@@ -36,4 +36,6 @@ public interface ExcelDataMapper extends BaseMapper<ExcelDataEntity> {
List<ExcelDataEntity> queryInfoList(CaseDTO caseDTO);
List<AssociationVO> queryAccountTemporary(@Param("userName") String userName, @Param("caseId") int caseId);
List<ExcelDataEntity> accountCashFlow(UserDTO userDTO);
List<ExcelDataEntity> queryListByPayeeNameAndPayUserName(@Param("payeeName") String payeeName, @Param("caseId") int caseId);
}
......@@ -20,5 +20,5 @@ public class ExcelDataVO extends ExcelDataEntity {
private String accountType;
private boolean whiteSetFlag;
private Integer whiteId;
}
......@@ -15,7 +15,7 @@ public class NodeVO {
private String bankCode;
private Boolean whiteSetFlag;
private Integer whiteId;
private int degree;
......
......@@ -67,4 +67,6 @@ public interface ExcelDataService extends IService<ExcelDataEntity> {
void deleteByPayUserName(String nodeName);
void deleteByPayeeName(String nodeName);
List<ExcelDataEntity> queryListByPayeeNameAndPayUserName(String payeeName, int caseId);
}
......@@ -417,6 +417,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
Set<String> uniqueNodes = new HashSet<>();
// 使用Map来统计每个人关联的节点数量
Map<String, Integer> nodeDegreeMap = new HashMap<>();
Map<String, String> nodeAndUser = new HashMap<>();
List<ExcelDataEntity> excelDataEntityList = excelDataService.queryInfoList(caseDTO);
......@@ -431,8 +432,12 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
uniqueNodes.add(payer);
uniqueNodes.add(payee);
// 更新每个人关联的节点数量
String key = payer + payee;
if (nodeAndUser.get(key) == null) {
nodeDegreeMap.put(payer, nodeDegreeMap.getOrDefault(payer, 0) + 1);
nodeDegreeMap.put(payee, nodeDegreeMap.getOrDefault(payee, 0) + 1);
nodeAndUser.put(key, key);
}
}
//查看每个人的账号类型
List<String> userNameList = new ArrayList<>(uniqueNodes);
......@@ -442,8 +447,8 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
//查看是否存在白名单
List<WhiteEntity> whiteEntityList = whiteService.queryByNameList(userNameList);
Map<String, Boolean> whiteMap = new HashMap<>();
whiteEntityList.forEach(whiteEntity -> whiteMap.put(whiteEntity.getName(), true));
Map<String, Integer> whiteMap = new HashMap<>();
whiteEntityList.forEach(whiteEntity -> whiteMap.put(whiteEntity.getName(), whiteEntity.getId()));
for (ExcelDataVO dataVO : excelDataEntityListNew) {
for (Map.Entry<String, Integer> entry : nodeDegreeMap.entrySet()) {
......@@ -458,8 +463,8 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
dataVO.setNodeNum(value);
}
}
Boolean whiteSetFlag = whiteMap.getOrDefault(dataVO.getPayUserName(), false);
dataVO.setWhiteSetFlag(whiteSetFlag);
Integer whiteId = whiteMap.getOrDefault(dataVO.getPayUserName(), null);
dataVO.setWhiteId(whiteId);
}
Iterator<ExcelDataVO> iterator = excelDataEntityListNew.iterator();
......@@ -485,7 +490,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
org.setNode(excelDataVO.getPayUserName());
org.setNodeNum(excelDataVO.getNodeNum());
org.setBankCode(excelDataVO.getPayeeBankCard());
org.setWhiteSetFlag(excelDataVO.isWhiteSetFlag());
org.setWhiteId(excelDataVO.getWhiteId());
org.setNodeType("银联");
result.add(org);
} else {
......@@ -493,7 +498,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
person.setNode(excelDataVO.getPayUserName());
person.setNodeNum(excelDataVO.getNodeNum());
person.setLabel(excelDataVO.getLabel());
person.setWhiteSetFlag(excelDataVO.isWhiteSetFlag());
person.setWhiteId(excelDataVO.getWhiteId());
person.setNodeType("个人");
result.add(person);
}
......
......@@ -119,6 +119,11 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
.eq(ExcelDataEntity::getPayeeName, nodeName));
}
@Override
public List<ExcelDataEntity> queryListByPayeeNameAndPayUserName(String payeeName, int caseId) {
return baseMapper.queryListByPayeeNameAndPayUserName(payeeName, caseId);
}
@Override
public List<AssociationVO> queryAccountTemporary(String userName, int caseId) {
return baseMapper.queryAccountTemporary(userName, caseId);
......
......@@ -45,13 +45,13 @@ public class NodeServiceImpl extends ServiceImpl<NodeMapper, NodeEntity> impleme
// 使用Set去重
Set<String> uniqueNodes = new HashSet<>();
List<ExcelDataEntity> excelDataEntityList = excelDataService.queryListByPayeeName(nodeDTO.getPayeeName(), nodeDTO.getCaseId());
Map<String, Integer> nodeDegreeMap = Maps.newHashMap();
List<ExcelDataEntity> excelDataEntityList = excelDataService.queryListByPayeeNameAndPayUserName(nodeDTO.getPayeeName(), nodeDTO.getCaseId());
excelDataEntityList.forEach(excelDataEntity -> {
String payer = excelDataEntity.getPayUserName();
String payee = excelDataEntity.getPayeeName();
// 添加节点
uniqueNodes.add(payer);
nodeDegreeMap.put(payer, nodeDegreeMap.getOrDefault(payer, 0) + 1);
uniqueNodes.add(payee);
});
//查看每个人的账号类型
......@@ -59,15 +59,6 @@ public class NodeServiceImpl extends ServiceImpl<NodeMapper, NodeEntity> impleme
//查看每个人的账号标签
List<ExcelDataVO> excelDataEntityListNew = userService.queryUserLabel(userNameList, nodeDTO.getCaseId());
for (ExcelDataVO dataVO : excelDataEntityListNew) {
for (Map.Entry<String, Integer> entry : nodeDegreeMap.entrySet()) {
String key = entry.getKey();
Integer value = entry.getValue();
if (dataVO.getPayUserName().equals(key)) {
dataVO.setNodeNum(value);
}
}
}
List<NodeVO> result = Lists.newArrayList();
excelDataEntityListNew.forEach(excelDataVO -> {
NodeVO person = new NodeVO();
......
......@@ -181,6 +181,7 @@
<if test="label != null and label != ''">
and u.label like concat('%',#{label},'%')
</if>
group by ed.id
</select>
<select id="queryAccountTemporary" resultType="com.platform.model.vo.AssociationVO">
select
......@@ -232,4 +233,25 @@
payment_account = #{otherUserName}
)
</select>
<select id="queryListByPayeeNameAndPayUserName" resultType="com.platform.model.entity.ExcelDataEntity">
select
ed.id,
ed.pay_user_name payUserName,
ed.payee_name payeeName,
ed.amount amount,
ed.ip ip,
ed.mac mac,
ed.payment_bank_name
from
excel_data ed
where
ed.use_flag = 1
and
ed.user_flag = 1
and
ed.case_id = #{caseId}
and
(ed.payee_name = #{payeeName} or ed.pay_user_name = #{payeeName})
</select>
</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