2 Commits b8b38a18d1 ... 97d0330925

Author SHA1 Message Date
  lym 97d0330925 优化。 3 years ago
  lym fd6ff9c22f 优化:jar包升级。 3 years ago
2 changed files with 20 additions and 18 deletions
  1. 1 1
      pom.xml
  2. 19 17
      src/main/java/com/hywa/banktest/bankframework/utils/TransUtils.java

+ 1 - 1
pom.xml

@@ -79,7 +79,7 @@
 		<dependency>
 			<groupId>com.alibaba</groupId>
 			<artifactId>fastjson</artifactId>
-			<version>1.2.41</version>
+			<version>1.2.76</version>
 		</dependency>
 		<dependency>
 			<groupId>org.projectlombok</groupId>

+ 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;
 	}