付款单模板,导入文件修复bug

product
chuang 2 years ago
parent 9ea26159ef
commit a0e1b5dc36

@ -12,10 +12,7 @@ import jnpf.purchaseorder.utils.VehiclePictureFolderUtils;
import jnpf.util.FilePathUtil;
import jnpf.util.JsonUtil;
import jnpf.util.context.SpringContext;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.NumberToTextConverter;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile;
@ -154,8 +151,8 @@ public class FileCopy {
// System.out.println(objects1);
List<Object> objects2 = reader.readColumn(0, 0, 1);
// 公司名字
String companyStr = String.valueOf(objects2.get(0));
companyStr=companyStr.substring(0,companyStr.lastIndexOf("公司")+2);
// String companyStr = String.valueOf(objects2.get(0));
// companyStr=companyStr.substring(0,companyStr.lastIndexOf("公司")+2);
// 销售合同编码
String infoStr = String.valueOf(objects2.get(1));
@ -182,7 +179,7 @@ public class FileCopy {
Cell cell = row.createCell(19);
Cell cell1 = row.createCell(20);
// Cell cell1 = row.createCell(20);
Cell cell2 = row.createCell(21);
Cell cell3 = row.createCell(22);
Cell cell4 = row.createCell(23);
@ -230,7 +227,7 @@ public class FileCopy {
cell.setCellValue(String.valueOf(o1).equals("null") ? "" : JsonUtil.getListToJsonArray((List<Map<String,Object>>)o1).toString());
cell4.setCellValue(String.valueOf(o2).equals("null") ? "" :JsonUtil.getListToJsonArray((List<Map<String,Object>>)o2).toString());
cell1.setCellValue(companyStr);
// cell1.setCellValue(companyStr);
cell2.setCellValue(str);
cell3.setCellValue(str3);
cell5.setCellType(CellType.STRING);
@ -243,8 +240,21 @@ public class FileCopy {
strCell1.setCellType(CellType.STRING);
strCell1.setCellValue(FileCopy.setSteColumn(strCell1));
strCell2.setCellType(CellType.STRING);
if (strCell2.getCellType() == CellType.NUMERIC) {
//hssfCell.setCellType(1);//设置为String
//String str_temp = String.valueOf(hssfCell.getRichStringCellValue());//得到值
DataFormatter dataFormatter = new DataFormatter();
FormulaEvaluator fe = writer.getWorkbook()
.getCreationHelper()
.createFormulaEvaluator();
String str_temp = dataFormatter.formatCellValue(strCell2, fe);
strCell2.setCellValue(str_temp);
}else {
strCell2.setCellValue(FileCopy.setSteColumn(strCell2));
}
strCell2.setCellType(CellType.STRING);
strCell3.setCellType(CellType.STRING);
strCell3.setCellValue(FileCopy.setSteColumn(strCell3));
strCell4.setCellType(CellType.STRING);

@ -15,7 +15,7 @@
<body>
<div id="app">
<h1 style="text-align: center">城市矿产请示</h1>
<h1 style="text-align: center">${customerName!"城市矿产"}请示</h1>
<p align="right">
流程编号QS-CSKC-2023-000000066723
</p>
@ -28,7 +28,7 @@
class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label "
style="text-align: center; background-color: rgb(231, 242, 251); color: black;">标题</th>
<td colspan="3" class="el-descriptions-item__cell el-descriptions-item__content"
style="color: black;">${customerName!""}的请示</td>
style="color: black;">${customerName!"城市矿产"}的请示</td>
</tr>
</tbody>
<tbody>
@ -38,7 +38,7 @@
style="text-align: center; background-color: rgb(231, 242, 251); color: black;">拟稿单位
</th>
<td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content"
style="color: black;">${fullName!""}</td>
style="color: black;">${fullName!"济钢集团/济钢城市矿产科技有限公司"}</td>
<th colspan="1"
class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label "
style="text-align: center; background-color: rgb(231, 242, 251); color: black;">拟稿日期

Loading…
Cancel
Save