Commit 98934eb2 authored by zhangfeng's avatar zhangfeng

Merge branch 'refs/heads/feature_member_score' into dev

parents b94a25e0 8c2c3f58
package cn.iocoder.yudao.module.reward.enums;
public enum RewardPickMethedEnum {
PICKUP(1, "上门领取"),
SEND_HOME_FREE(2, "包邮到家"),
SEND_HOME_PAY(3, "邮寄到付")
;
private final int value;
private final String name;
RewardPickMethedEnum(int value, String name) {
this.value = value;
this.name = name;
}
public int getValue() {
return value;
}
public String getName() {
return name;
}
}
...@@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.reward.convert.reward.RewardConvert; ...@@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.reward.convert.reward.RewardConvert;
import cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO; import cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO;
import cn.iocoder.yudao.module.reward.service.reward.RewardService; import cn.iocoder.yudao.module.reward.service.reward.RewardService;
import cn.iocoder.yudao.module.reward.vo.reward.*; import cn.iocoder.yudao.module.reward.vo.reward.*;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -65,7 +66,9 @@ public class RewardController { ...@@ -65,7 +66,9 @@ public class RewardController {
//@PreAuthorize("@ss.hasPermission('reward::query')") //@PreAuthorize("@ss.hasPermission('reward::query')")
public CommonResult<RewardBackVO> get(@RequestParam("id") Long id) { public CommonResult<RewardBackVO> get(@RequestParam("id") Long id) {
RewardDO rewardDO = rewardService.get(id); RewardDO rewardDO = rewardService.get(id);
return success(RewardConvert.INSTANCE.convert(rewardDO)); RewardBackVO rewardBackVO = RewardConvert.INSTANCE.convert(rewardDO);
addPickMethodList(rewardBackVO);
return success(rewardBackVO);
} }
@GetMapping("/list") @GetMapping("/list")
...@@ -74,7 +77,9 @@ public class RewardController { ...@@ -74,7 +77,9 @@ public class RewardController {
//@PreAuthorize("@ss.hasPermission('reward::query')") //@PreAuthorize("@ss.hasPermission('reward::query')")
public CommonResult<List<RewardBackVO>> getList(@RequestParam("ids") Collection<Long> ids) { public CommonResult<List<RewardBackVO>> getList(@RequestParam("ids") Collection<Long> ids) {
List<RewardDO> list = rewardService.getList(ids); List<RewardDO> list = rewardService.getList(ids);
return success(RewardConvert.INSTANCE.convertList(list)); List<RewardBackVO> rewardBackVOS = RewardConvert.INSTANCE.convertList(list);
rewardBackVOS.forEach(this::addPickMethodList);
return success(rewardBackVOS);
} }
@PostMapping("/page") @PostMapping("/page")
...@@ -82,7 +87,9 @@ public class RewardController { ...@@ -82,7 +87,9 @@ public class RewardController {
//@PreAuthorize("@ss.hasPermission('reward::query')") //@PreAuthorize("@ss.hasPermission('reward::query')")
public CommonResult<PageResult<RewardBackVO>> getPage(@Valid @RequestBody RewardQueryVO query, PageVO page) { public CommonResult<PageResult<RewardBackVO>> getPage(@Valid @RequestBody RewardQueryVO query, PageVO page) {
PageResult<RewardDO> pageResult = rewardService.getPage(query, page); PageResult<RewardDO> pageResult = rewardService.getPage(query, page);
return success(RewardConvert.INSTANCE.convertPage(pageResult)); PageResult<RewardBackVO> rewardBackVOPageResult = RewardConvert.INSTANCE.convertPage(pageResult);
rewardBackVOPageResult.getList().forEach(this::addPickMethodList);
return success(rewardBackVOPageResult);
} }
@PostMapping("/status") @PostMapping("/status")
...@@ -117,4 +124,8 @@ public class RewardController { ...@@ -117,4 +124,8 @@ public class RewardController {
List<RewardBackVO> datas = RewardConvert.INSTANCE.convertList(list); List<RewardBackVO> datas = RewardConvert.INSTANCE.convertList(list);
ExcelUtils.write(response, "礼品.xls", "数据", RewardBackVO.class, datas); ExcelUtils.write(response, "礼品.xls", "数据", RewardBackVO.class, datas);
} }
private void addPickMethodList (RewardBackVO rewardBackVO) {
rewardBackVO.setPickMethodList(JSON.parseArray(rewardBackVO.getPickMethod()));
}
} }
package cn.iocoder.yudao.module.reward.dal.dataobject.reward; package cn.iocoder.yudao.module.reward.dal.dataobject.reward;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*; import lombok.*;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 礼品 DO * 礼品 DO
...@@ -82,7 +84,7 @@ public class RewardDO extends BaseDO { ...@@ -82,7 +84,7 @@ public class RewardDO extends BaseDO {
* 领取方式(1上门领取,2包邮到家,3邮寄到付) * 领取方式(1上门领取,2包邮到家,3邮寄到付)
* TODO :改为枚举 * TODO :改为枚举
*/ */
private Integer pickMethod; private String pickMethod;
/** /**
* 允许兑换次数 * 允许兑换次数
*/ */
......
...@@ -8,6 +8,8 @@ import cn.iocoder.yudao.module.reward.convert.reward.RewardConvert; ...@@ -8,6 +8,8 @@ import cn.iocoder.yudao.module.reward.convert.reward.RewardConvert;
import cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO; import cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO;
import cn.iocoder.yudao.module.reward.dal.mysql.reward.RewardMapper; import cn.iocoder.yudao.module.reward.dal.mysql.reward.RewardMapper;
import cn.iocoder.yudao.module.reward.vo.reward.*; import cn.iocoder.yudao.module.reward.vo.reward.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -15,6 +17,7 @@ import org.springframework.validation.annotation.Validated; ...@@ -15,6 +17,7 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.Instant; import java.time.Instant;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -50,9 +53,9 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -50,9 +53,9 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
throw exception(REWARD_STATUS_NOT_ALLOW_CREATE); throw exception(REWARD_STATUS_NOT_ALLOW_CREATE);
} }
//领取方式只能是1,2,3 //领取方式只能是1,2,3
if (createReqVO.getPickMethod() != 1 && createReqVO.getPickMethod() != 2 && createReqVO.getPickMethod() != 3) { // if (createReqVO.getPickMethod() != 1 && createReqVO.getPickMethod() != 2 && createReqVO.getPickMethod() != 3) {
throw exception(REWARD_PICK_METHOD_NOT_ALLOW_CREATE); // throw exception(REWARD_PICK_METHOD_NOT_ALLOW_CREATE);
} // }
// 插入 // 插入
RewardDO rewardDO = RewardConvert.INSTANCE.convert(createReqVO); RewardDO rewardDO = RewardConvert.INSTANCE.convert(createReqVO);
rewardDO.setCode(generateRewardCode()); rewardDO.setCode(generateRewardCode());
...@@ -91,9 +94,9 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -91,9 +94,9 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW_CREATE); throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW_CREATE);
} }
//领取方式只能是1,2,3 //领取方式只能是1,2,3
if (updateReqVO.getPickMethod() != 1 && updateReqVO.getPickMethod() != 2 && updateReqVO.getPickMethod() != 3) { // if (updateReqVO.getPickMethod() != 1 && updateReqVO.getPickMethod() != 2 && updateReqVO.getPickMethod() != 3) {
throw exception(REWARD_PICK_METHOD_NOT_ALLOW_CREATE); // throw exception(REWARD_PICK_METHOD_NOT_ALLOW_CREATE);
} // }
updateObj = RewardConvert.INSTANCE.convert(updateReqVO); updateObj = RewardConvert.INSTANCE.convert(updateReqVO);
} else if (rewardDO.getStatus() == 1) { //已启用可编辑剩余数量和备注 } else if (rewardDO.getStatus() == 1) { //已启用可编辑剩余数量和备注
updateObj.setQuantityRemain(updateReqVO.getQuantityRemain()); updateObj.setQuantityRemain(updateReqVO.getQuantityRemain());
......
package cn.iocoder.yudao.module.reward.vo.reward; package cn.iocoder.yudao.module.reward.vo.reward;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.fastjson.JSONArray;
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 org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
...@@ -78,7 +80,11 @@ public class RewardBackVO { ...@@ -78,7 +80,11 @@ public class RewardBackVO {
@ExcelProperty("领取方式(1上门领取,2包邮到家,3邮寄到付)") @ExcelProperty("领取方式(1上门领取,2包邮到家,3邮寄到付)")
@ApiModelProperty(value = "领取方式(1上门领取,2包邮到家,3邮寄到付)", required = true) @ApiModelProperty(value = "领取方式(1上门领取,2包邮到家,3邮寄到付)", required = true)
private Integer pickMethod; private String pickMethod;
@ExcelProperty("领取方式(JSON数组)")
@ApiModelProperty(value = "领取方式(1上门领取,2包邮到家,3邮寄到付)")
private JSONArray pickMethodList;
@ExcelProperty("允许兑换次数") @ExcelProperty("允许兑换次数")
@ApiModelProperty(value = "允许兑换次数", required = true) @ApiModelProperty(value = "允许兑换次数", required = true)
......
package cn.iocoder.yudao.module.reward.vo.reward; package cn.iocoder.yudao.module.reward.vo.reward;
import com.alibaba.fastjson.JSONArray;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
...@@ -57,7 +59,10 @@ public class RewardBaseVO { ...@@ -57,7 +59,10 @@ public class RewardBaseVO {
private Date endTime; private Date endTime;
@ApiModelProperty(value = "领取方式(1上门领取,2包邮到家,3邮寄到付)") @ApiModelProperty(value = "领取方式(1上门领取,2包邮到家,3邮寄到付)")
private Integer pickMethod; private String pickMethod;
@ApiModelProperty(value = "领取方式(JSON数组)")
private JSONArray pickMethodList;
@ApiModelProperty(value = "允许兑换次数") @ApiModelProperty(value = "允许兑换次数")
private Integer allowCount; private Integer allowCount;
......
...@@ -10,6 +10,7 @@ import javax.validation.constraints.Min; ...@@ -10,6 +10,7 @@ import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.util.Date; import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
...@@ -61,9 +62,9 @@ public class RewardCreateReqVO { ...@@ -61,9 +62,9 @@ public class RewardCreateReqVO {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date endTime; private Date endTime;
@ApiModelProperty(value = "领取方式(1上门领取,2包邮到家,3邮寄到付)", required = true) @ApiModelProperty(value = "领取方式(1上门领取,2包邮到家,3邮寄到付)可以多选", required = true)
@NotNull(message = "领取方式不能为空") @NotNull(message = "领取方式不能为空")
private Integer pickMethod; private String pickMethod;
@ApiModelProperty(value = "允许兑换次数", required = true) @ApiModelProperty(value = "允许兑换次数", required = true)
@NotNull(message = "允许兑换次数不能为空") @NotNull(message = "允许兑换次数不能为空")
......
...@@ -35,7 +35,7 @@ public class RewardQueryVO { ...@@ -35,7 +35,7 @@ public class RewardQueryVO {
private Integer quantityRemainSymbol; private Integer quantityRemainSymbol;
@ApiModelProperty(value = "领取方式(1上门领取,2包邮到家,3邮寄到付)") @ApiModelProperty(value = "领取方式(1上门领取,2包邮到家,3邮寄到付)")
private Integer pickMethod; private String pickMethod;
@ApiModelProperty(value = "礼品状态(1已启用,2未启用,3已关闭,4已过期)") @ApiModelProperty(value = "礼品状态(1已启用,2未启用,3已关闭,4已过期)")
private Integer status; private Integer status;
......
...@@ -10,6 +10,7 @@ import javax.validation.constraints.Min; ...@@ -10,6 +10,7 @@ import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.util.Date; import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
...@@ -64,7 +65,7 @@ public class RewardUpdateReqVO { ...@@ -64,7 +65,7 @@ public class RewardUpdateReqVO {
private Date endTime; private Date endTime;
@ApiModelProperty(value = "领取方式(1上门领取,2包邮到家,3邮寄到付)") @ApiModelProperty(value = "领取方式(1上门领取,2包邮到家,3邮寄到付)")
private Integer pickMethod; private String pickMethod;
@ApiModelProperty(value = "允许兑换次数") @ApiModelProperty(value = "允许兑换次数")
@Min(value = 0) @Min(value = 0)
......
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