FanXiaoyu 6 年 前
コミット
51a74e5195
1 ファイル変更15 行追加2 行削除
  1. 15 2
      src/main/java/com/sagacloud/route/Route.java

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

@@ -1,10 +1,13 @@
 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.HandleWarrantyFromVenderProcessor;
+import com.sagacloud.route.processors.Manufacturer.GetVenderBySpecProcessor;
 import com.sagacloud.utils.Const;
 import com.sagacloud.utils.VendersUtil;
 import org.apache.camel.Exchange;
@@ -30,12 +33,22 @@ public class Route extends RouteBuilder {
                     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)
@@ -72,7 +85,7 @@ public class Route extends RouteBuilder {
                 .route()
                 .process();
 
-        //bodyJSONObject,含有projectId字段
+        //bodyJSONObject,含有projectId字段
         from("direct:getPropertiesByPj")
                 .process(new GetPropByPjProcessor())
                 .to(Const.dataPlatform+"/property/relation_query");