Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
relation
Commits
0ee46ee5
Commit
0ee46ee5
authored
Aug 12, 2025
by
wujipeng
Browse files
Merge remote-tracking branch 'origin/dev' into dev
parents
ed242cb5
e06648bb
Changes
9
Show whitespace changes
Inline
Side-by-side
src/main/java/com/platform/controller/PublicAccountController.java
View file @
0ee46ee5
package
com.platform.controller
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.platform.model.entity.PublicAccountEntity
;
import
com.platform.model.resp.Result
;
import
com.platform.service.PublicAccountService
;
...
...
@@ -24,7 +25,9 @@ public class PublicAccountController extends BaseController {
try
{
return
toAjax
(
publicAccountService
.
save
(
publicAccountEntity
));
}
catch
(
DuplicateKeyException
e
)
{
return
Result
.
fail
(
"该账户已是公共账户"
);
return
toAjax
(
publicAccountService
.
remove
(
new
LambdaQueryWrapper
<
PublicAccountEntity
>()
.
eq
(
PublicAccountEntity:
:
getCaseId
,
publicAccountEntity
.
getCaseId
())
.
eq
(
PublicAccountEntity:
:
getAccountName
,
publicAccountEntity
.
getAccountName
())));
}
}
}
src/main/java/com/platform/mapper/UserMapper.java
View file @
0ee46ee5
package
com.platform.mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.platform.model.dto.CaseDTO
;
import
com.platform.model.entity.UserEntity
;
import
com.platform.model.vo.ExcelDataVO
;
import
org.apache.ibatis.annotations.Mapper
;
...
...
@@ -14,4 +15,6 @@ public interface UserMapper extends BaseMapper<UserEntity> {
@Param
(
"caseId"
)
Integer
id
);
void
saveUserBatch
(
@Param
(
"userList"
)
List
<
UserEntity
>
userList
);
List
<
ExcelDataVO
>
queryList
(
CaseDTO
caseDTO
);
}
src/main/java/com/platform/model/vo/NodeVO.java
View file @
0ee46ee5
...
...
@@ -17,11 +17,14 @@ public class NodeVO {
private
Integer
whiteId
;
private
Boolean
publicAccountFlag
;
private
int
degree
;
public
NodeVO
(
String
node
,
String
label
)
{
public
NodeVO
(
String
node
,
String
label
,
boolean
publicAccountFlag
)
{
this
.
node
=
node
;
this
.
label
=
label
;
this
.
publicAccountFlag
=
publicAccountFlag
;
if
(
node
.
contains
(
"公司"
))
{
this
.
nodeType
=
"对公"
;
}
else
{
...
...
src/main/java/com/platform/service/UserService.java
View file @
0ee46ee5
package
com.platform.service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.platform.model.dto.CaseDTO
;
import
com.platform.model.dto.UserDTO
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.entity.UserEntity
;
...
...
@@ -42,4 +43,6 @@ public interface UserService extends IService<UserEntity> {
List
<
ExcelDataVO
>
queryUserLabel
(
List
<
String
>
userNameList
,
Integer
id
);
void
saveUserBatch
(
List
<
UserEntity
>
userList
);
List
<
ExcelDataVO
>
queryList
(
CaseDTO
caseDTO
);
}
src/main/java/com/platform/service/impl/CaseServiceImpl.java
View file @
0ee46ee5
...
...
@@ -54,12 +54,11 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
for
(
ExcelDataVO
excelDataVO
:
excelDataEntityList
)
{
if
(
StringUtils
.
isNotEmpty
(
excelDataVO
.
getPayUserName
())
&&
StringUtils
.
isNotEmpty
(
excelDataVO
.
getPayeeName
())
&&
excelDataVO
.
getPayUserName
().
equals
(
excelDataVO
.
getPayeeName
())
)
{
}
else
{
&&
!
excelDataVO
.
getPayUserName
().
equals
(
excelDataVO
.
getPayeeName
())
&&
StringUtils
.
isNotEmpty
(
excelDataVO
.
getFileId
()))
{
excelDataEntityList1
.
add
(
excelDataVO
);
}
}
excelDataEntityList1
.
forEach
(
excelDataEntity
->
{
if
(
StringUtils
.
isNull
(
excelDataEntity
.
getPayUserName
()))
{
excelDataEntity
.
setPayUserName
(
"无对应人员的数据"
);
...
...
@@ -158,6 +157,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
UnionFindVO
uf
=
new
UnionFindVO
();
Set
<
String
>
uniqueUserName
=
new
HashSet
<>();
Map
<
String
,
EdgeVO
>
edgeMap
=
new
HashMap
<>();
Map
<
String
,
Boolean
>
publicAccountMap
=
new
HashMap
<>();
// 配置规则
applyCaseRules
(
caseDTO
);
...
...
@@ -169,13 +169,13 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
}
// 处理原始数据
processRawData
(
excelDataEntityList
,
uf
,
uniqueUserName
,
edgeMap
,
caseDTO
.
getId
());
processRawData
(
excelDataEntityList
,
uf
,
uniqueUserName
,
edgeMap
,
publicAccountMap
,
caseDTO
.
getId
());
// 获取用户标签
Map
<
String
,
String
>
userAndLabel
=
getUserLabels
(
uniqueUserName
,
caseDTO
.
getId
());
// 添加节点
addNodesToGraph
(
graph
,
uniqueUserName
,
userAndLabel
);
addNodesToGraph
(
graph
,
uniqueUserName
,
userAndLabel
,
publicAccountMap
);
// 过滤有效边
List
<
EdgeVO
>
validEdges
=
filterValidEdges
(
edgeMap
,
uf
);
...
...
@@ -268,6 +268,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
UnionFindVO
uf
,
Set
<
String
>
uniqueUserName
,
Map
<
String
,
EdgeVO
>
edgeMap
,
Map
<
String
,
Boolean
>
publicAccountMap
,
int
caseId
)
{
//查看公共账号的数据
...
...
@@ -281,15 +282,14 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
String
payer
=
excelDataEntity
.
getPayUserName
();
String
payee
=
excelDataEntity
.
getPayeeName
();
// 跳过公共账户中的中号
if
(
isPublicAccount
(
payer
,
publicAccountEntityList
)
||
isPublicAccount
(
payee
,
publicAccountEntityList
))
{
continue
;
}
double
amount
=
formatAmount
(
excelDataEntity
.
getAmount
());
uniqueUserName
.
add
(
payer
);
uniqueUserName
.
add
(
payee
);
// 跳过公共账户中的中号
if
(
isPublicAccount
(
payer
,
publicAccountEntityList
,
publicAccountMap
)
||
isPublicAccount
(
payee
,
publicAccountEntityList
,
publicAccountMap
))
{
continue
;
}
// 使用UnionFindVO的接口正确添加节点
if
(!
uf
.
getParent
().
containsKey
(
payer
))
{
uf
.
makeSet
(
payer
);
...
...
@@ -306,12 +306,16 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
}
}
private
boolean
isPublicAccount
(
String
accountName
,
List
<
PublicAccountEntity
>
publicAccountEntityList
)
{
private
boolean
isPublicAccount
(
String
accountName
,
List
<
PublicAccountEntity
>
publicAccountEntityList
,
Map
<
String
,
Boolean
>
publicAccountMap
)
{
boolean
result
=
false
;
publicAccountMap
.
put
(
accountName
,
result
);
// 实现您的公共账户识别逻辑
for
(
PublicAccountEntity
publicAccountEntity
:
publicAccountEntityList
)
{
if
(
publicAccountEntity
.
getAccountName
().
equals
(
accountName
))
{
result
=
true
;
publicAccountMap
.
put
(
accountName
,
result
);
}
}
return
result
;
...
...
@@ -354,10 +358,14 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
return
userAndLabel
;
}
private
void
addNodesToGraph
(
GraphVO
graph
,
Set
<
String
>
uniqueUserName
,
Map
<
String
,
String
>
userAndLabel
)
{
private
void
addNodesToGraph
(
GraphVO
graph
,
Set
<
String
>
uniqueUserName
,
Map
<
String
,
String
>
userAndLabel
,
Map
<
String
,
Boolean
>
publicAccountMap
)
{
for
(
String
userName
:
uniqueUserName
)
{
String
label
=
userAndLabel
.
getOrDefault
(
userName
,
""
);
graph
.
addNode
(
new
NodeVO
(
userName
,
label
));
boolean
publicAccount
=
publicAccountMap
.
getOrDefault
(
userName
,
false
);
graph
.
addNode
(
new
NodeVO
(
userName
,
label
,
publicAccount
));
}
}
...
...
@@ -558,13 +566,15 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
@Override
public
List
<
NodeVO
>
info
(
CaseDTO
caseDTO
)
{
// 使用Set去重
Set
<
String
>
uniqueNodes
=
new
HashSet
<>();
// 使用Map来统计每个人关联的节点数量
Map
<
String
,
Integer
>
nodeDegreeMap
=
new
HashMap
<>();
Map
<
String
,
String
>
nodeAndUser
=
new
HashMap
<>();
List
<
ExcelDataEntity
>
excelDataEntityList
=
excelDataService
.
queryInfoList
(
caseDTO
);
List
<
ExcelDataVO
>
excelDataVOList
=
userService
.
queryList
(
caseDTO
);
List
<
String
>
userNameList
=
new
ArrayList
<>();
excelDataVOList
.
forEach
(
excelDataVO
->
userNameList
.
add
(
excelDataVO
.
getPayUserName
()));
List
<
ExcelDataEntity
>
excelDataEntityList
=
filterInfoExcelData
(
caseDTO
);
// 遍历结果集
for
(
ExcelDataEntity
excelDataEntity
:
excelDataEntityList
)
{
...
...
@@ -573,9 +583,6 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
if
(
StringUtils
.
isEmpty
(
payee
)
||
StringUtils
.
isEmpty
(
payer
))
{
continue
;
}
// 添加节点
uniqueNodes
.
add
(
payer
);
uniqueNodes
.
add
(
payee
);
// 更新每个人关联的节点数量
String
key
=
payer
+
payee
;
if
(
nodeAndUser
.
get
(
key
)
==
null
)
{
...
...
@@ -584,10 +591,6 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
nodeAndUser
.
put
(
key
,
key
);
}
}
//查看每个人的账号类型
List
<
String
>
userNameList
=
new
ArrayList
<>(
uniqueNodes
);
//查看每个人的账号标签
List
<
ExcelDataVO
>
excelDataEntityListNew
=
userService
.
queryUserLabel
(
userNameList
,
caseDTO
.
getId
());
//查看是否存在白名单
List
<
WhiteEntity
>
whiteEntityList
=
whiteService
.
queryByNameList
(
userNameList
);
...
...
@@ -595,7 +598,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
Map
<
String
,
Integer
>
whiteMap
=
new
HashMap
<>();
whiteEntityList
.
forEach
(
whiteEntity
->
whiteMap
.
put
(
whiteEntity
.
getName
(),
whiteEntity
.
getId
()));
for
(
ExcelDataVO
dataVO
:
excelData
Entity
List
New
)
{
for
(
ExcelDataVO
dataVO
:
excelData
VO
List
)
{
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
nodeDegreeMap
.
entrySet
())
{
String
key
=
entry
.
getKey
();
Integer
value
=
entry
.
getValue
();
...
...
@@ -612,7 +615,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
dataVO
.
setWhiteId
(
whiteId
);
}
Iterator
<
ExcelDataVO
>
iterator
=
excelData
Entity
List
New
.
iterator
();
Iterator
<
ExcelDataVO
>
iterator
=
excelData
VO
List
.
iterator
();
while
(
iterator
.
hasNext
())
{
ExcelDataVO
excelDataVO
=
iterator
.
next
();
if
(
caseDTO
.
getMinTransaction
()
!=
null
&&
caseDTO
.
getMaxTransaction
()
!=
null
)
{
...
...
@@ -628,7 +631,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
}
List
<
NodeVO
>
result
=
Lists
.
newArrayList
();
excelData
Entity
List
New
.
forEach
(
excelDataVO
->
{
excelData
VO
List
.
forEach
(
excelDataVO
->
{
NodeVO
org
=
new
NodeVO
();
if
(
excelDataVO
.
getAccountType
().
equals
(
"银联"
))
{
...
...
@@ -651,6 +654,50 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
return
result
;
}
private
List
<
ExcelDataEntity
>
filterInfoExcelData
(
CaseDTO
caseDTO
)
{
List
<
ExcelDataEntity
>
excelDataEntityList
=
excelDataService
.
queryList
(
caseDTO
);
if
(
CollUtil
.
isEmpty
(
excelDataEntityList
))
{
return
excelDataEntityList
;
}
// 使用迭代器安全删除
Iterator
<
ExcelDataEntity
>
iterator
=
excelDataEntityList
.
iterator
();
while
(
iterator
.
hasNext
())
{
ExcelDataEntity
excelDataEntity
=
iterator
.
next
();
// 过滤付款人类型
if
(
caseDTO
.
getNodeType
()
!=
null
)
{
if
(
caseDTO
.
getNodeType
().
equals
(
"银联"
)
&&
excelDataEntity
.
getPayeeName
().
contains
(
"公司"
))
{
iterator
.
remove
();
continue
;
}
if
(
caseDTO
.
getNodeType
().
equals
(
"个人"
)
&&
!
excelDataEntity
.
getPayeeName
().
contains
(
"公司"
))
{
iterator
.
remove
();
continue
;
}
}
// 过滤金额范围
if
(!
isWithinAmountRange
(
excelDataEntity
,
caseDTO
.
getMinAmount
(),
caseDTO
.
getMaxAmount
()))
{
iterator
.
remove
();
continue
;
}
// 过滤交易次数
if
(!
isWithinTransactionRange
(
excelDataEntity
,
caseDTO
.
getMinTransaction
(),
caseDTO
.
getMaxTransaction
()))
{
iterator
.
remove
();
}
}
// 白名单过滤
if
(
caseDTO
.
getWhiteFlag
()
!=
null
&&
caseDTO
.
getWhiteFlag
())
{
filterWhite
(
excelDataEntityList
);
}
return
excelDataEntityList
;
}
// 检查团体是否有实际连接(非孤立节点)
private
boolean
hasConnections
(
Set
<
String
>
members
,
GraphVO
graph
)
{
return
graph
.
getEdges
().
stream
()
...
...
src/main/java/com/platform/service/impl/GroupDetailServiceImpl.java
View file @
0ee46ee5
...
...
@@ -120,7 +120,7 @@ public class GroupDetailServiceImpl extends ServiceImpl<GroupDetailMapper, Group
excelDataEntityListNew
.
forEach
(
excelDataVO
->
userAndLabel
.
put
(
excelDataVO
.
getPayUserName
(),
excelDataVO
.
getLabel
()));
// 添加去重后的节点
for
(
String
node
:
uniqueNodes
)
{
graph
.
addNode
(
new
NodeVO
(
node
,
userAndLabel
.
get
(
node
)));
graph
.
addNode
(
new
NodeVO
(
node
,
userAndLabel
.
get
(
node
)
,
false
));
}
// 添加边
...
...
src/main/java/com/platform/service/impl/UserServiceImpl.java
View file @
0ee46ee5
...
...
@@ -11,6 +11,7 @@ import com.google.common.collect.Maps;
import
com.google.common.collect.Sets
;
import
com.platform.exception.BusinessException
;
import
com.platform.mapper.UserMapper
;
import
com.platform.model.dto.CaseDTO
;
import
com.platform.model.dto.UserDTO
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.entity.UserAccountEntity
;
...
...
@@ -248,7 +249,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
PageHelper
.
startPage
(
userDTO
.
getPageNum
(),
userDTO
.
getPageSize
());
if
(!
ObjectUtils
.
isEmpty
(
oneselfAccountList
)
&&
!
ObjectUtils
.
isEmpty
(
otherAccountList
)){
if
(!
ObjectUtils
.
isEmpty
(
oneselfAccountList
)
&&
!
ObjectUtils
.
isEmpty
(
otherAccountList
))
{
List
<
ExcelDataEntity
>
details
=
excelDataService
.
relationPage
(
oneselfAccountList
,
otherAccountList
);
everyoneVO
.
setDetails
(
details
);
}
...
...
@@ -317,4 +318,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
public
void
saveUserBatch
(
List
<
UserEntity
>
userList
)
{
baseMapper
.
saveUserBatch
(
userList
);
}
@Override
public
List
<
ExcelDataVO
>
queryList
(
CaseDTO
caseDTO
)
{
return
baseMapper
.
queryList
(
caseDTO
);
}
}
src/main/resources/com/platform/mapper/ExcelDataMapper.xml
View file @
0ee46ee5
...
...
@@ -54,6 +54,12 @@
<if
test=
"endTime != null"
>
and time
<
= #{endTime}
</if>
<if
test=
"startTime != null and endTime == null"
>
and time >= #{startTime}
</if>
<if
test=
"startTime == null and endTime != null"
>
and time
<![CDATA[ <= ]]>
#{startTime}
</if>
group by pay_user_name,payee_name
</select>
<select
id=
"selectFinancialTransactions"
resultType=
"com.platform.model.vo.AssociationVO"
>
...
...
src/main/resources/com/platform/mapper/UserMapper.xml
View file @
0ee46ee5
...
...
@@ -23,4 +23,26 @@
LEFT JOIN
user u ON u.user_name = v.userName AND u.case_id = #{caseId}
</select>
<select
id=
"queryList"
resultType=
"com.platform.model.vo.ExcelDataVO"
>
select
u.user_name payUserName,
u.label label
from
user u
left join
user_account ua
on
u.user_name = ua.user_name
<where>
and u.case_id = #{id}
<if
test=
"nodeName != null and nodeName != ''"
>
and (u.user_name like concat('%',#{nodeName},'%') or u.id_card like concat('%',#{nodeName},'%') or ua.code like concat('%',#{nodeName},'%') )
</if>
<if
test=
"label != null and label != ''"
>
and u.label like concat('%',#{label},'%')
</if>
</where>
group by u.user_name
</select>
</mapper>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment