chao 4 anos atrás
pai
commit
a5c40cc1ba

+ 3 - 0
src/main/java/com/caimei/www/controller/unlimited/ArticleController.java

@@ -76,6 +76,9 @@ public class ArticleController extends BaseController {
     public String toArticleDetail(@PathVariable("id") Integer id, final Model model) {
         List<BaseLink> typeList = articleService.getArticleTypes();
         Article article = articleService.getArticleInfo(id);
+        if(article == null){
+            return super.errorPath();
+        }
         model.addAttribute("article", article);
         model.addAttribute("articleType", typeList);
         model.addAttribute("articleId", id);

+ 3 - 0
src/main/java/com/caimei/www/controller/unlimited/EquipmentController.java

@@ -48,6 +48,9 @@ public class EquipmentController extends BaseController {
     @GetMapping("/equipment/detail.html")
     public String home(final Model model, @RequestParam("id") Integer equipmentId) {
         PageContent detail = equipmentService.getEquipmentById(equipmentId);
+        if(detail== null){
+            return super.errorPath();
+        }
         model.addAttribute("equipment", detail);
         return equipment_DETAIL_PATH;
     }

+ 3 - 0
src/main/java/com/caimei/www/controller/unlimited/ProductController.java

@@ -51,6 +51,9 @@ public class ProductController extends BaseController {
     @GetMapping("/product-{id}.html")
     public String detail(final Model model, @PathVariable("id") Integer productId) {
         ProductDetail detail = productService.getProductDetailById(productId);
+        if(detail== null){
+            return super.errorPath();
+        }
         model.addAttribute("productId", productId);
         model.addAttribute("product", detail);
         return PRODUCT_DETAIL_PATH;

+ 3 - 0
src/main/java/com/caimei/www/controller/unlimited/SupplierController.java

@@ -42,6 +42,9 @@ public class SupplierController extends BaseController {
     @GetMapping("/supplier/index.html")
     public String home(final Model model, @RequestParam("id") Integer supplierId) {
         SupplierDetail detail = supplierService.getSupplierById(supplierId);
+        if(detail== null){
+            return super.errorPath();
+        }
         model.addAttribute("supplier", detail);
         return SUPPLIER_INDEX_PATH;
     }

+ 4 - 2
src/main/java/com/caimei/www/service/page/impl/EquipmentServiceImpl.java

@@ -43,8 +43,10 @@ public class EquipmentServiceImpl implements EquipmentService {
     @Override
     public PageContent getEquipmentById(Integer equipmentId) {
         PageContent equipment = equipmentDao.getEquipmentById(equipmentId);
-        List<Parameter> contents = equipmentDao.getParametersByEquipmentId(equipmentId);
-        equipment.setPageContents(contents);
+        if (null != equipment){
+            List<Parameter> contents = equipmentDao.getParametersByEquipmentId(equipmentId);
+            equipment.setPageContents(contents);
+        }
         return equipment;
     }
 

+ 16 - 14
src/main/java/com/caimei/www/service/page/impl/ProductServiceImpl.java

@@ -34,20 +34,22 @@ public class ProductServiceImpl implements ProductService {
     @Override
     public ProductDetail getProductDetailById(Integer productId) {
         ProductDetail product = productDao.getProductDetailById(productId);
-        if(!StringUtil.isNullOrEmpty(product.getTags())){
-            product.setTagList(product.getTags().split(","));
-        }
-        // 价格等级
-        if (product.getPrice() > 50 * 5000) {
-            product.setPriceGrade(5);
-        } else if (product.getPrice() > 25 * 5000) {
-            product.setPriceGrade(4);
-        } else if (product.getPrice() > 10 * 5000) {
-            product.setPriceGrade(3);
-        } else if (product.getPrice() > 2.5 * 5000) {
-            product.setPriceGrade(2);
-        } else {
-            product.setPriceGrade(1);
+        if (null != product){
+            if (!StringUtil.isNullOrEmpty(product.getTags())) {
+                product.setTagList(product.getTags().split(","));
+            }
+            // 价格等级
+            if (product.getPrice() > 50 * 5000) {
+                product.setPriceGrade(5);
+            } else if (product.getPrice() > 25 * 5000) {
+                product.setPriceGrade(4);
+            } else if (product.getPrice() > 10 * 5000) {
+                product.setPriceGrade(3);
+            } else if (product.getPrice() > 2.5 * 5000) {
+                product.setPriceGrade(2);
+            } else {
+                product.setPriceGrade(1);
+            }
         }
         return product;
     }

+ 60 - 0
src/main/resources/static/css/base/404.css

@@ -0,0 +1,60 @@
+@charset "utf-8";
+/**
+ * PC端
+ */
+@media screen and (min-width:768px){
+    body {
+        background: #f6f6f6;
+        min-width: 1184px;
+        position: relative;
+        text-align: center;
+    }
+    #errorPage{
+        width: 1184px;
+        margin:5% auto;
+        height: 450px;
+        text-align: center;
+    }
+    #errorPage img{width:520px;}
+    .desc{text-align: left;}
+    .desc_link{
+        font-size: 30px;
+        letter-spacing: 3px;
+        color: #E15616;
+        text-decoration: underline;
+        display: inline-block;
+        margin: 0 15px;
+        font-weight: normal;
+    }
+
+
+}
+
+/**
+* 移动端
+*/
+@media screen and (max-width:768px){
+    body {
+        background: #f6f6f6;
+        position: relative;
+        text-align: center;
+    }
+    #errorPage{
+        margin: 10% auto;
+    }
+    #errorPage img{
+        width:60%;
+    }
+    .desc{background:#F5F5F5;text-align: left;}
+    .desc_link{
+        font-size: 8vw;
+        letter-spacing: 3px;
+        color: #E15616;
+        text-decoration: underline;
+        display: inline-block;
+        margin: 0 3vw;
+        font-weight: normal;
+    }
+
+
+}

BIN
src/main/resources/static/img/base/error.png


+ 22 - 0
src/main/resources/static/js/error/404.js

@@ -0,0 +1,22 @@
+var errorPage = new Vue({
+    el: "#errorPage",
+    data: {
+        errorDatas: []
+    },
+    methods: {
+        getErrorData: function () {
+            var _self = this;
+            $.getJSON("https://api.isoyu.com/gy/").done(function (r) {
+                _self.errorDatas = r;
+            });
+        },
+
+    },
+    created: function () {
+        // 获取列表数据
+        this.getErrorData();
+    },
+    mounted: function () {
+        var _self = this;
+    }
+});

+ 6 - 2
src/main/resources/templates/error/404.html

@@ -4,18 +4,22 @@
 <head>
     <title>采美365网-中国美业全方位线上交易服务互动平台,做美业,上采美</title>
     <template th:replace="components/head-link"></template>
+    <link th:href="@{/css/base/404.css(v=${version})}" rel="stylesheet" type="text/css">
 </head>
 <body>
 <!-- 引用头部 -->
 <template th:replace="components/header"></template>
 
-<!-- 帮助页面 -->
+<!-- 404页面 -->
 <div id="errorPage">
-    <h1 style="text-align:center">404</h1>
+    <img src="/img/base/error.png" alt="404">
+    <h5><a href="/" class="desc_link">回主页</a><a href="javascript:history.go(-1);" class="desc_link">返回上一步</a></h5>
 </div>
 
 <!-- 引入底部 -->
 <template th:replace="components/footer"></template>
 <template th:replace="components/foot-link"></template>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/error/404.js(v=${version})}"></script>
+<script type="text/javascript" src="//qzonestyle.gtimg.cn/qzone/hybrid/app/404/search_children.js" charset="utf-8" homePageUrl="/" homePageName="返回首页"></script>
 </body>
 </html>