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 376e18e8
authored
Apr 16, 2026
by
章家宝
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:【优惠券需求】优惠券联调改bug
1 parent
66296943
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
33 deletions
aus-core/src/main/java/com/glsx/usedcar/module/coupon/dao/CouponActivityRepository.java
aus-core/src/main/java/com/glsx/usedcar/module/coupon/dao/CouponDistributionRecordRepository.java
aus-core/src/main/java/com/glsx/usedcar/module/coupon/service/CouponActivityService.java
aus-core/src/main/java/com/glsx/usedcar/module/coupon/vo/CouponActivityAddVO.java
aus-core/src/main/java/com/glsx/usedcar/module/coupon/vo/CouponActivityUpdateVO.java
aus-core/src/main/java/com/glsx/usedcar/module/coupon/dao/CouponActivityRepository.java
View file @
376e18e
...
...
@@ -179,8 +179,8 @@ public interface CouponActivityRepository extends BaseRepository<CouponActivity,
AND (:searchKey IS NULL OR ca.activity_name LIKE CONCAT('%', :searchKey, '%') OR ca.activity_id LIKE CONCAT('%', :searchKey, '%'))
AND (:status IS NULL OR ca.status = :status)
AND (:activityType IS NULL OR ca.activity_type = :activityType)
AND (:
validStartTime IS NULL OR ca.valid_start_time >= :validS
tartTime)
AND (:
validEndTime IS NULL OR ca.valid_end_time <= :validE
ndTime)
AND (:
startTime IS NULL OR ca.create_time >= :s
tartTime)
AND (:
endTime IS NULL OR ca.create_time <= :e
ndTime)
GROUP BY ca.id, ca.activity_id, ca.activity_name, ca.valid_start_time, ca.valid_end_time,
ca.activity_type, ca.target_type, ca.distribution_quantity, ca.status,
ca.create_time, ca.send_notification, ca.remark, ca.update_time, ca.template_id
...
...
@@ -207,18 +207,18 @@ public interface CouponActivityRepository extends BaseRepository<CouponActivity,
AND (:searchKey IS NULL OR ca.activity_name LIKE CONCAT('%', :searchKey, '%') OR ca.activity_id LIKE CONCAT('%', :searchKey, '%'))
AND (:status IS NULL OR ca.status = :status)
AND (:activityType IS NULL OR ca.activity_type = :activityType)
AND (:
validStartTime IS NULL OR ca.valid_start_time >= :validS
tartTime)
AND (:
validEndTime IS NULL OR ca.valid_end_time <= :validE
ndTime)
AND (:
startTime IS NULL OR ca.create_time >= :s
tartTime)
AND (:
endTime IS NULL OR ca.create_time <= :e
ndTime)
"""
,
nativeQuery
=
true
)
Page
<
CouponActivityStatDTO
>
pageActivityStat
(
@Param
(
"searchKey"
)
String
searchKey
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"activityType"
)
Integer
activityType
,
@Param
(
"
validStartTime"
)
LocalDateTime
validS
tartTime
,
@Param
(
"
validEndTime"
)
LocalDateTime
validE
ndTime
,
@Param
(
"sortField"
)
String
sortField
,
@Param
(
"sortOrder"
)
String
sortOrder
,
@Param
(
"searchKey"
)
String
searchKey
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"activityType"
)
Integer
activityType
,
@Param
(
"
startTime"
)
LocalDateTime
s
tartTime
,
@Param
(
"
endTime"
)
LocalDateTime
e
ndTime
,
@Param
(
"sortField"
)
String
sortField
,
@Param
(
"sortOrder"
)
String
sortOrder
,
Pageable
pageable
);
...
...
aus-core/src/main/java/com/glsx/usedcar/module/coupon/dao/CouponDistributionRecordRepository.java
View file @
376e18e
...
...
@@ -150,8 +150,8 @@ public interface CouponDistributionRecordRepository extends BaseRepository<Coupo
AND (:couponStatus IS NULL OR c.status IN :couponStatus)
AND (:distributionType IS NULL OR r.distributionType = :distributionType)
AND (:orderCode IS NULL OR :orderCode = '' OR v.orderCode = :orderCode)
AND (:startTime IS NULL OR r.
create
Time >= :startTime)
AND (:endTime IS NULL OR r.
create
Time <= :endTime)
AND (:startTime IS NULL OR r.
distribution
Time >= :startTime)
AND (:endTime IS NULL OR r.
distribution
Time <= :endTime)
"""
)
Page
<
CouponDistributionRecordDTO
>
findDistributionRecords
(
@Param
(
"keyword"
)
String
keyword
,
...
...
aus-core/src/main/java/com/glsx/usedcar/module/coupon/service/CouponActivityService.java
View file @
376e18e
...
...
@@ -25,7 +25,9 @@ import org.summerframework.core.exception.BusinessCodeException;
import
org.summerframework.orm.paging.Pagination
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.time.*
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeParseException
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -309,11 +311,27 @@ public class CouponActivityService {
public
Page
<
CouponActivityRespVO
>
pageList
(
Pagination
<
CouponActivity
>
pagination
)
{
// 1. 提取查询条件
String
searchKey
=
(
String
)
pagination
.
getDataValue
(
"keyword"
);
Integer
status
=
(
Integer
)
pagination
.
getDataValue
(
"status"
);
Integer
activityType
=
(
Integer
)
pagination
.
getDataValue
(
"activityType"
);
LocalDateTime
validStartTime
=
(
LocalDateTime
)
pagination
.
getDataValue
(
"validStartTime"
);
LocalDateTime
validEndTime
=
(
LocalDateTime
)
pagination
.
getDataValue
(
"validEndTime"
);
String
searchKey
=
(
String
)
pagination
.
getFilterValueOrElseNull
(
"keyword"
);
Integer
status
=
(
Integer
)
pagination
.
getFilterValueOrElseNull
(
"status"
);
Integer
activityType
=
(
Integer
)
pagination
.
getFilterValueOrElseNull
(
"activityType"
);
List
<
String
>
timeRange
=
(
List
<
String
>)
pagination
.
getFilterValueOrElseNull
(
"createTime"
);
LocalDateTime
startTime
=
null
;
LocalDateTime
endTime
=
null
;
if
(
timeRange
!=
null
&&
timeRange
.
size
()
>
0
)
{
if
(
timeRange
.
size
()
==
2
)
{
DateTimeFormatter
dateFormatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
try
{
LocalDate
startDate
=
LocalDate
.
parse
(
timeRange
.
get
(
0
),
dateFormatter
);
startTime
=
startDate
.
atStartOfDay
();
LocalDate
endDate
=
LocalDate
.
parse
(
timeRange
.
get
(
1
),
dateFormatter
);
endTime
=
endDate
.
atTime
(
LocalTime
.
MAX
);
}
catch
(
DateTimeParseException
e
)
{
log
.
info
(
"日期格式解析失败!必须为 yyyy-MM-dd 格式:"
+
timeRange
);
}
}
else
{
log
.
info
(
"时间数组格式错误!必须包含2个元素:"
+
timeRange
);
}
}
// 2. 排序参数
String
sortField
=
pagination
.
getSort
()
==
null
?
"createTime"
:
pagination
.
getSort
();
...
...
@@ -321,7 +339,7 @@ public class CouponActivityService {
// 3. 执行查询
Page
<
CouponActivityStatDTO
>
dtoPage
=
couponActivityRepository
.
pageActivityStat
(
searchKey
,
status
,
activityType
,
validStartTime
,
validE
ndTime
,
searchKey
,
status
,
activityType
,
startTime
,
e
ndTime
,
sortField
,
sortOrder
,
pagination
.
getPageRequest
()
);
...
...
@@ -469,14 +487,29 @@ public class CouponActivityService {
*/
public
Page
<
CouponDistributionRecordRespVO
>
distributionRecordPage
(
Pagination
<
CouponDistributionRecord
>
pagination
)
{
// 1. 提取查询条件
String
keyword
=
(
String
)
pagination
.
getDataValue
(
"keyword"
);
String
userInfo
=
(
String
)
pagination
.
getDataValue
(
"userInfo"
);
List
<
Integer
>
couponStatus
=
(
List
<
Integer
>)
pagination
.
getDataValue
(
"couponStatus"
);
Integer
distributionType
=
(
Integer
)
pagination
.
getDataValue
(
"distributionType"
);
String
orderCode
=
(
String
)
pagination
.
getDataValue
(
"orderCode"
);
LocalDateTime
startTime
=
(
LocalDateTime
)
pagination
.
getDataValue
(
"startTime"
);
LocalDateTime
endTime
=
(
LocalDateTime
)
pagination
.
getDataValue
(
"endTime"
);
String
keyword
=
(
String
)
pagination
.
getFilterValueOrElseNull
(
"keyword"
);
String
userInfo
=
(
String
)
pagination
.
getFilterValueOrElseNull
(
"userInfo"
);
List
<
Integer
>
couponStatus
=
(
List
<
Integer
>)
pagination
.
getFilterValueOrElseNull
(
"couponStatus"
);
Integer
distributionType
=
(
Integer
)
pagination
.
getFilterValueOrElseNull
(
"distributionType"
);
String
orderCode
=
(
String
)
pagination
.
getFilterValueOrElseNull
(
"orderCode"
);
List
<
String
>
timeRange
=
(
List
<
String
>)
pagination
.
getFilterValueOrElseNull
(
"distributionTime"
);
LocalDateTime
startTime
=
null
;
LocalDateTime
endTime
=
null
;
if
(
timeRange
!=
null
&&
timeRange
.
size
()
>
0
)
{
if
(
timeRange
.
size
()
==
2
)
{
DateTimeFormatter
dateFormatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
try
{
LocalDate
startDate
=
LocalDate
.
parse
(
timeRange
.
get
(
0
),
dateFormatter
);
startTime
=
startDate
.
atStartOfDay
();
LocalDate
endDate
=
LocalDate
.
parse
(
timeRange
.
get
(
1
),
dateFormatter
);
endTime
=
endDate
.
atTime
(
LocalTime
.
MAX
);
}
catch
(
DateTimeParseException
e
)
{
log
.
info
(
"日期格式解析失败!必须为 yyyy-MM-dd 格式:"
+
timeRange
);
}
}
else
{
log
.
info
(
"时间数组格式错误!必须包含2个元素:"
+
timeRange
);
}
}
// 2. 执行查询
Page
<
CouponDistributionRecordDTO
>
dtoPage
=
distributionRecordRepository
.
findDistributionRecords
(
keyword
,
...
...
aus-core/src/main/java/com/glsx/usedcar/module/coupon/vo/CouponActivityAddVO.java
View file @
376e18e
...
...
@@ -6,7 +6,6 @@ import lombok.Data;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.util.List
;
...
...
@@ -37,8 +36,7 @@ public class CouponActivityAddVO implements Serializable {
@NotNull
(
message
=
"活动结束时间不能为空"
)
private
LocalDateTime
validEndTime
;
@Schema
(
description
=
"关联优惠券模板 ID"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"1"
)
@NotNull
(
message
=
"优惠券模板 ID 不能为空"
)
@Schema
(
description
=
"关联优惠券模板 ID"
,
example
=
"1"
)
private
Long
templateId
;
@Schema
(
description
=
"发放数量(张/人,直接发放类型使用)"
,
requiredMode
=
Schema
.
RequiredMode
.
NOT_REQUIRED
,
example
=
"1"
)
...
...
aus-core/src/main/java/com/glsx/usedcar/module/coupon/vo/CouponActivityUpdateVO.java
View file @
376e18e
...
...
@@ -40,8 +40,7 @@ public class CouponActivityUpdateVO implements Serializable {
@NotNull
(
message
=
"活动结束时间不能为空"
)
private
LocalDateTime
validEndTime
;
@Schema
(
description
=
"关联优惠券模板 ID"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"1"
)
@NotNull
(
message
=
"优惠券模板 ID 不能为空"
)
@Schema
(
description
=
"关联优惠券模板 ID"
,
example
=
"1"
)
private
Long
templateId
;
@Schema
(
description
=
"发放数量(张/人,直接发放类型使用)"
,
requiredMode
=
Schema
.
RequiredMode
.
NOT_REQUIRED
,
example
=
"1"
)
...
...
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