Commit 6cc0b7df authored by zhangfeng's avatar zhangfeng

获得目的仓树形列表返回优化

parent 930bb1a7
package cn.iocoder.yudao.module.member.service.scoreRule;
import java.time.Instant;
import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
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;
import cn.iocoder.yudao.module.depository.service.warehouse.WarehouseService;
import cn.iocoder.yudao.module.depository.vo.warehouse.WarehouseTreeRegionVO;
import cn.iocoder.yudao.module.member.convert.scoreRule.ScoreRuleConvert;
......@@ -31,11 +27,13 @@ import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import javax.annotation.Resource;
import java.time.Instant;
import java.util.*;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
import static java.util.Arrays.stream;
/**
* 积分规则 Service 实现类
......@@ -458,18 +456,18 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
ArrayList<WarehouseTreeRegionSimpleVO> warehouseTreeRegionSimpleVOS = new ArrayList<>();
for (WarehouseTreeRegionVO warehouseTreeRegionVO : list) {
WarehouseTreeRegionSimpleVO warehouseTreeRegionSimpleVO = new WarehouseTreeRegionSimpleVO();
warehouseTreeRegionSimpleVO.setCountryId(warehouseTreeRegionVO.getGuojia());
warehouseTreeRegionSimpleVO.setId(warehouseTreeRegionVO.getGuojia());
warehouseTreeRegionSimpleVO.setLabelZh(warehouseTreeRegionVO.getGuojiaName().replaceAll("\t", ""));
warehouseTreeRegionSimpleVO.setLabelEn(warehouseTreeRegionVO.getChildren().get(0).getGuojiaNameEn());
ArrayList<WarehouseTreeRegionSimpleVO.WarehouseCity> warehouseCitiesSimple = new ArrayList<>();
for (WarehouseTreeRegionVO warehouseTreeRegionVOChild : warehouseTreeRegionVO.getChildren()) {
WarehouseTreeRegionSimpleVO.WarehouseCity warehouseCity = new WarehouseTreeRegionSimpleVO.WarehouseCity();
warehouseCity.setCityId(warehouseTreeRegionVOChild.getShi());
warehouseCity.setId(warehouseTreeRegionVOChild.getShi());
warehouseCity.setLabelZh(warehouseTreeRegionVOChild.getShiName().replaceAll("\t", ""));
warehouseCity.setLabelEn(warehouseTreeRegionVOChild.getShiNameEn());
if (warehouseCitiesSimple.contains(warehouseCity)) {
WarehouseTreeRegionSimpleVO.Warehouse warehouse = new WarehouseTreeRegionSimpleVO.Warehouse();
warehouse.setWarehouseId(warehouseTreeRegionVOChild.getId());
warehouse.setId(warehouseTreeRegionVOChild.getId());
warehouse.setLabelZh(warehouseTreeRegionVOChild.getTitleZh());
warehouse.setLabelEn(warehouseTreeRegionVOChild.getTitleEn());
warehouseCitiesSimple.get(warehouseCitiesSimple.indexOf(warehouseCity)).getChildren().add(warehouse);
......@@ -477,7 +475,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
}
ArrayList<WarehouseTreeRegionSimpleVO.Warehouse> warehouseSimples = new ArrayList<>();
WarehouseTreeRegionSimpleVO.Warehouse warehouse = new WarehouseTreeRegionSimpleVO.Warehouse();
warehouse.setWarehouseId(warehouseTreeRegionVOChild.getId());
warehouse.setId(warehouseTreeRegionVOChild.getId());
warehouse.setLabelZh(warehouseTreeRegionVOChild.getTitleZh().replaceAll("\t", ""));
warehouse.setLabelEn(warehouseTreeRegionVOChild.getTitleEn());
warehouseSimples.add(warehouse);
......
package cn.iocoder.yudao.module.member.vo.scoreRule;
import cn.iocoder.yudao.module.depository.vo.warehouse.WarehouseRespVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -10,7 +9,7 @@ import java.util.Objects;
@Data
public class WarehouseTreeRegionSimpleVO {
@ApiModelProperty("国家id")
private Long countryId;
private Long id;
@ApiModelProperty("国家中文名")
private String labelZh;
@ApiModelProperty("国家英文名")
......@@ -22,7 +21,7 @@ public class WarehouseTreeRegionSimpleVO {
@Data
public static class WarehouseCity {
@ApiModelProperty("城市id")
private Long cityId;
private Long id;
@ApiModelProperty("城市中文名")
private String labelZh;
@ApiModelProperty("城市英文名")
......@@ -35,18 +34,18 @@ public class WarehouseTreeRegionSimpleVO {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
WarehouseCity that = (WarehouseCity) o;
return Objects.equals(cityId, that.cityId);
return Objects.equals(id, that.id);
}
@Override
public int hashCode() {
return Objects.hashCode(cityId);
return Objects.hashCode(id);
}
}
@Data
public static class Warehouse {
@ApiModelProperty("仓库id")
private Long warehouseId;
private Long id;
@ApiModelProperty("仓库中文名")
private String labelZh;
@ApiModelProperty("仓库英文名")
......
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