- 退款流程基本走完
This commit is contained in:
@@ -30,7 +30,7 @@ public interface OrderReturnMapper {
|
||||
* @param orderReturnDO
|
||||
* @return
|
||||
*/
|
||||
int updateByOrderId(OrderReturnDO orderReturnDO);
|
||||
int updateById(OrderReturnDO orderReturnDO);
|
||||
|
||||
/**
|
||||
* 查询 - 根据 orderId
|
||||
|
||||
@@ -63,6 +63,10 @@ public class OrderReturnDO extends BaseDO {
|
||||
* 同意时间
|
||||
*/
|
||||
private Date approvalTime;
|
||||
/**
|
||||
* 拒绝时间
|
||||
*/
|
||||
private Date refuseTime;
|
||||
/**
|
||||
* 物流时间(填写物流单号时间)
|
||||
*/
|
||||
@@ -90,8 +94,7 @@ public class OrderReturnDO extends BaseDO {
|
||||
* - 3、申请失败
|
||||
* - 4、退货中
|
||||
* - 5、已收货
|
||||
* - 6、拒绝退款
|
||||
* - 7、退货成功
|
||||
* - 6、退货成功
|
||||
*/
|
||||
private Integer status;
|
||||
}
|
||||
|
||||
@@ -3,15 +3,14 @@ package cn.iocoder.mall.order.biz.service;
|
||||
import cn.iocoder.common.framework.constant.DeletedStatusEnum;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.admin.api.DataDictService;
|
||||
import cn.iocoder.mall.admin.api.bo.DataDictBO;
|
||||
import cn.iocoder.mall.order.api.OrderLogisticsService;
|
||||
import cn.iocoder.mall.order.api.OrderReturnService;
|
||||
import cn.iocoder.mall.order.api.bo.OrderLastLogisticsInfoBO;
|
||||
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.constant.*;
|
||||
import cn.iocoder.mall.order.api.dto.OrderReturnApplyDTO;
|
||||
import cn.iocoder.mall.order.api.dto.OrderReturnQueryDTO;
|
||||
import cn.iocoder.mall.order.biz.convert.OrderReturnConvert;
|
||||
@@ -55,6 +54,9 @@ public class OrderReturnServiceImpl implements OrderReturnService {
|
||||
private OrderLogisticsService orderLogisticsService;
|
||||
@Reference(validation = "true", version = "${dubbo.consumer.PayRefundService.version}")
|
||||
private PayRefundService payRefundService;
|
||||
@Reference(validation = "true", version = "${dubbo.consumer.DataDictService.version}")
|
||||
private DataDictService dataDictService;
|
||||
|
||||
|
||||
@Override
|
||||
public CommonResult orderReturnApply(OrderReturnApplyDTO orderReturnDTO) {
|
||||
@@ -156,9 +158,10 @@ public class OrderReturnServiceImpl implements OrderReturnService {
|
||||
.error(OrderErrorCodeEnum.ORDER_RETURN_NOT_EXISTENT.getCode());
|
||||
}
|
||||
|
||||
orderReturnMapper.updateByOrderId(
|
||||
orderReturnMapper.updateById(
|
||||
new OrderReturnDO()
|
||||
.setId(id)
|
||||
.setApprovalTime(new Date())
|
||||
.setStatus(OrderReturnStatusEnum.APPLICATION_SUCCESSFUL.getValue())
|
||||
);
|
||||
return CommonResult.success(null);
|
||||
@@ -171,9 +174,10 @@ public class OrderReturnServiceImpl implements OrderReturnService {
|
||||
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_RETURN_NOT_EXISTENT.getCode());
|
||||
}
|
||||
|
||||
orderReturnMapper.updateByOrderId(
|
||||
orderReturnMapper.updateById(
|
||||
new OrderReturnDO()
|
||||
.setId(id)
|
||||
.setRefuseTime(new Date())
|
||||
.setStatus(OrderReturnStatusEnum.APPLICATION_FAIL.getValue())
|
||||
);
|
||||
return CommonResult.success(null);
|
||||
@@ -186,9 +190,10 @@ public class OrderReturnServiceImpl implements OrderReturnService {
|
||||
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_RETURN_NOT_EXISTENT.getCode());
|
||||
}
|
||||
|
||||
orderReturnMapper.updateByOrderId(
|
||||
orderReturnMapper.updateById(
|
||||
new OrderReturnDO()
|
||||
.setId(id)
|
||||
.setReceiverTime(new Date())
|
||||
.setStatus(OrderReturnStatusEnum.ORDER_RECEIPT.getValue())
|
||||
);
|
||||
return CommonResult.success(null);
|
||||
@@ -207,13 +212,24 @@ public class OrderReturnServiceImpl implements OrderReturnService {
|
||||
// TODO: 2019/5/8 sin 退货+退款:退回商品签收后,支付系统退款
|
||||
// TODO: 2019/5/8 sin 事务一致性 [重要]
|
||||
|
||||
|
||||
CommonResult<DataDictBO> dataDictResult = dataDictService
|
||||
.getDataDict(DictKeyConstants.ORDER_RETURN_REASON, orderReturnDO.getReason());
|
||||
|
||||
if (dataDictResult.isError()) {
|
||||
return ServiceExceptionUtil.error(OrderErrorCodeEnum.DICT_SERVER_INVOKING_FAIL.getCode());
|
||||
}
|
||||
|
||||
// 支付退款
|
||||
String orderDescription = dataDictResult.getData()
|
||||
.getDisplayName() + "(" + orderReturnDO.getDescribe() + ")";
|
||||
|
||||
CommonResult payResult = payRefundService.submitRefund(
|
||||
new PayRefundSubmitDTO()
|
||||
.setAppId(PayAppId.APP_ID_SHOP_ORDER)
|
||||
.setOrderId(String.valueOf(orderReturnDO.getOrderId()))
|
||||
.setPrice(orderReturnDO.getRefundPrice())
|
||||
.setOrderDescription("")
|
||||
.setOrderDescription(orderDescription)
|
||||
.setCreateIp(ip)
|
||||
);
|
||||
|
||||
@@ -222,9 +238,10 @@ public class OrderReturnServiceImpl implements OrderReturnService {
|
||||
}
|
||||
|
||||
// 更新 订单退货 信息
|
||||
orderReturnMapper.updateByOrderId(
|
||||
orderReturnMapper.updateById(
|
||||
new OrderReturnDO()
|
||||
.setId(id)
|
||||
.setClosingTime(new Date())
|
||||
.setStatus(OrderReturnStatusEnum.RETURN_SUCCESS.getValue())
|
||||
);
|
||||
|
||||
@@ -232,13 +249,16 @@ public class OrderReturnServiceImpl implements OrderReturnService {
|
||||
orderMapper.updateById(
|
||||
new OrderDO()
|
||||
.setId(orderReturnDO.getOrderId())
|
||||
.setClosingTime(new Date())
|
||||
.setStatus(OrderStatusEnum.COMPLETED.getValue())
|
||||
);
|
||||
|
||||
// 更新订单
|
||||
orderItemMapper.updateByOrderId(
|
||||
orderReturnDO.getOrderId(),
|
||||
new OrderItemDO().setStatus(OrderStatusEnum.COMPLETED.getValue())
|
||||
new OrderItemDO()
|
||||
.setClosingTime(new Date())
|
||||
.setStatus(OrderStatusEnum.COMPLETED.getValue())
|
||||
);
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
reason,
|
||||
`describe`,
|
||||
approval_time,
|
||||
refuse_time,
|
||||
logistics_time,
|
||||
receiver_time,
|
||||
closing_time,
|
||||
@@ -28,13 +29,13 @@
|
||||
INSERT INTO `order_return` (
|
||||
service_number, order_id, order_no, order_logistics_id,
|
||||
refund_price, reason, `describe`,
|
||||
approval_time, logistics_time, receiver_time, closing_time,
|
||||
approval_time, refuse_time, logistics_time, receiver_time, closing_time,
|
||||
service_type, status,
|
||||
create_time, update_time)
|
||||
VALUES (
|
||||
#{serviceNumber}, #{orderId}, #{orderNo}, #{orderLogisticsId},
|
||||
${refundPrice}, #{reason}, #{describe},
|
||||
#{approvalTime}, #{logisticsTime}, #{receiverTime}, #{closingTime},
|
||||
#{approvalTime}, #{refuse_time}, #{logisticsTime}, #{receiverTime}, #{closingTime},
|
||||
#{serviceType}, #{status}, #{createTime}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
@@ -58,20 +59,20 @@
|
||||
<if test="approvalTime != null">
|
||||
, approval_time = #{approvalTime}
|
||||
</if>
|
||||
<if test="refuseTime != null">
|
||||
, refuse_time = #{refuseTime}
|
||||
</if>
|
||||
<if test="logisticsTime != null">
|
||||
, logistics_time = #{logisticsTime}
|
||||
</if>
|
||||
<if test="receiverTime != null">
|
||||
, receiver_time = #{receiverTime}
|
||||
</if>
|
||||
<if test="deliveryTime != null">
|
||||
, delivery_time = #{deliveryTime}
|
||||
</if>
|
||||
<if test="closingTime != null">
|
||||
, closing_time = #{closingTime}
|
||||
</if>
|
||||
<if test="returnType != null">
|
||||
, return_type = #{returnType}
|
||||
<if test="serviceType != null">
|
||||
, service_type = #{serviceType}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
, status = #{status}
|
||||
@@ -88,10 +89,10 @@
|
||||
<!--
|
||||
更新 - 根据 id 更新
|
||||
-->
|
||||
<update id="updateByOrderId" parameterType="OrderReturnDO">
|
||||
<update id="updateById" parameterType="OrderReturnDO">
|
||||
UPDATE `order_return`
|
||||
<include refid="updateFieldSql"/>
|
||||
WHERE order_id = #{orderId}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!--
|
||||
@@ -109,6 +110,12 @@
|
||||
列表查询 - where
|
||||
-->
|
||||
<sql id="selectListWhere">
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="serviceNumber != null">
|
||||
AND service_number = #{serviceNumber}
|
||||
</if>
|
||||
<if test="orderId != null">
|
||||
AND order_id = #{orderId}
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user