Merge remote-tracking branch 'origin/dev_third_stage' into dev_third_stage
This commit is contained in:
+17
-21
@@ -283,7 +283,6 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
|
||||
for (int j = 0; j < leftSplit.length; j++) {
|
||||
if (ObjectUtils.isNotEmpty(leftSplit[j])) {
|
||||
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
||||
BufferedImage bufferImg = null;
|
||||
if (j > 0) {
|
||||
Row row2 = sheet.getRow(j + i);
|
||||
if (ObjectUtils.isEmpty(row2)) {
|
||||
@@ -318,7 +317,6 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
|
||||
for (int j = 0; j < rightSplit.length; j++) {
|
||||
if (ObjectUtils.isNotEmpty(rightSplit[j])) {
|
||||
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
||||
BufferedImage bufferImg = null;
|
||||
if (j > 0) {
|
||||
Row row2 = sheet.getRow(j + i);
|
||||
if (ObjectUtils.isEmpty(row2)) {
|
||||
@@ -409,21 +407,20 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
|
||||
* @param patriarch
|
||||
* @param cellStyleLink
|
||||
* @param byteArrayOut
|
||||
* @param row2
|
||||
* @param row
|
||||
* @param i
|
||||
* @param j
|
||||
* @param s
|
||||
* @param i2
|
||||
* @param text
|
||||
* @param cellNum
|
||||
* @throws IOException
|
||||
*/
|
||||
private void imgToExcel(Workbook workbook, String dir, HSSFPatriarch patriarch, CellStyle cellStyleLink, ByteArrayOutputStream byteArrayOut, Row row2, int i, int j, String s, int i2) throws IOException {
|
||||
BufferedImage bufferImg;
|
||||
if (s.contains("/upFiles")) {
|
||||
row2.setHeight((short) 3000); //设置行高
|
||||
private void imgToExcel(Workbook workbook, String dir, HSSFPatriarch patriarch, CellStyle cellStyleLink, ByteArrayOutputStream byteArrayOut, Row row, int i, int j, String text, int cellNum) throws IOException {
|
||||
if (text.contains("/upFiles")) {
|
||||
row.setHeight((short) 3000); //设置行高
|
||||
//先将图片下载到本地
|
||||
String fileLastName = s.substring(s.lastIndexOf("/") + 1);
|
||||
if (CosBootUtil.doesObjectExist(s)) {
|
||||
try (InputStream in = CosBootUtil.download(s)) {
|
||||
String fileLastName = text.substring(text.lastIndexOf("/") + 1);
|
||||
if (CosBootUtil.doesObjectExist(text)) {
|
||||
try (InputStream in = CosBootUtil.download(text)) {
|
||||
copyFile2(in, dir + File.separator + fileLastName);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -432,19 +429,19 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
|
||||
}
|
||||
File file = new File(dir + File.separator + fileLastName);
|
||||
if (file.exists()) {
|
||||
bufferImg = ImageIO.read(file);
|
||||
BufferedImage bufferImg = ImageIO.read(file);
|
||||
ImageIO.write(bufferImg, "jpg", byteArrayOut);
|
||||
//anchor主要用于设置图片的属性
|
||||
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 600, 200, (short) i2, j + i, (short) i2, j + i);
|
||||
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 600, 200, (short) cellNum, j + i, (short) cellNum, j + i);
|
||||
patriarch.createPicture(anchor, workbook.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG));
|
||||
|
||||
}
|
||||
} else {
|
||||
Cell cell = row2.createCell(i2);
|
||||
if (s.contains("<table")) {
|
||||
tableAssociations(workbook, cellStyleLink, cell, s);
|
||||
Cell cell = row.createCell(cellNum);
|
||||
if (text.contains("<table")) {
|
||||
tableAssociations(workbook, cellStyleLink, cell, text);
|
||||
} else {
|
||||
cell.setCellValue(s);
|
||||
cell.setCellValue(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -454,12 +451,11 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
|
||||
* @param workbook
|
||||
* @param cellStyleLink
|
||||
* @param cell
|
||||
* @param tableHtml1
|
||||
* @param tableHtml
|
||||
*/
|
||||
private void tableAssociations(Workbook workbook, CellStyle cellStyleLink, Cell cell, String tableHtml1) {
|
||||
private void tableAssociations(Workbook workbook, CellStyle cellStyleLink, Cell cell, String tableHtml) {
|
||||
cell.setCellValue("点击查看详情");
|
||||
//新开sheet生成表格
|
||||
String tableHtml = tableHtml1;
|
||||
if (org.apache.commons.lang.StringUtils.isNotEmpty(tableHtml) && tableHtml.indexOf("<tbody>") < 0) {
|
||||
if (tableHtml.indexOf("<thead>") < 0) {
|
||||
tableHtml = tableHtml.replaceFirst("<tr>", "<tbody><tr>");
|
||||
|
||||
Reference in New Issue
Block a user