TiQuUtil.java 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. package com.hy;
  2. import java.io.BufferedReader;
  3. import java.io.FileInputStream;
  4. import java.io.InputStreamReader;
  5. public class TiQuUtil {
  6. public static String patchFile="C:/Users/Administrator/Desktop/20190214/147/接口订单号.txt";//补丁文件路径
  7. public static String patchFile1="C:/Users/Administrator/Desktop/20190214/147/出票成功订单.txt";//补丁文件路径
  8. /**
  9. * @param args
  10. * @throws Exception
  11. */
  12. public static void main(String[] args) throws Exception {
  13. b();
  14. }
  15. @SuppressWarnings("unused")
  16. private static void a5() throws Exception {
  17. String line;
  18. String errorInfo = "";
  19. FileInputStream f = new FileInputStream("C:/Users/Administrator/Desktop/数据整理/test.txt");
  20. BufferedReader dr = new BufferedReader(new InputStreamReader(f,"utf-8"));
  21. while((line=dr.readLine())!=null){
  22. line=line.replaceAll("\\s*", "");
  23. /*String mainOrderId = line.split(",")[0];
  24. String agentId = line.split(",")[2];
  25. System.out.println("update TrainOrderOffline set agentid="+agentId+" where OrderNumber = '"+mainOrderId+"';");*/
  26. System.out.print("'"+line+"',");
  27. }
  28. }
  29. @SuppressWarnings("unused")
  30. private static void a3() throws Exception {
  31. String line;
  32. String errorInfo = "";
  33. FileInputStream f = new FileInputStream("C:/Users/Administrator/Desktop/数据整理/下单接受成功未入库ID.txt");
  34. BufferedReader dr = new BufferedReader(new InputStreamReader(f,"utf-8"));
  35. while((line=dr.readLine())!=null){
  36. line=line.replaceAll("\\s*", "");
  37. String mainOrderId = line.split(",")[0];
  38. String id = line.split(",")[1];
  39. FileInputStream f1 = new FileInputStream("C:/Users/Administrator/Desktop/数据整理/线下票_公共出票部分_panDuanChupiao.log");
  40. BufferedReader dr1 = new BufferedReader(new InputStreamReader(f1,"utf-8"));
  41. String chupaioData = "";
  42. String line1 = "";
  43. while((line1=dr1.readLine())!=null){
  44. try {
  45. if(line1.indexOf(id+"_出票点回填出票信息_车厢号:") != -1){
  46. line1=line1.replaceAll("\\s*", "");
  47. chupaioData += line1.substring(line1.indexOf(id+"_出票点回填出票信息_车厢号:")+18, line1.indexOf(";expressNum"))+",";
  48. }
  49. } catch (Exception e) {
  50. errorInfo += line1+",";
  51. }
  52. }
  53. if(chupaioData.equals("")){
  54. System.out.println(line);
  55. }else{
  56. String[] strs = chupaioData.substring(0, chupaioData.length()-1).split(",");
  57. for (int i = 0; i < strs.length; i++) {
  58. String SeatNo = "";
  59. String Coach = "";
  60. String sealPrice = "";
  61. String ticketNo = "1";
  62. String realSeat = "";
  63. String[] a = strs[i].split(";");
  64. for (String str : a) {
  65. if(str.indexOf("座位号") != -1) SeatNo = str.split(":")[1];
  66. if(str.indexOf("车厢号") != -1) Coach = str.split(":")[1];
  67. if(str.indexOf("出票价格") != -1) sealPrice = str.split(":")[1];
  68. if(str.indexOf("票号") != -1) ticketNo = str.split(":")[1];
  69. if(str.indexOf("realSeat") != -1) realSeat = str.split(":")[1];
  70. }
  71. }
  72. }
  73. }
  74. }
  75. @SuppressWarnings("unused")
  76. private static void a2() throws Exception {
  77. String line;
  78. String ids = "";
  79. String errorInfo = "";
  80. FileInputStream f = new FileInputStream("C:/Users/Administrator/Desktop/数据整理/下单接受成功未入库.txt");
  81. BufferedReader dr = new BufferedReader(new InputStreamReader(f,"utf-8"));
  82. /*while((line=dr.readLine())!=null){
  83. try {
  84. if(line.indexOf("reqData") != -1){
  85. line=line.replaceAll("\\s*", "");
  86. line=line.substring(line.indexOf("main_order_id")+15, line.length());
  87. line=line.substring(0, line.indexOf("}"));
  88. ids += "'"+line+"',";
  89. }
  90. } catch (Exception e) {
  91. errorInfo += line+",";
  92. }
  93. }
  94. System.out.println(ids.split(",").length);
  95. System.out.println(ids);
  96. System.out.println(errorInfo);*/
  97. System.out.print("[");
  98. while((line=dr.readLine())!=null){
  99. try {
  100. if(line.indexOf("reqData") != -1){
  101. System.out.println(line.substring(line.indexOf("reqData")+10, line.length())+",");
  102. }
  103. } catch (Exception e) {
  104. errorInfo += line+",";
  105. }
  106. }
  107. System.out.print("]");
  108. }
  109. @SuppressWarnings("unused")
  110. private static void a4() throws Exception {
  111. String line;
  112. String ids = "";
  113. String errorInfo = "";
  114. FileInputStream f = new FileInputStream("C:/Users/Administrator/Desktop/数据整理/下单接受成功未入库数据.txt");
  115. BufferedReader dr = new BufferedReader(new InputStreamReader(f,"utf-8"));
  116. System.out.print("[");
  117. while((line=dr.readLine())!=null){
  118. System.out.print(line);
  119. }
  120. System.out.print("]");
  121. }
  122. @SuppressWarnings("unused")
  123. private static void a() throws Exception {
  124. String line;
  125. String ids = "";
  126. String errorInfo = "";
  127. FileInputStream f = new FileInputStream(patchFile);
  128. BufferedReader dr = new BufferedReader(new InputStreamReader(f,"utf-8"));
  129. while((line=dr.readLine())!=null){
  130. try {
  131. if(line.indexOf("main_order_id") != -1){
  132. line=line.replaceAll("\\s*", "");
  133. line=line.substring(line.indexOf("main_order_id")+14, line.length());
  134. line=line.substring(0, line.indexOf(","));
  135. ids += "'"+line+"',";
  136. }
  137. } catch (Exception e) {
  138. errorInfo += line+",";
  139. }
  140. }
  141. System.out.println(ids.split(",").length);
  142. System.out.println(ids);
  143. System.out.println(errorInfo);
  144. }
  145. @SuppressWarnings("unused")
  146. private static void a1() throws Exception {
  147. String line;
  148. String ids = "";
  149. String errorInfo = "";
  150. FileInputStream f = new FileInputStream("C:/Users/Administrator/Desktop/数据整理/下单接受成功未入库.txt");
  151. BufferedReader dr = new BufferedReader(new InputStreamReader(f,"utf-8"));
  152. /*while((line=dr.readLine())!=null){
  153. try {
  154. if(line.indexOf("reqData") != -1){
  155. line=line.replaceAll("\\s*", "");
  156. line=line.substring(line.indexOf("main_order_id")+15, line.length());
  157. line=line.substring(0, line.indexOf("}"));
  158. ids += "'"+line+"',";
  159. }
  160. } catch (Exception e) {
  161. errorInfo += line+",";
  162. }
  163. }
  164. System.out.println(ids.split(",").length);
  165. System.out.println(ids);
  166. System.out.println(errorInfo);*/
  167. System.out.print("[");
  168. while((line=dr.readLine())!=null){
  169. try {
  170. if(line.indexOf("reqData") != -1){
  171. System.out.println(line.substring(line.indexOf("reqData")+10, line.length())+",");
  172. }
  173. } catch (Exception e) {
  174. errorInfo += line+",";
  175. }
  176. }
  177. System.out.print("]");
  178. }
  179. /**
  180. * 提取出票失败的接口订单号
  181. * @throws Exception
  182. */
  183. @SuppressWarnings("resource")
  184. private static void b() throws Exception{
  185. String line;
  186. String ids = "";
  187. String idss = "";
  188. String errorInfo = "";
  189. String noids = "";
  190. FileInputStream f = new FileInputStream("C:/Users/Administrator/Desktop/数据整理/test.txt");
  191. BufferedReader dr = new BufferedReader(new InputStreamReader(f,"utf-8"));
  192. while((line=dr.readLine())!=null){
  193. /*try {
  194. if(line.indexOf("main_order_id") != -1){
  195. line=line.replaceAll("\\s*", "");
  196. line=line.substring(line.indexOf("main_order_id")+14, line.length());
  197. ids+=line.substring(0, line.indexOf(",")+1);
  198. }
  199. } catch (Exception e) {
  200. errorInfo += line+",";
  201. }*/
  202. ids+=line+",";
  203. }
  204. FileInputStream f1 = new FileInputStream("C:/Users/Administrator/Desktop/数据整理/test1.txt");
  205. BufferedReader dr1 = new BufferedReader(new InputStreamReader(f1,"utf-8"));
  206. while((line=dr1.readLine()) != null){
  207. try {
  208. idss+=line.replaceAll("\\s*", "")+",";
  209. } catch (Exception e) {
  210. errorInfo += line+",";
  211. }
  212. }
  213. for (String str : ids.split(",")) {
  214. boolean is = false;
  215. for (String strs : idss.split(",")) {
  216. if(strs.equals(str)){
  217. is = true;
  218. break;
  219. }
  220. }
  221. if(!is){
  222. System.out.println(str);
  223. noids += str+",";
  224. }
  225. }
  226. System.out.println(noids.split(",").length);
  227. System.out.println(noids);
  228. System.out.println(errorInfo);
  229. }
  230. /**
  231. *
  232. * @throws Exception
  233. */
  234. @SuppressWarnings("resource")
  235. private static void c() throws Exception{
  236. String line;
  237. String ids = "";
  238. String idss = "";
  239. String errorInfo = "";
  240. String noids = "";
  241. FileInputStream f = new FileInputStream(patchFile);
  242. BufferedReader dr = new BufferedReader(new InputStreamReader(f,"utf-8"));
  243. while((line=dr.readLine())!=null){
  244. try {
  245. if(line.indexOf("main_order_id") != -1){
  246. line=line.replaceAll("\\s*", "");
  247. line=line.substring(line.indexOf("main_order_id")+14, line.length());
  248. ids+=line.substring(0, line.indexOf(",")+1);
  249. }
  250. } catch (Exception e) {
  251. errorInfo += line+",";
  252. }
  253. }
  254. FileInputStream f1 = new FileInputStream(patchFile1);
  255. BufferedReader dr1 = new BufferedReader(new InputStreamReader(f1,"utf-8"));
  256. while((line=dr1.readLine()) != null){
  257. try {
  258. idss+=line.replaceAll("\\s*", "")+",";
  259. } catch (Exception e) {
  260. errorInfo += line+",";
  261. }
  262. }
  263. for (String str : ids.split(",")) {
  264. boolean is = false;
  265. for (String strs : idss.split(",")) {
  266. if(strs.equals(str)){
  267. is = true;
  268. break;
  269. }
  270. }
  271. if(!is){
  272. System.out.println(str);
  273. }
  274. }
  275. System.out.println(noids.split(",").length);
  276. System.out.println(noids);
  277. System.out.println(errorInfo);
  278. }
  279. }