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
82f4598b
Commit
82f4598b
authored
Aug 01, 2025
by
zhuxiang
Browse files
团体详情
parent
b13cd184
Changes
12
Show whitespace changes
Inline
Side-by-side
src/main/java/com/platform/controller/GroupController.java
0 → 100644
View file @
82f4598b
package
com.platform.controller
;
import
com.platform.model.dto.GroupDetailDTO
;
import
com.platform.model.resp.Result
;
import
com.platform.page.TableDataInfo
;
import
com.platform.service.GroupDetailService
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
@RestController
@RequestMapping
(
"/group"
)
public
class
GroupController
extends
BaseController
{
@Resource
private
GroupDetailService
groupDetailService
;
@PostMapping
(
"/person"
)
public
TableDataInfo
person
(
@RequestBody
GroupDetailDTO
groupDetailDTO
)
{
startPage
(
groupDetailDTO
.
getPageNum
(),
groupDetailDTO
.
getPageSize
());
return
getDataTable
(
groupDetailService
.
queryList
(
groupDetailDTO
));
}
@PostMapping
(
"/ip"
)
public
TableDataInfo
ip
(
@RequestBody
GroupDetailDTO
groupDetailDTO
)
{
startPage
(
groupDetailDTO
.
getPageNum
(),
groupDetailDTO
.
getPageSize
());
return
getDataTable
(
groupDetailService
.
queryIp
(
groupDetailDTO
));
}
@GetMapping
(
"/ipDetail"
)
public
Result
getDetail
(
@RequestParam
String
ip
)
{
return
Result
.
data
(
groupDetailService
.
queryIpDetail
(
ip
));
}
@PostMapping
(
"/mac"
)
public
TableDataInfo
mac
(
@RequestBody
GroupDetailDTO
groupDetailDTO
)
{
startPage
(
groupDetailDTO
.
getPageNum
(),
groupDetailDTO
.
getPageSize
());
return
getDataTable
(
groupDetailService
.
queryMac
(
groupDetailDTO
));
}
@GetMapping
(
"/macDetail"
)
public
Result
macDetail
(
@RequestParam
String
mac
)
{
return
Result
.
data
(
groupDetailService
.
queryMacDetail
(
mac
));
}
}
src/main/java/com/platform/mapper/GroupDetailMapper.java
View file @
82f4598b
package
com.platform.mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.platform.model.dto.GroupDetailDTO
;
import
com.platform.model.entity.GroupDetailEntity
;
import
com.platform.model.vo.GroupDetailVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
@Mapper
public
interface
GroupDetailMapper
extends
BaseMapper
<
GroupDetailEntity
>
{
List
<
GroupDetailVO
>
queryIp
(
GroupDetailDTO
groupDetailDTO
);
List
<
GroupDetailVO
>
queryMac
(
GroupDetailDTO
groupDetailDTO
);
}
src/main/java/com/platform/model/dto/GroupDetailDTO.java
0 → 100644
View file @
82f4598b
package
com.platform.model.dto
;
import
lombok.Data
;
@Data
public
class
GroupDetailDTO
{
private
int
pageNum
;
private
int
pageSize
;
private
int
groupId
;
}
src/main/java/com/platform/model/entity/GroupDetailEntity.java
View file @
82f4598b
...
...
@@ -15,12 +15,19 @@ public class GroupDetailEntity {
@TableField
(
"case_id"
)
private
int
caseId
;
@TableField
(
"group_id"
)
private
int
groupId
;
private
String
userName
;
private
int
transactionCount
;
// 总交易次数
private
double
totalAmount
;
// 总交易金额(转出+转入)
private
double
outgoingAmount
;
// 转出金额
private
double
incomingAmount
;
// 转入金额
private
String
ip
;
private
String
mac
;
private
String
account
;
public
GroupDetailEntity
(
String
userName
)
{
this
.
userName
=
userName
;
}
...
...
src/main/java/com/platform/model/vo/EdgeVO.java
View file @
82f4598b
...
...
@@ -20,15 +20,23 @@ public class EdgeVO {
private
String
groupId
;
private
String
ip
;
private
String
mac
;
private
String
account
;
private
List
<
String
>
states
;
public
EdgeVO
(
String
id
,
String
source
,
String
target
,
int
totalTransactions
,
double
totalAmount
,
String
groupId
)
{
public
EdgeVO
(
String
id
,
String
source
,
String
target
,
int
totalTransactions
,
double
totalAmount
,
String
groupId
,
String
ip
,
String
mac
,
String
account
)
{
this
.
id
=
id
;
this
.
source
=
source
;
this
.
target
=
target
;
this
.
totalTransactions
=
totalTransactions
;
this
.
totalAmount
=
totalAmount
;
this
.
groupId
=
groupId
;
this
.
ip
=
ip
;
this
.
mac
=
mac
;
this
.
account
=
account
;
}
}
src/main/java/com/platform/model/vo/GroupDetailVO.java
0 → 100644
View file @
82f4598b
package
com.platform.model.vo
;
import
lombok.Data
;
@Data
public
class
GroupDetailVO
{
private
String
ip
;
private
int
frequency
;
private
String
associatedUsers
;
private
String
associatedAccounts
;
}
src/main/java/com/platform/service/GroupDetailService.java
View file @
82f4598b
package
com.platform.service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.platform.model.dto.GroupDetailDTO
;
import
com.platform.model.entity.GroupDetailEntity
;
import
com.platform.model.vo.GroupDetailVO
;
import
java.util.List
;
public
interface
GroupDetailService
extends
IService
<
GroupDetailEntity
>
{
List
<
GroupDetailEntity
>
queryList
(
GroupDetailDTO
groupDTO
);
List
<
GroupDetailVO
>
queryIp
(
GroupDetailDTO
groupDetailDTO
);
List
<
GroupDetailEntity
>
queryIpDetail
(
String
ip
);
List
<
GroupDetailVO
>
queryMac
(
GroupDetailDTO
groupDetailDTO
);
List
<
GroupDetailEntity
>
queryMacDetail
(
String
mac
);
}
src/main/java/com/platform/service/impl/CaseServiceImpl.java
View file @
82f4598b
...
...
@@ -121,6 +121,9 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CaseEntity> impleme
String
payer
=
excelDataEntity
.
getPayUserName
();
String
payee
=
excelDataEntity
.
getPayeeName
();
double
amount
=
excelDataEntity
.
getAmount
();
String
ip
=
excelDataEntity
.
getIp
();
String
mac
=
excelDataEntity
.
getMac
();
String
account
=
excelDataEntity
.
getPaymentBankName
();
// 添加到并查集
uf
.
makeSet
(
payer
);
...
...
@@ -138,7 +141,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CaseEntity> impleme
}
else
{
// 创建新边
String
edgeId
=
"line-"
+
payer
+
"-"
+
payee
;
EdgeVO
newEdge
=
new
EdgeVO
(
edgeId
,
payer
,
payee
,
1
,
amount
,
uf
.
find
(
payer
));
EdgeVO
newEdge
=
new
EdgeVO
(
edgeId
,
payer
,
payee
,
1
,
amount
,
uf
.
find
(
payer
)
,
ip
,
mac
,
account
);
edgeMap
.
put
(
edgeKey
,
newEdge
);
}
}
...
...
@@ -222,10 +225,16 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CaseEntity> impleme
String
payer
=
edge
.
getSource
();
String
payee
=
edge
.
getTarget
();
double
amount
=
edge
.
getTotalAmount
();
String
ip
=
edge
.
getIp
();
String
mac
=
edge
.
getMac
();
String
account
=
edge
.
getAccount
();
// 更新付款人(转出)
GroupDetailEntity
payerDetail
=
memberDetailMap
.
get
(
payer
);
if
(
payerDetail
!=
null
)
{
payerDetail
.
setIp
(
ip
);
payerDetail
.
setMac
(
mac
);
payerDetail
.
setAccount
(
account
);
payerDetail
.
addOutgoingTransaction
(
amount
);
payerDetail
.
incrementTransactionCount
(
edge
.
getTotalTransactions
());
}
...
...
@@ -233,6 +242,9 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CaseEntity> impleme
// 更新收款人(转入)
GroupDetailEntity
payeeDetail
=
memberDetailMap
.
get
(
payee
);
if
(
payeeDetail
!=
null
)
{
payeeDetail
.
setIp
(
ip
);
payeeDetail
.
setMac
(
mac
);
payeeDetail
.
setAccount
(
account
);
payeeDetail
.
addIncomingTransaction
(
amount
);
payeeDetail
.
incrementTransactionCount
(
edge
.
getTotalTransactions
());
}
...
...
src/main/java/com/platform/service/impl/GroupDetailServiceImpl.java
View file @
82f4598b
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.GroupDetailMapper
;
import
com.platform.model.dto.GroupDetailDTO
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.entity.GroupDetailEntity
;
import
com.platform.model.vo.GroupDetailVO
;
import
com.platform.service.GroupDetailService
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Service
public
class
GroupDetailServiceImpl
extends
ServiceImpl
<
GroupDetailMapper
,
GroupDetailEntity
>
implements
GroupDetailService
{
@Override
public
List
<
GroupDetailEntity
>
queryList
(
GroupDetailDTO
groupDetailDTO
)
{
return
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
GroupDetailEntity
>()
.
eq
(
GroupDetailEntity:
:
getGroupId
,
groupDetailDTO
.
getGroupId
()));
}
@Override
public
List
<
GroupDetailVO
>
queryIp
(
GroupDetailDTO
groupDetailDTO
)
{
return
baseMapper
.
queryIp
(
groupDetailDTO
);
}
@Override
public
List
<
GroupDetailEntity
>
queryIpDetail
(
String
ip
)
{
return
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
GroupDetailEntity
>()
.
eq
(
GroupDetailEntity:
:
getIp
,
ip
));
}
@Override
public
List
<
GroupDetailVO
>
queryMac
(
GroupDetailDTO
groupDetailDTO
)
{
return
baseMapper
.
queryMac
(
groupDetailDTO
);
}
@Override
public
List
<
GroupDetailEntity
>
queryMacDetail
(
String
mac
)
{
return
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
GroupDetailEntity
>()
.
eq
(
GroupDetailEntity:
:
getMac
,
mac
));
}
}
src/main/java/com/platform/service/impl/GroupServiceImpl.java
View file @
82f4598b
...
...
@@ -38,14 +38,15 @@ public class GroupServiceImpl extends ServiceImpl<GroupMapper, GroupEntity> impl
groupEntity
.
setTotalTransactions
(
groupVO
.
getTotalTransactions
());
//入库
save
(
groupEntity
);
System
.
out
.
println
(
groupEntity
.
getId
());
groupVO
.
setId
(
groupEntity
.
getId
());
List
<
GroupDetailEntity
>
groupDetailList
=
groupVO
.
getGroupDetailList
();
if
(
CollUtil
.
isNotEmpty
(
groupDetailList
))
{
groupDetailList
.
forEach
(
groupDetailEntity
->
groupDetailEntity
.
setCaseId
(
id
));
groupDetailList
.
forEach
(
groupDetailEntity
->
{
groupDetailEntity
.
setCaseId
(
id
);
groupDetailEntity
.
setGroupId
(
groupEntity
.
getId
());
});
groupDetailService
.
saveBatch
(
groupDetailList
);
}
groupVO
.
setGroupDetailList
(
null
);
});
}
...
...
src/main/resources/com/platform/mapper/ExcelDataMapper.xml
View file @
82f4598b
...
...
@@ -24,7 +24,10 @@
select
pay_user_name payUserName,
payee_name payeeName,
amount amount
amount amount,
ip ip,
mac mac,
payment_bank_name
from
excel_data
where
...
...
src/main/resources/com/platform/mapper/GroupDetailMapper.xml
0 → 100644
View file @
82f4598b
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.platform.mapper.GroupDetailMapper"
>
<select
id=
"queryIp"
resultType=
"com.platform.model.vo.GroupDetailVO"
>
SELECT
ip,
COUNT(*) AS frequency,
GROUP_CONCAT(DISTINCT user_name ORDER BY user_name SEPARATOR ', ') AS associatedUsers,
GROUP_CONCAT(DISTINCT account ORDER BY account SEPARATOR ', ') AS associatedAccounts
FROM
group_detail
where
group_id = #{groupId}
GROUP BY
ip
</select>
<select
id=
"queryMac"
resultType=
"com.platform.model.vo.GroupDetailVO"
>
SELECT
mac,
COUNT(*) AS frequency,
GROUP_CONCAT(DISTINCT user_name ORDER BY user_name SEPARATOR ', ') AS associatedUsers,
GROUP_CONCAT(DISTINCT account ORDER BY account SEPARATOR ', ') AS associatedAccounts
FROM
group_detail
where
group_id = #{groupId}
GROUP BY
mac
</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