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
e22fd60d
Commit
e22fd60d
authored
Sep 05, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户成为充值会员或者权益会员时,前三个月的累计消费进行积分
parent
4dfba59d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
113 additions
and
7 deletions
+113
-7
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+1
-1
ConsumerWalletService.java
...main/java/share/system/service/ConsumerWalletService.java
+2
-0
ConsumerWalletServiceImpl.java
.../share/system/service/impl/ConsumerWalletServiceImpl.java
+109
-6
EquityMembersOrderServiceImpl.java
...re/system/service/impl/EquityMembersOrderServiceImpl.java
+1
-0
No files found.
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
e22fd60d
...
...
@@ -397,7 +397,7 @@ public class RedisTask {
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
//当前时间加15分钟
Date
date
=
DateUtil
.
offsetMinute
(
new
Date
(),
15
);
Date
date
=
DateUtil
.
offsetMinute
(
sOrder
.
getEnd
Date
(),
15
);
map
.
put
(
"expirationTime"
,
date
.
toString
());
JSONObject
json
=
new
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ROOM_EXPIRE_TIME
.
getValue
()
+
sOrder
.
getOrderNo
(),
json
.
toString
());
...
...
share-system/src/main/java/share/system/service/ConsumerWalletService.java
View file @
e22fd60d
...
...
@@ -68,4 +68,6 @@ public interface ConsumerWalletService extends IService<ConsumerWallet> {
boolean
addConsumerWallet
(
ConsumerWallet
consumerWallet
);
boolean
editConsumerWallet
(
ConsumerWallet
consumerWallet
,
Recharge
recharge
,
ConsumerMember
one
);
void
accumulatedConsumptionStatistics
(
Long
consumerId
);
}
share-system/src/main/java/share/system/service/impl/ConsumerWalletServiceImpl.java
View file @
e22fd60d
package
share
.
system
.
service
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
...
...
@@ -7,9 +8,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.enums.GiveTypeEnum
;
import
share.common.enums.MemberTypeEnum
;
import
share.common.enums.YesNoEnum
;
import
share.common.enums.*
;
import
share.common.utils.DateUtils
;
import
share.system.domain.*
;
import
share.system.domain.vo.ConsumerWalletVo
;
...
...
@@ -18,8 +17,10 @@ import share.system.service.*;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.Date
;
import
java.util.List
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* 会员钱包Service业务层处理
...
...
@@ -32,7 +33,8 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ConsumerWalletServiceImpl
.
class
);
@Autowired
private
ConsumerWalletMapper
consumerWalletMapper
;
@Autowired
private
ConsumerWalletService
consumerWalletService
;
@Autowired
private
SConsumerService
sConsumerService
;
@Autowired
...
...
@@ -49,6 +51,12 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
private
ConsumerMemberService
consumerMemberService
;
@Autowired
private
MemberProgressLogService
memberProgressLogService
;
@Autowired
private
ISOrderService
orderService
;
@Autowired
private
ISCouponService
sCouponService
;
@Autowired
private
ISConsumerCouponService
consumerCouponService
;
/**
* 查询会员钱包
...
...
@@ -152,6 +160,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
durationLogService
.
save
(
durationLog
);
}
if
(
consumerWallet
.
getRemainingIntegral
().
compareTo
(
new
BigDecimal
(
0
))
>
0
)
{
accumulatedConsumptionStatistics
(
consumerWallet
,
one
,
memberConfig
);
IntegralLog
integralLog
=
new
IntegralLog
();
integralLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
integralLog
.
setCurrentIntegral
(
new
BigDecimal
(
0
));
...
...
@@ -266,4 +275,98 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
consumerMemberService
.
updateConsumerMember
(
one
);
return
i
==
1
;
}
private
void
accumulatedConsumptionStatistics
(
ConsumerWallet
consumerWallet
,
ConsumerMember
one
,
MemberConfig
memberConfig
)
{
final
BigDecimal
[]
consumption
=
{
BigDecimal
.
ZERO
};
//查询含当天23:59:59以及往前90天的00:00:00整天的订单
Calendar
calendar
=
Calendar
.
getInstance
();
// 设置时间为当天的23:59:59
calendar
.
set
(
Calendar
.
HOUR_OF_DAY
,
23
);
calendar
.
set
(
Calendar
.
MINUTE
,
59
);
calendar
.
set
(
Calendar
.
SECOND
,
59
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
sameDay
=
calendar
.
getTime
();
// 计算往前90天的日期
calendar
.
add
(
Calendar
.
DATE
,
-
90
);
// 设置为那天的00:00:00
calendar
.
set
(
Calendar
.
HOUR_OF_DAY
,
0
);
calendar
.
set
(
Calendar
.
MINUTE
,
0
);
calendar
.
set
(
Calendar
.
SECOND
,
0
);
Date
beforeDay
=
calendar
.
getTime
();
List
<
SOrder
>
orderList
=
orderService
.
list
(
new
LambdaQueryWrapper
<
SOrder
>()
.
between
(
SOrder:
:
getCreateTime
,
beforeDay
,
sameDay
)
.
eq
(
SOrder:
:
getConsumerId
,
one
.
getConsumerId
())
.
eq
(
SOrder:
:
getPayStatus
,
YesNoEnum
.
yes
.
getIndex
())
.
notIn
(
SOrder:
:
getRefundStatus
,
RefundStatusEnum
.
getRefundedStatus
())
.
in
(
SOrder:
:
getStatus
,
OrderStatusEnum
.
getValidOrderStatus
())
.
eq
(
SOrder:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
()));
if
(
CollectionUtil
.
isEmpty
(
orderList
))
{
return
;
}
Map
<
Long
,
SCoupon
>
sCouponMap
=
sCouponService
.
list
().
stream
().
collect
(
Collectors
.
toMap
(
SCoupon:
:
getId
,
Function
.
identity
()));
//优惠券id集合,去掉为null的
List
<
Long
>
ids
=
orderList
.
stream
().
map
(
SOrder:
:
getCouponId
).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
List
<
SConsumerCoupon
>
consumerCouponList
=
consumerCouponService
.
selectByIds
(
ids
).
stream
()
.
filter
(
s
->
s
.
getCouponType
().
equals
(
CouponTypeEnum
.
CASH
.
getCode
())).
collect
(
Collectors
.
toList
());
consumerCouponList
.
stream
().
forEach
(
item
->
{
if
(
ObjectUtil
.
isNotEmpty
(
item
.
getCouponPayPrice
()))
{
consumption
[
0
]
=
consumption
[
0
].
add
(
item
.
getCouponPayPrice
());
}
else
{
consumption
[
0
]
=
consumption
[
0
].
add
(
sCouponMap
.
get
(
item
.
getCouponId
()).
getCouponPayPrice
());
}
});
if
(
one
.
getMemberType
().
equals
(
MemberTypeEnum
.
RIGHTS
.
getIndex
()))
{
//orderList累加payPrice
consumption
[
0
]
=
consumption
[
0
].
add
(
orderList
.
stream
().
map
(
SOrder:
:
getPayPrice
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
}
if
(
consumption
[
0
].
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
IntegralLog
integralLog
=
new
IntegralLog
();
integralLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
integralLog
.
setCurrentIntegral
(
new
BigDecimal
(
0
));
integralLog
.
setVariableIntegral
(
consumerWallet
.
getRemainingIntegral
());
integralLog
.
setOperationTime
(
new
Date
());
integralLog
.
setCreateTime
(
new
Date
());
integralLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
integralLogService
.
save
(
integralLog
);
MemberProgressLog
memberProgressLog
=
new
MemberProgressLog
();
memberProgressLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
memberProgressLog
.
setCurrentProgress
(
new
BigDecimal
(
0
));
memberProgressLog
.
setVariableProgress
(
consumerWallet
.
getRemainingIntegral
());
memberProgressLog
.
setOperationTime
(
new
Date
());
memberProgressLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
memberProgressLog
.
setCreateTime
(
new
Date
());
memberProgressLog
.
setExpirationTime
(
DateUtils
.
addYears
(
new
Date
(),
memberConfig
.
getValidityPeriod
().
intValue
()));
memberProgressLogService
.
save
(
memberProgressLog
);
MemberConfig
newOne
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMemberType
,
one
.
getMemberType
())
.
eq
(
MemberConfig:
:
getMembershipLevel
,
one
.
getMembershipLevel
()
+
1L
));
MemberConfig
newTwo
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMemberType
,
one
.
getMemberType
())
.
eq
(
MemberConfig:
:
getMembershipLevel
,
one
.
getMembershipLevel
()
+
2L
));
if
(
ObjectUtil
.
isNotEmpty
(
newOne
)
&&
one
.
getMembershipProgress
().
compareTo
(
BigDecimal
.
valueOf
(
newOne
.
getLimitRequirements
()))
>=
0
)
{
if
(
ObjectUtil
.
isNotEmpty
(
newTwo
)
&&
one
.
getMembershipProgress
().
compareTo
(
BigDecimal
.
valueOf
(
newTwo
.
getLimitRequirements
()))
<=
0
)
{
one
.
setMembershipLevel
(
one
.
getMembershipLevel
()
+
1L
);
one
.
setMemberConfigId
(
newOne
.
getId
());
consumerMemberService
.
updateConsumerMember
(
one
);
}
else
{
one
.
setMembershipLevel
(
one
.
getMembershipLevel
()
+
2L
);
one
.
setMemberConfigId
(
newTwo
.
getId
());
consumerMemberService
.
updateConsumerMember
(
one
);
}
}
consumerWallet
.
setRemainingIntegral
(
consumerWallet
.
getRemainingIntegral
().
add
(
consumption
[
0
]));
consumerWalletMapper
.
updateConsumerWallet
(
consumerWallet
);
}
}
@Override
public
void
accumulatedConsumptionStatistics
(
Long
consumerId
)
{
ConsumerWallet
consumerWallet
=
consumerWalletService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerWallet
>().
eq
(
ConsumerWallet:
:
getConsumerId
,
consumerId
));
ConsumerMember
one
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
consumerId
));
MemberConfig
memberConfig
=
memberConfigService
.
getById
(
one
.
getMemberConfigId
());
accumulatedConsumptionStatistics
(
consumerWallet
,
one
,
memberConfig
);
}
}
share-system/src/main/java/share/system/service/impl/EquityMembersOrderServiceImpl.java
View file @
e22fd60d
...
...
@@ -251,6 +251,7 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
}
consumerWalletOne
.
setCreateTime
(
new
Date
());
consumerWalletService
.
save
(
consumerWalletOne
);
consumerWalletService
.
accumulatedConsumptionStatistics
(
equityMembersOrder
.
getConsumerId
());
}
updateEquityMembersOrder
(
equityMembersOrder
);
}
...
...
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