Commit 9979cd5e authored by zhangfeng's avatar zhangfeng

feature-reward:完善接口逻辑

parent 9f576514
...@@ -8,5 +8,14 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; ...@@ -8,5 +8,14 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
public interface ErrorCodeConstants { public interface ErrorCodeConstants {
ErrorCode REWARD_NOT_EXISTS = new ErrorCode(1010011001, "礼品不存在"); ErrorCode REWARD_NOT_EXISTS = new ErrorCode(1010011001, "礼品不存在");
ErrorCode REWARD_ENDTIME_ERROR = new ErrorCode(1001011002, "礼品结束时间不能早于当前时间"); ErrorCode REWARD_ENDTIME_ERROR = new ErrorCode(1001011002, "礼品结束时间不能早于当前时间");
ErrorCode REWARD_STATUS_NOT_ALLOW_DELETE = new ErrorCode(1001011003, "只有未启用可删除");
ErrorCode REWARD_STATUS_NOT_ALLOW_ClOSE = new ErrorCode(1001011004, "未启用礼品不可关闭");
ErrorCode REWARD_STATUS_CHANGE_ERROR = new ErrorCode(1001011005, "礼品状态操作不符合规则");
ErrorCode REWARD_STATUS_NOT_ALLOW_DELAY = new ErrorCode(1001011006, "只允许延期启用状态礼品");
ErrorCode REWARD_STATUS_NOT_ALLOW_CREATE = new ErrorCode(1001011007, "创建的礼品状态只能是启用或未启用");
ErrorCode REWARD_START_OR_END_TIME_NOT_ALLOW_CREATE = new ErrorCode(1001011008, "活动时间不合法");
ErrorCode REWARD_PICK_METHOD_NOT_ALLOW_CREATE = new ErrorCode(1001011009, "领取方式不合法");
ErrorCode REWARD_STATUS_NOT_ALLOW_UPDATE = new ErrorCode(1001011010, "礼物状态不允许编辑");
ErrorCode REWARD_STATUS_NOT_ALLOW_ENABLE = new ErrorCode(1001011011, "礼物不能启用");
} }
...@@ -15,12 +15,15 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ ...@@ -15,12 +15,15 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
public class RewardCreateReqVO { public class RewardCreateReqVO {
@ApiModelProperty(value = "中文名称") @ApiModelProperty(value = "中文名称")
@Size(max = 50, message = "名称长度不能超过50")
private String titleZh; private String titleZh;
@ApiModelProperty(value = "英文名称") @ApiModelProperty(value = "英文名称")
@Size(max = 50, message = "名称长度不能超过50")
private String titleEn; private String titleEn;
@ApiModelProperty(value = "法文名称") @ApiModelProperty(value = "法文名称")
@Size(max = 50, message = "名称长度不能超过50")
private String titleFr; private String titleFr;
@ApiModelProperty(value = "中文礼品图片") @ApiModelProperty(value = "中文礼品图片")
...@@ -34,6 +37,7 @@ public class RewardCreateReqVO { ...@@ -34,6 +37,7 @@ public class RewardCreateReqVO {
@ApiModelProperty(value = "兑换所需积分", required = true) @ApiModelProperty(value = "兑换所需积分", required = true)
@NotNull(message = "兑换所需积分不能为空") @NotNull(message = "兑换所需积分不能为空")
@Min(value = 0)
private Integer pointsRequire; private Integer pointsRequire;
@ApiModelProperty(value = "兑换网点", required = true) @ApiModelProperty(value = "兑换网点", required = true)
...@@ -42,6 +46,7 @@ public class RewardCreateReqVO { ...@@ -42,6 +46,7 @@ public class RewardCreateReqVO {
@ApiModelProperty(value = "剩余数量", required = true) @ApiModelProperty(value = "剩余数量", required = true)
@NotNull(message = "剩余数量不能为空") @NotNull(message = "剩余数量不能为空")
@Min(value = 0)
private Integer quantityRemain; private Integer quantityRemain;
@ApiModelProperty(value = "活动开始时间") @ApiModelProperty(value = "活动开始时间")
...@@ -58,6 +63,7 @@ public class RewardCreateReqVO { ...@@ -58,6 +63,7 @@ public class RewardCreateReqVO {
@ApiModelProperty(value = "允许兑换次数", required = true) @ApiModelProperty(value = "允许兑换次数", required = true)
@NotNull(message = "允许兑换次数不能为空") @NotNull(message = "允许兑换次数不能为空")
@Min(value = 0)
private Integer allowCount; private Integer allowCount;
@ApiModelProperty(value = "中文备注") @ApiModelProperty(value = "中文备注")
......
package cn.iocoder.yudao.module.reward.vo.reward; package cn.iocoder.yudao.module.reward.vo.reward;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("管理后台 - 礼品更新 Request VO") @ApiModel("管理后台 - 礼品更新 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class RewardUpdateReqVO extends RewardBaseVO { public class RewardUpdateReqVO {
@ApiModelProperty(value = "", required = true) @ApiModelProperty(value = "", required = true)
@NotNull(message = "不能为空") @NotNull(message = "不能为空")
private Long id; private Long id;
@ApiModelProperty(value = "中文名称")
@Size(max = 50, message = "名称长度不能超过50")
private String titleZh;
@ApiModelProperty(value = "英文名称")
@Size(max = 50, message = "名称长度不能超过50")
private String titleEn;
@ApiModelProperty(value = "法文名称")
@Size(max = 50, message = "名称长度不能超过50")
private String titleFr;
@ApiModelProperty(value = "中文礼品图片")
private String imgZh;
@ApiModelProperty(value = "英文礼品图片")
private String imgEn;
@ApiModelProperty(value = "法文礼品图片")
private String imgFr;
@ApiModelProperty(value = "兑换所需积分")
@Min(value = 0)
private Integer pointsRequire;
@ApiModelProperty(value = "兑换网点")
private Integer nodeId;
@ApiModelProperty(value = "剩余数量")
@Min(value = 0)
private Integer quantityRemain;
@ApiModelProperty(value = "活动开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date startTime;
@ApiModelProperty(value = "活动结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date endTime;
@ApiModelProperty(value = "领取方式(1上门领取,2包邮到家,3邮寄到付)")
private Integer pickMethod;
@ApiModelProperty(value = "允许兑换次数")
@Min(value = 0)
private Integer allowCount;
@ApiModelProperty(value = "中文备注")
@Size(max = 500, message = "中文备注长度不能超过500")
private String remarkZh;
@ApiModelProperty(value = "英文备注")
@Size(max = 500, message = "英文备注长度不能超过500")
private String remarkEn;
@ApiModelProperty(value = "法文备注")
@Size(max = 500, message = "法文备注长度不能超过500")
private String remarkFr;
} }
import cn.hutool.core.lang.UUID; import cn.hutool.core.lang.UUID;
import org.apache.commons.lang3.RandomStringUtils;
public class GenRewardCodeTest { public class GenRewardCodeTest {
public static void main(String[] args) { public static void main(String[] args) {
String format = String.format("%012d", 2); String string = RandomStringUtils.randomAlphanumeric(12).toUpperCase();
String uuid = UUID.randomUUID().toString().replaceAll("-", ""); System.out.println(string);
System.out.println(format);
System.out.println(uuid);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment