Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
usedCarAuction
/
aus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9283e6ae
authored
Apr 10, 2026
by
章家宝
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:【优惠券需求】优惠券发放记录导出
1 parent
bd572eb2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
180 additions
and
64 deletions
aus-admin/src/main/java/com/glsx/usedcar/export/CouponDistributionRecordExportBean.java
aus-admin/src/main/java/com/glsx/usedcar/export/CouponDistributionRecordExportBean.java
View file @
9283e6a
...
@@ -3,18 +3,14 @@ package com.glsx.usedcar.export;
...
@@ -3,18 +3,14 @@ package com.glsx.usedcar.export;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
com.glsx.usedcar.module.coupon.vo.CouponDistributionRecordRespVO
;
import
com.glsx.usedcar.module.coupon.vo.CouponDistributionRecordRespVO
;
import
lombok.AllArgsConstructor
;
import
lombok.*
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
/**
* 优惠券发放记录导出Bean
*/
@Data
@Data
@Builder
@Builder
@NoArgsConstructor
@NoArgsConstructor
...
@@ -28,39 +24,25 @@ public class CouponDistributionRecordExportBean implements Serializable {
...
@@ -28,39 +24,25 @@ public class CouponDistributionRecordExportBean implements Serializable {
private
static
final
DateTimeFormatter
DATE_TIME_FORMATTER
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
private
static
final
DateTimeFormatter
DATE_TIME_FORMATTER
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
/**
/**
*
发放记录ID
*
活动ID / 名称
*/
*/
@ExcelProperty
(
"
发放记录ID
"
)
@ExcelProperty
(
"
活动ID/名称
"
)
@ColumnWidth
(
2
5
)
@ColumnWidth
(
3
5
)
private
String
recordId
;
private
String
activityInfo
;
/**
/**
*
活动
名称
*
优惠券ID /
名称
*/
*/
@ExcelProperty
(
"
活动
名称"
)
@ExcelProperty
(
"
优惠券ID/
名称"
)
@ColumnWidth
(
3
0
)
@ColumnWidth
(
3
5
)
private
String
activityName
;
private
String
couponInfo
;
/**
/**
*
优惠券名称
*
发放用户名 / 手机号
*/
*/
@ExcelProperty
(
"
优惠券名称
"
)
@ExcelProperty
(
"
发放用户名/手机号
"
)
@ColumnWidth
(
30
)
@ColumnWidth
(
30
)
private
String
templateName
;
private
String
userInfo
;
/**
* 用户姓名
*/
@ExcelProperty
(
"用户姓名"
)
@ColumnWidth
(
20
)
private
String
accountName
;
/**
* 用户手机号
*/
@ExcelProperty
(
"用户手机号"
)
@ColumnWidth
(
20
)
private
String
mobile
;
/**
/**
* 发放类型
* 发放类型
...
@@ -70,18 +52,25 @@ public class CouponDistributionRecordExportBean implements Serializable {
...
@@ -70,18 +52,25 @@ public class CouponDistributionRecordExportBean implements Serializable {
private
String
distributionType
;
private
String
distributionType
;
/**
/**
*
券面额
*
优惠券状态
*/
*/
@ExcelProperty
(
"
券面额(元)
"
)
@ExcelProperty
(
"
优惠券状态
"
)
@ColumnWidth
(
15
)
@ColumnWidth
(
15
)
private
String
faceAmount
;
private
String
couponStatus
;
/**
* 关联订单号 / 车型
*/
@ExcelProperty
(
"关联订单号/车型"
)
@ColumnWidth
(
35
)
private
String
orderVehicleInfo
;
/**
/**
*
发放备注
*
成交价 / 抵扣金额
*/
*/
@ExcelProperty
(
"
发放备注
"
)
@ExcelProperty
(
"
成交价/抵扣金额
"
)
@ColumnWidth
(
30
)
@ColumnWidth
(
30
)
private
String
distributionRemark
;
private
String
amountInfo
;
/**
/**
* 发放时间
* 发放时间
...
@@ -91,18 +80,11 @@ public class CouponDistributionRecordExportBean implements Serializable {
...
@@ -91,18 +80,11 @@ public class CouponDistributionRecordExportBean implements Serializable {
private
String
distributionTime
;
private
String
distributionTime
;
/**
/**
* 操作人
* 使用/过期时间
*/
@ExcelProperty
(
"操作人"
)
@ColumnWidth
(
20
)
private
String
operator
;
/**
* 创建时间
*/
*/
@ExcelProperty
(
"
创建
时间"
)
@ExcelProperty
(
"
使用/过期
时间"
)
@ColumnWidth
(
20
)
@ColumnWidth
(
35
)
private
String
creat
eTime
;
private
String
useExpir
eTime
;
/**
/**
* 从VO转换为导出Bean
* 从VO转换为导出Bean
...
@@ -112,31 +94,165 @@ public class CouponDistributionRecordExportBean implements Serializable {
...
@@ -112,31 +94,165 @@ public class CouponDistributionRecordExportBean implements Serializable {
return
;
return
;
}
}
this
.
recordId
=
vo
.
getRecordId
()
!=
null
?
vo
.
getRecordId
()
:
""
;
// 活动ID / 名称
this
.
activityName
=
vo
.
getActivityName
()
!=
null
?
vo
.
getActivityName
()
:
""
;
this
.
activityInfo
=
formatActivityInfo
(
vo
.
getActivityId
(),
vo
.
getActivityName
());
this
.
templateName
=
vo
.
getTemplateName
()
!=
null
?
vo
.
getTemplateName
()
:
""
;
this
.
accountName
=
vo
.
getAccountName
()
!=
null
?
vo
.
getAccountName
()
:
""
;
// 优惠券ID / 名称
this
.
mobile
=
vo
.
getMobile
()
!=
null
?
vo
.
getMobile
()
:
""
;
this
.
couponInfo
=
formatCouponInfo
(
vo
.
getCouponId
(),
vo
.
getTemplateName
());
// 发放用户名 / 手机号
this
.
userInfo
=
formatUserInfo
(
vo
.
getAccountName
(),
vo
.
getMobile
());
// 发放类型转换
// 发放类型转换
this
.
distributionType
=
switch
(
vo
.
getDistributionType
())
{
this
.
distributionType
=
convertDistributionType
(
vo
.
getDistributionType
());
// 优惠券状态转换
this
.
couponStatus
=
convertCouponStatus
(
vo
.
getCouponStatus
());
// 关联订单号 / 车型
this
.
orderVehicleInfo
=
formatOrderVehicleInfo
(
vo
.
getOrderCode
(),
vo
.
getVehicleInfo
());
// 成交价 / 抵扣金额
this
.
amountInfo
=
formatAmountInfo
(
vo
.
getTransactionAmount
(),
vo
.
getActualDeduction
());
// 发放时间
this
.
distributionTime
=
vo
.
getDistributionTime
()
!=
null
?
vo
.
getDistributionTime
().
format
(
DATE_TIME_FORMATTER
)
:
""
;
// 使用/过期时间
this
.
useExpireTime
=
formatUseExpireTime
(
vo
.
getUseTime
(),
vo
.
getExpireTime
());
}
/**
* 格式化活动信息
*/
private
String
formatActivityInfo
(
String
activityId
,
String
activityName
)
{
if
(
activityId
==
null
&&
activityName
==
null
)
{
return
""
;
}
if
(
activityId
==
null
)
{
return
activityName
;
}
if
(
activityName
==
null
)
{
return
activityId
;
}
return
activityId
+
"/"
+
activityName
;
}
/**
* 格式化优惠券信息
*/
private
String
formatCouponInfo
(
String
couponId
,
String
templateName
)
{
if
(
couponId
==
null
&&
templateName
==
null
)
{
return
""
;
}
if
(
couponId
==
null
)
{
return
templateName
;
}
if
(
templateName
==
null
)
{
return
couponId
;
}
return
couponId
+
"/"
+
templateName
;
}
/**
* 格式化用户信息
*/
private
String
formatUserInfo
(
String
accountName
,
String
mobile
)
{
if
(
accountName
==
null
&&
mobile
==
null
)
{
return
""
;
}
if
(
accountName
==
null
)
{
return
mobile
;
}
if
(
mobile
==
null
)
{
return
accountName
;
}
return
accountName
+
"/"
+
mobile
;
}
/**
* 转换发放类型
*/
private
String
convertDistributionType
(
Integer
distributionType
)
{
if
(
distributionType
==
null
)
{
return
""
;
}
return
switch
(
distributionType
)
{
case
1
->
"自动触发"
;
case
1
->
"自动触发"
;
case
2
->
"手动发放"
;
case
2
->
"手动发放"
;
case
3
->
"直接发放活动"
;
case
3
->
"直接发放活动"
;
default
->
"未知类型"
;
default
->
"未知类型"
;
};
};
}
// 券面额格式化
/**
this
.
faceAmount
=
vo
.
getFaceAmount
()
!=
null
?
vo
.
getFaceAmount
().
toString
()
:
"0.00"
;
* 转换优惠券状态
*/
private
String
convertCouponStatus
(
Integer
couponStatus
)
{
if
(
couponStatus
==
null
)
{
return
""
;
}
return
switch
(
couponStatus
)
{
case
1
->
"待使用"
;
case
2
->
"已核销"
;
case
3
->
"已失效"
;
case
4
->
"已退回"
;
default
->
"未知状态"
;
};
}
this
.
distributionRemark
=
vo
.
getDistributionRemark
()
!=
null
?
vo
.
getDistributionRemark
()
:
""
;
/**
* 格式化订单/车辆信息
*/
private
String
formatOrderVehicleInfo
(
String
orderCode
,
String
vehicleInfo
)
{
if
(
orderCode
==
null
&&
vehicleInfo
==
null
)
{
return
""
;
}
if
(
orderCode
==
null
)
{
return
vehicleInfo
;
}
if
(
vehicleInfo
==
null
)
{
return
orderCode
;
}
return
orderCode
+
"/"
+
vehicleInfo
;
}
// 时间格式化
/**
this
.
distributionTime
=
vo
.
getDistributionTime
()
!=
null
* 格式化金额信息
?
vo
.
getDistributionTime
().
format
(
DATE_TIME_FORMATTER
)
:
""
;
*/
this
.
createTime
=
vo
.
getCreateTime
()
!=
null
private
String
formatAmountInfo
(
BigDecimal
transactionAmount
,
BigDecimal
actualDeduction
)
{
?
vo
.
getCreateTime
().
format
(
DATE_TIME_FORMATTER
)
:
""
;
if
(
transactionAmount
==
null
&&
actualDeduction
==
null
)
{
return
""
;
}
String
transactionStr
=
transactionAmount
!=
null
?
transactionAmount
.
toString
()
:
""
;
String
deductionStr
=
actualDeduction
!=
null
?
actualDeduction
.
toString
()
:
""
;
if
(
transactionAmount
==
null
)
{
return
deductionStr
;
}
if
(
actualDeduction
==
null
)
{
return
transactionStr
;
}
return
transactionStr
+
"/"
+
deductionStr
;
}
this
.
operator
=
vo
.
getOperator
()
!=
null
?
vo
.
getOperator
()
:
""
;
/**
* 格式化使用/过期时间
*/
private
String
formatUseExpireTime
(
LocalDateTime
useTime
,
LocalDateTime
expireTime
)
{
if
(
useTime
==
null
&&
expireTime
==
null
)
{
return
""
;
}
String
useTimeStr
=
useTime
!=
null
?
useTime
.
format
(
DATE_TIME_FORMATTER
)
:
""
;
String
expireTimeStr
=
expireTime
!=
null
?
expireTime
.
format
(
DATE_TIME_FORMATTER
)
:
""
;
if
(
useTime
==
null
)
{
return
expireTimeStr
;
}
if
(
expireTime
==
null
)
{
return
useTimeStr
;
}
return
useTimeStr
+
"/"
+
expireTimeStr
;
}
}
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment