记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
董敬伟
liquidnet-bus-v1
Commits
5534807d
Commit
5534807d
authored
Sep 03, 2021
by
张国柄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
会员权益详情+券适用规则;
parent
51328063
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
130 additions
and
12 deletions
+130
-12
AdamMemberRightsCouponRuleVo.java
...net/service/adam/dto/vo/AdamMemberRightsCouponRuleVo.java
+29
-0
AdamMemberRightsCouponVo.java
...quidnet/service/adam/dto/vo/AdamMemberRightsCouponVo.java
+4
-0
CandyMgtCouponAdminServiceImpl.java
...ai/candy/service/impl/CandyMgtCouponAdminServiceImpl.java
+12
-0
CandyCouponDueTaskController.java
...m/controller/candy/task/CandyCouponDueTaskController.java
+82
-10
PlatformCandyCouponService.java
...atform/service/impl/candy/PlatformCandyCouponService.java
+3
-2
No files found.
liquidnet-bus-api/liquidnet-service-adam-api/src/main/java/com/liquidnet/service/adam/dto/vo/AdamMemberRightsCouponRuleVo.java
0 → 100644
View file @
5534807d
package
com
.
liquidnet
.
service
.
adam
.
dto
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
@ApiModel
(
value
=
"AdamMemberRightsCouponRuleVo"
,
description
=
"会员权益券适用规则"
)
@Data
public
class
AdamMemberRightsCouponRuleVo
implements
Serializable
,
Cloneable
{
private
static
final
long
serialVersionUID
=
4282440130223655255L
;
@ApiModelProperty
(
value
=
"适用范围[100-全场|90-演出|91-场次|92-票|80-商品|81-款式]"
,
example
=
"90"
)
private
Integer
useScope
;
@ApiModelProperty
(
value
=
"适用名称"
,
example
=
"北京草莓"
)
private
String
busiName
;
@ApiModelProperty
(
value
=
"适用ID"
,
example
=
"1"
)
private
String
busiId
;
private
static
final
AdamMemberRightsCouponRuleVo
obj
=
new
AdamMemberRightsCouponRuleVo
();
public
static
AdamMemberRightsCouponRuleVo
getNew
()
{
try
{
return
(
AdamMemberRightsCouponRuleVo
)
obj
.
clone
();
}
catch
(
CloneNotSupportedException
e
)
{
return
new
AdamMemberRightsCouponRuleVo
();
}
}
}
liquidnet-bus-api/liquidnet-service-adam-api/src/main/java/com/liquidnet/service/adam/dto/vo/AdamMemberRightsCouponVo.java
View file @
5534807d
...
...
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.List
;
@ApiModel
(
value
=
"AdamMemberRightsCouponVo"
,
description
=
"会员专享特权券"
)
@Data
...
...
@@ -31,6 +32,9 @@ public class AdamMemberRightsCouponVo implements java.io.Serializable, Cloneable
@ApiModelProperty
(
position
=
10
,
value
=
"满减~减"
)
private
BigDecimal
valMinus
;
/* com.liquidnet.service.adam.dto.vo.AdamMemberRightsCouponRuleVo */
private
List
<
AdamMemberRightsCouponRuleVo
>
useRules
;
private
static
final
AdamMemberRightsCouponVo
obj
=
new
AdamMemberRightsCouponVo
();
public
static
AdamMemberRightsCouponVo
getNew
()
{
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/candy/service/impl/CandyMgtCouponAdminServiceImpl.java
View file @
5534807d
...
...
@@ -8,6 +8,7 @@ import com.liquidnet.client.admin.zhengzai.candy.service.ICandyMgtCouponAdminSer
import
com.liquidnet.common.cache.redis.util.RedisUtil
;
import
com.liquidnet.common.exception.LiquidnetServiceException
;
import
com.liquidnet.service.adam.constant.AdamRedisConst
;
import
com.liquidnet.service.adam.dto.vo.AdamMemberRightsCouponRuleVo
;
import
com.liquidnet.service.adam.dto.vo.AdamMemberRightsCouponVo
;
import
com.liquidnet.service.candy.dto.admin.CandyMgtCouponInfoDto
;
import
com.liquidnet.service.candy.dto.admin.CandyMgtCouponListParam
;
...
...
@@ -56,6 +57,16 @@ public class CandyMgtCouponAdminServiceImpl extends ServiceImpl<CandyMgtCouponMa
case
0
:
break
;
case
1
:
List
<
AdamMemberRightsCouponRuleVo
>
memberRightsCouponRuleVoList
=
new
ArrayList
<>();
initCouponRuleList
.
forEach
(
r
->
{
AdamMemberRightsCouponRuleVo
memberRightsCouponRuleVo
=
AdamMemberRightsCouponRuleVo
.
getNew
();
memberRightsCouponRuleVo
.
setBusiId
(
r
.
getBusiId
());
memberRightsCouponRuleVo
.
setBusiName
(
r
.
getBusiName
());
memberRightsCouponRuleVo
.
setUseScope
(
r
.
getUseScope
());
memberRightsCouponRuleVoList
.
add
(
memberRightsCouponRuleVo
);
});
// 同步REDIS:用户端:购买会员详情页:权益列表:权益详情:专享券信息
List
<
AdamMemberRightsCouponVo
>
memberRightsCouponVoList
=
(
List
<
AdamMemberRightsCouponVo
>)
redisUtil
.
get
(
AdamRedisConst
.
INFO_MEMBER_RIGHTS_COUPON
.
concat
(
initMgtCoupon
.
getMcouponId
()));
...
...
@@ -75,6 +86,7 @@ public class CandyMgtCouponAdminServiceImpl extends ServiceImpl<CandyMgtCouponMa
memberRightsCouponVo
.
setValFace
(
initCoupon
.
getValFace
());
memberRightsCouponVo
.
setValOver
(
initCoupon
.
getValOver
());
memberRightsCouponVo
.
setValMinus
(
initCoupon
.
getValMinus
());
memberRightsCouponVo
.
setUseRules
(
memberRightsCouponRuleVoList
);
memberRightsCouponVoList
.
add
(
memberRightsCouponVo
);
}
...
...
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/controller/candy/task/CandyCouponDueTaskController.java
View file @
5534807d
...
...
@@ -7,12 +7,16 @@ import com.liquidnet.common.exception.LiquidnetServiceException;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.candy.constant.CandyRedisConst
;
import
com.liquidnet.service.candy.dto.CandyCommonCouponBasicDto
;
import
com.liquidnet.service.candy.dto.CandyCouponCodeDto
;
import
com.liquidnet.service.candy.entity.CandyCommonCoupon
;
import
com.liquidnet.service.candy.entity.CandyCoupon
;
import
com.liquidnet.service.candy.entity.CandyCouponCode
;
import
com.liquidnet.service.candy.entity.CandyUserCoupon
;
import
com.liquidnet.service.platform.service.impl.candy.PlatformCandyCommonCouponService
;
import
com.liquidnet.service.platform.service.impl.candy.PlatformCandyCouponCodeService
;
import
com.liquidnet.service.platform.service.impl.candy.PlatformCandyCouponService
;
import
com.liquidnet.service.platform.service.impl.candy.PlatformCandyUserCouponService
;
import
com.liquidnet.service.platform.utils.ObjectUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -24,6 +28,7 @@ import java.time.LocalDateTime;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -48,9 +53,11 @@ public class CandyCouponDueTaskController {
@Autowired
private
PlatformCandyCouponService
platformCandyCouponService
;
@Autowired
private
PlatformCandyCouponCodeService
platformCandyCouponCodeService
;
@Autowired
private
PlatformCandyCommonCouponService
platformCandyCommonCouponService
;
@Autowired
private
PlatformCandy
CouponCodeService
platformCandyCouponCode
Service
;
private
PlatformCandy
UserCouponService
platformCandyUserCoupon
Service
;
/**
* <p>
...
...
@@ -65,9 +72,60 @@ public class CandyCouponDueTaskController {
public
ResponseDto
<
String
>
processForRedeem
()
{
LocalDateTime
now
=
LocalDateTime
.
now
();
// 查取状态可用的到期兑换码
LambdaQueryWrapper
<
CandyCouponCode
>
couponCodeQueryWrapper
=
Wrappers
.
lambdaQuery
(
CandyCouponCode
.
class
);
couponCodeQueryWrapper
.
eq
(
CandyCouponCode:
:
getState
,
1
);
couponCodeQueryWrapper
.
le
(
CandyCouponCode:
:
getRedeemStop
,
now
);
int
totalCount
=
platformCandyCouponCodeService
.
count
(
couponCodeQueryWrapper
);
AtomicInteger
pl
=
new
AtomicInteger
();
int
remainCount
=
totalCount
;
int
num
=
0
,
pSize
=
1000
;
log
.
info
(
"券到期检查处理:兑换码[到期总记录数:{}] >>> BEGIN BEGIN BEGIN"
,
totalCount
);
ArrayList
<
CandyCouponCode
>
updateCouponCodeList
=
ObjectUtil
.
getCandyCouponCodeArrayList
();
couponCodeQueryWrapper
.
select
(
CandyCouponCode:
:
getMid
,
CandyCouponCode:
:
getCcode
);
couponCodeQueryWrapper
.
orderByAsc
(
CandyCouponCode:
:
getMid
);
while
(
remainCount
>
0
)
{
updateCouponCodeList
.
clear
();
LambdaQueryWrapper
<
CandyCouponCode
>
couponCodeLambdaQueryWrapper
=
couponCodeQueryWrapper
.
clone
();
String
lastLimitSql
=
"LIMIT "
+
(
num
*
pSize
)
+
","
+
pSize
;
couponCodeLambdaQueryWrapper
.
last
(
lastLimitSql
);
List
<
CandyCouponCode
>
couponCodeList
=
platformCandyCouponCodeService
.
list
(
couponCodeLambdaQueryWrapper
);
int
listSize
=
CollectionUtils
.
isEmpty
(
couponCodeList
)
?
-
1
:
couponCodeList
.
size
();
for
(
int
i
=
0
;
i
<
listSize
;
i
++)
{
CandyCouponCode
couponCode
=
couponCodeList
.
get
(
i
);
couponCode
.
setState
(
3
);
couponCode
.
setUpdatedAt
(
now
);
updateCouponCodeList
.
add
(
couponCode
);
}
if
(!
CollectionUtils
.
isEmpty
(
couponCodeList
))
{
if
(
platformCandyCouponCodeService
.
updateBatchById
(
updateCouponCodeList
,
updateCouponCodeList
.
size
()))
{
updateCouponCodeList
.
forEach
(
r
->
{
String
ccKey
=
CandyRedisConst
.
BASIC_COUPON_CODE
.
concat
(
r
.
getCcode
());
CandyCouponCodeDto
dto
=
(
CandyCouponCodeDto
)
redisUtil
.
get
(
ccKey
);
if
(
null
!=
dto
)
{
dto
.
setState
(
3
);
redisUtil
.
set
(
ccKey
,
dto
);
}
pl
.
getAndIncrement
();
});
}
else
{
throw
new
LiquidnetServiceException
(
"-1"
,
"券码到期处理失败"
);
}
}
num
++;
remainCount
-=
pSize
;
log
.
info
(
"券到期检查处理中:兑换码[到期总记录数:{},单次处理:{},剩余处理数:{}]"
,
totalCount
,
lastLimitSql
,
remainCount
);
}
log
.
info
(
"券到期检查处理:兑换码[到期总记录数:{},处理总数:{}] >>> END END END"
,
totalCount
,
pl
.
get
());
return
ResponseDto
.
success
();
}
...
...
@@ -89,7 +147,7 @@ public class CandyCouponDueTaskController {
commonCouponQueryWrapper
.
eq
(
CandyCommonCoupon:
:
getState
,
1
);
commonCouponQueryWrapper
.
select
(
CandyCommonCoupon:
:
getMid
,
CandyCommonCoupon:
:
getCcouponId
,
CandyCommonCoupon:
:
getCouponId
);
List
<
CandyCommonCoupon
>
commonCouponList
=
platformCandyCommonCouponService
.
list
(
commonCouponQueryWrapper
);
log
.
info
(
"券到期检查:公有券[可用券总数:{}] >>> BEGIN BEGIN BEGIN"
,
commonCouponList
.
size
());
log
.
info
(
"券到期检查
处理
:公有券[可用券总数:{}] >>> BEGIN BEGIN BEGIN"
,
commonCouponList
.
size
());
if
(!
CollectionUtils
.
isEmpty
(
commonCouponList
))
{
List
<
CandyCommonCoupon
>
updateCommonCouponList
=
new
ArrayList
<>();
...
...
@@ -98,22 +156,23 @@ public class CandyCouponDueTaskController {
Object
[]
commonCouponIdArr
=
commonCouponList
.
stream
().
map
(
CandyCommonCoupon:
:
getCouponId
).
toArray
();
Map
<
String
,
List
<
CandyCommonCoupon
>>
commonCouponIdToListMap
=
commonCouponList
.
stream
().
collect
(
Collectors
.
groupingBy
(
CandyCommonCoupon:
:
getCouponId
));
// 查取状态可用的公有券 - 对应的
过
期券列表
// 查取状态可用的公有券 - 对应的
到
期券列表
LambdaQueryWrapper
<
CandyCoupon
>
couponQueryWrapper
=
Wrappers
.
lambdaQuery
(
CandyCoupon
.
class
);
couponQueryWrapper
.
in
(
CandyCoupon:
:
getCouponId
,
commonCouponIdArr
);
couponQueryWrapper
.
le
(
CandyCoupon:
:
getExpireAt
,
now
);
int
totalCount
=
platformCandyCouponService
.
count
(
couponQueryWrapper
),
remainCount
=
totalCount
,
num
=
0
,
pSize
=
1000
;
log
.
info
(
"券到期检查:公有券[可用券总数:{},其中到期券ID数:{}]"
,
commonCouponList
.
size
(),
totalCount
);
log
.
info
(
"券到期检查
处理
:公有券[可用券总数:{},其中到期券ID数:{}]"
,
commonCouponList
.
size
(),
totalCount
);
couponQueryWrapper
.
select
(
CandyCoupon:
:
getMid
,
CandyCoupon:
:
getCouponId
);
couponQueryWrapper
.
orderByAsc
(
CandyCoupon:
:
getMid
);
while
(
remainCount
>
0
)
{
LambdaQueryWrapper
<
CandyCoupon
>
couponLambdaQueryWrapper
=
couponQueryWrapper
.
clone
();
String
lastLimitSql
=
"LIMIT "
+
(
num
*
pSize
)
+
","
+
pSize
;
couponQueryWrapper
.
last
(
lastLimitSql
);
couponQueryWrapper
.
select
(
CandyCoupon:
:
getMid
,
CandyCoupon:
:
getCouponId
);
List
<
CandyCoupon
>
couponList
=
platformCandyCouponService
.
list
(
couponQueryWrapper
);
couponLambdaQueryWrapper
.
last
(
lastLimitSql
);
List
<
CandyCoupon
>
couponList
=
platformCandyCouponService
.
list
(
couponLambdaQueryWrapper
);
int
couponL
istSize
=
CollectionUtils
.
isEmpty
(
couponList
)
?
-
1
:
couponList
.
size
();
for
(
int
i
=
0
;
i
<
couponL
istSize
;
i
++)
{
int
l
istSize
=
CollectionUtils
.
isEmpty
(
couponList
)
?
-
1
:
couponList
.
size
();
for
(
int
i
=
0
;
i
<
l
istSize
;
i
++)
{
CandyCoupon
coupon
=
couponList
.
get
(
i
);
List
<
CandyCommonCoupon
>
inCommonCouponList
=
commonCouponIdToListMap
.
get
(
coupon
.
getCouponId
());
...
...
@@ -151,7 +210,7 @@ public class CandyCouponDueTaskController {
throw
new
LiquidnetServiceException
(
"-1"
,
String
.
format
(
"券到期处理失败[updateCommonCouponList.size=%s]"
,
updateCommonCouponList
.
size
()));
}
}
log
.
info
(
"券到期检查:公有券[可用券总数:{},到期券ID数:{},到期券处理数:{}] >>> END END END"
,
commonCouponList
.
size
(),
totalCount
,
updateCommonCouponList
.
size
());
log
.
info
(
"券到期检查
处理
:公有券[可用券总数:{},到期券ID数:{},到期券处理数:{}] >>> END END END"
,
commonCouponList
.
size
(),
totalCount
,
updateCommonCouponList
.
size
());
}
return
ResponseDto
.
success
();
}
...
...
@@ -168,6 +227,19 @@ public class CandyCouponDueTaskController {
@PutMapping
(
"user"
)
public
ResponseDto
<
String
>
processForUser
()
{
LocalDateTime
now
=
LocalDateTime
.
now
();
// 查取状态可用的到期券
LambdaQueryWrapper
<
CandyUserCoupon
>
userCouponQueryWrapper
=
Wrappers
.
lambdaQuery
(
CandyUserCoupon
.
class
);
userCouponQueryWrapper
.
eq
(
CandyUserCoupon:
:
getState
,
1
);
userCouponQueryWrapper
.
le
(
CandyUserCoupon:
:
getDuedAt
,
now
);
int
totalCount
=
platformCandyUserCouponService
.
count
(
userCouponQueryWrapper
);
AtomicInteger
pl
=
new
AtomicInteger
();
int
remainCount
=
totalCount
;
int
num
=
0
,
pSize
=
1000
;
log
.
info
(
"券到期检查处理:私有券[到期总记录数:{}] >>> BEGIN BEGIN BEGIN"
,
totalCount
);
ArrayList
<
CandyUserCoupon
>
candyUserCouponArrayList
=
ObjectUtil
.
getCandyUserCouponArrayList
();
return
ResponseDto
.
success
();
}
}
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/impl/candy/PlatformCandyCouponService.java
View file @
5534807d
...
...
@@ -183,12 +183,13 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
int
totalCount
=
userMemberCount
,
eventAmt
=
mgtCoupon
.
getEventAmt
();
log
.
info
(
"发放券处理中:目标全体会员[总数:{},发放量:{}]"
,
userMemberCount
,
eventAmt
);
queryWrapper
.
select
(
AdamUserMember:
:
getUid
).
orderByAsc
(
AdamUserMember:
:
getMid
);
while
(
totalCount
>
0
)
{
initUserCouponList
.
clear
();
LambdaQueryWrapper
<
AdamUserMember
>
userMemberLambdaQueryWrapper
=
queryWrapper
.
clone
();
String
lastLimitSql
=
"LIMIT "
+
(
num
*
pSize
)
+
","
+
pSize
;
queryWrapper
.
orderByAsc
(
AdamUserMember:
:
getMid
).
last
(
lastLimitSql
);
queryWrapper
.
select
(
AdamUserMember:
:
getUid
);
userMemberLambdaQueryWrapper
.
last
(
lastLimitSql
);
List
<
AdamUserMember
>
userMemberList
=
platformAdamUserMemberService
.
list
(
queryWrapper
);
int
userMemberListSize
=
CollectionUtils
.
isEmpty
(
userMemberList
)
?
-
1
:
userMemberList
.
size
();
...
...
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