Browse Source

优化。

lym 3 years ago
parent
commit
97d0330925
1 changed files with 19 additions and 17 deletions
  1. 19 17
      src/main/java/com/hywa/banktest/bankframework/utils/TransUtils.java

+ 19 - 17
src/main/java/com/hywa/banktest/bankframework/utils/TransUtils.java

@@ -60,24 +60,26 @@ public class TransUtils {
 		String text = readToLineFile(new File(target), "GBK");
 		String lineText = desBase64(text);
 		String[] lines = lineText.split("\n");
-		for (int i = 1; i < lines.length; i++) {
-			String[] words = lines[i].split("\\|");
-			TransVo transVo1 = new TransVo();
-			transVo1.setNum(Integer.valueOf(words[0]));
-			transVo1.setFarmerName(words[1]);
-			transVo1.setFarmerAccount(words[2]);
-			transVo1.setCardType(words[3]);
-			transVo1.setFarmerPid(words[4]);
-			transVo1.setMoney(words[5]);
-			transVo1.setCustomerNum(words[6]);
-			transVo1.setOrderNo(words[7]);
-			if (words.length >= 10) {
-				transVo1.setBankDealState(words[8]);
-				transVo1.setBankDealMsg(words[9]);
+		if (lines != null && lines.length > 1) {
+			for (int i = 1; i < lines.length; i++) {
+				String[] words = lines[i].split("\\|");
+				TransVo transVo1 = new TransVo();
+				transVo1.setNum(Integer.valueOf(words[0]));
+				transVo1.setFarmerName(words[1]);
+				transVo1.setFarmerAccount(words[2]);
+				transVo1.setCardType(words[3]);
+				transVo1.setFarmerPid(words[4]);
+				transVo1.setMoney(words[5]);
+				transVo1.setCustomerNum(words[6]);
+				transVo1.setOrderNo(words[7]);
+				if (words.length >= 10) {
+					transVo1.setBankDealState(words[8]);
+					transVo1.setBankDealMsg(words[9]);
+				}
+				transVo1.setBankReceiptFile(fileName);
+				transVo1.setId(words[7]);
+				transVos.add(transVo1);
 			}
-			transVo1.setBankReceiptFile(fileName);
-			transVo1.setId(words[7]);
-			transVos.add(transVo1);
 		}
 		return transVos;
 	}