123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- package com.hy;
- import java.io.BufferedReader;
- import java.io.FileInputStream;
- import java.io.InputStreamReader;
- public class TiQuUtil {
- public static String patchFile="C:/Users/Administrator/Desktop/20190214/147/接口订单号.txt";//补丁文件路径
- public static String patchFile1="C:/Users/Administrator/Desktop/20190214/147/出票成功订单.txt";//补丁文件路径
-
- /**
- * @param args
- * @throws Exception
- */
- public static void main(String[] args) throws Exception {
- b();
- }
- @SuppressWarnings("unused")
- private static void a5() throws Exception {
- String line;
- String errorInfo = "";
-
- FileInputStream f = new FileInputStream("C:/Users/Administrator/Desktop/数据整理/test.txt");
- BufferedReader dr = new BufferedReader(new InputStreamReader(f,"utf-8"));
- while((line=dr.readLine())!=null){
- line=line.replaceAll("\\s*", "");
- /*String mainOrderId = line.split(",")[0];
- String agentId = line.split(",")[2];
- System.out.println("update TrainOrderOffline set agentid="+agentId+" where OrderNumber = '"+mainOrderId+"';");*/
- System.out.print("'"+line+"',");
- }
- }
-
- @SuppressWarnings("unused")
- private static void a3() throws Exception {
- String line;
- String errorInfo = "";
-
- FileInputStream f = new FileInputStream("C:/Users/Administrator/Desktop/数据整理/下单接受成功未入库ID.txt");
- BufferedReader dr = new BufferedReader(new InputStreamReader(f,"utf-8"));
- while((line=dr.readLine())!=null){
- line=line.replaceAll("\\s*", "");
- String mainOrderId = line.split(",")[0];
- String id = line.split(",")[1];
- FileInputStream f1 = new FileInputStream("C:/Users/Administrator/Desktop/数据整理/线下票_公共出票部分_panDuanChupiao.log");
- BufferedReader dr1 = new BufferedReader(new InputStreamReader(f1,"utf-8"));
- String chupaioData = "";
- String line1 = "";
- while((line1=dr1.readLine())!=null){
- try {
- if(line1.indexOf(id+"_出票点回填出票信息_车厢号:") != -1){
- line1=line1.replaceAll("\\s*", "");
- chupaioData += line1.substring(line1.indexOf(id+"_出票点回填出票信息_车厢号:")+18, line1.indexOf(";expressNum"))+",";
- }
- } catch (Exception e) {
- errorInfo += line1+",";
- }
- }
- if(chupaioData.equals("")){
- System.out.println(line);
- }else{
- String[] strs = chupaioData.substring(0, chupaioData.length()-1).split(",");
- for (int i = 0; i < strs.length; i++) {
- String SeatNo = "";
- String Coach = "";
- String sealPrice = "";
- String ticketNo = "1";
- String realSeat = "";
- String[] a = strs[i].split(";");
- for (String str : a) {
- if(str.indexOf("座位号") != -1) SeatNo = str.split(":")[1];
- if(str.indexOf("车厢号") != -1) Coach = str.split(":")[1];
- if(str.indexOf("出票价格") != -1) sealPrice = str.split(":")[1];
- if(str.indexOf("票号") != -1) ticketNo = str.split(":")[1];
- if(str.indexOf("realSeat") != -1) realSeat = str.split(":")[1];
- }
- }
- }
- }
- }
- @SuppressWarnings("unused")
- private static void a2() throws Exception {
- String line;
- String ids = "";
- String errorInfo = "";
-
- FileInputStream f = new FileInputStream("C:/Users/Administrator/Desktop/数据整理/下单接受成功未入库.txt");
- BufferedReader dr = new BufferedReader(new InputStreamReader(f,"utf-8"));
- /*while((line=dr.readLine())!=null){
- try {
- if(line.indexOf("reqData") != -1){
- line=line.replaceAll("\\s*", "");
- line=line.substring(line.indexOf("main_order_id")+15, line.length());
- line=line.substring(0, line.indexOf("}"));
- ids += "'"+line+"',";
- }
- } catch (Exception e) {
- errorInfo += line+",";
- }
- }
- System.out.println(ids.split(",").length);
- System.out.println(ids);
- System.out.println(errorInfo);*/
- System.out.print("[");
- while((line=dr.readLine())!=null){
- try {
- if(line.indexOf("reqData") != -1){
- System.out.println(line.substring(line.indexOf("reqData")+10, line.length())+",");
- }
- } catch (Exception e) {
- errorInfo += line+",";
- }
- }
- System.out.print("]");
- }
- @SuppressWarnings("unused")
- private static void a4() throws Exception {
- String line;
- String ids = "";
- String errorInfo = "";
-
- FileInputStream f = new FileInputStream("C:/Users/Administrator/Desktop/数据整理/下单接受成功未入库数据.txt");
- BufferedReader dr = new BufferedReader(new InputStreamReader(f,"utf-8"));
-
- System.out.print("[");
- while((line=dr.readLine())!=null){
- System.out.print(line);
- }
- System.out.print("]");
- }
- @SuppressWarnings("unused")
- private static void a() throws Exception {
- String line;
- String ids = "";
- String errorInfo = "";
-
- FileInputStream f = new FileInputStream(patchFile);
- BufferedReader dr = new BufferedReader(new InputStreamReader(f,"utf-8"));
- while((line=dr.readLine())!=null){
- try {
- if(line.indexOf("main_order_id") != -1){
- line=line.replaceAll("\\s*", "");
- line=line.substring(line.indexOf("main_order_id")+14, line.length());
- line=line.substring(0, line.indexOf(","));
- ids += "'"+line+"',";
- }
- } catch (Exception e) {
- errorInfo += line+",";
- }
- }
- System.out.println(ids.split(",").length);
- System.out.println(ids);
- System.out.println(errorInfo);
- }
- @SuppressWarnings("unused")
- private static void a1() throws Exception {
- String line;
- String ids = "";
- String errorInfo = "";
-
- FileInputStream f = new FileInputStream("C:/Users/Administrator/Desktop/数据整理/下单接受成功未入库.txt");
- BufferedReader dr = new BufferedReader(new InputStreamReader(f,"utf-8"));
- /*while((line=dr.readLine())!=null){
- try {
- if(line.indexOf("reqData") != -1){
- line=line.replaceAll("\\s*", "");
- line=line.substring(line.indexOf("main_order_id")+15, line.length());
- line=line.substring(0, line.indexOf("}"));
- ids += "'"+line+"',";
- }
- } catch (Exception e) {
- errorInfo += line+",";
- }
- }
- System.out.println(ids.split(",").length);
- System.out.println(ids);
- System.out.println(errorInfo);*/
- System.out.print("[");
- while((line=dr.readLine())!=null){
- try {
- if(line.indexOf("reqData") != -1){
- System.out.println(line.substring(line.indexOf("reqData")+10, line.length())+",");
- }
- } catch (Exception e) {
- errorInfo += line+",";
- }
- }
- System.out.print("]");
- }
-
- /**
- * 提取出票失败的接口订单号
- * @throws Exception
- */
- @SuppressWarnings("resource")
- private static void b() throws Exception{
- String line;
- String ids = "";
- String idss = "";
- String errorInfo = "";
- String noids = "";
-
- FileInputStream f = new FileInputStream("C:/Users/Administrator/Desktop/数据整理/test.txt");
- BufferedReader dr = new BufferedReader(new InputStreamReader(f,"utf-8"));
- while((line=dr.readLine())!=null){
- /*try {
- if(line.indexOf("main_order_id") != -1){
- line=line.replaceAll("\\s*", "");
- line=line.substring(line.indexOf("main_order_id")+14, line.length());
- ids+=line.substring(0, line.indexOf(",")+1);
- }
- } catch (Exception e) {
- errorInfo += line+",";
- }*/
- ids+=line+",";
- }
- FileInputStream f1 = new FileInputStream("C:/Users/Administrator/Desktop/数据整理/test1.txt");
- BufferedReader dr1 = new BufferedReader(new InputStreamReader(f1,"utf-8"));
- while((line=dr1.readLine()) != null){
- try {
- idss+=line.replaceAll("\\s*", "")+",";
- } catch (Exception e) {
- errorInfo += line+",";
- }
- }
- for (String str : ids.split(",")) {
- boolean is = false;
- for (String strs : idss.split(",")) {
- if(strs.equals(str)){
- is = true;
- break;
- }
- }
- if(!is){
- System.out.println(str);
- noids += str+",";
- }
- }
- System.out.println(noids.split(",").length);
- System.out.println(noids);
- System.out.println(errorInfo);
- }
-
- /**
- *
- * @throws Exception
- */
- @SuppressWarnings("resource")
- private static void c() throws Exception{
- String line;
- String ids = "";
- String idss = "";
- String errorInfo = "";
- String noids = "";
-
- FileInputStream f = new FileInputStream(patchFile);
- BufferedReader dr = new BufferedReader(new InputStreamReader(f,"utf-8"));
- while((line=dr.readLine())!=null){
- try {
- if(line.indexOf("main_order_id") != -1){
- line=line.replaceAll("\\s*", "");
- line=line.substring(line.indexOf("main_order_id")+14, line.length());
- ids+=line.substring(0, line.indexOf(",")+1);
- }
- } catch (Exception e) {
- errorInfo += line+",";
- }
- }
-
- FileInputStream f1 = new FileInputStream(patchFile1);
- BufferedReader dr1 = new BufferedReader(new InputStreamReader(f1,"utf-8"));
- while((line=dr1.readLine()) != null){
- try {
- idss+=line.replaceAll("\\s*", "")+",";
- } catch (Exception e) {
- errorInfo += line+",";
- }
- }
- for (String str : ids.split(",")) {
- boolean is = false;
- for (String strs : idss.split(",")) {
- if(strs.equals(str)){
- is = true;
- break;
- }
- }
- if(!is){
- System.out.println(str);
- }
- }
- System.out.println(noids.split(",").length);
- System.out.println(noids);
- System.out.println(errorInfo);
- }
-
- }
|