Explorar o código

Merge remote-tracking branch 'origin/master'

Jxing %!s(int64=6) %!d(string=hai) anos
pai
achega
987c42c935
Modificáronse 1 ficheiros con 15 adicións e 2 borrados
  1. 15 2
      src/main/java/com/sagacloud/route/Route.java

+ 15 - 2
src/main/java/com/sagacloud/route/Route.java

@@ -1,11 +1,14 @@
 package com.sagacloud.route;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.github.rjeschke.txtmark.Processor;
 import com.sagacloud.Exceptions.InvalidPostException;
 import com.sagacloud.route.processors.Insurance.GetInsuranceNoListProcessor;
 import com.sagacloud.route.processors.GetPropByPjProcessor;
 import com.sagacloud.route.processors.Insurance.GetPropertyUnderWarrantyProcessor;
 import com.sagacloud.route.processors.Insurance.HandleWarrantyFromVenderProcessor;
+import com.sagacloud.route.processors.Manufacturer.GetVenderBySpecProcessor;
 import com.sagacloud.utils.Const;
 import com.sagacloud.utils.VendersUtil;
 import org.apache.camel.Exchange;
@@ -32,12 +35,22 @@ public class Route extends ExceptionHandlerBaseRoute {
                     String tmplateContentStr = writer.toString();
                     msg.getOut().setBody(tmplateContentStr.replace("#replaceMePlease#", docContentStr));
                 });
-        // 查询项目下的资产
+        // 生产商查询项目下的资产
         rest("/manufacturer/property/").post("query")
                 .consumes(MediaType.APPLICATION_JSON)
                 .produces(MediaType.APPLICATION_JSON)
                 .route()
+                .process(exchange -> {
+                    String jsonStr = exchange.getIn().getBody(String.class);
+                    JSONObject json = JSONObject.parseObject(jsonStr);
+                    exchange.setProperty("venderId",json.getString("venderId"));
+                    exchange.getIn().setBody(jsonStr);
+                })
+                .to("direct:getPropertiesByPj")
+                .process(new GetVenderBySpecProcessor())
+                .to(Const.venders+"/manufacturer/specification/query_vender")
                 .process();
+
         // 查询项目下的资产
         rest("/supplier/property/").post("query")
                 .consumes(MediaType.APPLICATION_JSON)
@@ -74,7 +87,7 @@ public class Route extends ExceptionHandlerBaseRoute {
                 .route()
                 .process();
 
-        //bodyJSONObject,含有projectId字段
+        //bodyJSONObject,含有projectId字段
         from("direct:getPropertiesByPj")
                 .process(new GetPropByPjProcessor())
                 .to(Const.dataPlatform+"/property/relation_query");