|
@@ -7,10 +7,8 @@ import org.springframework.stereotype.Controller;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
-import java.util.List;
|
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -62,6 +60,7 @@ public class PageController {
|
|
product = JSONObject.parseObject(String.valueOf(floorMap.get("data")), Map.class);
|
|
product = JSONObject.parseObject(String.valueOf(floorMap.get("data")), Map.class);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
System.out.println(e);
|
|
System.out.println(e);
|
|
|
|
+ return "404";
|
|
}
|
|
}
|
|
model.addAttribute("product", product);
|
|
model.addAttribute("product", product);
|
|
return "product";
|
|
return "product";
|
|
@@ -71,10 +70,10 @@ public class PageController {
|
|
* 商品列表页面
|
|
* 商品列表页面
|
|
*/
|
|
*/
|
|
@GetMapping("/list/{id}.html")
|
|
@GetMapping("/list/{id}.html")
|
|
- public String page(final Model model, @PathVariable("id") String pageId, @RequestParam("title") String pageTitle) {
|
|
|
|
|
|
+ public String page(final Model model, @PathVariable("id") String pageId, String title) {
|
|
model.addAttribute("path", "list");
|
|
model.addAttribute("path", "list");
|
|
model.addAttribute("pageId", pageId);
|
|
model.addAttribute("pageId", pageId);
|
|
- model.addAttribute("pageTitle", pageTitle);
|
|
|
|
|
|
+ model.addAttribute("pageTitle", title);
|
|
try {
|
|
try {
|
|
String productResult = RequestUtil.sendGet("https://core.caimei365.com/commodity/search/query/product/type?idType=1&id="+pageId);
|
|
String productResult = RequestUtil.sendGet("https://core.caimei365.com/commodity/search/query/product/type?idType=1&id="+pageId);
|
|
Map<String, Object> productMap = JSONObject.parseObject(productResult, Map.class);
|
|
Map<String, Object> productMap = JSONObject.parseObject(productResult, Map.class);
|
|
@@ -84,8 +83,18 @@ public class PageController {
|
|
model.addAttribute("productList", productList);
|
|
model.addAttribute("productList", productList);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
System.out.println(e);
|
|
System.out.println(e);
|
|
- model.addAttribute("productList", new JSONArray());
|
|
|
|
|
|
+ return "404";
|
|
}
|
|
}
|
|
return "list";
|
|
return "list";
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 404
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/error")
|
|
|
|
+ public String errorPage(final Model model) {
|
|
|
|
+ model.addAttribute("msg", "404页面");
|
|
|
|
+ return "404";
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|