Browse Source

上传文件至 'member_jf'

yjf18142830808 5 years ago
parent
commit
a4a7b127b4
1 changed files with 80 additions and 7 deletions
  1. 80 7
      member_jf/mem_memberbase_add.ktr

+ 80 - 7
member_jf/mem_memberbase_add.ktr

@@ -505,7 +505,63 @@
       <to>Java 代码</to>
       <enabled>Y</enabled>
     </hop>
+    <hop>
+      <from>Java 代码</from>
+      <to>Elasticsearch bulk insert</to>
+      <enabled>Y</enabled>
+    </hop>
   </order>
+  <step>
+    <name>Elasticsearch bulk insert</name>
+    <type>ElasticSearchBulk</type>
+    <description/>
+    <distribute>Y</distribute>
+    <custom_distribution/>
+    <copies>1</copies>
+    <partitioning>
+      <method>none</method>
+      <schema_name/>
+    </partitioning>
+    <general>
+      <index>crm_memberbase_phoneid</index>
+      <type>_doc</type>
+      <batchSize>50000</batchSize>
+      <timeout>100</timeout>
+      <timeoutUnit>SECONDS</timeoutUnit>
+      <isJson>N</isJson>
+      <idField>phoneid</idField>
+      <overwriteIfExists>Y</overwriteIfExists>
+      <useOutput>N</useOutput>
+      <stopOnError>Y</stopOnError>
+    </general>
+    <fields>
+    </fields>
+    <servers>
+      <server>
+        <address>192.168.50.32</address>
+        <port>9300</port>
+      </server>
+    </servers>
+    <settings>
+      <setting>
+        <name>cluster.name</name>
+        <value>es</value>
+      </setting>
+    </settings>
+    <attributes/>
+    <cluster_schema/>
+    <remotesteps>
+      <input>
+      </input>
+      <output>
+      </output>
+    </remotesteps>
+    <GUI>
+      <xloc>672</xloc>
+      <yloc>144</yloc>
+      <draw>Y</draw>
+    </GUI>
+  </step>
   <step>
     <name>HTTP client</name>
     <type>HTTP</type>
@@ -674,20 +730,24 @@ if(database == null){
 		int startEmail = DataId.indexOf("buyer_email")+("buyer_email\":\"".length());
 		int endEmail = DataId.indexOf("\",\"buyer_nick");
 		
-		int startTradeName = DataId.indexOf("trade_source")+("trade_source\":\"".length());
-		int endTradeName = DataId.indexOf("\",\"type");//\",\"type"
-		
+		int startTradeName = DataId.indexOf("buyer_nick")+("buyer_nick\":\"".length());
+		int endTradeName = DataId.indexOf("\"\",\"\"buyer_obtain_point_fee");
 		int startTradeFrom = DataId.indexOf("trade_from")+("trade_from\":\"".length());
 		int endTradeFrom = DataId.indexOf("\",\"trade_source");
 		//logBasic("--"+(end-start));
 		String email = DataId.substring(startEmail,endEmail);
 		//String tradeName = DataId.substring(startTradeName,endTradeName);
-		//String tradeFrom = DataId.substring(startTradeFrom,endTradeFrom);
+		String tradeFrom = DataId.substring(startTradeFrom,endTradeFrom);
 		logBasic("email--"+email);
+
 		//logBasic("tradeName--"+tradeName);
 		//logBasic("tradeFrom--"+tradeFrom);
 		logBasic("startEmail--"+startEmail);
 		logBasic("endEmail--"+endEmail);
+		logBasic("startTradeName--"+startTradeFrom);
+		logBasic("endTradeName--"+endTradeFrom);
+		logBasic("startTradeName--"+startTradeName);
+		logBasic("endTradeName--"+endTradeName);
 		Thread.sleep(1000);
 		GetRequest getRequest = new GetRequest(
     	"crm_memberbase_phoneid",  // Index
@@ -705,8 +765,8 @@ if(database == null){
 			updateRequest.doc(XContentFactory.jsonBuilder()
         		.startObject()
             	.field("MemEmail", email)
-            	.field("TradeName", "")
-            	.field("TradeFrom", "")
+            	.field("TradeName", "")//tradeName
+            	.field("TradeFrom", "")//tradeFrom
         		.endObject());
 			client.update(updateRequest,RequestOptions.DEFAULT);
 		    
@@ -764,7 +824,7 @@ if(database == null){
       <schema_name/>
     </partitioning>
     <connection>MemberPortal</connection>
-    <sql> SELECT top 50
+    <sql> SELECT 
  	case when OriginType =6 then concat( 'http://api.360lj.com/taobaodocking/GetOneOrderInfo?tid=',substring(OrdersCode,3,LEN(OrdersCode)-1))
 	else concat( 'http://api.360lj.com/taobaodocking/GetOneOrderInfo?tid=',substring(OrdersCode,4,LEN(OrdersCode)-1)) end 
 	as Url
@@ -774,6 +834,7 @@ FROM mall..orders
    
 WHERE OrdersCode LIKE 'TM%' AND OriginType IN (6,57,58)
 	AND AconsigneePhone2!=''
+	AND DateDiff(dd,OrderTime,getdate())&lt;=90
    ORDER BY OrderTime DESC</sql>
     <limit>0</limit>
     <lookup/>
@@ -795,6 +856,18 @@ WHERE OrdersCode LIKE 'TM%' AND OriginType IN (6,57,58)
     </GUI>
   </step>
   <step_error_handling>
+    <error>
+      <source_step>HTTP client</source_step>
+      <target_step/>
+      <is_enabled>N</is_enabled>
+      <nr_valuename/>
+      <descriptions_valuename/>
+      <fields_valuename/>
+      <codes_valuename/>
+      <max_errors/>
+      <max_pct_errors/>
+      <min_pct_rows/>
+    </error>
   </step_error_handling>
   <slave-step-copy-partition-distribution>
   </slave-step-copy-partition-distribution>