mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 17:21:53 +08:00
trade:【交易售后】增加会员取消售后
This commit is contained in:
parent
ed9c8d4a78
commit
64df5ce5f4
@ -35,6 +35,7 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode AFTER_SALE_DELIVERY_FAIL_STATUS_NOT_SELLER_AGREE = new ErrorCode(1011000108, "退货失败,售后单状态不处于【待买家退货】");
|
ErrorCode AFTER_SALE_DELIVERY_FAIL_STATUS_NOT_SELLER_AGREE = new ErrorCode(1011000108, "退货失败,售后单状态不处于【待买家退货】");
|
||||||
ErrorCode AFTER_SALE_CONFIRM_FAIL_STATUS_NOT_BUYER_DELIVERY = new ErrorCode(1011000109, "确认收货失败,售后单状态不处于【待确认收货】");
|
ErrorCode AFTER_SALE_CONFIRM_FAIL_STATUS_NOT_BUYER_DELIVERY = new ErrorCode(1011000109, "确认收货失败,售后单状态不处于【待确认收货】");
|
||||||
ErrorCode AFTER_SALE_REFUND_FAIL_STATUS_NOT_WAIT_REFUND = new ErrorCode(1011000110, "退款失败,售后单状态不是【待退款】");
|
ErrorCode AFTER_SALE_REFUND_FAIL_STATUS_NOT_WAIT_REFUND = new ErrorCode(1011000110, "退款失败,售后单状态不是【待退款】");
|
||||||
|
ErrorCode AFTER_SALE_CANCEL_FAIL_STATUS_NOT_APPLY_OR_AGREE = new ErrorCode(1011000111, "取消售后单失败,售后单状态不是【待审核】或【卖家同意】");
|
||||||
|
|
||||||
// ========== Cart 模块 1-011-001-000 ==========
|
// ========== Cart 模块 1-011-001-000 ==========
|
||||||
ErrorCode CARD_ITEM_NOT_FOUND = new ErrorCode(1011002000, "购物车项不存在");
|
ErrorCode CARD_ITEM_NOT_FOUND = new ErrorCode(1011002000, "购物车项不存在");
|
||||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
|||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleDisagreeReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleDisagreeReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSalePageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSalePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleRefuseReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleRespPageItemVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleRespPageItemVO;
|
||||||
import cn.iocoder.yudao.module.trade.convert.aftersale.TradeAfterSaleConvert;
|
import cn.iocoder.yudao.module.trade.convert.aftersale.TradeAfterSaleConvert;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO;
|
||||||
@ -82,6 +83,15 @@ public class TradeAfterSaleController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping("/receive")
|
||||||
|
@ApiOperation("确认收货")
|
||||||
|
@ApiImplicitParam(name = "id", value = "售后编号", required = true, example = "1")
|
||||||
|
@PreAuthorize("@ss.hasPermission('trade:after-sale:receive')")
|
||||||
|
public CommonResult<Boolean> refuseAfterSale(TradeAfterSaleRefuseReqVO refuseReqVO) {
|
||||||
|
afterSaleService.refuseAfterSale(getLoginUserId(), refuseReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/refund")
|
@PostMapping("/refund")
|
||||||
@ApiOperation(value = "确认退款")
|
@ApiOperation(value = "确认退款")
|
||||||
@ApiImplicitParam(name = "id", value = "售后编号", required = true, example = "1")
|
@ApiImplicitParam(name = "id", value = "售后编号", required = true, example = "1")
|
||||||
|
@ -5,13 +5,11 @@ import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSa
|
|||||||
import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleDeliveryReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleDeliveryReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.service.aftersale.TradeAfterSaleService;
|
import cn.iocoder.yudao.module.trade.service.aftersale.TradeAfterSaleService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
@ -41,4 +39,12 @@ public class AppTradeAfterSaleController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeleteMapping(value = "/cancel")
|
||||||
|
@ApiOperation(value = "取消售后")
|
||||||
|
@ApiImplicitParam(name = "id", value = "售后编号", required = true, example = "1")
|
||||||
|
public CommonResult<Boolean> cancelAfterSale(@RequestParam("id") Long id) {
|
||||||
|
afterSaleService.cancelAfterSale(getLoginUserId(), id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -70,9 +70,9 @@ public interface TradeAfterSaleService {
|
|||||||
* 【管理员】拒绝收货
|
* 【管理员】拒绝收货
|
||||||
*
|
*
|
||||||
* @param userId 管理员用户编号
|
* @param userId 管理员用户编号
|
||||||
* @param confirmReqVO 收货 Request 信息
|
* @param refuseReqVO 拒绝收货 Request 信息
|
||||||
*/
|
*/
|
||||||
void refuseAfterSale(Long userId, TradeAfterSaleRefuseReqVO confirmReqVO);
|
void refuseAfterSale(Long userId, TradeAfterSaleRefuseReqVO refuseReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【管理员】确认退款
|
* 【管理员】确认退款
|
||||||
@ -83,4 +83,12 @@ public interface TradeAfterSaleService {
|
|||||||
*/
|
*/
|
||||||
void refundAfterSale(Long userId, String userIp, Long id);
|
void refundAfterSale(Long userId, String userIp, Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【会员】取消售后
|
||||||
|
*
|
||||||
|
* @param userId 会员用户编号
|
||||||
|
* @param id 交易售后编号
|
||||||
|
*/
|
||||||
|
void cancelAfterSale(Long userId, Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
||||||
import cn.iocoder.yudao.module.pay.api.refund.PayRefundApi;
|
import cn.iocoder.yudao.module.pay.api.refund.PayRefundApi;
|
||||||
import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO;
|
import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleDisagreeReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleDisagreeReqVO;
|
||||||
@ -262,9 +263,9 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void refuseAfterSale(Long userId, TradeAfterSaleRefuseReqVO confirmReqVO) {
|
public void refuseAfterSale(Long userId, TradeAfterSaleRefuseReqVO refuseReqVO) {
|
||||||
// 校验售后单存在,并状态为已退货
|
// 校验售后单存在,并状态为已退货
|
||||||
TradeAfterSaleDO afterSale = tradeAfterSaleMapper.selectById(confirmReqVO.getId());
|
TradeAfterSaleDO afterSale = tradeAfterSaleMapper.selectById(refuseReqVO.getId());
|
||||||
if (afterSale == null) {
|
if (afterSale == null) {
|
||||||
throw exception(AFTER_SALE_NOT_FOUND);
|
throw exception(AFTER_SALE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
@ -275,7 +276,7 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService {
|
|||||||
// 更新售后单的状态
|
// 更新售后单的状态
|
||||||
updateAfterSaleStatus(afterSale.getId(), TradeAfterSaleStatusEnum.BUYER_DELIVERY.getStatus(), new TradeAfterSaleDO()
|
updateAfterSaleStatus(afterSale.getId(), TradeAfterSaleStatusEnum.BUYER_DELIVERY.getStatus(), new TradeAfterSaleDO()
|
||||||
.setStatus(TradeAfterSaleStatusEnum.SELLER_REFUSE.getStatus()).setReceiveTime(LocalDateTime.now())
|
.setStatus(TradeAfterSaleStatusEnum.SELLER_REFUSE.getStatus()).setReceiveTime(LocalDateTime.now())
|
||||||
.setReceiveReason(confirmReqVO.getRefuseMemo()));
|
.setReceiveReason(refuseReqVO.getRefuseMemo()));
|
||||||
|
|
||||||
// 记录售后日志
|
// 记录售后日志
|
||||||
createAfterSaleLog(userId, UserTypeEnum.ADMIN.getValue(),
|
createAfterSaleLog(userId, UserTypeEnum.ADMIN.getValue(),
|
||||||
@ -351,6 +352,34 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancelAfterSale(Long userId, Long id) {
|
||||||
|
// 校验售后单的状态,并状态待退款
|
||||||
|
TradeAfterSaleDO afterSale = tradeAfterSaleMapper.selectByPayRefundId(id);
|
||||||
|
if (afterSale == null) {
|
||||||
|
throw exception(AFTER_SALE_NOT_FOUND);
|
||||||
|
}
|
||||||
|
if (ObjectUtils.equalsAny(afterSale.getStatus(), TradeAfterSaleStatusEnum.APPLY.getStatus(),
|
||||||
|
TradeAfterSaleStatusEnum.SELLER_AGREE.getStatus())) {
|
||||||
|
throw exception(AFTER_SALE_CANCEL_FAIL_STATUS_NOT_APPLY_OR_AGREE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新售后单的状态为【已取消】
|
||||||
|
updateAfterSaleStatus(afterSale.getId(), afterSale.getStatus(), new TradeAfterSaleDO()
|
||||||
|
.setStatus(TradeAfterSaleStatusEnum.BUYER_CANCEL.getStatus()));
|
||||||
|
|
||||||
|
// 记录售后日志
|
||||||
|
createAfterSaleLog(userId, UserTypeEnum.MEMBER.getValue(),
|
||||||
|
afterSale, afterSale.getStatus(), TradeAfterSaleStatusEnum.BUYER_CANCEL.getStatus());
|
||||||
|
|
||||||
|
// TODO 发送售后消息
|
||||||
|
|
||||||
|
// 更新交易订单项的售后状态为【未申请】
|
||||||
|
tradeOrderService.updateOrderItemAfterSaleStatus(afterSale.getOrderItemId(),
|
||||||
|
TradeOrderItemAfterSaleStatusEnum.APPLY.getStatus(),
|
||||||
|
TradeOrderItemAfterSaleStatusEnum.NONE.getStatus(), null);
|
||||||
|
}
|
||||||
|
|
||||||
private void createAfterSaleLog(Long userId, Integer userType, TradeAfterSaleDO afterSale,
|
private void createAfterSaleLog(Long userId, Integer userType, TradeAfterSaleDO afterSale,
|
||||||
Integer beforeStatus, Integer afterStatus) {
|
Integer beforeStatus, Integer afterStatus) {
|
||||||
TradeAfterSaleLogDO afterSaleLog = new TradeAfterSaleLogDO().setUserId(userId).setUserType(userType)
|
TradeAfterSaleLogDO afterSaleLog = new TradeAfterSaleLogDO().setUserId(userId).setUserType(userType)
|
||||||
|
Loading…
Reference in New Issue
Block a user