Commit f6f1fad2 authored by zhangfeng's avatar zhangfeng

客户端兑换记录

parent 7ff95b93
......@@ -83,6 +83,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
// 计算积分
List<ScoreRuleOrderVExtraVO.OrderVRule> orderVRules = extraInfo.getOrderVRule();
Integer scoreCount = 0;
// TODO:体积和重量取的字段确认
if (transportId == TransportTypeEnum.OCEAN_LCL.getValue()) {
// 海运算重量
BigDecimal orgVWeight = order.getOrgVWeight();
......
package cn.iocoder.yudao.module.reward.controller.app.config;
import cn.iocoder.yudao.framework.swagger.config.YudaoSwaggerAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.spring.web.plugins.Docket;
import javax.annotation.Resource;
/**
* Swagger2 自动配置类
*
* @author 捷道源码
*/
@Configuration
public class SwaggerAppRewardConfiguration {
@Bean
public Docket createAppRewardApi() {
String title = "客户端-礼品模块";
String author = "客户端-礼品模块";
String basePackage = "cn.iocoder.yudao.module.reward.controller.app";
// 创建 Docket 对象
return autoConfiguration.docket(title, author, basePackage);
}
@Resource
private YudaoSwaggerAutoConfiguration autoConfiguration;
}
\ No newline at end of file
package cn.iocoder.yudao.module.reward.controller.app.redeem;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.reward.api.reward.RedeemRewardApi;
import cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardReqVO;
import cn.iocoder.yudao.module.reward.api.reward.dto.RedeemRewardRespDTO;
import cn.iocoder.yudao.module.reward.controller.app.redeem.vo.AppRewardRedeemListRespVO;
import cn.iocoder.yudao.module.reward.service.redeem.RewardRedeemService;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemBaseVO;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemPageRespVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated
@RestController
@Api(tags = "用户 APP - 兑换记录管理")
@RequestMapping("/reward/redeem")
public class AppRedeemRewardController {
@Resource
private RedeemRewardApi redeemRewardApi;
@Resource
private RewardRedeemService rewardRedeemService;
@PostMapping("record/list")
@ApiOperation("兑换记录列表")
//@PreAuthenticated
public CommonResult<List<AppRewardRedeemListRespVO>> recordList(@Valid @RequestBody RewardRedeemBaseVO request) {
return success(rewardRedeemService.recordList(request.getMemberId()));
}
@PostMapping("record/detail")
@ApiOperation("兑换详情")
//@PreAuthenticated
public CommonResult<RewardRedeemPageRespVO> detail(@Valid @RequestBody RewardRedeemBaseVO request) {
return success(rewardRedeemService.detail(request.getId()));
}
@PostMapping("/single")
@ApiOperation("兑换礼品")
//@PreAuthenticated
public CommonResult<RedeemRewardRespDTO> redeemReward(@Valid @RequestBody RedeemRewardReqVO redeemRewardReqVO) {
return success(redeemRewardApi.redeemReward(redeemRewardReqVO));
}
}
package cn.iocoder.yudao.module.reward.controller.app.redeem.vo;
import cn.iocoder.yudao.module.reward.vo.reward.RewardRedeemBaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@ApiModel("客户端 - 礼品兑换记录列表 VO")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class AppRewardRedeemListRespVO {
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "礼品ID")
private Long rewardCode;
@ApiModelProperty(value = "礼品名称(中文)")
private String rewardTitleZh;
@ApiModelProperty(value = "礼品名称(英文)")
private String rewardTitleEn;
@ApiModelProperty(value = "礼品名称(法文)")
private String rewardTitleFr;
@ApiModelProperty(value = "兑换数量")
private Integer rewardCount;
@ApiModelProperty(value = "花费积分")
private Integer scoreCount;
@ApiModelProperty(value = "日志时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date createTime;
}
......@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.reward.service.redeem;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.module.reward.controller.app.redeem.vo.AppRewardRedeemListRespVO;
import cn.iocoder.yudao.module.reward.dal.dataobject.redeem.RewardRedeemDO;
import cn.iocoder.yudao.module.reward.vo.reward.*;
......@@ -37,4 +38,6 @@ public interface RewardRedeemService extends IService<RewardRedeemDO> {
Boolean cancel(RewardRedeemIdReqVO req);
RedeemCancelCheckRespVO cancelCheck(RewardRedeemIdReqVO req);
List<AppRewardRedeemListRespVO> recordList(Long memberId);
}
......@@ -16,12 +16,15 @@ import cn.iocoder.yudao.module.member.api.score.MemberUserScoreApi;
import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreOperateReqDTO;
import cn.iocoder.yudao.module.member.api.score.dto.ReleationScoreExpireInfoDTO;
import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum;
import cn.iocoder.yudao.module.reward.controller.app.redeem.vo.AppRewardRedeemListRespVO;
import cn.iocoder.yudao.module.reward.dal.dataobject.redeem.RewardRedeemDO;
import cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO;
import cn.iocoder.yudao.module.reward.dal.mysql.redeem.RewardRedeemMapper;
import cn.iocoder.yudao.module.reward.dto.RewardRedeemVerifyDTO;
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.*;
import cn.iocoder.yudao.module.system.api.file.FileMakeApi;
import cn.iocoder.yudao.module.system.api.file.dto.FileMakeReqDTO;
......@@ -35,6 +38,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -59,14 +63,16 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
private final ExpressApi expressApi;
private final CurrencyApi currencyApi;
private final MemberUserScoreApi memberUserScoreApi;
private final RewardService rewardService;
public RewardRedeemServiceImpl(RewardRedeemMapper rewardRedeemMapper, FileMakeApi fileMakeApi,
ExpressApi expressApi, CurrencyApi currencyApi, MemberUserScoreApi memberUserScoreApi) {
ExpressApi expressApi, CurrencyApi currencyApi, MemberUserScoreApi memberUserScoreApi, RewardService rewardService) {
this.rewardRedeemMapper = rewardRedeemMapper;
this.fileMakeApi = fileMakeApi;
this.expressApi = expressApi;
this.currencyApi = currencyApi;
this.memberUserScoreApi = memberUserScoreApi;
this.rewardService = rewardService;
}
@Override
......@@ -295,6 +301,24 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
return RedeemCancelCheckRespVO.builder().expireCount(totalExpireScore).build();
}
@Override
public List<AppRewardRedeemListRespVO> recordList(Long memberId) {
List<RewardRedeemDO> rewardRedeemDOList = rewardRedeemMapper.selectList("member_id", memberId);
return rewardRedeemDOList.stream().map(rewardRedeemDO -> {
RewardDO rewardDO = rewardService.getById(rewardRedeemDO.getRewardId());
return AppRewardRedeemListRespVO.builder()
.id(rewardRedeemDO.getId())
.createTime(rewardRedeemDO.getCreateTime())
.rewardCode(rewardRedeemDO.getRewardId())
.rewardTitleEn(rewardDO.getTitleEn())
.rewardTitleFr(rewardDO.getTitleFr())
.rewardTitleZh(rewardDO.getTitleZh())
.rewardCount(rewardRedeemDO.getRewardCount())
.scoreCount(rewardRedeemDO.getScoreCount())
.build();
}).collect(Collectors.toList());
}
private Map<String, String> validate(List<RedeemInfoImportExcelVO> dataList, Map<String, CurrencyRespDTO> titleZhCurrencyMap,
Map<String, CurrencyRespDTO> titleEnCurrencyMap,
Map<String, ExpressRespDTO> nameExpressMap) {
......
......@@ -3,9 +3,11 @@ package cn.iocoder.yudao.module.reward.vo.reward;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@ApiModel("管理后台 - 礼品兑换记录分页结果 VO")
@EqualsAndHashCode(callSuper = true)
public class RewardRedeemPageRespVO extends RewardRedeemBaseVO {
@ApiModelProperty(value = "会员名称中文")
private String memberNameZh;
......
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