Commit d2db0cdc authored by Quxl's avatar Quxl

x

parent 3195e0fb
package com.egolm.film.api.service.impl; package com.egolm.film.api.service.impl;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
...@@ -19,7 +20,6 @@ import org.apache.poi.hssf.usermodel.HSSFPatriarch; ...@@ -19,7 +20,6 @@ import org.apache.poi.hssf.usermodel.HSSFPatriarch;
import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -604,8 +604,8 @@ public class ExportServiceImpl implements ExportService { ...@@ -604,8 +604,8 @@ public class ExportServiceImpl implements ExportService {
String[] xyAry = key.split(",", 2); String[] xyAry = key.split(",", 2);
Integer x = Integer.valueOf(xyAry[1]); Integer x = Integer.valueOf(xyAry[1]);
Integer y = Integer.valueOf(xyAry[0]); Integer y = Integer.valueOf(xyAry[0]);
Row row = sheet.getRow(y-1); Cell cell = sheet.getRow(y-1).getCell(x-1);
Cell cell = row.getCell(x-1); if(cell != null) {
String tplValue = cell.getStringCellValue(); String tplValue = cell.getStringCellValue();
if(StringUtil.isNotBlank(tplValue) && tplValue.contains("_")) { if(StringUtil.isNotBlank(tplValue) && tplValue.contains("_")) {
cell.setCellValue(tplValue.replaceFirst("_+", value)); cell.setCellValue(tplValue.replaceFirst("_+", value));
...@@ -613,11 +613,13 @@ public class ExportServiceImpl implements ExportService { ...@@ -613,11 +613,13 @@ public class ExportServiceImpl implements ExportService {
cell.setCellValue(value); cell.setCellValue(value);
} }
} }
}
/** /**
* 处理剧照 * 处理剧照
*/ */
if(StringUtil.isNotBlank(filmExt.getPhoto_mv())) { if(StringUtil.isNotBlank(filmExt.getPhoto_mv())) {
try {
String pathMvPhoto = ossService.getOssPath(filmExt.getPhoto_mv(), 10); String pathMvPhoto = ossService.getOssPath(filmExt.getPhoto_mv(), 10);
URL mvPhotoUrl = new URL(pathMvPhoto); URL mvPhotoUrl = new URL(pathMvPhoto);
HttpURLConnection mvPhotoConn = (HttpURLConnection)mvPhotoUrl.openConnection(); HttpURLConnection mvPhotoConn = (HttpURLConnection)mvPhotoUrl.openConnection();
...@@ -628,12 +630,16 @@ public class ExportServiceImpl implements ExportService { ...@@ -628,12 +630,16 @@ public class ExportServiceImpl implements ExportService {
HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short)0, 3, (short)9, 3); HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short)0, 3, (short)9, 3);
patriarch.createPicture(anchor, wb.addPicture(mvPhotoBytes, HSSFWorkbook.PICTURE_TYPE_JPEG)); patriarch.createPicture(anchor, wb.addPicture(mvPhotoBytes, HSSFWorkbook.PICTURE_TYPE_JPEG));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
} }
/** /**
* 处理导演图片 * 处理导演图片
*/ */
if(StringUtil.isNotBlank(filmExt.getPhoto_director())) { if(StringUtil.isNotBlank(filmExt.getPhoto_director())) {
try {
String pathDirectorPhoto = ossService.getOssPath(filmExt.getPhoto_director(), 10); String pathDirectorPhoto = ossService.getOssPath(filmExt.getPhoto_director(), 10);
URL directorPhotoUrl = new URL(pathDirectorPhoto); URL directorPhotoUrl = new URL(pathDirectorPhoto);
HttpURLConnection directorPhotoConn = (HttpURLConnection)directorPhotoUrl.openConnection(); HttpURLConnection directorPhotoConn = (HttpURLConnection)directorPhotoUrl.openConnection();
...@@ -644,6 +650,9 @@ public class ExportServiceImpl implements ExportService { ...@@ -644,6 +650,9 @@ public class ExportServiceImpl implements ExportService {
HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short)2, 18, (short)3, 25); HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short)2, 18, (short)3, 25);
patriarch.createPicture(anchor, wb.addPicture(directorPhotoBytes, HSSFWorkbook.PICTURE_TYPE_JPEG)); patriarch.createPicture(anchor, wb.addPicture(directorPhotoBytes, HSSFWorkbook.PICTURE_TYPE_JPEG));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
} }
wb.write(os); wb.write(os);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment