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
13f950ee
Commit
13f950ee
authored
Aug 30, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权益订单回调增加赠送积分的逻辑
parent
2a2b97e0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
21 deletions
+48
-21
EquityMembersOrderServiceImpl.java
...re/system/service/impl/EquityMembersOrderServiceImpl.java
+48
-21
No files found.
share-system/src/main/java/share/system/service/impl/EquityMembersOrderServiceImpl.java
View file @
13f950ee
...
...
@@ -56,6 +56,8 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
private
ConsumerWalletService
consumerWalletService
;
@Autowired
private
IntegralLogService
integralLogService
;
@Autowired
private
MemberProgressLogService
memberProgressLogService
;
/**
* 查询权益会员订单
...
...
@@ -179,20 +181,20 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
newConsumerMember
.
setExpirationDate
(
DateUtils
.
addYears
(
DateUtils
.
parseDate
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM
,
new
Date
())),
equityMembersOrderConfig
.
getValidityPeriod
().
intValue
()));
newConsumerMember
.
setMembershipProgress
(
equityMembersOrderConfig
.
getGiftPoints
());
if
(
equityMembersOrderConfig
.
getGiftPoints
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
MemberProgressLog
memberProgressLog
=
new
MemberProgressLog
();
memberProgressLog
.
setConsumerId
(
equityMembersOrder
.
getConsumerId
());
memberProgressLog
.
setCurrentProgress
(
BigDecimal
.
ZERO
);
memberProgressLog
.
setVariableProgress
(
equityMembersOrderConfig
.
getGiftPoints
());
memberProgressLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
memberProgressLog
.
setOperationTime
(
new
Date
());
memberProgressLog
.
setCreateTime
(
new
Date
());
memberProgressLog
.
setExpirationTime
(
DateUtils
.
addYears
(
new
Date
(),
Math
.
toIntExact
(
memberConfig
.
getValidityPeriod
())));
memberProgressLogService
.
save
(
memberProgressLog
);
}
newConsumerMember
.
setCreateTime
(
new
Date
());
newConsumerMember
.
setIsRights
(
YesNoEnum
.
yes
.
getIndex
());
consumerMemberService
.
save
(
newConsumerMember
);
//增加积分日志
if
(
equityMembersOrderConfig
.
getGiftPoints
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
IntegralLog
integralLog
=
new
IntegralLog
();
integralLog
.
setConsumerId
(
equityMembersOrder
.
getConsumerId
());
integralLog
.
setCurrentIntegral
(
BigDecimal
.
ZERO
);
integralLog
.
setVariableIntegral
(
equityMembersOrderConfig
.
getGiftPoints
());
integralLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
integralLog
.
setOperationTime
(
new
Date
());
integralLog
.
setCreateTime
(
new
Date
());
integralLogService
.
save
(
integralLog
);
}
logger
.
debug
(
"新增权益会员"
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"consumerId"
,
String
.
valueOf
(
newConsumerMember
.
getConsumerId
()));
...
...
@@ -202,23 +204,24 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
redisUtil
.
set
(
ReceiptRdeisEnum
.
EQUITY_MEMBERS_TIME
.
getValue
()
+
equityMembersOrder
.
getConsumerId
(),
json
.
toString
());
logger
.
debug
(
"redis新增权益会员有效期"
);
}
else
{
MemberConfig
memberConfigServiceOne
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
())
.
eq
(
MemberConfig:
:
getMemberType
,
MemberTypeEnum
.
RIGHTS
.
getIndex
()));
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
RIGHTS
.
getIndex
()))
{
//在原来的基础上增加有效期
consumerMember
.
setExpirationDate
(
DateUtils
.
addYears
(
DateUtils
.
parseDate
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM
,
consumerMember
.
getExpirationDate
())),
equityMembersOrderConfig
.
getValidityPeriod
().
intValue
()));
extracted
(
equityMembersOrder
,
equityMembersOrderConfig
,
consumerMember
);
memberConfigServiceOne
.
getValidityPeriod
().
intValue
()));
extracted
(
equityMembersOrder
,
equityMembersOrderConfig
,
consumerMember
,
consumerWallet
,
memberConfigServiceOne
);
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
logger
.
debug
(
"权益会员原来的基础上增加有效期"
);
}
else
{
consumerMember
.
setIsRights
(
YesNoEnum
.
yes
.
getIndex
());
//修改会员类型为权益会员
consumerMember
.
setMemberType
(
MemberTypeEnum
.
RIGHTS
.
getIndex
());
consumerMember
.
setMemberConfigId
(
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
())
.
eq
(
MemberConfig:
:
getMemberType
,
MemberTypeEnum
.
RIGHTS
.
getIndex
())).
getId
());
consumerMember
.
setMemberConfigId
(
memberConfigServiceOne
.
getId
());
consumerMember
.
setExpirationDate
(
DateUtils
.
addYears
(
DateUtils
.
parseDate
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM
,
new
Date
())),
equityMembersOrderConfig
.
getValidityPeriod
().
intValue
()));
extracted
(
equityMembersOrder
,
equityMembersOrderConfig
,
consumerMember
);
memberConfigServiceOne
.
getValidityPeriod
().
intValue
()));
extracted
(
equityMembersOrder
,
equityMembersOrderConfig
,
consumerMember
,
consumerWallet
,
memberConfigServiceOne
);
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
logger
.
debug
(
"修改会员类型为权益会员"
);
}
...
...
@@ -235,23 +238,47 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
consumerWalletOne
.
setBalance
(
BigDecimal
.
ZERO
);
consumerWalletOne
.
setRemainingDuration
(
BigDecimal
.
ZERO
);
consumerWalletOne
.
setRemainingIntegral
(
BigDecimal
.
ZERO
);
if
(
equityMembersOrderConfig
.
getGiftPoints
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
consumerWalletOne
.
setRemainingIntegral
(
consumerWalletOne
.
getRemainingIntegral
().
add
(
equityMembersOrderConfig
.
getGiftPoints
()));
IntegralLog
integralLog
=
new
IntegralLog
();
integralLog
.
setConsumerId
(
equityMembersOrder
.
getConsumerId
());
integralLog
.
setCurrentIntegral
(
BigDecimal
.
ZERO
);
integralLog
.
setVariableIntegral
(
equityMembersOrderConfig
.
getGiftPoints
());
integralLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
integralLog
.
setOperationTime
(
new
Date
());
integralLog
.
setCreateTime
(
new
Date
());
integralLogService
.
save
(
integralLog
);
}
consumerWalletOne
.
setCreateTime
(
new
Date
());
consumerWalletService
.
save
(
consumerWalletOne
);
}
updateEquityMembersOrder
(
equityMembersOrder
);
}
private
void
extracted
(
EquityMembersOrder
equityMembersOrder
,
EquityMembersOrderConfig
equityMembersOrderConfig
,
ConsumerMember
consumerMember
)
{
private
void
extracted
(
EquityMembersOrder
equityMembersOrder
,
EquityMembersOrderConfig
equityMembersOrderConfig
,
ConsumerMember
consumerMember
,
ConsumerWallet
consumerWallet
,
MemberConfig
memberConfigServiceOne
)
{
if
(
equityMembersOrderConfig
.
getGiftPoints
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
MemberProgressLog
memberProgressLog
=
new
MemberProgressLog
();
memberProgressLog
.
setConsumerId
(
equityMembersOrder
.
getConsumerId
());
memberProgressLog
.
setCurrentProgress
(
consumerMember
.
getMembershipProgress
());
consumerMember
.
setMembershipProgress
(
equityMembersOrderConfig
.
getGiftPoints
().
add
(
consumerMember
.
getMembershipProgress
()));
memberProgressLog
.
setVariableProgress
(
equityMembersOrderConfig
.
getGiftPoints
().
add
(
consumerMember
.
getMembershipProgress
()));
memberProgressLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
memberProgressLog
.
setOperationTime
(
new
Date
());
memberProgressLog
.
setCreateTime
(
new
Date
());
memberProgressLog
.
setExpirationTime
(
DateUtils
.
addYears
(
new
Date
(),
Math
.
toIntExact
(
memberConfigServiceOne
.
getValidityPeriod
())));
IntegralLog
integralLog
=
new
IntegralLog
();
integralLog
.
setConsumerId
(
equityMembersOrder
.
getConsumerId
());
integralLog
.
setCurrentIntegral
(
consumerMember
.
getMembershipProgress
());
integralLog
.
setVariableIntegral
(
equityMembersOrderConfig
.
getGiftPoints
().
add
(
consumerMember
.
getMembershipProgres
s
()));
consumerMember
.
setMembershipProgress
(
equityMembersOrderConfig
.
getGiftPoints
().
add
(
consumerMember
.
getMembershipProgress
()));
consumerWallet
.
setRemainingIntegral
(
consumerWallet
.
getRemainingIntegral
().
add
(
equityMembersOrderConfig
.
getGiftPoint
s
()));
integralLog
.
setVariableIntegral
(
equityMembersOrderConfig
.
getGiftPoints
().
add
(
consumerWallet
.
getRemainingIntegral
()));
integralLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
integralLog
.
setOperationTime
(
new
Date
());
integralLog
.
setCreateTime
(
new
Date
());
integralLogService
.
save
(
integralLog
);
memberProgressLogService
.
save
(
memberProgressLog
);
consumerWalletService
.
updateById
(
consumerWallet
);
}
//查询当前会员类型和下一级的会员配置
MemberConfig
one
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
...
...
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