优化标准详情拆分的导入+导出+sql记录
This commit is contained in:
@@ -58,5 +58,8 @@ public class SarStandItemVal extends BaseEntity {
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date modifyTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String imgName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
+8
@@ -1,8 +1,14 @@
|
||||
package com.adc.da.slrs.SarStandItemVal.service;
|
||||
|
||||
import com.adc.da.slrs.SarStandItemVal.entity.SarStandItemVal;
|
||||
import com.adc.da.slrs.standardSplit.dto.FileSpiltValTableExportDto;
|
||||
import com.adc.da.slrs.standardSplit.dto.FileSplitValExportDto;
|
||||
import com.adc.da.slrs.standardSplit.dto.FileSplitValImgExportDto;
|
||||
import com.adc.da.slrs.standardSplit.entity.SarFileSplitItemsEOPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
@@ -13,4 +19,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface ISarStandItemValService extends IService<SarStandItemVal> {
|
||||
|
||||
List<FileSplitValExportDto> combineItemValInfo(List<SarStandItemVal> getValList, List<FileSpiltValTableExportDto> allTableList, List<FileSplitValImgExportDto> allImgList, SarFileSplitItemsEOPage page);
|
||||
|
||||
}
|
||||
|
||||
+77
@@ -3,9 +3,18 @@ package com.adc.da.slrs.SarStandItemVal.service.impl;
|
||||
import com.adc.da.slrs.SarStandItemVal.dao.SarStandItemValDao;
|
||||
import com.adc.da.slrs.SarStandItemVal.entity.SarStandItemVal;
|
||||
import com.adc.da.slrs.SarStandItemVal.service.ISarStandItemValService;
|
||||
import com.adc.da.slrs.standardSplit.dto.FileSpiltValTableExportDto;
|
||||
import com.adc.da.slrs.standardSplit.dto.FileSplitValExportDto;
|
||||
import com.adc.da.slrs.standardSplit.dto.FileSplitValImgExportDto;
|
||||
import com.adc.da.slrs.standardSplit.entity.SarFileSplitItemsEOPage;
|
||||
import com.adc.da.slrs.standardSplit.entity.SarFileSplitItemsTableEOPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
@@ -17,4 +26,72 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class SarStandItemValServiceImpl extends ServiceImpl<SarStandItemValDao, SarStandItemVal> implements ISarStandItemValService {
|
||||
|
||||
@Override
|
||||
public List<FileSplitValExportDto> combineItemValInfo(List<SarStandItemVal> getValList, List<FileSpiltValTableExportDto> allTableList, List<FileSplitValImgExportDto> allImgList, SarFileSplitItemsEOPage page) {
|
||||
int tableIndex = page.getTableIndex();
|
||||
int imgIndex = page.getImgIndex();
|
||||
List<FileSplitValExportDto> valContent = new ArrayList<>();
|
||||
if (getValList != null && !getValList.isEmpty()) {
|
||||
String preType = "";
|
||||
for(SarStandItemVal itemsValEO : getValList){
|
||||
String type = itemsValEO.getPropertyType();
|
||||
FileSplitValExportDto lastOne = new FileSplitValExportDto();
|
||||
lastOne.setValType(type);
|
||||
if(preType.equals(type) && "TEXT".equals(type)) {
|
||||
lastOne = valContent.get(valContent.size() - 1);
|
||||
lastOne.setValContent(lastOne.getValContent()+itemsValEO.getPropertyVal() + "\n");
|
||||
valContent.set(valContent.size() - 1, lastOne);
|
||||
} else if ("TEXT".equals(type)) {
|
||||
lastOne.setValContent(lastOne.getValContent()+itemsValEO.getPropertyVal() + "\n");
|
||||
valContent.add(lastOne);
|
||||
} else if ("TABLE".equals(type)) {
|
||||
String tableName = String.valueOf(tableIndex);
|
||||
lastOne.setValContent("tableSheet" + tableName);
|
||||
//查询table信息
|
||||
SarFileSplitItemsTableEOPage tablePage = new SarFileSplitItemsTableEOPage();
|
||||
tablePage.setItemsValId(itemsValEO.getId());
|
||||
valContent.add(lastOne);
|
||||
// List<List<SarFileSplitItemsTableEO>> tableList = combineTableList(itemsValEO);
|
||||
FileSpiltValTableExportDto tableExportDto = new FileSpiltValTableExportDto();
|
||||
tableExportDto.setTableName("tableSheet" + tableName);
|
||||
// tableExportDto.setTableEOList(tableList);
|
||||
tableExportDto.setTableHtCon(itemsValEO.getPropertyVal());
|
||||
allTableList.add(tableExportDto);
|
||||
tableIndex++;
|
||||
page.setTableIndex(tableIndex);
|
||||
} else if ("IMG".equals(type)) {
|
||||
String imgContent = itemsValEO.getPropertyVal();
|
||||
String imgUUIndex = "img" + String.valueOf(imgIndex);
|
||||
if (StringUtils.isNotEmpty(imgContent)){
|
||||
int pathIndex = imgContent.indexOf("src='file");
|
||||
if (pathIndex==-1){
|
||||
String sa = imgContent.replaceAll("\''","\'");
|
||||
pathIndex = sa.indexOf("src='file");
|
||||
}
|
||||
if (pathIndex > -1 && imgContent.length()>(pathIndex+16)) {
|
||||
String imgPath = imgContent.substring(pathIndex+16,imgContent.length()-2);
|
||||
String imgName = imgUUIndex + "-" +imgPath.substring(imgPath.lastIndexOf("/")+1,imgPath.length());
|
||||
lastOne.setValContent(imgUUIndex+".png");
|
||||
final String[] split = imgName.split("-");
|
||||
final String[] split1 = split[1].split("\\.");
|
||||
lastOne.setValContent(split1[0]+".png");
|
||||
valContent.add(lastOne);
|
||||
FileSplitValImgExportDto fileSplitValImgExportDto = new FileSplitValImgExportDto();
|
||||
fileSplitValImgExportDto.setImgName(imgUUIndex+".png");
|
||||
if (StringUtils.isNotEmpty(itemsValEO.getImgName())) {
|
||||
fileSplitValImgExportDto.setImgPath(itemsValEO.getImgName());
|
||||
} else {
|
||||
fileSplitValImgExportDto.setImgPath(imgPath);
|
||||
}
|
||||
allImgList.add(fileSplitValImgExportDto);
|
||||
imgIndex++;
|
||||
page.setImgIndex(imgIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
preType = itemsValEO.getPropertyType();
|
||||
}
|
||||
}
|
||||
return valContent;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,12 +1,11 @@
|
||||
package com.adc.da.slrs.sarStandItems.entity;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@@ -36,4 +35,7 @@ public class FindSarItemsPageReqDTO extends BasePage {
|
||||
|
||||
@ApiModelProperty(value = "解读内容")
|
||||
private String readContent;
|
||||
|
||||
@ApiModelProperty(value = "选中的id")
|
||||
private List<String> idList;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.adc.da.slrs.sarStandItems.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.adc.da.slrs.SarCompStatusInfo.entity.SarCompStatusInfo;
|
||||
import com.adc.da.slrs.standardSplit.dto.FileSplitValExportDto;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -197,4 +197,7 @@ public class SarStandItems extends BaseEntity {
|
||||
@TableField("edit_flag")
|
||||
private String editFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<FileSplitValExportDto> itemValContent;
|
||||
|
||||
}
|
||||
|
||||
+345
-5
@@ -2,9 +2,7 @@ package com.adc.da.slrs.standardSplit.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.adc.da.att.controller.AttFileEOController;
|
||||
import com.adc.da.att.entity.AttFileEO;
|
||||
import com.adc.da.att.service.IAttFileEOService;
|
||||
import com.adc.da.att.util.CommonExportUtil;
|
||||
@@ -13,6 +11,10 @@ import com.adc.da.common.ConvertHtml2Excel;
|
||||
import com.adc.da.common.FileUnZip;
|
||||
import com.adc.da.common.SplitTableInfo;
|
||||
import com.adc.da.http.PageInfo;
|
||||
import com.adc.da.slrs.SarStandItemVal.entity.SarStandItemVal;
|
||||
import com.adc.da.slrs.SarStandItemVal.service.ISarStandItemValService;
|
||||
import com.adc.da.slrs.sarStandItems.entity.SarStandItems;
|
||||
import com.adc.da.slrs.sarStandItems.service.impl.SarStandItemsServiceImpl;
|
||||
import com.adc.da.slrs.sarStandardComplianceAssessResult.entity.SarStandardsInfoEO;
|
||||
import com.adc.da.slrs.standardSplit.dto.*;
|
||||
import com.adc.da.slrs.standardSplit.entity.*;
|
||||
@@ -21,10 +23,10 @@ import com.adc.da.sys.util.UUIDUtils;
|
||||
import com.adc.da.util.exception.AdcDaBaseException;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.util.utils.FileUtil;
|
||||
import com.adc.da.util.utils.IOUtils;
|
||||
import com.adc.da.utils.util.POIReadExcelToHtml;
|
||||
import com.adc.da.common.ReadExcel;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -43,8 +45,6 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import static com.adc.da.utils.util.ExcelUtil.checkObjAllFieldsIsNull;
|
||||
@@ -74,6 +74,12 @@ public class SarFileSplitItemsEOController extends BaseController<SarFileSplitIt
|
||||
@Autowired
|
||||
private SarStandardsInfoEOService sarStandardsInfoEOService;
|
||||
|
||||
@Autowired
|
||||
private SarStandItemsServiceImpl ServiceImpl;
|
||||
|
||||
@Autowired
|
||||
private ISarStandItemValService iSarStandItemValService;
|
||||
|
||||
@Value("${file.path}")
|
||||
private String filePath;
|
||||
|
||||
@@ -823,4 +829,338 @@ public class SarFileSplitItemsEOController extends BaseController<SarFileSplitIt
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|SarFileSplitItemsEO|导出zip")
|
||||
@GetMapping(value = "/exportStandardItemExcel")
|
||||
public void exportStandardItemExcel(String idList, String exportName,String standId, HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||||
OutputStream os = null;
|
||||
OutputStream excelOS = null;
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
String fileOriName = "拆分条款信息";
|
||||
if (StringUtils.isNotEmpty(exportName)) {
|
||||
fileOriName = exportName;
|
||||
}
|
||||
try{
|
||||
//创建临时文件夹
|
||||
String fileNowPath = uploadFilePath + "/tempZip/" + UUIDUtils.randomUUID20() + "/" + fileOriName;
|
||||
File nowFile = new File(fileNowPath);
|
||||
if (nowFile.exists()){
|
||||
nowFile.delete();
|
||||
}
|
||||
nowFile.mkdirs();
|
||||
String fileName = fileOriName + ".xls";
|
||||
HSSFSheet sheetItems = workbook.createSheet("条款内容");
|
||||
String[] headers = {"条款号","条款名称","内容简介"};
|
||||
HSSFCellStyle cellStyle =workbook.createCellStyle();
|
||||
cellStyle.setWrapText(true);
|
||||
// cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
HSSFCellStyle cellStyle1 =workbook.createCellStyle();
|
||||
cellStyle1.setAlignment(HorizontalAlignment.CENTER);
|
||||
HSSFCellStyle cellStyleLink =workbook.createCellStyle();
|
||||
HSSFFont font = workbook.createFont();
|
||||
font.setColor(IndexedColors.LIGHT_BLUE.index);
|
||||
cellStyleLink.setFont(font);
|
||||
cellStyleLink.setWrapText(true);
|
||||
List<String> ids = new ArrayList<>();
|
||||
QueryWrapper<SarStandItems> objectQueryWrapper = new QueryWrapper<>();
|
||||
SarFileSplitItemsEOPage page = new SarFileSplitItemsEOPage();
|
||||
if (StringUtils.isNotEmpty(idList)) {
|
||||
String[] idArr = idList.split(",");
|
||||
List<String> itemIdList = Arrays.asList(idArr);
|
||||
if(!itemIdList.isEmpty()){
|
||||
for (String id :itemIdList) {
|
||||
ids.add(id);
|
||||
}
|
||||
}
|
||||
page.setIdList(itemIdList);
|
||||
}
|
||||
//查询全部条款
|
||||
page.setInfoId(null);
|
||||
page.setOrderBy(null);
|
||||
|
||||
if(!ids.isEmpty()){
|
||||
objectQueryWrapper.in("ID", ids);
|
||||
}
|
||||
//查询全部条款
|
||||
objectQueryWrapper.orderByDesc("CREATION_TIME");
|
||||
if(StringUtils.isNotBlank(standId)) {
|
||||
objectQueryWrapper.eq("STAND_ID", standId);
|
||||
}
|
||||
List<SarStandItems> allItemsList = ServiceImpl.list(objectQueryWrapper);
|
||||
|
||||
|
||||
List<FileSpiltValTableExportDto> allTableList = new ArrayList<>();
|
||||
List<FileSplitValImgExportDto> allImgList = new ArrayList<>();
|
||||
List<AttFileEO> allRelevFileList = new ArrayList<>();
|
||||
int countMaxFile = 1;
|
||||
String fileIds = "";
|
||||
if (allItemsList != null && !allItemsList.isEmpty()) {
|
||||
for (SarStandItems itemsExportDto : allItemsList) {
|
||||
QueryWrapper<SarStandItemVal> sarStandItemValQueryWrapper = new QueryWrapper<>();
|
||||
sarStandItemValQueryWrapper.orderByDesc("CREATION_TIME");
|
||||
sarStandItemValQueryWrapper.in("ITEM_ID",itemsExportDto.getId());
|
||||
List<SarStandItemVal> getValList = iSarStandItemValService.list(sarStandItemValQueryWrapper);
|
||||
|
||||
for (SarStandItemVal sarStandItemVal : getValList){
|
||||
//判断数据是否是img
|
||||
if(sarStandItemVal.getPropertyType().equals("img") || sarStandItemVal.getPropertyType().equals("IMG")){
|
||||
//进行分割
|
||||
String[] split = sarStandItemVal.getPropertyVal().split("=");
|
||||
//获取图片id
|
||||
String[] split1 = split[3].split("'");
|
||||
sarStandItemVal.setPropertyVal(split1[0]);
|
||||
//循环数据 获取id
|
||||
if(StringUtils.isBlank(fileIds)){
|
||||
fileIds = split1[0];
|
||||
}else {
|
||||
fileIds += ","+split1[0];
|
||||
}
|
||||
AttFileEO fileInfo = attFileEOService.getFileInfo(sarStandItemVal.getPropertyVal());
|
||||
String excelImageUrl = "src='file:///E:/data/slrs/file"+fileInfo.getFilePath()+fileInfo.getOldFileName();
|
||||
// 数据加工
|
||||
sarStandItemVal.setPropertyVal(excelImageUrl);
|
||||
}
|
||||
}
|
||||
List<FileSplitValExportDto> valContentList = iSarStandItemValService.combineItemValInfo(getValList,allTableList,allImgList,page);
|
||||
itemsExportDto.setItemValContent(valContentList);
|
||||
}
|
||||
}
|
||||
// 在excel表中添加表头
|
||||
HSSFRow row = sheetItems.createRow(0);
|
||||
sheetItems.setColumnWidth(0,10*256);
|
||||
sheetItems.setColumnWidth(1,20*256);
|
||||
sheetItems.setColumnWidth(2,100*256);
|
||||
sheetItems.setColumnWidth(3,20*256);
|
||||
sheetItems.setColumnWidth(4,20*256);
|
||||
sheetItems.setColumnWidth(5,20*256);
|
||||
sheetItems.setColumnWidth(6,20*256);
|
||||
sheetItems.setColumnWidth(7,20*256);
|
||||
sheetItems.setColumnWidth(8,20*256);
|
||||
sheetItems.setColumnWidth(9,20*256);
|
||||
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
HSSFCell cell = row.createCell(i);
|
||||
HSSFRichTextString text = new HSSFRichTextString(headers[i]);
|
||||
cell.setCellValue(text);
|
||||
cell.setCellStyle(cellStyle1);
|
||||
}
|
||||
//放文字内容
|
||||
int allRow = 0;
|
||||
for(int rowNum = 0;rowNum < allItemsList.size(); rowNum++){
|
||||
SarStandItems exportDto = allItemsList.get(rowNum);
|
||||
List<FileSplitValExportDto> valList = exportDto.getItemValContent();
|
||||
int countFile = 0;
|
||||
if(valList != null && !valList.isEmpty()){
|
||||
int startRow = allRow + 1;
|
||||
for (int valRow=0;valRow<valList.size();valRow++) {
|
||||
allRow++;
|
||||
HSSFRow row1 = sheetItems.createRow(allRow);
|
||||
row1.createCell(0).setCellValue(exportDto.getItemsNum());
|
||||
row1.getCell(0).setCellStyle(cellStyle);
|
||||
row1.createCell(1).setCellValue(exportDto.getItemsName());
|
||||
row1.getCell(1).setCellStyle(cellStyle);
|
||||
HSSFCell cell2 = row1.createCell(2);
|
||||
row1.getCell(2).setCellStyle(cellStyle);
|
||||
String content = valList.get(valRow).getValContent();
|
||||
if (StringUtils.isNotEmpty(content)) {
|
||||
content = content.replaceAll("null","");
|
||||
if (content.lastIndexOf("\n") > -1) {
|
||||
content = content.substring(0,content.lastIndexOf("\n"));
|
||||
}
|
||||
}
|
||||
//处理上下角标
|
||||
List<SplitFont> subList = new ArrayList<>();
|
||||
List<SplitFont> supList = new ArrayList<>();
|
||||
boolean handleCorner = false;
|
||||
if (content.contains("<span class=sup>")) {
|
||||
handleCornerMarkers(content, supList, "<span class=sup>","<span class=sub>");
|
||||
}
|
||||
if (content.contains("<span class=sub>")) {
|
||||
handleCornerMarkers(content, subList, "<span class=sub>","<span class=sub>");
|
||||
}
|
||||
if (subList.size() > 0 || supList.size() > 0) {
|
||||
content = content.replaceAll("<span class=sup>", "");
|
||||
content = content.replaceAll("<span class=sub>", "");
|
||||
content = content.replaceAll("</span>", "");
|
||||
//设置角标font
|
||||
HSSFFont fontSub = workbook.createFont();
|
||||
fontSub.setTypeOffset(HSSFFont.SS_SUB);
|
||||
HSSFFont fontSup = workbook.createFont();
|
||||
fontSup.setTypeOffset(HSSFFont.SS_SUPER);
|
||||
|
||||
RichTextString richTextString = new HSSFRichTextString(content);
|
||||
if (subList.size() > 0) {
|
||||
for (SplitFont splitFont : subList) {
|
||||
richTextString.applyFont(splitFont.getStartIndex(),splitFont.getEndIndex(),fontSub);
|
||||
}
|
||||
}
|
||||
if (supList.size() > 0) {
|
||||
for (SplitFont splitFont : supList) {
|
||||
richTextString.applyFont(splitFont.getStartIndex(),splitFont.getEndIndex(),fontSup);
|
||||
}
|
||||
}
|
||||
cell2.setCellValue(richTextString);
|
||||
handleCorner = true;
|
||||
}
|
||||
|
||||
if("TABLE".equals(valList.get(valRow).getValType())){
|
||||
/* 连接跳转*/
|
||||
CreationHelper createHelper = workbook.getCreationHelper();
|
||||
Hyperlink hyperlink1 = createHelper.createHyperlink(HyperlinkType.DOCUMENT);
|
||||
String tableName = "#\'"+ content + "\'!A1";
|
||||
hyperlink1.setAddress(tableName);
|
||||
cell2.setHyperlink(hyperlink1);// 链接
|
||||
row1.getCell(2).setCellStyle(cellStyleLink);
|
||||
} //else if ("IMG".equals(valList.get(valRow).getValType())) {
|
||||
if ("IMG".equals(valList.get(valRow).getValType())) {
|
||||
/* 连接跳转*/
|
||||
CreationHelper createHelper = workbook.getCreationHelper();
|
||||
Hyperlink hyperlink1 = createHelper.createHyperlink(HyperlinkType.FILE);
|
||||
String imgName = content;
|
||||
hyperlink1.setAddress(imgName);
|
||||
cell2.setHyperlink(hyperlink1);// 链接
|
||||
row1.getCell(2).setCellStyle(cellStyleLink);
|
||||
}
|
||||
if (!handleCorner) {
|
||||
cell2.setCellValue(content);
|
||||
}
|
||||
|
||||
|
||||
row1.createCell(3).setCellValue(exportDto.getResponsibleUnitShow());
|
||||
row1.getCell(3).setCellStyle(cellStyle);
|
||||
row1.createCell(4).setCellValue(exportDto.getFoShow());
|
||||
row1.getCell(4).setCellStyle(cellStyle);
|
||||
row1.createCell(5).setCellValue(exportDto.getDutyEngineerShow());
|
||||
row1.getCell(5).setCellStyle(cellStyle);
|
||||
row1.createCell(6).setCellValue(exportDto.getSvpps());
|
||||
row1.getCell(6).setCellStyle(cellStyle);
|
||||
row1.createCell(7).setCellValue(exportDto.getApplyArctic());
|
||||
row1.getCell(7).setCellStyle(cellStyle);
|
||||
row1.createCell(8).setCellValue(exportDto.getClaimTypeShow());
|
||||
row1.getCell(8).setCellStyle(cellStyle);
|
||||
row1.createCell(9).setCellValue(exportDto.getBusStandCover());
|
||||
row1.getCell(9).setCellStyle(cellStyle);
|
||||
|
||||
}
|
||||
if (allRow > startRow) {
|
||||
sheetItems.addMergedRegion(new CellRangeAddress(startRow,allRow,0,0));
|
||||
sheetItems.addMergedRegion(new CellRangeAddress(startRow,allRow,1,1));
|
||||
sheetItems.addMergedRegion(new CellRangeAddress(startRow,allRow,3,3));
|
||||
sheetItems.addMergedRegion(new CellRangeAddress(startRow,allRow,4,4));
|
||||
sheetItems.addMergedRegion(new CellRangeAddress(startRow,allRow,5,5));
|
||||
sheetItems.addMergedRegion(new CellRangeAddress(startRow,allRow,6,6));
|
||||
sheetItems.addMergedRegion(new CellRangeAddress(startRow,allRow,7,7));
|
||||
sheetItems.addMergedRegion(new CellRangeAddress(startRow,allRow,8,8));
|
||||
sheetItems.addMergedRegion(new CellRangeAddress(startRow,allRow,9,9));
|
||||
}
|
||||
} else {
|
||||
allRow++;
|
||||
HSSFRow row1 = sheetItems.createRow(allRow);
|
||||
row1.createCell(0).setCellValue(exportDto.getItemsNum());
|
||||
row1.getCell(0).setCellStyle(cellStyle);
|
||||
row1.createCell(1).setCellValue(exportDto.getItemsName());
|
||||
row1.getCell(1).setCellStyle(cellStyle);
|
||||
row1.createCell(2).setCellValue("");
|
||||
row1.getCell(2).setCellStyle(cellStyle);
|
||||
row1.createCell(3).setCellValue(exportDto.getResponsibleUnitShow());
|
||||
row1.getCell(3).setCellStyle(cellStyle);
|
||||
row1.createCell(4).setCellValue(exportDto.getFoShow());
|
||||
row1.getCell(4).setCellStyle(cellStyle);
|
||||
row1.createCell(5).setCellValue(exportDto.getDutyEngineerShow());
|
||||
row1.getCell(5).setCellStyle(cellStyle);
|
||||
row1.createCell(6).setCellValue(exportDto.getSvpps());
|
||||
row1.getCell(6).setCellStyle(cellStyle);
|
||||
row1.createCell(7).setCellValue(exportDto.getApplyArctic());
|
||||
row1.getCell(7).setCellStyle(cellStyle);
|
||||
row1.createCell(8).setCellValue(exportDto.getClaimTypeShow());
|
||||
row1.getCell(8).setCellStyle(cellStyle);
|
||||
row1.createCell(9).setCellValue(exportDto.getBusStandCover());
|
||||
row1.getCell(9).setCellStyle(cellStyle);
|
||||
}
|
||||
}
|
||||
if (countMaxFile > 1) {
|
||||
for (int i=1;i<countMaxFile;i++) {
|
||||
sheetItems.setColumnWidth(9+i,40*256);
|
||||
}
|
||||
sheetItems.addMergedRegion(new CellRangeAddress(0,0,9,9+countMaxFile-1));
|
||||
}
|
||||
// 放表格内容
|
||||
if(allTableList!= null && !allTableList.isEmpty()){
|
||||
for(FileSpiltValTableExportDto tableExportDto : allTableList){
|
||||
// List<List<SarFileSplitItemsTableEO>> rowtableList = tableExportDto.getTableEOList();
|
||||
// HSSFSheet sheetTable = workbook.createSheet(tableExportDto.getTableName());
|
||||
String tableName = tableExportDto.getTableName();
|
||||
String tableHtml = tableExportDto.getTableHtCon();
|
||||
if (StringUtils.isNotEmpty(tableHtml) && tableHtml.indexOf("<tbody>") < 0) {
|
||||
if (tableHtml.indexOf("<thead>") < 0) {
|
||||
tableHtml = tableHtml.replaceFirst("<tr>","<tbody><tr>");
|
||||
tableHtml = tableHtml.replaceFirst("</table>","</tbody></table>");
|
||||
} else {
|
||||
tableHtml = tableHtml.replaceFirst("</thead>","</thead><tbody>");
|
||||
tableHtml = tableHtml.replaceFirst("</table>","</tbody></table>");
|
||||
}
|
||||
}
|
||||
String cnt = "\n";
|
||||
tableHtml = tableHtml.replaceAll("<[\\s]*?br[^>]*?>|<[\\s]*?\\/[\\s]*?br[\\s]*?>", cnt);
|
||||
workbook = ConvertHtml2Excel.table2Excel(tableHtml,workbook,tableName);
|
||||
// for (int r=0;r<rowtableList.size();r++) {
|
||||
// List<SarFileSplitItemsTableEO> colTableList = rowtableList.get(r);
|
||||
// HSSFRow tRow = sheetTable.createRow(colTableList.get(0).getRowNum()-1);
|
||||
// for(int c=0;c<colTableList.size();c++){
|
||||
// SarFileSplitItemsTableEO tableEO = colTableList.get(c);
|
||||
// tRow.createCell(tableEO.getColNum()-1).setCellValue(tableEO.getContent());
|
||||
// tRow.getCell(tableEO.getColNum()-1).setCellStyle(cellStyle);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
//下载图片内容
|
||||
if (allImgList != null && !allImgList.isEmpty()) {
|
||||
sarFileSplitItemsEOService.downLoadImgList(allImgList,fileNowPath);
|
||||
}
|
||||
//下载关联文件内容
|
||||
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
|
||||
sarFileSplitItemsEOService.downLoadFileList(allRelevFileList,fileNowPath);
|
||||
}
|
||||
String repFileName = fileName.replaceAll("/","_");
|
||||
excelOS = new FileOutputStream(fileNowPath + "/" + repFileName);
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment; filename=\""+ ReadExcel.encodeFileName(fileOriName+".zip", request) +"\"");
|
||||
response.setContentType("application/force-download");
|
||||
response.flushBuffer();
|
||||
os = response.getOutputStream();
|
||||
workbook.write(excelOS);
|
||||
excelOS.flush();
|
||||
excelOS.close();
|
||||
List<AttFileEO> multiFileInfos = this.attFileEOService.getMultiFileInfos(fileIds);
|
||||
if(CollectionUtils.isNotEmpty(multiFileInfos)){
|
||||
for (AttFileEO data : multiFileInfos){
|
||||
if(StringUtils.isNotBlank(data.getOldFileName())){
|
||||
String[] split = data.getOldFileName().split("\\.");
|
||||
//存在则更换后缀
|
||||
if(split.length>0){
|
||||
data.setOldFileName(split[0]+".png");
|
||||
}
|
||||
}
|
||||
}
|
||||
this.attFileEOService.downLoadFileList(multiFileInfos,fileNowPath);
|
||||
}
|
||||
ZipUtil.zip(fileNowPath,fileNowPath+".zip");
|
||||
FileInputStream fis = new FileInputStream(fileNowPath+".zip");
|
||||
int len = 0;
|
||||
while ((len = fis.read()) != -1) {
|
||||
os.write(len);
|
||||
}
|
||||
os.flush();
|
||||
os.close(); // 后开先关
|
||||
fis.close(); // 先开后关
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
throw new AdcDaBaseException("下载文件失败,请重试");
|
||||
} finally {
|
||||
IOUtils.closeQuietly(os);
|
||||
IOUtils.closeQuietly(excelOS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+36
-4
@@ -6,6 +6,8 @@ import com.adc.da.att.vo.AttFileVo;
|
||||
import com.adc.da.common.FileUnZip;
|
||||
import com.adc.da.common.SplitTableInfo;
|
||||
import com.adc.da.login.util.UserUtils;
|
||||
import com.adc.da.slrs.SarStandItemVal.dao.SarStandItemValDao;
|
||||
import com.adc.da.slrs.SarStandItemVal.entity.SarStandItemVal;
|
||||
import com.adc.da.slrs.sarStandItems.dao.SarStandItemsDao;
|
||||
import com.adc.da.slrs.sarStandItems.entity.SarStandItems;
|
||||
import com.adc.da.slrs.standardSplit.dao.*;
|
||||
@@ -38,8 +40,6 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import static com.adc.da.utils.util.ExcelUtil.checkObjAllFieldsIsNull;
|
||||
@@ -81,6 +81,8 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
|
||||
@Autowired
|
||||
private SarStandItemsDao sarStandItemsDao;
|
||||
@Autowired
|
||||
private SarStandItemValDao sarStandItemValDao;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -1081,7 +1083,22 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
//加入的里面 删除旧的
|
||||
QueryWrapper<SarStandItems> objectQueryWrapper = new QueryWrapper<>();
|
||||
objectQueryWrapper.eq("STAND_ID",sarFileSplitInfoEO.getStandId());
|
||||
sarStandItemsDao.delete(objectQueryWrapper);
|
||||
List<SarStandItems> sarStandItemsList = sarStandItemsDao.selectList(objectQueryWrapper);
|
||||
if(!sarStandItemsList.isEmpty()){
|
||||
List<String> setIds = new ArrayList<>();
|
||||
for (SarStandItems sarStandItems:sarStandItemsList) {
|
||||
setIds.add(sarStandItems.getId());
|
||||
}
|
||||
if(!setIds.isEmpty()){
|
||||
//加入的里面 删除旧的
|
||||
QueryWrapper<SarStandItems> objectQueryWrapperDelete = new QueryWrapper<>();
|
||||
objectQueryWrapperDelete.in("ID",setIds);
|
||||
sarStandItemsDao.delete(objectQueryWrapperDelete);
|
||||
sarStandItemValDao.deleteByItemsIds(setIds);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//加入的里面
|
||||
for (SarFileSplitItemsEO itemsEO : addItemsEOList){
|
||||
if(itemsEO.getItemsNum().equals("总目录")) {
|
||||
@@ -1094,8 +1111,23 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
sarStandItems.setItemsName(itemsEO.getItemsName());
|
||||
sarStandItems.setTermsConditions(itemsEO.getItermsConditions());
|
||||
sarStandItems.setDutyEngineer(itemsEO.getDutyEngineer());
|
||||
sarStandItems.setId(UUIDUtils.randomUUID20());
|
||||
String uuId = UUIDUtils.randomUUID20();
|
||||
sarStandItems.setId(uuId);
|
||||
sarStandItemsDao.insert(sarStandItems);
|
||||
List<SarFileSplitItemsValEO> itemValEOList = itemsEO.getItemValEOList();
|
||||
if(!itemValEOList.isEmpty()){
|
||||
for (SarFileSplitItemsValEO itemsValEO: itemValEOList){
|
||||
SarStandItemVal sarStandItemVal = new SarStandItemVal();
|
||||
sarStandItemVal.setItemId(uuId);
|
||||
sarStandItemVal.setCreationTime(new Date());
|
||||
sarStandItemVal.setPropertyType(itemsValEO.getType());
|
||||
sarStandItemVal.setPropertyVal(itemsValEO.getItemContent());
|
||||
sarStandItemVal.setValidFlag(0);
|
||||
sarStandItemVal.setId(UUIDUtils.randomUUID20());
|
||||
sarStandItemValDao.insert(sarStandItemVal);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//统计成功结果需要去掉总目录这条数据
|
||||
String msg = "成功导入" + (countSuccess-1) + "条";
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
-- 福田数据库 表字段 记录 字典 等信息记录
|
||||
-- 2023-04-14 16:27 生产环境未同步
|
||||
-- 更改 sar_stand_item_val 表PROOERTY_VAL 类型 varchar 为 text
|
||||
|
||||
|
||||
Reference in New Issue
Block a user