@PostMapping("/test") public void test() throws IOException {Path csvFile = Paths.get("D:\\test/27.csv");//虚拟机退出时删除临时文件csvFile.toFile().deleteOnExit();List<String> list = Files.readAllLines(csvFile, Charset.forName("GB2312"));//List<String> allLines,// String formattedDate, String fileId//billingService.buildBillingResult(list,"","2024-12-30","13234");InputStream resourceAsStream = this.getClass().getResourceAsStream("/keystore/a.csv");byte[] downloadAsBytes = IOUtils.readFully(resourceAsStream,Objects.requireNonNull(resourceAsStream).available());}
@GetMapping("/test")
public void test() throws IOException {
Path csvFile = Paths.get("D:\\test/a.txt");
//虚拟机退出时删除临时文件
//csvFile.toFile().deleteOnExit();
//List<String> list = Files.readAllLines(csvFile, Charset.forName("GB2312"));
baiduApService.buildBillingResult(csvFile,zhuti.xxx,LocalDate.now(),"1111");
}
public List<PayChannelBillingInfo> buildBillingResult(Path path, zhuti zhuti , LocalDate date,String fileId) throws IOException {final List<String> allLines = Files.readAllLines(path);final Splitter splitter = Splitter.on("&&");final List<String> headers = splitter.splitToList(allLines.get(6));final List<LinkedHashMap<String, String>> list = allLines.subList(7, allLines.size() - 2).stream().filter(StringUtils::isNotBlank).map(lineString -> {List<String> values = splitter.splitToList(lineString);if("danhao".equals(values.get(0))){log.info("对账订单号size:{}",values.size()+":"+values.get(0)+":"+values.get(2));for (int i=0 ;i<values.size();i++) {log.info("对账订单号str:{}",values.get(i));}}if("danhao".equals(values.get(0))){log.info("对账订单号size:{}",values.size()+":"+values.get(0)+":"+values.get(2));for (int i=0 ;i<values.size();i++) {log.info("对账订单号str:{}",values.get(i));}}return IntStream.range(0, headers.size()).boxed().collect(Collectors.toMap(headers::get, values::get, (a, b) -> b, Maps::newLinkedHashMap));}).collect(Collectors.toList());