Commit ce5c2e27 authored by zhangfeng's avatar zhangfeng

Merge branch 'refs/heads/feature_member_score_zhangfeng' into feature_member_score

parents 57807f35 0612f246
...@@ -65,9 +65,9 @@ public class ScoreRuleController { ...@@ -65,9 +65,9 @@ public class ScoreRuleController {
@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('member:score-rule:query')") @PreAuthorize("@ss.hasPermission('member:score-rule:query')")
public CommonResult<ScoreRuleBackVO> getScoreRule(@NotNull @RequestBody Long id) { public CommonResult<ScoreRuleBackDetailVO> getScoreRule(@NotNull @RequestBody Long id) {
ScoreRuleBackVO scoreRuleBackVO = scoreRuleService.getScoreRule(id); ScoreRuleBackDetailVO scoreRuleBackDetailVO = scoreRuleService.getScoreRule(id);
return success(scoreRuleBackVO); return success(scoreRuleBackDetailVO);
} }
@PostMapping("/list") @PostMapping("/list")
......
package cn.iocoder.yudao.module.member.convert.scoreRule; package cn.iocoder.yudao.module.member.convert.scoreRule;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.dal.dataobject.scoreRule.ScoreRuleDO;
import cn.iocoder.yudao.module.member.vo.scoreRule.ScoreRuleBackVO; 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.ScoreRuleCreateReqVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.ScoreRuleUpdateReqVO; import cn.iocoder.yudao.module.member.vo.scoreRule.ScoreRuleUpdateReqVO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.member.dal.dataobject.scoreRule.ScoreRuleDO;
import java.util.List;
/** /**
* 积分规则 DO Convert * 积分规则 DO Convert
......
...@@ -41,7 +41,7 @@ public interface ScoreRuleService extends IService<ScoreRuleDO> { ...@@ -41,7 +41,7 @@ public interface ScoreRuleService extends IService<ScoreRuleDO> {
* @param id 编号 * @param id 编号
* @return 积分规则 * @return 积分规则
*/ */
ScoreRuleBackVO getScoreRule(Long id); ScoreRuleBackDetailVO getScoreRule(Long id);
/** /**
* 获得积分规则列表 * 获得积分规则列表
......
...@@ -17,6 +17,7 @@ import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleOrderVExtraVO; ...@@ -17,6 +17,7 @@ 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.ScoreRuleRegisterExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleShareExtraVO; import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleShareExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRulerRecommendExtraVO; import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRulerRecommendExtraVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO; import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
...@@ -99,14 +100,15 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score ...@@ -99,14 +100,15 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
} }
@Override @Override
public ScoreRuleBackVO getScoreRule(Long id) { public ScoreRuleBackDetailVO getScoreRule(Long id) {
ScoreRuleDO scoreRuleDO = scoreRuleMapper.selectById(id); ScoreRuleDO scoreRuleDO = scoreRuleMapper.selectById(id);
if (scoreRuleDO == null) { if (scoreRuleDO == null) {
throw exception(SCORE_RULE_NOT_EXISTS); throw exception(SCORE_RULE_NOT_EXISTS);
} }
ScoreRuleBackVO scoreRuleBackVO = ScoreRuleConvert.INSTANCE.convert(scoreRuleDO); ScoreRuleBackDetailVO scoreRuleBackDetailVO = new ScoreRuleBackDetailVO();
setExtraVO(scoreRuleBackVO); BeanUtils.copyProperties(scoreRuleDO, scoreRuleBackDetailVO);
return scoreRuleBackVO; setExtraVO(scoreRuleBackDetailVO);
return scoreRuleBackDetailVO;
} }
...@@ -114,7 +116,6 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score ...@@ -114,7 +116,6 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
public List<ScoreRuleBackVO> getScoreRuleList(Collection<Long> ids) { public List<ScoreRuleBackVO> getScoreRuleList(Collection<Long> ids) {
List<ScoreRuleDO> scoreRuleDOS = scoreRuleMapper.selectBatchIds(ids); List<ScoreRuleDO> scoreRuleDOS = scoreRuleMapper.selectBatchIds(ids);
List<ScoreRuleBackVO> scoreRuleBackVOS = ScoreRuleConvert.INSTANCE.convertList(scoreRuleDOS); List<ScoreRuleBackVO> scoreRuleBackVOS = ScoreRuleConvert.INSTANCE.convertList(scoreRuleDOS);
scoreRuleBackVOS.forEach(this::setExtraVO);
return scoreRuleBackVOS; return scoreRuleBackVOS;
} }
...@@ -122,24 +123,23 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score ...@@ -122,24 +123,23 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
public PageResult<ScoreRuleBackVO> getScoreRulePage(ScoreRuleQueryVO query, PageVO page) { public PageResult<ScoreRuleBackVO> getScoreRulePage(ScoreRuleQueryVO query, PageVO page) {
PageResult<ScoreRuleDO> pageResult = scoreRuleMapper.selectPage(page, query); PageResult<ScoreRuleDO> pageResult = scoreRuleMapper.selectPage(page, query);
PageResult<ScoreRuleBackVO> scoreRuleBackVOPageResult = ScoreRuleConvert.INSTANCE.convertPage(pageResult); PageResult<ScoreRuleBackVO> scoreRuleBackVOPageResult = ScoreRuleConvert.INSTANCE.convertPage(pageResult);
scoreRuleBackVOPageResult.getList().forEach(this::setExtraVO);
return scoreRuleBackVOPageResult; return scoreRuleBackVOPageResult;
} }
/** /**
* 设置返回VO额外信息 * 设置返回VO额外信息
* *
* @param scoreRuleBackVO VO * @param scoreRuleBackDetailVO VO
*/ */
private void setExtraVO(ScoreRuleBackVO scoreRuleBackVO) { private void setExtraVO(ScoreRuleBackDetailVO scoreRuleBackDetailVO) {
if (scoreRuleBackVO.getType() == ScoreRuleTypeEnum.ORDER_V.getValue()) { if (scoreRuleBackDetailVO.getType() == ScoreRuleTypeEnum.ORDER_V.getValue()) {
scoreRuleBackVO.setExtraOrderV(JSONUtil.toBean(scoreRuleBackVO.getExtra(), ScoreRuleOrderVExtraVO.class)); scoreRuleBackDetailVO.setExtraOrderV(JSONUtil.toBean(scoreRuleBackDetailVO.getExtra(), ScoreRuleOrderVExtraVO.class));
} else if (scoreRuleBackVO.getType() == ScoreRuleTypeEnum.REGISTER.getValue()) { } else if (scoreRuleBackDetailVO.getType() == ScoreRuleTypeEnum.REGISTER.getValue()) {
scoreRuleBackVO.setExtraRegister(JSONUtil.toBean(scoreRuleBackVO.getExtra(), ScoreRuleRegisterExtraVO.class)); scoreRuleBackDetailVO.setExtraRegister(JSONUtil.toBean(scoreRuleBackDetailVO.getExtra(), ScoreRuleRegisterExtraVO.class));
} else if (scoreRuleBackVO.getType() == ScoreRuleTypeEnum.RECOMMEND.getValue()) { } else if (scoreRuleBackDetailVO.getType() == ScoreRuleTypeEnum.RECOMMEND.getValue()) {
scoreRuleBackVO.setExtraRecommend(JSONUtil.toBean(scoreRuleBackVO.getExtra(), ScoreRulerRecommendExtraVO.class)); scoreRuleBackDetailVO.setExtraRecommend(JSONUtil.toBean(scoreRuleBackDetailVO.getExtra(), ScoreRulerRecommendExtraVO.class));
} else if (scoreRuleBackVO.getType() == ScoreRuleTypeEnum.SHARE.getValue()) { } else if (scoreRuleBackDetailVO.getType() == ScoreRuleTypeEnum.SHARE.getValue()) {
scoreRuleBackVO.setExtraShare(JSONUtil.toBean(scoreRuleBackVO.getExtra(), ScoreRuleShareExtraVO.class)); scoreRuleBackDetailVO.setExtraShare(JSONUtil.toBean(scoreRuleBackDetailVO.getExtra(), ScoreRuleShareExtraVO.class));
} else { } else {
throw exception(SCORE_RULE_NOT_EXISTS); throw exception(SCORE_RULE_NOT_EXISTS);
} }
......
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel("管理后台 - 积分规则详细信息 Response VO")
public class ScoreRuleBackDetailVO extends ScoreRuleBackVO{
@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; 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 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 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; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/** /**
...@@ -17,7 +15,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ ...@@ -17,7 +15,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
* @author 系统管理员 * @author 系统管理员
*/ */
@Data @Data
@ApiModel("管理后台 - 积分规则 Response VO") @ApiModel("管理后台 - 积分规则基本信息 Response VO")
public class ScoreRuleBackVO { public class ScoreRuleBackVO {
@ExcelProperty("主键") @ExcelProperty("主键")
...@@ -72,7 +70,7 @@ public class ScoreRuleBackVO { ...@@ -72,7 +70,7 @@ public class ScoreRuleBackVO {
@ExcelProperty("积分有效期") @ExcelProperty("积分有效期")
@ApiModelProperty(value = "积分有效期", required = true) @ApiModelProperty(value = "积分有效期", required = true)
private Integer socrePeriod; private Integer scorePeriod;
@ExcelProperty("排序值") @ExcelProperty("排序值")
@ApiModelProperty(value = "排序值", required = true) @ApiModelProperty(value = "排序值", required = true)
...@@ -95,15 +93,17 @@ public class ScoreRuleBackVO { ...@@ -95,15 +93,17 @@ public class ScoreRuleBackVO {
@ApiModelProperty(value = "创建时间", required = true) @ApiModelProperty(value = "创建时间", required = true)
private Date createTime; private Date createTime;
@ApiModelProperty(value = "扩展字段原始") @ExcelProperty("更新时间")
private String extra; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "订单V值扩展字段") @ApiModelProperty(value = "更新时间", required = true)
private ScoreRuleOrderVExtraVO extraOrderV; private Date updateTime;
@ApiModelProperty(value = "注册扩展字段")
private ScoreRuleRegisterExtraVO extraRegister; @ExcelProperty("创建人")
@ApiModelProperty(value = "推荐扩展字段") @ApiModelProperty(value = "创建人", required = true)
private ScoreRulerRecommendExtraVO extraRecommend; private String creator;
@ApiModelProperty(value = "分享扩展字段")
private ScoreRuleShareExtraVO extraShare; @ExcelProperty("更新人")
@ApiModelProperty(value = "更新人", required = true)
private String updater;
} }
...@@ -70,7 +70,7 @@ public class ScoreRuleBaseVO { ...@@ -70,7 +70,7 @@ public class ScoreRuleBaseVO {
@NotNull(message = "排序值不能为空") @NotNull(message = "排序值不能为空")
private Integer orderNum; private Integer orderNum;
@ApiModelProperty(value = "是否推送(0是,1否)", required = true) @ApiModelProperty(value = "是否推送(0是,1否)默认是", required = true)
@NotNull(message = "是否推送不能为空") @NotNull(message = "是否推送不能为空")
private Integer pushActivity = 0; private Integer pushActivity = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment