记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
董敬伟
liquidnet-bus-v1
Commits
3f7fc023
Commit
3f7fc023
authored
Nov 11, 2021
by
zhengfuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抖音查询退款
parent
4f030082
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
95 additions
and
4 deletions
+95
-4
DragonErrorCodeEnum.java
...iquidnet/service/dragon/constant/DragonErrorCodeEnum.java
+2
-0
IDragonOrderRefundsService.java
...et/service/dragon/service/IDragonOrderRefundsService.java
+2
-0
AbstractDouYinPayStrategy.java
...el/douyinpay/strategy/impl/AbstractDouYinPayStrategy.java
+1
-1
RefundController.java
...liquidnet/service/dragon/controller/RefundController.java
+9
-0
DragonOrderRefundsServiceImpl.java
...ce/dragon/service/impl/DragonOrderRefundsServiceImpl.java
+75
-3
DragonOrderRefundsServiceImpl.java
...ce/dragon/service/impl/DragonOrderRefundsServiceImpl.java
+6
-0
No files found.
liquidnet-bus-api/liquidnet-service-dragon-api/src/main/java/com/liquidnet/service/dragon/constant/DragonErrorCodeEnum.java
View file @
3f7fc023
...
...
@@ -31,6 +31,8 @@ public enum DragonErrorCodeEnum {
TRADE_DOUYINPAY_SIGN_ERROR
(
"PAY0030001"
,
"抖音签名异常!"
),
TRADE_DOUYINPAY_QUERY_ERROR
(
"PAY0030002"
,
"抖音查询退款异常!"
),
TRADE_WEPAY_QUERY_ERROR
(
"PAY0020002"
,
"微信订单查询失败!"
);
private
String
code
;
...
...
liquidnet-bus-api/liquidnet-service-dragon-api/src/main/java/com/liquidnet/service/dragon/service/IDragonOrderRefundsService.java
View file @
3f7fc023
...
...
@@ -26,4 +26,6 @@ public interface IDragonOrderRefundsService {
String
douYinPayRefundCallBack
(
HttpServletRequest
request
,
HttpServletResponse
response
);
String
douYinPayRefundCodeStatus
(
String
outRefundNo
);
}
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/channel/douyinpay/strategy/impl/AbstractDouYinPayStrategy.java
View file @
3f7fc023
...
...
@@ -48,7 +48,7 @@ import java.util.TreeMap;
@Slf4j
public
abstract
class
AbstractDouYinPayStrategy
implements
IDouYinpayStrategy
{
// 订单过期时间(秒); 最小 15 分钟,最大两天
private
int
valid_time
=
180
;
private
int
valid_time
=
60
*
60
*
24
*
2
;
@Autowired
private
WepayBiz
wepayBiz
;
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/controller/RefundController.java
View file @
3f7fc023
...
...
@@ -63,6 +63,15 @@ public class RefundController {
public
String
douYinCallBack
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
return
orderRefundsService
.
douYinPayRefundCallBack
(
request
,
response
);
}
@PostMapping
(
"refund/douyinpay/result"
)
@ApiOperation
(
"抖音查询退款结果"
)
@ApiResponse
(
code
=
200
,
message
=
"接口返回对象参数"
)
public
String
douYinResult
(
@RequestParam
(
value
=
"outRefundNo"
)
String
outRefundNo
)
{
return
orderRefundsService
.
douYinPayRefundCodeStatus
(
outRefundNo
);
}
}
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/service/impl/DragonOrderRefundsServiceImpl.java
View file @
3f7fc023
...
...
@@ -30,6 +30,7 @@ import org.apache.http.HttpEntity;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.util.EntityUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -45,9 +46,7 @@ import java.io.InputStream;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.SortedMap
;
import
java.util.TreeMap
;
import
java.util.*
;
@Slf4j
@Service
...
...
@@ -405,6 +404,78 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
return
""
;
}
/**
* @author zhangfuxin
* @Description: 查询退款
* @date 2021/11/11 下午3:21
*/
@Override
public
String
douYinPayRefundCodeStatus
(
String
outRefundNo
)
{
try
{
//1、组织数据
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"app_id"
,
PayDouYinpayUtils
.
getInstance
().
getAPP_ID
());
map
.
put
(
"out_refund_no"
,
outRefundNo
);
//2、加密
map
.
put
(
"sign"
,
PayDouYinpayUtils
.
getInstance
().
createSign
(
map
));
//3、请求
String
data
=
JSON
.
toJSONString
(
map
);
log
.
info
(
"查询退款请求抖音参数:{}"
,
data
);
HttpPost
httpost
=
new
HttpPost
(
"https://developer.toutiao.com/api/apps/ecpay/v1/query_refund"
);
httpost
.
setEntity
(
new
StringEntity
(
data
,
"UTF-8"
));
CloseableHttpClient
httpClient
=
PayDouYinpayUtils
.
getInstance
().
getHttpClient
();
CloseableHttpResponse
response
=
httpClient
.
execute
(
httpost
);
HttpEntity
entity
=
response
.
getEntity
();
//接受到返回信息
String
json
=
EntityUtils
.
toString
(
response
.
getEntity
(),
"UTF-8"
);
EntityUtils
.
consume
(
entity
);
log
.
info
(
"查询抖音退款返回值:{}"
,
json
);
//解析、如果成功,则更新
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
json
);
if
(
jsonObject
.
getInteger
(
"err_no"
)==
0
){
JSONObject
refundInfo
=
jsonObject
.
getJSONObject
(
"refundInfo"
);
NotifyUrlDto
dto
=
new
NotifyUrlDto
();
if
(
refundInfo
.
getString
(
"refund_status"
).
equals
(
"SUCCESS"
)){
dto
.
setStatus
(
1
);
}
else
{
dto
.
setStatus
(
0
);
}
//开发者自定义的退款单号
dto
.
setOrderRefundCode
(
refundInfo
.
getString
(
"refund_no"
));
// 没有订单号
dto
.
setRefundCode
(
""
);
dto
.
setRefundPrice
(
refundInfo
.
getBigDecimal
(
"refund_amount"
).
divide
(
BigDecimal
.
valueOf
(
100
)).
toString
());
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
" yyyy年MM月dd日 "
);
// 抖音没有传回时间
dto
.
setRefundAt
(
sdf
.
format
(
new
Date
()));
//抖音回调没有写错误原因
dto
.
setRefundError
(
""
);
log
.
info
(
"SEND DOUYINPAY NOTIFTURL = "
+
JSON
.
toJSONString
(
dto
));
sendNotifyUrl
(
dto
,
null
);
//创建退款订单日志
mqHandleUtil
.
sendMySqlRedis
(
SqlMapping
.
get
(
"dragon_order_refund_log.insert"
),
new
Object
[]{
refundInfo
.
getString
(
"refund_no"
),
""
,
JSON
.
toJSONString
(
jsonObject
),
nowTime
,
nowTime
},
DragonConstant
.
MysqlRedisQueueEnum
.
DRAGON_REFUND_KEY
.
getCode
()
);
//修改订单 状态
mqHandleUtil
.
sendMySqlRedis
(
SqlMapping
.
get
(
"dragon_order_refund_success.update"
),
new
Object
[]{
nowTime
,
dto
.
getRefundAt
(),
DragonConstant
.
RefundStatusEnum
.
STATUS_REFUNDED
.
getCode
(),
refundInfo
.
getString
(
"refund_no"
)},
DragonConstant
.
MysqlRedisQueueEnum
.
DRAGON_REFUND_KEY
.
getCode
()
);
}
else
{
throw
new
LiquidnetServiceException
(
DragonErrorCodeEnum
.
TRADE_DOUYINPAY_QUERY_ERROR
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_DOUYINPAY_QUERY_ERROR
.
getMessage
());
}
return
json
;
}
catch
(
Exception
e
){
log
.
info
(
"查询退款报错:{}"
,
e
);
}
return
""
;
}
@Override
public
String
wePayRefundCallBack
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
...
...
@@ -613,3 +684,4 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
}
}
liquidnet-bus-service/liquidnet-service-notify/liquidnet-service-notify-impl/src/main/java/com/liquidnet/service/dragon/service/impl/DragonOrderRefundsServiceImpl.java
View file @
3f7fc023
...
...
@@ -514,6 +514,12 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
return
""
;
}
@Override
public
String
douYinPayRefundCodeStatus
(
String
outRefundNo
)
{
return
null
;
}
@Override
public
String
wePayRefundCallBack
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
InputStream
inStream
;
...
...
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