Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_ht
Commits
e3c9eb86
Commit
e3c9eb86
authored
Jan 29, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优惠卷领取记录查询增加是否逻辑删除条件
parent
442446eb
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
21 additions
and
9 deletions
+21
-9
QPServiceImplAspect.java
...ain/java/share/framework/aspectj/QPServiceImplAspect.java
+1
-0
CouponRetryTask.java
...artz/src/main/java/share/quartz/task/CouponRetryTask.java
+2
-0
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+2
-1
QPServiceImpl.java
...rc/main/java/share/system/service/impl/QPServiceImpl.java
+2
-1
SConsumerCouponServiceImpl.java
...share/system/service/impl/SConsumerCouponServiceImpl.java
+1
-0
SCouponServiceImpl.java
...in/java/share/system/service/impl/SCouponServiceImpl.java
+2
-1
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+2
-1
SConsumerCouponMapper.xml
...rc/main/resources/mapper/system/SConsumerCouponMapper.xml
+9
-5
No files found.
share-framework/src/main/java/share/framework/aspectj/QPServiceImplAspect.java
View file @
e3c9eb86
...
...
@@ -161,6 +161,7 @@ public class QPServiceImplAspect {
LambdaQueryWrapper
<
SConsumerCoupon
>
lambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
lambdaQueryWrapper
.
eq
(
SConsumerCoupon:
:
getCouponCode
,
couponCode
);
lambdaQueryWrapper
.
eq
(
SConsumerCoupon:
:
getUseStatus
,
code
);
lambdaQueryWrapper
.
eq
(
SConsumerCoupon:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
());
SConsumerCoupon
one
=
sConsumerCouponService
.
getOne
(
lambdaQueryWrapper
);
if
(
one
==
null
)
{
// 处理查询不到SConsumerCoupon的情况,例如抛出异常或记录日志
...
...
share-quartz/src/main/java/share/quartz/task/CouponRetryTask.java
View file @
e3c9eb86
...
...
@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
share.common.enums.UserStatusEnum
;
import
share.common.enums.YesNoEnum
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.impl.QPServiceImpl
;
...
...
@@ -23,6 +24,7 @@ public class CouponRetryTask {
public
void
AuToRetryCoupon
()
{
LambdaQueryWrapper
<
SConsumerCoupon
>
consumerCouponWrapper
=
new
LambdaQueryWrapper
<>();
consumerCouponWrapper
.
eq
(
SConsumerCoupon:
:
getUseStatus
,
UserStatusEnum
.
UNUSED
.
getCode
());
consumerCouponWrapper
.
eq
(
SConsumerCoupon:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
());
List
<
SConsumerCoupon
>
sConsumerCoupons
=
sConsumerCouponService
.
list
(
consumerCouponWrapper
);
List
<
SConsumerCoupon
>
expiredSConsumerCounpons
=
Optional
.
ofNullable
(
sConsumerCoupons
).
orElse
(
new
ArrayList
<>()).
stream
().
filter
(
item
->
{
if
(
item
.
getEndDate
().
compareTo
(
new
Date
())
<
0
)
{
...
...
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
e3c9eb86
...
...
@@ -99,6 +99,7 @@ public class RedisTask {
//获取所有待使用的优惠卷
LambdaQueryWrapper
<
SConsumerCoupon
>
wrapper
=
Wrappers
.
lambdaQuery
();
wrapper
.
eq
(
SConsumerCoupon:
:
getUseStatus
,
CouponStatusEnum
.
NORMAL
.
getValue
());
wrapper
.
eq
(
SConsumerCoupon:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
());
wrapper
.
isNotNull
(
SConsumerCoupon:
:
getCouponCode
);
List
<
SConsumerCoupon
>
coupons
=
isConsumerCouponService
.
list
(
wrapper
);
List
<
SStore
>
stores
=
storeService
.
list
();
...
...
@@ -128,7 +129,7 @@ public class RedisTask {
// 获取所有待使用的优惠卷
List
<
SConsumerCoupon
>
availableCoupons
=
isConsumerCouponService
.
list
(
new
LambdaQueryWrapper
<
SConsumerCoupon
>().
eq
(
SConsumerCoupon:
:
getUseStatus
,
CouponStatusEnum
.
NORMAL
.
getValue
())
new
LambdaQueryWrapper
<
SConsumerCoupon
>().
eq
(
SConsumerCoupon:
:
getUseStatus
,
CouponStatusEnum
.
NORMAL
.
getValue
())
.
eq
(
SConsumerCoupon:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
())
);
Set
<
Long
>
availableCouponIds
=
availableCoupons
.
stream
().
map
(
SConsumerCoupon:
:
getId
).
collect
(
Collectors
.
toSet
());
...
...
share-system/src/main/java/share/system/service/impl/QPServiceImpl.java
View file @
e3c9eb86
...
...
@@ -107,6 +107,7 @@ public class QPServiceImpl implements QPService {
LambdaQueryWrapper
<
SConsumerCoupon
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
SConsumerCoupon:
:
getCouponCode
,
code
);
queryWrapper
.
eq
(
SConsumerCoupon:
:
getUseStatus
,
UserStatusEnum
.
UNUSED
.
getCode
());
queryWrapper
.
eq
(
SConsumerCoupon:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
());
SConsumerCoupon
unUsedCoupon
=
isConsumerCouponService
.
getOne
(
queryWrapper
);
if
(
ObjectUtils
.
isNotEmpty
(
unUsedCoupon
))
{
throw
new
RuntimeException
(
"该券已被领取"
);
...
...
@@ -129,7 +130,7 @@ public class QPServiceImpl implements QPService {
List
<
TuangouDealQueryShopDealResponseEntity
>
groupActivities
=
queryshopdeal
(
openShopUuid
);
groupActivities
.
forEach
(
o
->
{
//套餐名称相同并且在售卖中
if
(
prepare
.
getDeal
_title
().
equals
(
o
.
getTitle
())
&&
saleStatusEnum
.
SELLING
.
getCode
().
equals
(
o
.
getSale_status
()))
{
if
(
prepare
.
getDeal
group_id
().
equals
(
o
.
getDealgroup_id
())
&&
saleStatusEnum
.
SELLING
.
getCode
().
equals
(
o
.
getSale_status
()))
{
Date
receiptEndDate
=
DateUtil
.
parse
(
o
.
getReceipt_end_date
(),
DatePattern
.
NORM_DATETIME_MINUTE_PATTERN
);
Date
receiptBeginDate
=
DateUtil
.
parse
(
o
.
getReceipt_begin_date
(),
DatePattern
.
NORM_DATETIME_MINUTE_PATTERN
);
sConsumerCoupon
.
setStartDate
(
receiptBeginDate
);
...
...
share-system/src/main/java/share/system/service/impl/SConsumerCouponServiceImpl.java
View file @
e3c9eb86
...
...
@@ -90,6 +90,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
LambdaQueryWrapper
<
SConsumerCoupon
>
queryWrapper
=
new
LambdaQueryWrapper
<
SConsumerCoupon
>();
queryWrapper
.
eq
(
SConsumerCoupon:
:
getConsumerId
,
user
.
getId
());
queryWrapper
.
eq
(
SConsumerCoupon:
:
getUseStatus
,
useStatus
);
queryWrapper
.
eq
(
SConsumerCoupon:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
());
if
(
UserStatusEnum
.
EXPIRED
.
getCode
().
compareTo
(
useStatus
)==
0
){
//已过期查询3个月以内的
queryWrapper
.
gt
(
SConsumerCoupon:
:
getEndDate
,
DateUtils
.
addMonths
(
new
Date
(),-
3
));
...
...
share-system/src/main/java/share/system/service/impl/SCouponServiceImpl.java
View file @
e3c9eb86
...
...
@@ -19,6 +19,7 @@ import share.common.core.page.TableSupport;
import
share.common.enums.CouponTypeEnum
;
import
share.common.enums.RoomType
;
import
share.common.enums.StoreType
;
import
share.common.enums.YesNoEnum
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -225,7 +226,7 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl
List
<
SCouponVo
>
sCouponVoList
=
convertDoListToVoList
(
sCouponList
);
//获取sCouponVoList的id集合
List
<
Long
>
ids
=
sCouponVoList
.
stream
().
map
(
SCoupon:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
SConsumerCoupon
>
sConsumerCoupons
=
sConsumerCouponService
.
list
(
new
LambdaQueryWrapper
<>(
SConsumerCoupon
.
class
).
in
(
SConsumerCoupon:
:
getCouponId
,
ids
));
List
<
SConsumerCoupon
>
sConsumerCoupons
=
sConsumerCouponService
.
list
(
new
LambdaQueryWrapper
<>(
SConsumerCoupon
.
class
).
in
(
SConsumerCoupon:
:
getCouponId
,
ids
)
.
eq
(
SConsumerCoupon:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
())
);
//统计每个couponId的出现次数
Map
<
Long
,
Long
>
collect
=
sConsumerCoupons
.
stream
().
collect
(
Collectors
.
groupingBy
(
SConsumerCoupon:
:
getCouponId
,
Collectors
.
counting
()));
sCouponVoList
.
stream
().
forEach
(
item
->
{
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
e3c9eb86
...
...
@@ -316,7 +316,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SStore
sStore
=
storeService
.
getById
(
request
.
getStoreId
());
SRoom
room
=
roomService
.
getById
(
request
.
getRoomId
());
if
(
ObjectUtil
.
isNotEmpty
(
room
)
&&
room
.
getIsDirtyRoom
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
throw
new
BaseException
(
"
当前房间未保洁,请选择其他房间
"
);
throw
new
BaseException
(
"
未保洁,不能预定!
"
);
}
//生成订单
SOrder
sOrder
=
generatSOrder
(
request
,
user
);
...
...
@@ -329,6 +329,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SConsumerCoupon
byId
=
null
;
if
(
Objects
.
nonNull
(
request
.
getCouponId
())
&&
request
.
getCouponId
()
!=
0
)
{
byId
=
consumerCouponService
.
getById
(
request
.
getCouponId
());
consumerCouponService
.
getOne
(
new
LambdaQueryWrapper
<>());
if
(
Objects
.
nonNull
(
byId
))
{
if
(
byId
.
getUseStatus
().
equals
(
UserStatusEnum
.
UNUSED
.
getCode
()))
{
if
(
StringUtils
.
isNotEmpty
(
byId
.
getCouponCode
()))
{
...
...
share-system/src/main/resources/mapper/system/SConsumerCouponMapper.xml
View file @
e3c9eb86
...
...
@@ -85,7 +85,9 @@
<select
id=
"selectSConsumerCouponList"
parameterType=
"SConsumerCoupon"
resultMap=
"SConsumerCouponResult"
>
<include
refid=
"selectSConsumerCouponVo"
/>
<where>
where
1=1
and is_delete = '0'
<if
test=
"consumerId != null "
>
and consumer_id = #{consumerId}
</if>
<if
test=
"couponId != null "
>
and coupon_id = #{couponId}
</if>
<if
test=
"storeId !=null"
>
and store_id = #{storeId}
</if>
...
...
@@ -109,19 +111,21 @@
<if
test=
"useDate != null "
>
and use_date = #{useDate}
</if>
<if
test=
"useStatus != null and useStatus != '' or useStatus==0"
>
and use_status = #{useStatus}
</if>
<if
test=
"weeks != null and weeks != ''"
>
and weeks = #{weeks}
</if>
<if
test=
"isDelete != null "
>
and is_delete = #{isDelete}
</if>
<if
test=
"deleteBy != null and deleteBy != ''"
>
and delete_by = #{deleteBy}
</if>
<if
test=
"deleteTime != null "
>
and delete_time = #{deleteTime}
</if>
</where>
ORDER BY create_time DESC
</select>
<select
id=
"selectSConsumerCouponById"
parameterType=
"Long"
resultMap=
"SConsumerCouponResult"
>
<include
refid=
"selectSConsumerCouponVo"
/>
where id = #{id}
where id = #{id}
and is_delete = '0'
</select>
<select
id=
"selectSConsumerCouponConut"
resultType=
"java.lang.Integer"
>
select count(1) from s_consumer_coupon where consumer_id = #{consumerId} and use_status = 0
select count(1)
from s_consumer_coupon
where consumer_id = #{consumerId}
and use_status = 0
and is_delete = '0'
</select>
<select
id=
"querySConsumerCouponList"
parameterType=
"SConsumerCoupon"
resultMap=
"SConsumerCouponResult"
>
<include
refid=
"selectSConsumerCouponVo"
/>
...
...
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