记得上下班打卡 | 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
b968cd91
Commit
b968cd91
authored
Oct 27, 2021
by
张国柄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RDS多数据源调整:adam、candy;
parent
aa46f5b2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
25 deletions
+42
-25
CandyCouponDueTaskController.java
...m/controller/candy/task/CandyCouponDueTaskController.java
+10
-6
PlatformMemberRefundService.java
...atform/service/impl/adam/PlatformMemberRefundService.java
+10
-6
PlatformCandyCouponService.java
...atform/service/impl/candy/PlatformCandyCouponService.java
+17
-10
PlatformCandyUserCouponService.java
...rm/service/impl/candy/PlatformCandyUserCouponService.java
+5
-3
No files found.
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/controller/candy/task/CandyCouponDueTaskController.java
View file @
b968cd91
...
@@ -2,6 +2,7 @@ package com.liquidnet.service.platform.controller.candy.task;
...
@@ -2,6 +2,7 @@ package com.liquidnet.service.platform.controller.candy.task;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.liquidnet.common.cache.redis.util.AbstractRedisUtil
;
import
com.liquidnet.common.cache.redis.util.RedisDataSourceUtil
;
import
com.liquidnet.common.cache.redis.util.RedisDataSourceUtil
;
import
com.liquidnet.common.exception.LiquidnetServiceException
;
import
com.liquidnet.common.exception.LiquidnetServiceException
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.base.ResponseDto
;
...
@@ -110,14 +111,15 @@ public class CandyCouponDueTaskController {
...
@@ -110,14 +111,15 @@ public class CandyCouponDueTaskController {
if
(!
CollectionUtils
.
isEmpty
(
updateCouponCodeList
))
{
if
(!
CollectionUtils
.
isEmpty
(
updateCouponCodeList
))
{
if
(
platformCandyCouponCodeService
.
updateBatchById
(
updateCouponCodeList
,
updateCouponCodeList
.
size
()))
{
if
(
platformCandyCouponCodeService
.
updateBatchById
(
updateCouponCodeList
,
updateCouponCodeList
.
size
()))
{
AbstractRedisUtil
redisCandyUtil
=
redisDataSourceUtil
.
getRedisCandyUtil
();
updateCouponCodeList
.
forEach
(
r
->
{
updateCouponCodeList
.
forEach
(
r
->
{
String
ccKey
=
CandyRedisConst
.
BASIC_COUPON_CODE
.
concat
(
r
.
getCcode
());
String
ccKey
=
CandyRedisConst
.
BASIC_COUPON_CODE
.
concat
(
r
.
getCcode
());
CandyCouponCodeDto
dto
=
(
CandyCouponCodeDto
)
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
get
(
ccKey
);
CandyCouponCodeDto
dto
=
(
CandyCouponCodeDto
)
redis
CandyUtil
.
get
(
ccKey
);
if
(
null
!=
dto
)
{
if
(
null
!=
dto
)
{
dto
.
setState
(
3
);
dto
.
setState
(
3
);
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
set
(
ccKey
,
dto
);
redis
CandyUtil
.
set
(
ccKey
,
dto
);
}
}
pl
.
getAndIncrement
();
pl
.
getAndIncrement
();
});
});
...
@@ -196,8 +198,9 @@ public class CandyCouponDueTaskController {
...
@@ -196,8 +198,9 @@ public class CandyCouponDueTaskController {
if
(!
CollectionUtils
.
isEmpty
(
updateCommonCouponList
))
{
if
(!
CollectionUtils
.
isEmpty
(
updateCommonCouponList
))
{
if
(
platformCandyCommonCouponService
.
updateBatchById
(
updateCommonCouponList
,
updateCommonCouponList
.
size
()))
{
if
(
platformCandyCommonCouponService
.
updateBatchById
(
updateCommonCouponList
,
updateCommonCouponList
.
size
()))
{
AbstractRedisUtil
redisCandyUtil
=
redisDataSourceUtil
.
getRedisCandyUtil
();
String
ccKey
=
CandyRedisConst
.
BASIC_COMMON_COUPON
;
String
ccKey
=
CandyRedisConst
.
BASIC_COMMON_COUPON
;
List
<
CandyCommonCouponBasicDto
>
vos
=
(
List
<
CandyCommonCouponBasicDto
>)
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
get
(
ccKey
);
List
<
CandyCommonCouponBasicDto
>
vos
=
(
List
<
CandyCommonCouponBasicDto
>)
redis
CandyUtil
.
get
(
ccKey
);
if
(!
CollectionUtils
.
isEmpty
(
vos
))
{
if
(!
CollectionUtils
.
isEmpty
(
vos
))
{
Map
<
String
,
CandyCommonCouponBasicDto
>
vosMap
=
vos
.
stream
().
collect
(
Collectors
.
toMap
(
CandyCommonCouponBasicDto:
:
getCcouponId
,
t
->
t
));
Map
<
String
,
CandyCommonCouponBasicDto
>
vosMap
=
vos
.
stream
().
collect
(
Collectors
.
toMap
(
CandyCommonCouponBasicDto:
:
getCcouponId
,
t
->
t
));
...
@@ -209,7 +212,7 @@ public class CandyCouponDueTaskController {
...
@@ -209,7 +212,7 @@ public class CandyCouponDueTaskController {
vos
.
add
(
commonCouponBasicDto
);
vos
.
add
(
commonCouponBasicDto
);
});
});
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
set
(
ccKey
,
vos
);
redis
CandyUtil
.
set
(
ccKey
,
vos
);
}
}
}
else
{
}
else
{
throw
new
LiquidnetServiceException
(
"-1"
,
String
.
format
(
"券到期处理失败[updateCommonCouponList.size=%s]"
,
updateCommonCouponList
.
size
()));
throw
new
LiquidnetServiceException
(
"-1"
,
String
.
format
(
"券到期处理失败[updateCommonCouponList.size=%s]"
,
updateCommonCouponList
.
size
()));
...
@@ -270,9 +273,10 @@ public class CandyCouponDueTaskController {
...
@@ -270,9 +273,10 @@ public class CandyCouponDueTaskController {
// 需要更新的用户券记录按UID分组处理
// 需要更新的用户券记录按UID分组处理
Map
<
String
,
List
<
CandyUserCoupon
>>
userCouponListByUidMap
=
updateUserCouponList
.
stream
().
collect
(
Collectors
.
groupingBy
(
CandyUserCoupon:
:
getUid
));
Map
<
String
,
List
<
CandyUserCoupon
>>
userCouponListByUidMap
=
updateUserCouponList
.
stream
().
collect
(
Collectors
.
groupingBy
(
CandyUserCoupon:
:
getUid
));
AbstractRedisUtil
redisCandyUtil
=
redisDataSourceUtil
.
getRedisCandyUtil
();
userCouponListByUidMap
.
forEach
((
uid
,
updateUserCouponListByUid
)
->
{
userCouponListByUidMap
.
forEach
((
uid
,
updateUserCouponListByUid
)
->
{
String
uckey
=
CandyRedisConst
.
BASIC_USER_COUPON
.
concat
(
uid
);
String
uckey
=
CandyRedisConst
.
BASIC_USER_COUPON
.
concat
(
uid
);
List
<
CandyUserCouponBasicDto
>
vos
=
(
List
<
CandyUserCouponBasicDto
>)
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
get
(
uckey
);
List
<
CandyUserCouponBasicDto
>
vos
=
(
List
<
CandyUserCouponBasicDto
>)
redis
CandyUtil
.
get
(
uckey
);
if
(!
CollectionUtils
.
isEmpty
(
vos
))
{
if
(!
CollectionUtils
.
isEmpty
(
vos
))
{
updateUserCouponListByUid
.
forEach
(
r
->
{
updateUserCouponListByUid
.
forEach
(
r
->
{
...
@@ -286,7 +290,7 @@ public class CandyCouponDueTaskController {
...
@@ -286,7 +290,7 @@ public class CandyCouponDueTaskController {
}
}
pl
.
getAndIncrement
();
pl
.
getAndIncrement
();
});
});
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
set
(
uckey
,
vos
);
redis
CandyUtil
.
set
(
uckey
,
vos
);
}
}
});
});
}
else
{
}
else
{
...
...
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/impl/adam/PlatformMemberRefundService.java
View file @
b968cd91
...
@@ -3,6 +3,7 @@ package com.liquidnet.service.platform.service.impl.adam;
...
@@ -3,6 +3,7 @@ package com.liquidnet.service.platform.service.impl.adam;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.liquidnet.common.cache.redis.util.AbstractRedisUtil
;
import
com.liquidnet.common.cache.redis.util.RedisDataSourceUtil
;
import
com.liquidnet.common.cache.redis.util.RedisDataSourceUtil
;
import
com.liquidnet.service.adam.constant.AdamRedisConst
;
import
com.liquidnet.service.adam.constant.AdamRedisConst
;
import
com.liquidnet.service.adam.dto.vo.AdamMemberOrderVo
;
import
com.liquidnet.service.adam.dto.vo.AdamMemberOrderVo
;
...
@@ -98,24 +99,27 @@ public class PlatformMemberRefundService extends ServiceImpl<AdamMemberRefundMap
...
@@ -98,24 +99,27 @@ public class PlatformMemberRefundService extends ServiceImpl<AdamMemberRefundMap
LocalDateTime
newExpiryAt
=
null
;
LocalDateTime
newExpiryAt
=
null
;
List
<
String
>
removeUcouponIdList
=
null
;
List
<
String
>
removeUcouponIdList
=
null
;
AbstractRedisUtil
redisAdamUtil
=
redisDataSourceUtil
.
getRedisAdamUtil
();
AbstractRedisUtil
redisCandyUtil
=
redisDataSourceUtil
.
getRedisCandyUtil
();
{
// 同步用户端信息
{
// 同步用户端信息
// 同步更新REDIS会员订单信息
// 同步更新REDIS会员订单信息
String
moKey
=
AdamRedisConst
.
INFO_MEMBER_ORDER
+
memberOrder
.
getUid
();
String
moKey
=
AdamRedisConst
.
INFO_MEMBER_ORDER
+
memberOrder
.
getUid
();
ArrayList
<
AdamMemberOrderVo
>
vos
=
(
ArrayList
<
AdamMemberOrderVo
>)
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
get
(
moKey
);
ArrayList
<
AdamMemberOrderVo
>
vos
=
(
ArrayList
<
AdamMemberOrderVo
>)
redis
AdamUtil
.
get
(
moKey
);
int
idx
=
IntStream
.
range
(
0
,
vos
.
size
()).
filter
(
i
->
vos
.
get
(
i
).
getOrderNo
().
equals
(
memberOrder
.
getOrderNo
())).
findFirst
().
orElse
(-
1
);
int
idx
=
IntStream
.
range
(
0
,
vos
.
size
()).
filter
(
i
->
vos
.
get
(
i
).
getOrderNo
().
equals
(
memberOrder
.
getOrderNo
())).
findFirst
().
orElse
(-
1
);
AdamMemberOrderVo
vo
=
vos
.
get
(
idx
);
AdamMemberOrderVo
vo
=
vos
.
get
(
idx
);
vo
.
setState
(
5
);
vo
.
setState
(
5
);
vo
.
setUpdatedAt
(
now
);
vo
.
setUpdatedAt
(
now
);
vos
.
set
(
idx
,
vo
);
vos
.
set
(
idx
,
vo
);
boolean
syncVo
=
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
set
(
moKey
,
vos
);
boolean
syncVo
=
redis
AdamUtil
.
set
(
moKey
,
vos
);
log
.
info
(
"###会员退款回调处理成功:更新REDIS会员订单信息{}[orderNo:{},uid:{}]"
,
syncVo
?
"成功"
:
"失败"
,
orderNo
,
memberOrder
.
getUid
());
log
.
info
(
"###会员退款回调处理成功:更新REDIS会员订单信息{}[orderNo:{},uid:{}]"
,
syncVo
?
"成功"
:
"失败"
,
orderNo
,
memberOrder
.
getUid
());
String
umKey
=
AdamRedisConst
.
INFO_USER_MEMBER
.
concat
(
memberOrder
.
getUid
());
String
umKey
=
AdamRedisConst
.
INFO_USER_MEMBER
.
concat
(
memberOrder
.
getUid
());
AdamUserMemberVo
userMemberVo
=
(
AdamUserMemberVo
)
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
get
(
umKey
);
AdamUserMemberVo
userMemberVo
=
(
AdamUserMemberVo
)
redis
AdamUtil
.
get
(
umKey
);
// 用户会员权益券信息
// 用户会员权益券信息
String
uckey
=
CandyRedisConst
.
BASIC_USER_COUPON
.
concat
(
memberOrder
.
getUid
());
String
uckey
=
CandyRedisConst
.
BASIC_USER_COUPON
.
concat
(
memberOrder
.
getUid
());
List
<
CandyUserCouponBasicDto
>
userCouponBasicDtoList
=
(
List
<
CandyUserCouponBasicDto
>)
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
get
(
uckey
);
List
<
CandyUserCouponBasicDto
>
userCouponBasicDtoList
=
(
List
<
CandyUserCouponBasicDto
>)
redis
CandyUtil
.
get
(
uckey
);
// 同步更新REDIS会员信息
// 同步更新REDIS会员信息
if
(
userMemberVo
.
getState
()
==
1
)
{
// 非拉黑用户,则更新到期时间为减去订单标记的会员有效期的日期
if
(
userMemberVo
.
getState
()
==
1
)
{
// 非拉黑用户,则更新到期时间为减去订单标记的会员有效期的日期
...
@@ -131,7 +135,7 @@ public class PlatformMemberRefundService extends ServiceImpl<AdamMemberRefundMap
...
@@ -131,7 +135,7 @@ public class PlatformMemberRefundService extends ServiceImpl<AdamMemberRefundMap
userMemberVo
.
setExpiryAt
(
newExpiryAt
);
userMemberVo
.
setExpiryAt
(
newExpiryAt
);
userMemberVo
.
setUpdatedAt
(
now
);
userMemberVo
.
setUpdatedAt
(
now
);
syncVo
=
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
set
(
umKey
,
userMemberVo
);
syncVo
=
redis
AdamUtil
.
set
(
umKey
,
userMemberVo
);
log
.
info
(
"###会员退款回调处理成功:更新REDIS会员信息{}[orderNo:{},uid:{}]"
,
syncVo
?
"成功"
:
"失败"
,
orderNo
,
memberOrder
.
getUid
());
log
.
info
(
"###会员退款回调处理成功:更新REDIS会员信息{}[orderNo:{},uid:{}]"
,
syncVo
?
"成功"
:
"失败"
,
orderNo
,
memberOrder
.
getUid
());
// 同步更新MYSQL会员信息
// 同步更新MYSQL会员信息
...
@@ -160,7 +164,7 @@ public class PlatformMemberRefundService extends ServiceImpl<AdamMemberRefundMap
...
@@ -160,7 +164,7 @@ public class PlatformMemberRefundService extends ServiceImpl<AdamMemberRefundMap
if
(!
CollectionUtils
.
isEmpty
(
removeUcouponIdList
))
{
if
(!
CollectionUtils
.
isEmpty
(
removeUcouponIdList
))
{
List
<
String
>
finalRemoveUcouponIdList
=
removeUcouponIdList
;
List
<
String
>
finalRemoveUcouponIdList
=
removeUcouponIdList
;
userCouponBasicDtoList
.
removeIf
(
r
->
finalRemoveUcouponIdList
.
contains
(
r
.
getUcouponId
()));
userCouponBasicDtoList
.
removeIf
(
r
->
finalRemoveUcouponIdList
.
contains
(
r
.
getUcouponId
()));
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
set
(
uckey
,
userCouponBasicDtoList
);
redis
CandyUtil
.
set
(
uckey
,
userCouponBasicDtoList
);
// 同步更新MYSQL用户会员权益券信息
// 同步更新MYSQL用户会员权益券信息
LambdaUpdateWrapper
<
CandyUserCoupon
>
candyUserCouponLambdaUpdateWrapper
=
Wrappers
.
lambdaUpdate
(
CandyUserCoupon
.
class
);
LambdaUpdateWrapper
<
CandyUserCoupon
>
candyUserCouponLambdaUpdateWrapper
=
Wrappers
.
lambdaUpdate
(
CandyUserCoupon
.
class
);
...
...
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/impl/candy/PlatformCandyCouponService.java
View file @
b968cd91
...
@@ -3,6 +3,7 @@ package com.liquidnet.service.platform.service.impl.candy;
...
@@ -3,6 +3,7 @@ package com.liquidnet.service.platform.service.impl.candy;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.liquidnet.common.cache.redis.util.AbstractRedisUtil
;
import
com.liquidnet.common.cache.redis.util.RedisDataSourceUtil
;
import
com.liquidnet.common.cache.redis.util.RedisDataSourceUtil
;
import
com.liquidnet.common.exception.LiquidnetServiceException
;
import
com.liquidnet.common.exception.LiquidnetServiceException
;
import
com.liquidnet.commons.lang.util.IDGenerator
;
import
com.liquidnet.commons.lang.util.IDGenerator
;
...
@@ -52,7 +53,7 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
...
@@ -52,7 +53,7 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
couponInfoDto
.
setUseRules
(
couponRuleDtoList
);
couponInfoDto
.
setUseRules
(
couponRuleDtoList
);
String
couponInfoDtoKey
=
CandyRedisConst
.
BASIC_COUPON_INFO
.
concat
(
couponInfoDto
.
getCouponId
());
String
couponInfoDtoKey
=
CandyRedisConst
.
BASIC_COUPON_INFO
.
concat
(
couponInfoDto
.
getCouponId
());
redisDataSourceUtil
.
getRedis
Kylin
Util
().
set
(
couponInfoDtoKey
,
couponInfoDto
);
redisDataSourceUtil
.
getRedis
Candy
Util
().
set
(
couponInfoDtoKey
,
couponInfoDto
);
switch
(
coupon
.
getBindType
())
{
// 领取方式[0-用户输入兑换|1-发放至用户]
switch
(
coupon
.
getBindType
())
{
// 领取方式[0-用户输入兑换|1-发放至用户]
case
0
:
case
0
:
...
@@ -110,8 +111,9 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
...
@@ -110,8 +111,9 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
if
(!
initCouponCodeList
.
isEmpty
())
{
if
(!
initCouponCodeList
.
isEmpty
())
{
if
(
platformCandyCouponCodeService
.
saveBatch
(
initCouponCodeList
))
{
if
(
platformCandyCouponCodeService
.
saveBatch
(
initCouponCodeList
))
{
AbstractRedisUtil
redisCandyUtil
=
redisDataSourceUtil
.
getRedisCandyUtil
();
initCouponCodeList
.
forEach
(
r
->
{
initCouponCodeList
.
forEach
(
r
->
{
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
set
(
CandyRedisConst
.
BASIC_COUPON_CODE
.
concat
(
r
.
getCcode
()),
CandyCouponCodeDto
.
getNew
().
copy
(
r
));
redis
CandyUtil
.
set
(
CandyRedisConst
.
BASIC_COUPON_CODE
.
concat
(
r
.
getCcode
()),
CandyCouponCodeDto
.
getNew
().
copy
(
r
));
});
});
initCouponCodeList
.
clear
();
initCouponCodeList
.
clear
();
...
@@ -152,16 +154,17 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
...
@@ -152,16 +154,17 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
if
(!
initCommonCouponList
.
isEmpty
())
{
if
(!
initCommonCouponList
.
isEmpty
())
{
if
(
platformCandyCommonCouponService
.
saveBatch
(
initCommonCouponList
,
initCommonCouponList
.
size
()))
{
if
(
platformCandyCommonCouponService
.
saveBatch
(
initCommonCouponList
,
initCommonCouponList
.
size
()))
{
AbstractRedisUtil
redisCandyUtil
=
redisDataSourceUtil
.
getRedisCandyUtil
();
initCommonCouponList
.
forEach
(
r
->
{
initCommonCouponList
.
forEach
(
r
->
{
String
ccKey
=
CandyRedisConst
.
BASIC_COMMON_COUPON
;
String
ccKey
=
CandyRedisConst
.
BASIC_COMMON_COUPON
;
List
<
CandyCommonCouponBasicDto
>
vos
=
(
List
<
CandyCommonCouponBasicDto
>)
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
get
(
ccKey
);
List
<
CandyCommonCouponBasicDto
>
vos
=
(
List
<
CandyCommonCouponBasicDto
>)
redis
CandyUtil
.
get
(
ccKey
);
if
(
CollectionUtils
.
isEmpty
(
vos
))
{
if
(
CollectionUtils
.
isEmpty
(
vos
))
{
vos
=
new
ArrayList
<>();
vos
=
new
ArrayList
<>();
}
}
vos
.
add
(
CandyCommonCouponBasicDto
.
getNew
().
copy
(
r
,
coupon
,
couponRuleDtoList
));
vos
.
add
(
CandyCommonCouponBasicDto
.
getNew
().
copy
(
r
,
coupon
,
couponRuleDtoList
));
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
set
(
ccKey
,
vos
);
redis
CandyUtil
.
set
(
ccKey
,
vos
);
});
});
}
else
{
}
else
{
throw
new
LiquidnetServiceException
(
"-1"
,
String
.
format
(
"券发放失败[mcouponId=%s]"
,
mgtCoupon
.
getMcouponId
()));
throw
new
LiquidnetServiceException
(
"-1"
,
String
.
format
(
"券发放失败[mcouponId=%s]"
,
mgtCoupon
.
getMcouponId
()));
...
@@ -220,17 +223,18 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
...
@@ -220,17 +223,18 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
if
(!
initUserCouponList
.
isEmpty
())
{
if
(!
initUserCouponList
.
isEmpty
())
{
if
(
platformCandyUserCouponService
.
saveBatch
(
initUserCouponList
))
{
if
(
platformCandyUserCouponService
.
saveBatch
(
initUserCouponList
))
{
AbstractRedisUtil
redisCandyUtil
=
redisDataSourceUtil
.
getRedisCandyUtil
();
initUserCouponList
.
forEach
(
r
->
{
initUserCouponList
.
forEach
(
r
->
{
String
uckey
=
CandyRedisConst
.
BASIC_USER_COUPON
.
concat
(
r
.
getUid
());
String
uckey
=
CandyRedisConst
.
BASIC_USER_COUPON
.
concat
(
r
.
getUid
());
List
<
CandyUserCouponBasicDto
>
vos
=
(
List
<
CandyUserCouponBasicDto
>)
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
get
(
uckey
);
List
<
CandyUserCouponBasicDto
>
vos
=
(
List
<
CandyUserCouponBasicDto
>)
redis
CandyUtil
.
get
(
uckey
);
if
(
CollectionUtils
.
isEmpty
(
vos
))
{
if
(
CollectionUtils
.
isEmpty
(
vos
))
{
vos
=
new
ArrayList
<>();
vos
=
new
ArrayList
<>();
}
}
vos
.
add
(
CandyUserCouponBasicDto
.
getNew
().
copy
(
r
,
coupon
,
couponRuleDtoList
));
vos
.
add
(
CandyUserCouponBasicDto
.
getNew
().
copy
(
r
,
coupon
,
couponRuleDtoList
));
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
set
(
uckey
,
vos
);
redis
CandyUtil
.
set
(
uckey
,
vos
);
});
});
}
else
{
}
else
{
throw
new
LiquidnetServiceException
(
"-1"
,
"券发放失败"
);
throw
new
LiquidnetServiceException
(
"-1"
,
"券发放失败"
);
...
@@ -261,11 +265,13 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
...
@@ -261,11 +265,13 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
int
eventAmt
=
mgtCoupon
.
getEventAmt
(),
pl
=
0
,
limitSize
=
eventLimitArr
.
length
;
int
eventAmt
=
mgtCoupon
.
getEventAmt
(),
pl
=
0
,
limitSize
=
eventLimitArr
.
length
;
log
.
info
(
"发放券处理中:目标指定手机号[总数:{},发放量:{}]"
,
limitSize
,
eventAmt
);
log
.
info
(
"发放券处理中:目标指定手机号[总数:{},发放量:{}]"
,
limitSize
,
eventAmt
);
AbstractRedisUtil
redisAdamUtil
=
redisDataSourceUtil
.
getRedisAdamUtil
();
// 指定手机号发放券中,会员权益券失效时间duedAt需要同步会员到期时间expiryAt
// 指定手机号发放券中,会员权益券失效时间duedAt需要同步会员到期时间expiryAt
boolean
isMemberRightsCoupon
=
coupon
.
getExclusive
()
==
1
;
boolean
isMemberRightsCoupon
=
coupon
.
getExclusive
()
==
1
;
for
(
int
i
=
0
;
i
<
eventAmt
;
i
++)
{
for
(
int
i
=
0
;
i
<
eventAmt
;
i
++)
{
for
(
String
r
:
eventLimitArr
)
{
for
(
String
r
:
eventLimitArr
)
{
String
uid
=
(
String
)
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
get
(
AdamRedisConst
.
IDENTITY_MOBILE
.
concat
(
r
));
String
uid
=
(
String
)
redis
AdamUtil
.
get
(
AdamRedisConst
.
IDENTITY_MOBILE
.
concat
(
r
));
if
(
StringUtils
.
isNotEmpty
(
uid
))
{
if
(
StringUtils
.
isNotEmpty
(
uid
))
{
CandyUserCoupon
userCoupon
=
new
CandyUserCoupon
();
CandyUserCoupon
userCoupon
=
new
CandyUserCoupon
();
...
@@ -277,7 +283,7 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
...
@@ -277,7 +283,7 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
userCoupon
.
setBindAt
(
coupon
.
getEffectAt
());
userCoupon
.
setBindAt
(
coupon
.
getEffectAt
());
if
(
isMemberRightsCoupon
)
{
if
(
isMemberRightsCoupon
)
{
AdamUserMemberVo
vo
=
(
AdamUserMemberVo
)
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
get
(
AdamRedisConst
.
INFO_USER_MEMBER
.
concat
(
uid
));
AdamUserMemberVo
vo
=
(
AdamUserMemberVo
)
redis
AdamUtil
.
get
(
AdamRedisConst
.
INFO_USER_MEMBER
.
concat
(
uid
));
userCoupon
.
setDuedAt
(
vo
.
getExpiryAt
());
userCoupon
.
setDuedAt
(
vo
.
getExpiryAt
());
}
else
{
}
else
{
userCoupon
.
setDuedAt
(
coupon
.
getExpireAt
());
userCoupon
.
setDuedAt
(
coupon
.
getExpireAt
());
...
@@ -291,19 +297,20 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
...
@@ -291,19 +297,20 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
}
}
}
}
AbstractRedisUtil
redisCandyUtil
=
redisDataSourceUtil
.
getRedisCandyUtil
();
if
(!
initUserCouponList
.
isEmpty
())
{
if
(!
initUserCouponList
.
isEmpty
())
{
if
(
platformCandyUserCouponService
.
saveBatch
(
initUserCouponList
))
{
if
(
platformCandyUserCouponService
.
saveBatch
(
initUserCouponList
))
{
initUserCouponList
.
forEach
(
r
->
{
initUserCouponList
.
forEach
(
r
->
{
String
uckey
=
CandyRedisConst
.
BASIC_USER_COUPON
.
concat
(
r
.
getUid
());
String
uckey
=
CandyRedisConst
.
BASIC_USER_COUPON
.
concat
(
r
.
getUid
());
List
<
CandyUserCouponBasicDto
>
vos
=
(
List
<
CandyUserCouponBasicDto
>)
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
get
(
uckey
);
List
<
CandyUserCouponBasicDto
>
vos
=
(
List
<
CandyUserCouponBasicDto
>)
redis
CandyUtil
.
get
(
uckey
);
if
(
CollectionUtils
.
isEmpty
(
vos
))
{
if
(
CollectionUtils
.
isEmpty
(
vos
))
{
vos
=
new
ArrayList
<>();
vos
=
new
ArrayList
<>();
}
}
vos
.
add
(
CandyUserCouponBasicDto
.
getNew
().
copy
(
r
,
coupon
,
couponRuleDtoList
));
vos
.
add
(
CandyUserCouponBasicDto
.
getNew
().
copy
(
r
,
coupon
,
couponRuleDtoList
));
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
set
(
uckey
,
vos
);
redis
CandyUtil
.
set
(
uckey
,
vos
);
});
});
}
else
{
}
else
{
throw
new
LiquidnetServiceException
(
"-1"
,
String
.
format
(
"券发放失败[mcouponId=%s]"
,
mgtCoupon
.
getMcouponId
()));
throw
new
LiquidnetServiceException
(
"-1"
,
String
.
format
(
"券发放失败[mcouponId=%s]"
,
mgtCoupon
.
getMcouponId
()));
...
...
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/impl/candy/PlatformCandyUserCouponService.java
View file @
b968cd91
...
@@ -2,6 +2,7 @@ package com.liquidnet.service.platform.service.impl.candy;
...
@@ -2,6 +2,7 @@ package com.liquidnet.service.platform.service.impl.candy;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.liquidnet.common.cache.redis.util.AbstractRedisUtil
;
import
com.liquidnet.common.cache.redis.util.RedisDataSourceUtil
;
import
com.liquidnet.common.cache.redis.util.RedisDataSourceUtil
;
import
com.liquidnet.service.adam.constant.AdamRedisConst
;
import
com.liquidnet.service.adam.constant.AdamRedisConst
;
import
com.liquidnet.service.base.OrderCloseMapping
;
import
com.liquidnet.service.base.OrderCloseMapping
;
...
@@ -70,7 +71,8 @@ public class PlatformCandyUserCouponService extends ServiceImpl<CandyUserCouponM
...
@@ -70,7 +71,8 @@ public class PlatformCandyUserCouponService extends ServiceImpl<CandyUserCouponM
}
}
public
List
<
CandyUserCouponBasicDto
>
ucouponBasicDtoByUidProcessing
(
String
uid
)
{
public
List
<
CandyUserCouponBasicDto
>
ucouponBasicDtoByUidProcessing
(
String
uid
)
{
if
(
null
==
redisDataSourceUtil
.
getRedisKylinUtil
().
get
(
AdamRedisConst
.
INFO_USER
.
concat
(
uid
)))
return
null
;
AbstractRedisUtil
redisCandyUtil
=
redisDataSourceUtil
.
getRedisCandyUtil
();
if
(
null
==
redisCandyUtil
.
get
(
AdamRedisConst
.
INFO_USER
.
concat
(
uid
)))
return
null
;
List
<
CandyUserCouponBasicDto
>
basicDtoList
=
candyUserCouponMapper
.
selectMultiForUserCouponBasicDto
(
uid
);
List
<
CandyUserCouponBasicDto
>
basicDtoList
=
candyUserCouponMapper
.
selectMultiForUserCouponBasicDto
(
uid
);
if
(!
CollectionUtils
.
isEmpty
(
basicDtoList
))
{
if
(!
CollectionUtils
.
isEmpty
(
basicDtoList
))
{
...
@@ -86,7 +88,7 @@ public class PlatformCandyUserCouponService extends ServiceImpl<CandyUserCouponM
...
@@ -86,7 +88,7 @@ public class PlatformCandyUserCouponService extends ServiceImpl<CandyUserCouponM
dto
.
setUseRules
(
couponRuleDtoListMap
.
get
(
dto
.
getCouponId
()));
dto
.
setUseRules
(
couponRuleDtoListMap
.
get
(
dto
.
getCouponId
()));
});
});
redis
DataSourceUtil
.
getRedisKylinUtil
()
.
set
(
CandyRedisConst
.
BASIC_USER_COUPON
.
concat
(
uid
),
basicDtoList
);
redis
CandyUtil
.
set
(
CandyRedisConst
.
BASIC_USER_COUPON
.
concat
(
uid
),
basicDtoList
);
}
}
return
basicDtoList
;
return
basicDtoList
;
}
}
...
@@ -104,7 +106,7 @@ public class PlatformCandyUserCouponService extends ServiceImpl<CandyUserCouponM
...
@@ -104,7 +106,7 @@ public class PlatformCandyUserCouponService extends ServiceImpl<CandyUserCouponM
dto
.
setUseRules
(
couponRuleDtoListMap
.
get
(
dto
.
getCouponId
()));
dto
.
setUseRules
(
couponRuleDtoListMap
.
get
(
dto
.
getCouponId
()));
});
});
redisDataSourceUtil
.
getRedis
Kylin
Util
().
set
(
CandyRedisConst
.
BASIC_COMMON_COUPON
,
basicDtoList
);
redisDataSourceUtil
.
getRedis
Candy
Util
().
set
(
CandyRedisConst
.
BASIC_COMMON_COUPON
,
basicDtoList
);
}
}
return
basicDtoList
;
return
basicDtoList
;
}
}
...
...
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