trade:初始化 api 包

This commit is contained in:
YunaiV 2023-10-22 21:56:21 +08:00
parent ec49751f25
commit 040a321b4e
28 changed files with 1194 additions and 1 deletions

View File

@ -22,7 +22,7 @@
<!-- <module>yudao-module-promotion-biz</module>--> <!-- <module>yudao-module-promotion-biz</module>-->
<module>yudao-module-product-api</module> <module>yudao-module-product-api</module>
<module>yudao-module-product-biz</module> <module>yudao-module-product-biz</module>
<!-- <module>yudao-module-trade-api</module>--> <module>yudao-module-trade-api</module>
<!-- <module>yudao-module-trade-biz</module>--> <!-- <module>yudao-module-trade-biz</module>-->
<!-- <module>yudao-module-statistics-api</module>--> <!-- <module>yudao-module-statistics-api</module>-->
<!-- <module>yudao-module-statistics-biz</module>--> <!-- <module>yudao-module-statistics-biz</module>-->

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-mall</artifactId>
<version>1.8.2-snapshot</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yudao-module-trade-api</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>
trade 模块 API暴露给其它模块调用
</description>
<dependencies>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-common</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<scope>provided</scope>
</dependency>
<!-- 参数校验 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<optional>true</optional>
</dependency>
<!-- RPC 远程调用相关 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.trade.api.order;
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO;
import cn.iocoder.yudao.module.trade.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Collection;
import java.util.List;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 订单")
public interface TradeOrderApi {
@GetMapping("/list")
@Operation(summary = "获得订单列表")
@Parameter(name = "ids", description = "订单编号数组", required = true)
List<TradeOrderRespDTO> getOrderList(@RequestParam("ids") Collection<Long> ids);
@GetMapping("/get")
@Operation(summary = "获得订单")
@Parameter(name = "id", description = "订单编号", required = true)
TradeOrderRespDTO getOrder(@RequestParam("id") Long id);
// TODO 芋艿需要优化下
@PutMapping("/cancel-paid")
@Parameters({
@Parameter(name = "userId", description = "用户编号", required = true, example = "1024"),
@Parameter(name = "orderId", description = "订单编号", required = true, example = "2048"),
})
void cancelPaidOrder(@RequestParam("userId") Long userId,
@RequestParam("orderId") Long orderId);
}

View File

@ -0,0 +1,69 @@
package cn.iocoder.yudao.module.trade.api.order.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 订单信息 Response DTO
*
* @author HUIHUI
*/
@Schema(description = "RPC 服务 - 订单信息 Response DTO")
@Data
public class TradeOrderRespDTO {
// ========== 订单基本信息 ==========
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "订单流水号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1146347329394184195")
private String no;
@Schema(description = "订单类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer type; // 参见 TradeOrderTypeEnum 枚举
@Schema(description = "订单来源", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer terminal; // 参见 TerminalEnum 枚举
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long userId;
@Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1")
private String userIp;
@Schema(description = "用户备注", example = "这个商品不错哦")
private String userRemark;
@Schema(description = "订单状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
private Integer status; // 参见 TradeOrderStatusEnum 枚举
@Schema(description = "购买的商品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
private Integer productCount;
@Schema(description = "订单完成时间")
private LocalDateTime finishTime;
@Schema(description = "订单取消时间")
private LocalDateTime cancelTime;
@Schema(description = "取消类型", example = "1")
private Integer cancelType; // 参见 TradeOrderCancelTypeEnum 枚举
@Schema(description = "商家备注", example = "这个用户很喜欢退货")
private String remark;
@Schema(description = "是否评价", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
private Boolean commentStatus;
// ========== 价格 + 支付基本信息 ==========
@Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long payOrderId;
@Schema(description = "是否已支付", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
private Boolean payStatus;
}

View File

@ -0,0 +1 @@
package cn.iocoder.yudao.module.trade.api;

View File

@ -0,0 +1,23 @@
package cn.iocoder.yudao.module.trade.enums;
import cn.iocoder.yudao.framework.common.enums.RpcConstants;
/**
* API 相关的枚举
*
* @author 芋道源码
*/
public class ApiConstants {
/**
* 服务名
*
* 注意需要保证和 spring.application.name 保持一致
*/
public static final String NAME = "trade-server";
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/trade";
public static final String VERSION = "1.0.0";
}

View File

@ -0,0 +1,12 @@
package cn.iocoder.yudao.module.trade.enums;
/**
* Trade 字典类型的枚举类
*
* @author owen
*/
public interface DictTypeConstants {
String BROKERAGE_WITHDRAW_STATUS = "brokerage_withdraw_status"; // 佣金提现状态
}

View File

@ -0,0 +1,96 @@
package cn.iocoder.yudao.module.trade.enums;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
/**
* Trade 错误码枚举类
* trade 系统使用 1-011-000-000
*
* @author LeeYan9
* @since 2022-08-26
*/
public interface ErrorCodeConstants {
// ========== Order 模块 1-011-000-000 ==========
ErrorCode ORDER_ITEM_NOT_FOUND = new ErrorCode(1_011_000_010, "交易订单项不存在");
ErrorCode ORDER_NOT_FOUND = new ErrorCode(1_011_000_011, "交易订单不存在");
ErrorCode ORDER_ITEM_UPDATE_AFTER_SALE_STATUS_FAIL = new ErrorCode(1_011_000_012, "交易订单项更新售后状态失败,请重试");
ErrorCode ORDER_UPDATE_PAID_STATUS_NOT_UNPAID = new ErrorCode(1_011_000_013, "交易订单更新支付状态失败,订单不是【未支付】状态");
ErrorCode ORDER_UPDATE_PAID_FAIL_PAY_ORDER_ID_ERROR = new ErrorCode(1_011_000_014, "交易订单更新支付状态失败,支付单编号不匹配");
ErrorCode ORDER_UPDATE_PAID_FAIL_PAY_ORDER_STATUS_NOT_SUCCESS = new ErrorCode(1_011_000_015, "交易订单更新支付状态失败,支付单状态不是【支付成功】状态");
ErrorCode ORDER_UPDATE_PAID_FAIL_PAY_PRICE_NOT_MATCH = new ErrorCode(1_011_000_016, "交易订单更新支付状态失败,支付单金额不匹配");
ErrorCode ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED = new ErrorCode(1_011_000_017, "交易订单发货失败,订单不是【待发货】状态");
ErrorCode ORDER_RECEIVE_FAIL_STATUS_NOT_DELIVERED = new ErrorCode(1_011_000_018, "交易订单收货失败,订单不是【待收货】状态");
ErrorCode ORDER_COMMENT_FAIL_STATUS_NOT_COMPLETED = new ErrorCode(1_011_000_019, "创建交易订单项的评价失败,订单不是【已完成】状态");
ErrorCode ORDER_COMMENT_STATUS_NOT_FALSE = new ErrorCode(1_011_000_020, "创建交易订单项的评价失败,订单已评价");
ErrorCode ORDER_DELIVERY_FAIL_REFUND_STATUS_NOT_NONE = new ErrorCode(1_011_000_021, "交易订单发货失败,订单已退款或部分退款");
ErrorCode ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS = new ErrorCode(1_011_000_022, "交易订单发货失败,拼团未成功");
ErrorCode ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS = new ErrorCode(1_011_000_023, "交易订单发货失败,砍价未成功");
ErrorCode ORDER_DELIVERY_FAIL_DELIVERY_TYPE_NOT_EXPRESS = new ErrorCode(1_011_000_024, "交易订单发货失败,发货类型不是快递");
ErrorCode ORDER_CANCEL_FAIL_STATUS_NOT_UNPAID = new ErrorCode(1_011_000_025, "交易订单取消失败,订单不是【待支付】状态");
ErrorCode ORDER_UPDATE_PRICE_FAIL_PAID = new ErrorCode(1_011_000_026, "支付订单调价失败,原因:支付订单已付款,不能调价");
ErrorCode ORDER_UPDATE_PRICE_FAIL_ALREADY = new ErrorCode(1_011_000_027, "支付订单调价失败,原因:已经修改过价格");
ErrorCode ORDER_UPDATE_PRICE_FAIL_PRICE_ERROR = new ErrorCode(1_011_000_028, "支付订单调价失败,原因:调整后支付价格不能小于 0.01 元");
ErrorCode ORDER_DELETE_FAIL_STATUS_NOT_CANCEL = new ErrorCode(1_011_000_029, "交易订单删除失败,订单不是【已取消】状态");
ErrorCode ORDER_RECEIVE_FAIL_DELIVERY_TYPE_NOT_PICK_UP = new ErrorCode(1_011_000_030, "交易订单自提失败,收货方式不是【用户自提】");
ErrorCode ORDER_UPDATE_ADDRESS_FAIL_STATUS_NOT_DELIVERED = new ErrorCode(1_011_000_031, "交易订单修改收货地址失败,原因:订单不是【待发货】状态");
ErrorCode ORDER_CREATE_FAIL_EXIST_UNPAID = new ErrorCode(1_011_000_032, "交易订单创建失败,原因:存在未付款订单");
// ========== After Sale 模块 1-011-000-100 ==========
ErrorCode AFTER_SALE_NOT_FOUND = new ErrorCode(1_011_000_100, "售后单不存在");
ErrorCode AFTER_SALE_CREATE_FAIL_REFUND_PRICE_ERROR = new ErrorCode(1_011_000_101, "申请退款金额错误");
ErrorCode AFTER_SALE_CREATE_FAIL_ORDER_STATUS_CANCELED = new ErrorCode(1_011_000_102, "订单已关闭,无法申请售后");
ErrorCode AFTER_SALE_CREATE_FAIL_ORDER_STATUS_NO_PAID = new ErrorCode(1_011_000_103, "订单未支付,无法申请售后");
ErrorCode AFTER_SALE_CREATE_FAIL_ORDER_STATUS_NO_DELIVERED = new ErrorCode(1_011_000_104, "订单未发货,无法申请【退货退款】售后");
ErrorCode AFTER_SALE_CREATE_FAIL_ORDER_ITEM_APPLIED = new ErrorCode(1_011_000_105, "订单项已申请售后,无法重复申请");
ErrorCode AFTER_SALE_AUDIT_FAIL_STATUS_NOT_APPLY = new ErrorCode(1_011_000_106, "审批失败,售后状态不处于审批中");
ErrorCode AFTER_SALE_UPDATE_STATUS_FAIL = new ErrorCode(1_011_000_107, "操作售后单失败,请刷新后重试");
ErrorCode AFTER_SALE_DELIVERY_FAIL_STATUS_NOT_SELLER_AGREE = new ErrorCode(1_011_000_108, "退货失败,售后单状态不处于【待买家退货】");
ErrorCode AFTER_SALE_CONFIRM_FAIL_STATUS_NOT_BUYER_DELIVERY = new ErrorCode(1_011_000_109, "确认收货失败,售后单状态不处于【待确认收货】");
ErrorCode AFTER_SALE_REFUND_FAIL_STATUS_NOT_WAIT_REFUND = new ErrorCode(1_011_000_110, "退款失败,售后单状态不是【待退款】");
ErrorCode AFTER_SALE_CANCEL_FAIL_STATUS_NOT_APPLY_OR_AGREE_OR_BUYER_DELIVERY =
new ErrorCode(1_011_000_111, "取消售后单失败,售后单状态不是【待审核】或【卖家同意】或【商家待收货】");
// ========== Cart 模块 1-011-002-000 ==========
ErrorCode CARD_ITEM_NOT_FOUND = new ErrorCode(1_011_002_000, "购物车项不存在");
// ========== Price 相关 1-011-003-000 ============
ErrorCode PRICE_CALCULATE_PAY_PRICE_ILLEGAL = new ErrorCode(1_011_003_000, "支付价格计算异常,原因:价格小于等于 0");
ErrorCode PRICE_CALCULATE_DELIVERY_PRICE_TEMPLATE_NOT_FOUND = new ErrorCode(1_011_003_002, "计算快递运费异常,找不到对应的运费模板");
ErrorCode PRICE_CALCULATE_COUPON_NOT_MATCH_NORMAL_ORDER = new ErrorCode(1_011_003_004, "参与秒杀、拼团、砍价的营销商品,无法使用优惠劵");
ErrorCode PRICE_CALCULATE_SECKILL_TOTAL_LIMIT_COUNT = new ErrorCode(1_011_003_005, "参与秒杀的商品,超过了秒杀总限购数量");
// ========== 物流 Express 模块 1-011-004-000 ==========
ErrorCode EXPRESS_NOT_EXISTS = new ErrorCode(1_011_004_000, "快递公司不存在");
ErrorCode EXPRESS_CODE_DUPLICATE = new ErrorCode(1_011_004_001, "已经存在该编码的快递公司");
ErrorCode EXPRESS_CLIENT_NOT_PROVIDE = new ErrorCode(1_011_004_002, "需要接入快递服务商比如【快递100】");
ErrorCode EXPRESS_STATUS_NOT_ENABLE = new ErrorCode(1_011_004_003, "快递公司未启用");
ErrorCode EXPRESS_API_QUERY_ERROR = new ErrorCode(1_011_004_101, "快递查询接口异常");
ErrorCode EXPRESS_API_QUERY_FAILED = new ErrorCode(1_011_004_102, "快递查询返回失败,原因:{}");
// ========== 物流 Template 模块 1-011-005-000 ==========
ErrorCode EXPRESS_TEMPLATE_NAME_DUPLICATE = new ErrorCode(1_011_005_000, "已经存在该运费模板名");
ErrorCode EXPRESS_TEMPLATE_NOT_EXISTS = new ErrorCode(1_011_005_001, "运费模板不存在");
// ========== 物流 PICK_UP 模块 1-011-006-000 ==========
ErrorCode PICK_UP_STORE_NOT_EXISTS = new ErrorCode(1_011_006_000, "自提门店不存在");
// ========== 分销用户 模块 1-011-007-000 ==========
ErrorCode BROKERAGE_USER_NOT_EXISTS = new ErrorCode(1_011_007_000, "分销用户不存在");
ErrorCode BROKERAGE_USER_FROZEN_PRICE_NOT_ENOUGH = new ErrorCode(1_011_007_001, "用户冻结佣金({})数量不足");
ErrorCode BROKERAGE_BIND_SELF = new ErrorCode(1_011_007_002, "不能绑定自己");
ErrorCode BROKERAGE_BIND_USER_NOT_ENABLED = new ErrorCode(1_011_007_003, "绑定用户没有推广资格");
ErrorCode BROKERAGE_BIND_CONDITION_ADMIN = new ErrorCode(1_011_007_004, "仅可在后台绑定推广员");
ErrorCode BROKERAGE_BIND_MODE_REGISTER = new ErrorCode(1_011_007_005, "只有在注册时可以绑定");
ErrorCode BROKERAGE_BIND_OVERRIDE = new ErrorCode(1_011_007_006, "已绑定了推广人");
ErrorCode BROKERAGE_BIND_LOOP = new ErrorCode(1_011_007_007, "下级不能绑定自己的上级");
ErrorCode BROKERAGE_USER_LEVEL_NOT_SUPPORT = new ErrorCode(1_011_007_008, "目前只支持 level 小于等于 2");
// ========== 分销提现 模块 1-011-008-000 ==========
ErrorCode BROKERAGE_WITHDRAW_NOT_EXISTS = new ErrorCode(1_011_008_000, "佣金提现记录不存在");
ErrorCode BROKERAGE_WITHDRAW_STATUS_NOT_AUDITING = new ErrorCode(1_011_008_001, "佣金提现记录状态不是审核中");
ErrorCode BROKERAGE_WITHDRAW_MIN_PRICE = new ErrorCode(1_011_008_002, "提现金额不能低于 {} 元");
ErrorCode BROKERAGE_WITHDRAW_USER_BALANCE_NOT_ENOUGH = new ErrorCode(1_011_008_003, "您当前最多可提现 {} 元");
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.trade.enums;
// TODO @芋艿枚举
/**
* 通知模板枚举类
*
* @author HUIHUI
*/
public interface MessageTemplateConstants {
String ORDER_DELIVERY = "order_delivery"; // 短信模版编号
String BROKERAGE_WITHDRAW_AUDIT_APPROVE = "brokerage_withdraw_audit_approve"; // 佣金提现审核通过
String BROKERAGE_WITHDRAW_AUDIT_REJECT = "brokerage_withdraw_audit_reject"; // 佣金提现审核不通过
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.trade.enums.aftersale;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* 售后操作类型的枚举
*
* @author 陈賝
* @since 2023/6/13 13:53
*/
@RequiredArgsConstructor
@Getter
public enum AfterSaleOperateTypeEnum {
MEMBER_CREATE(10, "会员申请退款"),
ADMIN_AGREE_APPLY(11, "商家同意退款"),
ADMIN_DISAGREE_APPLY(12, "商家拒绝退款"),
MEMBER_DELIVERY(20, "会员填写退货物流信息,快递公司:{deliveryName},快递单号:{logisticsNo}"),
ADMIN_AGREE_RECEIVE(21, "商家收货"),
ADMIN_DISAGREE_RECEIVE(22, "商家拒绝收货,原因:{reason}"),
ADMIN_REFUND(30, "商家退款"),
MEMBER_CANCEL(40, "会员取消退款"),
;
/**
* 操作类型
*/
private final Integer type;
/**
* 操作描述
*/
private final String content;
}

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.trade.enums.aftersale;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.Collection;
import static cn.hutool.core.util.ArrayUtil.firstMatch;
/**
* 售后状态的枚举
*
* <a href="https://www.processon.com/view/link/63731a270e3e742ce7b7c194">状态流转</a>
*
* @author 芋道源码
*/
@AllArgsConstructor
@Getter
public enum AfterSaleStatusEnum implements IntArrayValuable {
/**
* 申请售后
*/
APPLY(10,"申请中", "会员申请退款"), // 有赞的状态提示退款申请待商家处理
/**
* 卖家通过售后商品待退货
*/
SELLER_AGREE(20, "卖家通过", "商家同意退款"), // 有赞的状态提示请退货并填写物流信息
/**
* 买家已退货等待卖家收货商家待收货
*/
BUYER_DELIVERY(30,"待卖家收货", "会员填写退货物流信息"), // 有赞的状态提示退货退款申请待商家处理
/**
* 卖家已收货等待平台退款等待退款等待退款
*/
WAIT_REFUND(40, "等待平台退款", "商家收货"), // 有赞的状态提示有赞无该状态
/**
* 完成退款退款成功
*/
COMPLETE(50, "完成", "商家确认退款"), // 有赞的状态提示退款成功
/**
* 买家取消
*/
BUYER_CANCEL(61, "买家取消售后", "会员取消退款"), // 有赞的状态提示退款关闭
/**
* 卖家拒绝售后商家拒绝商家拒绝
*/
SELLER_DISAGREE(62,"卖家拒绝", "商家拒绝退款"), // 有赞的状态提示商家不同意退款申请
/**
* 卖家拒绝收货终止售后商家拒收货
*/
SELLER_REFUSE(63,"卖家拒绝收货", "商家拒绝收货"), // 有赞的状态提示商家拒绝收货不同意退款
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(AfterSaleStatusEnum::getStatus).toArray();
/**
* 进行中的售后状态
*
* 不包括已经结束的状态
*/
public static final Collection<Integer> APPLYING_STATUSES = Arrays.asList(
APPLY.getStatus(),
SELLER_AGREE.getStatus(),
BUYER_DELIVERY.getStatus(),
WAIT_REFUND.getStatus()
);
/**
* 状态
*/
private final Integer status;
/**
* 状态名
*/
private final String name;
/**
* 操作内容
*
* 目的记录售后日志的内容
*/
private final String content;
@Override
public int[] array() {
return ARRAYS;
}
public static AfterSaleStatusEnum valueOf(Integer status) {
return firstMatch(value -> value.getStatus().equals(status), values());
}
}

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.module.trade.enums.aftersale;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
/**
* 交易售后 - 类型
*
* @author 芋道源码
*/
@RequiredArgsConstructor
@Getter
public enum AfterSaleTypeEnum implements IntArrayValuable {
IN_SALE(10, "售中退款"), // 交易完成前买家申请退款
AFTER_SALE(20, "售后退款"); // 交易完成后买家申请退款
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(AfterSaleTypeEnum::getType).toArray();
/**
* 类型
*/
private final Integer type;
/**
* 类型名
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.module.trade.enums.aftersale;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
/**
* 交易售后 - 方式
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum AfterSaleWayEnum implements IntArrayValuable {
REFUND(10, "仅退款"),
RETURN_AND_REFUND(20, "退货退款");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(AfterSaleWayEnum::getWay).toArray();
/**
* 方式
*/
private final Integer way;
/**
* 方式名
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,48 @@
package cn.iocoder.yudao.module.trade.enums.brokerage;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 分销关系绑定模式枚举
*
* @author owen
*/
@AllArgsConstructor
@Getter
public enum BrokerageBindModeEnum implements IntArrayValuable {
/**
* 只要用户没有推广人随时都可以绑定分销关系
*/
ANYTIME(1, "首次绑定"),
/**
* 仅新用户注册时才能绑定推广关系
*/
REGISTER(2, "注册绑定"),
/**
* 每次扫码都覆盖
*/
OVERRIDE(3, "覆盖绑定"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BrokerageBindModeEnum::getMode).toArray();
/**
* 模式
*/
private final Integer mode;
/**
* 名字
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.module.trade.enums.brokerage;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 分佣模式枚举
*
* @author owen
*/
@AllArgsConstructor
@Getter
public enum BrokerageEnabledConditionEnum implements IntArrayValuable {
/**
* 所有用户都可以分销
*/
ALL(1, "人人分销"),
/**
* 仅可后台手动设置推广员
*/
ADMIN(2, "指定分销"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BrokerageEnabledConditionEnum::getCondition).toArray();
/**
* 模式
*/
private final Integer condition;
/**
* 名字
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.trade.enums.brokerage;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 佣金记录业务类型枚举
*
* @author owen
*/
@AllArgsConstructor
@Getter
public enum BrokerageRecordBizTypeEnum implements IntArrayValuable {
ORDER(1, "获得推广佣金", "获得推广佣金 {}", true),
WITHDRAW(2, "提现申请", "提现申请扣除佣金 {}", false),
WITHDRAW_REJECT(3, "提现申请驳回", "提现申请驳回,返还佣金 {}", true),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BrokerageRecordBizTypeEnum::getType).toArray();
/**
* 类型
*/
private final Integer type;
/**
* 标题
*/
private final String title;
/**
* 描述
*/
private final String description;
/**
* 是否为增加佣金
*/
private final boolean add;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.trade.enums.brokerage;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 佣金记录状态枚举
*
* @author owen
*/
@AllArgsConstructor
@Getter
public enum BrokerageRecordStatusEnum implements IntArrayValuable {
WAIT_SETTLEMENT(0, "待结算"),
SETTLEMENT(1, "已结算"),
CANCEL(2, "已取消"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BrokerageRecordStatusEnum::getStatus).toArray();
/**
* 状态
*/
private final Integer status;
/**
* 名字
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,42 @@
package cn.iocoder.yudao.module.trade.enums.brokerage;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
// TODO 芋艿提现的打通在纠结下
/**
* 佣金提现状态枚举
*
* @author owen
*/
@AllArgsConstructor
@Getter
public enum BrokerageWithdrawStatusEnum implements IntArrayValuable {
AUDITING(0, "审核中"),
AUDIT_SUCCESS(10, "审核通过"),
WITHDRAW_SUCCESS(11, "提现成功"),
AUDIT_FAIL(20, "审核不通过"),
WITHDRAW_FAIL(21, "提现失败"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BrokerageWithdrawStatusEnum::getStatus).toArray();
/**
* 状态
*/
private final Integer status;
/**
* 名字
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.trade.enums.brokerage;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 佣金提现类型枚举
*
* @author owen
*/
@AllArgsConstructor
@Getter
public enum BrokerageWithdrawTypeEnum implements IntArrayValuable {
WALLET(1, "钱包"),
BANK(2, "银行卡"),
WECHAT(3, "微信"),
ALIPAY(4, "支付宝"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BrokerageWithdrawTypeEnum::getType).toArray();
/**
* 类型
*/
private final Integer type;
/**
* 名字
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,43 @@
package cn.iocoder.yudao.module.trade.enums.delivery;
import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 快递配送计费方式枚举
*
* @author jason
*/
@AllArgsConstructor
@Getter
public enum DeliveryExpressChargeModeEnum implements IntArrayValuable {
COUNT(1, "按件"),
WEIGHT(2,"按重量"),
VOLUME(3, "按体积");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DeliveryExpressChargeModeEnum::getType).toArray();
/**
* 类型
*/
private final Integer type;
/**
* 描述
*/
private final String desc;
@Override
public int[] array() {
return ARRAYS;
}
public static DeliveryExpressChargeModeEnum valueOf(Integer value) {
return ArrayUtil.firstMatch(chargeMode -> chargeMode.getType().equals(value), DeliveryExpressChargeModeEnum.values());
}
}

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.module.trade.enums.delivery;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 配送方式枚举
*
* @author 芋道源码
*/
@Getter
@AllArgsConstructor
public enum DeliveryTypeEnum implements IntArrayValuable {
EXPRESS(1, "快递发货"),
PICK_UP(2, "用户自提"),;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DeliveryTypeEnum::getType).toArray();
/**
* 配送方式
*/
private final Integer type;
/**
* 状态名
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,5 @@
package cn.iocoder.yudao.module.trade.enums.notify;
// TODO @芋艿这个枚举的作用
public interface TradeNotifyEnums {
}

View File

@ -0,0 +1,38 @@
package cn.iocoder.yudao.module.trade.enums.order;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
/**
* 交易订单 - 关闭类型
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum TradeOrderCancelTypeEnum implements IntArrayValuable {
PAY_TIMEOUT(10, "超时未支付"),
AFTER_SALE_CLOSE(20, "退款关闭"),
MEMBER_CANCEL(30, "买家取消");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TradeOrderCancelTypeEnum::getType).toArray();
/**
* 关闭类型
*/
private final Integer type;
/**
* 关闭类型名
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,49 @@
package cn.iocoder.yudao.module.trade.enums.order;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
/**
* 交易订单项 - 售后状态
*
* @author 芋道源码
*/
@RequiredArgsConstructor
@Getter
public enum TradeOrderItemAfterSaleStatusEnum implements IntArrayValuable {
NONE(0, "未售后"),
APPLY(10, "售后中"),
SUCCESS(20, "售后成功");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TradeOrderItemAfterSaleStatusEnum::getStatus).toArray();
/**
* 状态值
*/
private final Integer status;
/**
* 状态名
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
/**
* 判断指定状态是否正处于未申请状态
*
* @param status 指定状态
* @return 是否
*/
public static boolean isNone(Integer status) {
return ObjectUtil.equals(status, NONE.getStatus());
}
}

View File

@ -0,0 +1,42 @@
package cn.iocoder.yudao.module.trade.enums.order;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* 订单操作类型的枚举
*
* @author 陈賝
* @since 2023/7/6 15:31
*/
@RequiredArgsConstructor
@Getter
public enum TradeOrderOperateTypeEnum {
MEMBER_CREATE(1, "用户下单"),
ADMIN_UPDATE_PRICE(2, "订单价格 {oldPayPrice} 修改,实际支付金额为 {newPayPrice} 元"),
MEMBER_PAY(10, "用户付款成功"),
ADMIN_UPDATE_ADDRESS(11, "收货地址修改"),
ADMIN_DELIVERY(20, "已发货,快递公司:{deliveryName},快递单号:{logisticsNo}"),
MEMBER_RECEIVE(30, "用户已收货"),
SYSTEM_RECEIVE(31, "到期未收货,系统自动确认收货"),
ADMIN_PICK_UP_RECEIVE(32, "管理员自提收货"),
MEMBER_COMMENT(33, "用户评价"),
SYSTEM_COMMENT(34, "到期未评价,系统自动评价"),
MEMBER_CANCEL(40, "取消订单"),
SYSTEM_CANCEL(41, "到期未支付,系统自动取消订单"),
// 42 预留管理员取消订单
ADMIN_CANCEL_AFTER_SALE(43, "订单全部售后,管理员自动取消订单"),
MEMBER_DELETE(49, "删除订单"),
;
/**
* 操作类型
*/
private final Integer type;
/**
* 操作描述
*/
private final String content;
}

View File

@ -0,0 +1,38 @@
package cn.iocoder.yudao.module.trade.enums.order;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
/**
* 交易订单 - 退款状态
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum TradeOrderRefundStatusEnum implements IntArrayValuable {
NONE(0, "未退款"),
PART(10, "部分退款"),
ALL(20, "全部退款");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TradeOrderRefundStatusEnum::getStatus).toArray();
/**
* 状态值
*/
private final Integer status;
/**
* 状态名
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -0,0 +1,116 @@
package cn.iocoder.yudao.module.trade.enums.order;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
/**
* 交易订单 - 状态
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum TradeOrderStatusEnum implements IntArrayValuable {
UNPAID(0, "待支付"),
UNDELIVERED(10, "待发货"),
DELIVERED(20, "已发货"),
COMPLETED(30, "已完成"),
CANCELED(40, "已取消");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TradeOrderStatusEnum::getStatus).toArray();
/**
* 状态值
*/
private final Integer status;
/**
* 状态名
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
// ========== 为什么写了很多 isXXX haveXXX 的判断逻辑呢 ==========
// ========== 方便找到某一类判断哪些业务正在使用 ==========
/**
* 判断指定状态是否正处于未付款状态
*
* @param status 指定状态
* @return 是否
*/
public static boolean isUnpaid(Integer status) {
return ObjectUtil.equal(UNPAID.getStatus(), status);
}
/**
* 判断指定状态是否正处于待发货状态
*
* @param status 指定状态
* @return 是否
*/
public static boolean isUndelivered(Integer status) {
return ObjectUtil.equal(UNDELIVERED.getStatus(), status);
}
/**
* 判断指定状态是否正处于已发货状态
*
* @param status 指定状态
* @return 是否
*/
public static boolean isDelivered(Integer status) {
return ObjectUtil.equals(status, DELIVERED.getStatus());
}
/**
* 判断指定状态是否正处于已取消状态
*
* @param status 指定状态
* @return 是否
*/
public static boolean isCanceled(Integer status) {
return ObjectUtil.equals(status, CANCELED.getStatus());
}
/**
* 判断指定状态是否正处于已完成状态
*
* @param status 指定状态
* @return 是否
*/
public static boolean isCompleted(Integer status) {
return ObjectUtil.equals(status, COMPLETED.getStatus());
}
/**
* 判断指定状态是否有过已付款状态
*
* @param status 指定状态
* @return 是否
*/
public static boolean havePaid(Integer status) {
return ObjectUtils.equalsAny(status, UNDELIVERED.getStatus(),
DELIVERED.getStatus(), COMPLETED.getStatus());
}
/**
* 判断指定状态是否有过已发货状态
*
* @param status 指定状态
* @return 是否
*/
public static boolean haveDelivered(Integer status) {
return ObjectUtils.equalsAny(status, DELIVERED.getStatus(), COMPLETED.getStatus());
}
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.trade.enums.order;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
/**
* 交易订单 - 类型
*
* @author Sin
*/
@RequiredArgsConstructor
@Getter
public enum TradeOrderTypeEnum implements IntArrayValuable {
NORMAL(0, "普通订单"),
SECKILL(1, "秒杀订单"),
BARGAIN(2, "砍价订单"),
COMBINATION(3, "拼团订单"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TradeOrderTypeEnum::getType).toArray();
/**
* 类型
*/
private final Integer type;
/**
* 类型名
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
public static boolean isNormal(Integer type) {
return ObjectUtil.equal(type, NORMAL.getType());
}
public static boolean isSeckill(Integer type) {
return ObjectUtil.equal(type, SECKILL.getType());
}
public static boolean isBargain(Integer type) {
return ObjectUtil.equal(type, BARGAIN.getType());
}
public static boolean isCombination(Integer type) {
return ObjectUtil.equal(type, COMBINATION.getType());
}
}