fix: try-catch the field is null exception
This commit is contained in:
@@ -24,7 +24,7 @@ public class StartupCompareRunner implements ApplicationRunner {
|
||||
// compareService.compare(5, "vehicle");
|
||||
// compareService.compare(5, "device");
|
||||
// compareService.compare(5, "business");
|
||||
compareService.compare(5, "driver");
|
||||
// compareService.compare(5, "driver");
|
||||
// compareService.compare(5, "vehicle_device");
|
||||
// compareService.compare(5, "driver_vehicle");
|
||||
// compareService.compare(5, "business_driver");
|
||||
|
@@ -47,7 +47,6 @@ public class ApiService {
|
||||
public <T> Mono<List<T>> getInfoPakistan(GetInfoVO getInfoVO) {
|
||||
ParameterizedTypeReference<List<T>> typeRef = (ParameterizedTypeReference<List<T>>) tableObjectMapping.get(getInfoVO.getTableName());
|
||||
if (typeRef == null) {
|
||||
// throw new IllegalArgumentException("不支持该表名: " + getInfoVO.getTableName());
|
||||
log.error("Pakistan API - 不支持该表名 : {}", getInfoVO.getTableName());
|
||||
return Mono.empty();
|
||||
}
|
||||
@@ -66,7 +65,6 @@ public class ApiService {
|
||||
log.warn("Pakistan API - WebClient 请求 eldData 失败,错误: {}", e.getMessage());
|
||||
return Mono.just(Collections.emptyList());
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Pro API
|
||||
@@ -74,7 +72,6 @@ public class ApiService {
|
||||
public <T> Mono<List<T>> getInfoPro(Integer customerId, String tableName) {
|
||||
ParameterizedTypeReference<List<T>> typeRef = (ParameterizedTypeReference<List<T>>) tableObjectMapping.get(tableName);
|
||||
if (typeRef == null) {
|
||||
// throw new IllegalArgumentException("不支持该表名: " + tableName);
|
||||
log.error("Pro API - 不支持该表名 : {}", tableName);
|
||||
return Mono.empty();
|
||||
}
|
||||
|
@@ -61,10 +61,16 @@ public class CompareService {
|
||||
* @Description: 获取 value 字段
|
||||
*/
|
||||
private static List<String> getValueField(String tableName) {
|
||||
List<String> valueFields = KEY_FIELDS.get(tableName);
|
||||
List<String> valueFields = null;
|
||||
try {
|
||||
valueFields = KEY_FIELDS.get(tableName);
|
||||
if (valueFields == null) {
|
||||
throw new IllegalArgumentException("未配置字段列表: " + tableName);
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.error(e.getMessage());
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return valueFields;
|
||||
}
|
||||
|
||||
@@ -207,7 +213,6 @@ public class CompareService {
|
||||
.filter(key -> !(pakistanMap.containsKey(key) && proMap.containsKey(key)))
|
||||
.map(key -> pakistanMap.getOrDefault(key, proMap.get(key))) // 取出差异项
|
||||
.collect(Collectors.toList());
|
||||
|
||||
log.info("customerId = {} - tableName = {} - differList = {}", customerId, tableName, diffList);
|
||||
|
||||
Set<Integer> differIds = diffList.stream()
|
||||
|
Reference in New Issue
Block a user