We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/** * 从文件中获取最大的json字段名称 * * @param file 文件 * @return 对应的json映射sql配置 */ public static List<JsonMappingSqlDTO> getJsonMappingSqlDTOList(File file) { List<JsonMappingSqlDTO> jsonMappingSqlDTOList = new ArrayList<>(); InputStreamReader inputStreamReader = null; JSONReader reader = null; Set<String> columnNames = new HashSet<>(); try { inputStreamReader = new InputStreamReader(Files.newInputStream(file.toPath()), StandardCharsets.UTF_8); reader = new JSONReader(inputStreamReader); reader.startArray(); // 启动数组解析 while (reader.hasNext()) { // 将其解析成Map<String,Object> 类型 JSONObject object = (JSONObject) reader.readObject(); // 获取所有的key Set<String> keySet = object.keySet(); for (String key : keySet) { if (!columnNames.contains(key)) { columnNames.add(key); JsonMappingSqlDTO jsonMappingSqlDTO = new JsonMappingSqlDTO(); jsonMappingSqlDTO.setFrom(key); jsonMappingSqlDTO.setTo(key); String type = Optional.ofNullable(object.get(key)) .map(value -> value.getClass().getSimpleName()) .orElse("String"); jsonMappingSqlDTO.setType(type); jsonMappingSqlDTOList.add(jsonMappingSqlDTO); } } } reader.endArray(); } catch (Exception e) { log.error("获取文件失败", e); } finally { try { if (Objects.nonNull(reader)) { reader.close(); } if (Objects.nonNull(inputStreamReader)) { inputStreamReader.close(); } } catch (IOException e) { log.error("关闭文件失败", e); } } return jsonMappingSqlDTOList; }
为啥换一个机器就可以。
The text was updated successfully, but these errors were encountered:
是多个jar共存加载顺序不一样导致问题了吧?
Sorry, something went wrong.
No branches or pull requests
为啥换一个机器就可以。
The text was updated successfully, but these errors were encountered: