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