From 4616f614418bd8715b65d159239b7a6058210d63 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 27 二月 2024 18:03:59 +0800
Subject: [PATCH] 新增加接口
---
cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/model/WorldCupStore.java | 41 +++++++++++++
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java | 25 +++++++-
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupStore.java | 16 +++++
cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java | 22 ++++++-
cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/WorldCupStoreClient.java | 24 ++++++++
cloud-server-other/src/main/java/com/dsh/other/controller/BannerController.java | 2
cloud-server-other/src/main/java/com/dsh/other/model/StoreConfigVo.java | 2
7 files changed, 123 insertions(+), 9 deletions(-)
diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java
index 8e48812..076f753 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java
@@ -2,7 +2,10 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.dsh.communityWorldCup.entity.WorldCup;
import com.dsh.communityWorldCup.entity.WorldCupPaymentParticipant;
+import com.dsh.communityWorldCup.entity.WorldCupStore;
import com.dsh.communityWorldCup.feignclient.account.AppUserClient;
import com.dsh.communityWorldCup.feignclient.account.StudentClient;
import com.dsh.communityWorldCup.feignclient.account.model.AppUser;
@@ -34,10 +37,8 @@
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
/**
* 社区世界杯
@@ -79,6 +80,9 @@
@Autowired
private PayMoneyUtil payMoneyUtil;
+
+ @Autowired
+ private IWorldCupStoreService worldCupStoreService;
@@ -367,4 +371,17 @@
e.printStackTrace();
}
}
+
+
+ /**
+ * 根据店铺id获取有效的世界杯
+ * @param storeId
+ * @return
+ */
+ @PostMapping("/worldCup/getWorldCupStoreList")
+ public List<WorldCupStore> getWorldCupStoreList(@RequestBody Integer storeId){
+ List<WorldCup> worldCupList = worldCupService.list(new QueryWrapper<WorldCup>().in("status", Arrays.asList(1, 2)));
+ List<Integer> collect = worldCupList.stream().map(WorldCup::getId).collect(Collectors.toList());
+ return worldCupStoreService.list(new QueryWrapper<WorldCupStore>().eq("storeId", storeId).in("worldCupId", collect));
+ }
}
diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupStore.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupStore.java
index 3582f39..d15871a 100644
--- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupStore.java
+++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/entity/WorldCupStore.java
@@ -29,4 +29,20 @@
*/
@TableField("storeId")
private Integer storeId;
+ /**
+ * 是否开启世界杯按钮(0=否,1=是)
+ */
+ @TableField("isOpen")
+ private Integer isOpen;
+ /**
+ * 世界杯入口背景图
+ */
+ @TableField("backgroundImage")
+ private String backgroundImage;
+ /**
+ * 排序
+ */
+ @TableField("sort")
+ private Integer sort;
+
}
diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/BannerController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/BannerController.java
index 4338689..632d169 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/controller/BannerController.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/controller/BannerController.java
@@ -82,7 +82,7 @@
@PostMapping("/base/banner/queryBannerList")
@ApiOperation(value = "获取banner数据", tags = {"APP-加入玩湃"})
@ApiImplicitParams({
- @ApiImplicitParam(value = "位置(1=首页,2=首页底部,3=线上课得积分,4=看视频得奖励,5=常见问题)", name = "position", dataType = "int", required = true),
+ @ApiImplicitParam(value = "广告类型位置(1=首页,2=首页底部,3=线上课得积分,4=看视频得奖励,5=常见问题,6=社区世界杯顶部,7=社区世界杯底部", name = "position", dataType = "int", required = true),
})
public ResultUtil<List<BannerVo>> queryBannerList(Integer position) {
List<BannerVo> list2 = bannerService.list1(position);
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 1568141..eb4ebef 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,6 +3,8 @@
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.WorldCupStoreClient;
+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;
@@ -15,6 +17,7 @@
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;
@@ -34,6 +37,9 @@
@Autowired
private IHomeModuleService homeModuleService;
+
+ @Resource
+ private WorldCupStoreClient worldCupStoreClient;
@@ -100,16 +106,24 @@
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) {
+ StoreConfigVo storeConfigVo = new StoreConfigVo();
+ storeConfigVo.setId(worldCupStore.getWorldCupId());
+ storeConfigVo.setBackgroundImage(worldCupStore.getBackgroundImage());
+ storeConfigVo.setType(9);
+ storeConfigVo.setIsOpen(worldCupStore.getIsOpen());
+ listVo.add(storeConfigVo);
+ }
+
+
//排序
Collections.sort(listVo, new Comparator<StoreConfigVo>() {
@Override
diff --git a/cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/WorldCupStoreClient.java b/cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/WorldCupStoreClient.java
new file mode 100644
index 0000000..5dd7e6b
--- /dev/null
+++ b/cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/WorldCupStoreClient.java
@@ -0,0 +1,24 @@
+package com.dsh.other.feignclient.communityWorldCup;
+
+import com.dsh.other.feignclient.communityWorldCup.model.WorldCupStore;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+
+import java.util.List;
+
+/**
+ * @author zhibing.pu
+ * @Date 2024/2/27 17:43
+ */
+@FeignClient("mb-cloud-communityWorldCup")
+public interface WorldCupStoreClient {
+
+
+ /**
+ * 根据门店id获取世界杯
+ * @param storeId 门店id
+ * @return
+ */
+ @PostMapping("/worldCup/getWorldCupStoreList")
+ List<WorldCupStore> getWorldCupStoreList(Integer storeId);
+}
diff --git a/cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/model/WorldCupStore.java b/cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/model/WorldCupStore.java
new file mode 100644
index 0000000..e604d77
--- /dev/null
+++ b/cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/model/WorldCupStore.java
@@ -0,0 +1,41 @@
+package com.dsh.other.feignclient.communityWorldCup.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * 社区世界杯门店
+ * @author zhibing.pu
+ * @Date 2024/2/18 18:06
+ */
+@Data
+public class WorldCupStore {
+ /**
+ * 主键
+ */
+ private Integer id;
+ /**
+ * 世界杯id
+ */
+ private Integer worldCupId;
+ /**
+ * 门店id
+ */
+ private Integer storeId;
+ /**
+ * 是否开启世界杯按钮(0=否,1=是)
+ */
+ private Integer isOpen;
+ /**
+ * 世界杯入口背景图
+ */
+ private String backgroundImage;
+ /**
+ * 排序
+ */
+ private Integer sort;
+
+}
diff --git a/cloud-server-other/src/main/java/com/dsh/other/model/StoreConfigVo.java b/cloud-server-other/src/main/java/com/dsh/other/model/StoreConfigVo.java
index f6660b6..f12b4de 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/model/StoreConfigVo.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/model/StoreConfigVo.java
@@ -19,4 +19,6 @@
private Integer sort;
@ApiModelProperty("背景图")
private String backgroundImage;
+ @ApiModelProperty("详情id")
+ private Integer id;
}
--
Gitblit v1.7.1