|
@@ -151,8 +151,7 @@ public class GeminiServiceImpl implements GeminiService {
|
|
|
log.info("domain:{},用户:{},所在车次:{},座位id:{},在{}获取跳转Gemini镜像的登录url",
|
|
log.info("domain:{},用户:{},所在车次:{},座位id:{},在{}获取跳转Gemini镜像的登录url",
|
|
|
DOMAIN, userId, groupsTrips.getId(), relationId, DateTime.now());
|
|
DOMAIN, userId, groupsTrips.getId(), relationId, DateTime.now());
|
|
|
|
|
|
|
|
- // /auth/logintoken?access_token={token}&account={carId}
|
|
|
|
|
- return DOMAIN + "/auth/logintoken?access_token=" + geminiUser.getUserToken() + "&account=" + carId;
|
|
|
|
|
|
|
+ return DOMAIN + "/logintoken?access_token=" + geminiUser.getUserToken() + "&account=" + carId;
|
|
|
} else {
|
|
} else {
|
|
|
throw BusinessRuntimeException.getInstance("服务器出了点问题");
|
|
throw BusinessRuntimeException.getInstance("服务器出了点问题");
|
|
|
}
|
|
}
|
|
@@ -196,6 +195,9 @@ public class GeminiServiceImpl implements GeminiService {
|
|
|
requestBody.put("size", size);
|
|
requestBody.put("size", size);
|
|
|
|
|
|
|
|
String res = HttpUtil.post(DOMAIN + "/carpage", requestBody.toString());
|
|
String res = HttpUtil.post(DOMAIN + "/carpage", requestBody.toString());
|
|
|
|
|
+ if (!JSONUtil.isJson(res)) {
|
|
|
|
|
+ res = res.substring(2);
|
|
|
|
|
+ }
|
|
|
return JSONUtil.toBean(res, GeminiCarPageResponse.class);
|
|
return JSONUtil.toBean(res, GeminiCarPageResponse.class);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.error("调用Gemini /carpage 接口失败: {}", StringUtil.getErrorText(e));
|
|
log.error("调用Gemini /carpage 接口失败: {}", StringUtil.getErrorText(e));
|
|
@@ -294,48 +296,31 @@ public class GeminiServiceImpl implements GeminiService {
|
|
|
|
|
|
|
|
List<GeminiCarInfoView> carInfoList = new ArrayList<>();
|
|
List<GeminiCarInfoView> carInfoList = new ArrayList<>();
|
|
|
|
|
|
|
|
- if (carPageResponse.getCode() != null && carPageResponse.getCode() == 0
|
|
|
|
|
|
|
+ if (carPageResponse.getCode() != null && carPageResponse.getCode() == 1000
|
|
|
&& carPageResponse.getData() != null
|
|
&& carPageResponse.getData() != null
|
|
|
- && carPageResponse.getData().getAccounts() != null) {
|
|
|
|
|
|
|
+ && carPageResponse.getData().getList() != null) {
|
|
|
|
|
|
|
|
- for (GeminiCarAccount account : carPageResponse.getData().getAccounts()) {
|
|
|
|
|
|
|
+ for (GeminiCarAccount account : carPageResponse.getData().getList()) {
|
|
|
GeminiCarInfoView carInfo = new GeminiCarInfoView();
|
|
GeminiCarInfoView carInfo = new GeminiCarInfoView();
|
|
|
- carInfo.setCarId(account.getName());
|
|
|
|
|
- carInfo.setCarName(account.getNickname());
|
|
|
|
|
|
|
+ carInfo.setCarId(account.getCarID());
|
|
|
|
|
+ carInfo.setCarName(account.getNickName());
|
|
|
|
|
|
|
|
- // 根据type设置isPlus: ultra=3, pro=2, free=1
|
|
|
|
|
- if ("ultra".equalsIgnoreCase(account.getType())) {
|
|
|
|
|
|
|
+ // 根据carType设置isPlus: Ultra=3, Pro=2, Free=1
|
|
|
|
|
+ if ("Ultra".equalsIgnoreCase(account.getCarType())) {
|
|
|
carInfo.setIsPlus(3);
|
|
carInfo.setIsPlus(3);
|
|
|
- } else if ("pro".equalsIgnoreCase(account.getType())) {
|
|
|
|
|
|
|
+ } else if ("Pro".equalsIgnoreCase(account.getCarType())) {
|
|
|
carInfo.setIsPlus(2);
|
|
carInfo.setIsPlus(2);
|
|
|
} else {
|
|
} else {
|
|
|
carInfo.setIsPlus(1);
|
|
carInfo.setIsPlus(1);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 获取状态信息
|
|
|
|
|
- if (account.getDisabled() != null && account.getDisabled()) {
|
|
|
|
|
- carInfo.setStatus("停运");
|
|
|
|
|
- carInfo.setAccountReady(false);
|
|
|
|
|
|
|
+ // 根据status设置状态
|
|
|
|
|
+ if (account.getStatus() != null && account.getStatus()) {
|
|
|
|
|
+ carInfo.setAccountReady(true);
|
|
|
|
|
+ carInfo.setStatus("空闲");
|
|
|
} else {
|
|
} else {
|
|
|
- // 调用 /status 接口获取详细状态
|
|
|
|
|
- GeminiCarStatusResponse statusResponse = getCarStatus(domain, account.getName());
|
|
|
|
|
- if (statusResponse.getAccountReady() != null && statusResponse.getAccountReady()) {
|
|
|
|
|
- carInfo.setAccountReady(true);
|
|
|
|
|
- carInfo.setClearsIn(statusResponse.getClearsIn() != null ? statusResponse.getClearsIn().longValue() : 0L);
|
|
|
|
|
- carInfo.setUse(statusResponse.getCount());
|
|
|
|
|
-
|
|
|
|
|
- if (carInfo.getClearsIn() > 0) {
|
|
|
|
|
- carInfo.setStatus("停运");
|
|
|
|
|
- carInfo.setExpTime(new DateTime(System.currentTimeMillis() + carInfo.getClearsIn() * 1000));
|
|
|
|
|
- } else {
|
|
|
|
|
- // 根据使用次数判断繁忙程度
|
|
|
|
|
- carInfo.setScore(statusResponse.getCount() != null ? statusResponse.getCount().doubleValue() : 0.0);
|
|
|
|
|
- carInfo.setStatus(carInfo.getScore() > 50 ? "繁忙" : "空闲");
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- carInfo.setAccountReady(false);
|
|
|
|
|
- carInfo.setStatus("停运");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ carInfo.setAccountReady(false);
|
|
|
|
|
+ carInfo.setStatus("停运");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
carInfoList.add(carInfo);
|
|
carInfoList.add(carInfo);
|
|
@@ -343,8 +328,10 @@ public class GeminiServiceImpl implements GeminiService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
int total = 0;
|
|
int total = 0;
|
|
|
- if (carPageResponse.getData() != null && carPageResponse.getData().getTotal() != null) {
|
|
|
|
|
- total = carPageResponse.getData().getTotal();
|
|
|
|
|
|
|
+ if (carPageResponse.getData() != null
|
|
|
|
|
+ && carPageResponse.getData().getPagination() != null
|
|
|
|
|
+ && carPageResponse.getData().getPagination().getTotal() != null) {
|
|
|
|
|
+ total = carPageResponse.getData().getPagination().getTotal();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
SearchResult<GeminiCarInfoView> result = new SearchResult<>(carInfoList);
|
|
SearchResult<GeminiCarInfoView> result = new SearchResult<>(carInfoList);
|