|
@@ -5,12 +5,28 @@ package com.sagacloud.route.processors;
|
|
|
*/
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.sagacloud.Exceptions.InvalidPostException;
|
|
|
+import com.sagacloud.cache.ProPasCache;
|
|
|
+import com.sagacloud.pojos.InsurancePost;
|
|
|
+import com.sagacloud.route.InitEnvRoute;
|
|
|
+import com.sagacloud.utils.Const;
|
|
|
import org.apache.camel.Exchange;
|
|
|
import org.apache.camel.Processor;
|
|
|
|
|
|
public class GetInsuranceNoListProcessor implements Processor {
|
|
|
@Override
|
|
|
public void process(Exchange exchange) throws Exception {
|
|
|
+ String jsonStr = exchange.getIn().getBody(String.class);
|
|
|
+ InsurancePost post = JSONObject.parseObject(jsonStr, InsurancePost.class);
|
|
|
|
|
|
+ if(post.getVenderId() == null || post.getProjectId() == null || ProPasCache.getPjSecret(post.getProjectId()) == null)
|
|
|
+ throw new InvalidPostException("参数错误!");
|
|
|
+ //exchange.getIn().setBody();
|
|
|
+ exchange.setProperty("postParam", post);
|
|
|
+ exchange.getIn().setHeader(Exchange.HTTP_URI, String.join("", InitEnvRoute.venders, "/insurance/contract/query?method=POST"));
|
|
|
+ exchange.getIn().setHeader(Exchange.HTTP_QUERY,String.join("", Const.HEADER_PROJECT , "=", post.getProjectId(),
|
|
|
+ "&", Const.HEADER_SECRET, "=", ProPasCache.getPjSecret(post.getProjectId())));
|
|
|
}
|
|
|
}
|