Commit 151cf9ee authored by zhangfeng's avatar zhangfeng

Merge branch 'refs/heads/feature_member_score' into dev

parents dcf977b6 10a21b3e
package cn.iocoder.yudao.framework.snowflake.config;
import cn.hutool.core.lang.generator.SnowflakeGenerator;
import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration;
import cn.iocoder.yudao.framework.redis.helper.RedisHelper;
import io.micrometer.core.instrument.util.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.annotation.Resource;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
* @author zhaobiyan
*/
@Slf4j
@Configuration
@AutoConfigureAfter(YudaoRedisAutoConfiguration.class)
public class SnowFlakeConfiguration {
@Resource
private RedisHelper redisHelper;
@Bean
public SnowflakeGenerator snowflakeGenerator() throws UnknownHostException {
String hostAddress = InetAddress.getLocalHost().getHostAddress();
log.info("snow flask configuration, host address:{}", hostAddress);
String workId = redisHelper.get("snowflake:work:id:" + hostAddress);
if (StringUtils.isBlank(workId)) {
Long nextWorkId = redisHelper.incrBy("incr:work:id", 1);
redisHelper.set("snowflake:work:id:" + hostAddress, String.valueOf(nextWorkId));
workId = String.valueOf(nextWorkId);
}
return new SnowflakeGenerator(Long.parseLong(workId), 0);
}
}
...@@ -25,4 +25,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ ...@@ -25,4 +25,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
cn.iocoder.yudao.framework.pay.config.YudaoPayAutoConfiguration,\ cn.iocoder.yudao.framework.pay.config.YudaoPayAutoConfiguration,\
cn.iocoder.yudao.framework.customizer.CustomizationAutoConfiguration,\ cn.iocoder.yudao.framework.customizer.CustomizationAutoConfiguration,\
cn.iocoder.yudao.framework.i18n.config.LocaleAutoConfiguration,\ cn.iocoder.yudao.framework.i18n.config.LocaleAutoConfiguration,\
cn.iocoder.yudao.framework.limiter.RedisLimiterConfiguration cn.iocoder.yudao.framework.limiter.RedisLimiterConfiguration,\
cn.iocoder.yudao.framework.snowflake.config.SnowFlakeConfiguration
package cn.iocoder.yudao.module.member.controller.admin.memberUserScore;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.member.service.memberUserScore.MemberUserScoreService;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreBackVO;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreQueryVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated
@RestController
@Api(tags = "管理后台 - 会员积分")
@RequestMapping("/member/user-score")
public class MemberUserScoreController {
@Resource
private MemberUserScoreService userScoreService;
@PostMapping("/page")
@ApiOperation("获得会员积分分页")
@PreAuthorize("@ss.hasPermission('member:user-score:query')")
public CommonResult<PageResult<MemberUserScoreBackVO>> getUserScorePage(@Valid @RequestBody MemberUserScoreQueryVO query) {
PageResult<MemberUserScoreBackVO> pageResult = userScoreService.getUserScorePage(query);
return success(pageResult);
}
}
package cn.iocoder.yudao.module.member.controller.admin.memberUserScoreLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.service.memberUserScoreLog.MemberUserScoreLogService;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogBackVO;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogQueryVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated
@RestController
@Api(tags = "管理后台 - 会员积分记录")
@RequestMapping("/member/user-score-log")
public class MemberUserScoreLogController {
@Resource
private MemberUserScoreLogService memberUserScoreLogService;
@PostMapping("/page")
@ApiOperation("获得积分记录分页")
@PreAuthorize("@ss.hasPermission('member:user-score-log:query')")
public CommonResult<PageResult<MemberUserScoreLogBackVO>> page(@Valid @RequestBody MemberUserScoreLogQueryVO query) {
PageResult<MemberUserScoreLogBackVO> pageResult = memberUserScoreLogService.getPage(query);
return success(pageResult);
}
}
package cn.iocoder.yudao.module.member.convert.memberUserScore;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* 会员积分 Convert
* @author 系统管理员
*/
@Mapper
public interface MemberUserScoreConvert {
/*****转换MapStruct*****/
MemberUserScoreConvert INSTANCE = Mappers.getMapper(MemberUserScoreConvert.class);
}
package cn.iocoder.yudao.module.member.convert.memberUserScoreLog;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* 会员积分 Convert
* @author 系统管理员
*/
@Mapper
public interface MemberUserScoreLogConvert {
/*****转换MapStruct*****/
MemberUserScoreLogConvert INSTANCE = Mappers.getMapper(MemberUserScoreLogConvert.class);
}
package cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore;
public class MemberUserScoreBackDO {
}
package cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/**
* 会员积分 DO
*
* @author 系统管理员
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("member_user_score")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MemberUserScoreDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 会员id
*/
private Long memberId;
/**
* 持有积分
*/
private Integer holdScore;
/**
* 已使用积分
*/
private Integer usedScore;
/**
* 过期积分
*/
private Integer expiredScore;
}
package cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreLog;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("member_user_score_log")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MemberUserScoreLogDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 会员id
*/
private Long memberId;
private Integer scoreCount;
private Integer operateType;
private Integer sourceType;
private Long ruleId;
private String extParam = "{}";
}
package cn.iocoder.yudao.module.member.dal.mysql.memberUserScore;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore.MemberUserScoreDO;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreBackVO;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreQueryVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 会员积分 Mapper
* @author 系统管理员
*/
@Mapper
public interface MemberUserScoreMapper extends AbstractMapper<MemberUserScoreDO> {
List<MemberUserScoreBackVO> getUserScoreList(@Param("start") int start,@Param("size") int size,@Param("query") MemberUserScoreQueryVO query);
int countUserScore(@Param("query") MemberUserScoreQueryVO query);
}
package cn.iocoder.yudao.module.member.dal.mysql.memberUserScoreLog;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreLog.MemberUserScoreLogDO;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogBackVO;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogQueryVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 会员积分 Mapper
* @author 系统管理员
*/
@Mapper
public interface MemberUserScoreLogMapper extends AbstractMapper<MemberUserScoreLogDO> {
List<MemberUserScoreLogBackVO> getPageRecordList(@Param("start") int start, @Param("size") int size, @Param("query") MemberUserScoreLogQueryVO query);
int getPageCount(@Param("query") MemberUserScoreLogQueryVO query);
}
package cn.iocoder.yudao.module.member.service.memberUserScore;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.module.member.vo.memberUserScore.*;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore.MemberUserScoreDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
* 会员积分 Service 接口
*
* @author 系统管理员
*/
public interface MemberUserScoreService extends IService<MemberUserScoreDO> {
/**
* 删除会员积分
* @param id 编号
*/
void deleteUserScore(Long id);
/**
* 获得会员积分
* @param id 编号
* @return 会员积分
*/
MemberUserScoreDO getUserScore(Long id);
/**
* 获得会员积分列表
* @param ids 编号
* @return 会员积分列表
*/
List<MemberUserScoreDO> getUserScoreList(Collection<Long> ids);
/**
* 获得会员积分分页
* @param query 查询
* @return 会员积分分页
*/
PageResult<MemberUserScoreBackVO> getUserScorePage(MemberUserScoreQueryVO query);
/**
* 获得会员积分列表, 用于 Excel 导出
* @param query 查询
* @return 会员积分列表
*/
List<MemberUserScoreDO> getUserScoreList(MemberUserScoreQueryVO query);
}
package cn.iocoder.yudao.module.member.service.memberUserScore;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore.MemberUserScoreDO;
import cn.iocoder.yudao.module.member.dal.mysql.memberUserScore.MemberUserScoreMapper;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreBackVO;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreQueryVO;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
/**
* 会员积分 Service 实现类
*
* @author 系统管理员
*/
@Service
@Validated
public class MemberUserScoreServiceImpl extends AbstractService<MemberUserScoreMapper, MemberUserScoreDO> implements MemberUserScoreService {
@Resource
private MemberUserScoreMapper userScoreMapper;
@Override
public void deleteUserScore(Long id) {
// 删除
userScoreMapper.deleteById(id);
}
@Override
public MemberUserScoreDO getUserScore(Long id) {
return userScoreMapper.selectById(id);
}
@Override
public List<MemberUserScoreDO> getUserScoreList(Collection<Long> ids) {
return userScoreMapper.selectBatchIds(ids);
}
@Override
public PageResult<MemberUserScoreBackVO> getUserScorePage(MemberUserScoreQueryVO query) {
int start = (query.getPageNo() - 1) * query.getPageSize();
int size = query.getPageSize();
List<MemberUserScoreBackVO> list = userScoreMapper.getUserScoreList(start, size, query);
int total = userScoreMapper.countUserScore(query);
return new PageResult<>(list, total, query.getPageSize(), query.getPageNo(), (total + query.getPageSize() - 1) / query.getPageSize());
}
@Override
public List<MemberUserScoreDO> getUserScoreList(MemberUserScoreQueryVO query) {
return userScoreMapper.selectList(query);
}
}
package cn.iocoder.yudao.module.member.service.memberUserScoreLog;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreLog.MemberUserScoreLogDO;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogBackVO;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogQueryVO;
/**
* 会员积分日志 Service 接口
*
* @author 系统管理员
*/
public interface MemberUserScoreLogService extends IService<MemberUserScoreLogDO> {
PageResult<MemberUserScoreLogBackVO> getPage(MemberUserScoreLogQueryVO query);
}
package cn.iocoder.yudao.module.member.service.memberUserScoreLog;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreLog.MemberUserScoreLogDO;
import cn.iocoder.yudao.module.member.dal.mysql.memberUserScoreLog.MemberUserScoreLogMapper;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogBackVO;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogQueryVO;
import cn.iocoder.yudao.module.system.service.dict.DictTypeService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.List;
/**
* 会员积分日志 Service 实现类
*
* @author 系统管理员
*/
@Service
@Validated
public class MemberUserScoreLogServiceImpl extends AbstractService<MemberUserScoreLogMapper, MemberUserScoreLogDO> implements MemberUserScoreLogService {
@Resource
private MemberUserScoreLogMapper userScoreLogMapper;
@Resource
private DictTypeService dictTypeService;
@Override
public PageResult<MemberUserScoreLogBackVO> getPage(MemberUserScoreLogQueryVO query) {
int start = (query.getPageNo() - 1) * query.getPageSize();
int size = query.getPageSize();
List<MemberUserScoreLogBackVO> list = userScoreLogMapper.getPageRecordList(start, size, query);
int total = userScoreLogMapper.getPageCount(query);
return new PageResult<>(list, total, query.getPageSize(), query.getPageNo(), (total + query.getPageSize() - 1) / query.getPageSize());
}
}
package cn.iocoder.yudao.module.member.vo.memberUserScore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author zhaobiyan
*/
@Data
@ApiModel("管理后台 - 会员积分查询 VO")
public class MemberUserScoreBackVO {
@ApiModelProperty(value = "会员id")
private String id;
@ApiModelProperty(value = "会员昵称")
private String nickname;
@ApiModelProperty(value = "联系方式")
private String areaCode;
@ApiModelProperty(value = "手机号")
private String mobile;
@ApiModelProperty(value = "国家(中文)")
private String countryNameZh;
@ApiModelProperty(value = "国家(英文)")
private String countryNameEn;
@ApiModelProperty(value = "当前积分")
private Integer holdScore;
@ApiModelProperty(value = "已兑换积分")
private Integer usedScore;
@ApiModelProperty(value = "会员注册时间")
private Date createTime;
}
package cn.iocoder.yudao.module.member.vo.memberUserScore;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author zhaobiyan
*/
@Data
@ApiModel("管理后台 - 会员积分查询 VO")
public class MemberUserScoreQueryVO extends PageParam {
@ApiModelProperty(value = "关键词")
private String key;
@ApiModelProperty(value = "国家")
private Integer country;
@ApiModelProperty(value = "当前积分")
private Integer holdScore;
@ApiModelProperty(value = "当前积分操作")
private Integer holdScoreOperate;
@ApiModelProperty(value = "已使用积分")
private Integer usedScore;
@ApiModelProperty(value = "已使用积分操作")
private Integer usedScoreOperate;
@ApiModelProperty(value = "会员创建时间开始")
private Date startTime;
@ApiModelProperty(value = "会员创建时间结束")
private Date endTime;
}
package cn.iocoder.yudao.module.member.vo.memberUserScoreLog;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
import java.util.Collections;
import java.util.Date;
import java.util.Map;
/**
* @author zhaobiyan
*/
@Data
@ApiModel("管理后台 - 积分记录查询 VO")
public class MemberUserScoreLogBackVO {
@ApiModelProperty(value = "积分记录id")
private Long id;
@ApiModelProperty(value = "会员id")
private Long memberId;
@ApiModelProperty(value = "会员昵称")
private String memberName;
@ApiModelProperty(value = "积分数量")
private Integer scoreCount;
@ApiModelProperty(value = "操作类别")
private Integer operateType;
@ApiModelProperty(value = "积分来源")
private Integer sourceType;
@ApiModelProperty(value = "规则标题(中文)")
private String ruleTitleZh;
@ApiModelProperty(value = "规则标题(英文)")
private String ruleTitleEn;
@ApiModelProperty(value = "规则说明(中文)")
private String ruleDescZh;
@ApiModelProperty(value = "规则说明(英文)")
private String ruleDescEn;
@ApiModelProperty(value = "规则封面(中文)")
private String coverImageZh;
@ApiModelProperty(value = "规则封面(英文)")
private String coverImageEn;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "扩展参数")
private String extParam;
public JSONObject getExtParamJson() {
if (StringUtils.isBlank(extParam)) {
return new JSONObject();
}
return JSONUtil.parseObj(extParam);
}
}
package cn.iocoder.yudao.module.member.vo.memberUserScoreLog;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author zhaobiyan
*/
@Data
@ApiModel("管理后台 - 积分记录查询 VO")
public class MemberUserScoreLogQueryVO extends PageParam {
@ApiModelProperty(value = "关键词")
private String key;
@ApiModelProperty(value = "积分来源")
private Integer sourceType;
@ApiModelProperty(value = "规则标题")
private String ruleTitle;
@ApiModelProperty(value = "规则说明")
private String ruleDesc;
@ApiModelProperty(value = "积分数值")
private Integer scoreCount;
@ApiModelProperty(value = "积分数值操作")
private Integer scoreCountOperate;
@ApiModelProperty(value = "开始时间")
private Date startTime;
@ApiModelProperty(value = "结束时间")
private Date endTime;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.member.dal.mysql.memberUserScoreLog.MemberUserScoreLogMapper">
<select id="getPageRecordList"
resultType="cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogBackVO">
select
musl.id as id,
musl.member_id as memberId,
mu.nickname as memberName,
musl.score_count as scoreCount,
musl.operate_type as operateType,
musl.source_type as sourceType,
sr.title_zh as ruleTitleZh,
sr.title_en as ruleTitleEn,
sr.desc_zh as ruleDescZh,
sr.desc_en as ruleDescEn,
sr.cover_image_zh as coverImageZh,
sr.cover_image_en as coverImageEn,
musl.create_time as createTime,
musl.ext_param as extParam
from member_user_score_log musl
left join member_user mu on mu.id = musl.member_id
left join score_rule sr on sr.id = musl.rule_id
where 1=1
<include refid="pageCondition"/>
order by musl.create_time desc
limit #{start}, #{size}
</select>
<select id="getPageCount" resultType="java.lang.Integer">
select count(*)
from member_user_score_log musl
left join member_user mu on mu.id = musl.member_id
left join score_rule sr on sr.id = musl.rule_id
where 1=1
<include refid="pageCondition"/>
</select>
<sql id="pageCondition">
<if test="query.key !=null and query.key != ''">
and (mu.nickname like '%${query.key}%' or mu.mobile like '%${query.key}%')
</if>
<if test="query.sourceType !=null">
and musl.source_type = #{query.sourceType}
</if>
<if test="query.ruleTitle !=null and query.ruleTitle !=''">
and (sr.title_zh like '%${query.ruleTitle}%' or sr.title_en like '%${query.ruleTitle}%')
</if>
<if test="query.ruleDesc !=null and query.ruleDesc !=''">
and (sr.desc_zh like '%${query.ruleDesc}%' or sr.desc_en like '%${query.ruleDesc}%')
</if>
<if test="query.startTime != null ">
and musl.create_time &gt;= #{query.startTime}
</if>
<if test="query.endTime != null ">
and musl.create_time &lt;= #{query.endTime}
</if>
<if test="query.scoreCount != null and query.scoreCountOperate != null">
<!--1:大于 2:等于 3:小于-->
<if test="query.scoreCountOperate == 1">
and musl.score_count &gt; #{query.scoreCount}
</if>
<if test="query.scoreCountOperate == 2">
and musl.score_count = #{query.scoreCount}
</if>
<if test="query.scoreCountOperate == 3">
and musl.score_count &lt; #{query.scoreCount}
</if>
</if>
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.member.dal.mysql.memberUserScore.MemberUserScoreMapper">
<select id="getUserScoreList"
resultType="cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreBackVO">
select
mu.id,
mu.nickname,
mu.area_code as areaCode,
mu.mobile,
re.title_zh as countryNameZh,
re.title_en as countryNameEn,
mus.hold_score as holdScore,
mus.used_score as usedScore,
mu.create_time as createTime
from member_user mu
left join member_user_score mus on mus.member_id = mu.id
left join ecw_region re on re.id = mu.country
where 1 = 1
<include refid="scoreCondition"/>
order by mu.id
limit #{start}, #{size}
</select>
<select id="countUserScore" resultType="java.lang.Integer">
select
count(*)
from member_user mu
left join member_user_score mus on mus.member_id = mu.id
left join ecw_region re on re.id = mu.country
where 1 = 1
<include refid="scoreCondition"/>
</select>
<sql id="scoreCondition">
<if test="query.key != null and query.key != ''">
and (mu.nickname like '%${query.key}%' or mu.mobile like '%${query.key}%')
</if>
<if test="query.country != null">
and mu.country = #{query.country}
</if>
<if test="query.startTime != null ">
and mu.create_time &gt;= #{query.startTime}
</if>
<if test="query.endTime != null ">
and mu.create_time &lt;= #{query.endTime}
</if>
<if test="query.usedScore != null and query.usedScoreOperate != null">
<!--1:大于 2:等于 3:小于-->
<if test="query.usedScoreOperate == 1">
and mus.used_score &gt; #{query.usedScore}
</if>
<if test="query.usedScoreOperate == 2">
and mus.used_score = #{query.usedScore}
</if>
<if test="query.usedScoreOperate == 3">
and mus.used_score &lt; #{query.usedScore}
</if>
</if>
<if test="query.holdScore != null and query.holdScoreOperate != null">
<!--1:大于 2:等于 3:小于-->
<if test="query.holdScoreOperate == 1">
and mus.hold_score &gt; #{query.holdScore}
</if>
<if test="query.holdScoreOperate == 2">
and mus.hold_score = #{query.holdScore}
</if>
<if test="query.holdScoreOperate == 3">
and mus.hold_score &lt; #{query.holdScore}
</if>
</if>
</sql>
</mapper>
package cn.iocoder.yudao.module.reward.api.reward;
import cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardReqVO;
import cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardRespDTO;
import java.util.List;
/**
* 礼品兑换 api 接口
*/
public interface RedeemRewardApi {
RedeemRewardRespDTO redeemReward(RedeemRewardReqVO redeemRewardReqVO);
List<RedeemRewardRespDTO> redeemRewards(List<RedeemRewardReqVO> redeemRewardReqVOList);
}
package cn.iocoder.yudao.module.reward.api.reward.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@ApiModel("管理后台 - 礼品兑换 Request VO")
public class RedeemRewardReqVO {
@ApiModelProperty(value = "会员名称")
private String memberName;
@ApiModelProperty(value = "当前积分")
private Integer score;
@ApiModelProperty(value = "礼品id")
private Long rewardId;
@ApiModelProperty(value = "兑换数量")
private Integer count;
@ApiModelProperty(value = "兑换方式,同领取方式(1上门领取,2包邮到家,3邮寄到付)")
private Integer pickMethod;
@ApiModelProperty(value = "兑换入口(后台,app,web)")
private String entrance;
@ApiModelProperty(value = "费用数字(两位小数)")
private Integer expenses;
@ApiModelProperty(value = "费用币种(字典配置)")
private Integer currency;
@ApiModelProperty(value = "收件人姓名")
private String recipientName;
@ApiModelProperty(value = "收件人电话")
private String recipientPhoneNum;
@ApiModelProperty(value = "收件人地址")
private String recipientAddress;
@ApiModelProperty(value = "兑换人")
private String redeemer;
@ApiModelProperty(value = "兑换时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date redemptionTime;
@ApiModelProperty(value = "快递公司")
private String courierCompany;
@ApiModelProperty(value = "快递单号")
private String expressNo;
@ApiModelProperty(value = "快递日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date expressDate;
@ApiModelProperty(value = "快递寄出人")
private String expressSender;
@ApiModelProperty(value = "上传附件")
private String annex;
@ApiModelProperty(value = "备注")
private String remark;
}
package cn.iocoder.yudao.module.reward.api.reward.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("管理后台 - 礼品兑换 Response VO")
public class RedeemRewardRespDTO {
@ApiModelProperty(value = "兑换操作结果")
private Boolean exchangeResult;
@ApiModelProperty(value = "兑换操作详情")
private String msg;
}
...@@ -6,6 +6,16 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; ...@@ -6,6 +6,16 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
// TODO 待办:请将下面的错误码复制到 yudao-module-reward-api 模块的 ErrorCodeConstants 类中。注意,请给“TODO 补充编号”设置一个错误码编号!!! // TODO 待办:请将下面的错误码复制到 yudao-module-reward-api 模块的 ErrorCodeConstants 类中。注意,请给“TODO 补充编号”设置一个错误码编号!!!
// ========== 礼品 TODO 补充编号 ========== // ========== 礼品 TODO 补充编号 ==========
public interface ErrorCodeConstants { public interface ErrorCodeConstants {
ErrorCode _NOT_EXISTS = new ErrorCode(1009011000, "礼品不存在"); ErrorCode REWARD_NOT_EXISTS = new ErrorCode(1010011001, "礼品不存在");
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, "礼物不能启用");
} }
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);
} }
} }
package cn.iocoder.yudao.module.reward.api.reward;
import cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardReqVO;
import cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardRespDTO;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.List;
@Service
@Validated
public class RedeemRewardApiImpl implements RedeemRewardApi {
@Override
public RedeemRewardRespDTO redeemReward(RedeemRewardReqVO redeemRewardReqVO) {
return null;
}
@Override
public List<RedeemRewardRespDTO> redeemRewards(List<RedeemRewardReqVO> redeemRewardReqVOList) {
return null;
}
}
package cn.iocoder.yudao.module.reward.controller.admin.reward;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.reward.api.reward.RedeemRewardApi;
import cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardReqVO;
import cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardRespDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated
@RestController
@Api(tags = "管理后台 - 礼品管理")
@RequestMapping("/reward/redeem")
public class RedeemRewardController {
@Resource
private RedeemRewardApi redeemRewardApi;
@PostMapping("/single")
@ApiOperation("兑换礼品")
//@PreAuthorize("@ss.hasPermission('reward::redeem')")
public CommonResult<RedeemRewardRespDTO> redeemReward(@Valid @RequestBody RedeemRewardReqVO redeemRewardReqVO) {
return success(redeemRewardApi.redeemReward(redeemRewardReqVO));
}
@PostMapping("/batch")
@ApiOperation("批量兑换礼品")
//@PreAuthorize("@ss.hasPermission('reward::redeem')")
public CommonResult<List<RedeemRewardRespDTO>> redeemRewards(@Valid @RequestBody List<RedeemRewardReqVO> redeemRewardReqVOList) {
return success(redeemRewardApi.redeemRewards(redeemRewardReqVOList));
}
}
...@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
...@@ -63,7 +64,7 @@ public class RewardController { ...@@ -63,7 +64,7 @@ public class RewardController {
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
//@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)); return success(RewardConvert.INSTANCE.convert(rewardDO));
} }
...@@ -88,7 +89,20 @@ public class RewardController { ...@@ -88,7 +89,20 @@ public class RewardController {
@ApiOperation("礼品状态变更") @ApiOperation("礼品状态变更")
//@PreAuthorize("@ss.hasPermission('reward::query')") //@PreAuthorize("@ss.hasPermission('reward::query')")
public CommonResult<Boolean> updateStatus(@Valid @RequestBody RewardStatusReqVO statusVO) { public CommonResult<Boolean> updateStatus(@Valid @RequestBody RewardStatusReqVO statusVO) {
rewardService.updateById(RewardConvert.INSTANCE.convertStatusReqVO(statusVO)); rewardService.updateStatus(statusVO);
return success(true);
}
@PostMapping("/copy/{id}")
@ApiOperation("复制礼品")
public CommonResult<Long> copyReward(@NotNull @PathVariable Long id) {
return success(rewardService.copyReward(id));
}
@PostMapping("/delay")
@ApiOperation("礼品延期")
public CommonResult<Boolean> delayReward(@Valid @RequestBody RewardDelayReqVO delayVO) {
rewardService.delayReward(delayVO);
return success(true); return success(true);
} }
...@@ -97,7 +111,7 @@ public class RewardController { ...@@ -97,7 +111,7 @@ public class RewardController {
//@PreAuthorize("@ss.hasPermission('reward::export')") //@PreAuthorize("@ss.hasPermission('reward::export')")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public void exportExcel(@Valid RewardQueryVO query, public void exportExcel(@Valid RewardQueryVO query,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
List<RewardDO> list = rewardService.getList(query); List<RewardDO> list = rewardService.getList(query);
// 导出 Excel // 导出 Excel
List<RewardBackVO> datas = RewardConvert.INSTANCE.convertList(list); List<RewardBackVO> datas = RewardConvert.INSTANCE.convertList(list);
......
package cn.iocoder.yudao.module.reward.convert.reward;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.reward.vo.reward.*;
import cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO;
/**
* 礼品 Convert
* @author 系统管理员
*/
@Mapper
public interface RewardConvert {
/*****转换MapStruct*****/
RewardConvert INSTANCE = Mappers.getMapper(RewardConvert.class);
/***
* 创建VO转实体
* @param bean
* @return
*/
RewardDO convert(RewardCreateReqVO bean);
/***
* 修改VO转实体
* @param bean
* @return
*/
RewardDO convert(RewardUpdateReqVO bean);
/***
* 实体转返回VO
* @param bean
* @return
*/
RewardBackVO convert(RewardDO bean);
/***
* 实体列表转返回VO列表
* @param list
* @return
*/
List<RewardBackVO> convertList(List<RewardDO> list);
/***
* 实体分页转返回分页
* @param page
* @return
*/
PageResult<RewardBackVO> convertPage(PageResult<RewardDO> page);
/***
* 更新礼品状态VO转实体
* @param bean
* @return
*/
RewardDO convertStatusReqVO(RewardStatusReqVO bean);
/***
* 礼品延期VO转实体
* @param bean
* @return
*/
RewardDO convertDelayReqVO(RewardDelayReqVO bean);
}
package cn.iocoder.yudao.module.reward.dal.dataobject.reward;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.util.Date;
/**
* 礼品 DO
*
* @author 系统管理员
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("ecw_reward")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class RewardDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 礼品ID
*/
private String code;
/**
* 中文名称
*/
private String titleZh;
/**
* 英文名称
*/
private String titleEn;
/**
* 法文名称
*/
private String titleFr;
/**
* 中文礼品图片
*/
private String imgZh;
/**
* 英文礼品图片
*/
private String imgEn;
/**
* 法文礼品图片
*/
private String imgFr;
/**
* 兑换所需积分
*/
private Integer pointsRequire;
/**
* 兑换网点
*/
private Integer nodeId;
/**
* 已兑换次数
*/
private Integer exchangeCount;
/**
* 剩余数量
*/
private Integer quantityRemain;
/**
* 活动开始时间
*/
private Date startTime;
/**
* 活动结束时间
*/
private Date endTime;
/**
* 领取方式(1上门领取,2包邮到家,3邮寄到付)
*/
private Integer pickMethod;
/**
* 允许兑换次数
*/
private Integer allowCount;
/**
* 中文备注
*/
private String remarkZh;
/**
* 英文备注
*/
private String remarkEn;
/**
* 法文备注
*/
private String remarkFr;
/**
* 礼品状态(1已启用,2未启用,3已关闭,4已过期)
*/
private Integer status;
}
package cn.iocoder.yudao.module.reward.dal.mysql.reward;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardQueryVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 礼品 Mapper
* @author 系统管理员
*/
@Mapper
public interface RewardMapper extends AbstractMapper<RewardDO> {
@Override
default PageResult<RewardDO> selectPage(PageVO page, Object object) {
if (object instanceof RewardQueryVO) {
RewardQueryVO vo = (RewardQueryVO)object;
return selectPage(page, new LambdaQuery<RewardDO>()
.eqIfPresent(RewardDO::getCode, vo.getCode())
.eqIfPresent(RewardDO::getTitleZh, vo.getTitle())
.eqIfPresent(RewardDO::getTitleEn, vo.getTitle())
.eqIfPresent(RewardDO::getTitleFr, vo.getTitle())
.eqIfPresent(RewardDO::getPointsRequire, vo.getPointsRequire())
.eqIfPresent(RewardDO::getNodeId, vo.getNodeId())
.eqIfPresent(RewardDO::getQuantityRemain, vo.getQuantityRemain())
.eqIfPresent(RewardDO::getPickMethod, vo.getPickMethod())
.eqIfPresent(RewardDO::getStatus, vo.getStatus())
.betweenIfPresent(RewardDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
.orderByDesc(RewardDO::getId));
}
return null;
}
@Override
default List<RewardDO> selectList(Object object) {
if (object instanceof RewardQueryVO) {
RewardQueryVO vo = (RewardQueryVO)object;
return selectList(new LambdaQuery<RewardDO>()
.eqIfPresent(RewardDO::getCode, vo.getCode())
.eqIfPresent(RewardDO::getTitleZh, vo.getTitle())
.eqIfPresent(RewardDO::getTitleEn, vo.getTitle())
.eqIfPresent(RewardDO::getTitleFr, vo.getTitle())
.eqIfPresent(RewardDO::getPointsRequire, vo.getPointsRequire())
.eqIfPresent(RewardDO::getNodeId, vo.getNodeId())
.eqIfPresent(RewardDO::getQuantityRemain, vo.getQuantityRemain())
.eqIfPresent(RewardDO::getPickMethod, vo.getPickMethod())
.eqIfPresent(RewardDO::getStatus, vo.getStatus())
.betweenIfPresent(RewardDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
.orderByDesc(RewardDO::getId));
}
return null;
}
}
package cn.iocoder.yudao.module.reward.service.reward;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO;
import cn.iocoder.yudao.module.reward.vo.reward.*;
import javax.validation.Valid;
import java.util.Collection;
import java.util.List;
/**
* 礼品 Service 接口
*
* @author 系统管理员
*/
public interface RewardService extends IService<RewardDO> {
/**
* 创建礼品
* @param createReqVO 创建信息
* @return 编号
*/
Long create(@Valid RewardCreateReqVO createReqVO);
/**
* 更新礼品
* @param updateReqVO 更新信息
*/
void update(@Valid RewardUpdateReqVO updateReqVO);
/**
* 删除礼品
* @param id 编号
*/
void delete(Long id);
/**
* 获得礼品
* @param id 编号
* @return 礼品
*/
RewardDO get(Long id);
/**
* 获得礼品列表
* @param ids 编号
* @return 礼品列表
*/
List<RewardDO> getList(Collection<Long> ids);
/**
* 获得礼品分页
* @param page 分页查询
* @param query 查询
* @return 礼品分页
*/
PageResult<RewardDO> getPage(RewardQueryVO query, PageVO page);
/**
* 获得礼品列表, 用于 Excel 导出
* @param query 查询
* @return 礼品列表
*/
List<RewardDO> getList(RewardQueryVO query);
/**
* 复制礼品
* @param id 编号
* @return 新的礼品id
*/
Long copyReward(Long id);
void delayReward(RewardDelayReqVO delayVO);
void updateStatus(RewardStatusReqVO statusVO);
}
package cn.iocoder.yudao.module.reward.vo.reward;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 礼品 Response VO
* @author 系统管理员
*/
@Data
@ApiModel("管理后台 - 礼品 Response VO")
public class RewardBackVO {
@ExcelProperty("")
@ApiModelProperty(value = "", required = true)
private Long id;
@ExcelProperty("礼品ID")
@ApiModelProperty(value = "礼品ID", required = true)
private String code;
@ExcelProperty("中文名称")
@ApiModelProperty(value = "中文名称")
private String titleZh;
@ExcelProperty("英文名称")
@ApiModelProperty(value = "英文名称")
private String titleEn;
@ExcelProperty("法文名称")
@ApiModelProperty(value = "法文名称")
private String titleFr;
@ExcelProperty("中文礼品图片")
@ApiModelProperty(value = "中文礼品图片")
private String imgZh;
@ExcelProperty("英文礼品图片")
@ApiModelProperty(value = "英文礼品图片")
private String imgEn;
@ExcelProperty("法文礼品图片")
@ApiModelProperty(value = "法文礼品图片")
private String imgFr;
@ExcelProperty("兑换所需积分")
@ApiModelProperty(value = "兑换所需积分", required = true)
private Integer pointsRequire;
@ExcelProperty("兑换网点")
@ApiModelProperty(value = "兑换网点", required = true)
private Integer nodeId;
@ExcelProperty("已兑换次数")
@ApiModelProperty(value = "已兑换次数")
private Integer exchangeCount;
@ExcelProperty("剩余数量")
@ApiModelProperty(value = "剩余数量", required = true)
private Integer quantityRemain;
@ExcelProperty("活动开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "活动开始时间")
private Date startTime;
@ExcelProperty("活动结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "活动结束时间")
private Date endTime;
@ExcelProperty("领取方式(1上门领取,2包邮到家,3邮寄到付)")
@ApiModelProperty(value = "领取方式(1上门领取,2包邮到家,3邮寄到付)", required = true)
private Integer pickMethod;
@ExcelProperty("允许兑换次数")
@ApiModelProperty(value = "允许兑换次数", required = true)
private Integer allowCount;
@ExcelProperty("中文备注")
@ApiModelProperty(value = "中文备注")
private String remarkZh;
@ExcelProperty("英文备注")
@ApiModelProperty(value = "英文备注")
private String remarkEn;
@ExcelProperty("法文备注")
@ApiModelProperty(value = "法文备注")
private String remarkFr;
@ExcelProperty("礼品状态(1已启用,2未启用,3已关闭,4已过期)")
@ApiModelProperty(value = "礼品状态(1已启用,2未启用,3已关闭,4已过期)", required = true)
private Integer status;
@ExcelProperty("创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}
package cn.iocoder.yudao.module.reward.vo.reward;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 礼品 Base VO,提供给添加、修改、详细的子 VO 使用
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
*/
@Data
public class RewardBaseVO {
@ApiModelProperty(value = "礼品ID")
private String code;
@ApiModelProperty(value = "中文名称")
private String titleZh;
@ApiModelProperty(value = "英文名称")
private String titleEn;
@ApiModelProperty(value = "法文名称")
private String titleFr;
@ApiModelProperty(value = "中文礼品图片")
private String imgZh;
@ApiModelProperty(value = "英文礼品图片")
private String imgEn;
@ApiModelProperty(value = "法文礼品图片")
private String imgFr;
@ApiModelProperty(value = "兑换所需积分")
private Integer pointsRequire;
@ApiModelProperty(value = "兑换网点")
private Integer nodeId;
@ApiModelProperty(value = "已兑换次数")
private Integer exchangeCount;
@ApiModelProperty(value = "剩余数量")
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 = "允许兑换次数")
private Integer allowCount;
@ApiModelProperty(value = "中文备注")
private String remarkZh;
@ApiModelProperty(value = "英文备注")
private String remarkEn;
@ApiModelProperty(value = "法文备注")
private String remarkFr;
@ApiModelProperty(value = "礼品状态(1已启用,2未启用,3已关闭,4已过期)")
private Integer status;
}
package cn.iocoder.yudao.module.reward.vo.reward;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@ToString(callSuper = true)
@ApiModel("管理后台 - 礼品创建 Request VO")
public class RewardCreateReqVO {
@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 = "兑换所需积分", required = true)
@NotNull(message = "兑换所需积分不能为空")
@Min(value = 0)
private Integer pointsRequire;
@ApiModelProperty(value = "兑换网点", required = true)
@NotNull(message = "兑换网点不能为空")
private Integer nodeId;
@ApiModelProperty(value = "剩余数量", required = true)
@NotNull(message = "剩余数量不能为空")
@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邮寄到付)", required = true)
@NotNull(message = "领取方式不能为空")
private Integer pickMethod;
@ApiModelProperty(value = "允许兑换次数", required = true)
@NotNull(message = "允许兑换次数不能为空")
@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;
@ApiModelProperty(value = "礼品状态(1已启用,2未启用,3已关闭,4已过期)", required = true)
@NotNull(message = "礼品状态不能为空")
private Integer status;
}
package cn.iocoder.yudao.module.reward.vo.reward;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@ApiModel("管理后台 - 礼品延期 VO")
public class RewardDelayReqVO {
@ApiModelProperty(value = "", required = true)
@NotNull(message = "不能为空")
private Long id;
@ApiModelProperty(value = "活动结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@NotNull(message = "结束时间不能为空")
private Date endTime;
}
package cn.iocoder.yudao.module.reward.vo.reward;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@ApiModel("管理后台 - 礼品查询 VO")
public class RewardQueryVO {
@ApiModelProperty(value = "礼品ID")
private String code;
@ApiModelProperty(value = "名称(不区分语言)")
private String title;
@ApiModelProperty(value = "兑换所需积分")
private Integer pointsRequire;
@ApiModelProperty(value = "兑换所需积分查询条件(1大于,2等于,3小于)")
private Integer pointsRequireSymbol;
@ApiModelProperty(value = "兑换网点")
private Integer nodeId;
@ApiModelProperty(value = "剩余数量")
private Integer quantityRemain;
@ApiModelProperty(value = "剩余数量查询条件(1大于,2等于,3小于)")
private Integer quantityRemainSymbol;
@ApiModelProperty(value = "领取方式(1上门领取,2包邮到家,3邮寄到付)")
private Integer pickMethod;
@ApiModelProperty(value = "礼品状态(1已启用,2未启用,3已关闭,4已过期)")
private Integer status;
@ApiModelProperty(value = "备注(不区分语言)")
private String remark;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
}
package cn.iocoder.yudao.module.reward.vo.reward;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
@ApiModel("管理后台 - 礼品状态更新 VO")
public class RewardStatusReqVO {
@ApiModelProperty(value = "", required = true)
@NotNull(message = "不能为空")
private Long id;
@ApiModelProperty(value = "礼品状态(1已启用,2未启用,3已关闭,4已过期)")
@NotNull(message = "礼品状态不能为空")
private Integer status;
}
package cn.iocoder.yudao.module.reward.vo.reward;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("管理后台 - 礼品更新 Request VO")
@Data
@ToString(callSuper = true)
public class RewardUpdateReqVO {
@ApiModelProperty(value = "", required = true)
@NotNull(message = "不能为空")
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;
}
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