Commit 1d410cf4 authored by zhangfeng's avatar zhangfeng

Merge branch 'refs/heads/feature_member_score' into dev

parents 209eaded b48dc662
...@@ -44,5 +44,11 @@ public interface ErrorCodeConstants { ...@@ -44,5 +44,11 @@ public interface ErrorCodeConstants {
ErrorCode SCORE_COUNT_ERROR = new ErrorCode(1004008002, "score.count.error"); ErrorCode SCORE_COUNT_ERROR = new ErrorCode(1004008002, "score.count.error");
ErrorCode MEMBER_SCORE_NOT_ENOUGH = new ErrorCode(1004008002, "member.score.not.enough"); ErrorCode MEMBER_SCORE_NOT_ENOUGH = new ErrorCode(1004008003, "member.score.not.enough");
ErrorCode SCORE_RULE_NOT_EXISTS = new ErrorCode(1004008004, "score.rule.not.exists");
ErrorCode SCORE_RULE_DELETE_ERROR = new ErrorCode(1004008005, "score.rule.delete.error");
ErrorCode SCORE_RULE_UPDATE_ERROR = new ErrorCode(1004008005, "score.rule.update.error");
} }
package cn.iocoder.yudao.module.member.enums;
public enum PlatformTypeEnum {
BACKEND(1, "后台"),
APP(2, "APP"),
WEB(3, "WEB");
private final int value;
private final String name;
PlatformTypeEnum(int value, String name) {
this.value = value;
this.name = name;
}
public int getValue() {
return value;
}
public String getName() {
return name;
}
}
package cn.iocoder.yudao.module.member.enums;
public enum ScoreRuleStatusEnum {
ENABLED(1, "已启用"),
DISABLED(2, "未启用"),
CLOSED(3, "已关闭"),
EXPIRED(4, "已过期");
private final int value;
private final String name;
ScoreRuleStatusEnum(int value, String name) {
this.value = value;
this.name = name;
}
public int getValue() {
return value;
}
public String getName() {
return name;
}
}
package cn.iocoder.yudao.module.member.enums;
public enum ScoreRuleTypeEnum {
ORDER_V(1, "订单V值"),
REGISTER(2, "注册"),
RECOMMEND(3, "推荐"),
SHARE(4, "分享活动");
private final int value;
private final String name;
ScoreRuleTypeEnum(int value, String name) {
this.value = value;
this.name = name;
}
public int getValue() {
return value;
}
public String getName() {
return name;
}
}
package cn.iocoder.yudao.module.member.enums;
public enum YesOrNoTypeEnum {
YES,
NO;
}
package cn.iocoder.yudao.module.member.controller.admin.scoreRule;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.member.convert.scoreRule.ScoreRuleConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.scoreRule.ScoreRuleDO;
import cn.iocoder.yudao.module.member.service.scoreRule.ScoreRuleService;
import cn.iocoder.yudao.module.member.vo.scoreRule.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Validated
@RestController
@Api(tags = "管理后台 - 积分规则")
@RequestMapping("/member/score-rule")
public class ScoreRuleController {
@Resource
private ScoreRuleService scoreRuleService;
@PostMapping("/create")
@ApiOperation("创建积分规则")
@PreAuthorize("@ss.hasPermission('member:score-rule:create')")
public CommonResult<Long> createScoreRule(@Valid @RequestBody ScoreRuleCreateReqVO createReqVO) {
return success(scoreRuleService.createScoreRule(createReqVO));
}
@PostMapping("/update")
@ApiOperation("更新积分规则")
@PreAuthorize("@ss.hasPermission('member:score-rule:update')")
public CommonResult<Boolean> updateScoreRule(@Valid @RequestBody ScoreRuleUpdateReqVO updateReqVO) {
scoreRuleService.updateScoreRule(updateReqVO);
return success(true);
}
@PostMapping("/delete")
@ApiOperation("删除积分规则")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('member:score-rule:delete')")
public CommonResult<Boolean> deleteScoreRule(@NotNull @RequestBody Long id) {
scoreRuleService.deleteScoreRule(id);
return success(true);
}
@PostMapping("/get")
@ApiOperation("获得积分规则详情")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('member:score-rule:query')")
public CommonResult<ScoreRuleBackVO> getScoreRule(@NotNull @RequestBody Long id) {
ScoreRuleBackVO scoreRuleBackVO = scoreRuleService.getScoreRule(id);
return success(scoreRuleBackVO);
}
@PostMapping("/list")
@ApiOperation("获得积分规则列表")
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
@PreAuthorize("@ss.hasPermission('member:score-rule:query')")
public CommonResult<List<ScoreRuleBackVO>> getScoreRuleList(@NotNull @RequestBody Collection<Long> ids) {
List<ScoreRuleBackVO> list = scoreRuleService.getScoreRuleList(ids);
return success(list);
}
@PostMapping("/page")
@ApiOperation("获得积分规则分页")
@PreAuthorize("@ss.hasPermission('member:score-rule:query')")
public CommonResult<PageResult<ScoreRuleBackVO>> getScoreRulePage(@Valid @RequestBody ScoreRuleQueryVO query, PageVO page) {
PageResult<ScoreRuleBackVO> pageResult = scoreRuleService.getScoreRulePage(query, page);
return success(pageResult);
}
@PostMapping("/status")
@ApiOperation("启用关闭")
@PreAuthorize("@ss.hasPermission('member:score-rule:update')")
public CommonResult<Boolean> updateStatus(@Valid @RequestBody ScoreRuleStatusReqVO scoreRuleStatusReqVO) {
Boolean res = scoreRuleService.updateStatus(scoreRuleStatusReqVO);
return success(res);
}
@PostMapping("/copy")
@ApiOperation("复制规则")
@PreAuthorize("@ss.hasPermission('member:score-rule:create')")
public CommonResult<Long> copyScoreRule(@NotNull @RequestBody Long id) {
Long newId = scoreRuleService.copyScoreRule(id);
return success(id);
}
@PostMapping("/delay")
@ApiOperation("延期规则")
@PreAuthorize("@ss.hasPermission('member:score-rule:update')")
public CommonResult<Boolean> delayScoreRule(@Valid @RequestBody ScoreDelayReqVO scoreDelayReqVO) {
Boolean res = scoreRuleService.delayScoreRule(scoreDelayReqVO);
return success(res);
}
@GetMapping("/export-excel")
@ApiOperation("导出积分规则Excel")
@PreAuthorize("@ss.hasPermission('member:score-rule:export')")
@OperateLog(type = EXPORT)
public void exportScoreRuleExcel(@Valid ScoreRuleQueryVO query,
HttpServletResponse response) throws IOException {
List<ScoreRuleDO> list = scoreRuleService.getScoreRuleList(query);
// 导出 Excel
List<ScoreRuleBackVO> datas = ScoreRuleConvert.INSTANCE.convertList(list);
ExcelUtils.write(response, "积分规则.xls", "数据", ScoreRuleBackVO.class, datas);
}
}
package cn.iocoder.yudao.module.member.convert.scoreRule;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.vo.scoreRule.ScoreRuleBackVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.ScoreRuleCreateReqVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.ScoreRuleUpdateReqVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.member.dal.dataobject.scoreRule.ScoreRuleDO;
/**
* 积分规则 DO Convert
* @author 系统管理员
*/
@Mapper
public interface ScoreRuleConvert {
/*****转换MapStruct*****/
ScoreRuleConvert INSTANCE = Mappers.getMapper(ScoreRuleConvert.class);
/***
* 创建VO转实体
* @param bean
* @return
*/
ScoreRuleDO convert(ScoreRuleCreateReqVO bean);
/***
* 修改VO转实体
* @param bean
* @return
*/
ScoreRuleDO convert(ScoreRuleUpdateReqVO bean);
/***
* 实体转返回VO
* @param bean
* @return
*/
ScoreRuleBackVO convert(ScoreRuleDO bean);
/***
* 实体列表转返回VO列表
* @param list
* @return
*/
List<ScoreRuleBackVO> convertList(List<ScoreRuleDO> list);
/***
* 实体分页转返回分页
* @param page
* @return
*/
PageResult<ScoreRuleBackVO> convertPage(PageResult<ScoreRuleDO> page);
}
package cn.iocoder.yudao.module.member.dal.dataobject.scoreRule;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 积分规则 DO
*
* @author 系统管理员
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("score_rule")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ScoreRuleDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 指标类型
*/
private Integer type;
/**
* 规则标题中文
*/
private String titleZh;
/**
* 规则标题英文
*/
private String titleEn;
/**
* 规则说明中文
*/
private String descZh;
/**
* 规则说明英文
*/
private String descEn;
/**
* 封面图中文
*/
private String coverImageZh;
/**
* 封面图英文
*/
private String coverImageEn;
/**
* 单次获取积分数
*/
private Integer getScoreOnce;
/**
* 累积最高积分
*/
private Integer maxScoreTotal;
/**
* 活动开始时间
*/
private Date startTime;
/**
* 活动结束时间
*/
private Date endTime;
/**
* 积分有效期
*/
private Integer socrePeriod;
/**
* 排序值
*/
private Integer orderNum;
/**
* 是否推送
*/
private Integer pushActivity;
/**
* 展示平台
*/
private String showPlatform;
/**
* 活动状态
*/
private Integer status;
/**
* 扩展字段
*/
private String extra;
}
package cn.iocoder.yudao.module.member.dal.mysql.scoreRule;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.member.dal.dataobject.scoreRule.ScoreRuleDO;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.ScoreRuleQueryVO;
import org.apache.ibatis.annotations.Mapper;
/**
* 积分规则 DO Mapper
* @author 系统管理员
*/
@Mapper
public interface ScoreRuleMapper extends AbstractMapper<ScoreRuleDO> {
@Override
default PageResult<ScoreRuleDO> selectPage(PageVO page, Object object) {
if (object instanceof ScoreRuleQueryVO) {
ScoreRuleQueryVO vo = (ScoreRuleQueryVO)object;
return selectPage(page, new LambdaQuery<ScoreRuleDO>()
.eqIfPresent(ScoreRuleDO::getType, vo.getType())
.eqIfPresent(ScoreRuleDO::getTitleZh, vo.getTitleZh())
.eqIfPresent(ScoreRuleDO::getTitleEn, vo.getTitleEn())
.eqIfPresent(ScoreRuleDO::getDescZh, vo.getDescZh())
.eqIfPresent(ScoreRuleDO::getDescEn, vo.getDescEn())
.eqIfPresent(ScoreRuleDO::getCoverImageZh, vo.getCoverImageZh())
.eqIfPresent(ScoreRuleDO::getCoverImageEn, vo.getCoverImageEn())
.eqIfPresent(ScoreRuleDO::getGetScoreOnce, vo.getGetScoreOnce())
.eqIfPresent(ScoreRuleDO::getMaxScoreTotal, vo.getMaxScoreTotal())
.betweenIfPresent(ScoreRuleDO::getStartTime, vo.getBeginStartTime(), vo.getEndStartTime())
.betweenIfPresent(ScoreRuleDO::getEndTime, vo.getBeginEndTime(), vo.getEndEndTime())
.eqIfPresent(ScoreRuleDO::getSocrePeriod, vo.getSocrePeriod())
.eqIfPresent(ScoreRuleDO::getOrderNum, vo.getOrderNum())
.eqIfPresent(ScoreRuleDO::getPushActivity, vo.getPushActivity())
.eqIfPresent(ScoreRuleDO::getShowPlatform, vo.getShowPlatform())
.eqIfPresent(ScoreRuleDO::getStatus, vo.getStatus())
.eqIfPresent(ScoreRuleDO::getExtra, vo.getExtra())
.betweenIfPresent(ScoreRuleDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
.orderByDesc(ScoreRuleDO::getId));
}
return null;
}
@Override
default List<ScoreRuleDO> selectList(Object object) {
if (object instanceof ScoreRuleQueryVO) {
ScoreRuleQueryVO vo = (ScoreRuleQueryVO)object;
return selectList(new LambdaQuery<ScoreRuleDO>()
.eqIfPresent(ScoreRuleDO::getType, vo.getType())
.eqIfPresent(ScoreRuleDO::getTitleZh, vo.getTitleZh())
.eqIfPresent(ScoreRuleDO::getTitleEn, vo.getTitleEn())
.eqIfPresent(ScoreRuleDO::getDescZh, vo.getDescZh())
.eqIfPresent(ScoreRuleDO::getDescEn, vo.getDescEn())
.eqIfPresent(ScoreRuleDO::getCoverImageZh, vo.getCoverImageZh())
.eqIfPresent(ScoreRuleDO::getCoverImageEn, vo.getCoverImageEn())
.eqIfPresent(ScoreRuleDO::getGetScoreOnce, vo.getGetScoreOnce())
.eqIfPresent(ScoreRuleDO::getMaxScoreTotal, vo.getMaxScoreTotal())
.betweenIfPresent(ScoreRuleDO::getStartTime, vo.getBeginStartTime(), vo.getEndStartTime())
.betweenIfPresent(ScoreRuleDO::getEndTime, vo.getBeginEndTime(), vo.getEndEndTime())
.eqIfPresent(ScoreRuleDO::getSocrePeriod, vo.getSocrePeriod())
.eqIfPresent(ScoreRuleDO::getOrderNum, vo.getOrderNum())
.eqIfPresent(ScoreRuleDO::getPushActivity, vo.getPushActivity())
.eqIfPresent(ScoreRuleDO::getShowPlatform, vo.getShowPlatform())
.eqIfPresent(ScoreRuleDO::getStatus, vo.getStatus())
.eqIfPresent(ScoreRuleDO::getExtra, vo.getExtra())
.betweenIfPresent(ScoreRuleDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
.orderByDesc(ScoreRuleDO::getId));
}
return null;
}
}
package cn.iocoder.yudao.module.member.service.scoreRule;
import java.util.*;
import javax.validation.*;
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.member.dal.dataobject.scoreRule.ScoreRuleDO;
import cn.iocoder.yudao.module.member.vo.scoreRule.*;
/**
* 积分规则 Service 接口
*
* @author 系统管理员
*/
public interface ScoreRuleService extends IService<ScoreRuleDO> {
/**
* 创建积分规则
* @param createReqVO 创建信息
* @return 编号
*/
Long createScoreRule(@Valid ScoreRuleCreateReqVO createReqVO);
/**
* 更新积分规则
* @param updateReqVO 更新信息
*/
void updateScoreRule(@Valid ScoreRuleUpdateReqVO updateReqVO);
/**
* 删除积分规则
* @param id 编号
*/
void deleteScoreRule(Long id);
/**
* 获得积分规则
*
* @param id 编号
* @return 积分规则
*/
ScoreRuleBackVO getScoreRule(Long id);
/**
* 获得积分规则列表
*
* @param ids 编号
* @return 积分规则列表
*/
List<ScoreRuleBackVO> getScoreRuleList(Collection<Long> ids);
/**
* 获得积分规则分页
*
* @param page 分页查询
* @param query 查询
* @return 积分规则分页
*/
PageResult<ScoreRuleBackVO> getScoreRulePage(ScoreRuleQueryVO query, PageVO page);
/**
* 获得积分规则列表, 用于 Excel 导出
* @param query 查询
* @return 积分规则列表
*/
List<ScoreRuleDO> getScoreRuleList(ScoreRuleQueryVO query);
/**
* 积分规则启用关闭
* @param scoreRuleStatusReqVO 积分规则状态
* @return
*/
Boolean updateStatus(ScoreRuleStatusReqVO scoreRuleStatusReqVO);
/**
* 积分规则复制
* @param id
* @return
*/
Long copyScoreRule(Long id);
/**
* 积分规则延期
* @param scoreDelayReqVO 积分规则延期
* @return
*/
Boolean delayScoreRule(ScoreDelayReqVO scoreDelayReqVO);
}
package cn.iocoder.yudao.module.member.service.scoreRule;
import java.time.Instant;
import java.util.*;
import javax.annotation.Resource;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.module.member.convert.scoreRule.ScoreRuleConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.scoreRule.ScoreRuleDO;
import cn.iocoder.yudao.module.member.dal.mysql.scoreRule.ScoreRuleMapper;
import cn.iocoder.yudao.module.member.enums.ScoreRuleStatusEnum;
import cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum;
import cn.iocoder.yudao.module.member.vo.scoreRule.*;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleOrderVExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleRegisterExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleShareExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRulerRecommendExtraVO;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
/**
* 积分规则 Service 实现类
*
* @author 系统管理员
*/
@Service
@Validated
public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, ScoreRuleDO> implements ScoreRuleService {
@Resource
private ScoreRuleMapper scoreRuleMapper;
@Override
public Long createScoreRule(ScoreRuleCreateReqVO createReqVO) {
ScoreRuleDO scoreRule = ScoreRuleConvert.INSTANCE.convert(createReqVO);
Integer scoreRuleType = scoreRule.getType();
setExtraDO(createReqVO, scoreRuleType, scoreRule);
scoreRuleMapper.insert(scoreRule);
// 返回
return scoreRule.getId();
}
@Override
public void updateScoreRule(ScoreRuleUpdateReqVO updateReqVO) {
// 校验存在
this.validateScoreRuleExists(updateReqVO.getId());
ScoreRuleDO scoreRule = ScoreRuleConvert.INSTANCE.convert(updateReqVO);
setExtraDO(updateReqVO, updateReqVO.getType(), scoreRule);
// 更新
ScoreRuleDO updateObj = ScoreRuleConvert.INSTANCE.convert(updateReqVO);
scoreRuleMapper.updateById(updateObj);
}
/**
* 设置额外信息
*
* @param reqVO 请求实体
* @param scoreRuleType 指标类型
* @param scoreRule 需要填充额外字段的DO
*/
private void setExtraDO(ScoreRuleBaseVO reqVO, Integer scoreRuleType, ScoreRuleDO scoreRule) {
if (scoreRuleType == ScoreRuleTypeEnum.ORDER_V.getValue()) {
scoreRule.setExtra(JSONUtil.toJsonStr(reqVO.getExtraOrderV()));
} else if (scoreRuleType == ScoreRuleTypeEnum.REGISTER.getValue()) {
scoreRule.setExtra(JSONUtil.toJsonStr(reqVO.getExtraRegister()));
} else if (scoreRuleType == ScoreRuleTypeEnum.RECOMMEND.getValue()) {
scoreRule.setExtra(JSONUtil.toJsonStr(reqVO.getExtraRecommend()));
} else if (scoreRuleType == ScoreRuleTypeEnum.SHARE.getValue()) {
scoreRule.setExtra(JSONUtil.toJsonStr(reqVO.getExtraShare()));
} else {
throw exception(SCORE_RULE_NOT_EXISTS);
}
}
@Override
public void deleteScoreRule(Long id) {
ScoreRuleDO scoreRuleDO = scoreRuleMapper.selectById(id);
if (scoreRuleDO == null) {
throw exception(SCORE_RULE_NOT_EXISTS);
}
if (scoreRuleDO.getStatus() == ScoreRuleStatusEnum.ENABLED.getValue()) {
throw exception(SCORE_RULE_DELETE_ERROR);
}
// 删除
scoreRuleMapper.deleteById(id);
}
private void validateScoreRuleExists(Long id) {
if (scoreRuleMapper.selectById(id) == null) {
throw exception(SCORE_RULE_NOT_EXISTS);
}
}
@Override
public ScoreRuleBackVO getScoreRule(Long id) {
ScoreRuleDO scoreRuleDO = scoreRuleMapper.selectById(id);
if (scoreRuleDO == null) {
throw exception(SCORE_RULE_NOT_EXISTS);
}
ScoreRuleBackVO scoreRuleBackVO = ScoreRuleConvert.INSTANCE.convert(scoreRuleDO);
setExtraVO(scoreRuleBackVO);
return scoreRuleBackVO;
}
@Override
public List<ScoreRuleBackVO> getScoreRuleList(Collection<Long> ids) {
List<ScoreRuleDO> scoreRuleDOS = scoreRuleMapper.selectBatchIds(ids);
List<ScoreRuleBackVO> scoreRuleBackVOS = ScoreRuleConvert.INSTANCE.convertList(scoreRuleDOS);
scoreRuleBackVOS.forEach(this::setExtraVO);
return scoreRuleBackVOS;
}
@Override
public PageResult<ScoreRuleBackVO> getScoreRulePage(ScoreRuleQueryVO query, PageVO page) {
PageResult<ScoreRuleDO> pageResult = scoreRuleMapper.selectPage(page, query);
PageResult<ScoreRuleBackVO> scoreRuleBackVOPageResult = ScoreRuleConvert.INSTANCE.convertPage(pageResult);
scoreRuleBackVOPageResult.getList().forEach(this::setExtraVO);
return scoreRuleBackVOPageResult;
}
/**
* 设置返回VO额外信息
*
* @param scoreRuleBackVO VO
*/
private void setExtraVO(ScoreRuleBackVO scoreRuleBackVO) {
if (scoreRuleBackVO.getType() == ScoreRuleTypeEnum.ORDER_V.getValue()) {
scoreRuleBackVO.setExtraOrderV(JSONUtil.toBean(scoreRuleBackVO.getExtra(), ScoreRuleOrderVExtraVO.class));
} else if (scoreRuleBackVO.getType() == ScoreRuleTypeEnum.REGISTER.getValue()) {
scoreRuleBackVO.setExtraRegister(JSONUtil.toBean(scoreRuleBackVO.getExtra(), ScoreRuleRegisterExtraVO.class));
} else if (scoreRuleBackVO.getType() == ScoreRuleTypeEnum.RECOMMEND.getValue()) {
scoreRuleBackVO.setExtraRecommend(JSONUtil.toBean(scoreRuleBackVO.getExtra(), ScoreRulerRecommendExtraVO.class));
} else if (scoreRuleBackVO.getType() == ScoreRuleTypeEnum.SHARE.getValue()) {
scoreRuleBackVO.setExtraShare(JSONUtil.toBean(scoreRuleBackVO.getExtra(), ScoreRuleShareExtraVO.class));
} else {
throw exception(SCORE_RULE_NOT_EXISTS);
}
}
@Override
public List<ScoreRuleDO> getScoreRuleList(ScoreRuleQueryVO query) {
return scoreRuleMapper.selectList(query);
}
@Override
public Boolean updateStatus(ScoreRuleStatusReqVO scoreRuleStatusReqVO) {
ScoreRuleDO scoreRuleDO = scoreRuleMapper.selectById(scoreRuleStatusReqVO.getId());
if (scoreRuleDO == null) {
throw exception(SCORE_RULE_NOT_EXISTS);
}
ScoreRuleDO upScoreRuleDO = new ScoreRuleDO();
upScoreRuleDO.setId(scoreRuleStatusReqVO.getId());
upScoreRuleDO.setStatus(scoreRuleStatusReqVO.getStatus());
int updated = scoreRuleMapper.updateById(upScoreRuleDO);
return updated > 0;
}
@Override
public Long copyScoreRule(Long id) {
ScoreRuleDO scoreRuleDO = scoreRuleMapper.selectById(id);
if (scoreRuleDO == null) {
throw exception(SCORE_RULE_NOT_EXISTS);
}
scoreRuleDO.setStatus(ScoreRuleStatusEnum.DISABLED.getValue());
scoreRuleDO.setId(null);
scoreRuleDO.setCreateTime(null);
scoreRuleDO.setUpdateTime(null);
scoreRuleMapper.insert(scoreRuleDO);
return scoreRuleDO.getId();
}
@Override
public Boolean delayScoreRule(ScoreDelayReqVO delayReqVO) {
ScoreRuleDO scoreRuleDO = scoreRuleMapper.selectById(delayReqVO.getId());
if (scoreRuleDO == null) {
throw exception(SCORE_RULE_NOT_EXISTS);
}
if (scoreRuleDO.getStatus() != ScoreRuleStatusEnum.ENABLED.getValue()) {
throw exception(SCORE_RULE_UPDATE_ERROR);
}
Instant now = Instant.now();
//结束时间不能小于当前时间
if (!delayReqVO.getEndTime().toInstant().isAfter(now)) {
throw exception(SCORE_RULE_UPDATE_ERROR);
}
ScoreRuleDO upScoreRuleDO = new ScoreRuleDO();
upScoreRuleDO.setId(delayReqVO.getId());
upScoreRuleDO.setEndTime(delayReqVO.getEndTime());
int updated = scoreRuleMapper.updateById(upScoreRuleDO);
return updated > 0;
}
}
package cn.iocoder.yudao.module.member.vo.scoreRule;
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("管理后台 - 积分规则延期 Response VO")
public class ScoreDelayReqVO {
@ApiModelProperty(value = "主键", required = true)
@NotNull(message = "主键不能为空")
private Long id;
@ApiModelProperty(value = "结束时间", required = true)
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@NotNull(message = "结束时间不能为空")
private Date endTime;
}
package cn.iocoder.yudao.module.member.vo.scoreRule;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleOrderVExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleRegisterExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleShareExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRulerRecommendExtraVO;
import com.baomidou.dynamic.datasource.annotation.DS;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import com.alibaba.excel.annotation.ExcelProperty;
import org.springframework.format.annotation.DateTimeFormat;
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 ScoreRuleBackVO {
@ExcelProperty("主键")
@ApiModelProperty(value = "主键", required = true)
private Long id;
@ExcelProperty("指标类型")
@ApiModelProperty(value = "指标类型", required = true)
private Integer type;
@ExcelProperty("规则标题中文")
@ApiModelProperty(value = "规则标题中文", required = true)
private String titleZh;
@ExcelProperty("规则标题英文")
@ApiModelProperty(value = "规则标题英文", required = true)
private String titleEn;
@ExcelProperty("规则说明中文")
@ApiModelProperty(value = "规则说明中文", required = true)
private String descZh;
@ExcelProperty("规则说明英文")
@ApiModelProperty(value = "规则说明英文", required = true)
private String descEn;
@ExcelProperty("封面图中文")
@ApiModelProperty(value = "封面图中文")
private String coverImageZh;
@ExcelProperty("封面图英文")
@ApiModelProperty(value = "封面图英文")
private String coverImageEn;
@ExcelProperty("单次获取积分数")
@ApiModelProperty(value = "单次获取积分数", required = true)
private Integer getScoreOnce;
@ExcelProperty("累积最高积分")
@ApiModelProperty(value = "累积最高积分", required = true)
private Integer maxScoreTotal;
@ExcelProperty("活动开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "活动开始时间", required = true)
private Date startTime;
@ExcelProperty("活动结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "活动结束时间", required = true)
private Date endTime;
@ExcelProperty("积分有效期")
@ApiModelProperty(value = "积分有效期", required = true)
private Integer socrePeriod;
@ExcelProperty("排序值")
@ApiModelProperty(value = "排序值", required = true)
private Integer orderNum;
@ExcelProperty("是否推送")
@ApiModelProperty(value = "是否推送", required = true)
private Integer pushActivity;
@ExcelProperty("展示平台")
@ApiModelProperty(value = "展示平台", required = true)
private String showPlatform;
@ExcelProperty("活动状态")
@ApiModelProperty(value = "活动状态", required = true)
private Integer status;
@ExcelProperty("创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
@ApiModelProperty(value = "扩展字段原始")
private String extra;
@ApiModelProperty(value = "订单V值扩展字段")
private ScoreRuleOrderVExtraVO extraOrderV;
@ApiModelProperty(value = "注册扩展字段")
private ScoreRuleRegisterExtraVO extraRegister;
@ApiModelProperty(value = "推荐扩展字段")
private ScoreRulerRecommendExtraVO extraRecommend;
@ApiModelProperty(value = "分享扩展字段")
private ScoreRuleShareExtraVO extraShare;
}
package cn.iocoder.yudao.module.member.vo.scoreRule;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleOrderVExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleRegisterExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleShareExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRulerRecommendExtraVO;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
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 ScoreRuleBaseVO {
@ApiModelProperty(value = "指标类型(1订单V值,2注册,3推荐,4分享)", required = true)
@NotNull(message = "指标类型不能为空")
private Integer type;
@ApiModelProperty(value = "规则标题中文", required = true)
@NotNull(message = "规则标题中文不能为空")
private String titleZh;
@ApiModelProperty(value = "规则标题英文", required = true)
@NotNull(message = "规则标题英文不能为空")
private String titleEn;
@ApiModelProperty(value = "规则说明中文", required = true)
@NotNull(message = "规则说明中文不能为空")
private String descZh;
@ApiModelProperty(value = "规则说明英文", required = true)
@NotNull(message = "规则说明英文不能为空")
private String descEn;
@ApiModelProperty(value = "封面图中文")
private String coverImageZh;
@ApiModelProperty(value = "封面图英文")
private String coverImageEn;
@ApiModelProperty(value = "单次获取积分数,订单V值中代表单次最高获取积分数", required = true)
@NotNull(message = "单次获取积分数不能为空")
private Integer getScoreOnce;
@ApiModelProperty(value = "累积最高积分(注册直接传null)", required = true)
private Integer maxScoreTotal;
@ApiModelProperty(value = "活动开始时间", required = true)
@NotNull(message = "活动开始时间不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date startTime;
@ApiModelProperty(value = "活动结束时间", required = true)
@NotNull(message = "活动结束时间不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date endTime;
@ApiModelProperty(value = "积分有效期(天)", required = true)
@NotNull(message = "积分有效期不能为空")
private Integer scorePeriod;
@ApiModelProperty(value = "排序值", required = true)
@NotNull(message = "排序值不能为空")
private Integer orderNum;
@ApiModelProperty(value = "是否推送(0是,1否)", required = true)
@NotNull(message = "是否推送不能为空")
private Integer pushActivity = 0;
@ApiModelProperty(value = "展示平台(1后台,2APP,3WEB)可多选,示例(1,2,3)", required = true)
@NotNull(message = "展示平台不能为空")
private String showPlatform;
@ApiModelProperty(value = "活动状态(1已启用,2未启用,3已关闭,4已过期)", required = true)
@NotNull(message = "活动状态不能为空")
private Integer status;
@ApiModelProperty(value = "订单V值扩展字段")
private ScoreRuleOrderVExtraVO extraOrderV;
@ApiModelProperty(value = "注册扩展字段")
private ScoreRuleRegisterExtraVO extraRegister;
@ApiModelProperty(value = "推荐扩展字段")
private ScoreRulerRecommendExtraVO extraRecommend;
@ApiModelProperty(value = "分享扩展字段")
private ScoreRuleShareExtraVO extraShare;
}
package cn.iocoder.yudao.module.member.vo.scoreRule;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleOrderVExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleRegisterExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleShareExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRulerRecommendExtraVO;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel("管理后台 - 积分规则创建 Request VO")
public class ScoreRuleCreateReqVO extends ScoreRuleBaseVO {
}
package cn.iocoder.yudao.module.member.vo.scoreRule;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@ApiModel("管理后台 - 积分规则查询 VO")
public class ScoreRuleQueryVO {
@ApiModelProperty(value = "指标类型")
private Integer type;
@ApiModelProperty(value = "规则标题中文")
private String titleZh;
@ApiModelProperty(value = "规则标题英文")
private String titleEn;
@ApiModelProperty(value = "规则说明中文")
private String descZh;
@ApiModelProperty(value = "规则说明英文")
private String descEn;
@ApiModelProperty(value = "封面图中文")
private String coverImageZh;
@ApiModelProperty(value = "封面图英文")
private String coverImageEn;
@ApiModelProperty(value = "单次获取积分数")
private Integer getScoreOnce;
@ApiModelProperty(value = "累积最高积分")
private Integer maxScoreTotal;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始活动开始时间")
private Date beginStartTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束活动开始时间")
private Date endStartTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始活动结束时间")
private Date beginEndTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束活动结束时间")
private Date endEndTime;
@ApiModelProperty(value = "积分有效期")
private Integer socrePeriod;
@ApiModelProperty(value = "排序值")
private Integer orderNum;
@ApiModelProperty(value = "是否推送")
private Integer pushActivity;
@ApiModelProperty(value = "展示平台")
private String showPlatform;
@ApiModelProperty(value = "活动状态")
private Integer status;
@ApiModelProperty(value = "扩展字段")
private String extra;
@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.member.vo.scoreRule;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
@ApiModel("管理后台 - 启用关闭规则 VO")
public class ScoreRuleStatusReqVO {
@ApiModelProperty(value = "主键", required = true)
@NotNull(message = "主键不能为空")
private Long id;
@ApiModelProperty(value = "状态(1已启用,2未启用,3已关闭,4已过期)", required = true)
@NotNull(message = "状态不能为空")
private Integer status;
}
package cn.iocoder.yudao.module.member.vo.scoreRule;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleOrderVExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleRegisterExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleShareExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRulerRecommendExtraVO;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
@ApiModel("管理后台 - 积分规则更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ScoreRuleUpdateReqVO extends ScoreRuleBaseVO {
@ApiModelProperty(value = "主键", required = true)
@NotNull(message = "主键不能为空")
private Long id;
}
package cn.iocoder.yudao.module.member.vo.scoreRule.extra;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("管理后台 - 订单V值额外字段 VO")
public class ScoreRuleOrderVExtraVO {
@ApiModelProperty(value = "是否首单(0是,1否)默认否", required = true)
private Integer firstOrder = 1;
@ApiModelProperty(value = "运输方式(1海运拼柜,3专线空运)字典有", required = true)
private Integer transportType;
@ApiModelProperty(value = "目的国,可多选,逗号拼接", required = true)
private String targetCountry;
@ApiModelProperty(value = "目的城市,可多选,逗号拼接", required = true)
private String targetCity;
@ApiModelProperty(value = "提货点,可多选,逗号拼接", required = true)
private String receiveAddr;
@ApiModelProperty(value = "渠道,运输方式选择海运时,渠道隐藏,可多选,逗号拼接")
private String channel;
@ApiModelProperty(value = "积分规则列表", required = true)
private List<OrderVRule> orderVRule;
@ApiModelProperty(value = "订单入口(1后台,2APP,3WEB)可多选,逗号拼", required = true)
private String orderEntry;
@Data
public static class OrderVRule {
@ApiModelProperty(value = "起始重量/体积")
private Integer low;
@ApiModelProperty(value = "截止重量/体积")
private Integer high;
@ApiModelProperty(value = "积分")
private Integer score;
}
}
package cn.iocoder.yudao.module.member.vo.scoreRule.extra;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("管理后台 - 注册额外字段 VO")
public class ScoreRuleRegisterExtraVO {
@ApiModelProperty(value = "注册平台(2APP,3WEB)可多选,逗号拼", required = true)
private String registerPlatform ;
}
package cn.iocoder.yudao.module.member.vo.scoreRule.extra;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("管理后台 - 分享额外字段 VO")
public class ScoreRuleShareExtraVO {
@ApiModelProperty(value = "中文活动内容", required = true)
private String activityDescZh ;
@ApiModelProperty(value = "英文活动内容", required = true)
private String activityDescEn ;
@ApiModelProperty(value = "活动链接", required = true)
private String activityUrl ;
@ApiModelProperty(value = "是否分享(0是,1否)默认是", required = true)
private String shareStatus ;
}
package cn.iocoder.yudao.module.member.vo.scoreRule.extra;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("管理后台 - 推荐额外字段 VO")
public class ScoreRulerRecommendExtraVO {
@ApiModelProperty(value = "中文分享文案", required = true)
private String shareContentZh ;
@ApiModelProperty(value = "英文分享文案", required = true)
private String shareContentEn ;
@ApiModelProperty(value = "是否分享(0是,1否)默认是", required = true)
private Integer shareStatus = 0;
}
...@@ -23,5 +23,8 @@ public interface ErrorCodeConstants { ...@@ -23,5 +23,8 @@ public interface ErrorCodeConstants {
ErrorCode REWARD_REDEEM_FAIL = new ErrorCode(1001011015, "批量兑换失败"); ErrorCode REWARD_REDEEM_FAIL = new ErrorCode(1001011015, "批量兑换失败");
ErrorCode REWARD_REDEEM_COUNT_NOT_ALLOW = new ErrorCode(1001011016, "批量兑换每次最多十条"); ErrorCode REWARD_REDEEM_COUNT_NOT_ALLOW = new ErrorCode(1001011016, "批量兑换每次最多十条");
ErrorCode REWARD_REDEEM_ALLOW_COUNT_ERROR = new ErrorCode(1001011017, "超出允许兑换次数"); ErrorCode REWARD_REDEEM_ALLOW_COUNT_ERROR = new ErrorCode(1001011017, "超出允许兑换次数");
ErrorCode REWARD_REDEEM_NOT_EXIST = new ErrorCode(1001011018, "reward.redeem.not.exist");
ErrorCode REWARD_REDEEM_STATUS_ERROR = new ErrorCode(1001011018, "reward.redeem.status.error");
ErrorCode REWARD_REDEEM_VERIFY_NO_PARAM = new ErrorCode(1001011018, "reward.redeem.verify.no.param");
} }
package cn.iocoder.yudao.module.reward.enums;
public enum QuantitativeRelationSymbolEnum {
GT(1, "大于"),
EQ(2, "等于"),
LT(3, "小于");
private final int value;
private final String name;
QuantitativeRelationSymbolEnum(int value, String name) {
this.value = value;
this.name = name;
}
public int getValue() {
return value;
}
public String getName() {
return name;
}
}
package cn.iocoder.yudao.module.reward.enums; package cn.iocoder.yudao.module.reward.enums;
public enum RewardPickMethedEnum { public enum RewardPickMethedEnum {
PICKUP(1, "上门领取"), SELF_PICKUP(1, "上门领取"),
SEND_HOME_FREE(2, "包邮到家"), SEND_HOME_FREE(2, "包邮到家"),
SEND_HOME_PAY(3, "邮寄到付") SEND_HOME_PAY(3, "邮寄到付")
; ;
......
package cn.iocoder.yudao.module.reward.enums;
public enum RewardStatusEnum {
ENABLED(1, "已启用"),
DISABLED(2, "未启用"),
CLOSED(3, "已关闭"),
EXPIRED(4, "已过期");
private final int value;
private final String name;
RewardStatusEnum(int value, String name) {
this.value = value;
this.name = name;
}
public int getValue() {
return value;
}
public String getName() {
return name;
}
}
...@@ -62,9 +62,6 @@ public class RedeemRewardApiImpl implements RedeemRewardApi { ...@@ -62,9 +62,6 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
throw exception(REWARD_COUNT_NOT_ENOUGH); throw exception(REWARD_COUNT_NOT_ENOUGH);
} }
// 兑换方式不匹配 // 兑换方式不匹配
// if (!Objects.equals(rewardDO.getPickMethod(), redeemRewardReqVO.getRedeemType())) {
// throw exception(REWARD_PICK_METHOD_NOT_ALLOW_CREATE);
// }
String pickMethod = rewardDO.getPickMethod(); String pickMethod = rewardDO.getPickMethod();
String[] split = pickMethod.split(","); String[] split = pickMethod.split(",");
if (!Arrays.asList(split).contains(String.valueOf(redeemRewardReqVO.getRedeemType()))) { if (!Arrays.asList(split).contains(String.valueOf(redeemRewardReqVO.getRedeemType()))) {
...@@ -91,15 +88,15 @@ public class RedeemRewardApiImpl implements RedeemRewardApi { ...@@ -91,15 +88,15 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
return null; return null;
} }
private void redeemReward(RewardDO rewardDO, Integer rewardCount) { private void redeemReward(RewardDO reward, Integer rewardCount) {
// 更新时校验礼品数量是否足够 // 更新时校验礼品数量是否足够
RewardDO rewardDO1 = rewardMapper.selectById(rewardDO.getId()); RewardDO rewardDO = rewardMapper.selectById(reward.getId());
if (rewardDO1.getQuantityRemain() < rewardCount) { if (rewardDO.getQuantityRemain() < rewardCount) {
throw exception(REWARD_COUNT_NOT_ENOUGH); throw exception(REWARD_COUNT_NOT_ENOUGH);
} }
rewardDO.setExchangeCount(rewardDO.getExchangeCount() + 1); reward.setExchangeCount(reward.getExchangeCount() + 1);
rewardDO.setQuantityRemain(rewardDO.getQuantityRemain() - rewardCount); reward.setQuantityRemain(reward.getQuantityRemain() - rewardCount);
rewardMapper.updateById(rewardDO); rewardMapper.updateById(reward);
} }
private void updateMemberScore(RedeemRewardReqVO redeemRewardReqVO, RewardDO rewardDO, Long redeemId) { private void updateMemberScore(RedeemRewardReqVO redeemRewardReqVO, RewardDO rewardDO, Long redeemId) {
...@@ -139,9 +136,6 @@ public class RedeemRewardApiImpl implements RedeemRewardApi { ...@@ -139,9 +136,6 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
for (RedeemRewardReqVO redeemRewardReqVO : redeemRewardReqVOList) { for (RedeemRewardReqVO redeemRewardReqVO : redeemRewardReqVOList) {
// 每个兑换VO校验一遍 // 每个兑换VO校验一遍
// 兑换方式不匹配 // 兑换方式不匹配
// if (!Objects.equals(rewardDO.getPickMethod(), redeemRewardReqVO.getRedeemType())) {
// throw exception(REWARD_PICK_METHOD_NOT_ALLOW_CREATE);
// }
String pickMethod = rewardDO.getPickMethod(); String pickMethod = rewardDO.getPickMethod();
String[] split = pickMethod.split(","); String[] split = pickMethod.split(",");
if (!Arrays.asList(split).contains(String.valueOf(redeemRewardReqVO.getRedeemType()))) { if (!Arrays.asList(split).contains(String.valueOf(redeemRewardReqVO.getRedeemType()))) {
......
...@@ -6,11 +6,12 @@ import cn.iocoder.yudao.module.reward.api.reward.RedeemRewardApi; ...@@ -6,11 +6,12 @@ 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.RedeemRewardReqVO;
import cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardRespDTO; import cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardRespDTO;
import cn.iocoder.yudao.module.reward.service.redeem.RewardRedeemService; import cn.iocoder.yudao.module.reward.service.redeem.RewardRedeemService;
import cn.iocoder.yudao.module.reward.vo.reward.*;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageReqVO; import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageReqVO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO; import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -19,7 +20,6 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -19,7 +20,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
...@@ -42,17 +42,35 @@ public class RedeemRewardController { ...@@ -42,17 +42,35 @@ public class RedeemRewardController {
return success(rewardRedeemService.pageInfo(reqVO)); return success(rewardRedeemService.pageInfo(reqVO));
} }
@PostMapping("record/detail")
@ApiOperation("兑换记录详情")
public CommonResult<RewardRedeemPageRespVO> detail(@Valid @RequestBody RewardRedeemBaseVO request) {
return success(rewardRedeemService.detail(request.getId()));
}
@PostMapping("record/update")
@ApiOperation("兑换记录更新")
public CommonResult<Boolean> update(@Valid @RequestBody RewardRedeemUpdateVO request) {
return success(rewardRedeemService.updateRecord(request));
}
@PostMapping("record/verify")
@ApiOperation("兑换记录核销")
public CommonResult<Boolean> verify(@Valid @RequestBody RewardRedeemVerifyVO request) {
return success(rewardRedeemService.verify(request));
}
@PostMapping("/single") @PostMapping("/single")
@ApiOperation("兑换礼品") @ApiOperation("兑换礼品")
//@PreAuthorize("@ss.hasPermission('reward::redeem')") @PreAuthorize("@ss.hasPermission('ecw:giftManagement:exchange')")
public CommonResult<RedeemRewardRespDTO> redeemReward(@Valid @RequestBody RedeemRewardReqVO redeemRewardReqVO) { public CommonResult<RedeemRewardRespDTO> redeemReward(@Valid @RequestBody RedeemRewardReqVO redeemRewardReqVO) {
return success(redeemRewardApi.redeemReward(redeemRewardReqVO)); return success(redeemRewardApi.redeemReward(redeemRewardReqVO));
} }
@PostMapping("/batch") @PostMapping("/batch")
@ApiOperation("批量兑换礼品") @ApiOperation("批量兑换礼品")
//@PreAuthorize("@ss.hasPermission('reward::redeem')") @PreAuthorize("@ss.hasPermission('ecw:giftManagement:exchange')")
public CommonResult<List<RedeemRewardRespDTO>> redeemRewards(@Valid @RequestBody List<RedeemRewardReqVO> redeemRewardReqVOList) { public CommonResult<List<RedeemRewardRespDTO>> redeemRewards(@Valid @RequestBody List<RedeemRewardReqVO> redeemRewardReqVOList) {
return success(redeemRewardApi.redeemRewards(redeemRewardReqVOList)); return success(redeemRewardApi.redeemRewards(redeemRewardReqVOList));
} }
......
...@@ -9,10 +9,10 @@ import cn.iocoder.yudao.module.reward.convert.reward.RewardConvert; ...@@ -9,10 +9,10 @@ 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;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -38,14 +38,14 @@ public class RewardController { ...@@ -38,14 +38,14 @@ public class RewardController {
@PostMapping("/create") @PostMapping("/create")
@ApiOperation("创建礼品") @ApiOperation("创建礼品")
//@PreAuthorize("@ss.hasPermission('reward::create')") @PreAuthorize("@ss.hasPermission('ecw:giftManagement:add')")
public CommonResult<Long> create(@Valid @RequestBody RewardCreateReqVO createReqVO) { public CommonResult<Long> create(@Valid @RequestBody RewardCreateReqVO createReqVO) {
return success(rewardService.create(createReqVO)); return success(rewardService.create(createReqVO));
} }
@PostMapping("/update") @PostMapping("/update")
@ApiOperation("更新礼品") @ApiOperation("更新礼品")
//@PreAuthorize("@ss.hasPermission('reward::update')") @PreAuthorize("@ss.hasPermission('ecw:giftManagement:edit')")
public CommonResult<Boolean> update(@Valid @RequestBody RewardUpdateReqVO updateReqVO) { public CommonResult<Boolean> update(@Valid @RequestBody RewardUpdateReqVO updateReqVO) {
rewardService.update(updateReqVO); rewardService.update(updateReqVO);
return success(true); return success(true);
...@@ -54,7 +54,7 @@ public class RewardController { ...@@ -54,7 +54,7 @@ public class RewardController {
@DeleteMapping("/delete") @DeleteMapping("/delete")
@ApiOperation("删除礼品") @ApiOperation("删除礼品")
@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::delete')") @PreAuthorize("@ss.hasPermission('ecw:giftManagement:delete')")
public CommonResult<Boolean> delete(@RequestParam("id") Long id) { public CommonResult<Boolean> delete(@RequestParam("id") Long id) {
rewardService.delete(id); rewardService.delete(id);
return success(true); return success(true);
...@@ -63,7 +63,7 @@ public class RewardController { ...@@ -63,7 +63,7 @@ public class RewardController {
@GetMapping("/get") @GetMapping("/get")
@ApiOperation("获得礼品详情") @ApiOperation("获得礼品详情")
@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('ecw:giftManagement:check')")
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);
RewardBackVO rewardBackVO = RewardConvert.INSTANCE.convert(rewardDO); RewardBackVO rewardBackVO = RewardConvert.INSTANCE.convert(rewardDO);
...@@ -91,7 +91,7 @@ public class RewardController { ...@@ -91,7 +91,7 @@ public class RewardController {
@PostMapping("/status") @PostMapping("/status")
@ApiOperation("礼品状态变更") @ApiOperation("礼品状态变更")
//@PreAuthorize("@ss.hasPermission('reward::query')") @PreAuthorize("@ss.hasPermission('ecw:giftManagement:close')")
public CommonResult<Boolean> updateStatus(@Valid @RequestBody RewardStatusReqVO statusVO) { public CommonResult<Boolean> updateStatus(@Valid @RequestBody RewardStatusReqVO statusVO) {
rewardService.updateStatus(statusVO); rewardService.updateStatus(statusVO);
return success(true); return success(true);
...@@ -99,12 +99,14 @@ public class RewardController { ...@@ -99,12 +99,14 @@ public class RewardController {
@PostMapping("/copy/{id}") @PostMapping("/copy/{id}")
@ApiOperation("复制礼品") @ApiOperation("复制礼品")
@PreAuthorize("@ss.hasPermission('ecw:giftManagement:copy')")
public CommonResult<Long> copyReward(@NotNull @PathVariable Long id) { public CommonResult<Long> copyReward(@NotNull @PathVariable Long id) {
return success(rewardService.copyReward(id)); return success(rewardService.copyReward(id));
} }
@PostMapping("/delay") @PostMapping("/delay")
@ApiOperation("礼品延期") @ApiOperation("礼品延期")
@PreAuthorize("@ss.hasPermission('ecw:giftManagement:postpone')")
public CommonResult<Boolean> delayReward(@Valid @RequestBody RewardDelayReqVO delayVO) { public CommonResult<Boolean> delayReward(@Valid @RequestBody RewardDelayReqVO delayVO) {
rewardService.delayReward(delayVO); rewardService.delayReward(delayVO);
return success(true); return success(true);
......
...@@ -76,7 +76,7 @@ public class RewardRedeemDO extends BaseDO { ...@@ -76,7 +76,7 @@ public class RewardRedeemDO extends BaseDO {
/** /**
* 快递公司 * 快递公司
*/ */
private String courierCompany; private Integer courierCompany;
/** /**
* 快递单号 * 快递单号
*/ */
...@@ -84,7 +84,7 @@ public class RewardRedeemDO extends BaseDO { ...@@ -84,7 +84,7 @@ public class RewardRedeemDO extends BaseDO {
/** /**
* 快递日期 * 快递日期
*/ */
private String expressDate; private Date expressDate;
/** /**
* 快递寄出人 * 快递寄出人
*/ */
...@@ -97,4 +97,8 @@ public class RewardRedeemDO extends BaseDO { ...@@ -97,4 +97,8 @@ public class RewardRedeemDO extends BaseDO {
* 备注 * 备注
*/ */
private String remark; private String remark;
private String verifyUser;
private Date verifyTime;
} }
...@@ -19,4 +19,6 @@ public interface RewardRedeemMapper extends AbstractMapper<RewardRedeemDO> { ...@@ -19,4 +19,6 @@ public interface RewardRedeemMapper extends AbstractMapper<RewardRedeemDO> {
List<RewardRedeemPageRespVO> pageInfo(@Param("start") int start, @Param("size") int size, @Param("req") RewardRedeemPageReqVO reqVO); List<RewardRedeemPageRespVO> pageInfo(@Param("start") int start, @Param("size") int size, @Param("req") RewardRedeemPageReqVO reqVO);
int pageCount(@Param("req") RewardRedeemPageReqVO reqVO); int pageCount(@Param("req") RewardRedeemPageReqVO reqVO);
RewardRedeemPageRespVO detail(@Param("id") Long id);
} }
...@@ -5,7 +5,8 @@ import cn.iocoder.yudao.framework.mybatis.core.service.IService; ...@@ -5,7 +5,8 @@ import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.module.reward.dal.dataobject.redeem.RewardRedeemDO; import cn.iocoder.yudao.module.reward.dal.dataobject.redeem.RewardRedeemDO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageReqVO; import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageReqVO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO; import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage; import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemUpdateVO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemVerifyVO;
/** /**
* 礼品兑换 Service 接口 * 礼品兑换 Service 接口
...@@ -15,4 +16,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -15,4 +16,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
public interface RewardRedeemService extends IService<RewardRedeemDO> { public interface RewardRedeemService extends IService<RewardRedeemDO> {
PageResult<RewardRedeemPageRespVO> pageInfo(RewardRedeemPageReqVO reqVO); PageResult<RewardRedeemPageRespVO> pageInfo(RewardRedeemPageReqVO reqVO);
RewardRedeemPageRespVO detail(Long id);
Boolean updateRecord(RewardRedeemUpdateVO request);
Boolean verify(RewardRedeemVerifyVO request);
} }
...@@ -2,16 +2,29 @@ package cn.iocoder.yudao.module.reward.service.redeem; ...@@ -2,16 +2,29 @@ package cn.iocoder.yudao.module.reward.service.redeem;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService; import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.reward.dal.dataobject.redeem.RewardRedeemDO; import cn.iocoder.yudao.module.reward.dal.dataobject.redeem.RewardRedeemDO;
import cn.iocoder.yudao.module.reward.dal.mysql.redeem.RewardRedeemMapper; import cn.iocoder.yudao.module.reward.dal.mysql.redeem.RewardRedeemMapper;
import cn.iocoder.yudao.module.reward.enums.ErrorCodeConstants;
import cn.iocoder.yudao.module.reward.enums.RewardPickMethedEnum;
import cn.iocoder.yudao.module.reward.enums.RewardRedeemStatusEnum;
import cn.iocoder.yudao.module.reward.service.reward.RewardService;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageReqVO; import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageReqVO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO; import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemUpdateVO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemVerifyVO;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.micrometer.core.instrument.util.StringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
/** /**
* 礼品兑换 Service * 礼品兑换 Service
* *
...@@ -22,6 +35,8 @@ import java.util.List; ...@@ -22,6 +35,8 @@ import java.util.List;
public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper, RewardRedeemDO> implements RewardRedeemService { public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper, RewardRedeemDO> implements RewardRedeemService {
@Resource @Resource
private RewardRedeemMapper rewardRedeemMapper; private RewardRedeemMapper rewardRedeemMapper;
@Resource
private RewardService rewardService;
@Override @Override
public PageResult<RewardRedeemPageRespVO> pageInfo(RewardRedeemPageReqVO reqVO) { public PageResult<RewardRedeemPageRespVO> pageInfo(RewardRedeemPageReqVO reqVO) {
...@@ -31,4 +46,96 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper, ...@@ -31,4 +46,96 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
int total = rewardRedeemMapper.pageCount(reqVO); int total = rewardRedeemMapper.pageCount(reqVO);
return new PageResult<>(result, total, reqVO.getPageSize(), reqVO.getPageNo(), (total + reqVO.getPageSize() - 1) / reqVO.getPageSize()); return new PageResult<>(result, total, reqVO.getPageSize(), reqVO.getPageNo(), (total + reqVO.getPageSize() - 1) / reqVO.getPageSize());
} }
@Override
public RewardRedeemPageRespVO detail(Long id) {
if (id == null) {
return null;
}
return rewardRedeemMapper.detail(id);
}
@Override
public Boolean updateRecord(RewardRedeemUpdateVO request) {
updateValidateParam(request);
LambdaUpdateWrapper<RewardRedeemDO> wrapper = Wrappers.lambdaUpdate();
wrapper.eq(RewardRedeemDO::getId, request.getId());
wrapper.set(RewardRedeemDO::getRedeemType, request.getRedeemType());
wrapper.set(RewardRedeemDO::getExpenses, request.getExpenses());
wrapper.set(RewardRedeemDO::getCurrency, request.getCurrency());
wrapper.set(RewardRedeemDO::getRecipientName, request.getRecipientName());
wrapper.set(RewardRedeemDO::getRecipientAddress, request.getRecipientAddress());
wrapper.set(RewardRedeemDO::getRecipientPhoneNum, request.getRecipientPhoneNum());
wrapper.set(RewardRedeemDO::getRedeemer, request.getRedeemer());
wrapper.set(RewardRedeemDO::getRedemptionTime, request.getRedemptionTime());
wrapper.set(RewardRedeemDO::getCourierCompany, request.getCourierCompany());
wrapper.set(RewardRedeemDO::getExpressNo, request.getExpressNo());
wrapper.set(RewardRedeemDO::getExpressDate, request.getExpressDate());
wrapper.set(RewardRedeemDO::getExpressSender, request.getExpressSender());
wrapper.set(RewardRedeemDO::getAnnex, request.getAnnex());
wrapper.set(RewardRedeemDO::getRemark, request.getRemark());
wrapper.set(RewardRedeemDO::getUpdater, SecurityFrameworkUtils.getLoginUserId());
wrapper.set(RewardRedeemDO::getUpdateTime, new Date());
rewardRedeemMapper.update(null, wrapper);
return true;
}
@Override
public Boolean verify(RewardRedeemVerifyVO request) {
verifyValidateParam(request);
LambdaUpdateWrapper<RewardRedeemDO> wrapper = Wrappers.lambdaUpdate();
wrapper.eq(RewardRedeemDO::getId, request.getId());
wrapper.set(RewardRedeemDO::getStatus, RewardRedeemStatusEnum.REDEEMED.getValue());
wrapper.set(RewardRedeemDO::getRecipientName, request.getRecipientName());
wrapper.set(RewardRedeemDO::getRecipientPhoneNum, request.getRecipientPhoneNum());
wrapper.set(RewardRedeemDO::getRecipientAddress, request.getRecipientAddress());
wrapper.set(RewardRedeemDO::getCourierCompany, request.getCourierCompany());
wrapper.set(RewardRedeemDO::getExpressNo, request.getExpressNo());
wrapper.set(RewardRedeemDO::getExpressDate, request.getExpressDate());
wrapper.set(RewardRedeemDO::getExpressSender, request.getExpressSender());
wrapper.set(RewardRedeemDO::getVerifyUser, request.getVerifyUser());
wrapper.set(RewardRedeemDO::getVerifyTime, request.getVerifyTime());
wrapper.set(RewardRedeemDO::getUpdater, SecurityFrameworkUtils.getLoginUserId());
wrapper.set(RewardRedeemDO::getUpdateTime, new Date());
rewardRedeemMapper.update(null, wrapper);
return true;
}
private void verifyValidateParam(RewardRedeemVerifyVO request) {
RewardRedeemDO rewardRedeemDO = getById(request.getId());
if (rewardRedeemDO == null) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_NOT_EXIST);
}
if (rewardRedeemDO.getStatus() != RewardRedeemStatusEnum.REDEEMING.getValue()) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_STATUS_ERROR);
}
if (rewardRedeemDO.getRedeemType() != RewardPickMethedEnum.PICKUP.getValue()) {
//除上门领取状态外,其他方式需要验证 courierCompany, expressNo, expressDate, expressSender, recipientAddress 不能为空
if (request.getCourierCompany() == null) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_VERIFY_NO_PARAM);
}
if (StringUtils.isBlank(request.getExpressNo())) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_VERIFY_NO_PARAM);
}
if (request.getExpressDate() == null) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_VERIFY_NO_PARAM);
}
if (StringUtils.isBlank(request.getExpressSender())) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_VERIFY_NO_PARAM);
}
if (StringUtils.isBlank(request.getRecipientAddress())) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_VERIFY_NO_PARAM);
}
}
}
private void updateValidateParam(RewardRedeemUpdateVO request) {
RewardRedeemDO rewardRedeemDO = getById(request.getId());
if (rewardRedeemDO == null) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_NOT_EXIST);
}
if (rewardRedeemDO.getStatus() != RewardRedeemStatusEnum.REDEEMING.getValue()) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_STATUS_ERROR);
}
}
} }
...@@ -7,6 +7,8 @@ import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO; ...@@ -7,6 +7,8 @@ import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.reward.convert.reward.RewardConvert; 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.enums.QuantitativeRelationSymbolEnum;
import cn.iocoder.yudao.module.reward.enums.RewardStatusEnum;
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.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
...@@ -49,13 +51,9 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -49,13 +51,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);
} }
// 创建的礼品状态只能是启用或未启用 // 创建的礼品状态只能是启用或未启用
if (createReqVO.getStatus() != 1 && createReqVO.getStatus() != 2) { if (createReqVO.getStatus() != RewardStatusEnum.ENABLED.getValue() && createReqVO.getStatus() != RewardStatusEnum.DISABLED.getValue()) {
throw exception(REWARD_STATUS_NOT_ALLOW_CREATE); throw exception(REWARD_STATUS_NOT_ALLOW_CREATE);
} }
//领取方式只能是1,2,3
// if (createReqVO.getPickMethod() != 1 && createReqVO.getPickMethod() != 2 && createReqVO.getPickMethod() != 3) {
// 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());
...@@ -75,7 +73,6 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -75,7 +73,6 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
} }
@Override @Override
// TODO :完善校验
public void update(RewardUpdateReqVO updateReqVO) { public void update(RewardUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
RewardDO rewardDO = rewardMapper.selectById(updateReqVO.getId()); RewardDO rewardDO = rewardMapper.selectById(updateReqVO.getId());
...@@ -84,7 +81,7 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -84,7 +81,7 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
} }
RewardDO updateObj = new RewardDO(); RewardDO updateObj = new RewardDO();
//未启用可编辑所有内容 //未启用可编辑所有内容
if (rewardDO.getStatus() == 2) { if (rewardDO.getStatus() == RewardStatusEnum.DISABLED.getValue()) {
if (ObjectUtils.allNotNull(updateReqVO.getStartTime(), updateReqVO.getEndTime())) { if (ObjectUtils.allNotNull(updateReqVO.getStartTime(), updateReqVO.getEndTime())) {
if (updateReqVO.getStartTime().after((updateReqVO.getEndTime())) || updateReqVO.getEndTime().before(Date.from(Instant.now()))) { if (updateReqVO.getStartTime().after((updateReqVO.getEndTime())) || updateReqVO.getEndTime().before(Date.from(Instant.now()))) {
throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW_CREATE); throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW_CREATE);
...@@ -93,12 +90,8 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -93,12 +90,8 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
} else { } else {
throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW_CREATE); throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW_CREATE);
} }
//领取方式只能是1,2,3
// if (updateReqVO.getPickMethod() != 1 && updateReqVO.getPickMethod() != 2 && updateReqVO.getPickMethod() != 3) {
// 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() == RewardStatusEnum.ENABLED.getValue()) { //已启用可编辑剩余数量和备注
updateObj.setQuantityRemain(updateReqVO.getQuantityRemain()); updateObj.setQuantityRemain(updateReqVO.getQuantityRemain());
updateObj.setRemarkEn(updateReqVO.getRemarkEn()); updateObj.setRemarkEn(updateReqVO.getRemarkEn());
updateObj.setRemarkFr(updateReqVO.getRemarkFr()); updateObj.setRemarkFr(updateReqVO.getRemarkFr());
...@@ -117,7 +110,7 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -117,7 +110,7 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
throw exception(REWARD_NOT_EXISTS); throw exception(REWARD_NOT_EXISTS);
} }
//只有未启用可以删除 //只有未启用可以删除
if (rewardDO.getStatus() != 2) { if (rewardDO.getStatus() != RewardStatusEnum.DISABLED.getValue()) {
throw exception(REWARD_STATUS_NOT_ALLOW_DELETE); throw exception(REWARD_STATUS_NOT_ALLOW_DELETE);
} }
// 删除 // 删除
...@@ -166,9 +159,9 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -166,9 +159,9 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
} }
//兑换积分 //兑换积分
if (query.getPointsRequireSymbol() != null && query.getPointsRequire() != null) { if (query.getPointsRequireSymbol() != null && query.getPointsRequire() != null) {
lambdaQuery.gt(query.getPointsRequireSymbol() == 1, RewardDO::getPointsRequire, query.getPointsRequire()) lambdaQuery.gt(query.getPointsRequireSymbol() == QuantitativeRelationSymbolEnum.GT.getValue(), RewardDO::getPointsRequire, query.getPointsRequire())
.eq(query.getPointsRequireSymbol() == 2, RewardDO::getPointsRequire, query.getPointsRequire()) .eq(query.getPointsRequireSymbol() == QuantitativeRelationSymbolEnum.EQ.getValue(), RewardDO::getPointsRequire, query.getPointsRequire())
.lt(query.getPointsRequireSymbol() == 3, RewardDO::getPointsRequire, query.getPointsRequire()); .lt(query.getPointsRequireSymbol() == QuantitativeRelationSymbolEnum.LT.getValue(), RewardDO::getPointsRequire, query.getPointsRequire());
} }
//兑换网点id,领取方式,状态 //兑换网点id,领取方式,状态
lambdaQuery.eqIfPresent(RewardDO::getNodeId, query.getNodeId()) lambdaQuery.eqIfPresent(RewardDO::getNodeId, query.getNodeId())
...@@ -186,9 +179,9 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -186,9 +179,9 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
} }
//剩余数量 //剩余数量
if (query.getQuantityRemainSymbol() != null && query.getQuantityRemain() != null) { if (query.getQuantityRemainSymbol() != null && query.getQuantityRemain() != null) {
lambdaQuery.gt(query.getQuantityRemainSymbol() == 1, RewardDO::getQuantityRemain, query.getQuantityRemain()) lambdaQuery.gt(query.getQuantityRemainSymbol() == QuantitativeRelationSymbolEnum.GT.getValue(), RewardDO::getQuantityRemain, query.getQuantityRemain())
.eq(query.getQuantityRemainSymbol() == 2, RewardDO::getQuantityRemain, query.getQuantityRemain()) .eq(query.getQuantityRemainSymbol() == QuantitativeRelationSymbolEnum.EQ.getValue(), RewardDO::getQuantityRemain, query.getQuantityRemain())
.lt(query.getQuantityRemainSymbol() == 3, RewardDO::getQuantityRemain, query.getQuantityRemain()); .lt(query.getQuantityRemainSymbol() == QuantitativeRelationSymbolEnum.LT.getValue(), RewardDO::getQuantityRemain, query.getQuantityRemain());
} }
//创建时间 //创建时间
lambdaQuery.betweenIfPresent(RewardDO::getCreateTime, query.getBeginCreateTime(), query.getEndCreateTime()) lambdaQuery.betweenIfPresent(RewardDO::getCreateTime, query.getBeginCreateTime(), query.getEndCreateTime())
...@@ -213,7 +206,7 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -213,7 +206,7 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
//重新生成礼品ID //重新生成礼品ID
reward.setCode(generateRewardCode()); reward.setCode(generateRewardCode());
//设置为未启用 //设置为未启用
reward.setStatus(2); reward.setStatus(RewardStatusEnum.DISABLED.getValue());
reward.setId(null); reward.setId(null);
reward.setCreateTime(null); reward.setCreateTime(null);
...@@ -235,7 +228,7 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -235,7 +228,7 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
throw exception(REWARD_NOT_EXISTS); throw exception(REWARD_NOT_EXISTS);
} }
//只允许延期已启用状态礼品 //只允许延期已启用状态礼品
if (reward.getStatus() != 1) { if (reward.getStatus() != RewardStatusEnum.ENABLED.getValue()) {
throw exception(REWARD_STATUS_NOT_ALLOW_DELAY); throw exception(REWARD_STATUS_NOT_ALLOW_DELAY);
} }
Instant now = Instant.now(); Instant now = Instant.now();
...@@ -253,15 +246,17 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -253,15 +246,17 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
Integer oldStatus = rewardDO.getStatus(); Integer oldStatus = rewardDO.getStatus();
Integer newStatus = statusVO.getStatus(); Integer newStatus = statusVO.getStatus();
switch (newStatus) { switch (newStatus) {
case 3://关闭:未启用情况下,不可进行关闭;点击关闭需要有二次弹窗提示;关闭后状态为已关闭,不支持兑换 //关闭:未启用情况下,不可进行关闭;关闭后状态为已关闭,不支持兑换
if (oldStatus == 2) { case 3:
if (oldStatus == RewardStatusEnum.DISABLED.getValue()) {
throw exception(REWARD_STATUS_NOT_ALLOW_ClOSE); throw exception(REWARD_STATUS_NOT_ALLOW_ClOSE);
} else { } else {
rewardMapper.updateById(RewardConvert.INSTANCE.convertStatusReqVO(statusVO)); rewardMapper.updateById(RewardConvert.INSTANCE.convertStatusReqVO(statusVO));
} }
break; break;
case 1://启用:有效期有效且未启用可进行点击启用,需要有二次确认弹窗 //启用:有效期有效且未启用可进行点击启用
if (oldStatus == 2) { case 1:
if (oldStatus == RewardStatusEnum.DISABLED.getValue()) {
if (rewardDO.getEndTime().toInstant().isBefore(Instant.now())) { if (rewardDO.getEndTime().toInstant().isBefore(Instant.now())) {
throw exception(REWARD_STATUS_NOT_ALLOW_ENABLE); throw exception(REWARD_STATUS_NOT_ALLOW_ENABLE);
} }
...@@ -273,19 +268,23 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -273,19 +268,23 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
} }
} }
//生成礼品ID /**
* 生成礼品ID
*/
private String generateRewardCode() { private String generateRewardCode() {
return RandomStringUtils.randomAlphanumeric(12).toUpperCase(); return RandomStringUtils.randomAlphanumeric(12).toUpperCase();
} }
//校验礼品是否过期并修改礼品状态 /**
//TODO:异步更新礼品状态 * 校验礼品是否过期并修改礼品状态
*/
private void validateExpire(RewardDO rewardDO) { private void validateExpire(RewardDO rewardDO) {
if (rewardDO.getEndTime() != null){ //TODO:异步更新礼品状态
if (rewardDO.getStatus() == 1 && rewardDO.getEndTime().toInstant().isBefore(Instant.now())) { if (rewardDO.getEndTime() != null) {
if (rewardDO.getStatus() == RewardStatusEnum.DISABLED.getValue() && rewardDO.getEndTime().toInstant().isBefore(Instant.now())) {
RewardDO expireReward = new RewardDO(); RewardDO expireReward = new RewardDO();
expireReward.setId(rewardDO.getId()); expireReward.setId(rewardDO.getId());
expireReward.setStatus(4); expireReward.setStatus(RewardStatusEnum.EXPIRED.getValue());
rewardMapper.updateById(expireReward); rewardMapper.updateById(expireReward);
} }
} }
......
...@@ -78,7 +78,7 @@ public class RewardRedeemBaseVO { ...@@ -78,7 +78,7 @@ public class RewardRedeemBaseVO {
* 快递公司 * 快递公司
*/ */
@ApiModelProperty(value = "快递公司") @ApiModelProperty(value = "快递公司")
private String courierCompany; private Integer courierCompany;
/** /**
* 快递单号 * 快递单号
*/ */
...@@ -114,4 +114,14 @@ public class RewardRedeemBaseVO { ...@@ -114,4 +114,14 @@ public class RewardRedeemBaseVO {
private String updateTime; private String updateTime;
@ApiModelProperty(value = "是否删除") @ApiModelProperty(value = "是否删除")
private Boolean deleted; private Boolean deleted;
/**
* 核销人
*/
@ApiModelProperty(value = "核销人")
private String verifyUser;
/**
* 核销时间
*/
@ApiModelProperty(value = "核销时间")
private String verifyTime;
} }
package cn.iocoder.yudao.module.reward.vo.reward;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class RewardRedeemUpdateVO {
@NotNull(message = "id is not null")
@ApiModelProperty(value = "id")
private Long id;
@NotNull(message = "redeemType is not null")
@ApiModelProperty(value = "兑换方式")
private Integer redeemType;
@ApiModelProperty(value = "费用")
private BigDecimal expenses;
@ApiModelProperty(value = "币种")
private Integer currency;
/**
* 收件人姓名
*/
@NotNull(message = "recipientName is not null")
@ApiModelProperty(value = "收件人姓名")
private String recipientName;
/**
* 收件人电话
*/
@NotNull(message = "recipientPhoneNum is not null")
@ApiModelProperty(value = "收件人电话")
private String recipientPhoneNum;
/**
* 收件人地址
*/
@ApiModelProperty(value = "收件人地址")
private String recipientAddress;
/**
* 兑换人
*/
@ApiModelProperty(value = "兑换人")
private String redeemer;
/**
* 兑换时间
*/
@ApiModelProperty(value = "兑换时间")
private Date redemptionTime;
/**
* 快递公司
*/
@ApiModelProperty(value = "快递公司")
private String courierCompany;
/**
* 快递单号
*/
@ApiModelProperty(value = "快递单号")
private String expressNo;
/**
* 快递日期
*/
@ApiModelProperty(value = "快递日期")
private String expressDate;
/**
* 快递寄出人
*/
@ApiModelProperty(value = "快递寄出人")
private String expressSender;
/**
* 上传附件
*/
@ApiModelProperty(value = "上传附件")
private String annex;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remark;
}
package cn.iocoder.yudao.module.reward.vo.reward;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.Date;
@Data
public class RewardRedeemVerifyVO {
@NotNull(message = "id is not null")
@ApiModelProperty(value = "id")
private Long id;
/**
* 收件人姓名
*/
@NotNull(message = "recipientName is not null")
@ApiModelProperty(value = "收件人姓名")
private String recipientName;
/**
* 收件人电话
*/
@NotNull(message = "recipientPhoneNum is not null")
@ApiModelProperty(value = "收件人电话")
private String recipientPhoneNum;
@ApiModelProperty(value = "快递公司")
private Integer courierCompany;
/**
* 收件人地址
*/
@ApiModelProperty(value = "收件人地址")
private String recipientAddress;
/**
* 快递单号
*/
@ApiModelProperty(value = "快递单号")
private String expressNo;
/**
* 快递日期
*/
@ApiModelProperty(value = "快递日期")
private Date expressDate;
/**
* 快递寄出人
*/
@ApiModelProperty(value = "快递寄出人")
private String expressSender;
/**
* 核销人
*/
@ApiModelProperty(value = "核销人")
@NotNull(message = "verifyUser is not null")
private String verifyUser;
/**
* 核销时间
*/
@NotNull(message = "verify time is not null")
@ApiModelProperty(value = "核销时间")
private Date verifyTime;
}
...@@ -10,7 +10,6 @@ import javax.validation.constraints.Min; ...@@ -10,7 +10,6 @@ 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;
...@@ -20,7 +19,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ ...@@ -20,7 +19,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
public class RewardUpdateReqVO { public class RewardUpdateReqVO {
@ApiModelProperty(value = "", required = true) @ApiModelProperty(value = "", required = true)
@NotNull(message = "不能为空") @NotNull(message = "id不能为空")
private Long id; private Long id;
@ApiModelProperty(value = "中文名称") @ApiModelProperty(value = "中文名称")
...@@ -52,7 +51,6 @@ public class RewardUpdateReqVO { ...@@ -52,7 +51,6 @@ public class RewardUpdateReqVO {
private Integer nodeId; private Integer nodeId;
@ApiModelProperty(value = "剩余数量") @ApiModelProperty(value = "剩余数量")
@NotNull(message = "剩余数量不能为空")
@Min(value = 0) @Min(value = 0)
private Integer quantityRemain; private Integer quantityRemain;
......
...@@ -11,6 +11,44 @@ ...@@ -11,6 +11,44 @@
<select id="pageInfo" resultType="cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO"> <select id="pageInfo" resultType="cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO">
select select
<include refid="columns"/>
from ecw_reward_redeem err
left join ecw_reward er on err.reward_id = er.id
left join member_user mu on mu.id = err.member_id
left join ecw_node en on er.node_id = en.id
left join system_user suc on suc.id = er.creator
left join system_user suu on suu.id = er.updater
left join ecw_currency cc on err.currency = cc.id
where 1=1
<include refid="pageCondition"/>
order by er.create_time desc
limit #{start}, #{size}
</select>
<select id="pageCount" resultType="java.lang.Integer">
select count(*)
from ecw_reward_redeem err
left join ecw_reward er on err.reward_id = er.id
left join member_user mu on mu.id = err.member_id
left join ecw_node en on er.node_id = en.id
left join system_user suc on suc.id = er.creator
left join system_user suu on suu.id = er.updater
where 1=1
<include refid="pageCondition"/>
</select>
<select id="detail" resultType="cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO">
select
<include refid="columns"/>
from ecw_reward_redeem err
left join ecw_reward er on err.reward_id = er.id
left join member_user mu on mu.id = err.member_id
left join ecw_node en on er.node_id = en.id
left join system_user suc on suc.id = er.creator
left join system_user suu on suu.id = er.updater
left join ecw_currency cc on err.currency = cc.id
where err.id = #{id}
</select>
<sql id="columns">
err.id , err.id ,
err.member_id as memberId, err.member_id as memberId,
err.reward_id as rewardId, err.reward_id as rewardId,
...@@ -36,6 +74,8 @@ ...@@ -36,6 +74,8 @@
err.creator as creator, err.creator as creator,
err.updater as updater, err.updater as updater,
err.deleted as deleted, err.deleted as deleted,
err.verify_user as verifyUser,
err.verify_time as verifyTime,
mu.nickname as memberName, mu.nickname as memberName,
er.code as rewardCode, er.code as rewardCode,
er.title_zh as rewardTitleZh, er.title_zh as rewardTitleZh,
...@@ -49,29 +89,7 @@ ...@@ -49,29 +89,7 @@
cc.title_zh as currencyTitleZh, cc.title_zh as currencyTitleZh,
cc.title_en as currencyTitleEn, cc.title_en as currencyTitleEn,
(select username from system_user where id = er.updater) as updaterName (select username from system_user where id = er.updater) as updaterName
from ecw_reward_redeem err </sql>
left join ecw_reward er on err.reward_id = er.id
left join member_user mu on mu.id = err.member_id
left join ecw_node en on er.node_id = en.id
left join system_user suc on suc.id = er.creator
left join system_user suu on suu.id = er.updater
left join ecw_currency cc on err.currency = cc.id
where 1=1
<include refid="pageCondition"/>
order by er.create_time desc
limit #{start}, #{size}
</select>
<select id="pageCount" resultType="java.lang.Integer">
select count(*)
from ecw_reward_redeem err
left join ecw_reward er on err.reward_id = er.id
left join member_user mu on mu.id = err.member_id
left join ecw_node en on er.node_id = en.id
left join system_user suc on suc.id = er.creator
left join system_user suu on suu.id = er.updater
where 1=1
<include refid="pageCondition"/>
</select>
<sql id="pageCondition"> <sql id="pageCondition">
<if test="req.rewardTitle != null and req.rewardTitle !=''"> <if test="req.rewardTitle != null and req.rewardTitle !=''">
......
...@@ -1010,4 +1010,7 @@ reward.status.change.error=The reward status change error ...@@ -1010,4 +1010,7 @@ reward.status.change.error=The reward status change error
reward.status.not.allow.delay=Only enable status can delay reward.status.not.allow.delay=Only enable status can delay
reward.status.not.allow.create=Only enabled or disabled reward status can be created reward.status.not.allow.create=Only enabled or disabled reward status can be created
reward.time.not.allow=The reward time is not allow reward.time.not.allow=The reward time is not allow
get.lock.failed = The service is busy, please try again later get.lock.failed = The service is busy, please try again later
\ No newline at end of file reward.redeem.not.exist = reward redeem record does not exist
reward.redeem.status.error = reward redeem record that is redeeming can edit or verify
reward.redeem.verify.no.param = In addition to collect at home, the delivery company/delivery number/delivery time/delivery sender/recipient address must be filled in
\ No newline at end of file
...@@ -1014,4 +1014,7 @@ reward.status.change.error=\u793C\u54C1\u72B6\u6001\u64CD\u4F5C\u4E0D\u7B26\u540 ...@@ -1014,4 +1014,7 @@ reward.status.change.error=\u793C\u54C1\u72B6\u6001\u64CD\u4F5C\u4E0D\u7B26\u540
reward.status.not.allow.delay=\u53EA\u5141\u8BB8\u5EF6\u671F\u542F\u7528\u72B6\u6001\u793C\u54C1 reward.status.not.allow.delay=\u53EA\u5141\u8BB8\u5EF6\u671F\u542F\u7528\u72B6\u6001\u793C\u54C1
reward.status.not.allow.create=\u521B\u5EFA\u7684\u793C\u54C1\u72B6\u6001\u53EA\u80FD\u662F\u542F\u7528\u6216\u672A\u542F\u7528 reward.status.not.allow.create=\u521B\u5EFA\u7684\u793C\u54C1\u72B6\u6001\u53EA\u80FD\u662F\u542F\u7528\u6216\u672A\u542F\u7528
reward.time.not.allow=\u6D3B\u52A8\u65F6\u95F4\u4E0D\u5408\u6CD5 reward.time.not.allow=\u6D3B\u52A8\u65F6\u95F4\u4E0D\u5408\u6CD5
get.lock.failed = \u670D\u52A1\u7E41\u5FD9\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5 get.lock.failed = \u670D\u52A1\u7E41\u5FD9\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5
\ No newline at end of file reward.redeem.not.exist = \u793C\u54C1\u5151\u6362\u8BB0\u5F55\u4E0D\u5B58\u5728
reward.redeem.status.error = \u53EA\u6709\u5151\u6362\u4E2D\u72B6\u6001\u7684\u8BB0\u5F55\u624D\u5141\u8BB8\u7F16\u8F91\u6216\u6838\u9500
reward.redeem.verify.no.param = \u9664\u4E0A\u95E8\u9886\u53D6\u5916\uFF0C\u5FEB\u9012\u516C\u53F8/\u5FEB\u9012\u5355\u53F7/\u5FEB\u9012\u65F6\u95F4/\u5FEB\u9012\u53D1\u9001\u4EBA/\u6536\u4EF6\u4EBA\u5730\u5740\uFF0C\u5FC5\u987B\u586B\u5199
\ No newline at end of file
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