修改bug
This commit is contained in:
@@ -216,8 +216,8 @@ public class SfRouteQueryUtil {
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
String mailNo = "SF0282456509537";
|
||||
String result = queryRoute(mailNo,"18012017423");
|
||||
String mailNo = "SF3191365477469";
|
||||
String result = queryRoute(mailNo,"15075462410");
|
||||
System.out.println(result);
|
||||
OaExpressVo oaExpress = parseData(result);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.net.URLEncoder;
|
||||
@@ -106,9 +107,21 @@ public class StoRouteQueryUtil {
|
||||
JSONObject last = arr.getJSONObject(arr.size() - 1);
|
||||
OaExpressVo vo = new OaExpressVo();
|
||||
vo.setExpressCode(last.getString("waybillNo"));
|
||||
vo.setLastUpdateTime(last.getDate("opTime"));
|
||||
vo.setLastStatus(last.getString("scanType"));
|
||||
vo.setRemark(last.getString("memo"));
|
||||
// 设置时间
|
||||
String opTime = last.getString("opTime");
|
||||
if (opTime != null) {
|
||||
try {
|
||||
// 解析时间格式 "2025-07-27 13:01:00"
|
||||
java.text.SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
vo.setAcceptTime(sdf.parse(opTime));
|
||||
} catch (Exception e) {
|
||||
vo.setAcceptTime(null);
|
||||
}
|
||||
}
|
||||
// 设置状态 - 使用scanType作为状态
|
||||
vo.setFirstStatusName(last.getString("memo"));
|
||||
// 设置备注 - 使用memo作为备注
|
||||
vo.setRemark(last.getString("scanType"));
|
||||
return vo;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -120,7 +133,7 @@ public class StoRouteQueryUtil {
|
||||
// main方法测试
|
||||
public static void main(String[] args) {
|
||||
List<String> waybillNos = new ArrayList<>();
|
||||
waybillNos.add("777325378857266"); // 测试单号
|
||||
waybillNos.add("777326763655544"); // 测试单号
|
||||
String result = queryRoute(waybillNos);
|
||||
System.out.println("申通原始返回:" + result);
|
||||
OaExpressVo vo = parseData(result);
|
||||
|
||||
@@ -114,8 +114,8 @@ public class ZtoTrackQueryUtil {
|
||||
// main方法测试
|
||||
public static void main(String[] args) throws IOException {
|
||||
System.out.println("本机公网IP为: " + getPublicIp());
|
||||
String billCode = "78921681808881";
|
||||
OaExpressVo result = queryTrack(billCode,"9553");
|
||||
String billCode = "78925013374727";
|
||||
OaExpressVo result = queryTrack(billCode,"2410");
|
||||
|
||||
System.out.println(result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user