Commit 96aa5243 authored by zhangfeng's avatar zhangfeng

礼品兑换网点修改

parent c3cfff53
......@@ -63,7 +63,7 @@ public class RewardDO extends BaseDO {
/**
* 兑换网点
*/
private Integer nodeId;
private String nodeId;
/**
* 已兑换次数
*/
......
......@@ -24,10 +24,7 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.time.Instant;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
......@@ -173,9 +170,8 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
.eq(query.getPointsRequireSymbol() == QuantitativeRelationSymbolEnum.EQ.getValue(), RewardDO::getPointsRequire, query.getPointsRequire())
.lt(query.getPointsRequireSymbol() == QuantitativeRelationSymbolEnum.LT.getValue(), RewardDO::getPointsRequire, query.getPointsRequire());
}
//兑换网点id,领取方式,状态
lambdaQuery.eqIfPresent(RewardDO::getNodeId, query.getNodeId())
.eqIfPresent(RewardDO::getPickMethod, query.getPickMethod())
//领取方式,状态
lambdaQuery.eqIfPresent(RewardDO::getPickMethod, query.getPickMethod())
.eqIfPresent(RewardDO::getStatus, query.getStatus());
//备注,模糊匹配三种语言
if (query.getRemark() != null) {
......@@ -199,6 +195,10 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
PageResult<RewardDO> rewardDOPageResult = rewardMapper.selectPage(page, lambdaQuery);
//校验是否过期
rewardDOPageResult.getList().forEach(this::validateExpire);
// 过滤兑换网点
if (query.getNodeId() != null) {
rewardDOPageResult.getList().removeIf(rewardDO -> !Arrays.asList(rewardDO.getNodeId().split(",")).contains(query.getNodeId().toString()));
}
return rewardDOPageResult;
}
......@@ -295,9 +295,9 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
List<NodeRespDTO> nodes = null;
// 如果用户没有填写国家或城市默认展示中国的礼品
if (user.getCity() == null || user.getCountry() == null) {
nodes = nodeApi.getNodesByCity(null,130L);
nodes = nodeApi.getNodesByCity(null, 130L);
} else {
nodes = nodeApi.getNodesByCity(user.getCity().longValue(),null);
nodes = nodeApi.getNodesByCity(user.getCity().longValue(), null);
}
if (CollectionUtil.isNotEmpty(nodes)) {
rewardDOLambdaQuery.in(RewardDO::getNodeId, nodes.stream().map(NodeRespDTO::getId).collect(Collectors.toList()));
......
......@@ -58,7 +58,7 @@ public class RewardBackVO {
@ExcelProperty("兑换网点")
@ApiModelProperty(value = "兑换网点", required = true)
private Integer nodeId;
private String nodeId;
@ExcelProperty("已兑换次数")
@ApiModelProperty(value = "已兑换次数")
......
......@@ -47,7 +47,7 @@ public class RewardCreateReqVO {
@ApiModelProperty(value = "兑换网点", required = true)
@NotNull(message = "兑换网点不能为空")
private Integer nodeId;
private String nodeId;
@ApiModelProperty(value = "剩余数量", required = true)
@NotNull(message = "剩余数量不能为空")
......
......@@ -48,7 +48,7 @@ public class RewardUpdateReqVO {
private Integer pointsRequire;
@ApiModelProperty(value = "兑换网点")
private Integer nodeId;
private String nodeId;
@ApiModelProperty(value = "剩余数量")
@Min(value = 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