|
@@ -32,6 +32,7 @@ import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
|
|
+import java.util.Comparator;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
import java.util.Set;
|
|
@@ -301,8 +302,17 @@ public class GeminiServiceImpl implements GeminiService {
|
|
|
&& carPageResponse.getData().getList() != null) {
|
|
&& carPageResponse.getData().getList() != null) {
|
|
|
|
|
|
|
|
for (GeminiCarAccount account : carPageResponse.getData().getList()) {
|
|
for (GeminiCarAccount account : carPageResponse.getData().getList()) {
|
|
|
- GeminiCarInfoView carInfo = new GeminiCarInfoView();
|
|
|
|
|
- carInfo.setCarId(account.getCarID());
|
|
|
|
|
|
|
+ // 停运的账号不返回
|
|
|
|
|
+ if (account.getStatus() == null || !account.getStatus()) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 调用status接口获取详细信息(分数等)
|
|
|
|
|
+ GeminiCarInfoView carInfo = getCarInfo(domain, account.getCarID());
|
|
|
|
|
+ // status接口返回停运的也过滤掉
|
|
|
|
|
+ if ("停运".equals(carInfo.getStatus())) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
carInfo.setCarName(account.getNickName());
|
|
carInfo.setCarName(account.getNickName());
|
|
|
|
|
|
|
|
// 根据carType设置isPlus: Ultra=3, Pro=2, Free=1
|
|
// 根据carType设置isPlus: Ultra=3, Pro=2, Free=1
|
|
@@ -314,28 +324,15 @@ public class GeminiServiceImpl implements GeminiService {
|
|
|
carInfo.setIsPlus(1);
|
|
carInfo.setIsPlus(1);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 根据status设置状态
|
|
|
|
|
- if (account.getStatus() != null && account.getStatus()) {
|
|
|
|
|
- carInfo.setAccountReady(true);
|
|
|
|
|
- carInfo.setStatus("空闲");
|
|
|
|
|
- } else {
|
|
|
|
|
- carInfo.setAccountReady(false);
|
|
|
|
|
- carInfo.setStatus("停运");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
carInfoList.add(carInfo);
|
|
carInfoList.add(carInfo);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- int total = 0;
|
|
|
|
|
- if (carPageResponse.getData() != null
|
|
|
|
|
- && carPageResponse.getData().getPagination() != null
|
|
|
|
|
- && carPageResponse.getData().getPagination().getTotal() != null) {
|
|
|
|
|
- total = carPageResponse.getData().getPagination().getTotal();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 按score从低到高排序
|
|
|
|
|
+ carInfoList.sort(Comparator.comparingDouble(c -> c.getScore() != null ? c.getScore() : 0.0));
|
|
|
|
|
|
|
|
SearchResult<GeminiCarInfoView> result = new SearchResult<>(carInfoList);
|
|
SearchResult<GeminiCarInfoView> result = new SearchResult<>(carInfoList);
|
|
|
- result.setTotalCount(total);
|
|
|
|
|
|
|
+ result.setTotalCount(carInfoList.size());
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -363,7 +360,7 @@ public class GeminiServiceImpl implements GeminiService {
|
|
|
carInfo.setStatus("停运");
|
|
carInfo.setStatus("停运");
|
|
|
carInfo.setExpTime(new DateTime(System.currentTimeMillis() + carInfo.getClearsIn() * 1000));
|
|
carInfo.setExpTime(new DateTime(System.currentTimeMillis() + carInfo.getClearsIn() * 1000));
|
|
|
} else {
|
|
} else {
|
|
|
- carInfo.setScore(statusResponse.getCount() != null ? statusResponse.getCount().doubleValue() : 0.0);
|
|
|
|
|
|
|
+ carInfo.setScore(statusResponse.getScore());
|
|
|
carInfo.setStatus(carInfo.getScore() > 50 ? "繁忙" : "空闲");
|
|
carInfo.setStatus(carInfo.getScore() > 50 ? "繁忙" : "空闲");
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|