瀏覽代碼

修改route类结构

Jxing 6 年之前
父節點
當前提交
5620794f6d

+ 35 - 0
src/main/java/com/sagacloud/pojos/Warranty.java

@@ -0,0 +1,35 @@
+package com.sagacloud.pojos;
+/*
+ * Author: Jxing
+ * Create Time: 2018/7/12
+ */
+
+public class Warranty {
+    private String insuranceNo;
+    private String expireDate;
+    private String contractFile;
+
+    public String getInsuranceNo() {
+        return insuranceNo;
+    }
+
+    public void setInsuranceNo(String insuranceNo) {
+        this.insuranceNo = insuranceNo;
+    }
+
+    public String getExpireDate() {
+        return expireDate;
+    }
+
+    public void setExpireDate(String expireDate) {
+        this.expireDate = expireDate;
+    }
+
+    public String getContractFile() {
+        return contractFile;
+    }
+
+    public void setContractFile(String contractFile) {
+        this.contractFile = contractFile;
+    }
+}

+ 3 - 33
src/main/java/com/sagacloud/pojos/WarrantyList.java

@@ -12,7 +12,7 @@ public class WarrantyList {
     private String result;
     private String resultMsg;
     @JSONField(name="content")
-    private List<WarrantyList> warrantyList;
+    private List<Warranty> warrantyList;
 
     public String getResult() {
         return result;
@@ -30,42 +30,12 @@ public class WarrantyList {
         this.resultMsg = resultMsg;
     }
 
-    public List<WarrantyList> getWarrantyList() {
+    public List<Warranty> getWarrantyList() {
         return warrantyList;
     }
 
-    public void setWarrantyList(List<WarrantyList> warrantyList) {
+    public void setWarrantyList(List<Warranty> warrantyList) {
         this.warrantyList = warrantyList;
     }
 
-    public class Warrnaty{
-
-        private String insuranceNo;
-        private String expireDate;
-        private String contractFile;
-
-        public String getInsuranceNo() {
-            return insuranceNo;
-        }
-
-        public void setInsuranceNo(String insuranceNo) {
-            this.insuranceNo = insuranceNo;
-        }
-
-        public String getExpireDate() {
-            return expireDate;
-        }
-
-        public void setExpireDate(String expireDate) {
-            this.expireDate = expireDate;
-        }
-
-        public String getContractFile() {
-            return contractFile;
-        }
-
-        public void setContractFile(String contractFile) {
-            this.contractFile = contractFile;
-        }
-    }
 }

+ 3 - 10
src/main/java/com/sagacloud/route/Route.java

@@ -10,6 +10,7 @@ import com.sagacloud.utils.Const;
 import com.sagacloud.utils.VendersUtil;
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.http.common.HttpOperationFailedException;
 import org.apache.commons.io.IOUtils;
 
 import javax.ws.rs.core.MediaType;
@@ -18,7 +19,7 @@ import java.io.StringWriter;
 /**
  * Created by Xiaoyu on 2018/7/10
  */
-public class Route extends RouteBuilder {
+public class Route extends ExceptionHandlerBaseRoute {
     @Override
     public void configure() throws Exception {
         rest().get("/doc")
@@ -88,13 +89,5 @@ public class Route extends RouteBuilder {
 
     }
 
-    protected void configExceptionHandler(){
-        onException(InvalidPostException.class).handled(true).process(new org.apache.camel.Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                Exception exception = (Exception) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
-                exchange.getOut().setBody(VendersUtil.errorJsonMsg(exception.getMessage()));
-            }
-        });
-    }
+
 }