From 7cd3dea07f5b7cefad9dea9fd7daf992449aaac8 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期二, 12 三月 2024 18:24:38 +0800 Subject: [PATCH] 修改bug --- cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java index 46adbc8..c809190 100644 --- a/cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java +++ b/cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java @@ -9,6 +9,7 @@ import com.dsh.other.service.IHomeModuleService; import com.dsh.other.service.StoreConfigService; import com.dsh.other.util.ResultUtil; +import com.dsh.other.util.ToolUtil; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; @@ -65,12 +66,14 @@ StoreConfigVo vo = new StoreConfigVo(); vo.setType(0); vo.setIsOpen(homeModule.getIsOpen()); + vo.setIsTop(homeModule.getIsTop()); vo.setSort(homeModule.getSort()); vo.setBackgroundImage(homeModule.getBackgroundImage()); listVo.add(vo); } for (StoreConfig storeConfig : list) { StoreConfigVo storeConfigVo = new StoreConfigVo(); + storeConfigVo.setIsTop(0); BeanUtils.copyProperties(storeConfig, storeConfigVo); if (!StringUtils.hasLength(storeConfig.getBackgroundImage())) { switch (storeConfigVo.getType()) { @@ -116,8 +119,9 @@ List<WorldCupStore> worldCupStoreList = worldCupStoreClient.getWorldCupStoreList(storeId); for (WorldCupStore worldCupStore : worldCupStoreList) { StoreConfigVo storeConfigVo = new StoreConfigVo(); + storeConfigVo.setIsTop(0); storeConfigVo.setId(worldCupStore.getWorldCupId()); - storeConfigVo.setBackgroundImage(worldCupStore.getBackgroundImage()); + storeConfigVo.setBackgroundImage(ToolUtil.isNotEmpty(worldCupStore.getBackgroundImage()) ? worldCupStore.getBackgroundImage() : "https://we-park-life.oss-cn-beijing.aliyuncs.com/img/760934115ff6468591ed51f0d760a989.jpg"); storeConfigVo.setType(9); storeConfigVo.setIsOpen(worldCupStore.getIsOpen()); storeConfigVo.setSort(worldCupStore.getSort()); @@ -132,6 +136,16 @@ return o1.getSort().compareTo(o2.getSort()); } }); + //排序 + Collections.sort(listVo, new Comparator<StoreConfigVo>() { + @Override + public int compare(StoreConfigVo o1, StoreConfigVo o2) { + return o1.getIsTop().compareTo(o2.getIsTop()) * -1; + } + }); + for (int i = 0; i < listVo.size(); i++) { + listVo.get(i).setSort(i + 1); + } return ResultUtil.success(listVo); } catch (Exception e) { e.printStackTrace(); -- Gitblit v1.7.1