项目模块初步完成
This commit is contained in:
@ -0,0 +1,138 @@
|
||||
package com.greenorange.promotion.model.dto.project;
|
||||
|
||||
import com.greenorange.promotion.annotation.EnumValue;
|
||||
import com.greenorange.promotion.model.enums.ProjectStatusEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 项目添加请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "项目添加请求体", requiredProperties = {
|
||||
"projectName",
|
||||
"projectImage",
|
||||
"maxProjectPrice",
|
||||
"minProjectPrice",
|
||||
"projectDescription",
|
||||
"settlementDesc",
|
||||
"projectDesc",
|
||||
"projectFlow",
|
||||
"applyPromoCodeDesc",
|
||||
"projectSettlementCycle",
|
||||
"currentPromotionCount",
|
||||
"maxPromoterCount",
|
||||
"projectStatus",
|
||||
"isShelves",
|
||||
})
|
||||
public class ProjectAddRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@NotBlank(message = "项目名称不能为空")
|
||||
@Schema(description = "项目名称", example = "美团省钱包")
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 项目图片URL
|
||||
*/
|
||||
@NotBlank(message = "项目图片URL不能为空")
|
||||
@Schema(description = "项目图片URL", example = "http://xxx.png")
|
||||
private String projectImage;
|
||||
|
||||
/**
|
||||
* 项目最高价格
|
||||
*/
|
||||
@DecimalMin(value = "0", message = "项目最低价格不能小于0")
|
||||
@Schema(description = "项目最高价格", example = "30")
|
||||
private BigDecimal maxProjectPrice;
|
||||
|
||||
/**
|
||||
* 项目最低价格
|
||||
*/
|
||||
@DecimalMin(value = "0", message = "项目最低价格不能小于0")
|
||||
@Schema(description = "项目最低价格", example = "10")
|
||||
private BigDecimal minProjectPrice;
|
||||
|
||||
/**
|
||||
* 项目简介
|
||||
*/
|
||||
@NotBlank(message = "项目简介不能为空")
|
||||
@Schema(description = "项目简介", example = "不限制推广方式,禁止/恶意/夸大虚假宣传")
|
||||
private String projectDescription;
|
||||
|
||||
/**
|
||||
* 结算说明(富文本)
|
||||
*/
|
||||
@NotBlank(message = "结算说明(富文本)不能为空")
|
||||
@Schema(description = "结算说明(富文本)", example = "富文本")
|
||||
private String settlementDesc;
|
||||
|
||||
/**
|
||||
* 项目说明(富文本)
|
||||
*/
|
||||
@NotBlank(message = "项目说明(富文本)不能为空")
|
||||
@Schema(description = "项目说明(富文本)", example = "富文本")
|
||||
private String projectDesc;
|
||||
|
||||
/**
|
||||
* 项目流程(富文本)
|
||||
*/
|
||||
@NotBlank(message = "项目流程(富文本)不能为空")
|
||||
@Schema(description = "项目流程(富文本)", example = "富文本")
|
||||
private String projectFlow;
|
||||
|
||||
/**
|
||||
* 申请推广码说明(富文本)
|
||||
*/
|
||||
@NotBlank(message = "申请推广码说明(富文本)不能为空")
|
||||
@Schema(description = "申请推广码说明(富文本)", example = "富文本")
|
||||
private String applyPromoCodeDesc;
|
||||
|
||||
/**
|
||||
* 项目结算周期
|
||||
*/
|
||||
@Min(value = 1, message = "项目结算周期不能小于1")
|
||||
@Schema(description = "项目结算周期", example = "2")
|
||||
private Integer projectSettlementCycle;
|
||||
|
||||
/**
|
||||
* 当前推广人数
|
||||
*/
|
||||
@Min(value = 1, message = "当前推广人数不能小于1")
|
||||
@Schema(description = "当前推广人数", example = "150")
|
||||
private Integer currentPromotionCount;
|
||||
|
||||
/**
|
||||
* 最大推广人数
|
||||
*/
|
||||
@Min(value = 1, message = "当前推广人数不能小于1")
|
||||
@Schema(description = "最大推广人数", example = "200")
|
||||
private Integer maxPromoterCount;
|
||||
|
||||
/**
|
||||
* 项目状态(项目运行|人数已满|项目暂停)
|
||||
*/
|
||||
@EnumValue(enumClass = ProjectStatusEnum.class)
|
||||
@Schema(description = "项目状态", example = "项目运行")
|
||||
private String projectStatus;
|
||||
|
||||
/**
|
||||
* 是否上架
|
||||
*/
|
||||
@Schema(description = "是否上架", example = "true")
|
||||
private Boolean isShelves;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
package com.greenorange.promotion.model.dto.project;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
|
||||
/**
|
||||
* 项目查询请求体,继承自分页请求 PageRequest
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "项目查询请求体", requiredProperties = {"current", "pageSize"})
|
||||
public class ProjectQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 项目 ID
|
||||
*/
|
||||
@Schema(description = "项目 ID", example = "1")
|
||||
@Min(value = 1L, message = "项目 ID不能小于1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@NotBlank(message = "项目名称不能为空")
|
||||
@Schema(description = "项目名称", example = "美团省钱包")
|
||||
private String projectName;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,143 @@
|
||||
package com.greenorange.promotion.model.dto.project;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 项目更新请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "项目更新请求体", requiredProperties = {
|
||||
"id",
|
||||
"projectName",
|
||||
"projectImage",
|
||||
"maxProjectPrice",
|
||||
"minProjectPrice",
|
||||
"projectDescription",
|
||||
"settlementDesc",
|
||||
"projectDesc",
|
||||
"projectFlow",
|
||||
"applyPromoCodeDesc",
|
||||
"projectSettlementCycle",
|
||||
"currentPromotionCount",
|
||||
"maxPromoterCount",
|
||||
"projectStatus",
|
||||
"isShelves",
|
||||
})
|
||||
public class ProjectUpdateRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
@Min(value = 1L, message = "项目 ID不能小于1")
|
||||
@TableId(type = IdType.AUTO)
|
||||
@Schema(description = "项目ID", example = "美团省钱包")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@NotBlank(message = "项目名称不能为空")
|
||||
@Schema(description = "项目名称", example = "美团省钱包")
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 项目图片URL
|
||||
*/
|
||||
@NotBlank(message = "项目图片URL不能为空")
|
||||
@Schema(description = "项目图片URL", example = "http://xxx.png")
|
||||
private String projectImage;
|
||||
|
||||
/**
|
||||
* 项目最高价格
|
||||
*/
|
||||
@DecimalMin(value = "0", message = "项目最低价格不能小于0")
|
||||
@Schema(description = "项目最高价格", example = "30")
|
||||
private BigDecimal maxProjectPrice;
|
||||
|
||||
/**
|
||||
* 项目最低价格
|
||||
*/
|
||||
@DecimalMin(value = "0", message = "项目最低价格不能小于0")
|
||||
@Schema(description = "项目最低价格", example = "10")
|
||||
private BigDecimal minProjectPrice;
|
||||
|
||||
/**
|
||||
* 项目简介
|
||||
*/
|
||||
@NotBlank(message = "项目简介不能为空")
|
||||
@Schema(description = "项目简介", example = "不限制推广方式,禁止/恶意/夸大虚假宣传")
|
||||
private String projectDescription;
|
||||
|
||||
/**
|
||||
* 结算说明(富文本)
|
||||
*/
|
||||
@NotBlank(message = "结算说明(富文本)不能为空")
|
||||
@Schema(description = "结算说明(富文本)", example = "富文本")
|
||||
private String settlementDesc;
|
||||
|
||||
/**
|
||||
* 项目说明(富文本)
|
||||
*/
|
||||
@NotBlank(message = "项目说明(富文本)不能为空")
|
||||
@Schema(description = "项目说明(富文本)", example = "富文本")
|
||||
private String projectDesc;
|
||||
|
||||
/**
|
||||
* 项目流程(富文本)
|
||||
*/
|
||||
@NotBlank(message = "项目流程(富文本)不能为空")
|
||||
@Schema(description = "项目流程(富文本)", example = "富文本")
|
||||
private String projectFlow;
|
||||
|
||||
/**
|
||||
* 申请推广码说明(富文本)
|
||||
*/
|
||||
@NotBlank(message = "申请推广码说明(富文本)不能为空")
|
||||
@Schema(description = "申请推广码说明(富文本)", example = "富文本")
|
||||
private String applyPromoCodeDesc;
|
||||
|
||||
/**
|
||||
* 项目结算周期
|
||||
*/
|
||||
@Schema(description = "项目结算周期", example = "2")
|
||||
private Integer projectSettlementCycle;
|
||||
|
||||
/**
|
||||
* 当前推广人数
|
||||
*/
|
||||
@Schema(description = "当前推广人数", example = "150")
|
||||
private Integer currentPromotionCount;
|
||||
|
||||
/**
|
||||
* 最大推广人数
|
||||
*/
|
||||
@Schema(description = "最大推广人数", example = "200")
|
||||
private Integer maxPromoterCount;
|
||||
|
||||
/**
|
||||
* 项目状态(项目运行|人数已满|项目暂停)
|
||||
*/
|
||||
@NotBlank(message = "项目状态不能为空")
|
||||
@Schema(description = "项目状态", example = "项目运行")
|
||||
private String projectStatus;
|
||||
|
||||
/**
|
||||
* 是否上架
|
||||
*/
|
||||
@Schema(description = "是否上架", example = "true")
|
||||
private Boolean isShelves;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -66,7 +66,7 @@ public class UserInfoAddRequest implements Serializable {
|
||||
* 用户角色
|
||||
*/
|
||||
@EnumValue(enumClass = UserRoleEnum.class)
|
||||
@Schema(description = "用户角色", example = "USER")
|
||||
@Schema(description = "用户角色", example = "user")
|
||||
private String userRole;
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,112 @@
|
||||
package com.greenorange.promotion.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 项目表
|
||||
* @TableName project
|
||||
*/
|
||||
@TableName(value ="project")
|
||||
@Data
|
||||
public class Project implements Serializable {
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 项目图片URL
|
||||
*/
|
||||
private String projectImage;
|
||||
|
||||
/**
|
||||
* 项目最高价格
|
||||
*/
|
||||
private BigDecimal maxProjectPrice;
|
||||
|
||||
/**
|
||||
* 项目最低价格
|
||||
*/
|
||||
private BigDecimal minProjectPrice;
|
||||
|
||||
/**
|
||||
* 项目简介
|
||||
*/
|
||||
private String projectDescription;
|
||||
|
||||
/**
|
||||
* 结算说明(富文本)
|
||||
*/
|
||||
private String settlementDesc;
|
||||
|
||||
/**
|
||||
* 项目说明(富文本)
|
||||
*/
|
||||
private String projectDesc;
|
||||
|
||||
/**
|
||||
* 项目流程(富文本)
|
||||
*/
|
||||
private String projectFlow;
|
||||
|
||||
/**
|
||||
* 申请推广码说明(富文本)
|
||||
*/
|
||||
private String applyPromoCodeDesc;
|
||||
|
||||
/**
|
||||
* 项目结算周期
|
||||
*/
|
||||
private Integer projectSettlementCycle;
|
||||
|
||||
/**
|
||||
* 当前推广人数
|
||||
*/
|
||||
private Integer currentPromotionCount;
|
||||
|
||||
/**
|
||||
* 最大推广人数
|
||||
*/
|
||||
private Integer maxPromoterCount;
|
||||
|
||||
/**
|
||||
* 项目状态(项目运行|人数已满|项目暂停)
|
||||
*/
|
||||
private String projectStatus;
|
||||
|
||||
/**
|
||||
* 是否上架
|
||||
*/
|
||||
private Integer isShelves;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.greenorange.promotion.model.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
public enum ProjectStatusEnum {
|
||||
|
||||
RUNNING("项目运行", "running"),
|
||||
FULL("人数已满", "full"),
|
||||
PAUSED("项目暂停", "paused");
|
||||
|
||||
private final String text;
|
||||
private final String value;
|
||||
|
||||
ProjectStatusEnum(String text, String value) {
|
||||
this.text = text;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取值列表
|
||||
*/
|
||||
public static List<String> getValues() {
|
||||
return Arrays.stream(values())
|
||||
.map(item -> item.value)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据值获取枚举
|
||||
*/
|
||||
public static ProjectStatusEnum getEnumByValue(String value) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return null;
|
||||
}
|
||||
for (ProjectStatusEnum status : ProjectStatusEnum.values()) {
|
||||
if (status.value.equals(value)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ package com.greenorange.promotion.model.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -0,0 +1,110 @@
|
||||
package com.greenorange.promotion.model.vo.project;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 项目 视图对象
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "项目 视图对象")
|
||||
public class ProjectVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 项目 ID
|
||||
*/
|
||||
@Schema(description = "项目 ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@Schema(description = "项目名称", example = "美团省钱包")
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 项目图片URL
|
||||
*/
|
||||
@Schema(description = "项目图片URL", example = "http://xxx.png")
|
||||
private String projectImage;
|
||||
|
||||
/**
|
||||
* 项目最高价格
|
||||
*/
|
||||
@Schema(description = "项目最高价格", example = "30")
|
||||
private BigDecimal maxProjectPrice;
|
||||
|
||||
/**
|
||||
* 项目最低价格
|
||||
*/
|
||||
@Schema(description = "项目最低价格", example = "10")
|
||||
private BigDecimal minProjectPrice;
|
||||
|
||||
/**
|
||||
* 项目简介
|
||||
*/
|
||||
@Schema(description = "项目简介", example = "不限制推广方式,禁止/恶意/夸大虚假宣传")
|
||||
private String projectDescription;
|
||||
|
||||
/**
|
||||
* 结算说明(富文本)
|
||||
*/
|
||||
@Schema(description = "结算说明(富文本)", example = "富文本")
|
||||
private String settlementDesc;
|
||||
|
||||
/**
|
||||
* 项目说明(富文本)
|
||||
*/
|
||||
@Schema(description = "项目说明(富文本)", example = "富文本")
|
||||
private String projectDesc;
|
||||
|
||||
/**
|
||||
* 项目流程(富文本)
|
||||
*/
|
||||
@Schema(description = "项目流程(富文本)", example = "富文本")
|
||||
private String projectFlow;
|
||||
|
||||
/**
|
||||
* 申请推广码说明(富文本)
|
||||
*/
|
||||
@Schema(description = "申请推广码说明(富文本)", example = "富文本")
|
||||
private String applyPromoCodeDesc;
|
||||
|
||||
/**
|
||||
* 项目结算周期
|
||||
*/
|
||||
@Schema(description = "项目结算周期", example = "2")
|
||||
private Integer projectSettlementCycle;
|
||||
|
||||
/**
|
||||
* 当前推广人数
|
||||
*/
|
||||
@Schema(description = "当前推广人数", example = "150")
|
||||
private Integer currentPromotionCount;
|
||||
|
||||
/**
|
||||
* 最大推广人数
|
||||
*/
|
||||
@Schema(description = "最大推广人数", example = "200")
|
||||
private Integer maxPromoterCount;
|
||||
|
||||
/**
|
||||
* 项目状态(项目运行|人数已满|项目暂停)
|
||||
*/
|
||||
@Schema(description = "项目状态", example = "项目运行")
|
||||
private String projectStatus;
|
||||
|
||||
/**
|
||||
* 是否上架
|
||||
*/
|
||||
@Schema(description = "是否上架", example = "true")
|
||||
private Boolean isShelves;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
Reference in New Issue
Block a user