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
7669fce1
Commit
7669fce1
authored
Jul 03, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权益会员订单回调
parent
ec816c7d
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
176 additions
and
9 deletions
+176
-9
ReceiptRdeisEnum.java
...on/src/main/java/share/common/enums/ReceiptRdeisEnum.java
+1
-0
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+13
-0
EquityMembersOrderMapper.java
...in/java/share/system/mapper/EquityMembersOrderMapper.java
+2
-0
EquityMembersOrderService.java
.../java/share/system/service/EquityMembersOrderService.java
+4
-0
CallbackServiceImpl.java
...n/java/share/system/service/impl/CallbackServiceImpl.java
+80
-0
EquityMembersOrderServiceImpl.java
...re/system/service/impl/EquityMembersOrderServiceImpl.java
+66
-7
RechargeServiceImpl.java
...n/java/share/system/service/impl/RechargeServiceImpl.java
+1
-1
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+5
-1
EquityMembersOrderMapper.xml
...main/resources/mapper/system/EquityMembersOrderMapper.xml
+4
-0
No files found.
share-common/src/main/java/share/common/enums/ReceiptRdeisEnum.java
View file @
7669fce1
...
...
@@ -13,6 +13,7 @@ public enum ReceiptRdeisEnum {
//房间15分钟过期
ROOM_EXPIRE_TIME
(
9
,
"ROOM_EXPIRE_TIME."
),
ORDER_CANCEL_PAY
(
10
,
"ORDER_CANCEL_PAY."
),
EQUITY_MEMBERS_TIME
(
11
,
"EQUITY_MEMBERS_TIME."
)
;
...
...
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
7669fce1
...
...
@@ -455,6 +455,19 @@ public class RedisTask {
});
}
public
void
AutoEquityMembers
()
{
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"
);
});
}
public
void
AutoAddRoomLabel
()
{
List
<
RoomLabel
>
roomLabelList
=
roomLabelService
.
list
();
//获取roomLabelList中的roomId,去重
...
...
share-system/src/main/java/share/system/mapper/EquityMembersOrderMapper.java
View file @
7669fce1
...
...
@@ -60,4 +60,6 @@ public interface EquityMembersOrderMapper extends BaseMapper<EquityMembersOrder>
* @return 结果
*/
public
int
deleteEquityMembersOrderByIds
(
Long
[]
ids
);
EquityMembersOrder
getInfoByEntity
(
EquityMembersOrder
equityMembersOrderParam
);
}
share-system/src/main/java/share/system/service/EquityMembersOrderService.java
View file @
7669fce1
...
...
@@ -64,4 +64,8 @@ public interface EquityMembersOrderService extends IService<EquityMembersOrder>
public
int
deleteEquityMembersOrderById
(
Long
id
);
RechargePayResultResponse
createEquityMembers
(
CreateEquityMembersRequest
request
);
EquityMembersOrder
getInfoByEntity
(
EquityMembersOrder
equityMembersOrderParam
);
void
paymentSuccessful
(
EquityMembersOrder
equityMembersOrder
);
}
share-system/src/main/java/share/system/service/impl/CallbackServiceImpl.java
View file @
7669fce1
...
...
@@ -70,6 +70,9 @@ public class CallbackServiceImpl implements CallbackService {
@Autowired
private
RechargeService
rechargeService
;
@Autowired
private
EquityMembersOrderService
equityMembersOrderService
;
/**
* 微信支付回调
*/
...
...
@@ -454,6 +457,83 @@ public class CallbackServiceImpl implements CallbackService {
return
responseVo
;
}
break
;
case
RIGHTS:
EquityMembersOrder
equityMembersOrderParam
=
new
EquityMembersOrder
();
equityMembersOrderParam
.
setOutTradeNo
(
param
.
getTerminal_trace
());
equityMembersOrderParam
.
setConsumerId
(
attachVo
.
getUserId
());
EquityMembersOrder
equityMembersOrder
=
equityMembersOrderService
.
getInfoByEntity
(
equityMembersOrderParam
);
if
(
ObjectUtil
.
isNull
(
equityMembersOrder
))
{
logger
.
error
(
"saobei wechat pay error : 订单信息不存在==》"
+
param
.
getTerminal_trace
());
responseVo
.
setReturn_code
(
SaobeiStatusEnum
.
FAIL
.
getCode
());
responseVo
.
setReturn_msg
(
"订单信息不存在!"
);
// 保存api日志
saobeiApiLog
.
setResponseParams
(
JSONUtil
.
toJsonStr
(
responseVo
));
saobeiApiLog
.
setResult
(
responseVo
.
getReturn_code
());
saobeiApiLog
.
setResultMsg
(
responseVo
.
getReturn_msg
());
saobeiApiLog
.
setOutTradeNo
(
param
.
getOut_trade_no
());
saobeiApiLogService
.
insertSaobeiApiLog
(
saobeiApiLog
);
return
responseVo
;
}
if
(
YesNoEnum
.
yes
.
getIndex
().
equals
(
equityMembersOrder
.
getPayStatus
()))
{
logger
.
error
(
"saobei wechat pay error : 订单已处理==》"
+
param
.
getTerminal_trace
());
responseVo
.
setReturn_code
(
SaobeiStatusEnum
.
SUCCESS
.
getCode
());
responseVo
.
setReturn_msg
(
"success"
);
// 保存api日志
saobeiApiLog
.
setResponseParams
(
JSONUtil
.
toJsonStr
(
responseVo
));
saobeiApiLog
.
setResult
(
responseVo
.
getReturn_code
());
saobeiApiLog
.
setResultMsg
(
responseVo
.
getReturn_msg
());
saobeiApiLog
.
setOutTradeNo
(
param
.
getOut_trade_no
());
saobeiApiLogService
.
insertSaobeiApiLog
(
saobeiApiLog
);
return
responseVo
;
}
WechatPayInfo
equityPayInfo
=
wechatPayInfoService
.
getByNo
(
equityMembersOrder
.
getOutTradeNo
());
if
(
ObjectUtil
.
isNull
(
equityPayInfo
))
{
logger
.
error
(
"saobei wechat pay error : 微信订单信息不存在==》"
+
param
.
getTerminal_trace
());
responseVo
.
setReturn_code
(
SaobeiStatusEnum
.
FAIL
.
getCode
());
responseVo
.
setReturn_msg
(
"微信订单信息不存在!"
);
// 保存api日志
saobeiApiLog
.
setResponseParams
(
JSONUtil
.
toJsonStr
(
responseVo
));
saobeiApiLog
.
setResult
(
responseVo
.
getReturn_code
());
saobeiApiLog
.
setResultMsg
(
responseVo
.
getReturn_msg
());
saobeiApiLog
.
setOutTradeNo
(
param
.
getOut_trade_no
());
saobeiApiLogService
.
insertSaobeiApiLog
(
saobeiApiLog
);
return
responseVo
;
}
// wechatPayInfo.setIsSubscribe(param.getIsSubscribe());
equityPayInfo
.
setBankType
(
param
.
getBank_type
());
equityPayInfo
.
setCashFee
(
Integer
.
valueOf
(
param
.
getTotal_fee
()));
// wechatPayInfo.setTransactionId(param.getOut_trade_no());
equityPayInfo
.
setTimeEnd
(
param
.
getEnd_time
());
equityPayInfo
.
setTimeExpire
(
param
.
getEnd_time
());
Boolean
aBoolean
=
Boolean
.
FALSE
;
try
{
equityMembersOrder
.
setPayStatus
(
YesNoEnum
.
yes
.
getIndex
());
equityMembersOrder
.
setPayTime
(
DateUtils
.
getNowDate
());
equityMembersOrderService
.
paymentSuccessful
(
equityMembersOrder
);
equityPayInfo
.
setTradeState
(
"1"
);
equityPayInfo
.
setTradeStateDesc
(
"支付成功"
);
wechatPayInfoService
.
updateById
(
equityPayInfo
);
aBoolean
=
Boolean
.
TRUE
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"微信支付回调出错"
);
logger
.
error
(
e
.
toString
());
}
if
(!
aBoolean
)
{
logger
.
error
(
"saobei wechat pay error : 订单更新失败==》"
+
param
.
getTerminal_trace
());
responseVo
.
setReturn_code
(
SaobeiStatusEnum
.
FAIL
.
getCode
());
responseVo
.
setReturn_msg
(
"订单更新失败!"
);
// 保存api日志
saobeiApiLog
.
setResponseParams
(
JSONUtil
.
toJsonStr
(
responseVo
));
saobeiApiLog
.
setResult
(
responseVo
.
getReturn_code
());
saobeiApiLog
.
setResultMsg
(
responseVo
.
getReturn_msg
());
saobeiApiLog
.
setOutTradeNo
(
param
.
getOut_trade_no
());
saobeiApiLogService
.
insertSaobeiApiLog
(
saobeiApiLog
);
return
responseVo
;
}
break
;
default
:
logger
.
error
(
"wechat pay err : 未知的支付类型==》"
+
param
.
getTerminal_trace
());
break
;
...
...
share-system/src/main/java/share/system/service/impl/EquityMembersOrderServiceImpl.java
View file @
7669fce1
package
share
.
system
.
service
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.json.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.MemberTypeEnum
;
import
share.common.enums.ReceiptRdeisEnum
;
import
share.common.enums.YesNoEnum
;
import
share.common.exception.base.BaseException
;
import
share.common.utils.BaseUtil
;
import
share.common.utils.DateUtils
;
import
share.common.utils.bean.BeanUtils
;
import
share.system.domain.EquityMembersOrder
;
import
share.system.domain.EquityMembersOrderConfig
;
import
share.system.domain.SConsumer
;
import
share.system.domain.*
;
import
share.system.domain.vo.EquityMembersOrderVo
;
import
share.system.domain.vo.FrontTokenComponent
;
import
share.system.mapper.EquityMembersOrderMapper
;
import
share.system.request.CreateEquityMembersRequest
;
import
share.system.response.RechargePayResultResponse
;
import
share.system.service.EquityMembersOrderConfigService
;
import
share.system.service.EquityMembersOrderService
;
import
share.system.service.OrderPayService
;
import
share.system.service.SConsumerService
;
import
share.system.service.*
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 权益会员订单Service业务层处理
...
...
@@ -41,6 +44,12 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
private
EquityMembersOrderConfigService
equityMembersOrderConfigService
;
@Autowired
private
OrderPayService
orderPayService
;
@Autowired
private
ConsumerMemberService
consumerMemberService
;
@Autowired
private
MemberConfigService
memberConfigService
;
@Autowired
private
RedisUtil
redisUtil
;
/**
* 查询权益会员订单
...
...
@@ -128,6 +137,56 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
return
response
;
}
@Override
public
EquityMembersOrder
getInfoByEntity
(
EquityMembersOrder
equityMembersOrderParam
)
{
return
equityMembersOrderMapper
.
getInfoByEntity
(
equityMembersOrderParam
);
}
@Override
public
void
paymentSuccessful
(
EquityMembersOrder
equityMembersOrder
)
{
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
equityMembersOrder
.
getConsumerId
()));
EquityMembersOrderConfig
equityMembersOrderConfig
=
equityMembersOrderConfigService
.
selectEquityMembersOrderConfigById
(
equityMembersOrder
.
getEquityMembersConfigId
());
if
(
ObjectUtil
.
isEmpty
(
consumerMember
))
{
ConsumerMember
newConsumerMember
=
new
ConsumerMember
();
newConsumerMember
.
setConsumerId
(
equityMembersOrder
.
getConsumerId
());
newConsumerMember
.
setMembershipLevel
(
equityMembersOrderConfig
.
getDefaultLevel
());
consumerMember
.
setMemberType
(
MemberTypeEnum
.
RIGHTS
.
getIndex
());
MemberConfig
memberConfig
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>()
.
eq
(
MemberConfig:
:
getMembershipLevel
,
equityMembersOrderConfig
.
getDefaultLevel
())
.
eq
(
MemberConfig:
:
getMemberType
,
MemberTypeEnum
.
RIGHTS
.
getIndex
()));
consumerMember
.
setMemberConfigId
(
memberConfig
.
getId
());
consumerMember
.
setExpirationDate
(
DateUtils
.
addDays
(
DateUtils
.
parseDate
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM
,
new
Date
())),
equityMembersOrderConfig
.
getValidityPeriod
().
intValue
()));
consumerMember
.
setMembershipProgress
(
0L
);
consumerMemberService
.
save
(
newConsumerMember
);
}
else
{
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
RECHARGE
.
getIndex
()))
{
//充值会员修改为权益会员
consumerMember
.
setMemberType
(
MemberTypeEnum
.
RIGHTS
.
getIndex
());
consumerMember
.
setExpirationDate
(
DateUtils
.
addDays
(
DateUtils
.
parseDate
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM
,
new
Date
())),
equityMembersOrderConfig
.
getValidityPeriod
().
intValue
()));
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
}
else
if
(
consumerMember
.
getMemberType
().
equals
(
MemberTypeEnum
.
RIGHTS
.
getIndex
()))
{
//在原来的基础上增加有效期
consumerMember
.
setExpirationDate
(
DateUtils
.
addDays
(
DateUtils
.
parseDate
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM
,
consumerMember
.
getExpirationDate
())),
equityMembersOrderConfig
.
getValidityPeriod
().
intValue
()));
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
}
else
{
//修改会员类型为权益会员
consumerMember
.
setMemberType
(
MemberTypeEnum
.
RIGHTS
.
getIndex
());
consumerMember
.
setExpirationDate
(
DateUtils
.
addDays
(
DateUtils
.
parseDate
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM
,
new
Date
())),
equityMembersOrderConfig
.
getValidityPeriod
().
intValue
()));
consumerMemberService
.
updateConsumerMember
(
consumerMember
);
}
}
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"consumerId"
,
String
.
valueOf
(
consumerMember
.
getConsumerId
()));
//当前时间加15分钟
map
.
put
(
"expirationTime"
,
consumerMember
.
getExpirationDate
().
toString
());
JSONObject
json
=
new
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
EQUITY_MEMBERS_TIME
.
getValue
()
+
equityMembersOrder
.
getConsumerId
(),
json
.
toString
());
}
private
EquityMembersOrder
generatEquityMembersOrder
(
CreateEquityMembersRequest
request
,
SConsumer
user
)
{
EquityMembersOrder
equityMembersOrder
=
new
EquityMembersOrder
();
BeanUtils
.
copyProperties
(
request
,
equityMembersOrder
);
...
...
share-system/src/main/java/share/system/service/impl/RechargeServiceImpl.java
View file @
7669fce1
...
...
@@ -152,7 +152,7 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
.
eq
(
MemberConfig:
:
getMembershipLevel
,
1L
)
.
eq
(
MemberConfig:
:
getMemberType
,
MemberTypeEnum
.
RECHARGE
.
getIndex
()));
consumerMember
.
setMemberConfigId
(
memberConfig
.
getId
());
consumerMember
.
setMembershipProgress
(
recharge
.
getRechargeAmount
().
longValue
()
);
consumerMember
.
setMembershipProgress
(
0L
);
consumerMember
.
setExpirationDate
(
DateUtils
.
addDays
(
new
Date
(),
memberConfig
.
getValidityPeriod
().
intValue
()));
consumerMemberService
.
save
(
consumerMember
);
extracted
(
recharge
);
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
7669fce1
...
...
@@ -1930,7 +1930,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if
(
ObjectUtil
.
isNull
(
request
.
getCouponId
())
||
request
.
getCouponId
()
<=
0
)
{
priceResponse
.
setCouponFee
(
BigDecimal
.
ZERO
);
priceResponse
.
setDiscountFee
(
priceResponse
.
getTotalFee
().
subtract
(
priceResponse
.
getPayFee
()));
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscountFee
().
divide
(
priceResponse
.
getTotalFee
(),
2
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
100
)));
if
(
priceResponse
.
getTotalFee
().
compareTo
(
new
BigDecimal
(
0
))
==
0
)
{
priceResponse
.
setDiscountRatio
(
BigDecimal
.
ZERO
);
}
else
{
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscountFee
().
divide
(
priceResponse
.
getTotalFee
(),
2
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
100
)));
}
CronParser
cronParser
=
new
CronParser
(
CronDefinitionBuilder
.
instanceDefinitionFor
(
CronType
.
QUARTZ
));
if
(
ObjectUtil
.
isNotEmpty
(
activity
))
{
Cron
cron
=
cronParser
.
parse
(
activity
.
getCronExpression
());
...
...
share-system/src/main/resources/mapper/system/EquityMembersOrderMapper.xml
View file @
7669fce1
...
...
@@ -89,6 +89,10 @@
<include
refid=
"selectEquityMembersOrderVo"
/>
where id = #{id}
</select>
<select
id=
"getInfoByEntity"
resultType=
"share.system.domain.EquityMembersOrder"
>
<include
refid=
"selectEquityMembersOrderVo"
/>
where out_trade_no=#{outTradeNo} and consumer_id=#{consumerId}
</select>
<insert
id=
"insertEquityMembersOrder"
parameterType=
"EquityMembersOrder"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into s_equity_members_order
...
...
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