|
@@ -2,19 +2,24 @@ package com.caimei.www.controller.unlimited;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.caimei.www.controller.BaseController;
|
|
|
+import com.caimei.www.pojo.JsonModel;
|
|
|
import com.caimei.www.pojo.baike.BaikeProduct;
|
|
|
import com.caimei.www.pojo.baike.BaikeType;
|
|
|
import com.caimei.www.pojo.page.ImageLink;
|
|
|
import com.caimei.www.service.page.BaseService;
|
|
|
import com.caimei.www.service.page.ProductService;
|
|
|
+import com.google.gson.JsonArray;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.Model;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 采美文库
|
|
@@ -23,6 +28,7 @@ import java.util.List;
|
|
|
* @date : 2021/11/23
|
|
|
*/
|
|
|
@Controller
|
|
|
+@RequestMapping("/encyclopedia")
|
|
|
public class EncyclopediaController extends BaseController {
|
|
|
|
|
|
private static final String PRODUCT_LIST = "encyclopedia/product";
|
|
@@ -53,7 +59,7 @@ public class EncyclopediaController extends BaseController {
|
|
|
/**
|
|
|
* 产品列表
|
|
|
*/
|
|
|
- @GetMapping("/encyclopedia/product.html")
|
|
|
+ @GetMapping("/product.html")
|
|
|
public String getProductList(final Model model) {
|
|
|
Integer commodityType = 1;
|
|
|
// 搜索热门关键字
|
|
@@ -74,7 +80,7 @@ public class EncyclopediaController extends BaseController {
|
|
|
/**
|
|
|
* 产品详情
|
|
|
*/
|
|
|
- @GetMapping("/encyclopedia/product-{id}.html")
|
|
|
+ @GetMapping("/product-{id}.html")
|
|
|
public String getProductDetail(final Model model, @PathVariable("id") Integer productId) {
|
|
|
BaikeProduct baikeProduct = productService.getBaikeProductDetail(productId);
|
|
|
if (baikeProduct == null) {
|
|
@@ -87,7 +93,7 @@ public class EncyclopediaController extends BaseController {
|
|
|
/**
|
|
|
* 仪器列表
|
|
|
*/
|
|
|
- @GetMapping("/encyclopedia/instrument.html")
|
|
|
+ @GetMapping("/instrument.html")
|
|
|
public String getInstrumentList(final Model model) {
|
|
|
Integer commodityType = 2;
|
|
|
// 搜索热门关键字
|
|
@@ -108,7 +114,7 @@ public class EncyclopediaController extends BaseController {
|
|
|
/**
|
|
|
* 仪器详情
|
|
|
*/
|
|
|
- @GetMapping("/encyclopedia/instrument-{id}.html")
|
|
|
+ @GetMapping("/instrument-{id}.html")
|
|
|
public String getInstrumentDetail(final Model model, @PathVariable("id") Integer productId) {
|
|
|
BaikeProduct baikeInstrument = productService.getBaikeProductDetail(productId);
|
|
|
if (baikeInstrument == null) {
|
|
@@ -121,20 +127,17 @@ public class EncyclopediaController extends BaseController {
|
|
|
/**
|
|
|
* 查看更多
|
|
|
*/
|
|
|
- @GetMapping("/encyclopedia/more.html")
|
|
|
- public String getMoreList(final Model model) {
|
|
|
- ArrayList<Object> list = new ArrayList<>();
|
|
|
- for (int i=0; i< 1000 ; i++){
|
|
|
- list.add(new Object());
|
|
|
- }
|
|
|
- model.addAttribute("list", list);
|
|
|
+ @GetMapping("/more-{typeId}-{pageNum}-{pageSize}.html")
|
|
|
+ public String getMoreList(final Model model, @PathVariable("typeId") Integer typeId, @PathVariable("pageNum") Integer pageNum, @PathVariable("pageSize") Integer pageSize) {
|
|
|
+ Map<String, Object> moreData = productService.getBaikeMoreJson(typeId, pageNum, pageSize);
|
|
|
+ model.addAttribute("moreData", moreData);
|
|
|
return MORE_LIST;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 搜索列表
|
|
|
*/
|
|
|
- @GetMapping("/encyclopedia/search.html")
|
|
|
+ @GetMapping("/search.html")
|
|
|
public String getSearchPage() {
|
|
|
return SEARCH_PAGE;
|
|
|
}
|
|
@@ -142,7 +145,7 @@ public class EncyclopediaController extends BaseController {
|
|
|
/**
|
|
|
* 联系我们
|
|
|
*/
|
|
|
- @GetMapping("/encyclopedia/contact.html")
|
|
|
+ @GetMapping("/contact.html")
|
|
|
public String getContact() {
|
|
|
return CONTACT;
|
|
|
}
|
|
@@ -150,7 +153,7 @@ public class EncyclopediaController extends BaseController {
|
|
|
/**
|
|
|
* 关于我们
|
|
|
*/
|
|
|
- @GetMapping("/encyclopedia/about.html")
|
|
|
+ @GetMapping("/about.html")
|
|
|
public String getAboutUs() {
|
|
|
return ABOUT_US;
|
|
|
}
|
|
@@ -158,8 +161,18 @@ public class EncyclopediaController extends BaseController {
|
|
|
/**
|
|
|
* 关于我们位置定位
|
|
|
*/
|
|
|
- @GetMapping("/encyclopedia/map.html")
|
|
|
+ @GetMapping("/map.html")
|
|
|
public String getMap() {
|
|
|
return MAP;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 增加浏览量
|
|
|
+ */
|
|
|
+ @GetMapping("/pv")
|
|
|
+ @ResponseBody
|
|
|
+ public JsonModel encyclopediaPv(Integer id) {
|
|
|
+ return productService.encyclopediaPv(id);
|
|
|
+ }
|
|
|
+
|
|
|
}
|