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
8c855714
Commit
8c855714
authored
Aug 02, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改退款日志
parent
2d91f978
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
150 additions
and
118 deletions
+150
-118
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+150
-118
No files found.
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
8c855714
...
...
@@ -1185,6 +1185,156 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
private
void
refundExtracted
(
ConsumerWallet
consumerWallet
,
SOrder
sOrder
,
ConsumerMember
consumerMember
)
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerWallet
))
{
if
(
ObjectUtil
.
isNotEmpty
(
sOrder
.
getDuration
())
&&
sOrder
.
getDuration
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
DurationLog
durationLog
=
new
DurationLog
();
durationLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
durationLog
.
setVariableDuration
(
sOrder
.
getDuration
());
durationLog
.
setCurrentDuration
(
consumerWallet
.
getRemainingDuration
());
durationLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
durationLog
.
setOperationTime
(
new
Date
());
durationLogService
.
save
(
durationLog
);
consumerWallet
.
setRemainingDuration
(
consumerWallet
.
getRemainingDuration
().
add
(
sOrder
.
getDuration
()));
consumerWalletService
.
updateById
(
consumerWallet
);
}
if
(
ObjectUtil
.
isNotEmpty
(
sOrder
.
getBalance
())
&&
sOrder
.
getBalance
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
BalanceLog
balanceLog
=
new
BalanceLog
();
balanceLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
balanceLog
.
setVariableAmount
(
sOrder
.
getBalance
());
balanceLog
.
setCurrentBalance
(
consumerWallet
.
getBalance
());
balanceLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
balanceLog
.
setOperationTime
(
new
Date
());
balanceLogService
.
save
(
balanceLog
);
consumerWallet
.
setBalance
(
consumerWallet
.
getBalance
().
add
(
sOrder
.
getBalance
()));
consumerWalletService
.
updateById
(
consumerWallet
);
}
}
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
// if (consumerMember.getMemberType().equals(MemberTypeEnum.RECHARGE.getIndex())) {
// IntegralLog integralLog = new IntegralLog();
// integralLog.setConsumerId(sOrder.getConsumerId());
// integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral());
// BigDecimal integral = consumerWallet.getRemainingIntegral().subtract(sOrder.getBalance());
// consumerWallet.setRemainingIntegral(integral);
// integralLog.setVariableIntegral(sOrder.getBalance());
// integralLog.setOperationType(YesNoEnum.no.getIndex());
// integralLog.setOperationTime(new Date());
// integralLogService.save(integralLog);
// consumerWalletService.updateById(consumerWallet);
// MemberProgressLog memberProgressLog = new MemberProgressLog();
// memberProgressLog.setConsumerId(sOrder.getConsumerId());
// memberProgressLog.setCurrentProgress(consumerMember.getMembershipProgress());
// BigDecimal membershipProgress = consumerMember.getMembershipProgress().subtract(sOrder.getBalance());
// //查询当前会员类型和当前等级的会员配置
// MemberConfig one = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
// .eq(MemberConfig::getMemberType, consumerMember.getMemberType())
// .eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
//
// if (ObjectUtil.isNotEmpty(one)) {
// //判断是否升级
// if (membershipProgress.compareTo(BigDecimal.valueOf(one.getLimitRequirements())) < 0) {
// consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1L);
// 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(sOrder.getBalance());
// consumerMember.setMembershipProgress(membershipProgress);
// memberProgressLog.setOperationType(YesNoEnum.no.getIndex());
// memberProgressLog.setOperationTime(new Date());
// Long validityPeriod = memberConfigService.getById(consumerMember.getMemberConfigId()).getValidityPeriod();
// memberProgressLog.setExpirationTime(DateUtils.addYears(new Date(), validityPeriod.intValue()));
// memberProgressLogService.save(memberProgressLog);
// consumerMemberService.updateConsumerMember(consumerMember);
// } else if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
SConsumerCoupon
coupon
=
consumerCouponService
.
getById
(
sOrder
.
getCouponId
());
IntegralLog
integralLog
=
new
IntegralLog
();
integralLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
integralLog
.
setCurrentIntegral
(
consumerWallet
.
getRemainingIntegral
());
BigDecimal
integral
;
BigDecimal
membershipProgress
;
if
(
ObjectUtil
.
isNotEmpty
(
coupon
)
&&
!
coupon
.
getPlatformType
().
equals
(
PlatformTypeEnum
.
SELF
.
getCode
())
&&
coupon
.
getCouponType
().
equals
(
CouponTypeEnum
.
CASH
.
getCode
()))
{
integral
=
consumerWallet
.
getRemainingIntegral
()
.
subtract
(
sOrder
.
getBalance
()).
subtract
(
coupon
.
getCouponPayPrice
());
membershipProgress
=
consumerMember
.
getMembershipProgress
()
.
subtract
(
sOrder
.
getBalance
()).
subtract
(
coupon
.
getCouponPayPrice
());
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
RIGHTS
.
getIndex
()))
{
integral
=
integral
.
subtract
(
sOrder
.
getPayPrice
());
membershipProgress
=
membershipProgress
.
subtract
(
sOrder
.
getPayPrice
());
}
}
else
{
integral
=
consumerWallet
.
getRemainingIntegral
().
subtract
(
sOrder
.
getBalance
());
membershipProgress
=
consumerMember
.
getMembershipProgress
().
subtract
(
sOrder
.
getBalance
());
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
RIGHTS
.
getIndex
()))
{
integral
=
integral
.
subtract
(
sOrder
.
getPayPrice
());
membershipProgress
=
membershipProgress
.
subtract
(
sOrder
.
getPayPrice
());
}
}
integralLog
.
setVariableIntegral
(
consumerWallet
.
getRemainingIntegral
().
subtract
(
integral
));
consumerWallet
.
setRemainingIntegral
(
integral
);
integralLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
integralLog
.
setOperationTime
(
new
Date
());
integralLogService
.
save
(
integralLog
);
consumerWalletService
.
updateById
(
consumerWallet
);
MemberProgressLog
memberProgressLog
=
new
MemberProgressLog
();
memberProgressLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
memberProgressLog
.
setCurrentProgress
(
consumerMember
.
getMembershipProgress
());
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
NORMAL
.
getIndex
()))
{
if
(
consumerMember
.
getIsRecharge
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
consumerMember
.
setMemberType
(
MemberTypeEnum
.
RECHARGE
.
getIndex
());
MemberConfig
one
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMemberType
,
consumerMember
.
getMemberType
())
.
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
()
-
1L
));
if
(
membershipProgress
.
compareTo
(
BigDecimal
.
valueOf
(
one
.
getLimitRequirements
()))
<
0
)
{
consumerMember
.
setMembershipLevel
(
consumerMember
.
getMembershipLevel
()
-
1L
);
consumerMember
.
setMemberConfigId
(
one
.
getId
());
}
}
else
if
(
consumerMember
.
getIsRights
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
consumerMember
.
setMemberType
(
MemberTypeEnum
.
RIGHTS
.
getIndex
());
MemberConfig
one
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMemberType
,
consumerMember
.
getMemberType
())
.
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
()
-
1L
));
if
(
membershipProgress
.
compareTo
(
BigDecimal
.
valueOf
(
one
.
getLimitRequirements
()))
<
0
)
{
consumerMember
.
setMembershipLevel
(
consumerMember
.
getMembershipLevel
()
-
1L
);
consumerMember
.
setMemberConfigId
(
one
.
getId
());
}
}
}
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
(
BigDecimal
.
valueOf
(
one
.
getLimitRequirements
()))
<
0
)
{
consumerMember
.
setMembershipLevel
(
consumerMember
.
getMembershipLevel
()
-
1L
);
consumerMember
.
setMemberConfigId
(
one
.
getId
());
}
}
}
memberProgressLog
.
setVariableProgress
(
consumerMember
.
getMembershipProgress
().
subtract
(
membershipProgress
));
consumerMember
.
setMembershipProgress
(
membershipProgress
);
memberProgressLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
memberProgressLog
.
setOperationTime
(
new
Date
());
memberProgressLog
.
setCreateTime
(
new
Date
());
Long
validityPeriod
=
memberConfigService
.
getById
(
consumerMember
.
getMemberConfigId
()).
getValidityPeriod
();
memberProgressLog
.
setExpirationTime
(
DateUtils
.
addYears
(
new
Date
(),
validityPeriod
.
intValue
()));
if
(!
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
NORMAL
.
getIndex
()))
{
memberProgressLogService
.
save
(
memberProgressLog
);
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
}
}
// }
}
private
String
lockOrder
(
CreateOrderRequest
request
)
throws
BaseException
{
try
{
//自旋10次,每次等待1秒
...
...
@@ -1894,125 +2044,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
return
Boolean
.
TRUE
;
}
private
void
refundExtracted
(
ConsumerWallet
consumerWallet
,
SOrder
sOrder
,
ConsumerMember
consumerMember
)
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerWallet
))
{
if
(
ObjectUtil
.
isNotEmpty
(
sOrder
.
getDuration
())
&&
sOrder
.
getDuration
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
DurationLog
durationLog
=
new
DurationLog
();
durationLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
durationLog
.
setVariableDuration
(
sOrder
.
getDuration
());
durationLog
.
setCurrentDuration
(
consumerWallet
.
getRemainingDuration
());
durationLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
durationLog
.
setOperationTime
(
new
Date
());
durationLogService
.
save
(
durationLog
);
consumerWallet
.
setRemainingDuration
(
consumerWallet
.
getRemainingDuration
().
add
(
sOrder
.
getDuration
()));
consumerWalletService
.
updateById
(
consumerWallet
);
}
if
(
ObjectUtil
.
isNotEmpty
(
sOrder
.
getBalance
())
&&
sOrder
.
getBalance
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
BalanceLog
balanceLog
=
new
BalanceLog
();
balanceLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
balanceLog
.
setVariableAmount
(
sOrder
.
getBalance
());
balanceLog
.
setCurrentBalance
(
consumerWallet
.
getBalance
());
balanceLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
balanceLog
.
setOperationTime
(
new
Date
());
balanceLogService
.
save
(
balanceLog
);
consumerWallet
.
setBalance
(
consumerWallet
.
getBalance
().
add
(
sOrder
.
getBalance
()));
consumerWalletService
.
updateById
(
consumerWallet
);
}
}
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
RECHARGE
.
getIndex
()))
{
IntegralLog
integralLog
=
new
IntegralLog
();
integralLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
integralLog
.
setCurrentIntegral
(
consumerWallet
.
getRemainingIntegral
());
BigDecimal
integral
=
consumerWallet
.
getRemainingIntegral
().
subtract
(
sOrder
.
getBalance
());
consumerWallet
.
setRemainingIntegral
(
integral
);
integralLog
.
setVariableIntegral
(
sOrder
.
getBalance
());
integralLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
integralLog
.
setOperationTime
(
new
Date
());
integralLogService
.
save
(
integralLog
);
consumerWalletService
.
updateById
(
consumerWallet
);
MemberProgressLog
memberProgressLog
=
new
MemberProgressLog
();
memberProgressLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
memberProgressLog
.
setCurrentProgress
(
consumerMember
.
getMembershipProgress
());
BigDecimal
membershipProgress
=
consumerMember
.
getMembershipProgress
().
subtract
(
sOrder
.
getBalance
());
//查询当前会员类型和当前等级的会员配置
MemberConfig
one
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMemberType
,
consumerMember
.
getMemberType
())
.
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
()));
if
(
ObjectUtil
.
isNotEmpty
(
one
))
{
//判断是否升级
if
(
membershipProgress
.
compareTo
(
BigDecimal
.
valueOf
(
one
.
getLimitRequirements
()))
<
0
)
{
consumerMember
.
setMembershipLevel
(
consumerMember
.
getMembershipLevel
()
-
1L
);
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
(
sOrder
.
getBalance
());
consumerMember
.
setMembershipProgress
(
membershipProgress
);
memberProgressLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
memberProgressLog
.
setOperationTime
(
new
Date
());
Long
validityPeriod
=
memberConfigService
.
getById
(
consumerMember
.
getMemberConfigId
()).
getValidityPeriod
();
memberProgressLog
.
setExpirationTime
(
DateUtils
.
addYears
(
new
Date
(),
validityPeriod
.
intValue
()));
memberProgressLogService
.
save
(
memberProgressLog
);
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
}
else
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
RIGHTS
.
getIndex
()))
{
SConsumerCoupon
coupon
=
consumerCouponService
.
getById
(
sOrder
.
getCouponId
());
IntegralLog
integralLog
=
new
IntegralLog
();
integralLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
integralLog
.
setCurrentIntegral
(
consumerWallet
.
getRemainingIntegral
());
BigDecimal
integral
;
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
());
}
else
{
integral
=
consumerWallet
.
getRemainingIntegral
().
subtract
(
sOrder
.
getPayPrice
()).
subtract
(
sOrder
.
getBalance
());
membershipProgress
=
consumerMember
.
getMembershipProgress
().
subtract
(
sOrder
.
getPayPrice
()).
subtract
(
sOrder
.
getBalance
());
}
integralLog
.
setVariableIntegral
(
consumerWallet
.
getRemainingIntegral
().
subtract
(
integral
));
consumerWallet
.
setRemainingIntegral
(
integral
);
integralLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
integralLog
.
setOperationTime
(
new
Date
());
integralLogService
.
save
(
integralLog
);
consumerWalletService
.
updateById
(
consumerWallet
);
MemberProgressLog
memberProgressLog
=
new
MemberProgressLog
();
memberProgressLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
memberProgressLog
.
setCurrentProgress
(
consumerMember
.
getMembershipProgress
());
//查询当前会员类型和下一级的会员配置
MemberConfig
one
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMemberType
,
consumerMember
.
getMemberType
())
.
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
()));
if
(
ObjectUtil
.
isNotEmpty
(
one
))
{
//判断是否升级
if
(
membershipProgress
.
compareTo
(
BigDecimal
.
valueOf
(
one
.
getLimitRequirements
()))
<
0
)
{
consumerMember
.
setMembershipLevel
(
consumerMember
.
getMembershipLevel
()
-
1L
);
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
(
membershipProgress
));
consumerMember
.
setMembershipProgress
(
membershipProgress
);
memberProgressLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
memberProgressLog
.
setOperationTime
(
new
Date
());
Long
validityPeriod
=
memberConfigService
.
getById
(
consumerMember
.
getMemberConfigId
()).
getValidityPeriod
();
memberProgressLog
.
setExpirationTime
(
DateUtils
.
addYears
(
new
Date
(),
validityPeriod
.
intValue
()));
memberProgressLogService
.
save
(
memberProgressLog
);
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
}
}
}
@Override
public
List
<
SOrder
>
payedUnrefundListByUserId
(
Long
userId
)
{
...
...
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