!581 订单列表管理重构完善

Merge pull request !581 from puhui999/feature/mall_product
This commit is contained in:
芋道源码 2023-08-22 14:10:05 +00:00 committed by Gitee
commit 4c634245e9
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
29 changed files with 371 additions and 201 deletions

View File

@ -18,7 +18,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@Data @Data
public class BargainActivityBaseVO { public class BargainActivityBaseVO {
@Schema(description = "砍价活动名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "越拼越省钱") @Schema(description = "砍价活动名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "砍得越多省得越多,是兄弟就来砍我")
@NotNull(message = "砍价名称不能为空") @NotNull(message = "砍价名称不能为空")
private String name; private String name;

View File

@ -1,11 +1,11 @@
package cn.iocoder.yudao.module.trade.controller.admin.delivery; 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.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; 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.*;
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.convert.delivery.DeliveryExpressConvert;
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO; import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressService; import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressService;
@ -67,6 +67,15 @@ public class DeliveryExpressController {
return success(DeliveryExpressConvert.INSTANCE.convert(deliveryExpress)); 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") @GetMapping("/page")
@Operation(summary = "获得快递公司分页") @Operation(summary = "获得快递公司分页")
@PreAuthorize("@ss.hasPermission('trade:delivery:express:query')") @PreAuthorize("@ss.hasPermission('trade:delivery:express:query')")

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.module.trade.controller.admin.delivery; 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.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; 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.controller.admin.delivery.vo.pickup.*;
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryPickUpStoreConvert; 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.dataobject.delivery.DeliveryPickUpStoreDO;
@ -16,14 +15,11 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.IOException;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 自提门店") @Tag(name = "管理后台 - 自提门店")
@RestController @RestController
@ -67,6 +63,15 @@ public class DeliveryPickUpStoreController {
return success(DeliveryPickUpStoreConvert.INSTANCE.convert(deliveryPickUpStore)); 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") @GetMapping("/list")
@Operation(summary = "获得自提门店列表") @Operation(summary = "获得自提门店列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@ -84,16 +89,4 @@ public class DeliveryPickUpStoreController {
return success(DeliveryPickUpStoreConvert.INSTANCE.convertPage(pageResult)); 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);
}
} }

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -5,10 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; 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.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.order.vo.TradeOrderDeliveryReqVO; import cn.iocoder.yudao.module.trade.controller.admin.order.vo.*;
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.convert.order.TradeOrderConvert; 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.TradeOrderDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO; 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)); 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") @PostMapping("/delivery")
@Operation(summary = "发货订单") @Operation(summary = "订单发货")
@PreAuthorize("@ss.hasPermission('trade:order:delivery')") @PreAuthorize("@ss.hasPermission('trade:order:update')")
public CommonResult<Boolean> deliveryOrder(@RequestBody TradeOrderDeliveryReqVO deliveryReqVO) { public CommonResult<Boolean> deliveryOrder(@RequestBody TradeOrderDeliveryReqVO deliveryReqVO) {
tradeOrderUpdateService.deliveryOrder(getLoginUserId(), deliveryReqVO); tradeOrderUpdateService.deliveryOrder(deliveryReqVO);
return success(true); 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 后台订单统计
} }

View File

@ -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;
}

View File

@ -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;
}

View File

@ -6,9 +6,9 @@ import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
/** /**
* 交易订单 Base VO提供给添加修改详细的子 VO 使用 * 交易订单 Base VO提供给添加修改详细的子 VO 使用
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成 * 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/ */
@Data @Data
public class TradeOrderBaseVO { 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") @Schema(description = "配送模板编号", example = "1024")
private Long deliveryTemplateId; private Long deliveryTemplateId;

View File

@ -1,11 +1,8 @@
package cn.iocoder.yudao.module.trade.controller.admin.order.vo; 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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 订单发货 Request VO") @Schema(description = "管理后台 - 订单发货 Request VO")
@ -16,18 +13,11 @@ public class TradeOrderDeliveryReqVO {
@NotNull(message = "订单编号不能为空") @NotNull(message = "订单编号不能为空")
private Long id; private Long id;
// TODO @puhui999可以去掉 type如果无需发货 logisticsId 传递 0logisticsNo 传递空串
@Schema(description = "发货类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
@InEnum(DeliveryTypeEnum.class)
@NotNull(message = "发货类型不能为空")
private Integer type;
@Schema(description = "发货物流公司编号", example = "1") @Schema(description = "发货物流公司编号", example = "1")
@NotNull(message = "发货物流公司不能为空") @NotNull(message = "发货物流公司不能为空")
private Long logisticsId; private Long logisticsId;
@Schema(description = "发货物流单号", example = "SF123456789") @Schema(description = "发货物流单号", example = "SF123456789")
@NotEmpty(message = "发货物流单号不能为空")
private String logisticsNo; private String logisticsNo;
} }

View File

@ -10,6 +10,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; 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; 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 @Mobile
private String userMobile; private String userMobile;
@Schema(description = "发货物流公司编号", example = "1")
private Long logisticsId;
@Schema(description = "自提门店编号", example = "[1,2]")
private List<Long> pickUpStoreIds;
@Schema(description = "收件人名称", example = "小红") @Schema(description = "收件人名称", example = "小红")
private String receiverName; private String receiverName;

View File

@ -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;
}

View File

@ -31,7 +31,7 @@ public class AppDeliverExpressController {
@GetMapping("/list") @GetMapping("/list")
@Operation(summary = "获得快递公司列表") @Operation(summary = "获得快递公司列表")
public CommonResult<List<AppDeliveryExpressRespVO>> getDeliveryExpressList() { 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)); list.sort(Comparator.comparing(DeliveryExpressDO::getSort));
return success(DeliveryExpressConvert.INSTANCE.convertList03(list)); return success(DeliveryExpressConvert.INSTANCE.convertList03(list));
} }

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.trade.convert.delivery; package cn.iocoder.yudao.module.trade.convert.delivery;
import cn.iocoder.yudao.framework.common.pojo.PageResult; 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.DeliveryExpressCreateReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressExcelVO; import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressExcelVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressRespVO; 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<DeliveryExpressExcelVO> convertList02(List<DeliveryExpressDO> list);
List<DeliveryExpressSimpleRespVO> convertList1(List<DeliveryExpressDO> list);
List<AppDeliveryExpressRespVO> convertList03(List<DeliveryExpressDO> list); List<AppDeliveryExpressRespVO> convertList03(List<DeliveryExpressDO> list);
} }

View File

@ -1,20 +1,18 @@
package cn.iocoder.yudao.module.trade.convert.delivery; package cn.iocoder.yudao.module.trade.convert.delivery;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; 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.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.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.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO; import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named; import org.mapstruct.Named;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper @Mapper
public interface DeliveryPickUpStoreConvert { public interface DeliveryPickUpStoreConvert {
@ -30,14 +28,10 @@ public interface DeliveryPickUpStoreConvert {
PageResult<DeliveryPickUpStoreRespVO> convertPage(PageResult<DeliveryPickUpStoreDO> page); 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") @Named("convertAreaIdToName")
default String convertAreaIdToName(Integer areaId) { default String convertAreaIdToName(Integer areaId) {
return AreaUtils.format(areaId); return AreaUtils.format(areaId);
} }
List<DeliveryPickUpStoreSimpleRespVO> convertList1(List<DeliveryPickUpStoreDO> list);
} }

View File

@ -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.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.member.user.MemberUserRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO; 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.*;
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageItemRespVO;
import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO; 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.*;
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemCommentCreateReqVO; 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); List<AppOrderExpressTrackRespDTO> convertList02(List<ExpressTrackRespDTO> list);
TradeOrderDO convert(TradeOrderAdjustAddressReqVO reqVO);
TradeOrderDO convert(TradeOrderAdjustPriceReqVO reqVO);
TradeOrderDO convert(TradeOrderRemarkReqVO reqVO);
} }

View File

@ -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.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; 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.controller.admin.delivery.vo.pickup.DeliveryPickUpStorePageReqVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO; import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -23,15 +22,10 @@ public interface DeliveryPickUpStoreMapper extends BaseMapperX<DeliveryPickUpSto
.orderByDesc(DeliveryPickUpStoreDO::getId)); .orderByDesc(DeliveryPickUpStoreDO::getId));
} }
default List<DeliveryPickUpStoreDO> selectList(DeliveryPickUpStoreExportReqVO reqVO) { default List<DeliveryPickUpStoreDO> selectListByStatus(Integer status) {
return selectList(new LambdaQueryWrapperX<DeliveryPickUpStoreDO>() return selectList(DeliveryPickUpStoreDO::getStatus, status);
.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));
} }
} }

View File

@ -34,6 +34,8 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
.eqIfPresent(TradeOrderDO::getStatus, reqVO.getStatus()) .eqIfPresent(TradeOrderDO::getStatus, reqVO.getStatus())
.eqIfPresent(TradeOrderDO::getPayChannelCode, reqVO.getPayChannelCode()) .eqIfPresent(TradeOrderDO::getPayChannelCode, reqVO.getPayChannelCode())
.eqIfPresent(TradeOrderDO::getTerminal,reqVO.getTerminal()) .eqIfPresent(TradeOrderDO::getTerminal,reqVO.getTerminal())
.eqIfPresent(TradeOrderDO::getLogisticsId, reqVO.getLogisticsId())
.inIfPresent(TradeOrderDO::getPickUpStoreId, reqVO.getPickUpStoreIds())
.betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime())); .betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime()));
} }

View File

@ -1,5 +1,8 @@
package cn.iocoder.yudao.module.trade.service.delivery; 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.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.DeliveryExpressCreateReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressExportReqVO; 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 cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
@ -64,11 +68,10 @@ public interface DeliveryExpressService {
List<DeliveryExpressDO> getDeliveryExpressList(DeliveryExpressExportReqVO exportReqVO); List<DeliveryExpressDO> getDeliveryExpressList(DeliveryExpressExportReqVO exportReqVO);
/** /**
* 快递公司列表 * 取指定状态的快递公司列表
* *
* @param status 状态 * @param status 状态
* @return 快递公司列表 * @return 返回快递公司列表
*/ */
List<DeliveryExpressDO> getDeliveryExpressList(Integer status); List<DeliveryExpressDO> getDeliveryExpressListByStatus(Integer status);
} }

View File

@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collection;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -95,7 +96,7 @@ public class DeliveryExpressServiceImpl implements DeliveryExpressService {
} }
@Override @Override
public List<DeliveryExpressDO> getDeliveryExpressList(Integer status) { public List<DeliveryExpressDO> getDeliveryExpressListByStatus(Integer status) {
return deliveryExpressMapper.selectListByStatus(status); return deliveryExpressMapper.selectListByStatus(status);
} }

View File

@ -1,14 +1,15 @@
package cn.iocoder.yudao.module.trade.service.delivery; 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.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.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.DeliveryPickUpStorePageReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO; import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO; import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
import javax.validation.Valid;
import java.util.Collection;
import java.util.List;
/** /**
* 自提门店 Service 接口 * 自提门店 Service 接口
* *
@ -63,10 +64,10 @@ public interface DeliveryPickUpStoreService {
PageResult<DeliveryPickUpStoreDO> getDeliveryPickUpStorePage(DeliveryPickUpStorePageReqVO pageReqVO); PageResult<DeliveryPickUpStoreDO> getDeliveryPickUpStorePage(DeliveryPickUpStorePageReqVO pageReqVO);
/** /**
* 获得自提门店列表, 用于 Excel 导出 * 获得指定状态的自提门店列表
* *
* @param exportReqVO 查询条件 * @param status 状态
* @return 自提门店列表 * @return 自提门店列表
*/ */
List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreList(DeliveryPickUpStoreExportReqVO exportReqVO); List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreListByStatus(Integer status);
} }

View File

@ -2,21 +2,20 @@ package cn.iocoder.yudao.module.trade.service.delivery;
import cn.iocoder.yudao.framework.common.pojo.PageResult; 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.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.DeliveryPickUpStorePageReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO; 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.convert.delivery.DeliveryPickUpStoreConvert;
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO; import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
import cn.iocoder.yudao.module.trade.dal.mysql.delivery.DeliveryPickUpStoreMapper; import cn.iocoder.yudao.module.trade.dal.mysql.delivery.DeliveryPickUpStoreMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; 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.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 实现类 * 自提门店 Service 实现类
@ -78,7 +77,8 @@ public class DeliveryPickUpStoreServiceImpl implements DeliveryPickUpStoreServic
} }
@Override @Override
public List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreList(DeliveryPickUpStoreExportReqVO exportReqVO) { public List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreListByStatus(Integer status) {
return deliveryPickUpStoreMapper.selectList(exportReqVO); return deliveryPickUpStoreMapper.selectListByStatus(status);
} }
} }

View File

@ -1,6 +1,9 @@
package cn.iocoder.yudao.module.trade.service.order; 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.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.AppTradeOrderCreateReqVO;
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementReqVO; import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementReqVO;
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementRespVO; import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementRespVO;
@ -47,10 +50,9 @@ public interface TradeOrderUpdateService {
/** /**
* 管理员发货交易订单 * 管理员发货交易订单
* *
* @param userId 管理员编号
* @param deliveryReqVO 发货请求 * @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); 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 =================== // =================== Order Item ===================
/** /**

View File

@ -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.CouponApi;
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponUseReqDTO; import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponUseReqDTO;
import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum; 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.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.AppTradeOrderCreateReqVO;
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementReqVO; import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementReqVO;
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementRespVO; 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.TradePriceCalculateReqBO;
import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateRespBO; import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateRespBO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; 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.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; 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_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.*; 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) { private KeyValue<TradeOrderDO, PayOrderRespDTO> validateOrderPayable(Long id, Long payOrderId) {
// 校验订单是否存在 // 校验订单是否存在
TradeOrderDO order = tradeOrderMapper.selectById(id); TradeOrderDO order = validateOrder(id);
if (order == null) {
throw exception(ORDER_NOT_FOUND);
}
// 校验订单未支付 // 校验订单未支付
if (!TradeOrderStatusEnum.isUnpaid(order.getStatus()) || order.getPayStatus()) { if (!TradeOrderStatusEnum.isUnpaid(order.getStatus()) || order.getPayStatus()) {
log.error("[validateOrderPaid][order({}) 不处于待支付状态请进行处理order 数据是:{}]", log.error("[validateOrderPaid][order({}) 不处于待支付状态请进行处理order 数据是:{}]",
@ -391,14 +393,14 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void deliveryOrder(Long userId, TradeOrderDeliveryReqVO deliveryReqVO) { public void deliveryOrder(TradeOrderDeliveryReqVO deliveryReqVO) {
// TODO @puhui999只有选择快递的才可以发货 // TODO @puhui999只有选择快递的才可以发货
// 1.1 校验并获得交易订单可发货 // 1.1 校验并获得交易订单可发货
TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId()); TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId());
TradeOrderDO updateOrderObj = new TradeOrderDO(); TradeOrderDO updateOrderObj = new TradeOrderDO();
// 判断发货类型 // 判断发货类型
// 2.1 快递发货 // 2.1 快递发货
if (Objects.equals(deliveryReqVO.getType(), DeliveryTypeEnum.EXPRESS.getMode())) { if (ObjectUtil.notEqual(deliveryReqVO.getLogisticsId(), 0L)) {
// 校验快递公司 // 校验快递公司
DeliveryExpressDO deliveryExpress = deliveryExpressService.getDeliveryExpress(deliveryReqVO.getLogisticsId()); DeliveryExpressDO deliveryExpress = deliveryExpressService.getDeliveryExpress(deliveryReqVO.getLogisticsId());
if (deliveryExpress == null) { if (deliveryExpress == null) {
@ -408,11 +410,9 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
throw exception(EXPRESS_STATUS_NOT_ENABLE); throw exception(EXPRESS_STATUS_NOT_ENABLE);
} }
updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo()).setDeliveryType(DeliveryTypeEnum.EXPRESS.getMode()); updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo()).setDeliveryType(DeliveryTypeEnum.EXPRESS.getMode());
} } else {
// TODO @puhui999无需发货时更新 logisticsId 0
// 2.2 无需发货 // 2.2 无需发货
if (Objects.equals(deliveryReqVO.getType(), DeliveryTypeEnum.NULL.getMode())) { updateOrderObj.setLogisticsId(0L).setLogisticsNo("").setDeliveryType(DeliveryTypeEnum.NULL.getMode());
updateOrderObj.setLogisticsId(null).setLogisticsNo("").setDeliveryType(DeliveryTypeEnum.NULL.getMode());
} }
// 更新 TradeOrderDO 状态为已发货等待收货 // 更新 TradeOrderDO 状态为已发货等待收货
@ -425,7 +425,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
// 发送站内信 // 发送站内信
tradeMessageService.sendMessageWhenDeliveryOrder(new TradeOrderMessageWhenDeliveryOrderReqBO().setOrderId(order.getId()) tradeMessageService.sendMessageWhenDeliveryOrder(new TradeOrderMessageWhenDeliveryOrderReqBO().setOrderId(order.getId())
.setUserId(userId).setMessage(null)); .setUserId(order.getUserId()).setMessage(null));
// TODO 芋艿OrderLog // TODO 芋艿OrderLog
// TODO 设计lili是不是发货后才支持售后 // TODO 设计lili是不是发货后才支持售后
@ -440,11 +440,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
* @return 交易订单 * @return 交易订单
*/ */
private TradeOrderDO validateOrderDeliverable(Long id) { private TradeOrderDO validateOrderDeliverable(Long id) {
// 校验订单是否存在 TradeOrderDO order = validateOrder(id);
TradeOrderDO order = tradeOrderMapper.selectById(id);
if (order == null) {
throw exception(ORDER_NOT_FOUND);
}
// 校验订单是否是待发货状态 // 校验订单是否是待发货状态
if (!TradeOrderStatusEnum.isUndelivered(order.getStatus())) { if (!TradeOrderStatusEnum.isUndelivered(order.getStatus())) {
throw exception(ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED); throw exception(ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED);
@ -470,6 +466,16 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
return order; return order;
} }
@NotNull
private TradeOrderDO validateOrder(Long id) {
// 校验订单是否存在
TradeOrderDO order = tradeOrderMapper.selectById(id);
if (order == null) {
throw exception(ORDER_NOT_FOUND);
}
return order;
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void receiveOrder(Long userId, Long id) { public void receiveOrder(Long userId, Long id) {
@ -489,6 +495,42 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
// TODO 芋艿lili 发送商品被购买完成的数据 // 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);
}
/** /**
* 校验交易订单满足可售货的条件 * 校验交易订单满足可售货的条件
* *

View File

@ -56,6 +56,7 @@ public class TradeAfterSaleServiceTest extends BaseDbUnitTest {
private TradeOrderUpdateService tradeOrderUpdateService; private TradeOrderUpdateService tradeOrderUpdateService;
@Resource @Resource
private TradeOrderQueryService tradeOrderQueryService; private TradeOrderQueryService tradeOrderQueryService;
@MockBean @MockBean
private PayRefundApi payRefundApi; private PayRefundApi payRefundApi;

View File

@ -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.dataobject.order.TradeOrderItemDO;
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderItemMapper; 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.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.TradeOrderConfig;
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties; import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties;
import org.junit.jupiter.api.BeforeEach; 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.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.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 cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
import static java.util.Collections.singletonList; import static java.util.Collections.singletonList;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
@ -282,7 +284,7 @@ public class TradeOrderUpdateServiceTest extends BaseDbUnitTest {
// mock 方法支付单 // mock 方法支付单
// 调用 // 调用
tradeOrderUpdateService.deliveryOrder(randomLongId(), deliveryReqVO); tradeOrderUpdateService.deliveryOrder(deliveryReqVO);
// 断言 // 断言
TradeOrderDO dbOrder = tradeOrderMapper.selectById(1L); TradeOrderDO dbOrder = tradeOrderMapper.selectById(1L);
assertEquals(dbOrder.getStatus(), TradeOrderStatusEnum.DELIVERED.getStatus()); assertEquals(dbOrder.getStatus(), TradeOrderStatusEnum.DELIVERED.getStatus());

View File

@ -27,6 +27,7 @@ public interface ErrorCodeConstants {
ErrorCode ORDER_IS_EXPIRED = new ErrorCode(1007002003, "支付订单已经过期"); ErrorCode ORDER_IS_EXPIRED = new ErrorCode(1007002003, "支付订单已经过期");
ErrorCode ORDER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1007002004, "发起支付报错,错误码:{},错误提示:{}"); ErrorCode ORDER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1007002004, "发起支付报错,错误码:{},错误提示:{}");
ErrorCode ORDER_REFUND_FAIL_STATUS_ERROR = new ErrorCode(1007002005, "支付订单退款失败,原因:状态不是已支付或已退款"); ErrorCode ORDER_REFUND_FAIL_STATUS_ERROR = new ErrorCode(1007002005, "支付订单退款失败,原因:状态不是已支付或已退款");
ErrorCode ORDER_PAID_NO_ADJUST_PRICE = new ErrorCode(1007002006, "支付订单调价失败,原因:支付订单已付款,不能调价");
// ========== ORDER 模块(拓展单) 1007003000 ========== // ========== ORDER 模块(拓展单) 1007003000 ==========
ErrorCode ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在"); ErrorCode ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在");