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
d00b3add
Commit
d00b3add
authored
Jul 03, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改充值回调
parent
bb0d8d54
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
78 additions
and
6 deletions
+78
-6
RechargeController.java
.../java/share/web/controller/system/RechargeController.java
+1
-1
ConsumerWalletService.java
...main/java/share/system/service/ConsumerWalletService.java
+4
-0
ConsumerWalletServiceImpl.java
.../share/system/service/impl/ConsumerWalletServiceImpl.java
+47
-0
RechargeServiceImpl.java
...n/java/share/system/service/impl/RechargeServiceImpl.java
+18
-4
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+8
-1
No files found.
share-front/src/main/java/share/web/controller/system/RechargeController.java
View file @
d00b3add
...
@@ -92,7 +92,7 @@ public class RechargeController extends BaseController {
...
@@ -92,7 +92,7 @@ public class RechargeController extends BaseController {
return
toAjax
(
rechargeService
.
deleteRechargeByIds
(
ids
));
return
toAjax
(
rechargeService
.
deleteRechargeByIds
(
ids
));
}
}
//
@Log
(
title
=
"充值"
,
businessType
=
BusinessType
.
DELETE
)
@PostMapping
(
"/recharge"
)
@PostMapping
(
"/recharge"
)
public
R
<
RechargePayResultResponse
>
createOrder
(
@RequestBody
@Validated
CreateRechargeRequest
request
)
{
public
R
<
RechargePayResultResponse
>
createOrder
(
@RequestBody
@Validated
CreateRechargeRequest
request
)
{
if
(
"1"
.
equals
(
redisUtil
.
frontInOutLogSwitch
()))
{
if
(
"1"
.
equals
(
redisUtil
.
frontInOutLogSwitch
()))
{
...
...
share-system/src/main/java/share/system/service/ConsumerWalletService.java
View file @
d00b3add
package
share
.
system
.
service
;
package
share
.
system
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.ConsumerMember
;
import
share.system.domain.ConsumerWallet
;
import
share.system.domain.ConsumerWallet
;
import
share.system.domain.Recharge
;
import
share.system.domain.vo.ConsumerWalletVo
;
import
share.system.domain.vo.ConsumerWalletVo
;
import
java.util.List
;
import
java.util.List
;
...
@@ -64,4 +66,6 @@ public interface ConsumerWalletService extends IService<ConsumerWallet> {
...
@@ -64,4 +66,6 @@ public interface ConsumerWalletService extends IService<ConsumerWallet> {
ConsumerWalletVo
selectByConsumerId
();
ConsumerWalletVo
selectByConsumerId
();
boolean
addConsumerWallet
(
ConsumerWallet
consumerWallet
);
boolean
addConsumerWallet
(
ConsumerWallet
consumerWallet
);
boolean
editConsumerWallet
(
ConsumerWallet
consumerWallet
,
Recharge
recharge
,
ConsumerMember
one
);
}
}
share-system/src/main/java/share/system/service/impl/ConsumerWalletServiceImpl.java
View file @
d00b3add
package
share
.
system
.
service
.
impl
;
package
share
.
system
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
share.common.enums.MemberTypeEnum
;
import
share.common.enums.YesNoEnum
;
import
share.common.enums.YesNoEnum
;
import
share.common.utils.DateUtils
;
import
share.common.utils.DateUtils
;
import
share.system.domain.*
;
import
share.system.domain.*
;
...
@@ -33,6 +35,12 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
...
@@ -33,6 +35,12 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
private
DurationLogService
durationLogService
;
private
DurationLogService
durationLogService
;
@Autowired
@Autowired
private
IntegralLogService
integralLogService
;
private
IntegralLogService
integralLogService
;
@Autowired
private
RechargeConfService
rechargeConfService
;
@Autowired
private
MemberConfigService
memberConfigService
;
@Autowired
private
ConsumerMemberService
consumerMemberService
;
/**
/**
* 查询会员钱包
* 查询会员钱包
...
@@ -136,4 +144,43 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
...
@@ -136,4 +144,43 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
integralLogService
.
save
(
integralLog
);
integralLogService
.
save
(
integralLog
);
return
i
==
1
;
return
i
==
1
;
}
}
@Override
public
boolean
editConsumerWallet
(
ConsumerWallet
consumerWallet
,
Recharge
recharge
,
ConsumerMember
one
)
{
RechargeConf
rechargeConf
=
rechargeConfService
.
selectRechargeConfById
(
recharge
.
getRechargeConfId
());
MemberConfig
memberConfig
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMembershipLevel
,
1L
)
.
eq
(
MemberConfig:
:
getMemberType
,
MemberTypeEnum
.
RECHARGE
.
getIndex
()));
one
.
setExpirationDate
(
DateUtils
.
addDays
(
new
Date
(),
memberConfig
.
getValidityPeriod
().
intValue
()));
consumerMemberService
.
updateConsumerMember
(
one
);
BigDecimal
balance
=
consumerWallet
.
getBalance
().
add
(
recharge
.
getRechargeAmount
()).
add
(
rechargeConf
.
getGiveAmount
());
consumerWallet
.
setBalance
(
balance
);
BigDecimal
duration
=
consumerWallet
.
getRemainingDuration
().
add
(
rechargeConf
.
getGiveDuration
());
consumerWallet
.
setRemainingDuration
(
duration
);
BigDecimal
Integral
=
consumerWallet
.
getRemainingIntegral
().
add
(
rechargeConf
.
getGiveRatio
().
multiply
(
recharge
.
getRechargeAmount
()));
consumerWallet
.
setRemainingIntegral
(
Integral
);
int
i
=
baseMapper
.
updateConsumerWallet
(
consumerWallet
);
BalanceLog
balanceLog
=
new
BalanceLog
();
balanceLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
balanceLog
.
setCurrentBalance
(
consumerWallet
.
getBalance
());
balanceLog
.
setVariableAmount
(
recharge
.
getRechargeAmount
().
add
(
rechargeConf
.
getGiveAmount
()));
balanceLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
balanceLog
.
setOperationTime
(
new
Date
());
balanceLogService
.
save
(
balanceLog
);
DurationLog
durationLog
=
new
DurationLog
();
durationLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
durationLog
.
setCurrentDuration
(
consumerWallet
.
getRemainingDuration
());
durationLog
.
setVariableDuration
(
rechargeConf
.
getGiveDuration
());
durationLog
.
setOperationTime
(
new
Date
());
durationLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
durationLogService
.
save
(
durationLog
);
IntegralLog
integralLog
=
new
IntegralLog
();
integralLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
integralLog
.
setCurrentIntegral
(
consumerWallet
.
getRemainingIntegral
());
integralLog
.
setVariableIntegral
(
rechargeConf
.
getGiveRatio
().
multiply
(
recharge
.
getRechargeAmount
()));
integralLog
.
setOperationTime
(
new
Date
());
integralLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
integralLogService
.
save
(
integralLog
);
return
i
==
1
;
}
}
}
share-system/src/main/java/share/system/service/impl/RechargeServiceImpl.java
View file @
d00b3add
...
@@ -155,8 +155,25 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
...
@@ -155,8 +155,25 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
consumerMember
.
setMembershipProgress
(
recharge
.
getRechargeAmount
().
longValue
());
consumerMember
.
setMembershipProgress
(
recharge
.
getRechargeAmount
().
longValue
());
consumerMember
.
setExpirationDate
(
DateUtils
.
addDays
(
new
Date
(),
memberConfig
.
getValidityPeriod
().
intValue
()));
consumerMember
.
setExpirationDate
(
DateUtils
.
addDays
(
new
Date
(),
memberConfig
.
getValidityPeriod
().
intValue
()));
consumerMemberService
.
save
(
consumerMember
);
consumerMemberService
.
save
(
consumerMember
);
RechargeConf
rechargeConf
=
rechargeConfService
.
selectRechargeConfById
(
recharge
.
getRechargeConfId
());
extracted
(
recharge
);
}
else
{
ConsumerWallet
consumerWallet
=
consumerWalletService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerWallet
>().
eq
(
ConsumerWallet:
:
getConsumerId
,
recharge
.
getConsumerId
()));
if
(
one
.
getMemberType
().
equals
(
MemberTypeEnum
.
RECHARGE
.
getIndex
()))
{
consumerWalletService
.
editConsumerWallet
(
consumerWallet
,
recharge
,
one
);
}
else
if
(
one
.
getMemberType
().
equals
(
MemberTypeEnum
.
RIGHTS
.
getIndex
()))
{
if
(
ObjectUtil
.
isEmpty
(
consumerWallet
))
{
extracted
(
recharge
);
}
else
{
//修改会员钱包
consumerWalletService
.
editConsumerWallet
(
consumerWallet
,
recharge
,
one
);
}
}
}
}
private
void
extracted
(
Recharge
recharge
)
{
//新增会员钱包
//新增会员钱包
RechargeConf
rechargeConf
=
rechargeConfService
.
selectRechargeConfById
(
recharge
.
getRechargeConfId
());
ConsumerWallet
consumerWallet
=
new
ConsumerWallet
();
ConsumerWallet
consumerWallet
=
new
ConsumerWallet
();
consumerWallet
.
setConsumerId
(
recharge
.
getConsumerId
());
consumerWallet
.
setConsumerId
(
recharge
.
getConsumerId
());
BigDecimal
balance
=
recharge
.
getRechargeAmount
().
add
(
rechargeConf
.
getGiveAmount
());
BigDecimal
balance
=
recharge
.
getRechargeAmount
().
add
(
rechargeConf
.
getGiveAmount
());
...
@@ -165,9 +182,6 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
...
@@ -165,9 +182,6 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
BigDecimal
Integral
=
recharge
.
getRechargeAmount
().
multiply
(
rechargeConf
.
getGiveRatio
());
BigDecimal
Integral
=
recharge
.
getRechargeAmount
().
multiply
(
rechargeConf
.
getGiveRatio
());
consumerWallet
.
setRemainingIntegral
(
Integral
);
consumerWallet
.
setRemainingIntegral
(
Integral
);
consumerWalletService
.
addConsumerWallet
(
consumerWallet
);
consumerWalletService
.
addConsumerWallet
(
consumerWallet
);
}
else
{
}
}
}
private
Recharge
generatRecharge
(
CreateRechargeRequest
request
,
SConsumer
user
)
{
private
Recharge
generatRecharge
(
CreateRechargeRequest
request
,
SConsumer
user
)
{
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
d00b3add
...
@@ -1931,7 +1931,13 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1931,7 +1931,13 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse
.
setCouponFee
(
BigDecimal
.
ZERO
);
priceResponse
.
setCouponFee
(
BigDecimal
.
ZERO
);
priceResponse
.
setDiscountFee
(
priceResponse
.
getTotalFee
().
subtract
(
priceResponse
.
getPayFee
()));
priceResponse
.
setDiscountFee
(
priceResponse
.
getTotalFee
().
subtract
(
priceResponse
.
getPayFee
()));
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscountFee
().
divide
(
priceResponse
.
getTotalFee
(),
2
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
100
)));
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscountFee
().
divide
(
priceResponse
.
getTotalFee
(),
2
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
100
)));
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
CronParser
cronParser
=
new
CronParser
(
CronDefinitionBuilder
.
instanceDefinitionFor
(
CronType
.
QUARTZ
));
if
(
ObjectUtil
.
isNotEmpty
(
activity
))
{
Cron
cron
=
cronParser
.
parse
(
activity
.
getCronExpression
());
ExecutionTime
executionTime
=
ExecutionTime
.
forCron
(
cron
);
boolean
match
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
request
.
getPreStartDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
boolean
match1
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
request
.
getPreEndDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
)
&&
!
match
&&
!
match1
)
{
MemberConfig
memberConfig
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>().
eq
(
MemberConfig:
:
getId
,
consumerMember
.
getMemberConfigId
()));
MemberConfig
memberConfig
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>().
eq
(
MemberConfig:
:
getId
,
consumerMember
.
getMemberConfigId
()));
//总金额乘以折扣比例除以100
//总金额乘以折扣比例除以100
priceResponse
.
setPayFee
(
priceResponse
.
getPayFee
().
multiply
(
memberConfig
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
)));
priceResponse
.
setPayFee
(
priceResponse
.
getPayFee
().
multiply
(
memberConfig
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
)));
...
@@ -1943,6 +1949,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1943,6 +1949,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse
.
setDiscountRatio
(
new
BigDecimal
(
0
));
priceResponse
.
setDiscountRatio
(
new
BigDecimal
(
0
));
}
}
}
}
}
}
else
{
}
else
{
// 判断优惠券是否可以使用
// 判断优惠券是否可以使用
if
(
Objects
.
nonNull
(
user
)
&&
Objects
.
nonNull
(
request
.
getCouponId
()))
{
if
(
Objects
.
nonNull
(
user
)
&&
Objects
.
nonNull
(
request
.
getCouponId
()))
{
...
...
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