package cn.net.test;

import com.google.gson.Gson;

import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.net.cpzslibs.label.JinLabelUtil;
import cn.net.cpzslibs.prot.handset.bean.req.jinLiquor.Jin20022ReqBean;
import cn.net.cpzslibs.prot.handset.bean.req.jinLiquor.Jin20023ReqBean;
import cn.net.cpzslibs.prot.handset.bean.req.jinLiquor.JinErrorLabelBean;
import cn.net.test.bean.LabelBoxBean;

public class AInsertJinTestData {
	// INSERT INTO `tbl_index_17` (label_id,produce_index,YEAR) VALUES
	// (813080800100700542,301,2017)
	// INSERT INTO `tbl_pro_301_17` (label_id,package_label_id) VALUES
	// (112030600100700511,286785104404)
	// INSERT INTO `tbl_pro_box_301_17` (package_label_id,product_id,group_id)
	// VALUES(286785104400,'zb000084',666)
	static int _lineFlag = 23;
	private static String filePath1 = "D:\\echo\\JinTestData\\zsm_1509335445614_600.txt";
	static String inserIndexSql = "";
	static String insertProSql = "";
	static String insertBoxSql = "";
	static List<String> labels = new ArrayList<>();
	static List<String> boxs = new ArrayList<>();
	static List<LabelBoxBean> boxBeans = new ArrayList<>();

	public static void main(String[] args) {

		// insertLalelAndBox();
		// insert85BoxLabel();
		// insertPrintLabel();
		// queryPrintLabel();
		// queryPrintContainer();
		// System.out.println(" jie:" +
		// AES.decrypt("79F6CAA41143546506DE863CDCF86DA2"));
		// queryAllProductInFile();
		// queryAllOrderSql();
		// getDealerOfflineData();
		// getWarehouseData();
//		getDealerOfflineErrorData();
//		getWLOrderScannerData();
//		getWarehouseTichuScannerData();
		getWLOrderScannerData();
//		getDBOptLog();
//		getDBOptLogPackageLabel();
	}

	private static void getDBOptLogPackageLabel() {
		String logPath = "E:\\echo\\新版手持机\\后期文档\\劲酒\\劲酒手持机\\物流终端\\日志相关\\考拉反馈\\2018-5-7\\";		
		String logFileName = "tbl_delivery_opeartion_30_after_123_all.txt";
		FileOperation operation = new FileOperation();
		StringBuilder sb = new StringBuilder();
		try {
			List<String> list = operation.readByIO(logPath+logFileName);
			for (String str : list) {
				if (str.startsWith("update tbl_pro_box_301_18 set tray_id = NULL")) {
					String packageLabel = str.substring(str.length()-12, str.length());
					sb.append(packageLabel);
					sb.append(",");
				}
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.err.println(sb.toString());
	}

	private static void getDBOptLog() {
		String outAnalyzeFileName="tbl_delivery_opeartion_30_analyze.txt";
		String logFileName = "tbl_delivery_opeartion_30.txt";
		String logPath = "E:\\echo\\新版手持机\\后期文档\\劲酒\\劲酒手持机\\物流终端\\日志相关\\考拉反馈\\2018-5-7\\";
		FileOperation operation = new FileOperation();
		StringBuilder sb = new StringBuilder();
		try {
			List<String> list = operation.readByIO(logPath+logFileName);
			for (String str : list) {
				if (str.startsWith("update tbl_pro_box_301_18") || str.startsWith("update tbl_delivery_order")) {
					sb.append(str);
					sb.append("\n");
				}
			}
			operation.contentToTxt(logPath+outAnalyzeFileName, sb.toString());
			
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

	private static void getWarehouseTichuScannerData() {
		String fileName = "jinpai-M1805000394";
		String logPath = "E:\\echo\\新版手持机\\后期文档\\劲酒\\劲酒手持机\\物流终端\\2018-5-2 导出日志\\" + fileName;
		String tcLabel = "302023132932";
		String outPath = "E:\\echo\\新版手持机\\后期文档\\劲酒\\劲酒手持机\\物流终端\\2018-5-2 导出日志\\tc\\";
		String outFileName = outPath + "tc_"+tcLabel+ ".txt";
		FileOperation operation = new FileOperation();
		StringBuilder sb = new StringBuilder();

		try {
			List<String> list = operation.readByIO(logPath);
			for (int i = 0; i < list.size(); i++) {
				String str = list.get(i);
				String tcLStr  = "\"package_label_id\":\""+tcLabel+"\"";
//				System.out.println(tcLStr);
				if (str.contains("upJson=") && str.contains("\"order_no\":\"M1805000394\"")&& str.contains(tcLStr) ) {
//					String packageLabel = str.substring(str.lastIndexOf("}") - 13 ,str.lastIndexOf("}")-1);
					sb.append(str);
					sb.append("\n");
						
				}
			}
//			System.err.println(sb.toString());
			operation.contentToTxt(outFileName, sb.toString());
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	private static void getWLOrderScannerData() {
		Gson gson = new Gson();
//		String fileName = "M1805000394-opt-3.txt";
		String fileName = "jin-pai";
		String logPath = "E:\\echo\\新版手持机\\后期文档\\劲酒\\劲酒手持机\\物流终端\\日志相关\\考拉反馈\\2018-5-7\\" + fileName;
		FileOperation operation = new FileOperation();
		StringBuilder sb = new StringBuilder();
		try {
			List<String> list = operation.readByIO(logPath);
			List<String> notRepeat = new ArrayList<>();
			
			System.out.println(logPath+"" + list.toString());
			for (int i = 0; i < list.size(); i++) {
				String str = list.get(i);
				if (str.contains("upJson=") && str.contains("\"order_no\":\"M1805001005\"")&& str.contains("package_label_id")) {
					String packageLabel = str.substring(str.lastIndexOf("}") - 13 ,str.lastIndexOf("}")-1);
					
						
					if (!notRepeat.contains(packageLabel)) {
						notRepeat.add(packageLabel);
					}
				}
			}
			
			for (int i = 0; i < notRepeat.size(); i++) {
				String str = notRepeat.get(i);
				if (i == 0) {
					sb.append("(");
				}
				sb.append(str);
				if (i < (notRepeat.size() - 1)) {
					sb.append(",");
				} else {
					sb.append(");");
				}
			}
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.err.println(sb.toString());

	}

	/**
	 * 获取经销商提交的错误码
	 */
	private static void getDealerOfflineErrorData() {

		Gson gson = new Gson();
		String errorDate = "2018-1-25";//存放原始数据的TXT文件名称
		String logPath = "D:\\echo\\JinTestData\\dealer_error_log\\" + errorDate + ".txt";
		FileOperation operation = new FileOperation();
		try {
			String logStr = operation.readTxtFile(new File(logPath));
			Jin20023ReqBean reqOffBean = gson.fromJson(logStr, Jin20023ReqBean.class);
			System.out.println("reqBean:" + reqOffBean.toString());
			List<JinErrorLabelBean> l = reqOffBean.getError_box_list();
			StringBuilder s1 = new StringBuilder();
			StringBuilder s2 = new StringBuilder();

			Map<Integer, StringBuilder> map = new HashMap<>();
			for (JinErrorLabelBean b : l) {
				if (!map.containsKey(b.getError_code())) {
					map.put(b.getError_code(), new StringBuilder());
				}
				StringBuilder sb = map.get(b.getError_code());
				sb.append(b.getLabel_id() + "\n");
			}

			String destDirName = "D:\\echo\\JinTestData\\dealer_error_log\\" + errorDate;
			long currentTime = System.currentTimeMillis();
//			String filePath = destDirName + "\\" + currentTime + "_error_10001.txt";
//			String filePath1 = destDirName + "\\" + currentTime + "_error_other.txt";
			operation.createDir(destDirName);
			for (Integer key : map.keySet()) {
				System.out.println("Key = " + key);
				String filePath = destDirName + "\\" + currentTime + "_error_"+key+".txt";
				operation.createFile(new File(filePath));
				operation.contentToTxt(filePath, map.get(key).toString());
			}

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	private static void getWarehouseData() {
		String logPath = "D:\\echo\\JinTestData\\warehouseOut\\outWarehouseLabel.txt";
		FileOperation operation = new FileOperation();
		try {
			List<String> list = operation.readByIO(logPath);
			// set opt=1, dealer_id = '02703003', create_time=CURRENT_TIMESTAMP,
			// delivery_relationid='372986' where package_label_id
			String beforeSql = "update tbl_pro_box_301_17 set dealer_id = '02703003', create_time=CURRENT_TIMESTAMP,delivery_relationid='372491' where package_label_id=";
			String updateSql = "";
			for (String s : list) {
				updateSql = updateSql + beforeSql + s + ";\n";
			}

			String filePath = "D:\\echo\\JinTestData\\warehouseOut\\updateoutWarehouseLabel.txt";
			operation.writeTxtFile(updateSql, new File(filePath));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	private static void getDealerOfflineData() {
		Gson gson = new Gson();
		String logPath = "D:\\echo\\JinTestData\\service_log.txt";
		FileOperation operation = new FileOperation();
		try {
			String logStr = operation.readTxtFile(new File(logPath));
			Jin20023ReqBean reqOffBean = gson.fromJson(logStr, Jin20023ReqBean.class);
			System.out.println("reqBean:" + reqOffBean.toString());
			List<String> l = reqOffBean.getPallet_box_list();
			for (int i = 0; i < l.size(); i++) {
				Jin20022ReqBean reqBean = new Jin20022ReqBean();
				reqBean.setPackage_label_id(l.get(i));
				reqBean.setOrder_number(reqOffBean.getOrder_number());
				reqBean.setDealer_id(reqOffBean.getDealer_id());
				reqBean.setSecond_dealer_id(reqOffBean.getSecond_dealer_id());
				reqBean.setSecond_dealer_name(reqOffBean.getSecond_dealer_name());
				reqBean.setOpt(2);
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	private static void queryAllOrderSql() {
		String productPath = "D:\\echo\\JinTestData\\product_info.txt";
		FileOperation operation = new FileOperation();
		List<String> allProducts = new ArrayList<>();
		try {

			allProducts = operation.readTextFile(new File(productPath));
			// System.out.println("list:" + list);

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		// SELECT
		// relationID,orderNo,dealerCode,dealerName,itemCode,cWhCode,cWhName,businessDate,orderAmount,deliveredNum,DataStatus
		// FROM `tbl_delivery_order` WHERE itemCode='zb000084' AND
		// cWhCode='JP61' AND DataStatus=0 ORDER BY businessDate DESC;

		// cWhCode cWhName
		// JP60 成品一库
		// JP61 成品二库
		// JP62 成品三库
		// JP63 成品四库
		// JP64 成品五库
		// JP65 成品七库
		// JP79 成品十库
		// JP83 劲牌成品八库
		// JP84 劲牌成品九库
		String queryOrderStr = "";
		String cWhCode = "JP63";
		String cWhName = "成品四库";
		String beforeSql = "SELECT relationID,orderNo,dealerCode,itemName,dealerName,itemCode,cWhCode,cWhName,businessDate,orderAmount,deliveredNum,DataStatus FROM `tbl_delivery_order` WHERE itemCode='";
		String endSql = "' AND cWhCode='" + cWhCode + "' AND DataStatus=0 ORDER BY businessDate DESC;\n";
		for (String p : allProducts) {
			queryOrderStr = queryOrderStr + beforeSql + p + endSql;
		}
		String beforeSql1 = "SELECT relationID,orderNo,dealerCode,dealerName,itemCode,itemName,cWhCode,cWhName,businessDate,orderAmount,deliveredNum,DataStatus FROM `tbl_delivery_order` WHERE ";
		String endSq2 = " AND cWhCode='" + cWhCode + "' AND DataStatus=0 ORDER BY businessDate DESC;\n";
		String queryOrderOrStr = "";

		String orStr = "";
		for (int i = 0; i < allProducts.size(); i++) {
			if (i == 0) {
				orStr = orStr + "(itemCode='" + allProducts.get(i) + "' OR ";
			} else if (i == allProducts.size() - 1) {
				orStr = orStr + "itemCode='" + allProducts.get(i) + "')";
			} else {
				orStr = orStr + "itemCode='" + allProducts.get(i) + "' OR ";
			}

		}
		String destDirName = "D:\\echo\\JinTestData\\queryOrderSql\\" + cWhName;
		String filePath = destDirName + "\\" + cWhName + "_" + cWhCode + "_single_query.txt";
		String filePath1 = destDirName + "\\" + cWhName + "_" + cWhCode + "_all_query.txt";

		System.out.println("filePath:" + filePath + " \nfilePath1:" + filePath1);
		try {
			// System.err.println(trays.size() + " trays:" + trays.toString());
			// System.out.println(" trayStr:" + trayStr.toString());
			operation.createDir(destDirName);
			operation.createFile(new File(filePath));
			// 写入

			operation.contentToTxt(filePath, queryOrderStr);
			operation.createFile(new File(filePath1));
			operation.contentToTxt(filePath1, beforeSql1 + orStr + endSq2);

			// List<String> l = operation.ps(new File(filePath)); //

		} catch (Exception e) { // TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	private static void queryAllProductInFile() {
		String productPath = "D:\\echo\\JinTestData\\product_repeat_info.txt";
		FileOperation operation = new FileOperation();
		List<String> allProducts = new ArrayList<>();
		try {

			allProducts = operation.readTextFile(new File(productPath));
			// System.out.println("list:" + list);

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		String pStr = "";
		List<String> pList = new ArrayList<>();
		for (String s : allProducts) {
			if (!pList.contains(s)) {
				pList.add(s);
				pStr = pStr + s + "\n";
			}
		}

		String destDirName = "D:\\echo\\JinTestData\\";
		String filePath = destDirName + "\\product_info.txt";

		try {
			// System.err.println(trays.size() + " trays:" + trays.toString());
			// System.out.println(" trayStr:" + trayStr.toString());
			operation.createDir(destDirName);
			operation.createFile(new File(filePath));
			// 写入

			operation.contentToTxt(filePath, pStr);
			// List<String> l = operation.ps(new File(filePath)); //

		} catch (Exception e) { // TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	private static void queryPrintContainer() {
		String containerPath = "D:\\echo\\JinTestData\\container_label.txt";
		FileOperation operation = new FileOperation();
		List<String> containerList = new ArrayList<>();
		try {
			containerList = operation.readTextFile(new File(containerPath));
			// System.out.println("list:" + list);

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String cs = "";
		for (int i = 0; i < containerList.size(); i++) {
			if (i < containerList.size() - 2) {
				cs = cs + containerList.get(i) + ",";
			} else {
				cs = cs + containerList.get(i);
			}
		}
		String beforeSql = "select * from `tbl_pro_301_17` where package_label_id in (";
		String endSQL = ");";
		System.out.println(beforeSql + cs + endSQL);

	}

	private static void queryPrintLabel() {
		String filePath = "D:\\echo\\JinTestData\\zsm_1509499528893_200.txt";
		FileOperation operation = new FileOperation();
		List<String> labelList = new ArrayList<>();
		List<String> containerList = new ArrayList<>();
		try {
			labelList = operation.readTextFile(new File(filePath));
			// System.out.println("list:" + list);

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		String s = "";
		for (int i = 0; i < 20; i++) {
			String labelStr = labelList.get(i);
			String label_22 = labelStr.replaceAll("http://zs.jingpai.com/", "").substring(0, 22);
			String label_18 = JinLabelUtil.getDB18Label(label_22);
			if (i < 20 - 1) {
				s = s + label_18 + ",";
			} else {
				s = s + label_18;
			}
		}

		String beforeSql = "select * from `tbl_pro_301_17` where package_label_id in (";
		String endSQL = ");";
		System.out.println(beforeSql + s + endSQL);
	}

	private static void insertPrintLabel() {
		String filePath = "D:\\echo\\JinTestData\\zsm_1509499528893_200.txt";
		String containerPath = "D:\\echo\\JinTestData\\container_label.txt";
		FileOperation operation = new FileOperation();
		List<String> labelList = new ArrayList<>();
		List<String> containerList = new ArrayList<>();
		try {
			labelList = operation.readTextFile(new File(filePath));
			containerList = operation.readTextFile(new File(containerPath));
			// System.out.println("list:" + list);

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		System.out.println(labelList.size() + "  list.size(): " + labelList.size() / 6);

		for (int i = 0; i < containerList.size(); i++) {
			String labelStr = labelList.get(i);
			String label_22 = labelStr.replaceAll("http://zs.jingpai.com/", "").substring(0, 22);
			String label_18 = JinLabelUtil.getDB18Label(label_22);
			String beforeSql = "INSERT INTO `tbl_pro_301_17` (label_id,package_label_id) VALUES(";
			String endSql = ");";
			System.out.println(beforeSql + label_18 + "," + containerList.get(i) + endSql);
		}

		/*
		 * for (String s : list) { String label_22 =
		 * s.replaceAll("http://zs.jingpai.com/", "").substring(0, 22); String
		 * label_18 = JinLabelUtil.getDB18Label(label_22); labels.add(label_18);
		 * String beforeSql =
		 * "INSERT INTO `tbl_index_17` (label_id,produce_index,YEAR) VALUES (";
		 * String endSql = ",301,2017);"; inserIndexSql = inserIndexSql +
		 * beforeSql + label_18 + endSql+"\n"; }
		 */

	}

	private static void insert85BoxLabel() {
		String filePath = "D:\\echo\\JinTestData\\container_label.txt";
		FileOperation operation = new FileOperation();
		List<String> list = new ArrayList<>();
		try {
			list = operation.readTextFile(new File(filePath));
			// System.out.println("list:" + list);

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		for (String s : list) {
			// 286785104400,'zb000084',666)
			String beforeSql = "INSERT INTO `tbl_pro_box_301_17` (package_label_id) VALUES(";
			String endSql = ");";
			System.out.println(beforeSql + s + endSql);
		}

		/*
		 * for (String s : list) { // 286785104400,'zb000084',666) String
		 * beforeSql =
		 * "UPDATE `tbl_pro_box_301_17` SET dealer_id='71404001' WHERE package_label_id="
		 * ; String endSql = ";"; System.out.println(beforeSql+s + endSql); }
		 */
		/*
		 * for (String s : list) { // 286785104400,'zb000084',666) String
		 * beforeSql =
		 * "UPDATE `tbl_pro_box_301_17` SET dealer_delivery_relationid = NULL,second_dealer_id = NULL WHERE package_label_id="
		 * ; String endSql = ";"; System.out.println(beforeSql+s + endSql); }
		 */

	}

	private static void insertLalelAndBox() {
		String filePath = "D:\\echo\\JinTestData\\zsm_1509499528893_200.txt";
		FileOperation operation = new FileOperation();
		List<String> list = new ArrayList<>();
		try {
			list = operation.readTextFile(new File(filePath));
			// System.out.println("list:" + list);

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		System.out.println(list.size() + "  list.size(): " + list.size() / 6);

		for (String s : list) {
			String label_22 = s.replaceAll("http://zs.jingpai.com/", "").substring(0, 22);
			String label_18 = JinLabelUtil.getDB18Label(label_22);
			labels.add(label_18);
			String beforeSql = "INSERT INTO `tbl_index_17` (label_id,produce_index,YEAR) VALUES (";
			String endSql = ",301,2017);";
			inserIndexSql = inserIndexSql + beforeSql + label_18 + endSql + "\n";
		}

		saveFile("insertIndexSql.txt", inserIndexSql);

		for (int i = 0; i < list.size() / 6; i++) {
			String box_id = JinLabelUtil.getBoxCode(_lineFlag);
			// JinLabelUtil.getBoxCode(i)
			// System.err.println(i + "：" + box_id);
			// System.err.println("box_id：" + box_id);
			boxs.add(box_id);
		}

		for (int i = 0; i < boxs.size(); i++) {
			LabelBoxBean lBean = new LabelBoxBean();
			lBean.setBox_id(boxs.get(i));
			List<String> ls = new ArrayList<>();
			String beforeBoxSql = "INSERT INTO `tbl_pro_box_301_17` (package_label_id,product_id,group_id) VALUES(";
			String endBoxSql = ",'zb000084',666);\n";
			// String insertBoxSql = beforeBoxSql+boxs.get(i)+endBoxSql;
			insertBoxSql = insertBoxSql + beforeBoxSql + boxs.get(i) + endBoxSql;
			for (int j = i * 6; j < (i * 6 + 6); j++) {
				ls.add(labels.get(j));
				String beforeProSql = "INSERT INTO `tbl_pro_301_17` (label_id,package_label_id) VALUES (";
				String endProSql = ");\n";
				// String insertProSql = beforeProSql + labels.get(j) + ","
				// +boxs.get(i)+endProSql;
				insertProSql = insertProSql + beforeProSql + labels.get(j) + "," + boxs.get(i) + endProSql;
				// System.err.println(i + " j:" + j);
			}
			lBean.setLabels(ls);
			boxBeans.add(lBean);
			// System.err.println(i*6 +" " + (i*6+6));
		}

		saveFile("inserProSql.txt", insertProSql);
		saveFile("insertBoxSql.txt", insertBoxSql);

	}

	private static void insert109Sql(List<String> list) {
		String saveStr = "";
		for (int i = 0; i < list.size(); i++) {
			String s = list.get(i);
			// String label_22 = s.replaceAll("http://zs.jingpai.com/",
			// "").substring(0, 22);
			// String label_18 = JinLabelUtil.getDB18Label(label_22);
			// String insertBefor = "INSERT INTO `tbl_pro_301_17` (label_id)
			// VALUES (" ;
			// String insertAfter = ");";
			// String sqlStr = insertBefor +label_18+insertAfter;
			// System.err.println(sqlStr);
			// saveStr = saveStr + sqlStr +"\n";

			String insertBefor = "INSERT INTO `tbl_pro_box_301_17` (package_label_id) VALUES (";
			String insertAfter = ");";
			String sqlStr = insertBefor + s + insertAfter;
			saveStr = saveStr + sqlStr + "\n";
		}

		saveFile(saveStr);

	}

	private static void saveFile(String fileName, String saveStr) {
		Date d = new Date();
		// DateFormat format = new SimpleDateFormat("yyyy-MM-dd HHmmss"); //
		DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		String s = format.format(d);

		FileOperation operation = new FileOperation();
		// String filePath = "D:\\echo\\JinTestData\\" + s + "\\trays.text";
		String destDirName = "D:\\echo\\JinTestData\\" + s;
		String filePath = destDirName + "\\" + fileName;

		try {
			// System.err.println(trays.size() + " trays:" + trays.toString());
			// System.out.println(" trayStr:" + trayStr.toString());
			// operation.createDir(destDirName);
			operation.createFile(new File(filePath));
			// 写入

			operation.contentToTxt(filePath, saveStr);
			// List<String> l = operation.readTextFile(new File(filePath)); //

		} catch (Exception e) { // TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	private static void saveFile(String saveStr) {
		Date d = new Date();
		// DateFormat format = new SimpleDateFormat("yyyy-MM-dd HHmmss"); //
		DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		String s = format.format(d);

		FileOperation operation = new FileOperation();
		// String filePath = "D:\\echo\\JinTestData\\" + s + "\\trays.text";
		String destDirName = "D:\\echo\\JinTestData\\" + s;
		String filePath = destDirName + "\\insertBoxLabelSql.text";

		try {
			// System.err.println(trays.size() + " trays:" + trays.toString());
			// System.out.println(" trayStr:" + trayStr.toString());
			operation.createDir(destDirName);
			operation.createFile(new File(filePath));
			// 写入

			operation.contentToTxt(filePath, saveStr);
			// List<String> l = operation.readTextFile(new File(filePath)); //

		} catch (Exception e) { // TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}
