| 
				
			 | 
			
			
				@@ -51,113 +51,6 @@ public class CamelJDBCConfiguration { 
			 | 
		
	
		
			
			| 
				
					51
				
			 | 
			
				
					51
				
			 | 
			
			
				             @Override 
			 | 
		
	
		
			
			| 
				
					52
				
			 | 
			
				
					52
				
			 | 
			
			
				             public void configure() throws Exception { 
			 | 
		
	
		
			
			| 
				
					53
				
			 | 
			
				
					53
				
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
					54
				
			 | 
			
				
			 | 
			
			
				-                /*RouteDefinition OrgAndWellSource= (RouteDefinition) from("timer:insert-OrgAndWellSource?period=86400000") 
			 | 
		
	
		
			
			| 
				
					55
				
			 | 
			
				
			 | 
			
			
				-                        .routeId("insert-OrgAndWellSource") 
			 | 
		
	
		
			
			| 
				
					56
				
			 | 
			
				
			 | 
			
			
				-                        .setHeader("date", constant(getDate()+" 00:00:00")) 
			 | 
		
	
		
			
			| 
				
					57
				
			 | 
			
				
			 | 
			
			
				-                        .process(exchange -> { 
			 | 
		
	
		
			
			| 
				
					58
				
			 | 
			
				
			 | 
			
			
				-                            org = 0; 
			 | 
		
	
		
			
			| 
				
					59
				
			 | 
			
				
			 | 
			
			
				-                            orgIdPreList = new HashMap<>(); 
			 | 
		
	
		
			
			| 
				
					60
				
			 | 
			
				
			 | 
			
			
				-                        }) 
			 | 
		
	
		
			
			| 
				
					61
				
			 | 
			
				
			 | 
			
			
				-                        .setBody(simple("select max(org_id) from centralbase.cb_pc_organization")) 
			 | 
		
	
		
			
			| 
				
					62
				
			 | 
			
				
			 | 
			
			
				-                        .to("jdbc:centralbase") 
			 | 
		
	
		
			
			| 
				
					63
				
			 | 
			
				
			 | 
			
			
				-                        .process(exchange -> { 
			 | 
		
	
		
			
			| 
				
					64
				
			 | 
			
				
			 | 
			
			
				-                            HashMap body = exchange.getIn().getBody(HashMap.class); 
			 | 
		
	
		
			
			| 
				
					65
				
			 | 
			
				
			 | 
			
			
				-                            if (body == null || StringUtils.isEmpty(body.get("max"))) org = 0; 
			 | 
		
	
		
			
			| 
				
					66
				
			 | 
			
				
			 | 
			
			
				-                            else 
			 | 
		
	
		
			
			| 
				
					67
				
			 | 
			
				
			 | 
			
			
				-                                org = Integer.valueOf(body.get("max").toString()); 
			 | 
		
	
		
			
			| 
				
					68
				
			 | 
			
				
			 | 
			
			
				-                        }) 
			 | 
		
	
		
			
			| 
				
					69
				
			 | 
			
				
			 | 
			
			
				-                        .setBody(simple("select org_id_pre,org_id from centralbase.cb_pc_organization")) 
			 | 
		
	
		
			
			| 
				
					70
				
			 | 
			
				
			 | 
			
			
				-                        .to("jdbc:centralbase") 
			 | 
		
	
		
			
			| 
				
					71
				
			 | 
			
				
			 | 
			
			
				-                        .split(body()).process(exchange -> { 
			 | 
		
	
		
			
			| 
				
					72
				
			 | 
			
				
			 | 
			
			
				-                            HashMap body = exchange.getIn().getBody(HashMap.class); 
			 | 
		
	
		
			
			| 
				
					73
				
			 | 
			
				
			 | 
			
			
				-                            orgIdPreList.put(body.get("org_id_pre"),body.get("org_id")); 
			 | 
		
	
		
			
			| 
				
					74
				
			 | 
			
				
			 | 
			
			
				-                        }).end(); 
			 | 
		
	
		
			
			| 
				
					75
				
			 | 
			
				
			 | 
			
			
				-                        setMyBody(OrgAndWellSource) 
			 | 
		
	
		
			
			| 
				
					76
				
			 | 
			
				
			 | 
			
			
				-                       .setBody(simple("select  distinct WELL_ID,cydmc,zyq,zk,qyrq,sccw,qk,REMARKS from DBA01 where PROD_DATE=to_date('${header.date}','yyyy-mm-dd hh24:mi:ss') and WELL_ID ='${header.well_id}'")) 
			 | 
		
	
		
			
			| 
				
					77
				
			 | 
			
				
			 | 
			
			
				-                       .to("jdbc:oracle") 
			 | 
		
	
		
			
			| 
				
					78
				
			 | 
			
				
			 | 
			
			
				-                       .transform() 
			 | 
		
	
		
			
			| 
				
					79
				
			 | 
			
				
			 | 
			
			
				-                       .body((result) -> { 
			 | 
		
	
		
			
			| 
				
					80
				
			 | 
			
				
			 | 
			
			
				-                              organization = new TreeSet<>(); 
			 | 
		
	
		
			
			| 
				
					81
				
			 | 
			
				
			 | 
			
			
				-                              return result; 
			 | 
		
	
		
			
			| 
				
					82
				
			 | 
			
				
			 | 
			
			
				-                          }) 
			 | 
		
	
		
			
			| 
				
					83
				
			 | 
			
				
			 | 
			
			
				-                       .step("1") 
			 | 
		
	
		
			
			| 
				
					84
				
			 | 
			
				
			 | 
			
			
				-                       .split(body()).process(exchange -> { 
			 | 
		
	
		
			
			| 
				
					85
				
			 | 
			
				
			 | 
			
			
				-                      Message in = exchange.getIn(); 
			 | 
		
	
		
			
			| 
				
					86
				
			 | 
			
				
			 | 
			
			
				-                      HashMap<String, Object> aRow = in.getBody(HashMap.class); 
			 | 
		
	
		
			
			| 
				
					87
				
			 | 
			
				
			 | 
			
			
				-                      if (StringUtils.isEmpty(aRow.get("qyrq"))){ 
			 | 
		
	
		
			
			| 
				
					88
				
			 | 
			
				
			 | 
			
			
				-                          aRow.put("QYRQ","2021-01-01 00:00:00"); 
			 | 
		
	
		
			
			| 
				
					89
				
			 | 
			
				
			 | 
			
			
				-                      } 
			 | 
		
	
		
			
			| 
				
					90
				
			 | 
			
				
			 | 
			
			
				-                      if (!aRow.containsKey("JM")) aRow.put("JM",aRow.get("WELL_ID")); 
			 | 
		
	
		
			
			| 
				
					91
				
			 | 
			
				
			 | 
			
			
				-                      String org_level3 = aRow.get("ZYQ") + "@" + aRow.get("CYDMC") + "@" + aRow.get("ZK"); 
			 | 
		
	
		
			
			| 
				
					92
				
			 | 
			
				
			 | 
			
			
				-                      String org_level2 = aRow.get("ZYQ") + "@" + aRow.get("CYDMC"); 
			 | 
		
	
		
			
			| 
				
					93
				
			 | 
			
				
			 | 
			
			
				-                      String org_level1 = aRow.get("ZYQ").toString(); 
			 | 
		
	
		
			
			| 
				
					94
				
			 | 
			
				
			 | 
			
			
				-                      aRow.put("station_id", org_level3); 
			 | 
		
	
		
			
			| 
				
					95
				
			 | 
			
				
			 | 
			
			
				-                      orgID = org; 
			 | 
		
	
		
			
			| 
				
					96
				
			 | 
			
				
			 | 
			
			
				-                      if ((!orgIdPreList.containsKey(org_level1)) || (!orgIdPreList.containsKey(org_level2)) || (!orgIdPreList.containsKey(org_level3))) { 
			 | 
		
	
		
			
			| 
				
					97
				
			 | 
			
				
			 | 
			
			
				-                          if (organization.add(org_level1)) { 
			 | 
		
	
		
			
			| 
				
					98
				
			 | 
			
				
			 | 
			
			
				-                                if (!orgIDs.containsKey(org_level1)) orgIDs.put(org_level1,++orgID); 
			 | 
		
	
		
			
			| 
				
					99
				
			 | 
			
				
			 | 
			
			
				-                          } 
			 | 
		
	
		
			
			| 
				
					100
				
			 | 
			
				
			 | 
			
			
				-                          if (organization.add(org_level2)) { 
			 | 
		
	
		
			
			| 
				
					101
				
			 | 
			
				
			 | 
			
			
				-                              if (!orgIDs.containsKey(org_level2)) orgIDs.put(org_level2,++orgID); 
			 | 
		
	
		
			
			| 
				
					102
				
			 | 
			
				
			 | 
			
			
				-                          } 
			 | 
		
	
		
			
			| 
				
					103
				
			 | 
			
				
			 | 
			
			
				-                          if (organization.add(org_level3)) { 
			 | 
		
	
		
			
			| 
				
					104
				
			 | 
			
				
			 | 
			
			
				-                              if (!orgIDs.containsKey(org_level3)) orgIDs.put(org_level3,++orgID); 
			 | 
		
	
		
			
			| 
				
					105
				
			 | 
			
				
			 | 
			
			
				-                          } 
			 | 
		
	
		
			
			| 
				
					106
				
			 | 
			
				
			 | 
			
			
				-                      } 
			 | 
		
	
		
			
			| 
				
					107
				
			 | 
			
				
			 | 
			
			
				-                      if(orgIdPreList.get(org_level3) !=null){ 
			 | 
		
	
		
			
			| 
				
					108
				
			 | 
			
				
			 | 
			
			
				-                          aRow.put("org_id",orgIdPreList.get(org_level3)); 
			 | 
		
	
		
			
			| 
				
					109
				
			 | 
			
				
			 | 
			
			
				-                          return; 
			 | 
		
	
		
			
			| 
				
					110
				
			 | 
			
				
			 | 
			
			
				-                      } 
			 | 
		
	
		
			
			| 
				
					111
				
			 | 
			
				
			 | 
			
			
				-                      if(orgIDs.get(org_level3) !=null){ 
			 | 
		
	
		
			
			| 
				
					112
				
			 | 
			
				
			 | 
			
			
				-                          aRow.put("org_id",orgIDs.get(org_level3)); 
			 | 
		
	
		
			
			| 
				
					113
				
			 | 
			
				
			 | 
			
			
				-                      } 
			 | 
		
	
		
			
			| 
				
					114
				
			 | 
			
				
			 | 
			
			
				-                  }) 
			 | 
		
	
		
			
			| 
				
					115
				
			 | 
			
				
			 | 
			
			
				-                  .setBody(simple("insert into centralbase.cb_cd_well_source (well_id,well_common_name,spud_date,org_id,station_id,station_name,completion_name,PRODUCING_AREA_name,remarks) " + 
			 | 
		
	
		
			
			| 
				
					116
				
			 | 
			
				
			 | 
			
			
				-                                  "select '${body[WELL_ID]}','${body[JM]}','${body[QYRQ]}'::timestamp,'${body[org_id]}','${body[station_id]}','${body[ZK]}','${body[SCCW]}','${body[QK]}','${body[REMARKS]}' " + 
			 | 
		
	
		
			
			| 
				
					117
				
			 | 
			
				
			 | 
			
			
				-                                  "where NOT EXISTS ( SELECT * FROM centralbase.cb_cd_well_source WHERE well_id = '${body[WELL_ID]}' )")) 
			 | 
		
	
		
			
			| 
				
					118
				
			 | 
			
				
			 | 
			
			
				-                  .to("jdbc:centralbase") 
			 | 
		
	
		
			
			| 
				
					119
				
			 | 
			
				
			 | 
			
			
				-                  .end() 
			 | 
		
	
		
			
			| 
				
					120
				
			 | 
			
				
			 | 
			
			
				-                  .transform().body((re) -> { 
			 | 
		
	
		
			
			| 
				
					121
				
			 | 
			
				
			 | 
			
			
				-                      List<Map<String, Object>> rows = new ArrayList<>(); 
			 | 
		
	
		
			
			| 
				
					122
				
			 | 
			
				
			 | 
			
			
				-                      for (String s : organization) { 
			 | 
		
	
		
			
			| 
				
					123
				
			 | 
			
				
			 | 
			
			
				-                          Map<String, Object> row = new HashMap<>(); 
			 | 
		
	
		
			
			| 
				
					124
				
			 | 
			
				
			 | 
			
			
				-                          String[] orgs = s.split("@"); 
			 | 
		
	
		
			
			| 
				
					125
				
			 | 
			
				
			 | 
			
			
				-                          row.put("org_id_pre", s); 
			 | 
		
	
		
			
			| 
				
					126
				
			 | 
			
				
			 | 
			
			
				-                          switch (orgs.length) { 
			 | 
		
	
		
			
			| 
				
					127
				
			 | 
			
				
			 | 
			
			
				-                              case 1: 
			 | 
		
	
		
			
			| 
				
					128
				
			 | 
			
				
			 | 
			
			
				-                                  row.put("org_name", orgs[0]); 
			 | 
		
	
		
			
			| 
				
					129
				
			 | 
			
				
			 | 
			
			
				-                                  row.put("org_level", 1); 
			 | 
		
	
		
			
			| 
				
					130
				
			 | 
			
				
			 | 
			
			
				-                                  row.put("org_parent", "0"); 
			 | 
		
	
		
			
			| 
				
					131
				
			 | 
			
				
			 | 
			
			
				-                                  break; 
			 | 
		
	
		
			
			| 
				
					132
				
			 | 
			
				
			 | 
			
			
				-                              case 2: 
			 | 
		
	
		
			
			| 
				
					133
				
			 | 
			
				
			 | 
			
			
				-                                  row.put("org_name", orgs[1]); 
			 | 
		
	
		
			
			| 
				
					134
				
			 | 
			
				
			 | 
			
			
				-                                  row.put("org_level", 2); 
			 | 
		
	
		
			
			| 
				
					135
				
			 | 
			
				
			 | 
			
			
				-                                  row.put("org_parent", orgIDs.get(orgs[0]).toString()); 
			 | 
		
	
		
			
			| 
				
					136
				
			 | 
			
				
			 | 
			
			
				-                                  break; 
			 | 
		
	
		
			
			| 
				
					137
				
			 | 
			
				
			 | 
			
			
				-                              case 3: 
			 | 
		
	
		
			
			| 
				
					138
				
			 | 
			
				
			 | 
			
			
				-                                  row.put("org_name", orgs[2]); 
			 | 
		
	
		
			
			| 
				
					139
				
			 | 
			
				
			 | 
			
			
				-                                  row.put("org_level", 3); 
			 | 
		
	
		
			
			| 
				
					140
				
			 | 
			
				
			 | 
			
			
				-                                  row.put("org_parent", orgIDs.get(orgs[0] + "@" + orgs[1]).toString()); 
			 | 
		
	
		
			
			| 
				
					141
				
			 | 
			
				
			 | 
			
			
				-                                  break; 
			 | 
		
	
		
			
			| 
				
					142
				
			 | 
			
				
			 | 
			
			
				-                          } 
			 | 
		
	
		
			
			| 
				
					143
				
			 | 
			
				
			 | 
			
			
				-                          if (!orgIdPreList.containsKey(s)) { 
			 | 
		
	
		
			
			| 
				
					144
				
			 | 
			
				
			 | 
			
			
				-                              org++; 
			 | 
		
	
		
			
			| 
				
					145
				
			 | 
			
				
			 | 
			
			
				-                              row.put("org_code", org); 
			 | 
		
	
		
			
			| 
				
					146
				
			 | 
			
				
			 | 
			
			
				-                              row.put("org_id", "" + org); 
			 | 
		
	
		
			
			| 
				
					147
				
			 | 
			
				
			 | 
			
			
				-                              orgIdPreList.put(s, row.get("org_id")); 
			 | 
		
	
		
			
			| 
				
					148
				
			 | 
			
				
			 | 
			
			
				-                              rows.add(row); 
			 | 
		
	
		
			
			| 
				
					149
				
			 | 
			
				
			 | 
			
			
				-                          } 
			 | 
		
	
		
			
			| 
				
					150
				
			 | 
			
				
			 | 
			
			
				-                      } 
			 | 
		
	
		
			
			| 
				
					151
				
			 | 
			
				
			 | 
			
			
				-                      return rows; 
			 | 
		
	
		
			
			| 
				
					152
				
			 | 
			
				
			 | 
			
			
				-                  }).split(body()) 
			 | 
		
	
		
			
			| 
				
					153
				
			 | 
			
				
			 | 
			
			
				-                  .setBody(simple("insert into centralbase.cb_pc_organization(org_id,org_code,org_name,org_level,parent_id,org_id_pre)" + 
			 | 
		
	
		
			
			| 
				
					154
				
			 | 
			
				
			 | 
			
			
				-                                  "select '${body[org_id]}','${body[org_code]}','${body[org_name]}','${body[org_level]}','${body[org_parent]}','${body[org_id_pre]}' " + 
			 | 
		
	
		
			
			| 
				
					155
				
			 | 
			
				
			 | 
			
			
				-                                  "where NOT EXISTS ( SELECT * FROM centralbase.cb_pc_organization WHERE org_id = '${body[org_id]}')")) 
			 | 
		
	
		
			
			| 
				
					156
				
			 | 
			
				
			 | 
			
			
				-                  .doTry() 
			 | 
		
	
		
			
			| 
				
					157
				
			 | 
			
				
			 | 
			
			
				-                  .to("jdbc:centralbase") 
			 | 
		
	
		
			
			| 
				
					158
				
			 | 
			
				
			 | 
			
			
				-                  .doCatch(Exception.class) 
			 | 
		
	
		
			
			| 
				
					159
				
			 | 
			
				
			 | 
			
			
				-                  .log("${header.date}"+" routeId:insert-OrgAndWellSource->  centralbase.cb_pc_organization insert data failed") 
			 | 
		
	
		
			
			| 
				
					160
				
			 | 
			
				
			 | 
			
			
				-                  .end();*/ 
			 | 
		
	
		
			
			| 
				
					161
				
			 | 
			
				
					54
				
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
					162
				
			 | 
			
				
					55
				
			 | 
			
			
				                 from("timer:update-wellControl?period=3600000") 
			 | 
		
	
		
			
			| 
				
					163
				
			 | 
			
				
					56
				
			 | 
			
			
				                         .routeId("update-wellControl") 
			 |