浏览代码

已关闭的产品仪器页和活动专题页跳转404

Aslee 4 年之前
父节点
当前提交
f50f0861a9

+ 23 - 2
src/main/java/com/caimei/www/controller/unlimited/ProductController.java

@@ -1,8 +1,10 @@
 package com.caimei.www.controller.unlimited;
 
 import com.caimei.www.controller.BaseController;
+import com.caimei.www.pojo.page.PageContent;
 import com.caimei.www.pojo.page.ProductDetail;
 import com.caimei.www.service.page.ProductService;
+import com.caimei.www.service.page.SinglePageService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
@@ -34,11 +36,18 @@ public class ProductController extends BaseController {
 
     private ProductService productService;
 
+    private SinglePageService singlePageService;
+
     @Autowired
     public void setProductService(ProductService productService) {
         this.productService = productService;
     }
 
+    @Autowired
+    public void setSinglePageService(SinglePageService singlePageService) {
+        this.singlePageService = singlePageService;
+    }
+
     /**
      * 商品分类列表/搜索结果 页面
      */
@@ -73,7 +82,11 @@ public class ProductController extends BaseController {
      * 仪器页
      */
     @GetMapping("/product/instrument.html")
-    public String instrument() {
+    public String instrument(Integer id) {
+        Integer pageId = singlePageService.getInstrumentPageIdById(id);
+        if (pageId == null) {
+            return super.errorPath();
+        }
         return INSTRUMENT_PAGE_PATH;
     }
 
@@ -81,7 +94,11 @@ public class ProductController extends BaseController {
      * 美体节活动页
      */
     @GetMapping("/product/temporary.html")
-    public String temporary() {
+    public String temporary(Integer id) {
+        Integer pageId = singlePageService.getInstrumentPageIdById(id);
+        if (pageId == null) {
+            return super.errorPath();
+        }
         return TEMPORARY_PAGE_PATH;
     }
 
@@ -115,6 +132,10 @@ public class ProductController extends BaseController {
      */
     @GetMapping("activity/activityTopic.html")
     public String activityTopic(final Model model, Integer id) {
+        Integer pageId = singlePageService.getActivityPageIdById(id);
+        if (pageId == null) {
+            return super.errorPath();
+        }
         model.addAttribute("pageId", id);
         return ACTIVITY_TOP_PATH;
     }

+ 8 - 0
src/main/java/com/caimei/www/mapper/SinglePageDao.java

@@ -90,4 +90,12 @@ public interface SinglePageDao {
      */
     String findMobileContent(Integer id);
 
+    /**
+     * 产品仪器页
+     */
+    Integer getInstrumentPageIdById(Integer id);
+    /**
+     * 活动专题页
+     */
+    Integer getActivityPageIdById(Integer id);
 }

+ 9 - 3
src/main/java/com/caimei/www/service/page/SinglePageService.java

@@ -3,8 +3,6 @@ package com.caimei.www.service.page;
 import com.caimei.www.pojo.JsonModel;
 import com.caimei.www.pojo.page.ImageLink;
 import com.caimei.www.pojo.page.PageContent;
-import com.caimei.www.pojo.page.PageFloor;
-import com.github.pagehelper.PageInfo;
 import org.springframework.http.server.reactive.ServerHttpResponse;
 import reactor.core.publisher.Mono;
 
@@ -30,5 +28,13 @@ public interface SinglePageService {
     Mono<Void> downloadByWriteWith(ServerHttpResponse response) throws UnsupportedEncodingException, FileNotFoundException;
     /** 获取讲师列表 */
     JsonModel<List<ImageLink>> getLiveTeachers();
-
+    /**
+     * 产品仪器页
+     * @return
+     */
+    Integer getInstrumentPageIdById(Integer id);
+    /**
+     * 活动专题页
+     */
+    Integer getActivityPageIdById(Integer id);
 }

+ 18 - 6
src/main/java/com/caimei/www/service/page/impl/SinglePageServiceImpl.java

@@ -4,11 +4,7 @@ import com.caimei.www.mapper.SinglePageDao;
 import com.caimei.www.pojo.JsonModel;
 import com.caimei.www.pojo.page.ImageLink;
 import com.caimei.www.pojo.page.PageContent;
-import com.caimei.www.pojo.page.PageFloor;
 import com.caimei.www.service.page.SinglePageService;
-import com.caimei.www.utils.ImageUtil;
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpHeaders;
@@ -16,7 +12,6 @@ import org.springframework.http.MediaType;
 import org.springframework.http.ZeroCopyHttpOutputMessage;
 import org.springframework.http.server.reactive.ServerHttpResponse;
 import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 import reactor.core.publisher.Mono;
 
@@ -24,7 +19,6 @@ import javax.annotation.Resource;
 import java.io.File;
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
-import java.text.SimpleDateFormat;
 import java.util.List;
 
 /**
@@ -107,4 +101,22 @@ public class SinglePageServiceImpl implements SinglePageService {
         return JsonModel.success(teacherList);
     }
 
+    @Override
+    public Integer getInstrumentPageIdById(Integer id) {
+        if (id == null) {
+            return null;
+        }
+        Integer pageId = singlePageDao.getInstrumentPageIdById(id);
+        return pageId;
+    }
+
+    @Override
+    public Integer getActivityPageIdById(Integer id) {
+        if (id == null) {
+            return null;
+        }
+        Integer pageId = singlePageDao.getActivityPageIdById(id);
+        return pageId;
+    }
+
 }

+ 13 - 0
src/main/resources/mapper/SinglePageMapper.xml

@@ -76,4 +76,17 @@
         SELECT content FROM cm_page_freedom WHERE pageId = #{id} AND type = 2
     </select>
 
+    <select id="getInstrumentPageIdById" resultType="java.lang.Integer">
+        select id from cm_page a
+        where
+            a.type=5 and a.enabledStatus=1
+            and a.id=#{id}
+    </select>
+    <select id="getActivityPageIdById" resultType="java.lang.Integer">
+        select id from cm_page a
+        where
+            a.type=6 and a.enabledStatus=1
+          and a.id=#{id}
+    </select>
+
 </mapper>