失败重试

master
lzq 2025-11-25 16:02:00 +08:00
parent 572ba946fd
commit 911fead99b
3 changed files with 18 additions and 5 deletions

View File

@ -24,7 +24,7 @@ public class Hsoa {
private static String refTnt = ""; private static String refTnt = "";
private static String tnt = ""; private static String tnt = "";
private static long lastLoginTime = 0; private static long lastLoginTime = 0;
private static final AppProperties appProperties; private static AppProperties appProperties;
static { static {
HttpClientDecorator httpClientDecorator = SpringUtil.getBean(HttpClientDecorator.class); HttpClientDecorator httpClientDecorator = SpringUtil.getBean(HttpClientDecorator.class);
@ -91,4 +91,16 @@ public class Hsoa {
wlock.unlock(); wlock.unlock();
} }
} }
public static void relogin() {
try {
wlock.lock();
log.info("重置登录TOKEN");
refTnt = "";
tnt = "";
login();
} finally {
wlock.unlock();
}
}
} }

View File

@ -15,5 +15,5 @@ public class HsoaProperties {
private String baseUrl; private String baseUrl;
private String username; private String username;
private String password; private String password;
private int expire = 3 * 24 * 3600; private int expire = 3 * 3600;
} }

View File

@ -1718,7 +1718,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
truckLocationTrackService.save(entity); truckLocationTrackService.save(entity);
try { try {
String transCompanyName = orderDetail.getTransCompanyName(); String transCompanyName = orderDetail.getTransCompanyName();
HsoaResult<?> result = Hsoa.pushVehicleTrajectory(new PushVehicleTrajectoryParam() PushVehicleTrajectoryParam param = new PushVehicleTrajectoryParam()
.setCompanyName(transCompanyName) .setCompanyName(transCompanyName)
.setTransportLicense(orderDetail.getCertificateSn()) .setTransportLicense(orderDetail.getCertificateSn())
.setPlateNumber(licensePlate) .setPlateNumber(licensePlate)
@ -1734,9 +1734,10 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
.setLiftStatus("0") .setLiftStatus("0")
.setAccStatus(1) .setAccStatus(1)
.setGpsTime(time) .setGpsTime(time)
.setLocationMode("WGS84") .setLocationMode("WGS84");
); HsoaResult<?> result = Hsoa.pushVehicleTrajectory(param);
if (result == null || !result.isSuccess()) { if (result == null || !result.isSuccess()) {
Hsoa.relogin();
log.error("推送定位数据失败数据Id{}", entity.getId()); log.error("推送定位数据失败数据Id{}", entity.getId());
} }
} catch (Exception e) { } catch (Exception e) {