Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
f152a58f
提交
f152a58f
authored
5月 08, 2019
作者:
sin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加退款操作
上级
87574d5e
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
57 行增加
和
8 行删除
+57
-8
AdminOrderReturnController.java
...ication/controller/admins/AdminOrderReturnController.java
+6
-2
OrderReturnService.java
...in/java/cn/iocoder/mall/order/api/OrderReturnService.java
+1
-1
OrderErrorCodeEnum.java
...n/iocoder/mall/order/api/constant/OrderErrorCodeEnum.java
+1
-0
OrderReturnStatusEnum.java
...ocoder/mall/order/api/constant/OrderReturnStatusEnum.java
+1
-3
OrderReturnServiceImpl.java
...ocoder/mall/order/biz/service/OrderReturnServiceImpl.java
+48
-2
没有找到文件。
order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminOrderReturnController.java
浏览文件 @
f152a58f
package
cn
.
iocoder
.
mall
.
order
.
application
.
controller
.
admins
;
import
cn.iocoder.common.framework.util.HttpUtil
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.order.api.OrderReturnService
;
import
cn.iocoder.mall.order.api.bo.OrderReturnListBO
;
...
...
@@ -12,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
/**
* 订单退货
*
...
...
@@ -49,7 +52,8 @@ public class AdminOrderReturnController {
}
@PostMapping
(
"confirm_order"
)
public
CommonResult
confirmOrder
(
@RequestParam
(
"id"
)
Integer
id
)
{
return
orderReturnService
.
refund
(
id
);
public
CommonResult
confirmOrder
(
HttpServletRequest
request
,
@RequestParam
(
"id"
)
Integer
id
)
{
String
ip
=
HttpUtil
.
getIp
(
request
);
return
orderReturnService
.
refund
(
id
,
ip
);
}
}
order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderReturnService.java
浏览文件 @
f152a58f
...
...
@@ -81,5 +81,5 @@ public interface OrderReturnService {
* @param id
* @return
*/
CommonResult
refund
(
Integer
id
);
CommonResult
refund
(
Integer
id
,
String
ip
);
}
order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderErrorCodeEnum.java
浏览文件 @
f152a58f
...
...
@@ -35,6 +35,7 @@ public enum OrderErrorCodeEnum {
// 订单退货
ORDER_RETURN_NO_RETURN_APPLY
(
1008000400
,
"未退货申请"
),
ORDER_RETURN_NOT_EXISTENT
(
1008000401
,
"退货订单不存在"
),
ORDER_RETURN_REFUND_FAILED
(
1008000402
,
"退款失败"
),
// ========== 购物车 ==========
CARD_ITEM_NOT_FOUND
(
1008003000
,
"购物车项不存在"
),
...
...
order/order-service-api/src/main/java/cn/iocoder/mall/order/api/constant/OrderReturnStatusEnum.java
浏览文件 @
f152a58f
...
...
@@ -17,15 +17,13 @@ public enum OrderReturnStatusEnum {
* - 4、退货中
* - 5、已收货
* - 6、拒绝退款
* - 7、退货成功
*/
RETURN_APPLICATION
(
1
,
"退货申请"
),
APPLICATION_SUCCESSFUL
(
2
,
"申请成功"
),
APPLICATION_FAIL
(
3
,
"申请失败"
),
RETURN_IN
(
4
,
"退货中"
),
ORDER_RECEIPT
(
5
,
"确认收货"
),
REFUSE_REFUND
(
6
,
"拒绝退款"
),
RETURN_SUCCESS
(
7
,
"退货成功"
),
RETURN_SUCCESS
(
6
,
"退货成功"
),
;
private
final
int
value
;
...
...
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderReturnServiceImpl.java
浏览文件 @
f152a58f
...
...
@@ -10,6 +10,8 @@ import cn.iocoder.mall.order.api.bo.OrderReturnInfoBO;
import
cn.iocoder.mall.order.api.bo.OrderReturnListBO
;
import
cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum
;
import
cn.iocoder.mall.order.api.constant.OrderReturnStatusEnum
;
import
cn.iocoder.mall.order.api.constant.OrderStatusEnum
;
import
cn.iocoder.mall.order.api.constant.PayAppId
;
import
cn.iocoder.mall.order.api.dto.OrderReturnApplyDTO
;
import
cn.iocoder.mall.order.api.dto.OrderReturnQueryDTO
;
import
cn.iocoder.mall.order.biz.convert.OrderReturnConvert
;
...
...
@@ -19,9 +21,12 @@ import cn.iocoder.mall.order.biz.dao.OrderReturnMapper;
import
cn.iocoder.mall.order.biz.dataobject.OrderDO
;
import
cn.iocoder.mall.order.biz.dataobject.OrderItemDO
;
import
cn.iocoder.mall.order.biz.dataobject.OrderReturnDO
;
import
cn.iocoder.mall.pay.api.PayRefundService
;
import
cn.iocoder.mall.pay.api.dto.PayRefundSubmitDTO
;
import
org.apache.dubbo.config.annotation.Reference
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.util.Collections
;
...
...
@@ -48,6 +53,8 @@ public class OrderReturnServiceImpl implements OrderReturnService {
@Reference
(
validation
=
"true"
)
private
OrderLogisticsService
orderLogisticsService
;
@Reference
(
validation
=
"true"
)
private
PayRefundService
payRefundService
;
@Override
public
CommonResult
orderReturnApply
(
OrderReturnApplyDTO
orderReturnDTO
)
{
...
...
@@ -188,12 +195,51 @@ public class OrderReturnServiceImpl implements OrderReturnService {
}
@Override
public
CommonResult
refund
(
Integer
id
)
{
@Transactional
public
CommonResult
refund
(
Integer
id
,
String
ip
)
{
OrderReturnDO
orderReturnDO
=
orderReturnMapper
.
selectById
(
id
);
if
(
orderReturnDO
==
null
)
{
return
ServiceExceptionUtil
.
error
(
OrderErrorCodeEnum
.
ORDER_RETURN_NOT_EXISTENT
.
getCode
());
}
// TODO: 2019/5/8 sin, 发送 MQ 消息,申请退货成功!
// TODO: 2019/5/8 sin 退款:支付系统退款
// TODO: 2019/5/8 sin 退货+退款:退回商品签收后,支付系统退款
// TODO: 2019/5/8 sin 事务一致性 [重要]
// 支付退款
CommonResult
payResult
=
payRefundService
.
submitRefund
(
new
PayRefundSubmitDTO
()
.
setAppId
(
PayAppId
.
APP_ID_SHOP_ORDER
)
.
setOrderId
(
String
.
valueOf
(
orderReturnDO
.
getOrderId
()))
.
setPrice
(
orderReturnDO
.
getRefundPrice
())
.
setOrderDescription
(
""
)
.
setCreateIp
(
ip
)
);
if
(!
payResult
.
isSuccess
())
{
return
ServiceExceptionUtil
.
error
(
OrderErrorCodeEnum
.
ORDER_RETURN_REFUND_FAILED
.
getCode
());
}
return
null
;
// 更新 订单退货 信息
orderReturnMapper
.
updateByOrderId
(
new
OrderReturnDO
()
.
setId
(
id
)
.
setStatus
(
OrderReturnStatusEnum
.
RETURN_SUCCESS
.
getValue
())
);
// 更新订单
orderMapper
.
updateById
(
new
OrderDO
()
.
setId
(
orderReturnDO
.
getOrderId
())
.
setStatus
(
OrderStatusEnum
.
COMPLETED
.
getValue
())
);
// 更新订单
orderItemMapper
.
updateByOrderId
(
orderReturnDO
.
getOrderId
(),
new
OrderItemDO
().
setStatus
(
OrderStatusEnum
.
COMPLETED
.
getValue
())
);
return
CommonResult
.
success
(
null
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论