pull/1121/head
梁宇奇 2025-07-13 16:43:19 +08:00
parent 7327b36175
commit e92685e322
12 changed files with 273 additions and 1 deletions

View File

@ -15,6 +15,7 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.notice.fs.FsNotice;
import com.ruoyi.web.controller.xkt.vo.order.*;
import com.ruoyi.xkt.domain.StoreOrder;
import com.ruoyi.xkt.domain.StoreOrderDetail;
import com.ruoyi.xkt.dto.express.ExpressCancelReqDTO;
import com.ruoyi.xkt.dto.express.ExpressInterceptReqDTO;
@ -268,6 +269,42 @@ public class StoreOrderController extends XktBaseController {
return success(afterSaleApplyResult.getStoreOrderId());
}
@PreAuthorize("@ss.hasAnyRoles('seller,store')||@ss.hasSupplierSubRole()")
@Log(title = "订单", businessType = BusinessType.OTHER)
@ApiOperation("申请平台介入")
@PostMapping("platform-involve/apply")
public R<Long> applyPlatformInvolve(@Valid @RequestBody PlatformInvolveApplyReqVO vo) {
Long orderId = vo.getStoreOrderId();
Long userId = SecurityUtils.getUserId();
Long storeId = SecurityUtils.getStoreId();
StoreOrder order = storeOrderService.getById(orderId);
Assert.notNull(order, "订单不存在");
if (Objects.equals(order.getStoreId(), storeId)
|| Objects.equals(order.getOrderUserId(), userId)) {
storeOrderService.applyPlatformInvolve(orderId, vo.getPlatformInvolveReason());
return R.ok(orderId);
}
return R.fail("无权限");
}
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
@Log(title = "订单", businessType = BusinessType.OTHER)
@ApiOperation("平台介入完成(管理员)")
@PostMapping("platform-involve/complete")
public R<Long> completePlatformInvolve(@Valid @RequestBody PlatformInvolveCompleteVO vo) {
storeOrderService.completePlatformInvolve(vo.getStoreOrderId(), vo.getPlatformInvolveResult());
return R.ok(vo.getStoreOrderId());
}
@PreAuthorize("@ss.hasAnyRoles('seller')")
@Log(title = "订单", businessType = BusinessType.OTHER)
@ApiOperation("售后完成(用户)")
@PostMapping("refund/complete")
public R<Long> completeRefundByUser(@Valid @RequestBody RefundCompleteVO vo) {
storeOrderService.completeRefundByUser(vo.getStoreOrderId());
return R.ok(vo.getStoreOrderId());
}
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()")
@Log(title = "订单", businessType = BusinessType.OTHER)
@ApiOperation("确认退款")

View File

@ -0,0 +1,25 @@
package com.ruoyi.web.controller.xkt.vo.order;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @author liangyq
* @date 2025-07-12
*/
@ApiModel
@Data
public class PlatformInvolveApplyReqVO {
@NotNull(message = "订单ID不能为空")
@ApiModelProperty(value = "订单ID", required = true)
private Long storeOrderId;
@NotNull(message = "平台介入原因不能为空")
@ApiModelProperty(value = "平台介入原因", required = true)
private String platformInvolveReason;
}

View File

@ -0,0 +1,25 @@
package com.ruoyi.web.controller.xkt.vo.order;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @author liangyq
* @date 2025-07-12
*/
@ApiModel
@Data
public class PlatformInvolveCompleteVO {
@NotNull(message = "订单ID不能为空")
@ApiModelProperty(value = "订单ID", required = true)
private Long storeOrderId;
@NotNull(message = "平台介入处理结果不能为空")
@ApiModelProperty(value = "平台介入处理结果", required = true)
private String platformInvolveResult;
}

View File

@ -0,0 +1,21 @@
package com.ruoyi.web.controller.xkt.vo.order;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @author liangyq
* @date 2025-07-12
*/
@ApiModel
@Data
public class RefundCompleteVO {
@NotNull(message = "订单ID不能为空")
@ApiModelProperty(value = "订单ID", required = true)
private Long storeOrderId;
}

View File

@ -446,6 +446,12 @@ public class StoreOrderInfoVO {
@ApiModelProperty(value = "档口地址")
private String storeAddress;
@ApiModelProperty(value = "平台介入原因")
private String platformInvolveReason;
@ApiModelProperty(value = "平台介入结果")
private String platformInvolveResult;
}
@ApiModel

View File

@ -250,6 +250,12 @@ public class StoreOrderPageItemVO extends StoreOrderDTO {
@ApiModelProperty(value = "订单明细")
private List<Detail> orderDetails;
@ApiModelProperty(value = "平台介入原因")
private String platformInvolveReason;
@ApiModelProperty(value = "平台介入结果")
private String platformInvolveResult;
@ApiModel
@Data
public static class Detail {

View File

@ -92,7 +92,7 @@ public class StoreOrderQueryVO extends BasePageVO {
private String prodArtNum;
@NotNull(message = "来源页面不能为空")
@ApiModelProperty(value = "来源页面[1:卖家订单列表 2:档口订单列表]", required = true)
@ApiModelProperty(value = "来源页面[1:卖家订单列表 2:档口/平台订单列表]", required = true)
private Integer srcPage;
}

View File

@ -155,6 +155,14 @@ public class StoreOrder extends SimpleEntity {
*
*/
private Date voucherDate;
/**
*
*/
private String platformInvolveReason;
/**
*
*/
private String platformInvolveResult;
/**
*
*/

View File

@ -173,6 +173,14 @@ public class StoreOrderDTO {
*
*/
private Date updateTime;
/**
*
*/
private String platformInvolveReason;
/**
*
*/
private String platformInvolveResult;
/**
*
*/

View File

@ -22,6 +22,9 @@ public enum EOrderAction {
REJECT_AFTER_SALE(9, "拒绝售后"),
CONFIRM_AFTER_SALE(10, "确认售后"),
REFUND(11, "退款"),
APPLY_PLATFORM_INVOLVE(12, "申请平台介入"),
COMPLETE_PLATFORM_INVOLVE(13, "平台介入完成"),
USER_COMPLETE_AFTER_SALE(14, "用户确认售后完成"),
;
private final Integer value;

View File

@ -45,6 +45,14 @@ public interface IStoreOrderService {
*/
StoreOrder getByOrderNo(String orderNo);
/**
* ID
*
* @param id
* @return
*/
StoreOrder getById(Long id);
/**
*
*
@ -218,4 +226,27 @@ public interface IStoreOrderService {
* @param storeId
*/
void checkOrderStore(Collection<Long> storeOrderDetailIds, Long storeId);
/**
*
*
* @param storeOrderId
* @param platformInvolveReason
*/
void applyPlatformInvolve(Long storeOrderId, String platformInvolveReason);
/**
*
*
* @param storeOrderId
* @param platformInvolveResult
*/
void completePlatformInvolve(Long storeOrderId, String platformInvolveResult);
/**
*
*
* @param storeOrderId
*/
void completeRefundByUser(Long storeOrderId);
}

View File

@ -359,6 +359,11 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
.eq(StoreOrder::getOrderNo, orderNo));
}
@Override
public StoreOrder getById(Long id) {
return storeOrderMapper.selectById(id);
}
@Override
public StoreOrderInfoDTO getInfo(Long storeOrderId) {
StoreOrder order = storeOrderMapper.selectById(storeOrderId);
@ -1349,6 +1354,103 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
storeOrderIds.forEach(id -> checkOrderStore(id, storeId));
}
@Transactional(rollbackFor = Exception.class)
@Override
public void applyPlatformInvolve(Long storeOrderId, String platformInvolveReason) {
StoreOrder order = getAndBaseCheck(storeOrderId);
if (!EOrderStatus.AFTER_SALE_IN_PROGRESS.getValue().equals(order.getOrderStatus())
&& !EOrderStatus.AFTER_SALE_REJECTED.getValue().equals(order.getOrderStatus())) {
throw new ServiceException(CharSequenceUtil.format("订单[{}]状态异常", order.getId()));
}
order.setOrderStatus(EOrderStatus.PLATFORM_INTERVENED.getValue());
order.setPlatformInvolveReason(platformInvolveReason);
int orderSuccess = storeOrderMapper.updateById(prepareUpdate(order));
if (orderSuccess == 0) {
throw new ServiceException(Constants.VERSION_LOCK_ERROR_COMMON_MSG);
}
//操作记录
addOperationRecords(order.getId(),
EOrderAction.APPLY_PLATFORM_INVOLVE,
null,
EOrderAction.APPLY_PLATFORM_INVOLVE,
SecurityUtils.getUserIdSafe(),
new Date());
}
@Transactional(rollbackFor = Exception.class)
@Override
public void completePlatformInvolve(Long storeOrderId, String platformInvolveResult) {
StoreOrder order = getAndBaseCheck(storeOrderId);
if (!EOrderStatus.PLATFORM_INTERVENED.getValue().equals(order.getOrderStatus())) {
throw new ServiceException(CharSequenceUtil.format("订单[{}]状态异常", order.getId()));
}
List<StoreOrderDetail> incompleteOrderDetails = storeOrderDetailMapper.selectList(Wrappers
.lambdaQuery(StoreOrderDetail.class)
.eq(StoreOrderDetail::getStoreOrderId, order.getId())
//售后未完成明细
.ne(StoreOrderDetail::getDetailStatus, EOrderStatus.AFTER_SALE_COMPLETED)
.eq(SimpleEntity::getDelFlag, Constants.UNDELETED));
List<Long> storeOrderDetailIds = new ArrayList<>(incompleteOrderDetails.size());
for (StoreOrderDetail storeOrderDetail : incompleteOrderDetails) {
storeOrderDetail.setDetailStatus(EOrderStatus.AFTER_SALE_COMPLETED.getValue());
int orderDetailSuccess = storeOrderDetailMapper.updateById(prepareUpdate(storeOrderDetail));
if (orderDetailSuccess == 0) {
throw new ServiceException(Constants.VERSION_LOCK_ERROR_COMMON_MSG);
}
storeOrderDetailIds.add(storeOrderDetail.getId());
}
order.setOrderStatus(EOrderStatus.AFTER_SALE_COMPLETED.getValue());
order.setPlatformInvolveResult(platformInvolveResult);
int orderSuccess = storeOrderMapper.updateById(prepareUpdate(order));
if (orderSuccess == 0) {
throw new ServiceException(Constants.VERSION_LOCK_ERROR_COMMON_MSG);
}
//操作记录
addOperationRecords(order.getId(),
EOrderAction.COMPLETE_PLATFORM_INVOLVE,
storeOrderDetailIds,
EOrderAction.COMPLETE_PLATFORM_INVOLVE,
SecurityUtils.getUserIdSafe(),
new Date());
}
@Transactional(rollbackFor = Exception.class)
@Override
public void completeRefundByUser(Long storeOrderId) {
StoreOrder order = getAndBaseCheck(storeOrderId);
if (!EOrderStatus.AFTER_SALE_IN_PROGRESS.getValue().equals(order.getOrderStatus())
&& !EOrderStatus.AFTER_SALE_REJECTED.getValue().equals(order.getOrderStatus())) {
throw new ServiceException(CharSequenceUtil.format("订单[{}]状态异常", order.getId()));
}
List<StoreOrderDetail> incompleteOrderDetails = storeOrderDetailMapper.selectList(Wrappers
.lambdaQuery(StoreOrderDetail.class)
.eq(StoreOrderDetail::getStoreOrderId, order.getId())
//售后未完成明细
.ne(StoreOrderDetail::getDetailStatus, EOrderStatus.AFTER_SALE_COMPLETED)
.eq(SimpleEntity::getDelFlag, Constants.UNDELETED));
List<Long> storeOrderDetailIds = new ArrayList<>(incompleteOrderDetails.size());
for (StoreOrderDetail storeOrderDetail : incompleteOrderDetails) {
storeOrderDetail.setDetailStatus(EOrderStatus.AFTER_SALE_COMPLETED.getValue());
int orderDetailSuccess = storeOrderDetailMapper.updateById(prepareUpdate(storeOrderDetail));
if (orderDetailSuccess == 0) {
throw new ServiceException(Constants.VERSION_LOCK_ERROR_COMMON_MSG);
}
storeOrderDetailIds.add(storeOrderDetail.getId());
}
order.setOrderStatus(EOrderStatus.AFTER_SALE_COMPLETED.getValue());
int orderSuccess = storeOrderMapper.updateById(prepareUpdate(order));
if (orderSuccess == 0) {
throw new ServiceException(Constants.VERSION_LOCK_ERROR_COMMON_MSG);
}
//操作记录
addOperationRecords(order.getId(),
EOrderAction.USER_COMPLETE_AFTER_SALE,
storeOrderDetailIds,
EOrderAction.USER_COMPLETE_AFTER_SALE,
SecurityUtils.getUserIdSafe(),
new Date());
}
/**
*
*