| | |
| | | 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; |
| | |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | |
| | | |
| | | @Autowired |
| | | private IHomeModuleService homeModuleService; |
| | | |
| | | @Resource |
| | | private WorldCupStoreClient worldCupStoreClient; |
| | | |
| | | @Resource |
| | | private WorldCupClient worldCupClient; |
| | | |
| | | |
| | | |
| | |
| | | StoreConfigVo vo = new StoreConfigVo(); |
| | | vo.setType(0); |
| | | vo.setIsOpen(homeModule.getIsOpen()); |
| | | vo.setIsTop(homeModule.getIsTop()); |
| | | vo.setSort(homeModule.getSort()); |
| | | vo.setBackgroundImage(homeModule.getBackgroundImage()); |
| | | vo.setDisplayType(homeModule.getDisplayType()); |
| | | 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()) { |
| | |
| | | storeConfigVo.setBackgroundImage("https://we-park-life.oss-cn-beijing.aliyuncs.com/img/0771fb3bd4de43c08492d0912209e51f.png"); |
| | | break; |
| | | } |
| | | case 9: { |
| | | storeConfigVo.setBackgroundImage("https://we-park-life.oss-cn-beijing.aliyuncs.com/img/0771fb3bd4de43c08492d0912209e51f.png"); |
| | | break; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | listVo.add(storeConfigVo); |
| | | } |
| | | |
| | | 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(ToolUtil.isNotEmpty(worldCupStore.getBackgroundImage()) ? worldCupStore.getBackgroundImage() : worldCup.getHomeBackdropImg()); |
| | | storeConfigVo.setType(9); |
| | | storeConfigVo.setIsOpen(worldCupStore.getIsOpen()); |
| | | storeConfigVo.setDisplayType(worldCupStore.getDisplayType()); |
| | | storeConfigVo.setSort(worldCupStore.getSort()); |
| | | listVo.add(storeConfigVo); |
| | | } |
| | | |
| | | |
| | | //排序 |
| | | Collections.sort(listVo, new Comparator<StoreConfigVo>() { |
| | | @Override |
| | |
| | | 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(); |