⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datald.java

📁 基于Java的地图数据管理软件。使用MySQL数据库管理系统。
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		double xianCount = 0.0;
		double xiangCount = 0.0;
		double cunCount = 0.0;
		int n = 0;
		int lineInt = 0;
		System.out.println("正在比较数据,请稍后...");
		for (int i = 1; list2 != null && i < list2.length; i++) {
			newLineStr = list2[i];
			// if (newLineStr.substring(0,1).equals("C")) continue;
			newLine = newLineStr.split("\t");
			newRoadNumber = newLine[0];
			newRoadName = newLine[1];
			n = 0;
			for (int j = 1; list1 != null && j < list1.length; j++) {
				oldLineStr = list1[j];
				oldLine = oldLineStr.split("\t");
				oldRoadNumber = oldLine[0];
				oldRoadName = oldLine[1];
				if (oldRoadNumber.equals(newRoadNumber)) {
					n++;
					break;
				}

			}
			if (n == 0) {
				lineInt++;
				roadMile = cc.getRoadMileCD(newLdArray, newRoadNumber);
				if (newRoadNumber.substring(0, 1).equals("C"))
					xianCount += roadMile[0];
				if (newRoadNumber.substring(0, 1).equals("X"))
					xiangCount += roadMile[0];
				if (newRoadNumber.substring(0, 1).equals("Y"))
					cunCount += roadMile[0];

				System.out
						.println("新增加路线:  " + newLine[0] + "   " + newLine[1]);
				tempStr = newLine[0] + "\t" + newLine[1] + "\t" + roadMile[0]
						+ "\t" + roadMile[1] + "\t" + roadMile[2];
				myFile.write(tempStr + "\r\n");

			}

		}
		sumCount = xianCount + xiangCount + cunCount;
		tempStr = "合计:" + sumCount + "\t" + xianCount + "\t" + xiangCount
				+ "\t" + cunCount;
		myFile.write(tempStr + "\r\n");
		myFile.close();
		return tempList;

	}

	// 新删除的路线(处理县乡道)
	public List getDelLX() throws IOException {
		// List list1 = new ArrayList();
		// List list2 = new ArrayList();
		List tempList = new ArrayList();
		FileOperate fo = new FileOperate();
		String outPutFile = "E:\\报部接口文件\\" + this.cityName + "\\已删除的路线一览表.txt";
		File newFile = fo.createFolder(outPutFile);
		FileWriter resultFile = new FileWriter(newFile);
		PrintWriter myFile = new PrintWriter(resultFile);
		CommClass cc = new CommClass();
		// String [] oldLdList = cc.getNewLd(this.oldFilePath);
		String[] list2 = cc.getRoadArray(this.oldFilePath);
		String[] list1 = cc.getRoadArray(this.newFilePath);
		String tempStr = "";
		String oldLineStr = "";
		String newLineStr = "";
		String oldRoadNumber = "";
		String newRoadNumber = "";
		String newRoadName = "";
		String oldRoadName = "";
		String[] oldLine = null;
		String[] newLine = null;
		double sumCount = 0.0;
		double xianCount = 0.0;
		double xiangCount = 0.0;
		double cunCount = 0.0;
		int n = 0;
		int lineInt = 0;
		System.out.println("正在比较数据,请稍后...");
		for (int i = 1; list2 != null && i < list2.length; i++) {
			newLineStr = list2[i];
			// if (newLineStr.substring(0,1).equals("C")) continue;
			newLine = newLineStr.split("\t");
			newRoadNumber = newLine[0];
			newRoadName = newLine[1];
			n = 0;
			for (int j = 1; list1 != null && j < list1.length; j++) {
				oldLineStr = list1[j];
				oldLine = oldLineStr.split("\t");
				oldRoadNumber = oldLine[0];
				oldRoadName = oldLine[1];
				if (oldRoadNumber.equals(newRoadNumber)) {
					n++;
					break;
				}

			}
			if (n == 0) {
				lineInt++;
				System.out
						.println("已删除路线:  " + newLine[0] + "   " + newLine[1]);
				double[] roadMile = cc.getRoadMileCD(oldLdArray, newRoadNumber);
				if (newRoadNumber.substring(0, 1).equals("C"))
					xianCount += roadMile[0];
				if (newRoadNumber.substring(0, 1).equals("X"))
					xiangCount += roadMile[0];
				if (newRoadNumber.substring(0, 1).equals("Y"))
					cunCount += roadMile[0];

				tempStr = newLine[0] + "\t" + newLine[1] + "\t" + roadMile[0]
						+ "\t" + roadMile[1] + "\t" + roadMile[2];
				myFile.write(tempStr + "\r\n");

			}

		}

		sumCount = xianCount + xiangCount + cunCount;
		tempStr = "合计:" + sumCount + "\t" + xianCount + "\t" + xiangCount
				+ "\t" + cunCount;
		myFile.write(tempStr + "\r\n");
		myFile.close();
		return tempList;

	}

	// 有更改的路线(处理县乡道)
	public List getAlterLX() throws IOException {
		// List list1 = new ArrayList();
		// List list2 = new ArrayList();
		List tempList = new ArrayList();
		FileOperate fo = new FileOperate();
		String outPutFile = "E:\\报部接口文件\\" + this.cityName + "\\已更改的路线一览表.txt";
		File newFile = fo.createFolder(outPutFile);
		FileWriter resultFile = new FileWriter(newFile);
		PrintWriter myFile = new PrintWriter(resultFile);
		CommClass cc = new CommClass();
		// String [] oldLdList = cc.getNewLd(this.oldFilePath);
		// String [] newLdList = cc.getNewLd(this.newFilePath);
		String[] list1 = cc.getRoadArray(this.oldFilePath);
		String[] list2 = cc.getRoadArray(this.newFilePath);
		String tempStr = "";
		String oldLineStr = "";
		String newLineStr = "";
		String oldRoadNumber = "";
		String newRoadNumber = "";
		String newRoadName = "";
		String oldRoadName = "";
		String newQiDianJD = "";
		String oldQiDianJD = "";
		String[] oldLine = null;
		String[] newLine = null;
		double chongFuCount = 0.0;
		double duanTouCount = 0.0;
		double[] oldRoadMile = null;
		double[] newRoadMile = null;
		int n = 0;
		int lineInt = 0;
		System.out.println("正在比较数据,请稍后...");
		for (int i = 1; list2 != null && i < list2.length; i++) {
			newLineStr = list2[i];
			// if (!newLineStr.substring(0,1).equals("C")) continue;
			newLine = newLineStr.split("\t");
			newRoadName = newLine[1];
			newQiDianJD = newLine[3];
			newRoadNumber = newLine[0];
			n = 0;
			for (int j = 1; list1 != null && j < list1.length; j++) {
				oldLineStr = list1[j];
				// if (!oldLineStr.substring(0,1).equals("C")) continue;
				oldLine = oldLineStr.split("\t");
				oldRoadNumber = oldLine[0];
				oldRoadName = oldLine[1];
				oldQiDianJD = oldLine[3];
				if (oldRoadNumber.equals(newRoadNumber)) {
					n++;
					break;
				}

			}
			if (n != 0) {

				oldRoadMile = cc.getRoadMileCD(oldLdArray, oldLine[0]);
				newRoadMile = cc.getRoadMileCD(newLdArray, newRoadNumber);
				if (oldRoadMile[0] != newRoadMile[0]
						|| !newRoadName.equals(oldRoadName)) {
					System.out.println("已更改路线:  " + newLine[0] + "   "
							+ newLine[1]);
					chongFuCount = newRoadMile[1];
					duanTouCount = newRoadMile[2];
					tempStr = oldLine[0] + "\t" + oldLine[1] + "\t"
							+ ItemValue.getRound(oldRoadMile[0], 3) + "\t"
							+ newLine[0] + "\t" + newLine[1] + "\t"
							+ ItemValue.getRound(newRoadMile[0], 3) + "\t"
							+ ItemValue.getRound(chongFuCount, 3) + "\t"
							+ ItemValue.getRound(duanTouCount, 3);
					myFile.write(tempStr + "\r\n");
				}

			}

		}
		myFile.close();
		return tempList;

	}

	// 与上次报部匹配不上的路段
	public List getNotFindLD() throws IOException {
		List tempList = new ArrayList();
		FileOperate fo = new FileOperate();
		String outPutFile = "E:\\报部接口文件\\" + this.cityName + "\\匹配不上的路段一览表.txt";
		File newFile = fo.createFolder(outPutFile);
		FileWriter resultFile = new FileWriter(newFile);
		PrintWriter myFile = new PrintWriter(resultFile);
		CommClass cc = new CommClass();
		String[] list2 = cc.getCFWArray(this.newFilePath + "\\Ld_超范围明细.txt");
		String[] list1 = cc.getNewLd(this.oldFilePath);

		String oldLineStr = "";
		String newLineStr = "";
		String oldQiDianName = "";
		String oldZhiDianName = "";
		String oldLiCheng = "";
		String newQiDianName = "";
		String newZhiDianName = "";
		String newLiCheng = "";
		String[] oldLine = null;
		String[] newLine = null;
		String tempStr = "";
		int n = 0;
		int lineInt = 0;
		System.out.println("正在比较数据,请稍后...");
		for (int i = 0; list2 != null && i < list2.length; i++) {
			newLineStr = list2[i];
			newLine = newLineStr.split("\t");
			oldQiDianName = newLine[5];
			oldZhiDianName = newLine[11];
			oldLiCheng = newLine[19];
			n = 0;
			for (int j = 0; list1 != null && j < list1.length; j++) {

				oldLineStr = list1[j];
				oldLine = oldLineStr.split("\t");
				newQiDianName = oldLine[5];
				newZhiDianName = oldLine[11];
				newLiCheng = oldLine[19];

				if ((oldQiDianName.equals(newQiDianName)
						&& oldZhiDianName.equals(newZhiDianName) && oldLiCheng
						.equals(newLiCheng))
						|| ((oldQiDianName.equals(newQiDianName) && oldZhiDianName
								.equals(newZhiDianName)) || oldLiCheng
								.equals(newLiCheng))
						|| (oldQiDianName.equals(newQiDianName)
								|| oldZhiDianName.equals(newZhiDianName) || oldLiCheng
								.equals(newLiCheng))) {
					n++;

					break;
				}

			}

			if (n == 0) {
				lineInt++;
				System.out.println("匹配不上的路段:  " + newLine[0] + "   "
						+ newLine[1]);
				myFile.write(newLineStr + "\r\n");

			}

		}
		myFile.close();
		return tempList;

	}

	// 超范围删除的路段
	public List getDelLuDuan() throws IOException {
		List tempList = new ArrayList();
		FileOperate fo = new FileOperate();
		String outPutFile = "E:\\报部接口文件\\" + this.cityName + "\\超范围删除路段一览表.txt";
		File newFile = fo.createFolder(outPutFile);
		FileWriter resultFile = new FileWriter(newFile);
		PrintWriter myFile = new PrintWriter(resultFile);
		CommClass cc = new CommClass();
		String[] list2 = cc.getCFWArray(this.newFilePath + "\\Ld_超范围明细.txt");
		String[] list1 = cc.getNewLd(this.oldFilePath);

		String oldLineStr = "";
		String newLineStr = "";
		String oldQiDianName = "";
		String oldZhiDianName = "";
		String oldLiCheng = "";
		String newQiDianName = "";
		String newZhiDianName = "";
		String newLiCheng = "";
		String[] oldLine = null;
		String[] newLine = null;
		String tempStr = "";
		int n = 0;
		int lineInt = 0;
		System.out.println("正在比较数据,请稍后...");
		for (int i = 0; list2 != null && i < list2.length; i++) {
			newLineStr = list2[i];
			if (!newLineStr.substring(0, 1).equals("C"))
				continue;
			newLine = newLineStr.split("\t");
			newQiDianName = newLine[7];
			newZhiDianName = newLine[13];
			newLiCheng = newLine[19];
			n = 0;
			for (int j = 0; list1 != null && j < list1.length; j++) {

				oldLineStr = list1[j];
				oldLine = oldLineStr.split("\t");
				oldQiDianName = oldLine[7];
				oldZhiDianName = oldLine[13];
				oldLiCheng = oldLine[19];

				if ((oldQiDianName.equals(newQiDianName)
						&& oldZhiDianName.equals(newZhiDianName) && oldLiCheng
						.equals(newLiCheng))
						|| ((oldQiDianName.equals(newQiDianName) && oldZhiDianName
								.equals(newZhiDianName)) || oldLiCheng
								.equals(newLiCheng))
						|| (oldQiDianName.equals(newQiDianName)
								|| oldZhiDianName.equals(newZhiDianName) || oldLiCheng
								.equals(newLiCheng))) {
					n++;

					break;
				}

			}

			if (n != 0) {
				lineInt++;
				tempStr = newLine[1] + "\t" + newLine[2] + "\t" + newLine[0]
						+ "\t\t\t" + newLine[19];
				System.out.println("超范围删除的路段:  " + newLine[0] + "   "
						+ newLine[1]);
				myFile.write(tempStr + "\r\n");

			}

		}
		myFile.close();
		return tempList;

	}

	// 有更改的路段
	public List getAlterLuDuan() throws IOException {
		List tempList = new ArrayList();
		FileOperate fo = new FileOperate();
		String outPutFile = "E:\\报部接口文件\\" + this.cityName + "\\有更改路段一览表.txt";
		File newFile = fo.createFolder(outPutFile);
		FileWriter resultFile = new FileWriter(newFile);
		PrintWriter myFile = new PrintWriter(resultFile);
		CommClass cc = new CommClass();
		String[] list2 = cc.getNewLd(this.newFilePath);
		String[] list1 = cc.getOldLd(this.oldFilePath);

		String oldLineStr = "";
		String newLineStr = "";
		String oldQiDianName = "";
		String oldZhiDianName = "";
		String oldLiCheng = "";
		String newQiDianName = "";
		String newZhiDianName = "";
		String newLiCheng = "";
		String[] oldLine = null;
		String[] newLine = null;
		String tempStr = "";
		int n = 0;
		int lineInt = 0;
		System.out.println("正在比较数据,请稍后...");
		for (int i = 1; list2 != null && i < list2.length; i++) {
			newLineStr = list2[i];
			// if (!newLineStr.substring(0,1).equals("C")) continue;
			newLine = newLineStr.split("\t");
			newQiDianName = newLine[7];
			newZhiDianName = newLine[13];
			newLiCheng = newLine[19];
			n = 0;
			for (int j = 1; list1 != null && j < list1.length; j++) {

				oldLineStr = list1[j];
				// if (!oldLineStr.substring(0,1).equals("C")) continue;
				oldLine = oldLineStr.split("\t");
				oldQiDianName = oldLine[7];
				oldZhiDianName = oldLine[13];
				oldLiCheng = oldLine[19];

				if ((oldQiDianName.equals(newQiDianName)
						&& oldZhiDianName.equals(newZhiDianName) && oldLiCheng
						.equals(newLiCheng))
						|| ((oldQiDianName.equals(newQiDianName) && oldZhiDianName
								.equals(newZhiDianName)) || oldLiCheng
								.equals(newLiCheng))
						|| (oldQiDianName.equals(newQiDianName)
								|| oldLiCheng.equals(newLiCheng) || oldZhiDianName
								.equals(newZhiDianName))) {
					n++;

					break;
				}

			}
			if (n != 0) {
				lineInt++;
				tempStr = oldLine[1] + "\t" + oldLine[2] + "\t" + oldLine[0]
						+ "\t" + newLine[1] + "\t" + newLine[2] + "\t"
						+ newLine[0] + "\t" + newLine[19];
				System.out
						.println("有更改路段:  " + newLine[0] + "   " + newLine[1]);
				myFile.write(tempStr + "\r\n");

			}

		}
		myFile.close();
		return tempList;

	}

	public static void main(String[] args) throws IOException {
		DataLd dvt = new DataLd();
		dvt.printAll();

	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -