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
13c76afb
Commit
13c76afb
authored
Aug 10, 2025
by
zhuxiang
Browse files
增加团体信息导出接口
parent
5b061046
Changes
9
Show whitespace changes
Inline
Side-by-side
src/main/java/com/platform/controller/GroupController.java
View file @
13c76afb
...
...
@@ -9,6 +9,7 @@ import com.platform.service.GroupService;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
@RestController
@RequestMapping
(
"/group"
)
...
...
@@ -30,12 +31,24 @@ public class GroupController extends BaseController {
return
getDataTable
(
groupDetailService
.
queryList
(
groupDetailDTO
));
}
@PostMapping
(
"/person/export"
)
public
void
personExport
(
@RequestBody
GroupDetailDTO
groupDetailDTO
,
HttpServletResponse
response
)
{
startPage
(
groupDetailDTO
.
getPageNum
(),
groupDetailDTO
.
getPageSize
());
groupDetailService
.
personExport
(
groupDetailDTO
,
response
);
}
@PostMapping
(
"/ip"
)
public
TableDataInfo
ip
(
@RequestBody
GroupDetailDTO
groupDetailDTO
)
{
startPage
(
groupDetailDTO
.
getPageNum
(),
groupDetailDTO
.
getPageSize
());
return
getDataTable
(
groupDetailService
.
queryIp
(
groupDetailDTO
));
}
@PostMapping
(
"/ip/export"
)
public
void
ipExport
(
@RequestBody
GroupDetailDTO
groupDetailDTO
,
HttpServletResponse
response
)
{
startPage
(
groupDetailDTO
.
getPageNum
(),
groupDetailDTO
.
getPageSize
());
groupDetailService
.
ipExport
(
groupDetailDTO
,
response
);
}
@GetMapping
(
"/ipDetail"
)
public
Result
getDetail
(
@RequestParam
String
ip
)
{
return
Result
.
data
(
groupDetailService
.
queryIpDetail
(
ip
));
...
...
@@ -47,6 +60,13 @@ public class GroupController extends BaseController {
return
getDataTable
(
groupDetailService
.
queryMac
(
groupDetailDTO
));
}
@PostMapping
(
"/mac/export"
)
public
void
macExport
(
@RequestBody
GroupDetailDTO
groupDetailDTO
,
HttpServletResponse
response
)
{
startPage
(
groupDetailDTO
.
getPageNum
(),
groupDetailDTO
.
getPageSize
());
groupDetailService
.
macExport
(
groupDetailDTO
,
response
);
}
@GetMapping
(
"/macDetail"
)
public
Result
macDetail
(
@RequestParam
String
mac
)
{
return
Result
.
data
(
groupDetailService
.
queryMacDetail
(
mac
));
...
...
src/main/java/com/platform/mapper/GroupDetailMapper.java
View file @
13c76afb
...
...
@@ -2,9 +2,9 @@ package com.platform.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
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.model.vo.GroupDetailIpVO
;
import
com.platform.model.vo.GroupDetailMacVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
...
...
@@ -13,9 +13,9 @@ import java.util.List;
public
interface
GroupDetailMapper
extends
BaseMapper
<
GroupDetailEntity
>
{
List
<
GroupDetailVO
>
queryIp
(
GroupDetailDTO
groupDetailDTO
);
List
<
GroupDetail
Ip
VO
>
queryIp
(
GroupDetailDTO
groupDetailDTO
);
List
<
GroupDetailVO
>
queryMac
(
GroupDetailDTO
groupDetailDTO
);
List
<
GroupDetail
Mac
VO
>
queryMac
(
GroupDetailDTO
groupDetailDTO
);
/**
* 根据团体id查看团体明细
...
...
src/main/java/com/platform/model/entity/GroupDetailEntity.java
View file @
13c76afb
package
com.platform.model.entity
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
...
...
@@ -10,6 +11,7 @@ import lombok.Data;
public
class
GroupDetailEntity
{
@TableId
(
value
=
"id"
)
@ExcelProperty
(
value
=
"序号"
)
private
int
id
;
@TableField
(
"case_id"
)
...
...
@@ -18,10 +20,16 @@ public class GroupDetailEntity {
@TableField
(
"group_id"
)
private
int
groupId
;
@ExcelProperty
(
value
=
"账户名称"
)
private
String
userName
;
@ExcelProperty
(
value
=
"交易次数"
)
private
int
transactionCount
;
// 总交易次数
@ExcelProperty
(
value
=
"交易总量"
)
private
double
totalAmount
;
// 总交易金额(转出+转入)
@ExcelProperty
(
value
=
"转出金额"
)
private
double
outgoingAmount
;
// 转出金额
@ExcelProperty
(
value
=
"转入金额"
)
private
double
incomingAmount
;
// 转入金额
private
String
ip
;
...
...
src/main/java/com/platform/model/vo/GroupDetailVO.java
→
src/main/java/com/platform/model/vo/GroupDetail
Ip
VO.java
View file @
13c76afb
package
com.platform.model.vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
lombok.Data
;
@Data
public
class
GroupDetailVO
{
public
class
GroupDetail
Ip
VO
{
@ExcelProperty
(
value
=
"序号"
)
private
int
id
;
@ExcelProperty
(
value
=
"IP地址"
)
private
String
ip
;
@ExcelProperty
(
value
=
"使用次数"
)
private
int
frequency
;
private
String
associatedUsers
;
@ExcelProperty
(
value
=
"关联账户数"
)
private
String
associatedAccounts
;
}
src/main/java/com/platform/model/vo/GroupDetailMacVO.java
0 → 100644
View file @
13c76afb
package
com.platform.model.vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
lombok.Data
;
@Data
public
class
GroupDetailMacVO
{
@ExcelProperty
(
value
=
"序号"
)
private
int
id
;
@ExcelProperty
(
value
=
"Mac地址"
)
private
String
mac
;
@ExcelProperty
(
value
=
"使用次数"
)
private
int
frequency
;
private
String
associatedUsers
;
@ExcelProperty
(
value
=
"关联账户数"
)
private
String
associatedAccounts
;
}
src/main/java/com/platform/service/GroupDetailService.java
View file @
13c76afb
...
...
@@ -4,20 +4,28 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
com.platform.model.dto.GroupDetailDTO
;
import
com.platform.model.entity.GroupDetailEntity
;
import
com.platform.model.vo.GraphVO
;
import
com.platform.model.vo.GroupDetailVO
;
import
com.platform.model.vo.GroupDetailIpVO
;
import
com.platform.model.vo.GroupDetailMacVO
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
public
interface
GroupDetailService
extends
IService
<
GroupDetailEntity
>
{
List
<
GroupDetailEntity
>
queryList
(
GroupDetailDTO
groupDTO
);
List
<
GroupDetailVO
>
queryIp
(
GroupDetailDTO
groupDetailDTO
);
List
<
GroupDetail
Ip
VO
>
queryIp
(
GroupDetailDTO
groupDetailDTO
);
List
<
GroupDetailEntity
>
queryIpDetail
(
String
ip
);
List
<
GroupDetailVO
>
queryMac
(
GroupDetailDTO
groupDetailDTO
);
List
<
GroupDetail
Mac
VO
>
queryMac
(
GroupDetailDTO
groupDetailDTO
);
List
<
GroupDetailEntity
>
queryMacDetail
(
String
mac
);
GraphVO
draw
(
String
groupId
);
void
personExport
(
GroupDetailDTO
groupDetailDTO
,
HttpServletResponse
httpServletResponse
);
void
ipExport
(
GroupDetailDTO
groupDetailDTO
,
HttpServletResponse
response
);
void
macExport
(
GroupDetailDTO
groupDetailDTO
,
HttpServletResponse
response
);
}
src/main/java/com/platform/service/impl/GroupDetailServiceImpl.java
View file @
13c76afb
package
com.platform.service.impl
;
import
cn.hutool.core.collection.CollUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.platform.mapper.GroupDetailMapper
;
...
...
@@ -16,6 +17,10 @@ import com.platform.utils.StringUtils;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.*
;
@Service
...
...
@@ -37,7 +42,7 @@ public class GroupDetailServiceImpl extends ServiceImpl<GroupDetailMapper, Group
}
@Override
public
List
<
GroupDetailVO
>
queryIp
(
GroupDetailDTO
groupDetailDTO
)
{
public
List
<
GroupDetail
Ip
VO
>
queryIp
(
GroupDetailDTO
groupDetailDTO
)
{
return
baseMapper
.
queryIp
(
groupDetailDTO
);
}
...
...
@@ -48,7 +53,7 @@ public class GroupDetailServiceImpl extends ServiceImpl<GroupDetailMapper, Group
}
@Override
public
List
<
GroupDetailVO
>
queryMac
(
GroupDetailDTO
groupDetailDTO
)
{
public
List
<
GroupDetail
Mac
VO
>
queryMac
(
GroupDetailDTO
groupDetailDTO
)
{
return
baseMapper
.
queryMac
(
groupDetailDTO
);
}
...
...
@@ -127,4 +132,76 @@ public class GroupDetailServiceImpl extends ServiceImpl<GroupDetailMapper, Group
return
null
;
}
@Override
public
void
personExport
(
GroupDetailDTO
groupDetailDTO
,
HttpServletResponse
response
)
{
// 设置响应头
response
.
setContentType
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
response
.
setCharacterEncoding
(
"utf-8"
);
String
fileName
;
try
{
fileName
=
URLEncoder
.
encode
(
"团体-人员列表"
,
"UTF-8"
).
replaceAll
(
"\\+"
,
"%20"
);
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
RuntimeException
(
e
);
}
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename*=utf-8''"
+
fileName
+
".xlsx"
);
List
<
GroupDetailEntity
>
groupDetailEntityList
=
queryList
(
groupDetailDTO
);
// 写入Excel
try
{
EasyExcel
.
write
(
response
.
getOutputStream
(),
WhiteVO
.
class
)
.
sheet
(
"团体-人员列表"
)
.
doWrite
(
groupDetailEntityList
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
@Override
public
void
ipExport
(
GroupDetailDTO
groupDetailDTO
,
HttpServletResponse
response
)
{
// 设置响应头
response
.
setContentType
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
response
.
setCharacterEncoding
(
"utf-8"
);
String
fileName
;
try
{
fileName
=
URLEncoder
.
encode
(
"团体-ip列表"
,
"UTF-8"
).
replaceAll
(
"\\+"
,
"%20"
);
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
RuntimeException
(
e
);
}
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename*=utf-8''"
+
fileName
+
".xlsx"
);
List
<
GroupDetailIpVO
>
groupDetailIpVOList
=
baseMapper
.
queryIp
(
groupDetailDTO
);
// 写入Excel
try
{
EasyExcel
.
write
(
response
.
getOutputStream
(),
WhiteVO
.
class
)
.
sheet
(
"团体-IP列表"
)
.
doWrite
(
groupDetailIpVOList
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
@Override
public
void
macExport
(
GroupDetailDTO
groupDetailDTO
,
HttpServletResponse
response
)
{
// 设置响应头
response
.
setContentType
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
response
.
setCharacterEncoding
(
"utf-8"
);
String
fileName
;
try
{
fileName
=
URLEncoder
.
encode
(
"团体-ip列表"
,
"UTF-8"
).
replaceAll
(
"\\+"
,
"%20"
);
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
RuntimeException
(
e
);
}
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename*=utf-8''"
+
fileName
+
".xlsx"
);
List
<
GroupDetailMacVO
>
groupDetailMacVOList
=
baseMapper
.
queryMac
(
groupDetailDTO
);
// 写入Excel
try
{
EasyExcel
.
write
(
response
.
getOutputStream
(),
WhiteVO
.
class
)
.
sheet
(
"团体-IP列表"
)
.
doWrite
(
groupDetailMacVOList
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
src/main/resources/com/platform/mapper/ExcelDataMapper.xml
View file @
13c76afb
...
...
@@ -36,8 +36,8 @@
payee_name payeeName,
SUM(amount) amount,
COUNT(*) AS transactionCount,
ip ip,
ma
c
mac,
max(
ip
)
ip,
ma
x(mac)
mac,
payment_bank_name
from
excel_data
...
...
@@ -50,6 +50,7 @@
<if
test=
"startTime != null and endTime != ''"
>
and time BETWEEN #{startTime} and #{endTime}
</if>
group by pay_user_name,payee_name
</select>
<select
id=
"selectFinancialTransactions"
resultType=
"com.platform.model.vo.AssociationVO"
>
select
...
...
src/main/resources/com/platform/mapper/GroupDetailMapper.xml
View file @
13c76afb
...
...
@@ -3,8 +3,9 @@
<!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
id=
"queryIp"
resultType=
"com.platform.model.vo.GroupDetail
Ip
VO"
>
SELECT
id,
ip,
COUNT(*) AS frequency,
GROUP_CONCAT(DISTINCT user_name ORDER BY user_name SEPARATOR ', ') AS associatedUsers,
...
...
@@ -21,8 +22,9 @@
ip
</select>
<select
id=
"queryMac"
resultType=
"com.platform.model.vo.GroupDetailVO"
>
<select
id=
"queryMac"
resultType=
"com.platform.model.vo.GroupDetail
Mac
VO"
>
SELECT
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