|
@@ -320,11 +320,11 @@ public class AuthServiceImpl implements AuthService {
|
|
List<ProductSaveDto> productList = new ArrayList<>();
|
|
List<ProductSaveDto> productList = new ArrayList<>();
|
|
|
|
|
|
// 得到机构对应的商品工作表
|
|
// 得到机构对应的商品工作表
|
|
- XSSFSheet productSheet = i <= sheetsNum ? workbook.getSheetAt(i) : null;
|
|
|
|
|
|
+ XSSFSheet productSheet = i < sheetsNum ? workbook.getSheetAt(i) : null;
|
|
String sheetName = null != productSheet ? productSheet.getSheetName() : null;
|
|
String sheetName = null != productSheet ? productSheet.getSheetName() : null;
|
|
if (null == productSheet || !authParty.equals(sheetName)) {
|
|
if (null == productSheet || !authParty.equals(sheetName)) {
|
|
// 遍历所有工作表,找到表名与授权机构名称相同的商品工作表
|
|
// 遍历所有工作表,找到表名与授权机构名称相同的商品工作表
|
|
- for (int j = 1; i < sheetsNum; i++) {
|
|
|
|
|
|
+ for (int j = 1; j < sheetsNum; j++) {
|
|
productSheet = workbook.getSheetAt(j);
|
|
productSheet = workbook.getSheetAt(j);
|
|
sheetName = productSheet.getSheetName();
|
|
sheetName = productSheet.getSheetName();
|
|
if (!authParty.equals(sheetName)) {
|
|
if (!authParty.equals(sheetName)) {
|
|
@@ -524,7 +524,7 @@ public class AuthServiceImpl implements AuthService {
|
|
HSSFRow authPartyRow = authPartySheet.createRow(authPartyRowNum.get());
|
|
HSSFRow authPartyRow = authPartySheet.createRow(authPartyRowNum.get());
|
|
HSSFCell authPartyCell = authPartyRow.createCell(0);
|
|
HSSFCell authPartyCell = authPartyRow.createCell(0);
|
|
authPartyCell.setCellType(CellType.valueOf("STRING"));
|
|
authPartyCell.setCellType(CellType.valueOf("STRING"));
|
|
- HSSFRichTextString authPartyName = new HSSFRichTextString(authParty.getAuthParty());
|
|
|
|
|
|
+ HSSFRichTextString authPartyName = new HSSFRichTextString(authParty.getAuthParty().trim());
|
|
authPartyCell.setCellValue(authPartyName);
|
|
authPartyCell.setCellValue(authPartyName);
|
|
authPartyCell.setCellStyle(customCellStyle);
|
|
authPartyCell.setCellStyle(customCellStyle);
|
|
authPartyRowNum.getAndIncrement();
|
|
authPartyRowNum.getAndIncrement();
|
|
@@ -568,7 +568,7 @@ public class AuthServiceImpl implements AuthService {
|
|
"参数值3", "参数名称4", "参数值4", "参数名称5", "参数值5", "参数名称6", "参数值6", "参数名称7",
|
|
"参数值3", "参数名称4", "参数值4", "参数名称5", "参数值5", "参数名称6", "参数值6", "参数名称7",
|
|
"参数值7", "参数名称8", "参数值8", "参数名称9", "参数值9", "参数名称10", "参数值10", "参数名称11",
|
|
"参数值7", "参数名称8", "参数值8", "参数名称9", "参数值9", "参数名称10", "参数值10", "参数名称11",
|
|
"参数值11", "参数名称12", "参数值12"};
|
|
"参数值11", "参数名称12", "参数值12"};
|
|
- for (int i = 0; i < 5 + authParty.getMaxParamNum(); i++) {
|
|
|
|
|
|
+ for (int i = 0; i < 5 + (0 == authParty.getMaxParamNum() ? 4 : authParty.getMaxParamNum()) * 2; i++) {
|
|
HSSFCell productTopRowCell = productTopRow.createCell(i);
|
|
HSSFCell productTopRowCell = productTopRow.createCell(i);
|
|
productTopRowCell.setCellType(CellType.valueOf("STRING"));
|
|
productTopRowCell.setCellType(CellType.valueOf("STRING"));
|
|
HSSFRichTextString columnText = new HSSFRichTextString(rowName[i]);
|
|
HSSFRichTextString columnText = new HSSFRichTextString(rowName[i]);
|
|
@@ -596,13 +596,13 @@ public class AuthServiceImpl implements AuthService {
|
|
productData.add(param.getParamName());
|
|
productData.add(param.getParamName());
|
|
productData.add(param.getParamContent());
|
|
productData.add(param.getParamContent());
|
|
});
|
|
});
|
|
- for (int j = 0; j < 5 + paramList.size(); j++) {
|
|
|
|
|
|
+ for (int j = 0; j < 5 + paramList.size() * 2; j++) {
|
|
HSSFCell productCell = productRow.createCell(j);
|
|
HSSFCell productCell = productRow.createCell(j);
|
|
if (j == 3 || j == 4) {
|
|
if (j == 3 || j == 4) {
|
|
// productSheet.addMergedRegion(new CellRangeAddress(j + 1,j + 1,j + 1,j + 1)) ;
|
|
// productSheet.addMergedRegion(new CellRangeAddress(j + 1,j + 1,j + 1,j + 1)) ;
|
|
// 头像
|
|
// 头像
|
|
InputStream imageStream = getImageStream(productData.get(j));
|
|
InputStream imageStream = getImageStream(productData.get(j));
|
|
- if (null != imageStream){
|
|
|
|
|
|
+ if (null != imageStream) {
|
|
try {
|
|
try {
|
|
BufferedImage bufferedImage = ImageIO.read(imageStream);
|
|
BufferedImage bufferedImage = ImageIO.read(imageStream);
|
|
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
|
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
|
@@ -610,7 +610,7 @@ public class AuthServiceImpl implements AuthService {
|
|
byte[] data = byteArrayOut.toByteArray();
|
|
byte[] data = byteArrayOut.toByteArray();
|
|
HSSFPatriarch drawingPatriarch = productSheet.createDrawingPatriarch();
|
|
HSSFPatriarch drawingPatriarch = productSheet.createDrawingPatriarch();
|
|
// 设置图片位置
|
|
// 设置图片位置
|
|
- HSSFClientAnchor anchor = new HSSFClientAnchor(30, 30, 700, 200, (short)j,productRowNum.get(),(short)j,productRowNum.get());
|
|
|
|
|
|
+ HSSFClientAnchor anchor = new HSSFClientAnchor(30, 30, 700, 200, (short) j, productRowNum.get(), (short) j, productRowNum.get());
|
|
drawingPatriarch.createPicture(anchor, workbook.addPicture(data, HSSFWorkbook.PICTURE_TYPE_JPEG));
|
|
drawingPatriarch.createPicture(anchor, workbook.addPicture(data, HSSFWorkbook.PICTURE_TYPE_JPEG));
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -630,7 +630,7 @@ public class AuthServiceImpl implements AuthService {
|
|
});
|
|
});
|
|
|
|
|
|
// 让列宽随着导出的列长自动适应
|
|
// 让列宽随着导出的列长自动适应
|
|
- for (int colNum = 0; (colNum < 5 + authParty.getMaxParamNum()); colNum++) {
|
|
|
|
|
|
+ for (int colNum = 0; (colNum < 5 + authParty.getMaxParamNum() * 2); colNum++) {
|
|
if (colNum == 3 || colNum == 4) {
|
|
if (colNum == 3 || colNum == 4) {
|
|
productSheet.setColumnWidth(colNum, 8200);
|
|
productSheet.setColumnWidth(colNum, 8200);
|
|
} else {
|
|
} else {
|