|
@@ -1,21 +1,28 @@
|
|
|
package com.ruoyi.shop.marketing.seckill.domain.bo;
|
|
package com.ruoyi.shop.marketing.seckill.domain.bo;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
|
|
|
+import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
import com.ruoyi.common.core.domain.BaseEntity;
|
|
import com.ruoyi.common.core.domain.BaseEntity;
|
|
|
import com.ruoyi.common.core.validate.AddGroup;
|
|
import com.ruoyi.common.core.validate.AddGroup;
|
|
|
import com.ruoyi.common.core.validate.EditGroup;
|
|
import com.ruoyi.common.core.validate.EditGroup;
|
|
|
|
|
+import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.filepathsplicing.FilePathValue;
|
|
import com.ruoyi.common.filepathsplicing.FilePathValue;
|
|
|
|
|
+import com.ruoyi.common.utils.ClassConvertUtils;
|
|
|
import com.ruoyi.shop.enums.ActiveState;
|
|
import com.ruoyi.shop.enums.ActiveState;
|
|
|
import com.ruoyi.shop.enums.CycleMode;
|
|
import com.ruoyi.shop.enums.CycleMode;
|
|
|
import io.swagger.annotations.ApiModel;
|
|
import io.swagger.annotations.ApiModel;
|
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
import lombok.Data;
|
|
import lombok.Data;
|
|
|
import lombok.EqualsAndHashCode;
|
|
import lombok.EqualsAndHashCode;
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.hibernate.validator.constraints.Length;
|
|
import org.hibernate.validator.constraints.Length;
|
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
|
|
|
|
|
|
import javax.validation.constraints.NotBlank;
|
|
import javax.validation.constraints.NotBlank;
|
|
|
import javax.validation.constraints.NotNull;
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
@@ -145,4 +152,50 @@ public class SeckillActivityBo extends BaseEntity {
|
|
|
*/
|
|
*/
|
|
|
@ApiModelProperty(value = "周几", required = true)
|
|
@ApiModelProperty(value = "周几", required = true)
|
|
|
private List<Integer> weekList;
|
|
private List<Integer> weekList;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 把字符串映射成对象
|
|
|
|
|
+ */
|
|
|
|
|
+ public void setWeeks(String weeks) {
|
|
|
|
|
+ this.weeks = weeks;
|
|
|
|
|
+ if (StringUtils.isEmpty(this.weeks)) {
|
|
|
|
|
+ setWeekList(new ArrayList<>());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ try {
|
|
|
|
|
+ setWeekList(ClassConvertUtils.stringToClassSnake(weeks, new TypeReference<List<Integer>>() {
|
|
|
|
|
+ }));
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ throw new ServiceException("字符串无法转List");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 把对象映射为字符串
|
|
|
|
|
+ */
|
|
|
|
|
+ public void setWeekList(List<Integer> weekList) {
|
|
|
|
|
+ if (CycleMode.EVERY_WEEK.equals(this.cycleMode)) {
|
|
|
|
|
+ this.weekList = weekList;
|
|
|
|
|
+ if (weekList.size() == 0) {
|
|
|
|
|
+ this.weeks = "";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.weeks = JSONUtil.toJsonStr(this.weekList);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public List<Integer> getWeekList() {
|
|
|
|
|
+ if (StringUtils.isNotBlank(this.weeks)) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ this.weekList = ClassConvertUtils.stringToClassSnake(this.weeks, new TypeReference<List<Integer>>() {
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ throw new ServiceException("字符串无法转List");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return this.weekList;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|