记得上下班打卡 | 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
7e0af894
Commit
7e0af894
authored
Aug 24, 2021
by
张国柄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+调整发放券任务;
parent
cfe4ead8
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
283 additions
and
94 deletions
+283
-94
CandyMgtCouponTaskController.java
...m/controller/candy/task/CandyMgtCouponTaskController.java
+35
-94
PlatformAdamUserMemberService.java
...form/service/impl/adam/PlatformAdamUserMemberService.java
+10
-0
PlatformCandyCouponService.java
...atform/service/impl/candy/PlatformCandyCouponService.java
+238
-0
No files found.
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/controller/candy/task/CandyMgtCouponTaskController.java
View file @
7e0af894
...
@@ -35,16 +35,6 @@ public class CandyMgtCouponTaskController {
...
@@ -35,16 +35,6 @@ public class CandyMgtCouponTaskController {
private
PlatformCandyMgtCouponService
platformCandyMgtCouponService
;
private
PlatformCandyMgtCouponService
platformCandyMgtCouponService
;
@Autowired
@Autowired
private
PlatformCandyCouponService
platformCandyCouponService
;
private
PlatformCandyCouponService
platformCandyCouponService
;
@Autowired
private
PlatformCandyCouponRuleService
platformCandyCouponRuleService
;
@Autowired
private
PlatformCandyCouponCodeService
platformCandyCouponCodeService
;
@Autowired
private
PlatformCandyUserCouponService
platformCandyUserCouponService
;
@Autowired
private
DMRdmService
dmRdmService
;
@Autowired
private
RedisUtil
redisUtil
;
@PostMapping
(
"issue/coupons"
)
@PostMapping
(
"issue/coupons"
)
public
void
issueCoupons
()
{
public
void
issueCoupons
()
{
...
@@ -52,98 +42,49 @@ public class CandyMgtCouponTaskController {
...
@@ -52,98 +42,49 @@ public class CandyMgtCouponTaskController {
.
eq
(
CandyMgtCoupon:
:
getState
,
0
)
.
eq
(
CandyMgtCoupon:
:
getState
,
0
)
.
orderByAsc
(
CandyMgtCoupon:
:
getEventAt
);
.
orderByAsc
(
CandyMgtCoupon:
:
getEventAt
);
List
<
CandyMgtCoupon
>
list
=
platformCandyMgtCouponService
.
list
(
queryWrapper
);
List
<
CandyMgtCoupon
>
list
=
platformCandyMgtCouponService
.
list
(
queryWrapper
);
int
taskSize
=
CollectionUtils
.
isEmpty
(
list
)
?
0
:
list
.
size
();
int
taskSize
=
CollectionUtils
.
isEmpty
(
list
)
?
-
1
:
list
.
size
();
log
.
info
(
"
issue coupons taskSize:{}
"
,
taskSize
);
log
.
info
(
"
发放券任务总数:{} >>> BEGIN BEGIN BEGIN
"
,
taskSize
);
LambdaQueryWrapper
<
CandyCoupon
>
couponQueryWrapper
=
Wrappers
.
lambdaQuery
(
CandyCoupon
.
class
).
eq
(
CandyCoupon:
:
getState
,
1
);
LambdaQueryWrapper
<
CandyCoupon
>
couponQueryWrapper
=
Wrappers
.
lambdaQuery
(
CandyCoupon
.
class
).
eq
(
CandyCoupon:
:
getState
,
1
);
LambdaQueryWrapper
<
CandyCouponRule
>
couponRuleQueryWrapper
=
Wrappers
.
lambdaQuery
(
CandyCouponRule
.
class
).
eq
(
CandyCouponRule:
:
getState
,
1
);
for
(
int
i
=
0
;
i
<
taskSize
;
i
++)
{
for
(
int
i
=
0
;
i
<
taskSize
;
i
++)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
CandyMgtCoupon
mgtCoupon
=
list
.
get
(
i
);
CandyMgtCoupon
mgtCoupon
=
list
.
get
(
i
);
CandyCoupon
coupon
=
platformCandyCouponService
.
getOne
(
couponQueryWrapper
.
eq
(
CandyCoupon:
:
getCouponId
,
mgtCoupon
.
getCouponId
()));
mgtCoupon
.
setState
(
9
);
List
<
CandyCouponRuleDto
>
couponRuleDtoList
=
platformCandyCouponRuleService
.
listForCouponRuleDto
(
coupon
.
getCouponId
());
try
{
if
(
platformCandyMgtCouponService
.
updateById
(
mgtCoupon
))
{
CandyCoupon
coupon
=
platformCandyCouponService
.
getOne
(
couponQueryWrapper
.
eq
(
CandyCoupon:
:
getCouponId
,
mgtCoupon
.
getCouponId
()));
List
<
CandyCouponCode
>
initCouponCodeList
=
new
ArrayList
<>();
List
<
CandyUserCoupon
>
initUserCouponList
=
new
ArrayList
<>();
log
.
info
(
"发放券任务总数:{},任务{}开始处理[mcouponId:{},couType:{},bindType:{},eventAmt:{},eventType:{}]"
,
taskSize
,
i
,
Integer
eventAmt
=
mgtCoupon
.
getEventAmt
();
mgtCoupon
.
getMcouponId
(),
coupon
.
getCouType
(),
coupon
.
getBindType
(),
mgtCoupon
.
getEventAmt
(),
mgtCoupon
.
getEventType
());
for
(
int
j
=
0
;
j
<
eventAmt
;
j
++)
{
switch
(
coupon
.
getCouType
())
{
switch
(
coupon
.
getCouType
())
{
case
1
:
case
1
:
// 代金券
String
uid
=
dmRdmService
.
getUidByMobile
(
"17701223310"
);
platformCandyCouponService
.
issueCashCouponHandler
(
mgtCoupon
,
coupon
);
if
(
StringUtils
.
isNotEmpty
(
uid
))
{
break
;
CandyUserCoupon
userCoupon
=
new
CandyUserCoupon
();
case
2
:
// 满减券
userCoupon
.
setUcouponId
(
IDGenerator
.
get32UUID
());
platformCandyCouponService
.
issueOverMinusCouponHandler
(
mgtCoupon
,
coupon
);
userCoupon
.
setMcouponId
(
mgtCoupon
.
getMcouponId
());
break
;
userCoupon
.
setUid
(
uid
);
case
3
:
// 兑换券
userCoupon
.
setCouponId
(
coupon
.
getCouponId
());
platformCandyCouponService
.
issueExchangeCouponHandler
(
mgtCoupon
,
coupon
);
userCoupon
.
setState
(
1
);
break
;
userCoupon
.
setBindAt
(
now
);
case
4
:
// 折扣券
platformCandyCouponService
.
issueDiscountCouponHandler
(
mgtCoupon
,
coupon
);
initUserCouponList
.
add
(
userCoupon
);
break
;
}
default
:
break
;
log
.
warn
(
"发放券任务总数:{},任务{}无法处理,无效的券类型[mcouponId:{},couType:{}]"
,
taskSize
,
i
,
mgtCoupon
.
getMcouponId
(),
coupon
.
getCouType
());
case
2
:
break
;
break
;
case
3
:
// 兑换券
CandyCouponCode
couponCode
=
new
CandyCouponCode
();
couponCode
.
setCcode
(
RandomStringUtils
.
randomAlphanumeric
(
16
));
couponCode
.
setCouponId
(
coupon
.
getCouponId
());
couponCode
.
setState
(
0
);
couponCode
.
setCreatedAt
(
now
);
initCouponCodeList
.
add
(
couponCode
);
break
;
case
4
:
break
;
default
:
log
.
warn
(
"Invalid operation[mcouponId:{},couType:{}]"
,
mgtCoupon
.
getMcouponId
(),
coupon
.
getCouType
());
break
;
}
}
if
(!
initUserCouponList
.
isEmpty
()
&&
platformCandyUserCouponService
.
saveBatch
(
initUserCouponList
))
{
CandyCouponInfoDto
couponInfoDto
=
new
CandyCouponInfoDto
();
BeanUtils
.
copyProperties
(
coupon
,
couponInfoDto
);
couponInfoDto
.
setUseRules
(
couponRuleDtoList
);
String
key
=
CandyRedisConst
.
BASIC_COUPON_INFO
.
concat
(
couponInfoDto
.
getCouponId
());
redisUtil
.
set
(
key
,
couponInfoDto
);
initUserCouponList
.
forEach
(
r
->
{
String
uckey
=
CandyRedisConst
.
BASIC_USER_COUPON
.
concat
(
r
.
getUid
());
List
<
CandyUserCouponBasicDto
>
vos
=
(
List
<
CandyUserCouponBasicDto
>)
redisUtil
.
get
(
uckey
);
if
(
CollectionUtils
.
isEmpty
(
vos
))
{
vos
=
new
ArrayList
<>();
}
}
vos
.
add
(
CandyUserCouponBasicDto
.
getNew
().
copy
(
r
,
coupon
,
couponRuleDtoList
));
redisUtil
.
set
(
uckey
,
vos
);
});
}
if
(!
initCouponCodeList
.
isEmpty
()
&&
platformCandyCouponCodeService
.
saveBatch
(
initCouponCodeList
))
{
mgtCoupon
.
setState
(
1
);
CandyCouponInfoDto
couponInfoDto
=
new
CandyCouponInfoDto
();
boolean
update
=
platformCandyMgtCouponService
.
updateById
(
mgtCoupon
);
BeanUtils
.
copyProperties
(
coupon
,
couponInfoDto
);
couponInfoDto
.
setUseRules
(
couponRuleDtoList
);
String
key
=
CandyRedisConst
.
BASIC_COUPON_INFO
.
concat
(
couponInfoDto
.
getCouponId
());
log
.
info
(
"发放券任务总数:{},任务{}处理{}[mcouponId:{},couType:{},bindType:{},eventAmt:{},eventType:{}]"
,
taskSize
,
i
,
(
update
?
"成功"
:
"失败"
),
redisUtil
.
set
(
key
,
couponInfoDto
);
mgtCoupon
.
getMcouponId
(),
coupon
.
getCouType
(),
coupon
.
getBindType
(),
mgtCoupon
.
getEventAmt
(),
mgtCoupon
.
getEventType
());
}
initCouponCodeList
.
forEach
(
r
->
{
}
catch
(
Exception
e
)
{
redisUtil
.
set
(
CandyRedisConst
.
BASIC_COUPON_CODE
.
concat
(
r
.
getCcode
()),
CandyCouponCodeDto
.
getNew
().
copy
(
r
));
log
.
error
(
"发放券任务总数:{},任务{}处理异常[mcouponId:{}]"
,
taskSize
,
i
,
mgtCoupon
.
getMcouponId
(),
e
);
});
}
}
mgtCoupon
.
setState
(
1
);
LambdaUpdateWrapper
<
CandyMgtCoupon
>
mgtCouponUpdateWrapper
=
Wrappers
.
lambdaUpdate
(
CandyMgtCoupon
.
class
).
eq
(
CandyMgtCoupon:
:
getMcouponId
,
mgtCoupon
.
getMcouponId
());
boolean
update
=
platformCandyMgtCouponService
.
update
(
mgtCoupon
,
mgtCouponUpdateWrapper
);
log
.
info
(
"issue coupons mcouponId:{} ~ {}"
,
mgtCoupon
.
getMcouponId
(),
update
);
}
}
log
.
info
(
"发放券任务总数:{} >>> END END END"
,
taskSize
);
}
}
}
}
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/impl/adam/PlatformAdamUserMemberService.java
0 → 100644
View file @
7e0af894
package
com
.
liquidnet
.
service
.
platform
.
service
.
impl
.
adam
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.liquidnet.service.adam.entity.AdamUserMember
;
import
com.liquidnet.service.adam.mapper.AdamUserMemberMapper
;
import
org.springframework.stereotype.Service
;
@Service
public
class
PlatformAdamUserMemberService
extends
ServiceImpl
<
AdamUserMemberMapper
,
AdamUserMember
>
{
}
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/impl/candy/PlatformCandyCouponService.java
View file @
7e0af894
This diff is collapsed.
Click to expand it.
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