Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
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
hooloo
ms
soss
Commits
6c33c84c
Commit
6c33c84c
authored
Mar 15, 2023
by
weijiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增后台退款接口
parent
08790613
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
5 deletions
+39
-5
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderRefundController.java
+39
-5
No files found.
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderRefundController.java
View file @
6c33c84c
...
@@ -28,14 +28,13 @@ import java.util.Objects;
...
@@ -28,14 +28,13 @@ import java.util.Objects;
/**
/**
* 订单退款Controller
* 订单退款Controller
*
*
* @author zxq
* @author zxq
* @date 2022-04-28
* @date 2022-04-28
*/
*/
@RestController
@RestController
@RequestMapping
(
"/system/refund"
)
@RequestMapping
(
"/system/refund"
)
public
class
OrderRefundController
extends
BaseController
public
class
OrderRefundController
extends
BaseController
{
{
@Autowired
@Autowired
private
IOrderRefundService
orderRefundService
;
private
IOrderRefundService
orderRefundService
;
@Autowired
@Autowired
...
@@ -122,11 +121,46 @@ public class OrderRefundController extends BaseController
...
@@ -122,11 +121,46 @@ public class OrderRefundController extends BaseController
return
ajaxResult
;
return
ajaxResult
;
}
}
/**
* 新增订单退款
*/
@Log
(
title
=
"后台退款"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
(
"/background"
)
public
AjaxResult
background
(
@RequestBody
OrderRefund
orderRefund
)
{
Assert
.
notNull
(
orderRefund
.
getRefundAmount
(),
"退款金额还未传递"
);
orderRefund
.
setCreateUserName
(
"BRAIN"
);
AjaxResult
ajaxResult
=
orderRefundService
.
insertOrderRefund
(
orderRefund
);
Object
obejct
=
ajaxResult
.
get
(
AjaxResult
.
DATA_TAG
);
if
(
obejct
instanceof
OrderRefund
)
{
OrderRefund
orderRefund1
=
(
OrderRefund
)
obejct
;
if
(
RefundState
.
PENDING
.
getState
().
equals
(
orderRefund1
.
getState
()))
{
int
refundAmount
=
orderRefund1
.
getRefundAmount
().
movePointRight
(
2
).
intValue
();
if
(
refundAmount
>
0
)
{
int
totalFee
=
orderRefund1
.
getOrder
().
getPaidAmount
().
movePointRight
(
2
).
intValue
();
boolean
refundSuc
;
try
{
String
refundResult
=
weixinService
.
refund
(
orderRefund1
.
getOrderNo
(),
orderRefund1
.
getRefundNo
(),
totalFee
,
refundAmount
);
refundSuc
=
!
Objects
.
equals
(
"退款失败"
,
refundResult
);
}
catch
(
Exception
e
)
{
refundSuc
=
false
;
}
orderRefund1
.
setState
(
refundSuc
?
RefundState
.
REFUNDING
.
getState
()
:
RefundState
.
FAILURE
.
getState
());
}
else
{
orderRefund1
.
setState
(
RefundState
.
SUCCESS
.
getState
());
}
orderRefundService
.
updateOrderRefund
(
orderRefund1
);
}
}
return
ajaxResult
;
}
@PostMapping
(
"/refund"
)
@PostMapping
(
"/refund"
)
public
void
refund
(){
public
void
refund
()
{
Order
order
=
orderService
.
selectOrderById
(
98L
);
Order
order
=
orderService
.
selectOrderById
(
98L
);
int
totalFee
=
order
.
getAmount
().
movePointRight
(
2
).
intValue
();
int
totalFee
=
order
.
getAmount
().
movePointRight
(
2
).
intValue
();
weixinService
.
refund
(
order
.
getOrderNo
(),
order
.
getOrderNo
()+
"1"
,
totalFee
,
totalFee
);
weixinService
.
refund
(
order
.
getOrderNo
(),
order
.
getOrderNo
()
+
"1"
,
totalFee
,
totalFee
);
}
}
...
...
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