|
@@ -43,6 +43,7 @@ import com.rtrh.projects.modules.utils.DateUtils;
|
|
|
import com.rtrh.projects.modules.utils.QualificationsDeclareCellWriteHandler;
|
|
|
import com.rtrh.projects.modules.utils.MyStringUtils;
|
|
|
import com.rtrh.projects.outapi.result.JsonResult;
|
|
|
+import com.rtrh.projects.web.util.ExcelStyleUtil;
|
|
|
import com.rtrh.projects.web.util.SheetData;
|
|
|
import com.rtrh.projects.web.util.SheetHead;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -874,16 +875,24 @@ public class SubInfoExportController extends BaseController {
|
|
|
Map<String, String> hyDictMap = subInduService.queryParentAll().stream().collect(Collectors.toMap(SubIndu::getCode, SubIndu::getTitle));
|
|
|
// 按行业分组
|
|
|
Map<String, List<SubInfoGxj>> groupMap = list.stream()
|
|
|
- .collect(Collectors.groupingBy(e -> StringUtils.defaultIfBlank(e.getIndusKind(), "未知行业")));
|
|
|
+ .collect(Collectors.groupingBy(e -> {
|
|
|
+ if (StringUtils.isNotBlank(e.getIndusKind())){
|
|
|
+ return e.getIndusKind().substring(0, 2);
|
|
|
+ }
|
|
|
+ return "未知行业";
|
|
|
+ }));
|
|
|
Workbook workbook;
|
|
|
if (SubInfoStatusEnum.CB.getCode().equals(queryVO.getStatus())) {
|
|
|
ExportParams exportParams = new ExportParams("“四个一批”工业项目表(储备项目库)", "储备项目库", ExcelType.XSSF);
|
|
|
+ exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
exportDetail(response, exportParams, SubInfoCbVO.class, list, hyDictMap, groupMap);
|
|
|
}else if (SubInfoStatusEnum.XJ.getCode().equals(queryVO.getStatus())){
|
|
|
ExportParams exportParams = new ExportParams("“四个一批”工业项目表(新建项目库)","新建项目库",ExcelType.XSSF);
|
|
|
+ exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
exportDetail(response, exportParams, SubInfoXjVO.class, list, hyDictMap, groupMap);
|
|
|
}else if (SubInfoStatusEnum.ZJ.getCode().equals(queryVO.getStatus())){
|
|
|
ExportParams exportParams = new ExportParams("“四个一批”工业项目表(在建项目库)","在建项目库",ExcelType.XSSF);
|
|
|
+ exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
exportDetail(response, exportParams, SubInfoZjVO.class, list, hyDictMap, groupMap);
|
|
|
}else if(SubInfoStatusEnum.TC.getCode().equals(queryVO.getStatus())) {
|
|
|
List<SubInfoTcVO> exportList = new ArrayList<>();
|
|
@@ -918,6 +927,8 @@ public class SubInfoExportController extends BaseController {
|
|
|
index++;
|
|
|
}
|
|
|
ExportParams exportParams = new ExportParams("“四个一批”工业项目表(投产项目库)","投产项目库",ExcelType.XSSF);
|
|
|
+ exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
+ // 设置默认样式(这里设置所有单元格都有边框)
|
|
|
workbook = ExcelExportUtil.exportExcel(exportParams, SubInfoTcVO.class, exportList);
|
|
|
extracted(response, list, workbook, allSize);
|
|
|
}else {
|
|
@@ -952,6 +963,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
index++;
|
|
|
}
|
|
|
ExportParams exportParams = new ExportParams("“四个一批”工业项目表(项目总库)", "项目总库", ExcelType.XSSF);
|
|
|
+ exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
workbook = ExcelExportUtil.exportExcel(exportParams, SubInfoZkVO.class, exportList);
|
|
|
// workbook = ExcelExportUtil.exportBigExcel(exportParams, SubInfoZkVO.class, new IExcelExportServer() {
|
|
|
// /**
|
|
@@ -1071,6 +1083,15 @@ public class SubInfoExportController extends BaseController {
|
|
|
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
return cellStyle;
|
|
|
}
|
|
|
+ private static CellStyle createBorderStyle(Workbook workbook) {
|
|
|
+ CellStyle cellStyle = workbook.createCellStyle();
|
|
|
+ cellStyle.setBorderBottom(BorderStyle.THIN); // 下边框
|
|
|
+ cellStyle.setBorderLeft(BorderStyle.THIN); // 左边框
|
|
|
+ cellStyle.setBorderTop(BorderStyle.THIN); // 上边框
|
|
|
+ cellStyle.setBorderRight(BorderStyle.THIN); // 右边框
|
|
|
+ return cellStyle;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
private ExcelExportEntity getExcelExportEntity(String name, Object key, int width) {
|
|
|
ExcelExportEntity excelExportEntity = new ExcelExportEntity(name, key, width);
|
|
@@ -1133,6 +1154,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
// 3.导出
|
|
|
ExportParams exportParams = new ExportParams("哈密市“四个一批”工业项目库总体情况", "项目库总体情况", ExcelType.XSSF);
|
|
|
+ exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, dataList);
|
|
|
response.setContentType("application/xlsx;charset=utf-8");
|
|
|
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncodeUtil.encode("项目库总体情况") + System.currentTimeMillis() + ".xlsx");
|
|
@@ -1222,6 +1244,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
exportData.add(new SubInfoTotalInfoVO("合计", "合计", list.size(), reduce.divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP)));
|
|
|
// 4.导出
|
|
|
ExportParams exportParams = new ExportParams("项目库基本情况","项目库基本情况", ExcelType.XSSF);
|
|
|
+ exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
int mergeTotalStartRow = exportData.size() + 1;
|
|
|
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, SubInfoTotalInfoVO.class, exportData);
|
|
|
response.setContentType("application/xlsx;charset=utf-8");
|