From 61bbd595ee2bc3c67b40878894dcc07174c6eea6 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期二, 24 九月 2024 10:15:30 +0800 Subject: [PATCH] 玩湃微信商户分账 --- cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java | 22 +++++++++++++++++++++- 1 files changed, 21 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..2b5e035 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 @@ -3,12 +3,15 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.dsh.other.entity.HomeModule; import com.dsh.other.entity.StoreConfig; +import com.dsh.other.feignclient.communityWorldCup.WorldCupClient; import com.dsh.other.feignclient.communityWorldCup.WorldCupStoreClient; +import com.dsh.other.feignclient.communityWorldCup.model.WorldCup; import com.dsh.other.feignclient.communityWorldCup.model.WorldCupStore; import com.dsh.other.model.StoreConfigVo; 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; @@ -41,6 +44,9 @@ @Resource private WorldCupStoreClient worldCupStoreClient; + @Resource + private WorldCupClient worldCupClient; + @@ -65,12 +71,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()) { @@ -115,9 +123,11 @@ List<WorldCupStore> worldCupStoreList = worldCupStoreClient.getWorldCupStoreList(storeId); for (WorldCupStore worldCupStore : worldCupStoreList) { + WorldCup worldCup = worldCupClient.getWorldCup(worldCupStore.getWorldCupId()); StoreConfigVo storeConfigVo = new StoreConfigVo(); + storeConfigVo.setIsTop(0); storeConfigVo.setId(worldCupStore.getWorldCupId()); - storeConfigVo.setBackgroundImage(worldCupStore.getBackgroundImage()); + storeConfigVo.setBackgroundImage(ToolUtil.isNotEmpty(worldCupStore.getBackgroundImage()) ? worldCupStore.getBackgroundImage() : worldCup.getHomeBackdropImg()); storeConfigVo.setType(9); storeConfigVo.setIsOpen(worldCupStore.getIsOpen()); storeConfigVo.setSort(worldCupStore.getSort()); @@ -132,6 +142,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