puzhibing
2024-03-12 7cd3dea07f5b7cefad9dea9fd7daf992449aaac8
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();