虚拟清单--导入模板添加说明
This commit is contained in:
+42
-6
@@ -31,6 +31,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
||||
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
||||
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
@@ -345,6 +346,9 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
cellStyle.setAlignment(HorizontalAlignment.CENTER);//垂直居中
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//水平居中
|
||||
|
||||
HSSFCellStyle cellStyleTemp = workbook.createCellStyle();
|
||||
cellStyleTemp.setWrapText(true);//自动换行
|
||||
|
||||
|
||||
int count = 1;
|
||||
int startLine = 0;
|
||||
@@ -370,8 +374,34 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
sheet.addMergedRegion(region1);
|
||||
count ++;
|
||||
}
|
||||
CellRangeAddress region =
|
||||
new CellRangeAddress(2, 2, 0, 27); //参数1:起始行 参数2:终止行 参数3:起始列 参数4:终止列
|
||||
sheet.addMergedRegion(region);
|
||||
String explain= "";
|
||||
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
|
||||
explain = "填写说明\n" +
|
||||
"1.导入数据从第四行开始\n" +
|
||||
"2.所有带*号的字段必须填写\n"+
|
||||
"3.状态,认证类型,认证级别,实施类别,交付物类型,发起人,责任人,字段是单选属性,必须和系统中的对应字段选项相匹配\n" +
|
||||
"4.适用范围,适用地区,责任领域,技术领域,字段是多选属性,必须和系统中的对应字段选项相匹配,填写多个时采用英文或中文逗号分割\n" +
|
||||
"5.新车型实施日期,在产车实施日期字段为日期,必须精确到日\n" +
|
||||
"6.编号,标题,子标题,WVTA ID,备注,填写文本内容\n" +
|
||||
"7.对应标准,填写多个时采用英文或中文逗号分割\n" +
|
||||
"8.交付物模板字段为文件属性,填写时需要在本文件同级目录下以标准号为名称建立文件夹,并在文件夹下放置文件,假设在AAA标准号下放置了B.docx,则应填写AAA/B.docx";
|
||||
}else{
|
||||
explain = "filling explanation\n" +
|
||||
"1.import data starts at the fourth line\n" +
|
||||
"2.all fields marked with * must be filled in\n"+
|
||||
"3.state,certification type,certification level,implementation category,type of deliverables,initiator,person liable,Fields are radio attributes that must match the corresponding field option in the system\n" +
|
||||
"4.scope of application,zone of application,area of responsibility,technical field, field is a multi-select attribute and must match the corresponding field in the system. If multiple fields are filled in, separate them by commas (,)\n" +
|
||||
"5.new car implementation date,on the production vehicle implementation date,Must be accurate to the day\n" +
|
||||
"6.serial number,title,subtitle,WVTA ID,remarks,Fill in the text\n" +
|
||||
"7.corresponding standard,If multiple entries are filled in, separate them by commas in English or Chinese\n" +
|
||||
"8.deliverable template,When filling in the field, you need to create a folder in the directory of the same level as the file with the name of the standard number and place the file in the folder. If b. diocx is stored under the AAA standard number, enter AAA/B. diocx";
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
//表头
|
||||
Row row = sheet.createRow(i);//开始创建标题行
|
||||
String[] headerArr = titleOne.split(",");
|
||||
@@ -388,12 +418,18 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
}else if(i == 1){
|
||||
//titleTwo
|
||||
String[] headerArrTwo = titleTwo.split(",");
|
||||
for (int j = 0; j < headerArrTwo.length; j++) {
|
||||
row.createCell(16+j).setCellValue(headerArrTwo[j]);
|
||||
}
|
||||
}else{
|
||||
short height = (short) (10 * 252);
|
||||
row.setHeight((short) height);
|
||||
Cell cell = row.createCell(0);
|
||||
cell.setCellStyle(cellStyleTemp);
|
||||
cell.setCellValue(new HSSFRichTextString(explain));
|
||||
}
|
||||
}
|
||||
response.setHeader("Content-Disposition",
|
||||
@@ -695,7 +731,7 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
}
|
||||
headerSb.append(key + ",");
|
||||
}
|
||||
} else {
|
||||
} else if(i > 2){
|
||||
List<String> headList = Arrays.asList(headerSb.toString().split(","));
|
||||
String field ="";
|
||||
if (HSSFCell.CELL_TYPE_NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) {
|
||||
@@ -715,12 +751,12 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (i != 0 && i != 1) {
|
||||
if (i > 2) {
|
||||
rowList.put(headerCell.getStringCellValue(), "");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i != 0 && i != 1) {
|
||||
if (i > 2) {
|
||||
dataList.add(rowList);
|
||||
}
|
||||
}
|
||||
@@ -783,7 +819,7 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
String zipEntryName,
|
||||
File saveDirectory,
|
||||
String cut) {
|
||||
int i = 2;
|
||||
int i = 3;
|
||||
List<String> msgList = new ArrayList<>();
|
||||
String value = "";
|
||||
boolean flag = true;
|
||||
|
||||
Reference in New Issue
Block a user