提交 b4b1b71d authored 作者: hzh's avatar hzh

商城模块集成

上级 cc0ff0c8
package org.dromara.mall.api.dto.member;
import lombok.Data;
/**
* 用户收件地址 Response DTO
*
* @author 芋道源码
*/
@Data
public class MemberAddressRespDTO {
/**
* 编号
*/
private Long id;
/**
* 用户编号
*/
private Long userId;
/**
* 收件人名称
*/
private String name;
/**
* 手机号
*/
private String mobile;
/**
* 地区编号
*/
private Integer areaId;
/**
* 收件详细地址
*/
private String detailAddress;
/**
* 是否默认
*/
private Boolean defaultStatus;
}
package org.dromara.mall.api.dto.member;
import lombok.Data;
/**
* 用户信息 Response DTO
*
* @author 芋道源码
*/
@Data
public class MemberConfigRespDTO {
/**
* 积分抵扣开关
*/
private Boolean pointTradeDeductEnable;
/**
* 积分抵扣,单位:分
* <p>
* 1 积分抵扣多少分
*/
private Integer pointTradeDeductUnitPrice;
/**
* 积分抵扣最大值
*/
private Integer pointTradeDeductMaxPrice;
/**
* 1 元赠送多少分
*/
private Integer pointTradeGivePoint;
}
package org.dromara.mall.api.dto.member;
import lombok.Data;
/**
* 会员等级 Resp DTO
*
* @author 芋道源码
*/
@Data
public class MemberLevelRespDTO {
/**
* 编号
*/
private Long id;
/**
* 等级名称
*/
private String name;
/**
* 等级
*/
private Integer level;
/**
* 升级经验
*/
private Integer experience;
/**
* 享受折扣
*/
private Integer discountPercent;
/**
* 状态
*
* 枚举 {@link org.dromara.common.core.enums.CommonStatusEnum}
*/
private Integer status;
}
package org.dromara.mall.api.dto.member;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 用户信息 Response DTO
*
* @author 芋道源码
*/
@Data
public class MemberUserRespDTO {
/**
* 用户ID
*/
private Long id;
/**
* 用户昵称
*/
private String nickname;
/**
* 帐号状态
*
* 枚举 {@link org.dromara.common.core.enums.CommonStatusEnum}
*/
private Integer status;
/**
* 用户头像
*/
private String avatar;
/**
* 手机
*/
private String mobile;
/**
* 创建时间(注册时间)
*/
private LocalDateTime createTime;
// ========== 其它信息 ==========
/**
* 会员级别编号
*/
private Long levelId;
/**
* 积分
*/
private Integer point;
}
package org.dromara.mall.api.dto.member;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* OAuth2.0 访问令牌的校验 Response DTO
*
* @author 芋道源码
*/
@Data
public class OAuth2AccessTokenCheckRespDTO implements Serializable {
/**
* 用户编号
*/
private Long userId;
/**
* 用户类型
*/
private Integer userType;
/**
* 用户信息
*/
private Map<String, String> userInfo;
/**
* 租户编号
*/
private Long tenantId;
/**
* 授权范围的数组
*/
private List<String> scopes;
/**
* 过期时间
*/
private LocalDateTime expiresTime;
}
package org.dromara.mall.api.dto.member;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* OAuth2.0 访问令牌创建 Request DTO
*
* @author 芋道源码
*/
@Data
public class OAuth2AccessTokenCreateReqDTO implements Serializable {
/**
* 用户编号
*/
@NotNull(message = "用户编号不能为空")
private Long userId;
/**
* 用户类型
*/
@NotNull(message = "用户类型不能为空")
// @InEnum(value = UserTypeEnum.class, message = "用户类型必须是 {value}")
private Integer userType;
/**
* 客户端编号
*/
@NotNull(message = "客户端编号不能为空")
private String clientId;
/**
* 授权范围
*/
private List<String> scopes;
}
package org.dromara.mall.api.dto.member;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* OAuth2.0 访问令牌的信息 Response DTO
*
* @author 芋道源码
*/
@Data
@Accessors(chain = true)
public class OAuth2AccessTokenRespDTO implements Serializable {
/**
* 访问令牌
*/
private String accessToken;
/**
* 刷新令牌
*/
private String refreshToken;
/**
* 用户编号
*/
private Long userId;
/**
* 用户类型
*/
private Integer userType;
/**
* 过期时间
*/
private LocalDateTime expiresTime;
}
package org.dromara.mall.api.dto.member;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.dromara.common.mall.validation.Mobile;
/**
* 短信验证码的发送 Request DTO
*
* @author 芋道源码
*/
@Data
public class SmsCodeSendReqDTO {
/**
* 手机号
*/
@Mobile
@NotEmpty(message = "手机号不能为空")
private String mobile;
/**
* 发送场景
*/
@NotNull(message = "发送场景不能为空")
// @InEnum(SmsSceneEnum.class)
private Integer scene;
/**
* 发送 IP
*/
@NotEmpty(message = "发送 IP 不能为空")
private String createIp;
}
package org.dromara.mall.api.dto.member;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.dromara.common.mall.validation.Mobile;
/**
* 短信验证码的使用 Request DTO
*
* @author 芋道源码
*/
@Data
public class SmsCodeUseReqDTO {
/**
* 手机号
*/
@Mobile
@NotEmpty(message = "手机号不能为空")
private String mobile;
/**
* 发送场景
*/
@NotNull(message = "发送场景不能为空")
// @InEnum(SmsSceneEnum.class)
private Integer scene;
/**
* 验证码
*/
@NotEmpty(message = "验证码")
private String code;
/**
* 使用 IP
*/
@NotEmpty(message = "使用 IP 不能为空")
private String usedIp;
}
package org.dromara.mall.api.dto.member;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.dromara.common.mall.validation.Mobile;
/**
* 短信验证码的校验 Request DTO
*
* @author 芋道源码
*/
@Data
public class SmsCodeValidateReqDTO {
/**
* 手机号
*/
@Mobile
@NotEmpty(message = "手机号不能为空")
private String mobile;
/**
* 发送场景
*/
@NotNull(message = "发送场景不能为空")
// @InEnum(SmsSceneEnum.class)
private Integer scene;
/**
* 验证码
*/
@NotEmpty(message = "验证码")
private String code;
}
package org.dromara.mall.api.dto.member;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 取消绑定社交用户 Request DTO
*
* @author 芋道源码
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SocialUserBindReqDTO {
/**
* 用户编号
*/
@NotNull(message = "用户编号不能为空")
private Long userId;
/**
* 用户类型
*/
// @InEnum(UserTypeEnum.class)
@NotNull(message = "用户类型不能为空")
private Integer userType;
/**
* 社交平台的类型
*/
// @InEnum(SocialTypeEnum.class)
@NotNull(message = "社交平台的类型不能为空")
private Integer socialType;
/**
* 授权码
*/
@NotEmpty(message = "授权码不能为空")
private String code;
/**
* state
*/
@NotNull(message = "state 不能为空")
private String state;
}
package org.dromara.mall.api.dto.member;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 社交用户 Response DTO
*
* @author 芋道源码
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SocialUserRespDTO {
/**
* 社交用户的 openid
*/
private String openid;
/**
* 社交用户的昵称
*/
private String nickname;
/**
* 社交用户的头像
*/
private String avatar;
/**
* 关联的用户编号
*/
private Long userId;
}
package org.dromara.mall.api.dto.member;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 社交绑定 Request DTO,使用 code 授权码
*
* @author 芋道源码
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SocialUserUnbindReqDTO {
/**
* 用户编号
*/
@NotNull(message = "用户编号不能为空")
private Long userId;
/**
* 用户类型
*/
// @InEnum(UserTypeEnum.class)
@NotNull(message = "用户类型不能为空")
private Integer userType;
/**
* 社交平台的类型
*/
// @InEnum(SocialTypeEnum.class)
@NotNull(message = "社交平台的类型不能为空")
private Integer socialType;
/**
* 社交平台的 openid
*/
@NotEmpty(message = "社交平台的 openid 不能为空")
private String openid;
}
package org.dromara.mall.api.dto.member;
import lombok.Data;
/**
* 微信公众号 JSAPI 签名 Response DTO
*
* @author 芋道源码
*/
@Data
public class SocialWxJsapiSignatureRespDTO {
/**
* 微信公众号的 appId
*/
private String appId;
/**
* 匿名串
*/
private String nonceStr;
/**
* 时间戳
*/
private Long timestamp;
/**
* URL
*/
private String url;
/**
* 签名
*/
private String signature;
}
package org.dromara.mall.api.dto.member;
import lombok.Data;
/**
* 微信小程序的手机信息 Response DTO
*
* @author 芋道源码
*/
@Data
public class SocialWxPhoneNumberInfoRespDTO {
/**
* 用户绑定的手机号(国外手机号会有区号)
*/
private String phoneNumber;
/**
* 没有区号的手机号
*/
private String purePhoneNumber;
/**
* 区号
*/
private String countryCode;
}
package org.dromara.mall.api.dto.member;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
/**
* 获取小程序码 Request DTO
*
* @author HUIHUI
* @see <a href="https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/qr-code/getUnlimitedQRCode.html">获取不限制的小程序码</a>
*/
@Data
public class SocialWxQrcodeReqDTO {
/**
* 页面路径不能携带参数(参数请放在scene字段里)
*/
public static final String SCENE = "";
/**
* 二维码宽度
*/
public static final Integer WIDTH = 430;
/**
* 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调
*/
public static final Boolean AUTO_COLOR = true;
/**
* 检查 page 是否存在
*/
public static final Boolean CHECK_PATH = true;
/**
* 是否需要透明底色
*
* hyaline 为 true 时,生成透明底色的小程序码
*/
public static final Boolean HYALINE = true;
/**
* 场景
*/
@NotEmpty(message = "场景不能为空")
private String scene;
/**
* 页面路径
*/
@NotEmpty(message = "页面路径不能为空")
private String path;
/**
* 二维码宽度
*/
private Integer width;
/**
* 是否需要透明底色
*/
private Boolean autoColor;
/**
* 是否检查 page 是否存在
*/
private Boolean checkPath;
/**
* 是否需要透明底色
*/
private Boolean hyaline;
}
package org.dromara.mall.api.dto.member;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.HashMap;
import java.util.Map;
/**
* 微信小程序订阅消息发送 Request DTO
*
* @author HUIHUI
*/
@Data
@Accessors(chain = true)
public class SocialWxaSubscribeMessageSendReqDTO {
/**
* 用户编号
*
* 关联 MemberUserDO 的 id 编号
* 关联 AdminUserDO 的 id 编号
*/
@NotNull(message = "用户编号不能为空")
private Long userId;
/**
* 用户类型
*
* 关联 {@link org.dromara.common.mall.enums.UserTypeEnum}
*/
@NotNull(message = "用户类型不能为空")
private Integer userType;
/**
* 消息模版标题
*/
@NotEmpty(message = "消息模版标题不能为空")
private String templateTitle;
/**
* 点击模板卡片后的跳转页面,仅限本小程序内的页面
*
* 支持带参数,(示例 index?foo=bar )。该字段不填则模板无跳转。
*/
private String page;
/**
* 模板内容的参数
*/
private Map<String, String> messages;
public SocialWxaSubscribeMessageSendReqDTO addMessage(String key, String value) {
if (messages == null) {
messages = new HashMap<>();
}
messages.put(key, value);
return this;
}
}
package org.dromara.mall.api.dto.member;
import lombok.Data;
/**
* 小程序订阅消息模版 Response DTO
*
* @author HUIHUI
*/
@Data
public class SocialWxaSubscribeTemplateRespDTO {
/**
* 模版编号
*/
private String id;
/**
* 模版标题
*/
private String title;
/**
* 模版内容
*/
private String content;
/**
* 模板内容示例
*/
private String example;
/**
* 模版类型
*
* 2:为一次性订阅
* 3:为长期订阅
*/
private Integer type;
}
package org.dromara.mall.api.dto.pay;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 支付单创建 Request DTO
*/
@Data
@Accessors(chain = true)
public class PayOrderCreateReqDTO implements Serializable {
public static final int SUBJECT_MAX_LENGTH = 32;
/**
* 应用标识
*/
@NotNull(message = "应用标识不能为空")
private String appKey;
/**
* 用户 IP
*/
@NotEmpty(message = "用户 IP 不能为空")
private String userIp;
// ========== 商户相关字段 ==========
/**
* 商户订单编号
*/
@NotEmpty(message = "商户订单编号不能为空")
private String merchantOrderId;
/**
* 商品标题
*/
@NotEmpty(message = "商品标题不能为空")
@Length(max = SUBJECT_MAX_LENGTH, message = "商品标题不能超过 32")
private String subject;
/**
* 商品描述
*/
@Length(max = 128, message = "商品描述信息长度不能超过128")
private String body;
// ========== 订单相关字段 ==========
/**
* 支付金额,单位:分
*/
@NotNull(message = "支付金额不能为空")
@DecimalMin(value = "0", inclusive = false, message = "支付金额必须大于零")
private Integer price;
/**
* 支付过期时间
*/
@NotNull(message = "支付过期时间不能为空")
private LocalDateTime expireTime;
}
package org.dromara.mall.api.dto.pay;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 支付单的通知 Request DTO
*
* @author 芋道源码
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PayOrderNotifyReqDTO {
/**
* 商户订单编号
*/
@NotEmpty(message = "商户订单号不能为空")
private String merchantOrderId;
/**
* 支付订单编号
*/
@NotNull(message = "支付订单编号不能为空")
private Long payOrderId;
}
package org.dromara.mall.api.dto.pay;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 支付单信息 Response DTO
*
* @author 芋道源码
*/
@Data
public class PayOrderRespDTO {
/**
* 订单编号,数据库自增
*/
private Long id;
/**
* 渠道编码
*
* 枚举 PayChannelEnum
*/
private String channelCode;
// ========== 商户相关字段 ==========
/**
* 商户订单编号
* 例如说,内部系统 A 的订单号。需要保证每个 PayMerchantDO 唯一
*/
private String merchantOrderId;
// ========== 订单相关字段 ==========
/**
* 支付金额,单位:分
*/
private Integer price;
/**
* 支付状态
*
* 枚举 {@link org.dromara.mall.enums.pay.order.PayOrderStatusEnum}
*/
private Integer status;
/**
* 订单支付成功时间
*/
private LocalDateTime successTime;
// ========== 渠道相关字段 ==========
}
package org.dromara.mall.api.dto.pay;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.URL;
import java.time.LocalDateTime;
import java.util.Map;
/**
* 统一下单 Request DTO
*
* @author 芋道源码
*/
@Data
@Accessors(chain = true)
public class PayOrderUnifiedReqDTO {
/**
* 用户 IP
*/
@NotEmpty(message = "用户 IP 不能为空")
private String userIp;
// ========== 商户相关字段 ==========
/**
* 外部订单号
*
* 对应 PayOrderExtensionDO 的 no 字段
*/
@NotEmpty(message = "外部订单编号不能为空")
private String outTradeNo;
/**
* 商品标题
*/
@NotEmpty(message = "商品标题不能为空")
@Length(max = 32, message = "商品标题不能超过 32")
private String subject;
/**
* 商品描述信息
*/
@Length(max = 128, message = "商品描述信息长度不能超过128")
private String body;
/**
* 支付结果的 notify 回调地址
*/
@NotEmpty(message = "支付结果的回调地址不能为空")
@URL(message = "支付结果的 notify 回调地址必须是 URL 格式")
private String notifyUrl;
/**
* 支付结果的 return 回调地址
*/
@URL(message = "支付结果的 return 回调地址必须是 URL 格式")
private String returnUrl;
// ========== 订单相关字段 ==========
/**
* 支付金额,单位:分
*/
@NotNull(message = "支付金额不能为空")
@DecimalMin(value = "0", inclusive = false, message = "支付金额必须大于零")
private Integer price;
/**
* 支付过期时间
*/
@NotNull(message = "支付过期时间不能为空")
private LocalDateTime expireTime;
// ========== 拓展参数 ==========
/**
* 支付渠道的额外参数
*
* 例如说,微信公众号需要传递 openid 参数
*/
private Map<String, String> channelExtras;
/**
* 展示模式
*
* 如果不传递,则每个支付渠道使用默认的方式
*
* 枚举 {@link org.dromara.common.pay.core.enums.order.PayOrderDisplayModeEnum}
*/
private String displayMode;
}
package org.dromara.mall.api.dto.pay;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
/**
* 退款单创建 Request DTO
*
* @author 芋道源码
*/
@Data
@Accessors(chain = true)
public class PayRefundCreateReqDTO {
/**
* 应用标识
*/
@NotNull(message = "应用标识不能为空")
private String appKey;
/**
* 用户 IP
*/
@NotEmpty(message = "用户 IP 不能为空")
private String userIp;
// ========== 商户相关字段 ==========
/**
* 商户订单编号
*/
@NotEmpty(message = "商户订单编号不能为空")
private String merchantOrderId;
/**
* 商户退款编号
*/
@NotEmpty(message = "商户退款编号不能为空")
private String merchantRefundId;
/**
* 退款描述
*/
@NotEmpty(message = "退款描述不能为空")
@Length(max = 128, message = "退款描述长度不能超过 128")
private String reason;
// ========== 订单相关字段 ==========
/**
* 退款金额,单位:分
*/
@NotNull(message = "退款金额不能为空")
@Min(value = 1, message = "退款金额必须大于零")
private Integer price;
}
package org.dromara.mall.api.dto.pay;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 退款单的通知 Request DTO
*
* @author 芋道源码
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PayRefundNotifyReqDTO {
/**
* 商户退款单编号
*/
@NotEmpty(message = "商户退款单编号不能为空")
private String merchantOrderId;
/**
* 支付退款编号
*/
@NotNull(message = "支付退款编号不能为空")
private Long payRefundId;
}
package org.dromara.mall.api.dto.pay;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 退款单信息 Response DTO
*
* @author 芋道源码
*/
@Data
public class PayRefundRespDTO {
/**
* 退款单编号
*/
private Long id;
/**
* 渠道编码
*
* 枚举 PayChannelEnum
*/
private String channelCode;
// ========== 退款相关字段 ==========
/**
* 退款状态
*
* 枚举 {@link org.dromara.mall.enums.pay.refund.PayRefundStatusEnum}
*/
private Integer status;
/**
* 退款金额,单位:分
*/
private Integer refundPrice;
// ========== 商户相关字段 ==========
/**
* 商户订单编号
*/
private String merchantOrderId;
/**
* 退款成功时间
*/
private LocalDateTime successTime;
}
package org.dromara.mall.api.dto.pay;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
import org.dromara.common.mall.validation.InEnum;
import org.dromara.mall.enums.pay.transfer.PayTransferTypeEnum;
import java.util.Map;
/**
* 转账单创建 Request DTO
*
* @author jason
*/
@Data
@Accessors(chain = true)
public class PayTransferCreateReqDTO {
/**
* 应用标识
*/
@NotNull(message = "应用标识不能为空")
private String appKey;
@NotEmpty(message = "转账渠道不能为空")
private String channelCode;
/**
* 转账渠道的额外参数
*/
private Map<String, String> channelExtras;
@NotEmpty(message = "用户 IP 不能为空")
private String userIp;
/**
* 类型
*/
@NotNull(message = "转账类型不能为空")
@InEnum(PayTransferTypeEnum.class)
private Integer type;
/**
* 商户转账单编号
*/
@NotEmpty(message = "商户转账单编号能为空")
private String merchantTransferId;
/**
* 转账金额,单位:分
*/
@Min(value = 1, message = "转账金额必须大于零")
@NotNull(message = "转账金额不能为空")
private Integer price;
/**
* 转账标题
*/
@NotEmpty(message = "转账标题不能为空")
private String subject;
/**
* 收款人姓名
*/
@NotBlank(message = "收款人姓名不能为空", groups = {PayTransferTypeEnum.Alipay.class})
private String userName;
@NotBlank(message = "支付宝登录号不能为空", groups = {PayTransferTypeEnum.Alipay.class})
private String alipayLogonId;
// ========== 微信转账相关字段 ==========
@NotBlank(message = "微信 openId 不能为空", groups = {PayTransferTypeEnum.WxPay.class})
private String openid;
}
package org.dromara.mall.api.dto.pay;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 转账单的通知 Request DTO
*
* @author jason
*/
@Data
@Accessors(chain = true)
public class PayTransferNotifyReqDTO {
// TODO 芋艿:要不要改成 orderId 待定;
/**
* 商户转账单号
*/
@NotEmpty(message = "商户转账单号不能为空")
private String merchantTransferId;
/**
* 转账订单编号
*/
@NotNull(message = "转账订单编号不能为空")
private Long payTransferId;
}
package org.dromara.mall.api.dto.pay;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 钱包余额增加 Request DTO
*
* @author 芋道源码
*/
@Data
@Accessors(chain = true)
public class PayWalletAddBalanceReqDTO {
/**
* 用户编号
*
* 关联 MemberUserDO 的 id 属性,或者 AdminUserDO 的 id 属性
*/
@NotNull(message = "用户编号不能为空")
private Long userId;
/**
* 用户类型
*
* 关联 {@link org.dromara.common.mall.enums.UserTypeEnum}
*/
@NotNull(message = "用户类型不能为空")
private Integer userType;
/**
* 关联业务分类
*/
@NotNull(message = "关联业务分类不能为空")
private Integer bizType;
/**
* 关联业务编号
*/
@NotNull(message = "关联业务编号不能为空")
private String bizId;
/**
* 交易金额,单位分
*
* 正值表示余额增加,负值表示余额减少
*/
@NotNull(message = "交易金额不能为空")
private Integer price;
}
package org.dromara.mall.api.dto.product;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.util.List;
/**
* 评论创建请求 DTO
*
* @author HUIHUI
*/
@Data
public class ProductCommentCreateReqDTO {
/**
* 商品 SKU 编号
*/
@NotNull(message = "商品 SKU 编号不能为空")
private Long skuId;
/**
* 订单编号
*/
private Long orderId;
/**
* 交易订单项编号
*/
private Long orderItemId;
/**
* 描述星级 1-5 分
*/
@NotNull(message = "描述星级不能为空")
private Integer descriptionScores;
/**
* 服务星级 1-5 分
*/
@NotNull(message = "服务星级不能为空")
private Integer benefitScores;
/**
* 评论内容
*/
@NotNull(message = "评论内容不能为空")
private String content;
/**
* 评论图片地址数组,以逗号分隔最多上传 9 张
*/
private List<String> picUrls;
/**
* 是否匿名
*/
@NotNull(message = "是否匿名不能为空")
private Boolean anonymous;
/**
* 评价人
*/
@NotNull(message = "评价人不能为空")
private Long userId;
}
package org.dromara.mall.api.dto.product;
import lombok.Data;
/**
* 商品属性项的明细 Response DTO
*
* @author 芋道源码
*/
@Data
public class ProductPropertyValueDetailRespDTO {
/**
* 属性的编号
*/
private Long propertyId;
/**
* 属性的名称
*/
private String propertyName;
/**
* 属性值的编号
*/
private Long valueId;
/**
* 属性值的名称
*/
private String valueName;
}
package org.dromara.mall.api.dto.product;
import lombok.Data;
import java.util.List;
/**
* 商品 SKU 信息 Response DTO
*
* @author LeeYan9
* @since 2022-08-26
*/
@Data
public class ProductSkuRespDTO {
/**
* 商品 SKU 编号,自增
*/
private Long id;
/**
* SPU 编号
*/
private Long spuId;
/**
* 属性数组
*/
private List<ProductPropertyValueDetailRespDTO> properties;
/**
* 销售价格,单位:分
*/
private Integer price;
/**
* 市场价,单位:分
*/
private Integer marketPrice;
/**
* 成本价,单位:分
*/
private Integer costPrice;
/**
* SKU 的条形码
*/
private String barCode;
/**
* 图片地址
*/
private String picUrl;
/**
* 库存
*/
private Integer stock;
/**
* 商品重量,单位:kg 千克
*/
private Double weight;
/**
* 商品体积,单位:m^3 平米
*/
private Double volume;
/**
* 一级分销的佣金,单位:分
*/
private Integer firstBrokeragePrice;
/**
* 二级分销的佣金,单位:分
*/
private Integer secondBrokeragePrice;
}
package org.dromara.mall.api.dto.product;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.List;
/**
* 商品 SKU 更新库存 Request DTO
*
* @author LeeYan9
* @since 2022-08-26
*/
@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class ProductSkuUpdateStockReqDTO {
/**
* 商品 SKU
*/
@NotNull(message = "商品 SKU 不能为空")
private List<Item> items;
@Data
@Accessors(chain = true)
public static class Item {
/**
* 商品 SKU 编号
*/
@NotNull(message = "商品 SKU 编号不能为空")
private Long id;
/**
* 库存变化数量
*
* 正数:增加库存
* 负数:扣减库存
*/
@NotNull(message = "库存变化数量不能为空")
private Integer incrCount;
}
}
package org.dromara.mall.api.dto.product;
import lombok.Data;
import java.util.List;
/**
* 商品 SPU 信息 Response DTO
*
* @author LeeYan9
* @since 2022-08-26
*/
@Data
public class ProductSpuRespDTO {
/**
* 商品 SPU 编号,自增
*/
private Long id;
// ========== 基本信息 =========
/**
* 商品名称
*/
private String name;
/**
* 商品分类编号
*/
private Long categoryId;
/**
* 商品封面图
*/
private String picUrl;
/**
* 商品状态
* <p>
* 枚举 {@link org.dromara.mall.enums.product.spu.ProductSpuStatusEnum}
*/
private Integer status;
// ========== SKU 相关字段 =========
/**
* 规格类型
*
* false - 单规格
* true - 多规格
*/
private Boolean specType;
/**
* 商品价格,单位使用:分
*/
private Integer price;
/**
* 市场价,单位使用:分
*/
private Integer marketPrice;
/**
* 成本价,单位使用:分
*/
private Integer costPrice;
/**
* 库存
*/
private Integer stock;
// ========== 物流相关字段 =========
/**
* 配送方式数组
*
* 对应 DeliveryTypeEnum 枚举
*/
private List<Integer> deliveryTypes;
/**
* 物流配置模板编号
*
* 对应 TradeDeliveryExpressTemplateDO 的 id 编号
*/
private Long deliveryTemplateId;
// ========== 营销相关字段 =========
/**
* 赠送积分
*/
private Integer giveIntegral;
// ========== 分销相关字段 =========
/**
* 分销类型
*
* false - 默认
* true - 自行设置
*/
private Boolean subCommissionType;
}
package org.dromara.mall.api.dto.promotion;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 校验参与砍价 Response DTO
*/
@Data
@Accessors(chain = true)
public class BargainValidateJoinRespDTO {
/**
* 砍价活动编号
*/
private Long activityId;
/**
* 砍价活动名称
*/
private String name;
/**
* 砍价金额
*/
private Integer bargainPrice;
}
package org.dromara.mall.api.dto.promotion;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
* 拼团记录的创建 Request DTO
*
* @author HUIHUI
*/
@Data
public class CombinationRecordCreateReqDTO {
/**
* 拼团活动编号
*/
@NotNull(message = "拼团活动编号不能为空")
private Long activityId;
/**
* spu 编号
*/
@NotNull(message = "spu 编号不能为空")
private Long spuId;
/**
* sku 编号
*/
@NotNull(message = "sku 编号不能为空")
private Long skuId;
/**
* 购买的商品数量
*/
@NotNull(message = "购买数量不能为空")
private Integer count;
/**
* 订单编号
*/
@NotNull(message = "订单编号不能为空")
private Long orderId;
/**
* 用户编号
*/
@NotNull(message = "用户编号不能为空")
private Long userId;
/**
* 团长编号
*/
private Long headId;
/**
* 拼团商品单价
*/
@NotNull(message = "拼团商品单价不能为空")
private Integer combinationPrice;
}
package org.dromara.mall.api.dto.promotion;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 拼团记录的创建 Response DTO
*
* @author HUIHUI
*/
@Data
@Accessors(chain = true)
public class CombinationRecordCreateRespDTO {
/**
* 拼团活动编号
*
* 关联 CombinationActivityDO 的 id 字段
*/
private Long combinationActivityId;
/**
* 拼团团长编号
*
* 关联 CombinationRecordDO 的 headId 字段
*/
private Long combinationHeadId;
/**
* 拼团记录编号
*
* 关联 CombinationRecordDO 的 id 字段
*/
private Long combinationRecordId;
}
package org.dromara.mall.api.dto.promotion;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 拼团记录 Response DTO
*
* @author 芋道源码
*/
@Data
public class CombinationRecordRespDTO {
/**
* 编号,主键自增
*/
private Long id;
/**
* 拼团活动编号
*
* 关联 CombinationActivityDO 的 id 字段
*/
private Long activityId;
/**
* 拼团商品单价
*
* 冗余 CombinationProductDO 的 combinationPrice 字段
*/
private Integer combinationPrice;
/**
* SPU 编号
*/
private Long spuId;
/**
* 商品名字
*/
private String spuName;
/**
* 商品图片
*/
private String picUrl;
/**
* SKU 编号
*/
private Long skuId;
/**
* 购买的商品数量
*/
private Integer count;
/**
* 用户编号
*/
private Long userId;
/**
* 用户昵称
*/
private String nickname;
/**
* 用户头像
*/
private String avatar;
/**
* 团长编号
*/
private Long headId;
/**
* 开团状态
*
* 关联 {@link CombinationRecordStatusEnum}
*/
private Integer status;
/**
* 订单编号
*/
private Long orderId;
/**
* 开团需要人数
*
* 关联 CombinationActivityDO 的 userSize 字段
*/
private Integer userSize;
/**
* 已加入拼团人数
*/
private Integer userCount;
/**
* 是否虚拟成团
*/
private Boolean virtualGroup;
/**
* 过期时间
*/
private LocalDateTime expireTime;
/**
* 开始时间 (订单付款后开始的时间)
*/
private LocalDateTime startTime;
/**
* 结束时间(成团时间/失败时间)
*/
private LocalDateTime endTime;
}
package org.dromara.mall.api.dto.promotion;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 校验参与拼团 Response DTO
*
* @author HUIHUI
*/
@Data
@Accessors(chain = true)
public class CombinationValidateJoinRespDTO {
/**
* 砍价活动编号
*/
private Long activityId;
/**
* 砍价活动名称
*/
private String name;
/**
* 拼团金额
*/
private Integer combinationPrice;
}
package org.dromara.mall.api.dto.promotion;
import lombok.Data;
import org.dromara.mall.enums.promotion.common.PromotionDiscountTypeEnum;
import org.dromara.mall.enums.promotion.coupon.CouponStatusEnum;
import org.dromara.mall.enums.promotion.coupon.CouponTakeTypeEnum;
import java.time.LocalDateTime;
import java.util.List;
/**
* 优惠劵 Response DTO
*
* @author 芋道源码
*/
@Data
public class CouponRespDTO {
// ========== 基本信息 BEGIN ==========
/**
* 优惠劵编号
*/
private Long id;
/**
* 优惠劵模板编号
*/
private Integer templateId;
/**
* 优惠劵名
*/
private String name;
/**
* 优惠码状态
* <p>
* 枚举 {@link CouponStatusEnum}
*/
private Integer status;
// ========== 基本信息 END ==========
// ========== 领取情况 BEGIN ==========
/**
* 用户编号
* <p>
* 关联 MemberUserDO 的 id 字段
*/
private Long userId;
/**
* 领取类型
* <p>
* 枚举 {@link CouponTakeTypeEnum}
*/
private Integer takeType;
// ========== 领取情况 END ==========
// ========== 使用规则 BEGIN ==========
/**
* 是否设置满多少金额可用,单位:分
*/
private Integer usePrice;
/**
* 生效开始时间
*/
private LocalDateTime validStartTime;
/**
* 生效结束时间
*/
private LocalDateTime validEndTime;
/**
* 商品范围
*/
private Integer productScope;
/**
* 商品范围编号的数组
*/
private List<Long> productScopeValues;
// ========== 使用规则 END ==========
// ========== 使用效果 BEGIN ==========
/**
* 折扣类型
*/
private Integer discountType;
/**
* 折扣百分比
*/
private Integer discountPercent;
/**
* 优惠金额,单位:分
*/
private Integer discountPrice;
/**
* 折扣上限,仅在 {@link #discountType} 等于 {@link PromotionDiscountTypeEnum#PERCENT} 时生效
*/
private Integer discountLimitPrice;
// ========== 使用效果 END ==========
// ========== 使用情况 BEGIN ==========
/**
* 使用订单号
*/
private Long useOrderId;
/**
* 使用时间
*/
private LocalDateTime useTime;
// ========== 使用情况 END ==========
}
package org.dromara.mall.api.dto.promotion;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 优惠劵使用 Request DTO
*
* @author 芋道源码
*/
@Data
@Accessors(chain = true)
public class CouponUseReqDTO {
/**
* 优惠劵编号
*/
@NotNull(message = "优惠劵编号不能为空")
private Long id;
/**
* 用户编号
*/
@NotNull(message = "用户编号不能为空")
private Long userId;
/**
* 订单编号
*/
@NotNull(message = "订单编号不能为空")
private Long orderId;
}
package org.dromara.mall.api.dto.promotion;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 限时折扣活动商品 Response DTO
*
* @author 芋道源码
*/
@Data
public class DiscountProductRespDTO {
/**
* 编号,主键自增
*/
private Long id;
/**
* 商品 SPU 编号
*/
private Long spuId;
/**
* 商品 SKU 编号
*/
private Long skuId;
/**
* 折扣类型
*/
private Integer discountType;
/**
* 折扣百分比
*/
private Integer discountPercent;
/**
* 优惠金额,单位:分
*/
private Integer discountPrice;
// ========== 活动字段 ==========
/**
* 限时折扣活动的编号
*/
private Long activityId;
/**
* 活动标题
*/
private String activityName;
/**
* 活动开始时间点
*/
private LocalDateTime activityStartTime;
/**
* 活动结束时间点
*/
private LocalDateTime activityEndTime;
}
package org.dromara.mall.api.dto.promotion;
import lombok.Data;
/**
* 校验参与积分商城 Response DTO
*/
@Data
public class PointValidateJoinRespDTO {
/**
* 可兑换次数
*/
private Integer count;
/**
* 所需兑换积分
*/
private Integer point;
/**
* 所需兑换金额,单位:分
*/
private Integer price;
}
package org.dromara.mall.api.dto.promotion;
import lombok.Data;
import lombok.experimental.Accessors;
import org.dromara.common.mall.enums.CommonStatusEnum;
import org.dromara.mall.enums.promotion.common.PromotionConditionTypeEnum;
import org.dromara.mall.enums.promotion.common.PromotionProductScopeEnum;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* 满减送活动的匹配 Response DTO
*
* @author 芋道源码
*/
@Data
public class RewardActivityMatchRespDTO {
/**
* 匹配的 SPU 数组
*/
private List<Long> spuIds;
/**
* 活动编号,主键自增
*/
private Long id;
/**
* 活动标题
*/
private String name;
/**
* 状态
*
* 枚举 {@link CommonStatusEnum}
*/
private Integer status;
/**
* 开始时间
*/
private LocalDateTime startTime;
/**
* 结束时间
*/
private LocalDateTime endTime;
/**
* 备注
*/
private String remark;
/**
* 条件类型
*
* 枚举 {@link PromotionConditionTypeEnum}
*/
private Integer conditionType;
/**
* 商品范围
*
* 枚举 {@link PromotionProductScopeEnum}
*/
private Integer productScope;
/**
* 商品 SPU 编号的数组
*/
private List<Long> productScopeValues;
/**
* 优惠规则的数组
*/
private List<Rule> rules;
/**
* 优惠规则
*/
@Data
@Accessors(chain = true)
public static class Rule implements Serializable {
/**
* 优惠门槛
*
* 1. 满 N 元,单位:分
* 2. 满 N 件
*/
private Integer limit;
/**
* 优惠价格,单位:分
*/
private Integer discountPrice;
/**
* 是否包邮
*/
private Boolean freeDelivery;
/**
* 赠送的积分
*/
private Integer point;
/**
* 赠送的优惠劵
*
* key: 优惠劵模版编号
* value:对应的优惠券数量
*
* 目的:用于订单支付后赠送优惠券
*/
private Map<Long, Integer> giveCouponTemplateCounts;
/**
* 规则描述
*
* 通过 {@link #limit}、{@link #discountPrice} 等字段进行拼接
*/
private String description;
}
}
package org.dromara.mall.api.dto.promotion;
import lombok.Data;
/**
* 校验参与秒杀 Response DTO
*/
@Data
public class SeckillValidateJoinRespDTO {
/**
* 秒杀活动名称
*/
private String name;
/**
* 总限购数量
*
* 目的:目前只有 trade 有具体下单的数据,需要交给 trade 价格计算使用
*/
private Integer totalLimitCount;
/**
* 秒杀金额
*/
private Integer seckillPrice;
}
package org.dromara.mall.api.dto.system;
import lombok.Data;
import java.util.Set;
/**
* Admin 用户 Response DTO
*
* @author 芋道源码
*/
@Data
public class AdminUserRespDTO {
/**
* 用户ID
*/
private Long id;
/**
* 用户昵称
*/
private String nickname;
/**
* 帐号状态
*
* 枚举 {@link CommonStatusEnum}
*/
private Integer status;
/**
* 部门ID
*/
private Long deptId;
/**
* 岗位编号数组
*/
private Set<Long> postIds;
/**
* 手机号码
*/
private String mobile;
/**
* 用户头像
*/
private String avatar;
}
package org.dromara.mall.api.dto.system;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Map;
/**
* 站内信发送给 Admin 或者 Member 用户
*
* @author xrcoder
*/
@Data
@Accessors(chain = true)
public class NotifySendSingleToUserReqDTO {
/**
* 用户编号
*/
@NotNull(message = "用户编号不能为空")
private Long userId;
/**
* 站内信模板编号
*/
@NotEmpty(message = "站内信模板编号不能为空")
private String templateCode;
/**
* 站内信模板参数
*/
private Map<String, Object> templateParams;
}
package org.dromara.mall.api.dto.system;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.dromara.common.mall.enums.CommonStatusEnum;
import org.dromara.common.mall.validation.InEnum;
@Data
public class NotifyTemplateReqDTO {
@NotEmpty(message = "模版名称不能为空")
private String name;
@NotNull(message = "模版编码不能为空")
private String code;
@NotNull(message = "模版类型不能为空")
private Integer type;
@NotEmpty(message = "发送人名称不能为空")
private String nickname;
@NotEmpty(message = "模版内容不能为空")
private String content;
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "状态必须是 {value}")
private Integer status;
private String remark;
}
package org.dromara.mall.api.dto.system;
import lombok.Data;
/**
* 微信公众号 JSAPI 签名 Response DTO
*
* @author 芋道源码
*/
@Data
public class SocialWxJsapiSignatureRespDTO {
/**
* 微信公众号的 appId
*/
private String appId;
/**
* 匿名串
*/
private String nonceStr;
/**
* 时间戳
*/
private Long timestamp;
/**
* URL
*/
private String url;
/**
* 签名
*/
private String signature;
}
package org.dromara.mall.api.dto.trade;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 订单信息 Response DTO
*
* @author HUIHUI
*/
@Data
public class TradeOrderRespDTO {
// ========== 订单基本信息 ==========
/**
* 订单编号,主键自增
*/
private Long id;
/**
* 订单流水号
*
* 例如说,1146347329394184195
*/
private String no;
/**
* 订单类型
*
* 枚举 {@link TradeOrderTypeEnum}
*/
private Integer type;
/**
* 订单来源
*
* 枚举 {@link TerminalEnum}
*/
private Integer terminal;
/**
* 用户编号
*/
private Long userId;
/**
* 用户 IP
*/
private String userIp;
/**
* 用户备注
*/
private String userRemark;
/**
* 订单状态
*
* 枚举 {@link TradeOrderStatusEnum}
*/
private Integer status;
/**
* 购买的商品数量
*/
private Integer productCount;
/**
* 订单完成时间
*/
private LocalDateTime finishTime;
/**
* 订单取消时间
*/
private LocalDateTime cancelTime;
/**
* 取消类型
*
* 枚举 {@link TradeOrderCancelTypeEnum}
*/
private Integer cancelType;
/**
* 商家备注
*/
private String remark;
/**
* 是否评价
*/
private Boolean commentStatus;
// ========== 价格 + 支付基本信息 ==========
/**
* 支付订单编号
*/
private Long payOrderId;
/**
* 是否已支付
*/
private Boolean payStatus;
}
package org.dromara.mall.api.message.user;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 会员用户创建消息
*
* @author owen
*/
@Data
@Accessors(chain = true)
public class MemberUserCreateMessage {
/**
* 用户编号
*/
@NotNull(message = "用户编号不能为空")
private Long userId;
}
package org.dromara.mall.api.service.infra;
import org.dromara.common.core.utils.json.JsonUtils;
/**
* WebSocket 发送器的 API 接口
*
* 对 WebSocketMessageSender 进行封装,提供给其它模块使用
*
* @author 芋道源码
*/
public interface WebSocketSenderApi {
/**
* 发送消息给指定用户
*
* @param userType 用户类型
* @param userId 用户编号
* @param messageType 消息类型
* @param messageContent 消息内容,JSON 格式
*/
void send(Integer userType, Long userId, String messageType, String messageContent);
/**
* 发送消息给指定用户类型
*
* @param userType 用户类型
* @param messageType 消息类型
* @param messageContent 消息内容,JSON 格式
*/
void send(Integer userType, String messageType, String messageContent);
/**
* 发送消息给指定 Session
*
* @param sessionId Session 编号
* @param messageType 消息类型
* @param messageContent 消息内容,JSON 格式
*/
void send(String sessionId, String messageType, String messageContent);
default void sendObject(Integer userType, Long userId, String messageType, Object messageContent) {
send(userType, userId, messageType, JsonUtils.toJsonString(messageContent));
}
default void sendObject(Integer userType, String messageType, Object messageContent) {
send(userType, messageType, JsonUtils.toJsonString(messageContent));
}
default void sendObject(String sessionId, String messageType, Object messageContent) {
send(sessionId, messageType, JsonUtils.toJsonString(messageContent));
}
}
package org.dromara.mall.api.service.infra.impl;
import org.dromara.common.websocket.dto.WebSocketMessageDto;
import org.dromara.common.websocket.utils.WebSocketUtils;
import org.dromara.mall.api.service.infra.WebSocketSenderApi;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* WebSocket 发送器的 API 实现类
*
* @author 芋道源码
*/
@Component
public class WebSocketSenderApiImpl implements WebSocketSenderApi {
@Override
public void send(Integer userType, Long userId, String messageType, String messageContent) {
WebSocketMessageDto dto = new WebSocketMessageDto();
dto.setSessionKeys(List.of(userId));
dto.setMessage(messageContent);
WebSocketUtils.publishMessage(dto);
}
@Override
public void send(Integer userType, String messageType, String messageContent) {
WebSocketMessageDto dto = new WebSocketMessageDto();
//TODO WHO根据用户类型查询用户id集合
dto.setSessionKeys(List.of(userType.longValue()));
dto.setMessage(messageContent);
WebSocketUtils.publishMessage(dto);
}
@Override
public void send(String sessionId, String messageType, String messageContent) {
WebSocketMessageDto dto = new WebSocketMessageDto();
dto.setSessionKeys(List.of(Long.valueOf(sessionId)));
dto.setMessage(messageContent);
WebSocketUtils.publishMessage(dto);
}
}
package org.dromara.mall.api.service.member;
import org.dromara.mall.api.dto.member.MemberAddressRespDTO;
/**
* 用户收件地址 API 接口
*
* @author 芋道源码
*/
public interface MemberAddressApi {
/**
* 获得用户收件地址
*
* @param id 收件地址编号
* @param userId 用户编号
* @return 用户收件地址
*/
MemberAddressRespDTO getAddress(Long id, Long userId);
/**
* 获得用户默认收件地址
*
* @param userId 用户编号
* @return 用户收件地址
*/
MemberAddressRespDTO getDefaultAddress(Long userId);
}
package org.dromara.mall.api.service.member;
import org.dromara.mall.api.dto.member.MemberConfigRespDTO;
/**
* 用户配置 API 接口
*
* @author owen
*/
public interface MemberConfigApi {
/**
* 获得积分配置
*
* @return 积分配置
*/
MemberConfigRespDTO getConfig();
}
package org.dromara.mall.api.service.member;
import org.dromara.mall.api.dto.member.MemberLevelRespDTO;
/**
* 会员等级 API 接口
*
* @author owen
*/
public interface MemberLevelApi {
/**
* 获得会员等级
*
* @param id 会员等级编号
* @return 会员等级
*/
MemberLevelRespDTO getMemberLevel(Long id);
/**
* 增加会员经验
*
* @param userId 会员ID
* @param experience 经验
* @param bizType 业务类型 {@link org.dromara.mall.enums.member.experience.MemberExperienceBizTypeEnum}
* @param bizId 业务编号
*/
void addExperience(Long userId, Integer experience, Integer bizType, String bizId);
/**
* 扣减会员经验
*
* @param userId 会员ID
* @param experience 经验
* @param bizType 业务类型 {@link MemberExperienceBizTypeEnum}
* @param bizId 业务编号
*/
void reduceExperience(Long userId, Integer experience, Integer bizType, String bizId);
}
package org.dromara.mall.api.service.member;
import jakarta.validation.constraints.Min;
/**
* 用户积分的 API 接口
*
* @author owen
*/
public interface MemberPointApi {
/**
* 增加用户积分
*
* @param userId 用户编号
* @param point 积分
* @param bizType 业务类型 {@link org.dromara.mall.enums.member.point.MemberPointBizTypeEnum}
* @param bizId 业务编号
*/
void addPoint(Long userId, @Min(value = 1L, message = "积分必须是正数") Integer point,
Integer bizType, String bizId);
/**
* 减少用户积分
*
* @param userId 用户编号
* @param point 积分
* @param bizType 业务类型 {@link org.dromara.mall.enums.member.point.MemberPointBizTypeEnum}
* @param bizId 业务编号
*/
void reducePoint(Long userId, @Min(value = 1L, message = "积分必须是正数") Integer point,
Integer bizType, String bizId);
}
package org.dromara.mall.api.service.member;
import org.dromara.mall.api.dto.member.MemberUserRespDTO;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import static org.dromara.common.mall.util.collection.CollectionUtils.convertMap;
/**
* 会员用户的 API 接口
*
* @author 芋道源码
*/
public interface MemberUserApi {
/**
* 获得会员用户信息
*
* @param id 用户编号
* @return 用户信息
*/
MemberUserRespDTO getUser(Long id);
/**
* 获得会员用户信息们
*
* @param ids 用户编号的数组
* @return 用户信息们
*/
List<MemberUserRespDTO> getUserList(Collection<Long> ids);
/**
* 获得会员用户 Map
*
* @param ids 用户编号的数组
* @return 会员用户 Map
*/
default Map<Long, MemberUserRespDTO> getUserMap(Collection<Long> ids) {
List<MemberUserRespDTO> list = getUserList(ids);
return convertMap(list, MemberUserRespDTO::getId);
}
/**
* 基于用户昵称,模糊匹配用户列表
*
* @param nickname 用户昵称,模糊匹配
* @return 用户信息的列表
*/
List<MemberUserRespDTO> getUserListByNickname(String nickname);
/**
* 基于手机号,精准匹配用户
*
* @param mobile 手机号
* @return 用户信息
*/
MemberUserRespDTO getUserByMobile(String mobile);
/**
* 校验用户是否存在
*
* @param id 用户编号
*/
void validateUser(Long id);
}
package org.dromara.mall.api.service.member.impl;
import jakarta.annotation.Resource;
import org.dromara.mall.api.dto.member.MemberAddressRespDTO;
import org.dromara.mall.api.service.member.MemberAddressApi;
import org.dromara.mall.convert.member.AddressConvert;
import org.dromara.mall.service.member.AddressService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 用户收件地址 API 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class MemberAddressApiImpl implements MemberAddressApi {
@Resource
private AddressService addressService;
@Override
public MemberAddressRespDTO getAddress(Long id, Long userId) {
return AddressConvert.INSTANCE.convert02(addressService.getAddress(userId, id));
}
@Override
public MemberAddressRespDTO getDefaultAddress(Long userId) {
return AddressConvert.INSTANCE.convert02(addressService.getDefaultUserAddress(userId));
}
}
package org.dromara.mall.api.service.member.impl;
import jakarta.annotation.Resource;
import org.dromara.mall.api.dto.member.MemberConfigRespDTO;
import org.dromara.mall.api.service.member.MemberConfigApi;
import org.dromara.mall.convert.member.MemberConfigConvert;
import org.dromara.mall.service.member.MemberConfigService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 用户配置 API 实现类
*
* @author owen
*/
@Service
@Validated
public class MemberConfigApiImpl implements MemberConfigApi {
@Resource
private MemberConfigService memberConfigService;
@Override
public MemberConfigRespDTO getConfig() {
return MemberConfigConvert.INSTANCE.convert01(memberConfigService.getConfig());
}
}
package org.dromara.mall.api.service.member.impl;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.dromara.mall.api.dto.member.MemberLevelRespDTO;
import org.dromara.mall.api.service.member.MemberLevelApi;
import org.dromara.mall.convert.member.MemberLevelConvert;
import org.dromara.mall.enums.member.experience.MemberExperienceBizTypeEnum;
import org.dromara.mall.service.member.MemberLevelService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
;import static org.dromara.common.mall.exception.util.ServiceExceptionUtil.exception;
import static org.dromara.mall.enums.member.ErrorCodeConstants.EXPERIENCE_BIZ_NOT_SUPPORT;
/**
* 会员等级 API 实现类
*
* @author owen
*/
@Slf4j
@Service
@Validated
public class MemberLevelApiImpl implements MemberLevelApi {
@Resource
private MemberLevelService memberLevelService;
@Override
public MemberLevelRespDTO getMemberLevel(Long id) {
return MemberLevelConvert.INSTANCE.convert02(memberLevelService.getLevel(id));
}
@Override
public void addExperience(Long userId, Integer experience, Integer bizType, String bizId) {
MemberExperienceBizTypeEnum bizTypeEnum = MemberExperienceBizTypeEnum.getByType(bizType);
if (bizTypeEnum == null) {
throw exception(EXPERIENCE_BIZ_NOT_SUPPORT);
}
memberLevelService.addExperience(userId, experience, bizTypeEnum, bizId);
}
@Override
public void reduceExperience(Long userId, Integer experience, Integer bizType, String bizId) {
addExperience(userId, -experience, bizType, bizId);
}
}
package org.dromara.mall.api.service.member.impl;
import cn.hutool.core.lang.Assert;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.dromara.mall.api.service.member.MemberPointApi;
import org.dromara.mall.enums.member.point.MemberPointBizTypeEnum;
import org.dromara.mall.service.member.MemberPointRecordService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import static org.dromara.common.mall.exception.util.ServiceExceptionUtil.exception;
import static org.dromara.mall.enums.member.ErrorCodeConstants.POINT_RECORD_BIZ_NOT_SUPPORT;
/**
* 用户积分的 API 实现类
*
* @author owen
*/
@Slf4j
@Service
@Validated
public class MemberPointApiImpl implements MemberPointApi {
@Resource
private MemberPointRecordService memberPointRecordService;
@Override
public void addPoint(Long userId, Integer point, Integer bizType, String bizId) {
Assert.isTrue(point > 0);
MemberPointBizTypeEnum bizTypeEnum = MemberPointBizTypeEnum.getByType(bizType);
if (bizTypeEnum == null) {
log.error("[addPoint][userId({}) point({}) bizType({}) bizId({}) {}]", userId, point, bizType, bizId,
POINT_RECORD_BIZ_NOT_SUPPORT);
return;
}
memberPointRecordService.createPointRecord(userId, point, bizTypeEnum, bizId);
}
@Override
public void reducePoint(Long userId, Integer point, Integer bizType, String bizId) {
Assert.isTrue(point > 0);
MemberPointBizTypeEnum bizTypeEnum = MemberPointBizTypeEnum.getByType(bizType);
if (bizTypeEnum == null) {
throw exception(POINT_RECORD_BIZ_NOT_SUPPORT);
}
memberPointRecordService.createPointRecord(userId, -point, bizTypeEnum, bizId);
}
}
package org.dromara.mall.api.service.member.impl;
import jakarta.annotation.Resource;
import org.dromara.mall.api.service.member.MemberUserApi;
import org.dromara.mall.convert.member.MemberUserConvert;
import org.dromara.mall.api.dto.member.MemberUserRespDTO;
import org.dromara.mall.domain.member.MemberUserDO;
import org.dromara.mall.service.member.MemberUserService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.Collection;
import java.util.List;
import static org.dromara.common.mall.exception.util.ServiceExceptionUtil.exception;
import static org.dromara.mall.enums.member.ErrorCodeConstants.USER_MOBILE_NOT_EXISTS;
/**
* 会员用户的 API 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class MemberUserApiImpl implements MemberUserApi {
@Resource
private MemberUserService userService;
@Override
public MemberUserRespDTO getUser(Long id) {
MemberUserDO user = userService.getUser(id);
return MemberUserConvert.INSTANCE.convert2(user);
}
@Override
public List<MemberUserRespDTO> getUserList(Collection<Long> ids) {
return MemberUserConvert.INSTANCE.convertList2(userService.getUserList(ids));
}
@Override
public List<MemberUserRespDTO> getUserListByNickname(String nickname) {
return MemberUserConvert.INSTANCE.convertList2(userService.getUserListByNickname(nickname));
}
@Override
public MemberUserRespDTO getUserByMobile(String mobile) {
return MemberUserConvert.INSTANCE.convert2(userService.getUserByMobile(mobile));
}
@Override
public void validateUser(Long id) {
MemberUserDO user = userService.getUser(id);
if (user == null) {
throw exception(USER_MOBILE_NOT_EXISTS);
}
}
}
package org.dromara.mall.api.service.pay;
import jakarta.validation.Valid;
import org.dromara.mall.api.dto.pay.PayOrderCreateReqDTO;
import org.dromara.mall.api.dto.pay.PayOrderRespDTO;
/**
* 支付单 API 接口
*
* @author LeeYan9
* @since 2022-08-26
*/
public interface PayOrderApi {
/**
* 创建支付单
*
* @param reqDTO 创建请求
* @return 支付单编号
*/
Long createOrder(@Valid PayOrderCreateReqDTO reqDTO);
/**
* 获得支付单
*
* @param id 支付单编号
* @return 支付单
*/
PayOrderRespDTO getOrder(Long id);
/**
* 更新支付订单价格
*
* @param id 支付单编号
* @param payPrice 支付单价格
*/
void updatePayOrderPrice(Long id, Integer payPrice);
}
package org.dromara.mall.api.service.pay;
import jakarta.validation.Valid;
import org.dromara.mall.api.dto.pay.PayRefundCreateReqDTO;
import org.dromara.mall.api.dto.pay.PayRefundRespDTO;
/**
* 退款单 API 接口
*
* @author 芋道源码
*/
public interface PayRefundApi {
/**
* 创建退款单
*
* @param reqDTO 创建请求
* @return 退款单编号
*/
Long createRefund(@Valid PayRefundCreateReqDTO reqDTO);
/**
* 获得退款单
*
* @param id 退款单编号
* @return 退款单
*/
PayRefundRespDTO getRefund(Long id);
}
package org.dromara.mall.api.service.pay;
import jakarta.validation.Valid;
import org.dromara.common.pay.core.client.dto.transfer.PayTransferRespDTO;
import org.dromara.mall.api.dto.pay.PayTransferCreateReqDTO;
/**
* 转账单 API 接口
*
* @author jason
*/
public interface PayTransferApi {
/**
* 创建转账单
*
* @param reqDTO 创建请求
* @return 转账单编号
*/
Long createTransfer(@Valid PayTransferCreateReqDTO reqDTO);
/**
* 获得转账单
*
* @param id 转账单编号
* @return 转账单
*/
PayTransferRespDTO getTransfer(Long id);
}
package org.dromara.mall.api.service.pay;
import org.dromara.mall.api.dto.pay.PayWalletAddBalanceReqDTO;
/**
* 钱包 API 接口
*
* @author liurulin
*/
public interface PayWalletApi {
/**
* 添加钱包余额
*
* @param reqDTO 增加余额请求
*/
void addWalletBalance(PayWalletAddBalanceReqDTO reqDTO);
}
package org.dromara.mall.api.service.pay.impl;
import jakarta.annotation.Resource;
import org.dromara.mall.api.dto.pay.PayOrderCreateReqDTO;
import org.dromara.mall.api.dto.pay.PayOrderRespDTO;
import org.dromara.mall.api.service.pay.PayOrderApi;
import org.dromara.mall.convert.pay.PayOrderConvert;
import org.dromara.mall.domain.pay.PayOrderDO;
import org.dromara.mall.service.pay.PayOrderService;
import org.springframework.stereotype.Service;
/**
* 支付单 API 实现类
*
* @author 芋道源码
*/
@Service
public class PayOrderApiImpl implements PayOrderApi {
@Resource
private PayOrderService payOrderService;
@Override
public Long createOrder(PayOrderCreateReqDTO reqDTO) {
return payOrderService.createOrder(reqDTO);
}
@Override
public PayOrderRespDTO getOrder(Long id) {
PayOrderDO order = payOrderService.getOrder(id);
return PayOrderConvert.INSTANCE.convert2(order);
}
@Override
public void updatePayOrderPrice(Long id, Integer payPrice) {
payOrderService.updatePayOrderPrice(id, payPrice);
}
}
package org.dromara.mall.api.service.pay.impl;
import jakarta.annotation.Resource;
import org.dromara.mall.api.dto.pay.PayRefundCreateReqDTO;
import org.dromara.mall.api.dto.pay.PayRefundRespDTO;
import org.dromara.mall.api.service.pay.PayRefundApi;
import org.dromara.mall.convert.pay.PayRefundConvert;
import org.dromara.mall.service.pay.PayRefundService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 退款单 API 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class PayRefundApiImpl implements PayRefundApi {
@Resource
private PayRefundService payRefundService;
@Override
public Long createRefund(PayRefundCreateReqDTO reqDTO) {
return payRefundService.createPayRefund(reqDTO);
}
@Override
public PayRefundRespDTO getRefund(Long id) {
return PayRefundConvert.INSTANCE.convert02(payRefundService.getRefund(id));
}
}
package org.dromara.mall.api.service.pay.impl;
import jakarta.annotation.Resource;
import org.dromara.common.mybatis.util.BeanUtils;
import org.dromara.common.pay.core.client.dto.transfer.PayTransferRespDTO;
import org.dromara.mall.api.dto.pay.PayTransferCreateReqDTO;
import org.dromara.mall.api.service.pay.PayTransferApi;
import org.dromara.mall.domain.pay.PayTransferDO;
import org.dromara.mall.service.pay.PayTransferService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 转账单 API 实现类
*
* @author jason
*/
@Service
@Validated
public class PayTransferApiImpl implements PayTransferApi {
@Resource
private PayTransferService payTransferService;
@Override
public Long createTransfer(PayTransferCreateReqDTO reqDTO) {
return payTransferService.createTransfer(reqDTO);
}
@Override
public PayTransferRespDTO getTransfer(Long id) {
PayTransferDO transfer = payTransferService.getTransfer(id);
return BeanUtils.toBean(transfer, PayTransferRespDTO.class);
}
}
package org.dromara.mall.api.service.pay.impl;
import cn.hutool.core.lang.Assert;
import jakarta.annotation.Resource;
import org.dromara.mall.api.dto.pay.PayWalletAddBalanceReqDTO;
import org.dromara.mall.api.service.pay.PayWalletApi;
import org.dromara.mall.domain.pay.PayWalletDO;
import org.dromara.mall.enums.pay.wallet.PayWalletBizTypeEnum;
import org.dromara.mall.service.pay.PayWalletService;
import org.springframework.stereotype.Service;
/**
* 钱包 API 实现类
*
* @author 芋道源码
*/
@Service
public class PayWalletApiImpl implements PayWalletApi {
@Resource
private PayWalletService payWalletService;
@Override
public void addWalletBalance(PayWalletAddBalanceReqDTO reqDTO) {
// 创建或获取钱包
PayWalletDO wallet = payWalletService.getOrCreateWallet(reqDTO.getUserId(), reqDTO.getUserType());
Assert.notNull(wallet, "钱包({}/{})不存在", reqDTO.getUserId(), reqDTO.getUserType());
// 增加余额
PayWalletBizTypeEnum bizType = PayWalletBizTypeEnum.valueOf(reqDTO.getBizType());
payWalletService.addWalletBalance(wallet.getId(), reqDTO.getBizId(), bizType, reqDTO.getPrice());
}
}
package org.dromara.mall.api.service.product;
import java.util.Collection;
/**
* 商品分类 API 接口
*
* @author owen
*/
public interface ProductCategoryApi {
/**
* 校验商品分类是否有效。如下情况,视为无效:
* 1. 商品分类编号不存在
* 2. 商品分类被禁用
*
* @param ids 商品分类编号数组
*/
void validateCategoryList(Collection<Long> ids);
}
package org.dromara.mall.api.service.product;
import org.dromara.mall.api.dto.product.ProductCommentCreateReqDTO;
/**
* 产品评论 API 接口
*
* @author HUIHUI
*/
public interface ProductCommentApi {
/**
* 创建评论
*
* @param createReqDTO 评论参数
* @return 返回评论创建后的 id
*/
Long createComment(ProductCommentCreateReqDTO createReqDTO);
}
package org.dromara.mall.api.service.product;
import org.dromara.mall.api.dto.product.ProductSkuRespDTO;
import org.dromara.mall.api.dto.product.ProductSkuUpdateStockReqDTO;
import java.util.Collection;
import java.util.List;
/**
* 商品 SKU API 接口
*
* @author LeeYan9
* @since 2022-08-26
*/
public interface ProductSkuApi {
/**
* 查询 SKU 信息
*
* @param id SKU 编号
* @return SKU 信息
*/
ProductSkuRespDTO getSku(Long id);
/**
* 批量查询 SKU 数组
*
* @param ids SKU 编号列表
* @return SKU 数组
*/
List<ProductSkuRespDTO> getSkuList(Collection<Long> ids);
/**
* 批量查询 SKU 数组
*
* @param spuIds SPU 编号列表
* @return SKU 数组
*/
List<ProductSkuRespDTO> getSkuListBySpuId(Collection<Long> spuIds);
/**
* 更新 SKU 库存(增加 or 减少)
*
* @param updateStockReqDTO 更新请求
*/
void updateSkuStock(ProductSkuUpdateStockReqDTO updateStockReqDTO);
}
package org.dromara.mall.api.service.product;
import org.dromara.mall.api.dto.product.ProductSpuRespDTO;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import static org.dromara.common.mall.util.collection.CollectionUtils.convertMap;
/**
* 商品 SPU API 接口
*
* @author LeeYan9
* @since 2022-08-26
*/
public interface ProductSpuApi {
/**
* 批量查询 SPU 数组
*
* @param ids SPU 编号列表
* @return SPU 数组
*/
List<ProductSpuRespDTO> getSpuList(Collection<Long> ids);
/**
* 批量查询 SPU MAP
*
* @param ids SPU 编号列表
* @return SPU MAP
*/
default Map<Long, ProductSpuRespDTO> getSpusMap(Collection<Long> ids) {
return convertMap(getSpuList(ids), ProductSpuRespDTO::getId);
}
/**
* 批量查询 SPU 数组,并且校验是否 SPU 是否有效。
*
* 如下情况,视为无效:
* 1. 商品编号不存在
* 2. 商品被禁用
*
* @param ids SPU 编号列表
* @return SPU 数组
*/
List<ProductSpuRespDTO> validateSpuList(Collection<Long> ids);
/**
* 获得 SPU
*
* @return SPU
*/
ProductSpuRespDTO getSpu(Long id);
}
package org.dromara.mall.api.service.product.impl;
import jakarta.annotation.Resource;
import org.dromara.mall.api.service.product.ProductCategoryApi;
import org.dromara.mall.service.product.ProductCategoryService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.Collection;
/**
* 商品分类 API 接口实现类
*
* @author owen
*/
@Service
@Validated
public class ProductCategoryApiImpl implements ProductCategoryApi {
@Resource
private ProductCategoryService productCategoryService;
@Override
public void validateCategoryList(Collection<Long> ids) {
productCategoryService.validateCategoryList(ids);
}
}
package org.dromara.mall.api.service.product.impl;
import jakarta.annotation.Resource;
import org.dromara.mall.api.dto.product.ProductCommentCreateReqDTO;
import org.dromara.mall.api.service.product.ProductCommentApi;
import org.dromara.mall.service.product.ProductCommentService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 商品评论 API 实现类
*
* @author HUIHUI
*/
@Service
@Validated
public class ProductCommentApiImpl implements ProductCommentApi {
@Resource
private ProductCommentService productCommentService;
@Override
public Long createComment(ProductCommentCreateReqDTO createReqDTO) {
return productCommentService.createComment(createReqDTO);
}
}
package org.dromara.mall.api.service.product.impl;
import jakarta.annotation.Resource;
import org.dromara.common.mybatis.util.BeanUtils;
import org.dromara.mall.api.dto.product.ProductSkuRespDTO;
import org.dromara.mall.api.dto.product.ProductSkuUpdateStockReqDTO;
import org.dromara.mall.api.service.product.ProductSkuApi;
import org.dromara.mall.domain.product.ProductSkuDO;
import org.dromara.mall.service.product.ProductSkuService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.Collection;
import java.util.List;
/**
* 商品 SKU API 实现类
*
* @author LeeYan9
* @since 2022-09-06
*/
@Service
@Validated
public class ProductSkuApiImpl implements ProductSkuApi {
@Resource
private ProductSkuService productSkuService;
@Override
public ProductSkuRespDTO getSku(Long id) {
ProductSkuDO sku = productSkuService.getSku(id);
return BeanUtils.toBean(sku, ProductSkuRespDTO.class);
}
@Override
public List<ProductSkuRespDTO> getSkuList(Collection<Long> ids) {
List<ProductSkuDO> skus = productSkuService.getSkuList(ids);
return BeanUtils.toBean(skus, ProductSkuRespDTO.class);
}
@Override
public List<ProductSkuRespDTO> getSkuListBySpuId(Collection<Long> spuIds) {
List<ProductSkuDO> skus = productSkuService.getSkuListBySpuId(spuIds);
return BeanUtils.toBean(skus, ProductSkuRespDTO.class);
}
@Override
public void updateSkuStock(ProductSkuUpdateStockReqDTO updateStockReqDTO) {
productSkuService.updateSkuStock(updateStockReqDTO);
}
}
package org.dromara.mall.api.service.product.impl;
import jakarta.annotation.Resource;
import org.dromara.common.mall.util.object.BeanUtils;
import org.dromara.mall.api.dto.product.ProductSpuRespDTO;
import org.dromara.mall.api.service.product.ProductSpuApi;
import org.dromara.mall.domain.product.ProductSpuDO;
import org.dromara.mall.service.product.ProductSpuService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.Collection;
import java.util.List;
/**
* 商品 SPU API 接口实现类
*
* @author LeeYan9
* @since 2022-09-06
*/
@Service
@Validated
public class ProductSpuApiImpl implements ProductSpuApi {
@Resource
private ProductSpuService spuService;
@Override
public List<ProductSpuRespDTO> getSpuList(Collection<Long> ids) {
List<ProductSpuDO> spus = spuService.getSpuList(ids);
return BeanUtils.toBean(spus, ProductSpuRespDTO.class);
}
@Override
public List<ProductSpuRespDTO> validateSpuList(Collection<Long> ids) {
List<ProductSpuDO> spus = spuService.validateSpuList(ids);
return BeanUtils.toBean(spus, ProductSpuRespDTO.class);
}
@Override
public ProductSpuRespDTO getSpu(Long id) {
ProductSpuDO spu = spuService.getSpu(id);
return BeanUtils.toBean(spu, ProductSpuRespDTO.class);
}
}
package org.dromara.mall.api.service.promotion;
/**
* 砍价活动 Api 接口
*
* @author HUIHUI
*/
public interface BargainActivityApi {
/**
* 更新砍价活动库存
*
* @param id 砍价活动编号
* @param count 购买数量
*/
void updateBargainActivityStock(Long id, Integer count);
}
package org.dromara.mall.api.service.promotion;
import org.dromara.mall.api.dto.promotion.BargainValidateJoinRespDTO;
/**
* 砍价记录 API 接口
*
* @author HUIHUI
*/
public interface BargainRecordApi {
/**
* 【下单前】校验是否参与砍价活动
* <p>
* 如果校验失败,则抛出业务异常
*
* @param userId 用户编号
* @param bargainRecordId 砍价活动编号
* @param skuId SKU 编号
* @return 砍价信息
*/
BargainValidateJoinRespDTO validateJoinBargain(Long userId, Long bargainRecordId, Long skuId);
/**
* 更新砍价记录的订单编号
*
* 在砍价成功后,用户发起订单后,会记录该订单编号
*
* @param id 砍价记录编号
* @param orderId 订单编号
*/
void updateBargainRecordOrderId(Long id, Long orderId);
}
package org.dromara.mall.api.service.promotion;
import jakarta.validation.Valid;
import org.dromara.mall.api.dto.promotion.CombinationRecordCreateReqDTO;
import org.dromara.mall.api.dto.promotion.CombinationRecordCreateRespDTO;
import org.dromara.mall.api.dto.promotion.CombinationRecordRespDTO;
import org.dromara.mall.api.dto.promotion.CombinationValidateJoinRespDTO;
/**
* 拼团记录 API 接口
*
* @author HUIHUI
*/
public interface CombinationRecordApi {
/**
* 校验是否满足拼团条件
*
* @param userId 用户编号
* @param activityId 活动编号
* @param headId 团长编号
* @param skuId sku 编号
* @param count 数量
*/
void validateCombinationRecord(Long userId, Long activityId, Long headId, Long skuId, Integer count);
/**
* 创建开团记录
*
* @param reqDTO 请求 DTO
* @return 拼团信息
*/
CombinationRecordCreateRespDTO createCombinationRecord(@Valid CombinationRecordCreateReqDTO reqDTO);
/**
* 基于订单编号,查询拼团记录
*
* @param userId 用户编号
* @param orderId 订单编号
* @return 拼团记录
*/
CombinationRecordRespDTO getCombinationRecordByOrderId(Long userId, Long orderId);
/**
* 【下单前】校验是否满足拼团活动条件
* <p>
* 如果校验失败,则抛出业务异常
*
* @param userId 用户编号
* @param activityId 活动编号
* @param headId 团长编号
* @param skuId sku 编号
* @param count 数量
* @return 拼团信息
*/
CombinationValidateJoinRespDTO validateJoinCombination(Long userId, Long activityId, Long headId,
Long skuId, Integer count);
}
package org.dromara.mall.api.service.promotion;
import jakarta.validation.Valid;
import org.dromara.mall.api.dto.promotion.CouponRespDTO;
import org.dromara.mall.api.dto.promotion.CouponUseReqDTO;
import java.util.List;
import java.util.Map;
/**
* 优惠劵 API 接口
*
* @author 芋道源码
*/
public interface CouponApi {
/**
* 获得用户的优惠劵列表
*
* @param userId 用户编号
* @param status 优惠劵状态
* @return 优惠劵列表
*/
List<CouponRespDTO> getCouponListByUserId(Long userId, Integer status);
/**
* 使用优惠劵
*
* @param useReqDTO 使用请求
*/
void useCoupon(@Valid CouponUseReqDTO useReqDTO);
/**
* 退还已使用的优惠券
*
* @param id 优惠券编号
*/
void returnUsedCoupon(Long id);
/**
* 【管理员】给指定用户批量发送优惠券
*
* @param giveCoupons key: 优惠劵模版编号,value:对应的数量
* @param userId 用户编号
* @return 优惠券编号列表
*/
List<Long> takeCouponsByAdmin(Map<Long, Integer> giveCoupons, Long userId);
/**
* 【管理员】作废指定用户的指定优惠劵
*
* @param giveCouponIds 赠送的优惠券编号
* @param userId 用户编号
*/
void invalidateCouponsByAdmin(List<Long> giveCouponIds, Long userId);
}
package org.dromara.mall.api.service.promotion;
import org.dromara.mall.api.dto.promotion.DiscountProductRespDTO;
import java.util.Collection;
import java.util.List;
/**
* 限时折扣 API 接口
*
* @author 芋道源码
*/
public interface DiscountActivityApi {
/**
* 获得 skuId 商品匹配的的限时折扣信息
*
* @param skuIds 商品 SKU 编号数组
* @return 限时折扣信息
*/
List<DiscountProductRespDTO> getMatchDiscountProductListBySkuIds(Collection<Long> skuIds);
}
package org.dromara.mall.api.service.promotion;
import org.dromara.mall.api.dto.promotion.PointValidateJoinRespDTO;
/**
* 积分商城活动 API 接口
*
* @author HUIHUI
*/
public interface PointActivityApi {
/**
* 【下单前】校验是否参与积分商城活动
*
* 如果校验失败,则抛出业务异常
*
* @param activityId 活动编号
* @param skuId SKU 编号
* @param count 数量
* @return 积分商城商品信息
*/
PointValidateJoinRespDTO validateJoinPointActivity(Long activityId, Long skuId, Integer count);
/**
* 更新积分商城商品库存(减少)
*
* @param id 活动编号
* @param skuId sku 编号
* @param count 数量(正数)
*/
void updatePointStockDecr(Long id, Long skuId, Integer count);
/**
* 更新积分商城商品库存(增加)
*
* @param id 活动编号
* @param skuId sku 编号
* @param count 数量(正数)
*/
void updatePointStockIncr(Long id, Long skuId, Integer count);
}
package org.dromara.mall.api.service.promotion;
import org.dromara.mall.api.dto.promotion.RewardActivityMatchRespDTO;
import java.util.Collection;
import java.util.List;
/**
* 满减送活动 API 接口
*
* @author 芋道源码
*/
public interface RewardActivityApi {
/**
* 获得 spuId 商品匹配的的满减送活动列表
*
* @param spuIds SPU 编号
* @return 满减送活动列表
*/
List<RewardActivityMatchRespDTO> getMatchRewardActivityListBySpuIds(Collection<Long> spuIds);
}
package org.dromara.mall.api.service.promotion;
import org.dromara.mall.api.dto.promotion.SeckillValidateJoinRespDTO;
/**
* 秒杀活动 API 接口
*
* @author HUIHUI
*/
public interface SeckillActivityApi {
/**
* 更新秒杀库存(减少)
*
* @param id 活动编号
* @param skuId sku 编号
* @param count 数量(正数)
*/
void updateSeckillStockDecr(Long id, Long skuId, Integer count);
/**
* 更新秒杀库存(增加)
*
* @param id 活动编号
* @param skuId sku 编号
* @param count 数量(正数)
*/
void updateSeckillStockIncr(Long id, Long skuId, Integer count);
/**
* 【下单前】校验是否参与秒杀活动
*
* 如果校验失败,则抛出业务异常
*
* @param activityId 活动编号
* @param skuId SKU 编号
* @param count 数量
* @return 秒杀信息
*/
SeckillValidateJoinRespDTO validateJoinSeckill(Long activityId, Long skuId, Integer count);
}
package org.dromara.mall.api.service.promotion.impl;
import jakarta.annotation.Resource;
import org.dromara.mall.api.service.promotion.BargainActivityApi;
import org.dromara.mall.service.promotion.BargainActivityService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 砍价活动 Api 接口实现类
*
* @author HUIHUI
*/
@Service
@Validated
public class BargainActivityApiImpl implements BargainActivityApi {
@Resource
private BargainActivityService bargainActivityService;
@Override
public void updateBargainActivityStock(Long id, Integer count) {
bargainActivityService.updateBargainActivityStock(id, count);
}
}
package org.dromara.mall.api.service.promotion.impl;
import jakarta.annotation.Resource;
import org.dromara.mall.api.dto.promotion.BargainValidateJoinRespDTO;
import org.dromara.mall.api.service.promotion.BargainRecordApi;
import org.dromara.mall.service.promotion.BargainRecordService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 砍价活动 API 实现类
*
* @author HUIHUI
*/
@Service
@Validated
public class BargainRecordApiImpl implements BargainRecordApi {
@Resource
private BargainRecordService bargainRecordService;
@Override
public BargainValidateJoinRespDTO validateJoinBargain(Long userId, Long bargainRecordId, Long skuId) {
return bargainRecordService.validateJoinBargain(userId, bargainRecordId, skuId);
}
@Override
public void updateBargainRecordOrderId(Long id, Long orderId) {
bargainRecordService.updateBargainRecordOrderId(id, orderId);
}
}
package org.dromara.mall.api.service.promotion.impl;
import jakarta.annotation.Resource;
import org.dromara.common.mybatis.util.BeanUtils;
import org.dromara.mall.api.dto.promotion.CombinationRecordCreateReqDTO;
import org.dromara.mall.api.dto.promotion.CombinationRecordCreateRespDTO;
import org.dromara.mall.api.dto.promotion.CombinationRecordRespDTO;
import org.dromara.mall.api.dto.promotion.CombinationValidateJoinRespDTO;
import org.dromara.mall.api.service.promotion.CombinationRecordApi;
import org.dromara.mall.convert.promotion.combination.CombinationActivityConvert;
import org.dromara.mall.domain.promotion.CombinationRecordDO;
import org.dromara.mall.service.promotion.CombinationRecordService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 拼团活动 API 实现类
*
* @author HUIHUI
*/
@Service
@Validated
public class CombinationRecordApiImpl implements CombinationRecordApi {
@Resource
private CombinationRecordService combinationRecordService;
@Override
public void validateCombinationRecord(Long userId, Long activityId, Long headId, Long skuId, Integer count) {
combinationRecordService.validateCombinationRecord(userId, activityId, headId, skuId, count);
}
@Override
public CombinationRecordCreateRespDTO createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) {
return CombinationActivityConvert.INSTANCE.convert4(combinationRecordService.createCombinationRecord(reqDTO));
}
@Override
public CombinationRecordRespDTO getCombinationRecordByOrderId(Long userId, Long orderId) {
CombinationRecordDO record = combinationRecordService.getCombinationRecord(userId, orderId);
return BeanUtils.toBean(record, CombinationRecordRespDTO.class);
}
@Override
public CombinationValidateJoinRespDTO validateJoinCombination(Long userId, Long activityId, Long headId, Long skuId, Integer count) {
return combinationRecordService.validateJoinCombination(userId, activityId, headId, skuId, count);
}
}
package org.dromara.mall.api.service.promotion.impl;
import jakarta.annotation.Resource;
import org.dromara.common.mybatis.util.BeanUtils;
import org.dromara.mall.api.dto.promotion.CouponRespDTO;
import org.dromara.mall.api.dto.promotion.CouponUseReqDTO;
import org.dromara.mall.api.service.promotion.CouponApi;
import org.dromara.mall.service.promotion.CouponService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.List;
import java.util.Map;
/**
* 优惠劵 API 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class CouponApiImpl implements CouponApi {
@Resource
private CouponService couponService;
@Override
public List<CouponRespDTO> getCouponListByUserId(Long userId, Integer status) {
return BeanUtils.toBean(couponService.getCouponList(userId, status), CouponRespDTO.class);
}
@Override
public void useCoupon(CouponUseReqDTO useReqDTO) {
couponService.useCoupon(useReqDTO.getId(), useReqDTO.getUserId(),
useReqDTO.getOrderId());
}
@Override
public void returnUsedCoupon(Long id) {
couponService.returnUsedCoupon(id);
}
@Override
public List<Long> takeCouponsByAdmin(Map<Long, Integer> giveCoupons, Long userId) {
return couponService.takeCouponsByAdmin(giveCoupons, userId);
}
@Override
public void invalidateCouponsByAdmin(List<Long> giveCouponIds, Long userId) {
couponService.invalidateCouponsByAdmin(giveCouponIds, userId);
}
}
package org.dromara.mall.api.service.promotion.impl;
import jakarta.annotation.Resource;
import org.dromara.common.mybatis.util.BeanUtils;
import org.dromara.mall.api.dto.promotion.DiscountProductRespDTO;
import org.dromara.mall.api.service.promotion.DiscountActivityApi;
import org.dromara.mall.domain.promotion.DiscountProductDO;
import org.dromara.mall.service.promotion.DiscountActivityService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.Collection;
import java.util.List;
/**
* 限时折扣 API 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class DiscountActivityApiImpl implements DiscountActivityApi {
@Resource
private DiscountActivityService discountActivityService;
@Override
public List<DiscountProductRespDTO> getMatchDiscountProductListBySkuIds(Collection<Long> skuIds) {
List<DiscountProductDO> list = discountActivityService.getMatchDiscountProductListBySkuIds(skuIds);
return BeanUtils.toBean(list, DiscountProductRespDTO.class);
}
}
package org.dromara.mall.api.service.promotion.impl;
import jakarta.annotation.Resource;
import org.dromara.mall.api.dto.promotion.PointValidateJoinRespDTO;
import org.dromara.mall.api.service.promotion.PointActivityApi;
import org.dromara.mall.service.promotion.PointActivityService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 积分商城活动 Api 接口实现类
*
* @author HUIHUI
*/
@Service
@Validated
public class PointActivityApiImpl implements PointActivityApi {
@Resource
private PointActivityService pointActivityService;
@Override
public PointValidateJoinRespDTO validateJoinPointActivity(Long activityId, Long skuId, Integer count) {
return pointActivityService.validateJoinPointActivity(activityId, skuId, count);
}
@Override
public void updatePointStockDecr(Long id, Long skuId, Integer count) {
pointActivityService.updatePointStockDecr(id, skuId, count);
}
@Override
public void updatePointStockIncr(Long id, Long skuId, Integer count) {
pointActivityService.updatePointStockIncr(id, skuId, count);
}
}
package org.dromara.mall.api.service.promotion.impl;
import jakarta.annotation.Resource;
import org.dromara.mall.api.dto.promotion.RewardActivityMatchRespDTO;
import org.dromara.mall.api.service.promotion.RewardActivityApi;
import org.dromara.mall.service.promotion.RewardActivityService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.Collection;
import java.util.List;
/**
* 满减送活动 API 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class RewardActivityApiImpl implements RewardActivityApi {
@Resource
private RewardActivityService rewardActivityService;
@Override
public List<RewardActivityMatchRespDTO> getMatchRewardActivityListBySpuIds(Collection<Long> spuIds) {
return rewardActivityService.getMatchRewardActivityListBySpuIds(spuIds);
}
}
package org.dromara.mall.api.service.promotion.impl;
import jakarta.annotation.Resource;
import org.dromara.mall.api.dto.promotion.SeckillValidateJoinRespDTO;
import org.dromara.mall.api.service.promotion.SeckillActivityApi;
import org.dromara.mall.service.promotion.SeckillActivityService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 秒杀活动接口 Api 接口实现类
*
* @author HUIHUI
*/
@Service
@Validated
public class SeckillActivityApiImpl implements SeckillActivityApi {
@Resource
private SeckillActivityService activityService;
@Override
public void updateSeckillStockDecr(Long id, Long skuId, Integer count) {
activityService.updateSeckillStockDecr(id, skuId, count);
}
@Override
public void updateSeckillStockIncr(Long id, Long skuId, Integer count) {
activityService.updateSeckillStockIncr(id, skuId, count);
}
@Override
public SeckillValidateJoinRespDTO validateJoinSeckill(Long activityId, Long skuId, Integer count) {
return activityService.validateJoinSeckill(activityId, skuId, count);
}
}
package org.dromara.mall.api.service.system;
import org.dromara.common.mall.util.collection.CollectionUtils;
import org.dromara.mall.api.dto.system.AdminUserRespDTO;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* Admin 用户 API 接口
*
* @author 芋道源码
*/
public interface AdminUserApi {
/**
* 通过用户 ID 查询用户
*
* @param id 用户ID
* @return 用户对象信息
*/
AdminUserRespDTO getUser(Long id);
/**
* 通过用户 ID 查询用户们
*
* @param ids 用户 ID 们
* @return 用户对象信息
*/
List<AdminUserRespDTO> getUserList(Collection<Long> ids);
/**
* 获得用户 Map
*
* @param ids 用户编号数组
* @return 用户 Map
*/
default Map<Long, AdminUserRespDTO> getUserMap(Collection<Long> ids) {
List<AdminUserRespDTO> users = getUserList(ids);
return CollectionUtils.convertMap(users, AdminUserRespDTO::getId);
}
/**
* 校验用户是否有效。如下情况,视为无效:
* 1. 用户编号不存在
* 2. 用户被禁用
*
* @param id 用户编号
*/
default void validateUser(Long id) {
validateUserList(Collections.singleton(id));
}
/**
* 校验用户们是否有效。如下情况,视为无效:
* 1. 用户编号不存在
* 2. 用户被禁用
*
* @param ids 用户编号数组
*/
void validateUserList(Collection<Long> ids);
}
package org.dromara.mall.api.service.system;
import jakarta.validation.Valid;
import org.dromara.mall.api.dto.system.NotifySendSingleToUserReqDTO;
/**
* 站内信发送 API 接口
*
* @author xrcoder
*/
public interface NotifyMessageSendApi {
/**
* 发送单条站内信给 Admin 用户
*
* @param reqDTO 发送请求
* @return 发送消息 ID
*/
Long sendSingleMessageToAdmin(@Valid NotifySendSingleToUserReqDTO reqDTO);
/**
* 发送单条站内信给 Member 用户
*
* @param reqDTO 发送请求
* @return 发送消息 ID
*/
Long sendSingleMessageToMember(@Valid NotifySendSingleToUserReqDTO reqDTO);
}
package org.dromara.mall.api.service.system;
import jakarta.validation.Valid;
import org.dromara.mall.api.dto.member.SocialWxPhoneNumberInfoRespDTO;
import org.dromara.mall.api.dto.member.SocialWxQrcodeReqDTO;
import org.dromara.mall.api.dto.member.SocialWxaSubscribeMessageSendReqDTO;
import org.dromara.mall.api.dto.member.SocialWxaSubscribeTemplateRespDTO;
import org.dromara.mall.api.dto.system.SocialWxJsapiSignatureRespDTO;
import java.util.List;
/**
* 社交应用的 API 接口
*
* @author 芋道源码
*/
public interface SocialClientApi {
/**
* 获得社交平台的授权 URL
*
* @param socialType 社交平台的类型 {@link SocialTypeEnum}
* @param userType 用户类型
* @param redirectUri 重定向 URL
* @return 社交平台的授权 URL
*/
String getAuthorizeUrl(Integer socialType, Integer userType, String redirectUri);
/**
* 创建微信公众号 JS SDK 初始化所需的签名
*
* @param userType 用户类型
* @param url 访问的 URL 地址
* @return 签名
*/
SocialWxJsapiSignatureRespDTO createWxMpJsapiSignature(Integer userType, String url);
//======================= 微信小程序独有 =======================
/**
* 获得微信小程序的手机信息
*
* @param userType 用户类型
* @param phoneCode 手机授权码
* @return 手机信息
*/
SocialWxPhoneNumberInfoRespDTO getWxMaPhoneNumberInfo(Integer userType, String phoneCode);
/**
* 获得小程序二维码
*
* @param reqVO 请求信息
* @return 小程序二维码
*/
byte[] getWxaQrcode(@Valid SocialWxQrcodeReqDTO reqVO);
/**
* 获得微信小程订阅模板
*
* @return 小程序订阅消息模版
*/
List<SocialWxaSubscribeTemplateRespDTO> getWxaSubscribeTemplateList(Integer userType);
/**
* 发送微信小程序订阅消息
*
* @param reqDTO 请求
*/
void sendWxaSubscribeMessage(SocialWxaSubscribeMessageSendReqDTO reqDTO);
}
package org.dromara.mall.api.service.system;
import jakarta.validation.Valid;
import org.dromara.mall.api.dto.member.SocialUserBindReqDTO;
import org.dromara.mall.api.dto.member.SocialUserRespDTO;
import org.dromara.mall.api.dto.member.SocialUserUnbindReqDTO;
/**
* 社交用户的 API 接口
*
* @author 芋道源码
*/
public interface SocialUserApi {
/**
* 绑定社交用户
*
* @param reqDTO 绑定信息
* @return 社交用户 openid
*/
String bindSocialUser(@Valid SocialUserBindReqDTO reqDTO);
/**
* 取消绑定社交用户
*
* @param reqDTO 解绑
*/
void unbindSocialUser(@Valid SocialUserUnbindReqDTO reqDTO);
/**
* 获得社交用户,基于 userId
*
* @param userType 用户类型
* @param userId 用户编号
* @param socialType 社交平台的类型
* @return 社交用户
*/
SocialUserRespDTO getSocialUserByUserId(Integer userType, Long userId, Integer socialType);
/**
* 获得社交用户
*
* 在认证信息不正确的情况下,也会抛出 {@link ServiceException} 业务异常
*
* @param userType 用户类型
* @param socialType 社交平台的类型
* @param code 授权码
* @param state state
* @return 社交用户
*/
SocialUserRespDTO getSocialUserByCode(Integer userType, Integer socialType, String code, String state);
}
package org.dromara.mall.api.service.system.impl;
import cn.hutool.core.collection.CollUtil;
import lombok.AllArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.dromara.common.mall.enums.CommonStatusEnum;
import org.dromara.common.mall.util.collection.CollectionUtils;
import org.dromara.mall.api.dto.system.AdminUserRespDTO;
import org.dromara.mall.api.service.system.AdminUserApi;
import org.dromara.mall.convert.system.AdminUserConvert;
import org.dromara.system.api.RemoteUserService;
import org.dromara.system.api.domain.vo.RemoteUserVo;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import static org.dromara.common.mall.exception.util.ServiceExceptionUtil.exception;
import static org.dromara.mall.enums.member.ErrorCodeConstants.USER_NOT_EXISTS;
import static org.dromara.mall.enums.system.ErrorCodeConstants.USER_IS_DISABLE;
/**
* Admin 用户 API 实现类
*
* @author 芋道源码
*/
@Service
@AllArgsConstructor
public class AdminUserApiImpl implements AdminUserApi {
@DubboReference
private final RemoteUserService remoteUserService;
@Override
public AdminUserRespDTO getUser(Long id) {
if (id == null) {
return null;
}
List<RemoteUserVo> list = remoteUserService.selectUserVoListByUserIds(List.of(id));
return CollUtil.isEmpty(list) ? null : AdminUserConvert.INSTANCE.convert(list.get(0));
}
@Override
public List<AdminUserRespDTO> getUserList(Collection<Long> ids) {
List<RemoteUserVo> list = remoteUserService.selectUserVoListByUserIds((List<Long>) ids);
return AdminUserConvert.INSTANCE.convertList(list);
}
@Override
public void validateUserList(Collection<Long> ids) {
if (CollUtil.isEmpty(ids)) {
return;
}
List<RemoteUserVo> users = remoteUserService.selectUserVoListByUserIds((List<Long>) ids);
Map<Long, RemoteUserVo> userMap = CollectionUtils.convertMap(users, RemoteUserVo::getUserId);
// 校验
ids.forEach(id -> {
RemoteUserVo user = userMap.get(id);
if (user == null) {
throw exception(USER_NOT_EXISTS);
}
if (!CommonStatusEnum.ENABLE.getStatus().equals(Integer.parseInt(user.getStatus()))) {
throw exception(USER_IS_DISABLE, user.getNickName());
}
});
}
}
package org.dromara.mall.api.service.system.impl;
import org.dromara.mall.api.dto.system.NotifySendSingleToUserReqDTO;
import org.dromara.mall.api.service.system.NotifyMessageSendApi;
import org.springframework.stereotype.Service;
/**
* 站内信发送 API 实现类
*
* @author xrcoder
*/
@Service
public class NotifyMessageSendApiImpl implements NotifyMessageSendApi {
@Override
public Long sendSingleMessageToAdmin(NotifySendSingleToUserReqDTO reqDTO) {
return null;
}
@Override
public Long sendSingleMessageToMember(NotifySendSingleToUserReqDTO reqDTO) {
return null;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论