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
e4591ddf
Commit
e4591ddf
authored
Aug 14, 2025
by
zhuxiang
Browse files
优化
parent
f834a8b5
Changes
13
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/platform/controller/VerifyAccountController.java
0 → 100644
View file @
e4591ddf
package
com.platform.controller
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.platform.model.entity.VerifyAccountEntity
;
import
com.platform.model.resp.Result
;
import
com.platform.service.VerifyAccountService
;
import
org.springframework.dao.DuplicateKeyException
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
@RestController
@RequestMapping
(
"/verify/account"
)
public
class
VerifyAccountController
extends
BaseController
{
@Resource
private
VerifyAccountService
verifyAccountService
;
@PostMapping
(
"/set"
)
public
Result
set
(
@RequestBody
VerifyAccountEntity
verifyAccount
)
{
try
{
return
toAjax
(
verifyAccountService
.
save
(
verifyAccount
));
}
catch
(
DuplicateKeyException
e
)
{
return
toAjax
(
verifyAccountService
.
remove
(
new
LambdaQueryWrapper
<
VerifyAccountEntity
>()
.
eq
(
VerifyAccountEntity:
:
getCaseId
,
verifyAccount
.
getCaseId
())
.
eq
(
VerifyAccountEntity:
:
getAccountName
,
verifyAccount
.
getAccountName
())));
}
}
}
src/main/java/com/platform/mapper/ExcelDataMapper.java
View file @
e4591ddf
...
...
@@ -27,7 +27,7 @@ public interface ExcelDataMapper extends BaseMapper<ExcelDataEntity> {
List
<
AssociationVO
>
selectFinancialTransactions
(
UserDTO
userDTO
);
List
<
ExcelDataVO
>
queryListByPayUserList
(
@Param
(
"userList"
)
List
<
String
>
userList
,
@Param
(
"case
Id"
)
int
case
Id
);
@Param
(
"case
DTO"
)
CaseDTO
case
DTO
);
List
<
ExcelDataEntity
>
cashFlow
(
UserDTO
userDTO
);
...
...
src/main/java/com/platform/mapper/VerifyAccountMapper.java
0 → 100644
View file @
e4591ddf
package
com.platform.mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.platform.model.entity.VerifyAccountEntity
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
VerifyAccountMapper
extends
BaseMapper
<
VerifyAccountEntity
>
{
}
src/main/java/com/platform/model/entity/VerifyAccountEntity.java
0 → 100644
View file @
e4591ddf
package
com.platform.model.entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
@Data
@TableName
(
"verify_account"
)
public
class
VerifyAccountEntity
{
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
private
Integer
caseId
;
private
String
accountName
;
}
src/main/java/com/platform/model/vo/NodeVO.java
View file @
e4591ddf
...
...
@@ -19,12 +19,15 @@ public class NodeVO {
private
Boolean
publicAccountFlag
;
private
Boolean
verifyAccountFlag
;
private
int
degree
;
public
NodeVO
(
String
node
,
String
label
,
boolean
publicAccountFlag
)
{
public
NodeVO
(
String
node
,
String
label
,
boolean
publicAccountFlag
,
boolean
verifyAccountFlag
)
{
this
.
node
=
node
;
this
.
label
=
label
;
this
.
publicAccountFlag
=
publicAccountFlag
;
this
.
verifyAccountFlag
=
verifyAccountFlag
;
if
(
node
.
contains
(
"公司"
))
{
this
.
nodeType
=
"对公"
;
}
else
{
...
...
src/main/java/com/platform/service/ExcelDataService.java
View file @
e4591ddf
...
...
@@ -47,7 +47,7 @@ public interface ExcelDataService extends IService<ExcelDataEntity> {
List
<
ExcelDataEntity
>
queryList
(
CaseDTO
caseDTO
);
List
<
ExcelDataVO
>
queryListByPayUserList
(
List
<
String
>
userList
,
int
case
Id
);
List
<
ExcelDataVO
>
queryListByPayUserList
(
List
<
String
>
userList
,
CaseDTO
case
DTO
);
List
<
AssociationVO
>
selectFinancialTransactions
(
UserDTO
userDTO
);
...
...
src/main/java/com/platform/service/VerifyAccountService.java
0 → 100644
View file @
e4591ddf
package
com.platform.service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.platform.model.entity.VerifyAccountEntity
;
import
java.util.List
;
public
interface
VerifyAccountService
extends
IService
<
VerifyAccountEntity
>
{
List
<
VerifyAccountEntity
>
queryByCaseId
(
int
caseId
);
}
src/main/java/com/platform/service/impl/CaseServiceImpl.java
View file @
e4591ddf
...
...
@@ -41,6 +41,8 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
private
UserRelationService
userRelationService
;
@Resource
private
PublicAccountService
publicAccountService
;
@Resource
private
VerifyAccountService
verifyAccountService
;
@Override
public
List
<
CaseVO
>
queryDataList
(
CaseDTO
caseDTO
)
{
...
...
@@ -156,6 +158,10 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
Set
<
String
>
uniqueUserName
=
new
HashSet
<>();
Map
<
String
,
EdgeVO
>
edgeMap
=
new
HashMap
<>();
Map
<
String
,
Boolean
>
publicAccountMap
=
new
HashMap
<>();
Map
<
String
,
Boolean
>
verifyAccountMap
=
new
HashMap
<>();
List
<
VerifyAccountEntity
>
verifyAccountEntityList
=
verifyAccountService
.
queryByCaseId
(
caseDTO
.
getId
());
verifyAccountEntityList
.
forEach
(
verifyAccountEntity
->
verifyAccountMap
.
put
(
verifyAccountEntity
.
getAccountName
(),
true
));
// 配置规则
applyCaseRules
(
caseDTO
);
...
...
@@ -173,7 +179,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
Map
<
String
,
String
>
userAndLabel
=
getUserLabels
(
uniqueUserName
,
caseDTO
.
getId
());
// 添加节点
addNodesToGraph
(
graph
,
uniqueUserName
,
userAndLabel
,
publicAccountMap
);
addNodesToGraph
(
graph
,
uniqueUserName
,
userAndLabel
,
publicAccountMap
,
verifyAccountMap
);
// 过滤有效边
List
<
EdgeVO
>
validEdges
=
filterValidEdges
(
edgeMap
,
uf
);
...
...
@@ -280,6 +286,10 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
String
payer
=
excelDataEntity
.
getPayUserName
();
String
payee
=
excelDataEntity
.
getPayeeName
();
if
(
StringUtils
.
isEmpty
(
payee
)
||
StringUtils
.
isEmpty
(
payer
)
||
payer
.
equals
(
"-"
)
||
payee
.
equals
(
"-"
))
{
continue
;
}
double
amount
=
formatAmount
(
excelDataEntity
.
getAmount
());
uniqueUserName
.
add
(
payer
);
uniqueUserName
.
add
(
payee
);
...
...
@@ -288,6 +298,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
if
(
isPublicAccount
(
payer
,
publicAccountEntityList
,
publicAccountMap
)
||
isPublicAccount
(
payee
,
publicAccountEntityList
,
publicAccountMap
))
{
continue
;
}
// 使用UnionFindVO的接口正确添加节点
if
(!
uf
.
getParent
().
containsKey
(
payer
))
{
uf
.
makeSet
(
payer
);
...
...
@@ -359,11 +370,13 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
private
void
addNodesToGraph
(
GraphVO
graph
,
Set
<
String
>
uniqueUserName
,
Map
<
String
,
String
>
userAndLabel
,
Map
<
String
,
Boolean
>
publicAccountMap
)
{
Map
<
String
,
Boolean
>
publicAccountMap
,
Map
<
String
,
Boolean
>
verifyAccountMap
)
{
for
(
String
userName
:
uniqueUserName
)
{
String
label
=
userAndLabel
.
getOrDefault
(
userName
,
""
);
boolean
publicAccount
=
publicAccountMap
.
getOrDefault
(
userName
,
false
);
graph
.
addNode
(
new
NodeVO
(
userName
,
label
,
publicAccount
));
boolean
verifyAccount
=
verifyAccountMap
.
getOrDefault
(
userName
,
false
);
graph
.
addNode
(
new
NodeVO
(
userName
,
label
,
publicAccount
,
verifyAccount
));
}
}
...
...
@@ -578,7 +591,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
for
(
ExcelDataEntity
excelDataEntity
:
excelDataEntityList
)
{
String
payer
=
excelDataEntity
.
getPayUserName
();
String
payee
=
excelDataEntity
.
getPayeeName
();
if
(
StringUtils
.
isEmpty
(
payee
)
||
StringUtils
.
isEmpty
(
payer
))
{
if
(
StringUtils
.
isEmpty
(
payee
)
||
StringUtils
.
isEmpty
(
payer
)
||
payer
.
equals
(
"-"
)
||
payee
.
equals
(
"-"
)
)
{
continue
;
}
// 更新每个人关联的节点数量
...
...
src/main/java/com/platform/service/impl/ExcelDataServiceImpl.java
View file @
e4591ddf
...
...
@@ -66,11 +66,11 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
}
@Override
public
List
<
ExcelDataVO
>
queryListByPayUserList
(
List
<
String
>
userList
,
int
case
Id
)
{
public
List
<
ExcelDataVO
>
queryListByPayUserList
(
List
<
String
>
userList
,
CaseDTO
case
DTO
)
{
if
(
CollUtil
.
isEmpty
(
userList
))
{
return
Lists
.
newArrayList
();
}
return
baseMapper
.
queryListByPayUserList
(
userList
,
case
Id
);
return
baseMapper
.
queryListByPayUserList
(
userList
,
case
DTO
);
}
@Override
...
...
src/main/java/com/platform/service/impl/GroupDetailServiceImpl.java
View file @
e4591ddf
...
...
@@ -2,17 +2,18 @@ package com.platform.service.impl;
import
cn.hutool.core.collection.CollUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.EasyExcelFactory
;
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.CaseDTO
;
import
com.platform.model.dto.GroupDetailDTO
;
import
com.platform.model.entity.CaseRuleConfigEntity
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.entity.GroupDetailEntity
;
import
com.platform.model.entity.GroupEntity
;
import
com.platform.model.vo.*
;
import
com.platform.service.ExcelDataService
;
import
com.platform.service.GroupDetailService
;
import
com.platform.service.GroupService
;
import
com.platform.service.UserService
;
import
com.platform.service.*
;
import
com.platform.utils.StringUtils
;
import
org.springframework.stereotype.Service
;
...
...
@@ -29,9 +30,13 @@ public class GroupDetailServiceImpl extends ServiceImpl<GroupDetailMapper, Group
@Resource
private
UserService
userService
;
@Resource
private
WhiteService
whiteService
;
@Resource
private
GroupService
groupService
;
@Resource
private
ExcelDataService
excelDataService
;
@Resource
private
CaseRuleConfigService
caseRuleConfigService
;
@Override
public
List
<
GroupDetailEntity
>
queryList
(
GroupDetailDTO
groupDetailDTO
)
{
...
...
@@ -83,7 +88,22 @@ public class GroupDetailServiceImpl extends ServiceImpl<GroupDetailMapper, Group
//根据团体id查看团体明细
List
<
String
>
userList
=
baseMapper
.
queryUserList
(
groupId
);
if
(
CollUtil
.
isNotEmpty
(
userList
))
{
List
<
ExcelDataVO
>
excelDataEntityList
=
excelDataService
.
queryListByPayUserList
(
userList
,
groupEntity
.
getCaseId
());
CaseDTO
caseDTO
=
new
CaseDTO
();
CaseRuleConfigEntity
caseRuleConfigEntity
=
caseRuleConfigService
.
getByCaseId
(
groupEntity
.
getCaseId
());
if
(
caseRuleConfigEntity
!=
null
)
{
caseDTO
.
setMinTransaction
(
caseRuleConfigEntity
.
getMinTransaction
());
caseDTO
.
setMaxTransaction
(
caseRuleConfigEntity
.
getMaxTransaction
());
caseDTO
.
setMinAmount
(
caseRuleConfigEntity
.
getMinAmount
());
caseDTO
.
setMaxAmount
(
caseRuleConfigEntity
.
getMaxAmount
());
caseDTO
.
setStartTime
(
caseRuleConfigEntity
.
getStartTime
());
caseDTO
.
setEndTime
(
caseRuleConfigEntity
.
getEndTime
());
caseDTO
.
setPrincipal
(
caseRuleConfigEntity
.
getPrincipal
());
caseDTO
.
setWhiteFlag
(
caseRuleConfigEntity
.
isWhiteFlag
());
caseDTO
.
setId
(
groupEntity
.
getCaseId
());
}
List
<
ExcelDataVO
>
excelDataEntityList
=
filterExcelData
(
userList
,
caseDTO
);
// 遍历结果集
for
(
ExcelDataVO
excelDataVO
:
excelDataEntityList
)
{
String
payer
=
excelDataVO
.
getPayUserName
();
...
...
@@ -120,7 +140,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
),
false
));
graph
.
addNode
(
new
NodeVO
(
node
,
userAndLabel
.
get
(
node
),
false
,
false
));
}
// 添加边
...
...
@@ -132,6 +152,71 @@ public class GroupDetailServiceImpl extends ServiceImpl<GroupDetailMapper, Group
return
null
;
}
private
List
<
ExcelDataVO
>
filterExcelData
(
List
<
String
>
userList
,
CaseDTO
caseDTO
)
{
List
<
ExcelDataVO
>
excelDataEntityList
=
excelDataService
.
queryListByPayUserList
(
userList
,
caseDTO
);
if
(
CollUtil
.
isEmpty
(
excelDataEntityList
))
{
return
excelDataEntityList
;
}
// 使用迭代器安全删除
Iterator
<
ExcelDataVO
>
iterator
=
excelDataEntityList
.
iterator
();
while
(
iterator
.
hasNext
())
{
ExcelDataEntity
excelDataEntity
=
iterator
.
next
();
// 过滤付款人类型
if
(
caseDTO
.
getPrincipal
()
!=
null
)
{
if
(
caseDTO
.
getPrincipal
()
==
1
&&
excelDataEntity
.
getPayeeName
().
contains
(
"公司"
))
{
iterator
.
remove
();
continue
;
}
if
(
caseDTO
.
getPrincipal
()
==
2
&&
!
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
isWithinAmountRange
(
ExcelDataEntity
entity
,
Double
min
,
Double
max
)
{
double
amount
=
entity
.
getAmount
();
if
(
min
!=
null
&&
amount
<
min
)
return
false
;
if
(
max
!=
null
&&
amount
>
max
)
return
false
;
return
true
;
}
private
boolean
isWithinTransactionRange
(
ExcelDataEntity
entity
,
Integer
min
,
Integer
max
)
{
int
count
=
entity
.
getTransactionCount
();
if
(
min
!=
null
&&
count
<
min
)
return
false
;
if
(
max
!=
null
&&
count
>
max
)
return
false
;
return
true
;
}
private
void
filterWhite
(
List
<
ExcelDataVO
>
excelDataEntityList
)
{
//查看白名单
List
<
String
>
whiteUser
=
whiteService
.
queryList
();
// 如果 name 属性值存在于白名单中,则移除该元素
excelDataEntityList
.
removeIf
(
entity
->
whiteUser
.
contains
(
entity
.
getPayUserName
())
||
whiteUser
.
contains
(
entity
.
getPayeeName
()));
}
@Override
public
void
personExport
(
GroupDetailDTO
groupDetailDTO
,
HttpServletResponse
response
)
{
// 设置响应头
...
...
@@ -172,7 +257,7 @@ public class GroupDetailServiceImpl extends ServiceImpl<GroupDetailMapper, Group
// 写入Excel
try
{
EasyExcel
.
write
(
response
.
getOutputStream
(),
WhiteVO
.
class
)
EasyExcel
Factory
.
write
(
response
.
getOutputStream
(),
WhiteVO
.
class
)
.
sheet
(
"团体-IP列表"
)
.
doWrite
(
groupDetailIpVOList
);
}
catch
(
IOException
e
)
{
...
...
@@ -196,7 +281,7 @@ public class GroupDetailServiceImpl extends ServiceImpl<GroupDetailMapper, Group
// 写入Excel
try
{
EasyExcel
.
write
(
response
.
getOutputStream
(),
WhiteVO
.
class
)
EasyExcel
Factory
.
write
(
response
.
getOutputStream
(),
WhiteVO
.
class
)
.
sheet
(
"团体-IP列表"
)
.
doWrite
(
groupDetailMacVOList
);
}
catch
(
IOException
e
)
{
...
...
src/main/java/com/platform/service/impl/VerifyAccountServiceImpl.java
0 → 100644
View file @
e4591ddf
package
com.platform.service.impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.platform.mapper.VerifyAccountMapper
;
import
com.platform.model.entity.VerifyAccountEntity
;
import
com.platform.service.VerifyAccountService
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Service
public
class
VerifyAccountServiceImpl
extends
ServiceImpl
<
VerifyAccountMapper
,
VerifyAccountEntity
>
implements
VerifyAccountService
{
@Override
public
List
<
VerifyAccountEntity
>
queryByCaseId
(
int
caseId
)
{
return
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
VerifyAccountEntity
>()
.
eq
(
VerifyAccountEntity:
:
getCaseId
,
caseId
));
}
}
src/main/resources/com/platform/mapper/ExcelDataMapper.xml
View file @
e4591ddf
...
...
@@ -54,12 +54,6 @@
<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"
>
...
...
@@ -99,13 +93,11 @@
<select
id=
"queryListByPayUserList"
resultType=
"com.platform.model.vo.ExcelDataVO"
>
select
ed.pay_user_name,
ed.pay_user_name
payUserName
,
ed.payee_name payeeName,
ed.remark,
ed.payee_bank_card,
ed.external_channel,
ed.amount,
u.label
SUM(ed.amount) amount,
COUNT(*) AS transactionCount,
Max(u.label) label
from
excel_data ed
left join
...
...
@@ -115,12 +107,21 @@
where
ed.use_flag = 1
and
ed.case_id = #{caseId}
ed.user_flag = 1
and
ed.case_id = #{caseDTO.id}
<if
test=
"caseDTO.startTime != null"
>
and ed.time >= #{caseDTO.startTime}
</if>
<if
test=
"caseDTO.endTime != null"
>
and ed.time
<
= #{caseDTO.endTime}
</if>
and
ed.pay_user_name in
<foreach
collection=
"userList"
item=
"userName"
open=
"("
separator=
","
close=
")"
>
<foreach
collection=
"userList"
item=
"userName"
open=
"("
separator=
","
close=
")"
>
#{userName}
</foreach>
</foreach>
group by ed.pay_user_name,ed.payee_name
</select>
<select
id=
"cashFlow"
resultType=
"com.platform.model.entity.ExcelDataEntity"
>
select id,
...
...
src/main/resources/com/platform/mapper/GroupDetailMapper.xml
View file @
e4591ddf
...
...
@@ -5,7 +5,7 @@
<select
id=
"queryIp"
resultType=
"com.platform.model.vo.GroupDetailIpVO"
>
SELECT
id,
MAX(
id
)
,
ip,
COUNT(*) AS frequency,
GROUP_CONCAT(DISTINCT user_name ORDER BY user_name SEPARATOR ', ') AS associatedUsers,
...
...
@@ -24,7 +24,7 @@
<select
id=
"queryMac"
resultType=
"com.platform.model.vo.GroupDetailMacVO"
>
SELECT
id,
MAX(
id
)
,
mac,
COUNT(*) AS frequency,
GROUP_CONCAT(DISTINCT user_name ORDER BY user_name SEPARATOR ', ') AS associatedUsers,
...
...
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