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
8e8eda65
Commit
8e8eda65
authored
Oct 12, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加赠送时长接口
parent
84281c5c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
0 deletions
+64
-0
ConsumerWalletController.java
...share/web/controller/system/ConsumerWalletController.java
+8
-0
ConsumerWalletService.java
...main/java/share/system/service/ConsumerWalletService.java
+2
-0
ConsumerWalletServiceImpl.java
.../share/system/service/impl/ConsumerWalletServiceImpl.java
+54
-0
No files found.
share-admin/src/main/java/share/web/controller/system/ConsumerWalletController.java
View file @
8e8eda65
...
@@ -89,4 +89,12 @@ public class ConsumerWalletController extends BaseController {
...
@@ -89,4 +89,12 @@ public class ConsumerWalletController extends BaseController {
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
consumerWalletService
.
deleteConsumerWalletByIds
(
ids
));
return
toAjax
(
consumerWalletService
.
deleteConsumerWalletByIds
(
ids
));
}
}
/**
* 赠送时长
*/
@PostMapping
(
"/giveDuration"
)
public
AjaxResult
giveDuration
(
@RequestBody
ConsumerWallet
consumerWallet
)
{
return
toAjax
(
consumerWalletService
.
giveDuration
(
consumerWallet
));
}
}
}
share-system/src/main/java/share/system/service/ConsumerWalletService.java
View file @
8e8eda65
...
@@ -70,4 +70,6 @@ public interface ConsumerWalletService extends IService<ConsumerWallet> {
...
@@ -70,4 +70,6 @@ public interface ConsumerWalletService extends IService<ConsumerWallet> {
boolean
editConsumerWallet
(
ConsumerWallet
consumerWallet
,
Recharge
recharge
,
ConsumerMember
one
);
boolean
editConsumerWallet
(
ConsumerWallet
consumerWallet
,
Recharge
recharge
,
ConsumerMember
one
);
void
accumulatedConsumptionStatistics
(
Long
consumerId
);
void
accumulatedConsumptionStatistics
(
Long
consumerId
);
int
giveDuration
(
ConsumerWallet
consumerWallet
);
}
}
share-system/src/main/java/share/system/service/impl/ConsumerWalletServiceImpl.java
View file @
8e8eda65
...
@@ -471,4 +471,58 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
...
@@ -471,4 +471,58 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
MemberConfig
memberConfig
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>().
eq
(
MemberConfig:
:
getMembershipLevel
,
one
.
getMembershipLevel
()));
MemberConfig
memberConfig
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>().
eq
(
MemberConfig:
:
getMembershipLevel
,
one
.
getMembershipLevel
()));
accumulatedConsumptionStatistics
(
consumerWallet
,
one
,
memberConfig
);
accumulatedConsumptionStatistics
(
consumerWallet
,
one
,
memberConfig
);
}
}
@Override
public
int
giveDuration
(
ConsumerWallet
consumerWallet
)
{
ConsumerWallet
oldConsumerWallet
=
consumerWalletService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerWallet
>().
eq
(
ConsumerWallet:
:
getConsumerId
,
consumerWallet
.
getConsumerId
()));
ConsumerMember
oldConsumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
consumerWallet
.
getConsumerId
()));
if
(
ObjectUtil
.
isNotEmpty
(
oldConsumerWallet
)
&&
ObjectUtil
.
isNotEmpty
(
oldConsumerMember
))
{
DurationLog
durationLog
=
new
DurationLog
();
durationLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
durationLog
.
setCurrentDuration
(
oldConsumerWallet
.
getRemainingDuration
());
durationLog
.
setVariableDuration
(
consumerWallet
.
getRemainingDuration
());
durationLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
durationLog
.
setOperationTime
(
new
Date
());
durationLog
.
setCreateTime
(
new
Date
());
oldConsumerWallet
.
setRemainingDuration
(
oldConsumerWallet
.
getRemainingDuration
().
add
(
consumerWallet
.
getRemainingDuration
()));
durationLogService
.
save
(
durationLog
);
consumerWalletService
.
updateById
(
oldConsumerWallet
);
return
1
;
}
else
{
ConsumerWallet
newConsumerWallet
=
new
ConsumerWallet
();
newConsumerWallet
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
newConsumerWallet
.
setBalance
(
BigDecimal
.
ZERO
);
newConsumerWallet
.
setRechargeAmount
(
BigDecimal
.
ZERO
);
newConsumerWallet
.
setGiftAmount
(
BigDecimal
.
ZERO
);
newConsumerWallet
.
setRemainingDuration
(
BigDecimal
.
ZERO
);
DurationLog
durationLog
=
new
DurationLog
();
durationLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
durationLog
.
setCurrentDuration
(
newConsumerWallet
.
getRemainingDuration
());
durationLog
.
setVariableDuration
(
consumerWallet
.
getRemainingDuration
());
durationLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
durationLog
.
setOperationTime
(
new
Date
());
durationLog
.
setCreateTime
(
new
Date
());
newConsumerWallet
.
setRemainingDuration
(
newConsumerWallet
.
getRemainingDuration
().
add
(
consumerWallet
.
getRemainingDuration
()));
newConsumerWallet
.
setRemainingIntegral
(
BigDecimal
.
ZERO
);
newConsumerWallet
.
setEquityFund
(
BigDecimal
.
ZERO
);
newConsumerWallet
.
setAccumulateEquityFund
(
BigDecimal
.
ZERO
);
newConsumerWallet
.
setCreateTime
(
new
Date
());
ConsumerMember
newConsumerMember
=
new
ConsumerMember
();
newConsumerMember
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
newConsumerMember
.
setMembershipLevel
(
0L
);
String
rechargeMembershipExpirationTime
=
sysConfigService
.
selectConfigByKey
(
"rechargeMembershipExpirationTime"
);
newConsumerMember
.
setExpirationDate
(
DateUtils
.
addYears
(
new
Date
(),
Integer
.
parseInt
(
rechargeMembershipExpirationTime
)));
newConsumerMember
.
setMembershipProgress
(
BigDecimal
.
ZERO
);
newConsumerMember
.
setIsRecharge
(
YesNoEnum
.
no
.
getIndex
());
newConsumerMember
.
setIsRights
(
YesNoEnum
.
no
.
getIndex
());
newConsumerMember
.
setCreateTime
(
new
Date
());
consumerWalletService
.
save
(
newConsumerWallet
);
durationLogService
.
save
(
durationLog
);
consumerMemberService
.
save
(
newConsumerMember
);
return
1
;
}
}
}
}
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