Commit c6ce937a authored by zhangfeng's avatar zhangfeng

客户端接口字典翻译

parent 369fbe44
......@@ -8,4 +8,6 @@ import java.util.List;
public interface NodeApi {
List<NodeRespDTO> getNodesByCity(Long cityId,Long countryId);
List<NodeTreeRegionDTO> getNodeTreeRegion();
NodeRespDTO getNodesById(Long id);
}
......@@ -41,4 +41,15 @@ public class NodeApiImpl implements NodeApi {
public List<NodeTreeRegionDTO> getNodeTreeRegion() {
return nodeMapper.getNodeTreeRegionList();
}
@Override
public NodeRespDTO getNodesById(Long id) {
NodeDO nodeDO = nodeMapper.selectById(id);
if (nodeDO != null) {
NodeRespDTO nodeRespDTO = new NodeRespDTO();
BeanUtils.copyProperties(nodeDO, nodeRespDTO);
return nodeRespDTO;
}
return null;
}
}
......@@ -20,6 +20,10 @@ public class AppScoreRuleListBackVO {
@ApiModelProperty(value = "指标类型", required = true)
private Integer type;
@ApiModelProperty(value = "指标类型中文")
private String typeZh;
@ApiModelProperty(value = "指标类型英文")
private String typeEn;
@ApiModelProperty(value = "规则标题中文", required = true)
private String titleZh;
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
......@@ -508,6 +509,9 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
ScoreRuleShareExtraVO scoreRuleShareExtraVO = JsonUtils.parseObject(scoreRuleDO.getExtra(), ScoreRuleShareExtraVO.class);
appScoreRuleListBackVO.setExtraShare(scoreRuleShareExtraVO);
}
String type = appScoreRuleListBackVO.getType().toString();
appScoreRuleListBackVO.setTypeZh(DictFrameworkUtils.getDictDataFromCache("score_rule_type", type).getLabel());
appScoreRuleListBackVO.setTypeEn(DictFrameworkUtils.getDictDataFromCache("score_rule_type", type).getLabelEn());
appScoreRuleListBackVOS.add(appScoreRuleListBackVO);
}
return appScoreRuleListBackVOS;
......@@ -520,6 +524,9 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
ScoreRuleBackDetailVO scoreRule = getScoreRule(id);
AppScoreRuleBackDetailVO appScoreRuleBackDetailVO = new AppScoreRuleBackDetailVO();
BeanUtils.copyProperties(scoreRule, appScoreRuleBackDetailVO);
String type = appScoreRuleBackDetailVO.getType().toString();
appScoreRuleBackDetailVO.setTypeZh(DictFrameworkUtils.getDictDataFromCache("score_rule_type", type).getLabel());
appScoreRuleBackDetailVO.setTypeEn(DictFrameworkUtils.getDictDataFromCache("score_rule_type", type).getLabelEn());
return appScoreRuleBackDetailVO;
}
}
package cn.iocoder.yudao.module.reward.controller.app.redeem;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.reward.api.reward.RedeemRewardApi;
......@@ -48,6 +49,12 @@ public class AppRedeemRewardController {
if (detail != null) {
AppRewardRedeemDetailRespVO appRewardRedeemDetailRespVO = new AppRewardRedeemDetailRespVO();
BeanUtils.copyProperties(detail, appRewardRedeemDetailRespVO);
String status = appRewardRedeemDetailRespVO.getStatus().toString();
appRewardRedeemDetailRespVO.setStatusZh(DictFrameworkUtils.getDictDataFromCache("reward_redeem_status", status).getLabel());
appRewardRedeemDetailRespVO.setStatusEn(DictFrameworkUtils.getDictDataFromCache("reward_redeem_status", status).getLabelEn());
String redeemType = appRewardRedeemDetailRespVO.getRedeemType().toString();
appRewardRedeemDetailRespVO.setRedeemTypeZh(DictFrameworkUtils.getDictDataFromCache("way_of_receiving", redeemType).getLabel());
appRewardRedeemDetailRespVO.setRedeemTypeEn(DictFrameworkUtils.getDictDataFromCache("way_of_receiving", redeemType).getLabelEn());
return success(appRewardRedeemDetailRespVO);
}
return null;
......
......@@ -20,6 +20,10 @@ public class AppRewardRedeemDetailRespVO {
private Long rewardId;
@ApiModelProperty(value = "兑换状态")
private Integer status;
@ApiModelProperty(value = "兑换状态中文")
private String statusZh;
@ApiModelProperty(value = "兑换状态英文")
private String statusEn;
@ApiModelProperty(value = "兑换积分")
private Integer totalCount;
@ApiModelProperty(value = "礼品名称(中文)")
......@@ -40,6 +44,10 @@ public class AppRewardRedeemDetailRespVO {
private Integer oncePointsRequire;
@ApiModelProperty(value = "兑换方式")
private Integer redeemType;
@ApiModelProperty(value = "兑换方式中文")
private String redeemTypeZh;
@ApiModelProperty(value = "兑换方式英文")
private String redeemTypeEn;
@ApiModelProperty(value = "兑换网点(中文)")
private String nodeTitleZh;
@ApiModelProperty(value = "兑换网点(英文)")
......
package cn.iocoder.yudao.module.reward.controller.app.reward;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
import cn.iocoder.yudao.module.ecw.api.node.NodeApi;
import cn.iocoder.yudao.module.ecw.api.node.dto.NodeRespDTO;
import cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardBackVO;
import cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardListReqVO;
import cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO;
......@@ -25,15 +28,14 @@ public class AppRewardController {
@Resource
private RewardService rewardService;
@Resource
private NodeApi nodeApi;
@GetMapping("/get")
@ApiOperation("获得礼品详情")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
public CommonResult<AppRewardBackVO> get(@RequestParam("id") Long id) {
RewardDO rewardDO = rewardService.get(id);
AppRewardBackVO appRewardBackVO = new AppRewardBackVO();
BeanUtils.copyProperties(rewardDO, appRewardBackVO);
return success(appRewardBackVO);
return success(rewardService.getRewardDetailForUser(id));
}
@PostMapping("/list")
......
......@@ -18,65 +18,62 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ApiModel("客户端 - 礼品 Response VO")
public class AppRewardBackVO {
@ExcelProperty("")
@ApiModelProperty(value = "", required = true)
@ApiModelProperty(value = "")
private Long id;
@ExcelProperty("礼品ID")
@ApiModelProperty(value = "礼品ID", required = true)
@ApiModelProperty(value = "礼品ID")
private String code;
@ExcelProperty("中文名称")
@ApiModelProperty(value = "中文名称")
private String titleZh;
@ExcelProperty("英文名称")
@ApiModelProperty(value = "英文名称")
private String titleEn;
//@ExcelProperty("法文名称")
//@ApiModelProperty(value = "法文名称")
//private String titleFr;
@ExcelProperty("中文礼品图片")
@ApiModelProperty(value = "中文礼品图片")
private String imgZh;
@ExcelProperty("英文礼品图片")
@ApiModelProperty(value = "英文礼品图片")
private String imgEn;
//@ExcelProperty("法文礼品图片")
//@ApiModelProperty(value = "法文礼品图片")
//private String imgFr;
@ExcelProperty("兑换所需积分")
@ApiModelProperty(value = "兑换所需积分", required = true)
@ApiModelProperty(value = "兑换所需积分")
private Integer pointsRequire;
@ExcelProperty("兑换网点")
@ApiModelProperty(value = "兑换网点", required = true)
@ApiModelProperty(value = "兑换网点id")
private Integer nodeId;
@ApiModelProperty(value = "兑换网点中文")
private String nodeZh;
@ApiModelProperty(value = "兑换网点英文")
private String nodeEn;
@ExcelProperty("剩余数量")
@ApiModelProperty(value = "剩余数量", required = true)
@ApiModelProperty(value = "剩余数量")
private Integer quantityRemain;
@ExcelProperty("活动开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "活动开始时间")
private Date startTime;
@ExcelProperty("活动结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "活动结束时间")
private Date endTime;
@ExcelProperty("领取方式(1上门领取,2包邮到家,3邮寄到付)")
@ApiModelProperty(value = "领取方式(1上门领取,2包邮到家,3邮寄到付)", required = true)
@ApiModelProperty(value = "领取方式(1上门领取,2包邮到家,3邮寄到付)")
private String pickMethod;
@ExcelProperty("允许兑换次数")
@ApiModelProperty(value = "允许兑换次数", required = true)
@ApiModelProperty(value = "领取方式:上门领取")
private String selfPickupZh;
private String selfPickupEn;
@ApiModelProperty(value = "领取方式:包邮到家")
private String sendHomeFreeZh;
private String sendHomeFreeEn;
@ApiModelProperty(value = "领取方式:邮寄到付")
private String sendHomePayZh;
private String sendHomePayEn;
@ApiModelProperty(value = "允许兑换次数")
private Integer allowCount;
}
......@@ -85,4 +85,6 @@ public interface RewardService extends IService<RewardDO> {
* @return
*/
List<AppRewardBackVO> getListByMemberInfo(AppRewardListReqVO reqVO);
AppRewardBackVO getRewardDetailForUser(Long id);
}
......@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.reward.service.reward;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
......@@ -20,6 +21,7 @@ import cn.iocoder.yudao.module.reward.vo.reward.*;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
......@@ -338,11 +340,42 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
}
List<RewardDO> rewardDOS = rewardMapper.selectList(rewardDOLambdaQuery);
if (rewardDOS != null && !rewardDOS.isEmpty()) {
return rewardDOS.stream().map(RewardConvert.INSTANCE::convertAppVO).collect(Collectors.toList());
List<AppRewardBackVO> collect = rewardDOS.stream().map(RewardConvert.INSTANCE::convertAppVO).collect(Collectors.toList());
collect.forEach(this::setPickMethod);
return collect;
}
return Collections.EMPTY_LIST;
}
@Override
public AppRewardBackVO getRewardDetailForUser(Long id) {
RewardDO rewardDO = rewardMapper.selectById(id);
AppRewardBackVO appRewardBackVO = new AppRewardBackVO();
BeanUtils.copyProperties(rewardDO, appRewardBackVO);
setPickMethod(appRewardBackVO);
NodeRespDTO nodesById = nodeApi.getNodesById(Long.valueOf(rewardDO.getNodeId()));
if (nodesById != null){
appRewardBackVO.setNodeZh(nodesById.getTitleZh());
appRewardBackVO.setNodeEn(nodesById.getTitleEn());
}
return appRewardBackVO;
}
private void setPickMethod(AppRewardBackVO appRewardBackVO){
for (String pickMethod : appRewardBackVO.getPickMethod().split(",")) {
if ("1".equals(pickMethod)) {
appRewardBackVO.setSelfPickupZh(DictFrameworkUtils.getDictDataFromCache("way_of_receiving", pickMethod).getLabel());
appRewardBackVO.setSelfPickupEn(DictFrameworkUtils.getDictDataFromCache("way_of_receiving", pickMethod).getLabelEn());
} else if ("2".equals(pickMethod)) {
appRewardBackVO.setSendHomeFreeZh(DictFrameworkUtils.getDictDataFromCache("way_of_receiving", pickMethod).getLabel());
appRewardBackVO.setSendHomeFreeEn(DictFrameworkUtils.getDictDataFromCache("way_of_receiving", pickMethod).getLabelEn());
} else if ("3".equals(pickMethod)) {
appRewardBackVO.setSendHomePayZh(DictFrameworkUtils.getDictDataFromCache("way_of_receiving", pickMethod).getLabel());
appRewardBackVO.setSendHomePayEn(DictFrameworkUtils.getDictDataFromCache("way_of_receiving", pickMethod).getLabelEn());
}
}
}
/**
* 生成礼品ID
*/
......
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