- @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());
复制代码 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |