|
@@ -19,7 +19,7 @@ import java.time.format.DateTimeFormatter;
|
19
|
19
|
import java.util.*;
|
20
|
20
|
|
21
|
21
|
@RunWith(SpringRunner.class)
|
22
|
|
-@SpringBootTest
|
|
22
|
+@SpringBootTest(classes = EtlCamelHugeApplication.class)
|
23
|
23
|
class EtlCamelHugeApplicationTests {
|
24
|
24
|
|
25
|
25
|
@Resource(name = "oracle")
|
|
@@ -57,21 +57,23 @@ class EtlCamelHugeApplicationTests {
|
57
|
57
|
|
58
|
58
|
results.forEach(rowMap->{
|
59
|
59
|
Stack<String> orgPreStack = new Stack<>();
|
60
|
|
- Map<String,Object> parentObj = null;
|
61
|
|
- while((parentObj=parentObjMap.get(rowMap.get("PARENT_ID").toString()))!=null){
|
|
60
|
+ Map<String,Object> parentObj = rowMap;
|
|
61
|
+
|
|
62
|
+ while((parentObj=parentObjMap.get(parentObj .get("ORG_ID").toString()))!=null){
|
62
|
63
|
orgPreStack.push(parentObj.get("ORG_NAME").toString());
|
63
|
64
|
}
|
64
|
65
|
StringBuilder orgIdPre = new StringBuilder();
|
65
|
66
|
while (!orgPreStack.isEmpty()){
|
66
|
|
- orgIdPre.append("@").append(orgPreStack.pop());
|
|
67
|
+ orgIdPre.append(orgPreStack.pop()).append("@");
|
67
|
68
|
}
|
68
|
|
- String orgIdPreStr = orgIdPre.delete(0, 1).toString();
|
|
69
|
+ orgIdPre.append(rowMap.get("ORG_NAME"));
|
|
70
|
+ String orgIdPreStr = orgIdPre.toString();
|
69
|
71
|
String sqlInsertOrg = String.format("insert into centralbase.cb_pc_organization(" +
|
70
|
72
|
"org_id,org_name,org_code,org_level,parent_id,org_id_pre) " +
|
71
|
|
- "values(%s,%s,%s,%s,%s,%s)",rowMap.get("ORG_ID"),rowMap.get("ORG_NAME"),rowMap.get("ORG_CODE"),rowMap.get("ORG_LEVEL")
|
|
73
|
+ "values('%s','%s','%s','%s','%s','%s')",rowMap.get("ORG_ID"),rowMap.get("ORG_NAME"),rowMap.get("ORG_CODE"),rowMap.get("ORG_LEVEL")
|
72
|
74
|
,rowMap.get("PARENT_ID"),orgIdPreStr);
|
73
|
|
- System.out.println(sqlInsertOrg);
|
74
|
|
-// centralbaseTemplate.execute(sqlInsertOrg);
|
|
75
|
+// System.out.println(sqlInsertOrg);
|
|
76
|
+ centralbaseTemplate.execute(sqlInsertOrg);
|
75
|
77
|
|
76
|
78
|
});
|
77
|
79
|
}
|