mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
!581 订单列表管理重构完善
Merge pull request !581 from puhui999/feature/mall_product
This commit is contained in:
commit
4c634245e9
@ -18,7 +18,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@Data
|
||||
public class BargainActivityBaseVO {
|
||||
|
||||
@Schema(description = "砍价活动名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "越拼越省钱")
|
||||
@Schema(description = "砍价活动名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "砍得越多省得越多,是兄弟就来砍我")
|
||||
@NotNull(message = "砍价名称不能为空")
|
||||
private String name;
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.*;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryExpressConvert;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
||||
import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressService;
|
||||
@ -67,6 +67,15 @@ public class DeliveryExpressController {
|
||||
return success(DeliveryExpressConvert.INSTANCE.convert(deliveryExpress));
|
||||
}
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@Operation(summary = "获取快递公司精简信息列表", description = "主要用于前端的下拉选项")
|
||||
public CommonResult<List<DeliveryExpressSimpleRespVO>> getSimpleDeliveryExpressList() {
|
||||
// 获取品牌列表,只要开启状态的
|
||||
List<DeliveryExpressDO> list = deliveryExpressService.getDeliveryExpressListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
// 排序后,返回给前端
|
||||
return success(DeliveryExpressConvert.INSTANCE.convertList1(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得快递公司分页")
|
||||
@PreAuthorize("@ss.hasPermission('trade:delivery:express:query')")
|
||||
|
@ -1,9 +1,8 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.*;
|
||||
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryPickUpStoreConvert;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
||||
@ -16,14 +15,11 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 自提门店")
|
||||
@RestController
|
||||
@ -67,6 +63,15 @@ public class DeliveryPickUpStoreController {
|
||||
return success(DeliveryPickUpStoreConvert.INSTANCE.convert(deliveryPickUpStore));
|
||||
}
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@Operation(summary = "获取快递公司精简信息列表")
|
||||
public CommonResult<List<DeliveryPickUpStoreSimpleRespVO>> getSimpleDeliveryPickUpStoreList() {
|
||||
// 获取品牌列表,只要开启状态的
|
||||
List<DeliveryPickUpStoreDO> list = deliveryPickUpStoreService.getDeliveryPickUpStoreListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
// 排序后,返回给前端
|
||||
return success(DeliveryPickUpStoreConvert.INSTANCE.convertList1(list));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得自提门店列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@ -84,16 +89,4 @@ public class DeliveryPickUpStoreController {
|
||||
return success(DeliveryPickUpStoreConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
// TODO @jason:导出去掉好列;简化下,一般用不到哈。
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出自提门店 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('trade:delivery:pick-up-store:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDeliveryPickUpStoreExcel(@Valid DeliveryPickUpStoreExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<DeliveryPickUpStoreDO> list = deliveryPickUpStoreService.getDeliveryPickUpStoreList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<DeliveryPickUpStoreExcelVO> datas = DeliveryPickUpStoreConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "自提门店.xls", "数据", DeliveryPickUpStoreExcelVO.class, datas);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 快递公司精简信息 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DeliveryExpressSimpleRespVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6592")
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "快递公司名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "顺丰速运")
|
||||
@NotNull(message = "快递公司名称不能为空")
|
||||
private String name;
|
||||
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class DeliveryPickUpStoreExcelVO {
|
||||
|
||||
@ExcelProperty("编号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("门店名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("门店简介")
|
||||
private String introduction;
|
||||
|
||||
@ExcelProperty("门店手机")
|
||||
private String phone;
|
||||
|
||||
@ExcelProperty("门店所在区域")
|
||||
private String areaName;
|
||||
|
||||
@ExcelProperty("门店详细地址")
|
||||
private String detailAddress;
|
||||
|
||||
@ExcelProperty("门店logo")
|
||||
private String logo;
|
||||
|
||||
// TODO @jason:是不是可以加个 convert?
|
||||
/**
|
||||
* easy-excel 好像暂时不支持 LocalTime. 转成string
|
||||
*/
|
||||
@ExcelProperty("营业开始时间")
|
||||
private String openingTime;
|
||||
|
||||
@ExcelProperty("营业结束时间")
|
||||
private String closingTime;
|
||||
|
||||
@ExcelProperty("纬度")
|
||||
private String latitude;
|
||||
|
||||
@ExcelProperty("经度")
|
||||
private String longitude;
|
||||
|
||||
@ExcelProperty(value = "状态", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.COMMON_STATUS)
|
||||
private Integer status;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 自提门店 Excel 导出 Request VO,参数和 DeliveryPickUpStorePageReqVO 是一致的")
|
||||
@Data
|
||||
public class DeliveryPickUpStoreExportReqVO {
|
||||
|
||||
@Schema(description = "门店名称", example = "李四")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "门店手机")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "区域id", example = "18733")
|
||||
private Integer areaId;
|
||||
|
||||
@Schema(description = "门店状态", example = "1")
|
||||
@InEnum(CommonStatusEnum.class)
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.Mobile;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalTime;
|
||||
|
||||
@Schema(description = "管理后台 - 自提门店精简信息 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DeliveryPickUpStoreSimpleRespVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23128")
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "门店名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||
@NotBlank(message = "门店名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "门店手机", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601892312")
|
||||
@NotBlank(message = "门店手机不能为空")
|
||||
@Mobile
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "区域编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18733")
|
||||
@NotNull(message = "区域编号不能为空")
|
||||
private Integer areaId;
|
||||
|
||||
@Schema(description = "门店详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "复旦大学路 188 号")
|
||||
@NotBlank(message = "门店详细地址不能为空")
|
||||
private String detailAddress;
|
||||
|
||||
@Schema(description = "营业开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "营业开始时间不能为空")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm")
|
||||
private LocalTime openingTime;
|
||||
|
||||
@Schema(description = "营业结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "营业结束时间不能为空")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm")
|
||||
private LocalTime closingTime;
|
||||
|
||||
}
|
@ -5,10 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDeliveryReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDetailRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageItemRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.*;
|
||||
import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||
@ -79,12 +76,52 @@ public class TradeOrderController {
|
||||
return success(TradeOrderConvert.INSTANCE.convert(order, orderItems, user));
|
||||
}
|
||||
|
||||
@GetMapping("/get-express-track-list")
|
||||
@Operation(summary = "获得交易订单的物流轨迹")
|
||||
@Parameter(name = "id", description = "交易订单编号")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||
public CommonResult<List<?>> getOrderExpressTrackList(@RequestParam("id") Long id) {
|
||||
return success(TradeOrderConvert.INSTANCE.convertList02(
|
||||
tradeOrderQueryService.getExpressTrackList(id, getLoginUserId())));
|
||||
}
|
||||
|
||||
@PostMapping("/delivery")
|
||||
@Operation(summary = "发货订单")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:delivery')")
|
||||
@Operation(summary = "订单发货")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||
public CommonResult<Boolean> deliveryOrder(@RequestBody TradeOrderDeliveryReqVO deliveryReqVO) {
|
||||
tradeOrderUpdateService.deliveryOrder(getLoginUserId(), deliveryReqVO);
|
||||
tradeOrderUpdateService.deliveryOrder(deliveryReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/remark")
|
||||
@Operation(summary = "订单备注")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||
public CommonResult<Boolean> remarkOrder(@RequestBody TradeOrderRemarkReqVO reqVO) {
|
||||
tradeOrderUpdateService.remarkOrder(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/adjust-price")
|
||||
@Operation(summary = "订单调价")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||
public CommonResult<Boolean> adjustPrice(@RequestBody TradeOrderAdjustPriceReqVO reqVO) {
|
||||
tradeOrderUpdateService.adjustPrice(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/adjust-address")
|
||||
@Operation(summary = "修改订单收货地址")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||
public CommonResult<Boolean> adjustAddress(@RequestBody TradeOrderAdjustAddressReqVO reqVO) {
|
||||
tradeOrderUpdateService.adjustAddress(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
// TODO @puhui999 订单物流详情
|
||||
// TODO @puhui999 【前台】订单取消
|
||||
// TODO @puhui999 【后台】订单取消
|
||||
// TODO @puhui999 【前台】订单核销
|
||||
// TODO @puhui999 【前台】订单删除
|
||||
// TODO @puhui999 【后台】订单统计
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.order.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 订单修改地址 Request VO")
|
||||
@Data
|
||||
public class TradeOrderAdjustAddressReqVO {
|
||||
|
||||
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "订单编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "收件人名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "z张三")
|
||||
@NotEmpty(message = "收件人名称不能为空")
|
||||
private String receiverName;
|
||||
|
||||
@Schema(description = "收件人手机", requiredMode = Schema.RequiredMode.REQUIRED, example = "19988188888")
|
||||
@NotEmpty(message = "收件人手机不能为空")
|
||||
private String receiverMobile;
|
||||
|
||||
@Schema(description = "收件人地区编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7310")
|
||||
@NotNull(message = "收件人地区编号不能为空")
|
||||
private Integer receiverAreaId;
|
||||
|
||||
@Schema(description = "收件人详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "昆明市五华区xxx小区xxx")
|
||||
@NotEmpty(message = "收件人详细地址不能为空")
|
||||
private String receiverDetailAddress;
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.order.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 订单改价 Request VO")
|
||||
@Data
|
||||
public class TradeOrderAdjustPriceReqVO {
|
||||
|
||||
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "订单编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "订单调价,单位:分 正数,加价;负数,减价", requiredMode = Schema.RequiredMode.REQUIRED, example = "-100")
|
||||
@NotNull(message = "订单调价价格不能为空")
|
||||
private Integer adjustPrice;
|
||||
|
||||
}
|
@ -6,9 +6,9 @@ import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 交易订单 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
* 交易订单 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class TradeOrderBaseVO {
|
||||
|
||||
@ -87,6 +87,12 @@ public class TradeOrderBaseVO {
|
||||
|
||||
// ========== 收件 + 物流基本信息 ==========
|
||||
|
||||
@Schema(description = "配送方式", example = "10")
|
||||
private Integer deliveryType;
|
||||
|
||||
@Schema(description = "自提门店", example = "10")
|
||||
private Long pickUpStoreId;
|
||||
|
||||
@Schema(description = "配送模板编号", example = "1024")
|
||||
private Long deliveryTemplateId;
|
||||
|
||||
|
@ -1,11 +1,8 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.order.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 订单发货 Request VO")
|
||||
@ -16,18 +13,11 @@ public class TradeOrderDeliveryReqVO {
|
||||
@NotNull(message = "订单编号不能为空")
|
||||
private Long id;
|
||||
|
||||
// TODO @puhui999:可以去掉 type;如果无需发货,则 logisticsId 传递 0;logisticsNo 传递空串
|
||||
@Schema(description = "发货类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
||||
@InEnum(DeliveryTypeEnum.class)
|
||||
@NotNull(message = "发货类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "发货物流公司编号", example = "1")
|
||||
@NotNull(message = "发货物流公司不能为空")
|
||||
private Long logisticsId;
|
||||
|
||||
@Schema(description = "发货物流单号", example = "SF123456789")
|
||||
@NotEmpty(message = "发货物流单号不能为空")
|
||||
private String logisticsNo;
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ -30,6 +31,12 @@ public class TradeOrderPageReqVO extends PageParam {
|
||||
@Mobile
|
||||
private String userMobile;
|
||||
|
||||
@Schema(description = "发货物流公司编号", example = "1")
|
||||
private Long logisticsId;
|
||||
|
||||
@Schema(description = "自提门店编号", example = "[1,2]")
|
||||
private List<Long> pickUpStoreIds;
|
||||
|
||||
@Schema(description = "收件人名称", example = "小红")
|
||||
private String receiverName;
|
||||
|
||||
|
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.order.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 订单备注 Request VO")
|
||||
@Data
|
||||
public class TradeOrderRemarkReqVO {
|
||||
|
||||
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "订单编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "商家备注", example = "你猜一下")
|
||||
@NotEmpty(message = "订单备注不能为空")
|
||||
private String remark;
|
||||
|
||||
}
|
@ -31,7 +31,7 @@ public class AppDeliverExpressController {
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得快递公司列表")
|
||||
public CommonResult<List<AppDeliveryExpressRespVO>> getDeliveryExpressList() {
|
||||
List<DeliveryExpressDO> list = deliveryExpressService.getDeliveryExpressList(CommonStatusEnum.ENABLE.getStatus());
|
||||
List<DeliveryExpressDO> list = deliveryExpressService.getDeliveryExpressListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
list.sort(Comparator.comparing(DeliveryExpressDO::getSort));
|
||||
return success(DeliveryExpressConvert.INSTANCE.convertList03(list));
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.trade.convert.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.*;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressExcelVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressRespVO;
|
||||
@ -29,6 +30,7 @@ public interface DeliveryExpressConvert {
|
||||
|
||||
List<DeliveryExpressExcelVO> convertList02(List<DeliveryExpressDO> list);
|
||||
|
||||
List<DeliveryExpressSimpleRespVO> convertList1(List<DeliveryExpressDO> list);
|
||||
List<AppDeliveryExpressRespVO> convertList03(List<DeliveryExpressDO> list);
|
||||
|
||||
}
|
||||
|
@ -1,20 +1,18 @@
|
||||
package cn.iocoder.yudao.module.trade.convert.delivery;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreExcelVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreSimpleRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Named;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DeliveryPickUpStoreConvert {
|
||||
|
||||
@ -30,14 +28,10 @@ public interface DeliveryPickUpStoreConvert {
|
||||
|
||||
PageResult<DeliveryPickUpStoreRespVO> convertPage(PageResult<DeliveryPickUpStoreDO> page);
|
||||
|
||||
List<DeliveryPickUpStoreExcelVO> convertList02(List<DeliveryPickUpStoreDO> list);
|
||||
|
||||
@Mapping(source = "areaId", target = "areaName", qualifiedByName = "convertAreaIdToName")
|
||||
DeliveryPickUpStoreExcelVO convert2(DeliveryPickUpStoreDO bean);
|
||||
|
||||
@Named("convertAreaIdToName")
|
||||
default String convertAreaIdToName(Integer areaId) {
|
||||
return AreaUtils.format(areaId);
|
||||
}
|
||||
|
||||
List<DeliveryPickUpStoreSimpleRespVO> convertList1(List<DeliveryPickUpStoreDO> list);
|
||||
}
|
||||
|
@ -17,8 +17,7 @@ import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCr
|
||||
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUserRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDetailRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageItemRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.*;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.*;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemCommentCreateReqVO;
|
||||
@ -278,4 +277,10 @@ public interface TradeOrderConvert {
|
||||
|
||||
List<AppOrderExpressTrackRespDTO> convertList02(List<ExpressTrackRespDTO> list);
|
||||
|
||||
TradeOrderDO convert(TradeOrderAdjustAddressReqVO reqVO);
|
||||
|
||||
TradeOrderDO convert(TradeOrderAdjustPriceReqVO reqVO);
|
||||
|
||||
TradeOrderDO convert(TradeOrderRemarkReqVO reqVO);
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.trade.dal.mysql.delivery;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreExportReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStorePageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -23,15 +22,10 @@ public interface DeliveryPickUpStoreMapper extends BaseMapperX<DeliveryPickUpSto
|
||||
.orderByDesc(DeliveryPickUpStoreDO::getId));
|
||||
}
|
||||
|
||||
default List<DeliveryPickUpStoreDO> selectList(DeliveryPickUpStoreExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<DeliveryPickUpStoreDO>()
|
||||
.likeIfPresent(DeliveryPickUpStoreDO::getName, reqVO.getName())
|
||||
.eqIfPresent(DeliveryPickUpStoreDO::getPhone, reqVO.getPhone())
|
||||
.eqIfPresent(DeliveryPickUpStoreDO::getAreaId, reqVO.getAreaId())
|
||||
.eqIfPresent(DeliveryPickUpStoreDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(DeliveryPickUpStoreDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(DeliveryPickUpStoreDO::getId));
|
||||
default List<DeliveryPickUpStoreDO> selectListByStatus(Integer status) {
|
||||
return selectList(DeliveryPickUpStoreDO::getStatus, status);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,6 +34,8 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
|
||||
.eqIfPresent(TradeOrderDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(TradeOrderDO::getPayChannelCode, reqVO.getPayChannelCode())
|
||||
.eqIfPresent(TradeOrderDO::getTerminal,reqVO.getTerminal())
|
||||
.eqIfPresent(TradeOrderDO::getLogisticsId, reqVO.getLogisticsId())
|
||||
.inIfPresent(TradeOrderDO::getPickUpStoreId, reqVO.getPickUpStoreIds())
|
||||
.betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime()));
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
package cn.iocoder.yudao.module.trade.service.delivery;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressExportReqVO;
|
||||
@ -8,6 +11,7 @@ import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.Delive
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -64,11 +68,10 @@ public interface DeliveryExpressService {
|
||||
List<DeliveryExpressDO> getDeliveryExpressList(DeliveryExpressExportReqVO exportReqVO);
|
||||
|
||||
/**
|
||||
* 获得快递公司列表
|
||||
* 获取指定状态的快递公司列表
|
||||
*
|
||||
* @param status 状态
|
||||
* @return 快递公司列表
|
||||
* @return 返回快递公司列表
|
||||
*/
|
||||
List<DeliveryExpressDO> getDeliveryExpressList(Integer status);
|
||||
|
||||
List<DeliveryExpressDO> getDeliveryExpressListByStatus(Integer status);
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@ -95,7 +96,7 @@ public class DeliveryExpressServiceImpl implements DeliveryExpressService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeliveryExpressDO> getDeliveryExpressList(Integer status) {
|
||||
public List<DeliveryExpressDO> getDeliveryExpressListByStatus(Integer status) {
|
||||
return deliveryExpressMapper.selectListByStatus(status);
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,15 @@
|
||||
package cn.iocoder.yudao.module.trade.service.delivery;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreExportReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStorePageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自提门店 Service 接口
|
||||
*
|
||||
@ -63,10 +64,10 @@ public interface DeliveryPickUpStoreService {
|
||||
PageResult<DeliveryPickUpStoreDO> getDeliveryPickUpStorePage(DeliveryPickUpStorePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得自提门店列表, 用于 Excel 导出
|
||||
* 获得指定状态的自提门店列表
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @param status 状态
|
||||
* @return 自提门店列表
|
||||
*/
|
||||
List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreList(DeliveryPickUpStoreExportReqVO exportReqVO);
|
||||
List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreListByStatus(Integer status);
|
||||
}
|
||||
|
@ -2,21 +2,20 @@ package cn.iocoder.yudao.module.trade.service.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreExportReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStorePageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryPickUpStoreConvert;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.mysql.delivery.DeliveryPickUpStoreMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.PICK_UP_STORE_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 自提门店 Service 实现类
|
||||
@ -78,7 +77,8 @@ public class DeliveryPickUpStoreServiceImpl implements DeliveryPickUpStoreServic
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreList(DeliveryPickUpStoreExportReqVO exportReqVO) {
|
||||
return deliveryPickUpStoreMapper.selectList(exportReqVO);
|
||||
public List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreListByStatus(Integer status) {
|
||||
return deliveryPickUpStoreMapper.selectListByStatus(status);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package cn.iocoder.yudao.module.trade.service.order;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderAdjustAddressReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderAdjustPriceReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDeliveryReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderRemarkReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementRespVO;
|
||||
@ -47,10 +50,9 @@ public interface TradeOrderUpdateService {
|
||||
/**
|
||||
* 【管理员】发货交易订单
|
||||
*
|
||||
* @param userId 管理员编号
|
||||
* @param deliveryReqVO 发货请求
|
||||
*/
|
||||
void deliveryOrder(Long userId, TradeOrderDeliveryReqVO deliveryReqVO);
|
||||
void deliveryOrder(TradeOrderDeliveryReqVO deliveryReqVO);
|
||||
|
||||
/**
|
||||
* 【会员】收货交易订单
|
||||
@ -60,6 +62,27 @@ public interface TradeOrderUpdateService {
|
||||
*/
|
||||
void receiveOrder(Long userId, Long id);
|
||||
|
||||
/**
|
||||
* 【管理员】交易订单备注
|
||||
*
|
||||
* @param reqVO 请求
|
||||
*/
|
||||
void remarkOrder(TradeOrderRemarkReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 调整价格
|
||||
*
|
||||
* @param reqVO 请求
|
||||
*/
|
||||
void adjustPrice(TradeOrderAdjustPriceReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 调整地址
|
||||
*
|
||||
* @param reqVO 请求
|
||||
*/
|
||||
void adjustAddress(TradeOrderAdjustAddressReqVO reqVO);
|
||||
|
||||
// =================== Order Item ===================
|
||||
|
||||
/**
|
||||
|
@ -29,7 +29,10 @@ import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordUp
|
||||
import cn.iocoder.yudao.module.promotion.api.coupon.CouponApi;
|
||||
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponUseReqDTO;
|
||||
import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderAdjustAddressReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderAdjustPriceReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDeliveryReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderRemarkReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementRespVO;
|
||||
@ -53,6 +56,7 @@ import cn.iocoder.yudao.module.trade.service.price.TradePriceService;
|
||||
import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateReqBO;
|
||||
import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateRespBO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -64,6 +68,7 @@ import java.util.Objects;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
||||
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.ORDER_NOT_FOUND;
|
||||
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.ORDER_PAID_NO_ADJUST_PRICE;
|
||||
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@ -345,10 +350,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
*/
|
||||
private KeyValue<TradeOrderDO, PayOrderRespDTO> validateOrderPayable(Long id, Long payOrderId) {
|
||||
// 校验订单是否存在
|
||||
TradeOrderDO order = tradeOrderMapper.selectById(id);
|
||||
if (order == null) {
|
||||
throw exception(ORDER_NOT_FOUND);
|
||||
}
|
||||
TradeOrderDO order = validateOrder(id);
|
||||
// 校验订单未支付
|
||||
if (!TradeOrderStatusEnum.isUnpaid(order.getStatus()) || order.getPayStatus()) {
|
||||
log.error("[validateOrderPaid][order({}) 不处于待支付状态,请进行处理!order 数据是:{}]",
|
||||
@ -391,14 +393,14 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deliveryOrder(Long userId, TradeOrderDeliveryReqVO deliveryReqVO) {
|
||||
public void deliveryOrder(TradeOrderDeliveryReqVO deliveryReqVO) {
|
||||
// TODO @puhui999:只有选择快递的,才可以发货
|
||||
// 1.1 校验并获得交易订单(可发货)
|
||||
TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId());
|
||||
TradeOrderDO updateOrderObj = new TradeOrderDO();
|
||||
// 判断发货类型
|
||||
// 2.1 快递发货
|
||||
if (Objects.equals(deliveryReqVO.getType(), DeliveryTypeEnum.EXPRESS.getMode())) {
|
||||
if (ObjectUtil.notEqual(deliveryReqVO.getLogisticsId(), 0L)) {
|
||||
// 校验快递公司
|
||||
DeliveryExpressDO deliveryExpress = deliveryExpressService.getDeliveryExpress(deliveryReqVO.getLogisticsId());
|
||||
if (deliveryExpress == null) {
|
||||
@ -408,11 +410,9 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
throw exception(EXPRESS_STATUS_NOT_ENABLE);
|
||||
}
|
||||
updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo()).setDeliveryType(DeliveryTypeEnum.EXPRESS.getMode());
|
||||
}
|
||||
// TODO @puhui999:无需发货时,更新 logisticsId 为 0;
|
||||
} else {
|
||||
// 2.2 无需发货
|
||||
if (Objects.equals(deliveryReqVO.getType(), DeliveryTypeEnum.NULL.getMode())) {
|
||||
updateOrderObj.setLogisticsId(null).setLogisticsNo("").setDeliveryType(DeliveryTypeEnum.NULL.getMode());
|
||||
updateOrderObj.setLogisticsId(0L).setLogisticsNo("").setDeliveryType(DeliveryTypeEnum.NULL.getMode());
|
||||
}
|
||||
|
||||
// 更新 TradeOrderDO 状态为已发货,等待收货
|
||||
@ -425,7 +425,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
|
||||
// 发送站内信
|
||||
tradeMessageService.sendMessageWhenDeliveryOrder(new TradeOrderMessageWhenDeliveryOrderReqBO().setOrderId(order.getId())
|
||||
.setUserId(userId).setMessage(null));
|
||||
.setUserId(order.getUserId()).setMessage(null));
|
||||
|
||||
// TODO 芋艿:OrderLog
|
||||
// TODO 设计:lili:是不是发货后,才支持售后?
|
||||
@ -440,11 +440,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
* @return 交易订单
|
||||
*/
|
||||
private TradeOrderDO validateOrderDeliverable(Long id) {
|
||||
// 校验订单是否存在
|
||||
TradeOrderDO order = tradeOrderMapper.selectById(id);
|
||||
if (order == null) {
|
||||
throw exception(ORDER_NOT_FOUND);
|
||||
}
|
||||
TradeOrderDO order = validateOrder(id);
|
||||
// 校验订单是否是待发货状态
|
||||
if (!TradeOrderStatusEnum.isUndelivered(order.getStatus())) {
|
||||
throw exception(ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED);
|
||||
@ -470,6 +466,16 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
return order;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private TradeOrderDO validateOrder(Long id) {
|
||||
// 校验订单是否存在
|
||||
TradeOrderDO order = tradeOrderMapper.selectById(id);
|
||||
if (order == null) {
|
||||
throw exception(ORDER_NOT_FOUND);
|
||||
}
|
||||
return order;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void receiveOrder(Long userId, Long id) {
|
||||
@ -489,6 +495,42 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
// TODO 芋艿:lili 发送商品被购买完成的数据
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remarkOrder(TradeOrderRemarkReqVO reqVO) {
|
||||
// 校验并获得交易订单
|
||||
validateOrder(reqVO.getId());
|
||||
|
||||
// 更新
|
||||
TradeOrderDO order = TradeOrderConvert.INSTANCE.convert(reqVO);
|
||||
tradeOrderMapper.updateById(order);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustPrice(TradeOrderAdjustPriceReqVO reqVO) {
|
||||
// 校验交易订单
|
||||
TradeOrderDO order = validateOrder(reqVO.getId());
|
||||
if (order.getPayStatus()) {
|
||||
throw exception(ORDER_PAID_NO_ADJUST_PRICE);
|
||||
}
|
||||
|
||||
// 更新
|
||||
TradeOrderDO update = TradeOrderConvert.INSTANCE.convert(reqVO);
|
||||
update.setPayPrice(update.getPayPrice() + update.getAdjustPrice());
|
||||
tradeOrderMapper.updateById(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustAddress(TradeOrderAdjustAddressReqVO reqVO) {
|
||||
// 校验交易订单
|
||||
validateOrder(reqVO.getId());
|
||||
// TODO 是否需要校验订单是否发货
|
||||
// TODO 发货后是否支持修改收货地址
|
||||
|
||||
// 更新
|
||||
TradeOrderDO update = TradeOrderConvert.INSTANCE.convert(reqVO);
|
||||
tradeOrderMapper.updateById(update);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验交易订单满足可售货的条件
|
||||
*
|
||||
|
@ -56,6 +56,7 @@ public class TradeAfterSaleServiceTest extends BaseDbUnitTest {
|
||||
private TradeOrderUpdateService tradeOrderUpdateService;
|
||||
@Resource
|
||||
private TradeOrderQueryService tradeOrderQueryService;
|
||||
|
||||
@MockBean
|
||||
private PayRefundApi payRefundApi;
|
||||
|
||||
|
@ -23,7 +23,10 @@ import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderItemMapper;
|
||||
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderMapper;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.*;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemAfterSaleStatusEnum;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderRefundStatusEnum;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum;
|
||||
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderConfig;
|
||||
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@ -38,7 +41,6 @@ import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
@ -282,7 +284,7 @@ public class TradeOrderUpdateServiceTest extends BaseDbUnitTest {
|
||||
// mock 方法(支付单)
|
||||
|
||||
// 调用
|
||||
tradeOrderUpdateService.deliveryOrder(randomLongId(), deliveryReqVO);
|
||||
tradeOrderUpdateService.deliveryOrder(deliveryReqVO);
|
||||
// 断言
|
||||
TradeOrderDO dbOrder = tradeOrderMapper.selectById(1L);
|
||||
assertEquals(dbOrder.getStatus(), TradeOrderStatusEnum.DELIVERED.getStatus());
|
||||
|
@ -27,6 +27,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode ORDER_IS_EXPIRED = new ErrorCode(1007002003, "支付订单已经过期");
|
||||
ErrorCode ORDER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1007002004, "发起支付报错,错误码:{},错误提示:{}");
|
||||
ErrorCode ORDER_REFUND_FAIL_STATUS_ERROR = new ErrorCode(1007002005, "支付订单退款失败,原因:状态不是已支付或已退款");
|
||||
ErrorCode ORDER_PAID_NO_ADJUST_PRICE = new ErrorCode(1007002006, "支付订单调价失败,原因:支付订单已付款,不能调价");
|
||||
|
||||
// ========== ORDER 模块(拓展单) 1007003000 ==========
|
||||
ErrorCode ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在");
|
||||
|
Loading…
Reference in New Issue
Block a user