企标excel处理

This commit is contained in:
zhaokaiyao@91isoft.com
2021-11-14 09:22:09 +08:00
parent 308baa5d67
commit 479e74ab6f
4 changed files with 15 additions and 15 deletions
@@ -14,10 +14,8 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.time.Year;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Component @Component
@@ -29,17 +29,19 @@ public class PathMatcher {
for (Row row : sheet) { for (Row row : sheet) {
if(row.getCell(1)==null || row.getCell(10)==null){
String latter = row.getCell(1).getStringCellValue().trim();//标准号
String fileId="";
if (row.getCell(10)!=null){
fileId = row.getCell(10).getStringCellValue().trim();//文档id
}else {
logger.info("+"); logger.info("+");
continue; continue;
} }
String latter = row.getCell(1).getStringCellValue().trim();//标准号
String fileId="";
fileId = row.getCell(10).getStringCellValue().trim();//文档id
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append(fileId) builder.append(fileId)
.append(latter); .append(latter);
@@ -55,7 +57,7 @@ public class PathMatcher {
} }
File file = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\匹配带入文件路径-国内库.xlsx"); File file = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\匹配带入文件路径-企标.xlsx");
FileOutputStream os = new FileOutputStream(file); FileOutputStream os = new FileOutputStream(file);
workbook.write(os); workbook.write(os);
@@ -40,13 +40,13 @@ public class StandMatcher {
String letter =convertCellValueToString(row.getCell(1));//标准号 String letter =convertCellValueToString(row.getCell(1));//标准号
String publish = convertCellValueToString(row.getCell(3));//发布日期 String publish = convertCellValueToString(row.getCell(4));//发布日期
String impl= convertCellValueToString(row.getCell(4));//实施日期 String impl= convertCellValueToString(row.getCell(5));//实施日期
String state = convertCellValueToString(row.getCell(2));//状态 String state = convertCellValueToString(row.getCell(3));//状态
String replace= convertCellValueToString(row.getCell(5));//代替标准号 String replace= convertCellValueToString(row.getCell(6));//代替标准号
@@ -72,7 +72,7 @@ public class StandMatcher {
} }
File result = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\匹配带入文件id-国内库.xlsx"); File result = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\匹配带入文件id-企标.xlsx");
FileOutputStream os = new FileOutputStream(result); FileOutputStream os = new FileOutputStream(result);
workbook.write(os); workbook.write(os);
} }
@@ -163,7 +163,7 @@ public class ImportExcelController extends BaseController<ImportDto> {
} }
@ApiOperation("根据文件id和标准匹配文件路径") @ApiOperation("根据文件id和标准号匹配文件路径")
@PostMapping("/matchingPath") @PostMapping("/matchingPath")
public void matchingPath(MultipartFile targetExcel,MultipartFile attachExcel) throws IOException { public void matchingPath(MultipartFile targetExcel,MultipartFile attachExcel) throws IOException {