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
f0d8a186
Commit
f0d8a186
authored
Jul 23, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改下单和退款自动升级和降级
parent
fc72dcec
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
19 deletions
+48
-19
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+4
-0
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+44
-19
No files found.
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
f0d8a186
package
share
.
quartz
.
task
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
...
...
@@ -520,6 +521,9 @@ public class RedisTask {
List
<
MemberProgressLog
>
list
=
memberProgressLogService
.
list
(
new
LambdaQueryWrapper
<
MemberProgressLog
>()
.
gt
(
MemberProgressLog:
:
getExpirationTime
,
new
Date
())
);
if
(
CollectionUtil
.
isEmpty
(
list
))
{
return
;
}
list
.
sort
(
Comparator
.
comparing
(
MemberProgressLog:
:
getOperationType
).
reversed
());
//获得list的consumerId
List
<
Long
>
consumerIds
=
list
.
stream
().
map
(
MemberProgressLog:
:
getConsumerId
).
distinct
().
collect
(
Collectors
.
toList
());
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
f0d8a186
...
...
@@ -1109,21 +1109,21 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
integralLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
integralLog
.
setCurrentIntegral
(
consumerWallet
.
getRemainingIntegral
());
BigDecimal
integral
;
Long
membershipProgress
;
BigDecimal
membershipProgress
;
if
(
ObjectUtil
.
isNotEmpty
(
coupon
)
&&
!
coupon
.
getPlatformType
().
equals
(
PlatformTypeEnum
.
SELF
.
getCode
())
&&
coupon
.
getCouponType
().
equals
(
CouponTypeEnum
.
CASH
.
getCode
()))
{
integral
=
consumerWallet
.
getRemainingIntegral
().
add
(
coupon
.
getCouponPayPrice
()).
add
(
sOrder
.
getBalance
());
membershipProgress
=
consumerMember
.
getMembershipProgress
().
add
(
sOrder
.
getBalance
())
.
add
(
coupon
.
getCouponPayPrice
())
.
longValue
()
;
.
add
(
coupon
.
getCouponPayPrice
());
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
RIGHTS
.
getIndex
()))
{
integral
=
integral
.
add
(
sOrder
.
getPayPrice
());
membershipProgress
=
BigDecimal
.
valueOf
(
membershipProgress
).
add
(
sOrder
.
getPayPrice
()).
longValue
(
);
membershipProgress
=
membershipProgress
.
add
(
sOrder
.
getPayPrice
()
);
}
}
else
{
integral
=
consumerWallet
.
getRemainingIntegral
().
add
(
sOrder
.
getBalance
());
membershipProgress
=
consumerMember
.
getMembershipProgress
().
add
(
sOrder
.
getBalance
())
.
longValue
()
;
membershipProgress
=
consumerMember
.
getMembershipProgress
().
add
(
sOrder
.
getBalance
());
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
RIGHTS
.
getIndex
()))
{
integral
=
integral
.
add
(
sOrder
.
getPayPrice
());
membershipProgress
=
BigDecimal
.
valueOf
(
membershipProgress
).
add
(
sOrder
.
getPayPrice
()).
longValue
(
);
membershipProgress
=
membershipProgress
.
add
(
sOrder
.
getPayPrice
()
);
}
}
integralLog
.
setVariableIntegral
(
integral
.
subtract
(
consumerWallet
.
getRemainingIntegral
()));
...
...
@@ -1136,19 +1136,31 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
MemberProgressLog
memberProgressLog
=
new
MemberProgressLog
();
memberProgressLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
memberProgressLog
.
setCurrentProgress
(
consumerMember
.
getMembershipProgress
());
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
NORMAL
.
getIndex
()))
{
MemberConfig
memberConfig
=
memberConfigService
.
getById
(
consumerMember
.
getMemberConfigId
());
if
(
ObjectUtil
.
isNotEmpty
(
memberConfig
))
{
//判断是否升级
if
(
membershipProgress
.
compareTo
(
BigDecimal
.
valueOf
(
memberConfig
.
getLimitRequirements
()))
>=
0
)
{
consumerMember
.
setMembershipLevel
(
consumerMember
.
getMembershipLevel
()
+
1L
);
consumerMember
.
setMemberConfigId
(
memberConfig
.
getId
());
consumerMember
.
setMemberType
(
MemberTypeEnum
.
RECHARGE
.
getIndex
());
}
}
}
else
{
//查询当前会员类型和下一级的会员配置
MemberConfig
one
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMemberType
,
consumerMember
.
getMemberType
())
.
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
()
+
1L
));
if
(
ObjectUtil
.
isNotEmpty
(
one
))
{
//判断是否升级
if
(
membershipProgress
.
compareTo
(
one
.
getLimitRequirements
(
))
>=
0
)
{
if
(
membershipProgress
.
compareTo
(
BigDecimal
.
valueOf
(
one
.
getLimitRequirements
()
))
>=
0
)
{
consumerMember
.
setMembershipLevel
(
consumerMember
.
getMembershipLevel
()
+
1L
);
consumerMember
.
setMemberConfigId
(
one
.
getId
());
}
}
consumerMember
.
setMembershipProgress
(
BigDecimal
.
valueOf
(
membershipProgress
));
memberProgressLog
.
setVariableProgress
(
BigDecimal
.
valueOf
(
membershipProgress
));
}
consumerMember
.
setMembershipProgress
(
membershipProgress
);
memberProgressLog
.
setVariableProgress
(
membershipProgress
.
subtract
(
consumerMember
.
getMembershipProgress
()));
memberProgressLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
memberProgressLog
.
setOperationTime
(
new
Date
());
memberProgressLog
.
setCreateTime
(
new
Date
());
...
...
@@ -1880,7 +1892,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
MemberProgressLog
memberProgressLog
=
new
MemberProgressLog
();
memberProgressLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
memberProgressLog
.
setCurrentProgress
(
consumerMember
.
getMembershipProgress
());
Long
membershipProgress
=
consumerMember
.
getMembershipProgress
().
subtract
(
sOrder
.
getBalance
()).
longValue
(
);
BigDecimal
membershipProgress
=
consumerMember
.
getMembershipProgress
().
subtract
(
sOrder
.
getBalance
()
);
//查询当前会员类型和当前等级的会员配置
MemberConfig
one
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMemberType
,
consumerMember
.
getMemberType
())
...
...
@@ -1888,13 +1900,21 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if
(
ObjectUtil
.
isNotEmpty
(
one
))
{
//判断是否升级
if
(
membershipProgress
.
compareTo
(
one
.
getLimitRequirements
(
))
<
0
)
{
if
(
membershipProgress
.
compareTo
(
BigDecimal
.
valueOf
(
one
.
getLimitRequirements
()
))
<
0
)
{
consumerMember
.
setMembershipLevel
(
consumerMember
.
getMembershipLevel
()
-
1L
);
consumerMember
.
setMemberConfigId
(
one
.
getId
());
MemberConfig
memberConfigServiceOne
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMemberType
,
consumerMember
.
getMemberType
())
.
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
()));
if
(
ObjectUtil
.
isNotEmpty
(
memberConfigServiceOne
))
{
consumerMember
.
setMemberConfigId
(
memberConfigServiceOne
.
getId
());
}
else
{
consumerMember
.
setMemberType
(
MemberTypeEnum
.
NORMAL
.
getIndex
());
}
}
}
memberProgressLog
.
setVariableProgress
(
sOrder
.
getBalance
());
consumerMember
.
setMembershipProgress
(
BigDecimal
.
valueOf
(
membershipProgress
)
);
consumerMember
.
setMembershipProgress
(
membershipProgress
);
memberProgressLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
memberProgressLog
.
setOperationTime
(
new
Date
());
Long
validityPeriod
=
memberConfigService
.
getById
(
consumerMember
.
getMemberConfigId
()).
getValidityPeriod
();
...
...
@@ -1907,15 +1927,15 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
integralLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
integralLog
.
setCurrentIntegral
(
consumerWallet
.
getRemainingIntegral
());
BigDecimal
integral
;
Long
membershipProgress
;
BigDecimal
membershipProgress
;
if
(
ObjectUtil
.
isNotEmpty
(
coupon
)
&&
!
coupon
.
getPlatformType
().
equals
(
PlatformTypeEnum
.
SELF
.
getCode
())
&&
coupon
.
getCouponType
().
equals
(
CouponTypeEnum
.
CASH
.
getCode
()))
{
integral
=
consumerWallet
.
getRemainingIntegral
().
subtract
(
sOrder
.
getPayPrice
())
.
subtract
(
sOrder
.
getBalance
()).
subtract
(
coupon
.
getCouponPayPrice
());
membershipProgress
=
consumerMember
.
getMembershipProgress
()
.
subtract
(
sOrder
.
getPayPrice
()).
subtract
(
sOrder
.
getBalance
()).
subtract
(
coupon
.
getCouponPayPrice
())
.
longValue
()
;
.
subtract
(
sOrder
.
getPayPrice
()).
subtract
(
sOrder
.
getBalance
()).
subtract
(
coupon
.
getCouponPayPrice
());
}
else
{
integral
=
consumerWallet
.
getRemainingIntegral
().
subtract
(
sOrder
.
getPayPrice
()).
subtract
(
sOrder
.
getBalance
());
membershipProgress
=
consumerMember
.
getMembershipProgress
().
subtract
(
sOrder
.
getPayPrice
()).
subtract
(
sOrder
.
getBalance
())
.
longValue
()
;
membershipProgress
=
consumerMember
.
getMembershipProgress
().
subtract
(
sOrder
.
getPayPrice
()).
subtract
(
sOrder
.
getBalance
());
}
integralLog
.
setVariableIntegral
(
consumerWallet
.
getRemainingIntegral
().
subtract
(
integral
));
...
...
@@ -1933,13 +1953,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
.
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
()));
if
(
ObjectUtil
.
isNotEmpty
(
one
))
{
//判断是否升级
if
(
membershipProgress
.
compareTo
(
one
.
getLimitRequirements
(
))
<
0
)
{
if
(
membershipProgress
.
compareTo
(
BigDecimal
.
valueOf
(
one
.
getLimitRequirements
()
))
<
0
)
{
consumerMember
.
setMembershipLevel
(
consumerMember
.
getMembershipLevel
()
-
1L
);
consumerMember
.
setMemberConfigId
(
one
.
getId
());
MemberConfig
memberConfigServiceOne
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMemberType
,
consumerMember
.
getMemberType
())
.
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
()));
if
(
ObjectUtil
.
isNotEmpty
(
memberConfigServiceOne
))
{
consumerMember
.
setMemberConfigId
(
memberConfigServiceOne
.
getId
());
}
}
}
memberProgressLog
.
setVariableProgress
(
consumerMember
.
getMembershipProgress
().
subtract
(
BigDecimal
.
valueOf
(
membershipProgress
)
));
consumerMember
.
setMembershipProgress
(
BigDecimal
.
valueOf
(
membershipProgress
)
);
memberProgressLog
.
setVariableProgress
(
consumerMember
.
getMembershipProgress
().
subtract
(
membershipProgress
));
consumerMember
.
setMembershipProgress
(
membershipProgress
);
memberProgressLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
memberProgressLog
.
setOperationTime
(
new
Date
());
Long
validityPeriod
=
memberConfigService
.
getById
(
consumerMember
.
getMemberConfigId
()).
getValidityPeriod
();
...
...
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