|
|
@@ -433,7 +433,7 @@ public class HanaOrderComponent {
|
|
|
"\tB.ZMAKTXX,\n" +
|
|
|
"\tB.GROES,\n" +
|
|
|
"\tB.ZTKNUM,\n" +
|
|
|
- "\treplace(replace(ltrim(rtrim(B.ZSTREET)),' ',''),'\"','') ZSTREET,\n" +
|
|
|
+ "\treplace(replace(ltrim(rtrim(B.ZSTREET)),'CHAR(10)',''),'CHAR(13)','') ZSTREET,\n" +
|
|
|
"\tB.ERDAT_S,\n" +
|
|
|
"\tB.ZERDAT2,\n" +
|
|
|
"\tB.ERDAT,\n" +
|
|
|
@@ -560,6 +560,94 @@ public class HanaOrderComponent {
|
|
|
|
|
|
}*/
|
|
|
private int createSelfReviewedDeliverOrderTxt(ResultSet result)throws Exception{
|
|
|
+ File file = null;
|
|
|
+ FileWriter fw = null;
|
|
|
+ Connection conn = null;
|
|
|
+ PreparedStatement pstm =null;
|
|
|
+ int j =0;
|
|
|
+ try {
|
|
|
+ long i =0;
|
|
|
+
|
|
|
+ //创建IO需求的条件,并声明输出路径
|
|
|
+ file = new File((Global.getTemdataPath()+"selfDeliverOrder/"));
|
|
|
+ log.info("selfDeliverOrder数据缓存路径:" + Global.getTemdataPath()+"selfDeliverOrder/");
|
|
|
+ if(!file.exists()){
|
|
|
+ file.mkdir();
|
|
|
+ }
|
|
|
+
|
|
|
+ file = new File(Global.getTemdataPath()+"selfDeliverOrder/"+j+".txt");
|
|
|
+ if(!file.exists()){
|
|
|
+ file.createNewFile();
|
|
|
+ }else {
|
|
|
+ //取得这个目录下的所有子文件对象
|
|
|
+ File[] files = new File(Global.getTemdataPath()+"selfDeliverOrder/").listFiles();
|
|
|
+ //遍历该目录下的文件对象
|
|
|
+ for (File f: files){
|
|
|
+ f.delete();
|
|
|
+ }
|
|
|
+ file.delete();
|
|
|
+ file.createNewFile();
|
|
|
+ }
|
|
|
+ fw = new FileWriter(file);
|
|
|
+ Long startTime = System.currentTimeMillis();
|
|
|
+ while (result.next()){
|
|
|
+
|
|
|
+ fw.write(
|
|
|
+ result.getString("MANDT")
|
|
|
+ +"$$"+result.getString("VBELN")
|
|
|
+ +"$$"+result.getString("DATUM")
|
|
|
+ + "\r\n");
|
|
|
+ fw.flush();
|
|
|
+ i++;
|
|
|
+ if (i%50000==0){
|
|
|
+ j++;
|
|
|
+ //创建IO需求的条件,并声明输出路径
|
|
|
+ file = new File(Global.getTemdataPath()+"selfDeliverOrder/"+j+".txt");
|
|
|
+ if(!file.exists()){
|
|
|
+ file.createNewFile();
|
|
|
+ }else {
|
|
|
+ file.delete();
|
|
|
+ file.createNewFile();
|
|
|
+ }
|
|
|
+ fw = new FileWriter(file);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Long endTime = System.currentTimeMillis();
|
|
|
+ log.info("生成selfDeliverOrder-TXT用时:" + (endTime - startTime) + "毫秒");
|
|
|
+
|
|
|
+ conn = getMysqlConnection();
|
|
|
+ //生产表
|
|
|
+ String sql = "TRUNCATE TABLE meta_hana_self_deliver_order";
|
|
|
+ pstm = conn.prepareStatement(sql);
|
|
|
+ pstm.execute();
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }finally {
|
|
|
+ fw.close();
|
|
|
+ if(pstm!=null){
|
|
|
+ try {
|
|
|
+ pstm.close();
|
|
|
+ } catch (SQLException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(conn!=null){
|
|
|
+ try {
|
|
|
+ conn.close();
|
|
|
+ } catch (SQLException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return j;
|
|
|
+ }
|
|
|
+
|
|
|
+ private int createDeliverOrderTxt(ResultSet result) throws Exception {
|
|
|
+=========
|
|
|
+>>>>>>>>> Temporary merge branch 2
|
|
|
File file = null;
|
|
|
FileWriter fw = null;
|
|
|
Connection conn = null;
|
|
|
@@ -867,7 +955,7 @@ public class HanaOrderComponent {
|
|
|
|
|
|
|
|
|
|
|
|
- public int bulkLoadFromInputStream(String loadDataSql,
|
|
|
+ public int bulkLoadFromInputStream (String loadDataSql,
|
|
|
InputStream dataStream) throws Exception {
|
|
|
if(dataStream==null){
|
|
|
log.info("InputStream is null ,No data is imported");
|
|
|
@@ -967,6 +1055,7 @@ public class HanaOrderComponent {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
public void runLoadDeliverOrder() throws Exception{
|
|
|
Connection conn = null;
|
|
|
PreparedStatement pstm =null;
|