Commit 96aa5243 authored by zhangfeng's avatar zhangfeng

礼品兑换网点修改

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