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
44ee3d87
Commit
44ee3d87
authored
Nov 18, 2023
by
YG8999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信退款
parent
9ecea2fe
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
88 additions
and
24 deletions
+88
-24
application-dev.yml
share-admin/src/main/resources/application-dev.yml
+13
-3
RestTemplateUtil.java
...c/main/java/share/common/utils/http/RestTemplateUtil.java
+2
-1
application-dev.yml
share-front/src/main/resources/application-dev.yml
+12
-5
application-prod.yml
share-front/src/main/resources/application-prod.yml
+10
-1
SnowFlakeUtil.java
...system/src/main/java/share/system/mqtt/SnowFlakeUtil.java
+17
-0
OrderRefundRequest.java
...rc/main/java/share/system/request/OrderRefundRequest.java
+2
-1
CallbackServiceImpl.java
...n/java/share/system/service/impl/CallbackServiceImpl.java
+3
-3
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+27
-9
WechatNewServiceImpl.java
.../java/share/system/service/impl/WechatNewServiceImpl.java
+2
-1
No files found.
share-admin/src/main/resources/application-dev.yml
View file @
44ee3d87
...
@@ -14,7 +14,13 @@ ruoyi:
...
@@ -14,7 +14,13 @@ ruoyi:
addressEnabled
:
false
addressEnabled
:
false
# 验证码类型 math 数字计算 char 字符验证
# 验证码类型 math 数字计算 char 字符验证
captchaType
:
char
captchaType
:
char
# 微信相关配置
wechat
:
appId
:
wxdd170b8783edf7a0
appSecret
:
7339f117e85876a0dfe10ea1ed47340e
mchId
:
1658895429
signKey
:
ZEKu56XCezuESfNEdM4zVZEN3cz2PuHz
certPath
:
/var/gxpt/wechat_ssl/apiclient_cert.p12
# 开发环境配置
# 开发环境配置
server
:
server
:
# 服务器的HTTP端口,默认为8080
# 服务器的HTTP端口,默认为8080
...
@@ -114,13 +120,13 @@ spring:
...
@@ -114,13 +120,13 @@ spring:
# redis 配置
# redis 配置
redis
:
redis
:
# 地址
# 地址
host
:
127.0.0.1
host
:
47.99.53.236
# 端口,默认为6379
# 端口,默认为6379
port
:
6379
port
:
6379
# 数据库索引
# 数据库索引
database
:
0
database
:
0
# 密码
# 密码
password
:
123456
password
:
Coujiao&031107
# 连接超时时间
# 连接超时时间
timeout
:
10s
timeout
:
10s
lettuce
:
lettuce
:
...
@@ -187,6 +193,10 @@ xss:
...
@@ -187,6 +193,10 @@ xss:
excludes
:
/system/notice
excludes
:
/system/notice
# 匹配链接
# 匹配链接
urlPatterns
:
/system/*,/monitor/*,/tool/*
urlPatterns
:
/system/*,/monitor/*,/tool/*
meituan
:
developerId
:
123456
signKey
:
abcdefghijklmnopqrstuvwxyz
appAuthToken
:
abcdefghijklmnopqrstuvwxyz
dianping
:
dianping
:
appKey
:
a59ea57cd1eb4737
appKey
:
a59ea57cd1eb4737
appSecret
:
0caaabb7fda1c1be46636171548dcf510d1fb706
appSecret
:
0caaabb7fda1c1be46636171548dcf510d1fb706
...
...
share-common/src/main/java/share/common/utils/http/RestTemplateUtil.java
View file @
44ee3d87
...
@@ -288,7 +288,8 @@ public class RestTemplateUtil {
...
@@ -288,7 +288,8 @@ public class RestTemplateUtil {
SSLConnectionSocketFactory
sslConnectionSocketFactory
=
new
SSLConnectionSocketFactory
(
SSLConnectionSocketFactory
sslConnectionSocketFactory
=
new
SSLConnectionSocketFactory
(
sslContext
,
sslContext
,
new
String
[]{
"TLSv1"
},
// new String[]{"TLSv1"},
null
,
null
,
null
,
new
DefaultHostnameVerifier
());
new
DefaultHostnameVerifier
());
...
...
share-front/src/main/resources/application-dev.yml
View file @
44ee3d87
...
@@ -18,8 +18,9 @@ ruoyi:
...
@@ -18,8 +18,9 @@ ruoyi:
wechat
:
wechat
:
appId
:
wxdd170b8783edf7a0
appId
:
wxdd170b8783edf7a0
appSecret
:
7339f117e85876a0dfe10ea1ed47340e
appSecret
:
7339f117e85876a0dfe10ea1ed47340e
mchId
:
0
mchId
:
1658895429
signKey
:
0
signKey
:
ZEKu56XCezuESfNEdM4zVZEN3cz2PuHz
certPath
:
/var/gxpt/wechat_ssl/apiclient_cert.p12
# 开发环境配置
# 开发环境配置
server
:
server
:
# 服务器的HTTP端口,默认为8080
# 服务器的HTTP端口,默认为8080
...
@@ -116,13 +117,13 @@ spring:
...
@@ -116,13 +117,13 @@ spring:
# redis 配置
# redis 配置
redis
:
redis
:
# 地址
# 地址
host
:
127.0.0.1
host
:
47.99.53.236
# 端口,默认为6379
# 端口,默认为6379
port
:
6379
port
:
6379
# 数据库索引
# 数据库索引
database
:
0
database
:
0
# 密码
# 密码
password
:
123456
password
:
Coujiao&031107
# 连接超时时间
# 连接超时时间
timeout
:
10s
timeout
:
10s
lettuce
:
lettuce
:
...
@@ -189,7 +190,13 @@ xss:
...
@@ -189,7 +190,13 @@ xss:
excludes
:
/system/notice
excludes
:
/system/notice
# 匹配链接
# 匹配链接
urlPatterns
:
/system/*,/monitor/*,/tool/*
urlPatterns
:
/system/*,/monitor/*,/tool/*
meituan
:
developerId
:
123456
signKey
:
abcdefghijklmnopqrstuvwxyz
appAuthToken
:
abcdefghijklmnopqrstuvwxyz
dianping
:
dianping
:
appKey
:
a59ea57cd1eb4737
appKey
:
a59ea57cd1eb4737
appSecret
:
0caaabb7fda1c1be46636171548dcf510d1fb706
appSecret
:
0caaabb7fda1c1be46636171548dcf510d1fb706
authCode
:
6be3e11e19d0b3595046cc2cefbf05da790be35d
#订单
order
:
allow-refund-time
:
3600
share-front/src/main/resources/application-prod.yml
View file @
44ee3d87
...
@@ -20,7 +20,7 @@ wechat:
...
@@ -20,7 +20,7 @@ wechat:
appSecret
:
7339f117e85876a0dfe10ea1ed47340e
appSecret
:
7339f117e85876a0dfe10ea1ed47340e
mchId
:
1658895429
mchId
:
1658895429
signKey
:
ZEKu56XCezuESfNEdM4zVZEN3cz2PuHz
signKey
:
ZEKu56XCezuESfNEdM4zVZEN3cz2PuHz
certPath
:
/
var/gxpt/wechat_ssl
/apiclient_cert.p12
certPath
:
/
Users/project/pseer
/apiclient_cert.p12
# 开发环境配置
# 开发环境配置
server
:
server
:
# 服务器的HTTP端口,默认为8080
# 服务器的HTTP端口,默认为8080
...
@@ -144,6 +144,12 @@ spring:
...
@@ -144,6 +144,12 @@ spring:
defaultTopic
:
"
ydlink/#"
defaultTopic
:
"
ydlink/#"
completion-timeout
:
15000
completion-timeout
:
15000
is-subscribe-topic
:
false
is-subscribe-topic
:
false
sms
:
url
:
"
http://121.36.230.249:7862/smsv2"
username
:
"
799243"
password
:
"
RjaI8uA"
extno
:
"
10690"
signature
:
"
【凑角】"
# token配置
# token配置
token
:
token
:
...
@@ -192,3 +198,6 @@ meituan:
...
@@ -192,3 +198,6 @@ meituan:
dianping
:
dianping
:
appKey
:
a59ea57cd1eb4737
appKey
:
a59ea57cd1eb4737
appSecret
:
0caaabb7fda1c1be46636171548dcf510d1fb706
appSecret
:
0caaabb7fda1c1be46636171548dcf510d1fb706
#订单
order
:
allow-refund-time
:
3600
share-system/src/main/java/share/system/mqtt/SnowFlakeUtil.java
View file @
44ee3d87
package
share
.
system
.
mqtt
;
package
share
.
system
.
mqtt
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.lang.Singleton
;
import
cn.hutool.core.lang.Singleton
;
import
java.util.Date
;
/**
/**
* 雪花算法工具类
* 雪花算法工具类
*/
*/
...
@@ -68,6 +73,18 @@ public class SnowFlakeUtil {
...
@@ -68,6 +73,18 @@ public class SnowFlakeUtil {
return
Singleton
.
get
(
SnowFlakeUtil
.
class
,
new
Object
[]{
1L
,
1L
}).
nextId
();
return
Singleton
.
get
(
SnowFlakeUtil
.
class
,
new
Object
[]{
1L
,
1L
}).
nextId
();
}
}
public
static
void
main
(
String
[]
args
)
{
String
dateStr1
=
"2017-03-01 22:33:23"
;
Date
date1
=
DateUtil
.
parse
(
dateStr1
);
String
dateStr2
=
"2023-11-18 13:03:23"
;
Date
date2
=
DateUtil
.
parse
(
dateStr2
);
long
between
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
between
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
date
(),
date2
,
DateUnit
.
SECOND
);
System
.
out
.
println
(
between
);
}
}
}
share-system/src/main/java/share/system/request/OrderRefundRequest.java
View file @
44ee3d87
...
@@ -10,6 +10,7 @@ import lombok.experimental.Accessors;
...
@@ -10,6 +10,7 @@ import lombok.experimental.Accessors;
import
javax.validation.constraints.DecimalMin
;
import
javax.validation.constraints.DecimalMin
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
/**
/**
...
@@ -19,7 +20,7 @@ import java.math.BigDecimal;
...
@@ -19,7 +20,7 @@ import java.math.BigDecimal;
@EqualsAndHashCode
(
callSuper
=
false
)
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"OrderRefundRequest对象"
,
description
=
"订单退款"
)
@ApiModel
(
value
=
"OrderRefundRequest对象"
,
description
=
"订单退款"
)
public
class
OrderRefundRequest
{
public
class
OrderRefundRequest
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"订单编号"
)
@ApiModelProperty
(
value
=
"订单编号"
)
...
...
share-system/src/main/java/share/system/service/impl/CallbackServiceImpl.java
View file @
44ee3d87
...
@@ -236,7 +236,7 @@ public class CallbackServiceImpl implements CallbackService {
...
@@ -236,7 +236,7 @@ public class CallbackServiceImpl implements CallbackService {
return
refundRecord
.
getStr
(
"returnXml"
);
return
refundRecord
.
getStr
(
"returnXml"
);
}
}
sOrder
.
setStatus
(
OrderStatusEnum
.
CANCEL
.
getCode
());
sOrder
.
setStatus
(
OrderStatusEnum
.
CANCEL
.
getCode
());
sOrder
.
setRefundStatus
(
RefundStatusEnum
.
INREFUN
D
.
getCode
());
sOrder
.
setRefundStatus
(
RefundStatusEnum
.
REFUNDE
D
.
getCode
());
boolean
update
=
sOrderService
.
updateById
(
sOrder
);
boolean
update
=
sOrderService
.
updateById
(
sOrder
);
if
(
update
)
{
if
(
update
)
{
// 退款task
// 退款task
...
@@ -313,10 +313,10 @@ public class CallbackServiceImpl implements CallbackService {
...
@@ -313,10 +313,10 @@ public class CallbackServiceImpl implements CallbackService {
throw
new
BaseException
(
"pay_weixin_appid或pay_routine_appid不能都为空"
);
throw
new
BaseException
(
"pay_weixin_appid或pay_routine_appid不能都为空"
);
}
}
if
(
StrUtil
.
isNotBlank
(
publicAppid
)
&&
appid
.
equals
(
publicAppid
))
{
if
(
StrUtil
.
isNotBlank
(
publicAppid
)
&&
appid
.
equals
(
publicAppid
))
{
signKey
=
weChatConfig
.
getSignKey
();
signKey
=
weChatConfig
.
get
Public
SignKey
();
}
}
if
(
StrUtil
.
isNotBlank
(
miniAppid
)
&&
appid
.
equals
(
miniAppid
))
{
if
(
StrUtil
.
isNotBlank
(
miniAppid
)
&&
appid
.
equals
(
miniAppid
))
{
signKey
=
weChatConfig
.
get
Public
SignKey
();
signKey
=
weChatConfig
.
getSignKey
();
}
}
return
signKey
;
return
signKey
;
}
}
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
44ee3d87
...
@@ -181,7 +181,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -181,7 +181,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
long
between
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
between
(
nowTime
,
long
between
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
between
(
nowTime
,
startTime
,
DateUnit
.
SECOND
);
startTime
,
DateUnit
.
SECOND
);
if
(
between
>
allowRefundTime
)
{
if
(
between
>
allowRefundTime
&&
RefundStatusEnum
.
UNREFUND
.
getCode
().
equals
(
order
.
getRefundStatus
())
)
{
return
Boolean
.
TRUE
;
return
Boolean
.
TRUE
;
}
}
}
}
...
@@ -418,7 +418,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -418,7 +418,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
}
}
//退款
//退款
if
(
sOrder
.
getPayType
().
equals
(
PayTypeEnum
.
WECHAT
.
get
Valu
e
())
&&
request
.
getAmount
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
if
(
sOrder
.
getPayType
().
equals
(
PayTypeEnum
.
WECHAT
.
get
Cod
e
())
&&
request
.
getAmount
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
try
{
try
{
orderRefundService
.
refund
(
request
,
sOrder
);
orderRefundService
.
refund
(
request
,
sOrder
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -447,7 +447,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -447,7 +447,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sOrder
.
setRefundReason
(
request
.
getRefundReason
());
sOrder
.
setRefundReason
(
request
.
getRefundReason
());
updateById
(
sOrder
);
updateById
(
sOrder
);
//微信退款
//微信退款
if
(
sOrder
.
getPayType
().
equals
(
PayTypeEnum
.
WECHAT
.
get
Valu
e
())
&&
request
.
getAmount
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
if
(
sOrder
.
getPayType
().
equals
(
PayTypeEnum
.
WECHAT
.
get
Cod
e
())
&&
request
.
getAmount
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
// 退款task
// 退款task
redisUtil
.
lPush
(
Constants
.
ORDER_TASK_REDIS_KEY_AFTER_REFUND_BY_USER
,
sOrder
.
getId
());
redisUtil
.
lPush
(
Constants
.
ORDER_TASK_REDIS_KEY_AFTER_REFUND_BY_USER
,
sOrder
.
getId
());
}
}
...
@@ -575,22 +575,40 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -575,22 +575,40 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
/**
* 小程序申请退款
* @param request
* @return
*/
@Override
@Override
public
boolean
autoRefund
(
OrderRefundRequest
request
)
{
public
boolean
autoRefund
(
OrderRefundRequest
request
)
{
SOrder
sOrder
=
getInfoException
(
request
.
getOrderNo
());
SOrder
sOrder
=
getInfoException
(
request
.
getOrderNo
());
if
(!
YesNoEnum
.
yes
.
getIndex
().
equals
(
sOrder
.
getPayStatus
()))
{
if
(!
YesNoEnum
.
yes
.
getIndex
().
equals
(
sOrder
.
getPayStatus
()))
{
throw
new
BaseException
(
"未支付无法退款"
);
throw
new
BaseException
(
"未支付无法退款"
);
}
}
if
(
sOrder
.
getRefundPrice
().
add
(
request
.
getAmount
()
).
compareTo
(
sOrder
.
getPayPrice
())
>
0
)
{
if
(
request
.
getAmount
(
).
compareTo
(
sOrder
.
getPayPrice
())
>
0
)
{
throw
new
BaseException
(
"退款金额大于支付金额,请修改退款金额"
);
throw
new
BaseException
(
"退款金额大于支付金额,请修改退款金额"
);
}
}
if
(
request
.
getAmount
().
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
// if (request.getAmount().compareTo(BigDecimal.ZERO) <= 0) {
if
(
sOrder
.
getPayPrice
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
// if (sOrder.getPayPrice().compareTo(BigDecimal.ZERO) != 0) {
throw
new
BaseException
(
"退款金额不能为0,请修改退款金额"
);
// throw new BaseException("退款金额不能为0,请修改退款金额");
// }
// }
// 是否满足退款
boolean
isRefunds
;
if
(
ObjectUtil
.
isNotNull
(
sOrder
.
getCouponId
()))
{
SConsumerCoupon
coupon
=
consumerCouponService
.
getById
(
sOrder
.
getCouponId
());
// 判断是否可以退款
isRefunds
=
isRefund
(
sOrder
,
coupon
);
}
else
{
// 判断是否可以退款
isRefunds
=
isRefund
(
sOrder
,
null
);
}
}
if
(!
isRefunds
)
{
throw
new
BaseException
(
"不满足订单退款规则"
);
}
}
//退款
//退款
if
(
sOrder
.
getPayType
().
equals
(
PayTypeEnum
.
WECHAT
.
get
Valu
e
())
&&
request
.
getAmount
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
if
(
sOrder
.
getPayType
().
equals
(
PayTypeEnum
.
WECHAT
.
get
Cod
e
())
&&
request
.
getAmount
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
try
{
try
{
orderRefundService
.
refund
(
request
,
sOrder
);
orderRefundService
.
refund
(
request
,
sOrder
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -606,7 +624,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -606,7 +624,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sOrder
.
setRefundReason
(
request
.
getRefundReason
());
sOrder
.
setRefundReason
(
request
.
getRefundReason
());
updateById
(
sOrder
);
updateById
(
sOrder
);
//微信退款
//微信退款
if
(
sOrder
.
getPayType
().
equals
(
PayTypeEnum
.
WECHAT
.
get
Valu
e
())
&&
request
.
getAmount
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
if
(
sOrder
.
getPayType
().
equals
(
PayTypeEnum
.
WECHAT
.
get
Cod
e
())
&&
request
.
getAmount
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
// 退款task, 定时任务退优惠券
// 退款task, 定时任务退优惠券
redisUtil
.
lPush
(
Constants
.
ORDER_TASK_REDIS_KEY_AFTER_REFUND_BY_USER
,
sOrder
.
getId
());
redisUtil
.
lPush
(
Constants
.
ORDER_TASK_REDIS_KEY_AFTER_REFUND_BY_USER
,
sOrder
.
getId
());
}
}
...
...
share-system/src/main/java/share/system/service/impl/WechatNewServiceImpl.java
View file @
44ee3d87
...
@@ -595,10 +595,11 @@ public class WechatNewServiceImpl implements WechatNewService {
...
@@ -595,10 +595,11 @@ public class WechatNewServiceImpl implements WechatNewService {
public
WxRefundResponseVo
payRefund
(
WxRefundVo
wxRefundVo
,
String
path
)
{
public
WxRefundResponseVo
payRefund
(
WxRefundVo
wxRefundVo
,
String
path
)
{
String
xmlStr
=
XmlUtil
.
objectToXml
(
wxRefundVo
);
String
xmlStr
=
XmlUtil
.
objectToXml
(
wxRefundVo
);
String
url
=
WeChatConstants
.
PAY_API_URL
+
WeChatConstants
.
PAY_REFUND_API_URI_WECHAT
;
String
url
=
WeChatConstants
.
PAY_API_URL
+
WeChatConstants
.
PAY_REFUND_API_URI_WECHAT
;
HashMap
<
String
,
Object
>
map
=
CollUtil
.
newHashMap
()
;
HashMap
<
String
,
Object
>
map
;
String
xml
=
""
;
String
xml
=
""
;
try
{
try
{
xml
=
restTemplateUtil
.
postWXRefundXml
(
url
,
xmlStr
,
wxRefundVo
.
getMch_id
(),
path
);
xml
=
restTemplateUtil
.
postWXRefundXml
(
url
,
xmlStr
,
wxRefundVo
.
getMch_id
(),
path
);
map
=
XmlUtil
.
xmlToMap
(
xml
);
map
=
XmlUtil
.
xmlToMap
(
xml
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
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