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
e3d95941
Commit
e3d95941
authored
Jul 22, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
会员进度日志表增加过期时间
parent
f677c315
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
158 additions
and
74 deletions
+158
-74
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+71
-3
MemberProgressLog.java
.../src/main/java/share/system/domain/MemberProgressLog.java
+5
-20
ConsumerWalletServiceImpl.java
.../share/system/service/impl/ConsumerWalletServiceImpl.java
+15
-11
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+61
-40
MemberProgressLogMapper.xml
.../main/resources/mapper/system/MemberProgressLogMapper.xml
+6
-0
No files found.
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
e3d95941
...
@@ -24,6 +24,7 @@ import share.common.constant.MqttConstants;
...
@@ -24,6 +24,7 @@ import share.common.constant.MqttConstants;
import
share.common.core.redis.RedisUtil
;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.*
;
import
share.common.enums.*
;
import
share.common.exception.base.BaseException
;
import
share.common.exception.base.BaseException
;
import
share.common.utils.DateUtils
;
import
share.system.domain.*
;
import
share.system.domain.*
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.service.*
;
import
share.system.service.*
;
...
@@ -92,6 +93,15 @@ public class RedisTask {
...
@@ -92,6 +93,15 @@ public class RedisTask {
@Autowired
@Autowired
private
SConsumerTokenService
sConsumerTokenService
;
private
SConsumerTokenService
sConsumerTokenService
;
@Autowired
private
ConsumerMemberService
consumerMemberService
;
@Autowired
private
ConsumerWalletService
consumerWalletService
;
@Autowired
private
MemberProgressLogService
memberProgressLogService
;
//15分钟的常量
//15分钟的常量
final
long
FIFTEEN_MINUTES
=
60
*
15
;
final
long
FIFTEEN_MINUTES
=
60
*
15
;
...
@@ -103,8 +113,8 @@ public class RedisTask {
...
@@ -103,8 +113,8 @@ public class RedisTask {
final
long
FOUR_MINUTES
=
60
*
4
;
final
long
FOUR_MINUTES
=
60
*
4
;
//1分钟的常量
//1分钟的常量
final
long
ONE_MINUTES
=
60
;
final
long
ONE_MINUTES
=
60
;
final
long
FOUR_DAY
=
60
*
24
*
4
;
final
long
THREE_DAY
=
60
*
24
*
3
;
final
long
THREE_DAY
=
60
*
24
*
3
;
final
long
TWO_DAY
=
60
*
24
*
2
;
/**
/**
...
@@ -459,7 +469,7 @@ public class RedisTask {
...
@@ -459,7 +469,7 @@ public class RedisTask {
});
});
}
}
public
void
AutoEquityMembers
()
{
public
void
AutoEquityMembers
Sms
()
{
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
EQUITY_MEMBERS_TIME
+
"*"
);
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
EQUITY_MEMBERS_TIME
+
"*"
);
if
(
keys
.
size
()
==
0
)
{
if
(
keys
.
size
()
==
0
)
{
return
;
return
;
...
@@ -471,13 +481,71 @@ public class RedisTask {
...
@@ -471,13 +481,71 @@ public class RedisTask {
Long
consumerId
=
jsonObject
.
getLong
(
"consumerId"
);
Long
consumerId
=
jsonObject
.
getLong
(
"consumerId"
);
//判断当前的日期是否在第3天和第2天中
//判断当前的日期是否在第3天和第2天中
long
expire
=
(
expirationTime
.
getTime
()
-
new
Date
().
getTime
())
/
1000
/
60
/
60
;
long
expire
=
(
expirationTime
.
getTime
()
-
new
Date
().
getTime
())
/
1000
/
60
/
60
;
if
(
T
WO_DAY
<
expire
&&
expire
<
THREE
_DAY
)
{
if
(
T
HREE_DAY
<
expire
&&
expire
<
FOUR
_DAY
)
{
SConsumer
sConsumer
=
sConsumerService
.
getById
(
consumerId
);
SConsumer
sConsumer
=
sConsumerService
.
getById
(
consumerId
);
logger
.
debug
(
"手机号为:{}的用户年度权益会员将在3天后失效"
,
sConsumer
.
getPhone
());
smsService
.
sendOneSms
(
sConsumer
.
getPhone
(),
"年度权益会员将在3天后失效,请及时续约保障权益会员的权益"
);
smsService
.
sendOneSms
(
sConsumer
.
getPhone
(),
"年度权益会员将在3天后失效,请及时续约保障权益会员的权益"
);
}
}
});
});
}
}
//权益会员降级
public
void
AutoUpdateEquityMembers
()
{
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
EQUITY_MEMBERS_TIME
+
"*"
);
if
(
keys
.
size
()
==
0
)
{
return
;
}
keys
.
stream
().
forEach
(
key
->
{
String
value
=
redisUtil
.
get
(
String
.
valueOf
(
key
));
JSONObject
jsonObject
=
new
JSONObject
(
value
);
Date
expirationTime
=
jsonObject
.
getDate
(
"expirationTime"
);
Long
consumerId
=
jsonObject
.
getLong
(
"consumerId"
);
if
(
expirationTime
.
getTime
()
<
new
Date
().
getTime
())
{
ConsumerWallet
consumerWallet
=
consumerWalletService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerWallet
>().
eq
(
ConsumerWallet:
:
getConsumerId
,
consumerId
));
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
consumerId
));
if
(
ObjectUtil
.
isNotEmpty
(
consumerWallet
))
{
consumerMember
.
setMemberType
(
MemberTypeEnum
.
RECHARGE
.
getIndex
());
}
else
{
consumerMember
.
setMemberType
(
MemberTypeEnum
.
NORMAL
.
getIndex
());
}
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
}
});
}
public
void
AutoProgressLog
()
{
//查询1年之前的数据
List
<
MemberProgressLog
>
list
=
memberProgressLogService
.
list
(
new
LambdaQueryWrapper
<
MemberProgressLog
>()
.
gt
(
MemberProgressLog:
:
getCreateTime
,
DateUtils
.
addYears
(
new
Date
(),
-
1
))
);
list
.
sort
(
Comparator
.
comparing
(
MemberProgressLog:
:
getOperationType
).
reversed
());
//获得list的consumerId
List
<
Long
>
consumerIds
=
list
.
stream
().
map
(
MemberProgressLog:
:
getConsumerId
).
distinct
().
collect
(
Collectors
.
toList
());
//按照consumerId进行分组
Map
<
Long
,
List
<
MemberProgressLog
>>
collect
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
MemberProgressLog:
:
getConsumerId
));
consumerIds
.
stream
().
forEach
(
item
->
{
List
<
MemberProgressLog
>
memberProgressLogs
=
collect
.
get
(
item
);
if
(
memberProgressLogs
.
size
()
>
1
)
{
final
BigDecimal
[]
sum
=
{
new
BigDecimal
(
100
)};
memberProgressLogs
.
stream
().
forEach
(
log
->
{
if
(
log
.
getOperationType
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
sum
[
0
]
=
sum
[
0
].
subtract
(
log
.
getVariableProgress
());
}
else
if
(
log
.
getOperationType
().
equals
(
YesNoEnum
.
no
.
getIndex
()))
{
sum
[
0
]
=
sum
[
0
].
add
(
log
.
getVariableProgress
());
}
});
sum
[
0
].
subtract
(
new
BigDecimal
(
100
));
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
item
));
if
(
consumerMember
.
getMembershipProgress
().
compareTo
(
sum
[
0
])
>=
0
)
{
consumerMember
.
setMembershipProgress
(
consumerMember
.
getMembershipProgress
().
subtract
(
sum
[
0
]));
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
}
}
});
}
public
void
AutoAddRoomLabel
()
{
public
void
AutoAddRoomLabel
()
{
List
<
RoomLabel
>
roomLabelList
=
roomLabelService
.
list
();
List
<
RoomLabel
>
roomLabelList
=
roomLabelService
.
list
();
//获取roomLabelList中的roomId,去重
//获取roomLabelList中的roomId,去重
...
...
share-system/src/main/java/share/system/domain/MemberProgressLog.java
View file @
e3d95941
...
@@ -3,8 +3,6 @@ package share.system.domain;
...
@@ -3,8 +3,6 @@ package share.system.domain;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
share.common.core.domain.BaseEntity
;
...
@@ -59,6 +57,11 @@ public class MemberProgressLog extends BaseEntity {
...
@@ -59,6 +57,11 @@ public class MemberProgressLog extends BaseEntity {
@Excel
(
name
=
"操作时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"操作时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
operationTime
;
private
Date
operationTime
;
//过期时间
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Excel
(
name
=
"过期时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
expirationTime
;
/**
/**
* 是否删除
* 是否删除
*/
*/
...
@@ -67,22 +70,4 @@ public class MemberProgressLog extends BaseEntity {
...
@@ -67,22 +70,4 @@ public class MemberProgressLog extends BaseEntity {
@TableField
(
select
=
false
)
@TableField
(
select
=
false
)
private
Long
isDelete
;
private
Long
isDelete
;
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"consumerId"
,
getConsumerId
())
.
append
(
"variableProgress"
,
getVariableProgress
())
.
append
(
"currentProgress"
,
getCurrentProgress
())
.
append
(
"operationType"
,
getOperationType
())
.
append
(
"operationTime"
,
getOperationTime
())
.
append
(
"isDelete"
,
getIsDelete
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"remark"
,
getRemark
())
.
toString
();
}
}
}
share-system/src/main/java/share/system/service/impl/ConsumerWalletServiceImpl.java
View file @
e3d95941
...
@@ -129,6 +129,8 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
...
@@ -129,6 +129,8 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
@Override
@Override
public
boolean
addConsumerWallet
(
ConsumerWallet
consumerWallet
)
{
public
boolean
addConsumerWallet
(
ConsumerWallet
consumerWallet
)
{
int
i
=
consumerWalletMapper
.
insertConsumerWallet
(
consumerWallet
);
int
i
=
consumerWalletMapper
.
insertConsumerWallet
(
consumerWallet
);
ConsumerMember
one
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
consumerWallet
.
getConsumerId
()));
MemberConfig
memberConfig
=
memberConfigService
.
getById
(
one
.
getMemberConfigId
());
if
(
consumerWallet
.
getBalance
().
compareTo
(
new
BigDecimal
(
0
))
>
0
)
{
if
(
consumerWallet
.
getBalance
().
compareTo
(
new
BigDecimal
(
0
))
>
0
)
{
BalanceLog
balanceLog
=
new
BalanceLog
();
BalanceLog
balanceLog
=
new
BalanceLog
();
balanceLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
balanceLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
...
@@ -165,6 +167,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
...
@@ -165,6 +167,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
memberProgressLog
.
setOperationTime
(
new
Date
());
memberProgressLog
.
setOperationTime
(
new
Date
());
memberProgressLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
memberProgressLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
memberProgressLog
.
setCreateTime
(
new
Date
());
memberProgressLog
.
setCreateTime
(
new
Date
());
memberProgressLog
.
setExpirationTime
(
DateUtils
.
addYears
(
new
Date
(),
memberConfig
.
getValidityPeriod
().
intValue
()));
memberProgressLogService
.
save
(
memberProgressLog
);
memberProgressLogService
.
save
(
memberProgressLog
);
}
}
return
i
==
1
;
return
i
==
1
;
...
@@ -194,7 +197,18 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
...
@@ -194,7 +197,18 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
}
}
int
i
=
updateConsumerWallet
(
consumerWallet
);
int
i
=
updateConsumerWallet
(
consumerWallet
);
//查询当前会员类型和下一级的会员配置
MemberConfig
memberConfigServiceOne
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMemberType
,
one
.
getMemberType
())
.
eq
(
MemberConfig:
:
getMembershipLevel
,
one
.
getMembershipLevel
()
+
1L
));
if
(
ObjectUtil
.
isNotEmpty
(
memberConfigServiceOne
))
{
//判断是否升级
if
(
one
.
getMembershipProgress
().
compareTo
(
BigDecimal
.
valueOf
(
memberConfigServiceOne
.
getLimitRequirements
()))
>=
0
)
{
one
.
setMembershipLevel
(
one
.
getMembershipLevel
()
+
1L
);
one
.
setMemberConfigId
(
one
.
getId
());
}
}
if
(
consumerWallet
.
getBalance
().
compareTo
(
new
BigDecimal
(
0
))
>
0
)
{
if
(
consumerWallet
.
getBalance
().
compareTo
(
new
BigDecimal
(
0
))
>
0
)
{
BalanceLog
balanceLog
=
new
BalanceLog
();
BalanceLog
balanceLog
=
new
BalanceLog
();
balanceLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
balanceLog
.
setConsumerId
(
consumerWallet
.
getConsumerId
());
...
@@ -234,21 +248,11 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
...
@@ -234,21 +248,11 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
memberProgressLog
.
setOperationTime
(
new
Date
());
memberProgressLog
.
setOperationTime
(
new
Date
());
memberProgressLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
memberProgressLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
memberProgressLog
.
setCreateTime
(
new
Date
());
memberProgressLog
.
setCreateTime
(
new
Date
());
memberProgressLog
.
setExpirationTime
(
DateUtils
.
addYears
(
new
Date
(),
memberConfigService
.
getById
(
one
.
getConsumerId
()).
getValidityPeriod
().
intValue
()));
memberProgressLogService
.
save
(
memberProgressLog
);
memberProgressLogService
.
save
(
memberProgressLog
);
one
.
setMembershipProgress
(
one
.
getMembershipProgress
().
add
(
divide
));
one
.
setMembershipProgress
(
one
.
getMembershipProgress
().
add
(
divide
));
}
}
//查询当前会员类型和下一级的会员配置
MemberConfig
memberConfigServiceOne
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMemberType
,
one
.
getMemberType
())
.
eq
(
MemberConfig:
:
getMembershipLevel
,
one
.
getMembershipLevel
()
+
1L
));
if
(
ObjectUtil
.
isNotEmpty
(
memberConfigServiceOne
))
{
//判断是否升级
if
(
one
.
getMembershipProgress
().
compareTo
(
BigDecimal
.
valueOf
(
memberConfigServiceOne
.
getLimitRequirements
()))
>=
0
)
{
one
.
setMembershipLevel
(
one
.
getMembershipLevel
()
+
1L
);
one
.
setMemberConfigId
(
one
.
getId
());
}
}
consumerMemberService
.
updateConsumerMember
(
one
);
consumerMemberService
.
updateConsumerMember
(
one
);
return
i
==
1
;
return
i
==
1
;
}
}
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
e3d95941
...
@@ -1049,6 +1049,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1049,6 +1049,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
durationLog
.
setCurrentDuration
(
consumerWallet
.
getRemainingDuration
());
durationLog
.
setCurrentDuration
(
consumerWallet
.
getRemainingDuration
());
durationLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
durationLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
durationLog
.
setOperationTime
(
new
Date
());
durationLog
.
setOperationTime
(
new
Date
());
durationLog
.
setCreateTime
(
new
Date
());
durationLogService
.
save
(
durationLog
);
durationLogService
.
save
(
durationLog
);
consumerWallet
.
setRemainingDuration
(
consumerWallet
.
getRemainingDuration
().
subtract
(
sOrder
.
getDuration
()));
consumerWallet
.
setRemainingDuration
(
consumerWallet
.
getRemainingDuration
().
subtract
(
sOrder
.
getDuration
()));
consumerWalletService
.
updateById
(
consumerWallet
);
consumerWalletService
.
updateById
(
consumerWallet
);
...
@@ -1060,46 +1061,49 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1060,46 +1061,49 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
balanceLog
.
setCurrentBalance
(
consumerWallet
.
getBalance
());
balanceLog
.
setCurrentBalance
(
consumerWallet
.
getBalance
());
balanceLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
balanceLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
balanceLog
.
setOperationTime
(
new
Date
());
balanceLog
.
setOperationTime
(
new
Date
());
balanceLog
.
setCreateTime
(
new
Date
());
balanceLogService
.
save
(
balanceLog
);
balanceLogService
.
save
(
balanceLog
);
consumerWallet
.
setBalance
(
consumerWallet
.
getBalance
().
subtract
(
sOrder
.
getBalance
()));
consumerWallet
.
setBalance
(
consumerWallet
.
getBalance
().
subtract
(
sOrder
.
getBalance
()));
consumerWalletService
.
updateById
(
consumerWallet
);
consumerWalletService
.
updateById
(
consumerWallet
);
}
}
}
}
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
RECHARGE
.
getIndex
()))
{
// if (consumerMember.getMemberType().equals(MemberTypeEnum.RECHARGE.getIndex())) {
IntegralLog
integralLog
=
new
IntegralLog
();
// IntegralLog integralLog = new IntegralLog();
integralLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
// integralLog.setConsumerId(sOrder.getConsumerId());
integralLog
.
setCurrentIntegral
(
consumerWallet
.
getRemainingIntegral
());
// integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral());
BigDecimal
integral
=
consumerWallet
.
getRemainingIntegral
().
add
(
sOrder
.
getBalance
());
// BigDecimal integral = consumerWallet.getRemainingIntegral().add(sOrder.getBalance());
consumerWallet
.
setRemainingIntegral
(
integral
);
// consumerWallet.setRemainingIntegral(integral);
integralLog
.
setVariableIntegral
(
sOrder
.
getBalance
());
// integralLog.setVariableIntegral(sOrder.getBalance());
integralLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
// integralLog.setOperationType(YesNoEnum.yes.getIndex());
integralLog
.
setOperationTime
(
new
Date
());
// integralLog.setOperationTime(new Date());
integralLogService
.
save
(
integralLog
);
// integralLog.setCreateTime(new Date());
consumerWalletService
.
updateById
(
consumerWallet
);
// integralLogService.save(integralLog);
MemberProgressLog
memberProgressLog
=
new
MemberProgressLog
();
// consumerWalletService.updateById(consumerWallet);
memberProgressLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
// MemberProgressLog memberProgressLog = new MemberProgressLog();
memberProgressLog
.
setCurrentProgress
(
consumerMember
.
getMembershipProgress
());
// memberProgressLog.setConsumerId(sOrder.getConsumerId());
Long
membershipProgress
=
sOrder
.
getBalance
().
add
(
consumerMember
.
getMembershipProgress
()).
longValue
();
// memberProgressLog.setCurrentProgress(consumerMember.getMembershipProgress());
//查询当前会员类型和下一级的会员配置
// Long membershipProgress = sOrder.getBalance().add(consumerMember.getMembershipProgress()).longValue();
MemberConfig
one
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
// //查询当前会员类型和下一级的会员配置
.
eq
(
MemberConfig:
:
getMemberType
,
consumerMember
.
getMemberType
())
// MemberConfig one = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
()
+
1L
));
// .eq(MemberConfig::getMemberType, consumerMember.getMemberType())
// .eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel() + 1L));
if
(
ObjectUtil
.
isNotEmpty
(
one
))
{
//
//判断是否升级
// if (ObjectUtil.isNotEmpty(one)) {
if
(
membershipProgress
.
compareTo
(
one
.
getLimitRequirements
())
>=
0
)
{
// //判断是否升级
consumerMember
.
setMembershipLevel
(
consumerMember
.
getMembershipLevel
()
+
1L
);
// if (membershipProgress.compareTo(one.getLimitRequirements()) >= 0) {
consumerMember
.
setMemberConfigId
(
one
.
getId
());
// consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() + 1L);
}
// consumerMember.setMemberConfigId(one.getId());
}
// }
consumerMember
.
setMembershipProgress
(
BigDecimal
.
valueOf
(
membershipProgress
));
// }
memberProgressLog
.
setVariableProgress
(
BigDecimal
.
valueOf
(
membershipProgress
));
// consumerMember.setMembershipProgress(BigDecimal.valueOf(membershipProgress));
memberProgressLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
// memberProgressLog.setVariableProgress(BigDecimal.valueOf(membershipProgress));
memberProgressLog
.
setOperationTime
(
new
Date
());
// memberProgressLog.setOperationType(YesNoEnum.yes.getIndex());
memberProgressLogService
.
save
(
memberProgressLog
);
// memberProgressLog.setOperationTime(new Date());
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
// memberProgressLog.setCreateTime(new Date());
}
else
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
RIGHTS
.
getIndex
()))
{
// memberProgressLogService.save(memberProgressLog);
// consumerMemberService.updateConsumerMember(consumerMember);
// } else if (consumerMember.getMemberType().equals(MemberTypeEnum.RIGHTS.getIndex())) {
SConsumerCoupon
coupon
=
consumerCouponService
.
getById
(
sOrder
.
getCouponId
());
SConsumerCoupon
coupon
=
consumerCouponService
.
getById
(
sOrder
.
getCouponId
());
IntegralLog
integralLog
=
new
IntegralLog
();
IntegralLog
integralLog
=
new
IntegralLog
();
integralLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
integralLog
.
setConsumerId
(
sOrder
.
getConsumerId
());
...
@@ -1107,18 +1111,26 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1107,18 +1111,26 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
BigDecimal
integral
;
BigDecimal
integral
;
Long
membershipProgress
;
Long
membershipProgress
;
if
(
ObjectUtil
.
isNotEmpty
(
coupon
)
&&
!
coupon
.
getPlatformType
().
equals
(
PlatformTypeEnum
.
SELF
.
getCode
())
&&
coupon
.
getCouponType
().
equals
(
CouponTypeEnum
.
CASH
.
getCode
()))
{
if
(
ObjectUtil
.
isNotEmpty
(
coupon
)
&&
!
coupon
.
getPlatformType
().
equals
(
PlatformTypeEnum
.
SELF
.
getCode
())
&&
coupon
.
getCouponType
().
equals
(
CouponTypeEnum
.
CASH
.
getCode
()))
{
integral
=
consumerWallet
.
getRemainingIntegral
().
add
(
sOrder
.
getPayPrice
()).
add
(
sOrder
.
getBalance
()).
add
(
coupon
.
getCouponPayPri
ce
());
integral
=
consumerWallet
.
getRemainingIntegral
().
add
(
coupon
.
getCouponPayPrice
()).
add
(
sOrder
.
getBalan
ce
());
membershipProgress
=
consumerMember
.
getMembershipProgress
().
add
(
sOrder
.
getBalance
())
membershipProgress
=
consumerMember
.
getMembershipProgress
().
add
(
sOrder
.
getBalance
())
.
add
(
sOrder
.
getPayPrice
()).
add
(
coupon
.
getCouponPayPrice
()).
longValue
();
.
add
(
coupon
.
getCouponPayPrice
()).
longValue
();
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
RIGHTS
.
getIndex
()))
{
integral
=
integral
.
add
(
sOrder
.
getPayPrice
());
membershipProgress
=
BigDecimal
.
valueOf
(
membershipProgress
).
add
(
sOrder
.
getPayPrice
()).
longValue
();
}
}
else
{
}
else
{
integral
=
consumerWallet
.
getRemainingIntegral
().
add
(
sOrder
.
getPayPrice
()).
add
(
sOrder
.
getBalance
());
integral
=
consumerWallet
.
getRemainingIntegral
().
add
(
sOrder
.
getBalance
());
membershipProgress
=
consumerMember
.
getMembershipProgress
().
add
(
sOrder
.
getBalance
()).
add
(
sOrder
.
getPayPrice
()).
longValue
();
membershipProgress
=
consumerMember
.
getMembershipProgress
().
add
(
sOrder
.
getBalance
()).
longValue
();
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
RIGHTS
.
getIndex
()))
{
integral
=
integral
.
add
(
sOrder
.
getPayPrice
());
membershipProgress
=
BigDecimal
.
valueOf
(
membershipProgress
).
add
(
sOrder
.
getPayPrice
()).
longValue
();
}
}
}
integralLog
.
setVariableIntegral
(
integral
.
subtract
(
consumerWallet
.
getRemainingIntegral
()));
integralLog
.
setVariableIntegral
(
integral
.
subtract
(
consumerWallet
.
getRemainingIntegral
()));
consumerWallet
.
setRemainingIntegral
(
integral
);
consumerWallet
.
setRemainingIntegral
(
integral
);
integralLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
integralLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
integralLog
.
setOperationTime
(
new
Date
());
integralLog
.
setOperationTime
(
new
Date
());
integralLog
.
setCreateTime
(
new
Date
());
integralLogService
.
save
(
integralLog
);
integralLogService
.
save
(
integralLog
);
consumerWalletService
.
updateById
(
consumerWallet
);
consumerWalletService
.
updateById
(
consumerWallet
);
MemberProgressLog
memberProgressLog
=
new
MemberProgressLog
();
MemberProgressLog
memberProgressLog
=
new
MemberProgressLog
();
...
@@ -1139,9 +1151,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1139,9 +1151,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
memberProgressLog
.
setVariableProgress
(
BigDecimal
.
valueOf
(
membershipProgress
));
memberProgressLog
.
setVariableProgress
(
BigDecimal
.
valueOf
(
membershipProgress
));
memberProgressLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
memberProgressLog
.
setOperationType
(
YesNoEnum
.
yes
.
getIndex
());
memberProgressLog
.
setOperationTime
(
new
Date
());
memberProgressLog
.
setOperationTime
(
new
Date
());
memberProgressLog
.
setCreateTime
(
new
Date
());
memberProgressLog
.
setExpirationTime
(
DateUtils
.
addYears
(
new
Date
(),
Math
.
toIntExact
(
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>().
eq
(
MemberConfig:
:
getId
,
consumerMember
.
getMemberConfigId
())).
getValidityPeriod
())));
memberProgressLogService
.
save
(
memberProgressLog
);
memberProgressLogService
.
save
(
memberProgressLog
);
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
}
//
}
}
}
}
}
...
@@ -1880,6 +1897,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1880,6 +1897,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
consumerMember
.
setMembershipProgress
(
BigDecimal
.
valueOf
(
membershipProgress
));
consumerMember
.
setMembershipProgress
(
BigDecimal
.
valueOf
(
membershipProgress
));
memberProgressLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
memberProgressLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
memberProgressLog
.
setOperationTime
(
new
Date
());
memberProgressLog
.
setOperationTime
(
new
Date
());
Long
validityPeriod
=
memberConfigService
.
getById
(
consumerMember
.
getMemberConfigId
()).
getValidityPeriod
();
memberProgressLog
.
setExpirationTime
(
DateUtils
.
addYears
(
new
Date
(),
validityPeriod
.
intValue
()));
memberProgressLogService
.
save
(
memberProgressLog
);
memberProgressLogService
.
save
(
memberProgressLog
);
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
}
else
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
RIGHTS
.
getIndex
()))
{
}
else
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
RIGHTS
.
getIndex
()))
{
...
@@ -1923,6 +1942,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1923,6 +1942,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
consumerMember
.
setMembershipProgress
(
BigDecimal
.
valueOf
(
membershipProgress
));
consumerMember
.
setMembershipProgress
(
BigDecimal
.
valueOf
(
membershipProgress
));
memberProgressLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
memberProgressLog
.
setOperationType
(
YesNoEnum
.
no
.
getIndex
());
memberProgressLog
.
setOperationTime
(
new
Date
());
memberProgressLog
.
setOperationTime
(
new
Date
());
Long
validityPeriod
=
memberConfigService
.
getById
(
consumerMember
.
getMemberConfigId
()).
getValidityPeriod
();
memberProgressLog
.
setExpirationTime
(
DateUtils
.
addYears
(
new
Date
(),
validityPeriod
.
intValue
()));
memberProgressLogService
.
save
(
memberProgressLog
);
memberProgressLogService
.
save
(
memberProgressLog
);
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
}
}
...
...
share-system/src/main/resources/mapper/system/MemberProgressLogMapper.xml
View file @
e3d95941
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
<result
property=
"currentProgress"
column=
"current_progress"
/>
<result
property=
"currentProgress"
column=
"current_progress"
/>
<result
property=
"operationType"
column=
"operation_type"
/>
<result
property=
"operationType"
column=
"operation_type"
/>
<result
property=
"operationTime"
column=
"operation_time"
/>
<result
property=
"operationTime"
column=
"operation_time"
/>
<result
property=
"expirationTime"
column=
"expiration_time"
/>
<result
property=
"isDelete"
column=
"is_delete"
/>
<result
property=
"isDelete"
column=
"is_delete"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createTime"
column=
"create_time"
/>
...
@@ -29,6 +30,7 @@
...
@@ -29,6 +30,7 @@
current_progress,
current_progress,
operation_type,
operation_type,
operation_time,
operation_time,
expiration_time,
is_delete,
is_delete,
create_by,
create_by,
create_time,
create_time,
...
@@ -48,6 +50,7 @@
...
@@ -48,6 +50,7 @@
m.current_progress,
m.current_progress,
m.operation_type,
m.operation_type,
m.operation_time,
m.operation_time,
m.expiration_time,
m.is_delete,
m.is_delete,
m.create_by,
m.create_by,
m.create_time,
m.create_time,
...
@@ -82,6 +85,7 @@
...
@@ -82,6 +85,7 @@
<if
test=
"currentProgress != null"
>
current_progress,
</if>
<if
test=
"currentProgress != null"
>
current_progress,
</if>
<if
test=
"operationType != null"
>
operation_type,
</if>
<if
test=
"operationType != null"
>
operation_type,
</if>
<if
test=
"operationTime != null"
>
operation_time,
</if>
<if
test=
"operationTime != null"
>
operation_time,
</if>
<if
test=
"expirationTime != null"
>
expiration_time,
</if>
<if
test=
"isDelete != null"
>
is_delete,
</if>
<if
test=
"isDelete != null"
>
is_delete,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
...
@@ -95,6 +99,7 @@
...
@@ -95,6 +99,7 @@
<if
test=
"currentProgress != null"
>
#{currentProgress},
</if>
<if
test=
"currentProgress != null"
>
#{currentProgress},
</if>
<if
test=
"operationType != null"
>
#{operationType},
</if>
<if
test=
"operationType != null"
>
#{operationType},
</if>
<if
test=
"operationTime != null"
>
#{operationTime},
</if>
<if
test=
"operationTime != null"
>
#{operationTime},
</if>
<if
test=
"expirationTime != null"
>
#{expirationTime},
</if>
<if
test=
"isDelete != null"
>
#{isDelete},
</if>
<if
test=
"isDelete != null"
>
#{isDelete},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
...
@@ -112,6 +117,7 @@
...
@@ -112,6 +117,7 @@
<if
test=
"currentProgress != null"
>
current_progress = #{currentProgress},
</if>
<if
test=
"currentProgress != null"
>
current_progress = #{currentProgress},
</if>
<if
test=
"operationType != null"
>
operation_type = #{operationType},
</if>
<if
test=
"operationType != null"
>
operation_type = #{operationType},
</if>
<if
test=
"operationTime != null"
>
operation_time = #{operationTime},
</if>
<if
test=
"operationTime != null"
>
operation_time = #{operationTime},
</if>
<if
test=
"expirationTime != null"
>
expiration_time = #{expirationTime},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
...
...
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