|
@@ -2,6 +2,7 @@ package com.rtrh.projects.web.controller.subject;
|
|
|
|
|
|
import cn.afterturn.easypoi.entity.BaseTypeConstants;
|
|
|
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
|
+import cn.afterturn.easypoi.excel.annotation.Excel;
|
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
|
@@ -112,6 +113,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
private ISubHisService subHisService;
|
|
|
@Autowired
|
|
|
private ISubPreGxjInfoService subPreGxjInfoService;
|
|
|
+
|
|
|
/**
|
|
|
* 导出汇总表
|
|
|
*
|
|
@@ -653,7 +655,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
try {
|
|
|
List<String> subjectIds = getSubjectIds();
|
|
|
- List<SubInfoTotalExcel> subInfoTotalExcel = subInfoService.getFixTotalExcel(vo,subjectIds);
|
|
|
+ List<SubInfoTotalExcel> subInfoTotalExcel = subInfoService.getFixTotalExcel(vo, subjectIds);
|
|
|
if (subInfoTotalExcel == null) {
|
|
|
subInfoTotalExcel = new ArrayList<>();
|
|
|
}
|
|
@@ -679,10 +681,10 @@ public class SubInfoExportController extends BaseController {
|
|
|
} else {
|
|
|
data.setInduskind(first.get().getTitle());
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
data.setInduskind("");
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
data.setInduskind("");
|
|
|
}
|
|
|
if (StringUtil.isNotEmpty(subjectId)) {
|
|
@@ -691,7 +693,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
data.setSubjectId("");
|
|
|
}
|
|
|
first.ifPresent(tSystable -> data.setSubjectId(tSystable.getTitle()));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
data.setSubjectId("");
|
|
|
}
|
|
|
//将金额由万元为单位转换为亿元为单位,并且保留两位小数,避免空指针异常
|
|
@@ -747,7 +749,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
LinkedHashMap<String, List<SubInfoTotalExcel>> industryList = subInfoTotalExcel.stream().collect(Collectors.groupingBy(SubInfoTotalExcel::getInduskind, LinkedHashMap::new, Collectors.toList()));
|
|
|
|
|
|
//遍历subInfoTotalExcel数据计算总金额
|
|
|
- BigDecimal totalAmt = subInfoTotalExcel.stream().map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO)).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal totalAmt = subInfoTotalExcel.stream().map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO)).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
Integer totalNum = subInfoTotalExcel.size();
|
|
|
|
|
|
LinkedHashMap<String, List<List<String>>> finalDataMap = new LinkedHashMap<>();
|
|
@@ -759,7 +761,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
data.add("按属地分");
|
|
|
data.add(subInfoListEntry.getKey());
|
|
|
data.add(String.valueOf(subInfoListEntry.getValue().size()));
|
|
|
- data.add(String.valueOf(subInfoListEntry.getValue().stream().map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO)).reduce(BigDecimal.ZERO, BigDecimal::add)));
|
|
|
+ data.add(String.valueOf(subInfoListEntry.getValue().stream().map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO)).reduce(BigDecimal.ZERO, BigDecimal::add)));
|
|
|
areaData.add(data);
|
|
|
}
|
|
|
finalDataMap.put("按属地划分", areaData);
|
|
@@ -771,7 +773,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
data.add("按规模划分");
|
|
|
data.add(subInfoListEntry.getKey());
|
|
|
data.add(String.valueOf(subInfoListEntry.getValue().size()));
|
|
|
- data.add(String.valueOf(subInfoListEntry.getValue().stream().map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO)).reduce(BigDecimal.ZERO, BigDecimal::add)));
|
|
|
+ data.add(String.valueOf(subInfoListEntry.getValue().stream().map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO)).reduce(BigDecimal.ZERO, BigDecimal::add)));
|
|
|
moneyData.add(data);
|
|
|
}
|
|
|
finalDataMap.put("按规模划分", moneyData);
|
|
@@ -783,7 +785,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
data.add("按行业分");
|
|
|
data.add(subInfoListEntry.getKey());
|
|
|
data.add(String.valueOf(subInfoListEntry.getValue().size()));
|
|
|
- data.add(String.valueOf(subInfoListEntry.getValue().stream().map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO)).reduce(BigDecimal.ZERO, BigDecimal::add)));
|
|
|
+ data.add(String.valueOf(subInfoListEntry.getValue().stream().map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO)).reduce(BigDecimal.ZERO, BigDecimal::add)));
|
|
|
industryData.add(data);
|
|
|
}
|
|
|
finalDataMap.put("按行业划分", industryData);
|
|
@@ -797,7 +799,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
for (Map.Entry<String, List<List<String>>> dataListEntry : finalDataMap.entrySet()) {
|
|
|
List<List<String>> dataList = dataListEntry.getValue();
|
|
|
- if (dataList != null && dataList.size() > 0){
|
|
|
+ if (dataList != null && dataList.size() > 0) {
|
|
|
int dataSize = dataList.size();
|
|
|
if (dataSize == 1) {
|
|
|
indexStart += dataSize;
|
|
@@ -850,6 +852,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// 将数字转换为中文数字的方法
|
|
|
public static String toChineseNumber(int num) {
|
|
|
String[] chineseDigits = {"", "一", "二", "三", "四", "五", "六", "七", "八", "九"};
|
|
@@ -879,7 +882,6 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 新建库 导出明细
|
|
|
- *
|
|
|
*/
|
|
|
@PostMapping("/exportNewDetailExcel")
|
|
|
public void exportNewDetailExcel(@RequestBody SubInfoQueryTzVO queryVO) {
|
|
@@ -890,7 +892,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
// 按行业分组
|
|
|
Map<String, List<SubInfoGxj>> groupMap = list.stream()
|
|
|
.collect(Collectors.groupingBy(e -> {
|
|
|
- if (StringUtils.isNotBlank(e.getIndusKind())){
|
|
|
+ if (StringUtils.isNotBlank(e.getIndusKind())) {
|
|
|
return e.getIndusKind().substring(0, 2);
|
|
|
}
|
|
|
return "未知行业";
|
|
@@ -899,9 +901,9 @@ public class SubInfoExportController extends BaseController {
|
|
|
List<SubPreNew> subPreNewList = subPreNewService.findList();
|
|
|
Map<String, List<SubPreNew>> subIdGroups = subPreNewList.stream().collect(Collectors.groupingBy(SubPreNew::getSubId));
|
|
|
// 查询工信局设置的手续
|
|
|
- Map<String, SubInfoPreNewVO> collect = subPreGxjInfoService.getGxjPreNewInfoList();
|
|
|
+ Map<String, PreInfoVO> collect = subPreGxjInfoService.getNewPreNewList();
|
|
|
|
|
|
- ExportParams exportParams = new ExportParams("“四个一批”工业项目表(新建项目库)","新建项目库",ExcelType.XSSF);
|
|
|
+ ExportParams exportParams = new ExportParams("“四个一批”工业项目表(新建项目库)", "新建项目库", ExcelType.XSSF);
|
|
|
exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
|
|
|
List<SubInfoXjVO> exportList = new ArrayList<>();
|
|
@@ -931,43 +933,25 @@ public class SubInfoExportController extends BaseController {
|
|
|
BeanUtils.copyProperties(subInfoGxj, vo);
|
|
|
vo.setAmtTotal(convertAmount(subInfoGxj.getAmtTotal()));
|
|
|
vo.setIndex(i + 1 + "");
|
|
|
- SubInfoXjVO.PreNewInfo preNewInfo = new SubInfoXjVO.PreNewInfo();
|
|
|
+ // SubInfoXjVO.PreNewInfo preNewInfo = new SubInfoXjVO.PreNewInfo();
|
|
|
+ PreNewConGxjVO preNewInfo = new PreNewConGxjVO();
|
|
|
vo.setPreNewInfo(Collections.singletonList(preNewInfo));
|
|
|
+ // 前期手续
|
|
|
List<SubPreNew> preNews = subIdGroups.get(subInfoGxj.getSubId());
|
|
|
- SubInfoPreNewVO subInfoPreNewVO = collect.get(subInfoGxj.getSubId());
|
|
|
-
|
|
|
- if (CollUtil.isNotEmpty(preNews)){
|
|
|
- preNews.forEach(e -> {
|
|
|
- if ("3".equals(e.getPreFlowId()) || "5".equals(e.getPreFlowId())) {
|
|
|
- preNewInfo.setRecord(e.getDateConfirm() != null ? e.getDateConfirm() :subInfoPreNewVO!=null? subInfoPreNewVO.getRecord():null); // 备案核准
|
|
|
- } else if ("2".equals(e.getPreFlowId())) {
|
|
|
- preNewInfo.setPrePlan(e.getDateConfirm() != null ? e.getDateConfirm() : subInfoPreNewVO == null ? null : subInfoPreNewVO.getPrePlan()); // 用地预审与选址意见书
|
|
|
- } else if ("13".equals(e.getPreFlowId())) {
|
|
|
- preNewInfo.setProPlanPermit(e.getDateConfirm()!= null ? e.getDateConfirm() : subInfoPreNewVO== null ? null : subInfoPreNewVO.getProPlanPermit()); // 建设工程规划许可证
|
|
|
- } else if ("14".equals(e.getPreFlowId())) {
|
|
|
- preNewInfo.setWorkPermit(e.getDateConfirm()!= null ? e.getDateConfirm() : subInfoPreNewVO== null ? null : subInfoPreNewVO.getWorkPermit()); // 施工许可证
|
|
|
- }else if ("10".equals(e.getPreFlowId())){
|
|
|
- preNewInfo.setEnvPlan(e.getDateConfirm()!= null ? e.getDateConfirm() : subInfoPreNewVO== null ? null : subInfoPreNewVO.getEnvPlan()); // 环评
|
|
|
- }else if ("9".equals(e.getPreFlowId())){
|
|
|
- preNewInfo.setEnergyPlan(e.getDateConfirm()!= null ? e.getDateConfirm() : subInfoPreNewVO== null ? null : subInfoPreNewVO.getEnergyPlan()); // 能评
|
|
|
- }else if ("11".equals(e.getPreFlowId())){
|
|
|
- preNewInfo.setSafePlan(e.getDateConfirm()!= null ? e.getDateConfirm() : subInfoPreNewVO== null ? null : subInfoPreNewVO.getSafePlan()); // 安评
|
|
|
- }else if ("19".equals(e.getPreFlowId())){
|
|
|
- preNewInfo.setSoilPlan(e.getDateConfirm()!= null ? e.getDateConfirm() : subInfoPreNewVO== null ? null : subInfoPreNewVO.getSoilPlan()); // 生产建设项目水土保持方案审批
|
|
|
- }else if ("7".equals(e.getPreFlowId())){
|
|
|
- preNewInfo.setPlanPermit(e.getDateConfirm()!= null ? e.getDateConfirm() : subInfoPreNewVO== null ? null : subInfoPreNewVO.getPlanPermit()); // 建设用地规划许可证
|
|
|
- }else if ("15".equals(e.getPreFlowId())){
|
|
|
- preNewInfo.setUnionPlanPermit(e.getDateConfirm()!= null ? e.getDateConfirm() : subInfoPreNewVO== null ? null : subInfoPreNewVO.getUnionPlanPermit()); // 施工图联合审查
|
|
|
- }
|
|
|
- });
|
|
|
- }else {
|
|
|
- if (subInfoPreNewVO != null){
|
|
|
- BeanUtils.copyProperties(subInfoPreNewVO, preNewInfo);
|
|
|
+ // 工信局设置的前期手续时间
|
|
|
+ PreInfoVO subInfoPreNewVO = collect.get(subInfoGxj.getSubId());
|
|
|
+
|
|
|
+ if (subInfoPreNewVO != null) {
|
|
|
+ BeanUtils.copyProperties(subInfoPreNewVO, preNewInfo);
|
|
|
+ }
|
|
|
+ if (CollUtil.isNotEmpty(preNews)) {
|
|
|
+ for (SubPreNew preNew : preNews) {
|
|
|
+ preNewInfo.fillDatePreByCode(preNew.getPreFlowId(), preNew.getDateConfirm());
|
|
|
}
|
|
|
}
|
|
|
hyList.add(vo);
|
|
|
}
|
|
|
- // 添加前计算行业类型合并行
|
|
|
+ // 行业类型合并行
|
|
|
allSize.add(exportList.size() + 3);
|
|
|
// 合计(832个)行
|
|
|
allSize.add(3);
|
|
@@ -990,13 +974,13 @@ public class SubInfoExportController extends BaseController {
|
|
|
// 按行业分组
|
|
|
Map<String, List<SubInfoGxj>> groupMap = list.stream()
|
|
|
.collect(Collectors.groupingBy(e -> {
|
|
|
- if (StringUtils.isNotBlank(e.getIndusKind())){
|
|
|
+ if (StringUtils.isNotBlank(e.getIndusKind())) {
|
|
|
return e.getIndusKind().substring(0, 2);
|
|
|
}
|
|
|
return "未知行业";
|
|
|
}));
|
|
|
|
|
|
- ExportParams exportParams = new ExportParams("“四个一批”工业项目表(在建项目库)","在建项目库",ExcelType.XSSF);
|
|
|
+ ExportParams exportParams = new ExportParams("“四个一批”工业项目表(在建项目库)", "在建项目库", ExcelType.XSSF);
|
|
|
exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
List<SubInfoZjVO> exportList = new ArrayList<>();
|
|
|
// 合计行
|
|
@@ -1032,13 +1016,13 @@ public class SubInfoExportController extends BaseController {
|
|
|
vo.setIndex(i + 1 + "");
|
|
|
|
|
|
// 每月完成工程量
|
|
|
- List<RptCont> subRptConts = rptContGroup.getOrDefault(subInfoGxj.getSubId(),new ArrayList<>());
|
|
|
+ List<RptCont> subRptConts = rptContGroup.getOrDefault(subInfoGxj.getSubId(), new ArrayList<>());
|
|
|
|
|
|
SubInfoZjVO.MonthNumBl monthNumBl = new SubInfoZjVO.MonthNumBl();
|
|
|
|
|
|
Map<String, BigDecimal> map = subRptConts.stream()
|
|
|
.filter(Objects::nonNull)
|
|
|
- .filter(e->StringUtils.isNotBlank(e.getKjMonth()))
|
|
|
+ .filter(e -> StringUtils.isNotBlank(e.getKjMonth()))
|
|
|
.collect(Collectors.toMap(RptCont::getKjMonth, e -> Optional.ofNullable(e.getNumBl()).orElse(BigDecimal.ZERO), (a, b) -> a));
|
|
|
monthNumBl.setMonth1(map.getOrDefault(DateUtil.thisYear() + "01", BigDecimal.ZERO) + "%");
|
|
|
monthNumBl.setMonth2(map.getOrDefault(DateUtil.thisYear() + "02", BigDecimal.ZERO) + "%");
|
|
@@ -1063,7 +1047,8 @@ public class SubInfoExportController extends BaseController {
|
|
|
index++;
|
|
|
}
|
|
|
// 构建表头
|
|
|
- List<ExcelExportEntity> entityList = new ArrayList<ExcelExportEntity>(){{
|
|
|
+ List<ExcelExportEntity> entityList = new ArrayList<ExcelExportEntity>() {{
|
|
|
+ add(new ExcelExportEntity("id", "id", 0));
|
|
|
add(new ExcelExportEntity("序号", "index", 12));
|
|
|
add(new ExcelExportEntity("项目名称", "subName", 20));
|
|
|
add(new ExcelExportEntity("项目所在地", "subjectName", 15));
|
|
@@ -1072,7 +1057,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
add(new ExcelExportEntity("建成投产时间", "endDate", 15));
|
|
|
|
|
|
ExcelExportEntity monthNumBlEntity = new ExcelExportEntity(year + "年1-12月项目工程进度(每月完成工程量)", "monthNumBlList", 12);
|
|
|
- List<ExcelExportEntity> subHeadEntities = new ArrayList<ExcelExportEntity>(){{
|
|
|
+ List<ExcelExportEntity> subHeadEntities = new ArrayList<ExcelExportEntity>() {{
|
|
|
add(new ExcelExportEntity("1月", "month1"));
|
|
|
add(new ExcelExportEntity("2月", "month2"));
|
|
|
add(new ExcelExportEntity("3月", "month3"));
|
|
@@ -1089,13 +1074,17 @@ public class SubInfoExportController extends BaseController {
|
|
|
monthNumBlEntity.setList(subHeadEntities);
|
|
|
add(monthNumBlEntity);
|
|
|
|
|
|
+ add(new ExcelExportEntity("产值", "amtCz", 12));
|
|
|
+ add(new ExcelExportEntity("增加值", "amtZjz", 12));
|
|
|
+ add(new ExcelExportEntity("税收", "amtSs", 12));
|
|
|
+ add(new ExcelExportEntity("解决就业人数", "numP", 12));
|
|
|
add(new ExcelExportEntity("年度投资(亿元)", "yearPlanAmt", 12));
|
|
|
add(new ExcelExportEntity("进展情况", "progress", 30));
|
|
|
add(new ExcelExportEntity("牵头部门", "deptName", 30));
|
|
|
add(new ExcelExportEntity("责任领导", "leader", 15));
|
|
|
add(new ExcelExportEntity("备注", "remark", 15));
|
|
|
}};
|
|
|
- List<Map<String, Object>> collect = exportList.stream().map(e->{
|
|
|
+ List<Map<String, Object>> collect = exportList.stream().map(e -> {
|
|
|
Map<String, Object> map = BeanUtil.beanToMap(e);
|
|
|
Object o = map.get("endDate");
|
|
|
if (o != null) {
|
|
@@ -1110,7 +1099,6 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 4库/总库 导出明细
|
|
|
- *
|
|
|
*/
|
|
|
@PostMapping("/exportDetailExcel")
|
|
|
public void exportDetailExcel(@RequestBody SubInfoQueryTzVO queryVO) {
|
|
@@ -1118,9 +1106,9 @@ public class SubInfoExportController extends BaseController {
|
|
|
try {
|
|
|
if (SubInfoStatusEnum.CB.getCode().equals(queryVO.getStatus())) {
|
|
|
exportCbDetailExcel(queryVO);
|
|
|
- }else if (SubInfoStatusEnum.XJ.getCode().equals(queryVO.getStatus())){
|
|
|
+ } else if (SubInfoStatusEnum.XJ.getCode().equals(queryVO.getStatus())) {
|
|
|
exportNewDetailExcel(queryVO);
|
|
|
- }else if (SubInfoStatusEnum.ZJ.getCode().equals(queryVO.getStatus())){
|
|
|
+ } else if (SubInfoStatusEnum.ZJ.getCode().equals(queryVO.getStatus())) {
|
|
|
exportMainDetailExcel(queryVO);
|
|
|
} else if (SubInfoStatusEnum.TC.getCode().equals(queryVO.getStatus())) {
|
|
|
exportTcDetailExcel(queryVO);
|
|
@@ -1140,25 +1128,30 @@ public class SubInfoExportController extends BaseController {
|
|
|
@PostMapping("/exportProcedureExcel")
|
|
|
public void exportProcedureExcel(@RequestBody SubInfoQueryTzVO queryVO) {
|
|
|
queryVO.setSubjectAuthIds(getSubjectIds());
|
|
|
- List<SubInfoGxj> list = subInfoQueryService.queryAll(getCurUser().getLoginUser(), queryVO);
|
|
|
+ List<PreInfoVO> list = subPreGxjInfoService.queryAllPreInfoAndCon(getCurUser().getLoginUser(), queryVO);
|
|
|
+
|
|
|
+ // List<SubInfoGxj> list = subInfoQueryService.queryAll(getCurUser().getLoginUser(), queryVO);
|
|
|
// 查询工信局设置的手续
|
|
|
- Map<String, SubInfoPreNewVO> collect = subPreGxjInfoService.getGxjPreNewInfoList();
|
|
|
+ // Map<String, SubInfoPreNewVO> collect = subPreGxjInfoService.getGxjPreNewInfoList();
|
|
|
|
|
|
- ExportParams exportParams = new ExportParams("手续明细","手续明细",ExcelType.XSSF);
|
|
|
+ ExportParams exportParams = new ExportParams("手续明细", "手续明细", ExcelType.XSSF);
|
|
|
exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
|
|
|
List<SubInfoProcedureVO> exportList = new ArrayList<>();
|
|
|
int index = 1;
|
|
|
- for (SubInfoGxj subInfoGxj : list) {
|
|
|
+ for (PreInfoVO subInfoGxj : list) {
|
|
|
SubInfoProcedureVO vo = new SubInfoProcedureVO();
|
|
|
+ PreNewConGxjVO conVo = new PreNewConGxjVO();
|
|
|
BeanUtil.copyProperties(subInfoGxj, vo);
|
|
|
+ BeanUtil.copyProperties(subInfoGxj, conVo);
|
|
|
+ vo.setPreNewInfo(conVo);
|
|
|
vo.setAmtTotal(convertAmount(subInfoGxj.getAmtTotal()));
|
|
|
vo.setIndex(String.valueOf(index++));
|
|
|
// 手续
|
|
|
- SubInfoPreNewVO subInfoPreNewVO = collect.get(subInfoGxj.getSubId());
|
|
|
- if (subInfoPreNewVO != null) {
|
|
|
- BeanUtils.copyProperties(subInfoPreNewVO, vo);
|
|
|
- }
|
|
|
+ // SubInfoPreNewVO subInfoPreNewVO = collect.get(subInfoGxj.getSubId());
|
|
|
+ // if (subInfoPreNewVO != null) {
|
|
|
+ // BeanUtils.copyProperties(subInfoPreNewVO, vo);
|
|
|
+ // }
|
|
|
exportList.add(vo);
|
|
|
}
|
|
|
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, SubInfoProcedureVO.class, exportList);
|
|
@@ -1173,7 +1166,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
try (OutputStream outputStream = response.getOutputStream()) {
|
|
|
workbook.write(outputStream);
|
|
|
workbook.close();
|
|
|
- }catch (IOException e) {
|
|
|
+ } catch (IOException e) {
|
|
|
// 处理 IO 异常
|
|
|
handleErrorResponse(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "导出 Excel 文件时出现错误:" + e.getMessage());
|
|
|
} catch (Exception e) {
|
|
@@ -1194,7 +1187,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
// 按行业分组
|
|
|
Map<String, List<SubInfoGxj>> groupMap = list.stream()
|
|
|
.collect(Collectors.groupingBy(e -> {
|
|
|
- if (StringUtils.isNotBlank(e.getIndusKind())){
|
|
|
+ if (StringUtils.isNotBlank(e.getIndusKind())) {
|
|
|
return e.getIndusKind().substring(0, 2);
|
|
|
}
|
|
|
return "未知行业";
|
|
@@ -1251,7 +1244,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
// 按行业分组
|
|
|
Map<String, List<SubInfoGxj>> groupMap = list.stream()
|
|
|
.collect(Collectors.groupingBy(e -> {
|
|
|
- if (StringUtils.isNotBlank(e.getIndusKind())){
|
|
|
+ if (StringUtils.isNotBlank(e.getIndusKind())) {
|
|
|
return e.getIndusKind().substring(0, 2);
|
|
|
}
|
|
|
return "未知行业";
|
|
@@ -1307,7 +1300,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
// 按行业分组
|
|
|
Map<String, List<SubInfoGxj>> groupMap = list.stream()
|
|
|
.collect(Collectors.groupingBy(e -> {
|
|
|
- if (StringUtils.isNotBlank(e.getIndusKind())){
|
|
|
+ if (StringUtils.isNotBlank(e.getIndusKind())) {
|
|
|
return e.getIndusKind().substring(0, 2);
|
|
|
}
|
|
|
return "未知行业";
|
|
@@ -1385,7 +1378,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
SubInfoStatusEnum anEnum = SubInfoStatusEnum.getEnum(key);
|
|
|
String statusRate = new BigDecimal(value.size()).multiply(new BigDecimal(100)).divide(new BigDecimal(list.size()), 2, RoundingMode.HALF_UP) + "%";
|
|
|
BigDecimal totalAmt = value.stream()
|
|
|
- .map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
+ .map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(10000), 2, RoundingMode.HALF_UP);
|
|
|
String format = String.format("%s项目%s个,占工业项目总数的%s,计划总投资%s亿元;", anEnum.getDesc(), value.size(), statusRate, totalAmt);
|
|
|
statusStrBuilder.append(format);
|
|
@@ -1399,7 +1392,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
subjectGroupList.forEach((key, value) -> {
|
|
|
String rate = new BigDecimal(value.size()).multiply(new BigDecimal(100)).divide(new BigDecimal(list.size()), 2, RoundingMode.HALF_UP) + "%";
|
|
|
BigDecimal totalAmt = value.stream()
|
|
|
- .map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
+ .map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(10000), 2, RoundingMode.HALF_UP);
|
|
|
String format = String.format("%s%s个,占工业项目总数的%s,计划总投资%s亿元;", jsddMap.get(key), value.size(), rate, totalAmt);
|
|
|
subjectStrBuilder.append(format);
|
|
@@ -1415,7 +1408,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
groupBoundaries.put("50-100亿元", new BigDecimal("1000000"));
|
|
|
Map<String, List<SubInfoTotalExcel>> scaleGroupList = list.stream().collect(Collectors.groupingBy(transaction -> {
|
|
|
for (Map.Entry<String, BigDecimal> entry : groupBoundaries.entrySet()) {
|
|
|
- if ((transaction.getAmtTotal() == null?BigDecimal.ZERO:transaction.getAmtTotal()).compareTo(entry.getValue()) < 0) {
|
|
|
+ if ((transaction.getAmtTotal() == null ? BigDecimal.ZERO : transaction.getAmtTotal()).compareTo(entry.getValue()) < 0) {
|
|
|
return entry.getKey();
|
|
|
}
|
|
|
}
|
|
@@ -1424,7 +1417,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
scaleGroupList.forEach((key, value) -> {
|
|
|
String rate = new BigDecimal(value.size()).multiply(new BigDecimal(100)).divide(new BigDecimal(list.size()), 2, RoundingMode.HALF_UP) + "%";
|
|
|
BigDecimal totalAmt = value.stream()
|
|
|
- .map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
+ .map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(10000), 2, RoundingMode.HALF_UP);
|
|
|
String format = String.format("计划总投资%s项目%s个,占工业项目总数的%s,计划总投资%s亿元;", key, value.size(), rate, totalAmt);
|
|
|
scaleStrBuilder.append(format);
|
|
@@ -1446,7 +1439,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
hyGroupList.forEach((key, value) -> {
|
|
|
String rate = new BigDecimal(value.size()).multiply(new BigDecimal(100)).divide(new BigDecimal(list.size()), 2, RoundingMode.HALF_UP) + "%";
|
|
|
BigDecimal totalAmt = value.stream()
|
|
|
- .map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
+ .map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(10000), 2, RoundingMode.HALF_UP);
|
|
|
String format = String.format("%s项目%s个,占工业项目总数的%s,计划总投资%s亿元;", hyflMap.getOrDefault(key, key), value.size(), rate, totalAmt);
|
|
|
hyStrBuilder.append(format);
|
|
@@ -1461,7 +1454,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
List<LogOperateVO> logList = logOperateService.queryByYear(year);
|
|
|
String preText = String.format("%s年1-%s月,", year, month);
|
|
|
- StringBuilder s = buildZhParagraph(preText, logList, month,lastMonth,subHisList,currSubInfoList);
|
|
|
+ StringBuilder s = buildZhParagraph(preText, logList, month, lastMonth, subHisList, currSubInfoList);
|
|
|
data.put("mainZhStr", s);
|
|
|
|
|
|
// 分属地看
|
|
@@ -1471,32 +1464,32 @@ public class SubInfoExportController extends BaseController {
|
|
|
StringBuilder subjectZhStr = new StringBuilder();
|
|
|
subjectZhGroups.forEach((key, value) -> {
|
|
|
String tempPreText = String.format("%s年1-%s月,%s", year, month, jsddMap.get(key));
|
|
|
- StringBuilder s1 = buildZhParagraph(tempPreText, value, month, lastMonth, hisSubjectGroups.getOrDefault(key,new ArrayList<>()), currSubjectGroups.getOrDefault(key,new ArrayList<>()));
|
|
|
+ StringBuilder s1 = buildZhParagraph(tempPreText, value, month, lastMonth, hisSubjectGroups.getOrDefault(key, new ArrayList<>()), currSubjectGroups.getOrDefault(key, new ArrayList<>()));
|
|
|
subjectZhStr.append(s1);
|
|
|
});
|
|
|
data.put("subjectZhStr", subjectZhStr);
|
|
|
|
|
|
// 分规模看
|
|
|
Map<String, List<SubHisVO>> hisScaleGroups = subHisList.stream()
|
|
|
- .collect(Collectors.groupingBy(transaction -> {
|
|
|
- for (Map.Entry<String, BigDecimal> entry : groupBoundaries.entrySet()) {
|
|
|
- if (transaction.getAmtTotal().compareTo(entry.getValue()) < 0) {
|
|
|
- return entry.getKey();
|
|
|
- }
|
|
|
- }
|
|
|
- return "100亿元以上";
|
|
|
- })
|
|
|
- );
|
|
|
+ .collect(Collectors.groupingBy(transaction -> {
|
|
|
+ for (Map.Entry<String, BigDecimal> entry : groupBoundaries.entrySet()) {
|
|
|
+ if (transaction.getAmtTotal().compareTo(entry.getValue()) < 0) {
|
|
|
+ return entry.getKey();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "100亿元以上";
|
|
|
+ })
|
|
|
+ );
|
|
|
Map<String, List<SubInfoGxj>> currScaleGroups = currSubInfoList.stream()
|
|
|
- .collect(Collectors.groupingBy(transaction -> {
|
|
|
- for (Map.Entry<String, BigDecimal> entry : groupBoundaries.entrySet()) {
|
|
|
- if (transaction.getAmtTotal().compareTo(entry.getValue()) < 0) {
|
|
|
- return entry.getKey();
|
|
|
- }
|
|
|
- }
|
|
|
- return "100亿元以上";
|
|
|
- })
|
|
|
- );
|
|
|
+ .collect(Collectors.groupingBy(transaction -> {
|
|
|
+ for (Map.Entry<String, BigDecimal> entry : groupBoundaries.entrySet()) {
|
|
|
+ if (transaction.getAmtTotal().compareTo(entry.getValue()) < 0) {
|
|
|
+ return entry.getKey();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "100亿元以上";
|
|
|
+ })
|
|
|
+ );
|
|
|
Map<String, List<LogOperateVO>> scaleZhGroups = logList.stream().collect(Collectors.groupingBy(transaction -> {
|
|
|
for (Map.Entry<String, BigDecimal> entry : groupBoundaries.entrySet()) {
|
|
|
if (transaction.getAmtTotal().compareTo(entry.getValue()) < 0) {
|
|
@@ -1508,7 +1501,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
StringBuilder scaleZhStr = new StringBuilder();
|
|
|
scaleZhGroups.forEach((key, value) -> {
|
|
|
String tempPreText = String.format("%s年1-%s月,%s", year, month, "计划总投资" + key);
|
|
|
- StringBuilder s1 = buildZhParagraph(tempPreText, value, month, lastMonth, hisScaleGroups.getOrDefault(key,CollUtil.newArrayList()), currScaleGroups.getOrDefault(key,CollUtil.newArrayList()));
|
|
|
+ StringBuilder s1 = buildZhParagraph(tempPreText, value, month, lastMonth, hisScaleGroups.getOrDefault(key, CollUtil.newArrayList()), currScaleGroups.getOrDefault(key, CollUtil.newArrayList()));
|
|
|
scaleZhStr.append(s1);
|
|
|
});
|
|
|
data.put("scaleZhStr", scaleZhStr);
|
|
@@ -1544,7 +1537,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
StringBuilder hyZhStr = new StringBuilder();
|
|
|
hyZhGroups.forEach((key, value) -> {
|
|
|
String tempPreText = String.format("%s年1-%s月,%s", year, month, hyflMap.get(key));
|
|
|
- StringBuilder s1 = buildZhParagraph(tempPreText, value, month,lastMonth, hisHyGroups.getOrDefault(key,CollUtil.newArrayList()), currHyGroups.getOrDefault(key,CollUtil.newArrayList()));
|
|
|
+ StringBuilder s1 = buildZhParagraph(tempPreText, value, month, lastMonth, hisHyGroups.getOrDefault(key, CollUtil.newArrayList()), currHyGroups.getOrDefault(key, CollUtil.newArrayList()));
|
|
|
scaleZhStr.append(s1);
|
|
|
});
|
|
|
data.put("hyZhStr", hyZhStr);
|
|
@@ -1577,12 +1570,12 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
WordExportUtil.exportWord07(word, data);
|
|
|
addBreakInCell(word.getParagraphs());
|
|
|
- response.setHeader("content-disposition","attachment;filename="+new String("analysis".getBytes(),"ISO8859-1"));
|
|
|
+ response.setHeader("content-disposition", "attachment;filename=" + new String("analysis".getBytes(), "ISO8859-1"));
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
|
|
word.write(response.getOutputStream());
|
|
|
}
|
|
|
|
|
|
- private StringBuilder buildZhParagraph(String preText, List<LogOperateVO> value, int month,int lastMonth, List<SubHisVO> subHisVOList, List<SubInfoGxj> subInfoGxjList) {
|
|
|
+ private StringBuilder buildZhParagraph(String preText, List<LogOperateVO> value, int month, int lastMonth, List<SubHisVO> subHisVOList, List<SubInfoGxj> subInfoGxjList) {
|
|
|
StringBuilder zhStrBuilder = new StringBuilder().append("\t");
|
|
|
StatusChangeCountersVO tempVo = new StatusChangeCountersVO();
|
|
|
addNum(value, tempVo);
|
|
@@ -1601,7 +1594,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
AtomicReference<Long> rgNum = new AtomicReference<>(0L);
|
|
|
Map<String, Long> collect = subInfoGxjList.stream()
|
|
|
.peek(subInfoGxj -> {
|
|
|
- if (subInfoGxj.getBoolRg()){
|
|
|
+ if (subInfoGxj.getBoolRg()) {
|
|
|
rgNum.set(rgNum.get() + 1);
|
|
|
}
|
|
|
})
|
|
@@ -1614,9 +1607,9 @@ public class SubInfoExportController extends BaseController {
|
|
|
BigDecimal tcl = BigDecimal.ZERO;
|
|
|
BigDecimal rgl = BigDecimal.ZERO;
|
|
|
if (fm.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
- kgl = new BigDecimal((zjNum + tcNum) * 100).divide(fm, 2, RoundingMode.HALF_UP);
|
|
|
- tcl = new BigDecimal(tcNum * 100).divide(fm, 2, RoundingMode.HALF_UP);
|
|
|
- rgl = new BigDecimal(rgNum.get() * 100).divide(fm, 2, RoundingMode.HALF_UP);
|
|
|
+ kgl = new BigDecimal((zjNum + tcNum) * 100).divide(fm, 2, RoundingMode.HALF_UP);
|
|
|
+ tcl = new BigDecimal(tcNum * 100).divide(fm, 2, RoundingMode.HALF_UP);
|
|
|
+ rgl = new BigDecimal(rgNum.get() * 100).divide(fm, 2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
|
|
|
Map<String, Long> statusNumMap = subHisVOList.stream().collect(Collectors.groupingBy(SubHisVO::getStatus, Collectors.counting()));
|
|
@@ -1668,11 +1661,11 @@ public class SubInfoExportController extends BaseController {
|
|
|
public static void addBreakInCell(List<XWPFParagraph> paragraphs) {
|
|
|
for (XWPFParagraph p : paragraphs) {
|
|
|
for (XWPFRun run : p.getRuns()) {//XWPFRun对象定义具有一组公共属性的文本区域
|
|
|
- if(run.getText(0)!= null && run.getText(0).contains("\n")) {
|
|
|
+ if (run.getText(0) != null && run.getText(0).contains("\n")) {
|
|
|
String[] lines = run.getText(0).split("\n");
|
|
|
- if(lines.length > 0) {
|
|
|
+ if (lines.length > 0) {
|
|
|
run.setText(lines[0], 0); // set first line into XWPFRun
|
|
|
- for(int i=1;i<lines.length;i++){
|
|
|
+ for (int i = 1; i < lines.length; i++) {
|
|
|
// add break and insert new text
|
|
|
run.addBreak();//中断
|
|
|
// run.addCarriageReturn();//回车符,但是不起作用
|
|
@@ -1702,7 +1695,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
// 获取数据
|
|
|
List<String> subjectIds = getSubjectIds();
|
|
|
- List<SmzkDetailVo> subInfoTotalExcel = subInfoService.exportSmzkDetailExcel(vo,subjectIds);
|
|
|
+ List<SmzkDetailVo> subInfoTotalExcel = subInfoService.exportSmzkDetailExcel(vo, subjectIds);
|
|
|
|
|
|
// 写入标题行
|
|
|
writer.writeHeadRow(CollUtil.newArrayList("“四个一批”工业项目表(项目总库)"));
|
|
@@ -1729,7 +1722,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
// 设置单元格样式
|
|
|
SXSSFWorkbook workbook = (SXSSFWorkbook) writer.getWorkbook();
|
|
|
SXSSFSheet sheet = workbook.getSheetAt(0);
|
|
|
- CellStyle cellStyle=writer.getStyleSet().getCellStyle();
|
|
|
+ CellStyle cellStyle = writer.getStyleSet().getCellStyle();
|
|
|
cellStyle.setWrapText(true);
|
|
|
cellStyle.setAlignment(HorizontalAlignment.LEFT);
|
|
|
|
|
@@ -1788,7 +1781,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private <K extends SubInfoBaseDetailVo> void exportDetail(HttpServletResponse response,ExportParams exportParams,Class<K> clazz, List<SubInfoGxj> list, Map<String, String> hyDictMap, Map<String, List<SubInfoGxj>> groupMap) {
|
|
|
+ private <K extends SubInfoBaseDetailVo> void exportDetail(HttpServletResponse response, ExportParams exportParams, Class<K> clazz, List<SubInfoGxj> list, Map<String, String> hyDictMap, Map<String, List<SubInfoGxj>> groupMap) {
|
|
|
List<K> exportList = new ArrayList<>();
|
|
|
// 合计行
|
|
|
K hjCount = BeanUtils.instantiateClass(clazz);
|
|
@@ -1859,7 +1852,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
try (OutputStream outputStream = response.getOutputStream()) {
|
|
|
workbook.write(outputStream);
|
|
|
workbook.close();
|
|
|
- }catch (IOException e) {
|
|
|
+ } catch (IOException e) {
|
|
|
// 处理 IO 异常
|
|
|
handleErrorResponse(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "导出 Excel 文件时出现错误:" + e.getMessage());
|
|
|
} catch (Exception e) {
|
|
@@ -1885,6 +1878,7 @@ 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); // 下边框
|
|
@@ -1946,7 +1940,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
jsddMap.getOrDefault(entry.getKey(), entry.getKey()),
|
|
|
entry.getValue().size(),
|
|
|
entry.getValue().stream()
|
|
|
- .map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
+ .map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add)
|
|
|
.divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP)
|
|
|
))
|
|
@@ -1986,7 +1980,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
entry.getKey(),
|
|
|
entry.getValue().size(),
|
|
|
entry.getValue().stream()
|
|
|
- .map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
+ .map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add)
|
|
|
.divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP)
|
|
|
))
|
|
@@ -2020,7 +2014,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
hyflMap.getOrDefault(entry.getKey(), entry.getKey()),
|
|
|
entry.getValue().size(),
|
|
|
entry.getValue().stream()
|
|
|
- .map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
+ .map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add)
|
|
|
.divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP)
|
|
|
)
|
|
@@ -2041,21 +2035,21 @@ public class SubInfoExportController extends BaseController {
|
|
|
exportData.addAll(amtList);
|
|
|
exportData.addAll(hyList);
|
|
|
BigDecimal reduce = list.stream()
|
|
|
- .map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
+ .map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
exportData.add(new SubInfoTotalInfoVO("合计", "合计", list.size(), reduce.divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP)));
|
|
|
// 4.导出
|
|
|
ExportParams exportParams = null;
|
|
|
- if (vo.getStatus().equals("1")){
|
|
|
- exportParams = new ExportParams("“四个一批”储备项目库基本情况","“四个一批”储备项目库基本情况", ExcelType.XSSF);
|
|
|
- }else if (vo.getStatus().equals("2")){
|
|
|
- exportParams = new ExportParams("“四个一批”新建项目库基本情况","“四个一批”新建项目库基本情况", ExcelType.XSSF);
|
|
|
- }else if (vo.getStatus().equals("3")){
|
|
|
- exportParams = new ExportParams("“四个一批”在建项目库基本情况","“四个一批”在建项目库基本情况", ExcelType.XSSF);
|
|
|
- }else if (vo.getStatus().equals("9")){
|
|
|
- exportParams = new ExportParams("“四个一批”投产库基本情况","“四个一批”投产库基本情况", ExcelType.XSSF);
|
|
|
- }else {
|
|
|
- exportParams = new ExportParams("“四个一批”项目库基本情况","“四个一批”项目库基本情况", ExcelType.XSSF);
|
|
|
+ if (vo.getStatus().equals("1")) {
|
|
|
+ exportParams = new ExportParams("“四个一批”储备项目库基本情况", "“四个一批”储备项目库基本情况", ExcelType.XSSF);
|
|
|
+ } else if (vo.getStatus().equals("2")) {
|
|
|
+ exportParams = new ExportParams("“四个一批”新建项目库基本情况", "“四个一批”新建项目库基本情况", ExcelType.XSSF);
|
|
|
+ } else if (vo.getStatus().equals("3")) {
|
|
|
+ exportParams = new ExportParams("“四个一批”在建项目库基本情况", "“四个一批”在建项目库基本情况", ExcelType.XSSF);
|
|
|
+ } else if (vo.getStatus().equals("9")) {
|
|
|
+ exportParams = new ExportParams("“四个一批”投产库基本情况", "“四个一批”投产库基本情况", ExcelType.XSSF);
|
|
|
+ } else {
|
|
|
+ exportParams = new ExportParams("“四个一批”项目库基本情况", "“四个一批”项目库基本情况", ExcelType.XSSF);
|
|
|
}
|
|
|
exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
int mergeTotalStartRow = exportData.size() + 1;
|
|
@@ -2066,10 +2060,10 @@ public class SubInfoExportController extends BaseController {
|
|
|
// 合并单元格
|
|
|
sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 1));
|
|
|
|
|
|
- if (ddList.size() > 1){
|
|
|
+ if (ddList.size() > 1) {
|
|
|
sheet.addMergedRegion(new CellRangeAddress(2, ddList.size() + 1, 0, 0));
|
|
|
}
|
|
|
- if (amtList.size() > 1){
|
|
|
+ if (amtList.size() > 1) {
|
|
|
sheet.addMergedRegion(new CellRangeAddress(ddList.size() + 2, ddList.size() + amtList.size() + 1, 0, 0));
|
|
|
}
|
|
|
if (hyList.size() > 1) {
|
|
@@ -2108,19 +2102,19 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
// 创建for循环,循环5次
|
|
|
List<String> newSubjectIds = new ArrayList<>();
|
|
|
- if (subjectIds.contains(jsddTitleMap.get("伊州区"))){
|
|
|
+ if (subjectIds.contains(jsddTitleMap.get("伊州区"))) {
|
|
|
newSubjectIds.add(jsddTitleMap.get("伊州区"));
|
|
|
}
|
|
|
- if (subjectIds.contains(jsddTitleMap.get("巴里坤县"))){
|
|
|
+ if (subjectIds.contains(jsddTitleMap.get("巴里坤县"))) {
|
|
|
newSubjectIds.add(jsddTitleMap.get("巴里坤县"));
|
|
|
}
|
|
|
- if (subjectIds.contains(jsddTitleMap.get("伊吾县"))){
|
|
|
+ if (subjectIds.contains(jsddTitleMap.get("伊吾县"))) {
|
|
|
newSubjectIds.add(jsddTitleMap.get("伊吾县"));
|
|
|
}
|
|
|
- if (subjectIds.contains(jsddTitleMap.get("高新区"))){
|
|
|
+ if (subjectIds.contains(jsddTitleMap.get("高新区"))) {
|
|
|
newSubjectIds.add(jsddTitleMap.get("高新区"));
|
|
|
}
|
|
|
- if (subjectIds.contains(jsddTitleMap.get("市本级"))){
|
|
|
+ if (subjectIds.contains(jsddTitleMap.get("市本级"))) {
|
|
|
newSubjectIds.add(jsddTitleMap.get("市本级"));
|
|
|
}
|
|
|
|
|
@@ -2129,7 +2123,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
ExcelExportEntity jsdd = null;
|
|
|
if (jsddMap.get(subjectId).equals("市本级")) {
|
|
|
jsdd = new ExcelExportEntity("其他", subjectId);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
jsdd = new ExcelExportEntity(jsddMap.get(subjectId), subjectId);
|
|
|
}
|
|
|
List<ExcelExportEntity> ddHead = new ArrayList<>();
|
|
@@ -2140,12 +2134,12 @@ public class SubInfoExportController extends BaseController {
|
|
|
}
|
|
|
// 0.2 构建数据
|
|
|
Map<String, List<SubInfoTotalExcel>> statusGroup = list.stream().collect(Collectors.groupingBy(SubInfoTotalExcel::getStatus));
|
|
|
- List<Map<String,Object>> dataList = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> dataList = new ArrayList<>();
|
|
|
// 0.2.1 储备项目
|
|
|
- List<SubInfoTotalExcel> cb = statusGroup.getOrDefault(SubInfoStatusEnum.CB.getCode(),new ArrayList<>());
|
|
|
- List<SubInfoTotalExcel> xj = statusGroup.getOrDefault(SubInfoStatusEnum.XJ.getCode(),new ArrayList<>());
|
|
|
- List<SubInfoTotalExcel> zj = statusGroup.getOrDefault(SubInfoStatusEnum.ZJ.getCode(),new ArrayList<>());
|
|
|
- List<SubInfoTotalExcel> tc = statusGroup.getOrDefault(SubInfoStatusEnum.TC.getCode(),new ArrayList<>());
|
|
|
+ List<SubInfoTotalExcel> cb = statusGroup.getOrDefault(SubInfoStatusEnum.CB.getCode(), new ArrayList<>());
|
|
|
+ List<SubInfoTotalExcel> xj = statusGroup.getOrDefault(SubInfoStatusEnum.XJ.getCode(), new ArrayList<>());
|
|
|
+ List<SubInfoTotalExcel> zj = statusGroup.getOrDefault(SubInfoStatusEnum.ZJ.getCode(), new ArrayList<>());
|
|
|
+ List<SubInfoTotalExcel> tc = statusGroup.getOrDefault(SubInfoStatusEnum.TC.getCode(), new ArrayList<>());
|
|
|
|
|
|
fillRowData(subjectIds, dataList, cb, SubInfoStatusEnum.CB.getDesc() + "项目");
|
|
|
fillRowData(subjectIds, dataList, xj, SubInfoStatusEnum.XJ.getDesc() + "项目");
|
|
@@ -2165,7 +2159,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
workbook.write(outputStream);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
- }finally {
|
|
|
+ } finally {
|
|
|
try {
|
|
|
workbook.close();
|
|
|
} catch (IOException e) {
|
|
@@ -2182,7 +2176,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
* @param statusGroup 分组待处理的数据
|
|
|
* @param name 项目类别
|
|
|
*/
|
|
|
- private void fillRowData(List<String> subjectIds, List<Map<String, Object>> dataList, List<SubInfoTotalExcel> statusGroup,String name) {
|
|
|
+ private void fillRowData(List<String> subjectIds, List<Map<String, Object>> dataList, List<SubInfoTotalExcel> statusGroup, String name) {
|
|
|
Map<String, List<SubInfoTotalExcel>> collect = statusGroup.stream().collect(Collectors.groupingBy(e -> StringUtils.defaultIfBlank(e.getSubjectId(), ".")));
|
|
|
Map<String, List<Object>> map = new LinkedHashMap<>();
|
|
|
// 处理有数据的区县列
|
|
@@ -2190,7 +2184,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
map.put(key, Collections.singletonList(new LinkedHashMap<String, Object>() {{
|
|
|
put("count", value.size());
|
|
|
BigDecimal reduce = value.stream()
|
|
|
- .map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
+ .map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
.map(amt -> Optional.ofNullable(amt).orElse(BigDecimal.ZERO))
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
put("amt", reduce.divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP));
|
|
@@ -2202,7 +2196,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
// 合计列
|
|
|
BigDecimal cbAmtSum = statusGroup.stream()
|
|
|
- .map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
+ .map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
rowMap.put("hj", Collections.singletonList(new LinkedHashMap<String, Object>() {{
|
|
|
put("count", statusGroup.size());
|
|
@@ -2234,8 +2228,8 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
// 获取数据
|
|
|
List<String> subjectIds = getSubjectIds();
|
|
|
- List<SubInfoFixDetail> subInfoTotalExcel = subInfoService.exportFixDetailExcel(vo,subjectIds);
|
|
|
- if (CollUtil.isEmpty(subInfoTotalExcel)){
|
|
|
+ List<SubInfoFixDetail> subInfoTotalExcel = subInfoService.exportFixDetailExcel(vo, subjectIds);
|
|
|
+ if (CollUtil.isEmpty(subInfoTotalExcel)) {
|
|
|
subInfoTotalExcel = CollUtil.newArrayList();
|
|
|
}
|
|
|
|
|
@@ -2255,7 +2249,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
// 写入合计行
|
|
|
BigDecimal totalAmt = subInfoTotalExcel.stream()
|
|
|
- .map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
+ .map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
writer.writeRow(CollUtil.newArrayList(
|
|
|
"合计(" + subInfoTotalExcel.size() + "个)", "", "", "", totalAmt.toString(), "", "", ""));
|
|
@@ -2286,7 +2280,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
}
|
|
|
|
|
|
//写入行业标题行
|
|
|
- List<String> hyflTitleRow = CollUtil.newArrayList(newKey,newKey,newKey,newKey,hyflTotalAmt.toString(),"","","");
|
|
|
+ List<String> hyflTitleRow = CollUtil.newArrayList(newKey, newKey, newKey, newKey, hyflTotalAmt.toString(), "", "", "");
|
|
|
valueList.add(hyflTitleRow);
|
|
|
mergeRowList.add(startRow);
|
|
|
startRow++;
|
|
@@ -2354,7 +2348,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
// 获取数据
|
|
|
List<String> subjectIds = getSubjectIds();
|
|
|
- List<SubInfoFixCbDetail> subInfoTotalExcel = subInfoService.exportFixCbDetailExcel(vo,subjectIds);
|
|
|
+ List<SubInfoFixCbDetail> subInfoTotalExcel = subInfoService.exportFixCbDetailExcel(vo, subjectIds);
|
|
|
|
|
|
// 写入标题行
|
|
|
writer.writeHeadRow(CollUtil.newArrayList("四个一批工业项目表"));
|
|
@@ -2372,7 +2366,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
// 写入合计行
|
|
|
BigDecimal totalAmt = subInfoTotalExcel.stream()
|
|
|
- .map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
+ .map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
writer.writeRow(CollUtil.newArrayList(
|
|
|
"合计(" + subInfoTotalExcel.size() + "个)", "", "", "", totalAmt.toString(), "", ""));
|
|
@@ -2403,7 +2397,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
}
|
|
|
|
|
|
//写入行业标题行
|
|
|
- List<String> hyflTitleRow = CollUtil.newArrayList(newKey,newKey,newKey,newKey,hyflTotalAmt.toString(),"","");
|
|
|
+ List<String> hyflTitleRow = CollUtil.newArrayList(newKey, newKey, newKey, newKey, hyflTotalAmt.toString(), "", "");
|
|
|
valueList.add(hyflTitleRow);
|
|
|
mergeRowList.add(startRow);
|
|
|
startRow++;
|
|
@@ -2454,14 +2448,14 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
// 获取数据
|
|
|
List<String> subjectIds = getSubjectIds();
|
|
|
- List<SubInfoFixZjDetail> subInfoTotalExcel = subInfoService.exportFixZjDetailExcel(vo,subjectIds);
|
|
|
+ List<SubInfoFixZjDetail> subInfoTotalExcel = subInfoService.exportFixZjDetailExcel(vo, subjectIds);
|
|
|
|
|
|
// 写入标题行
|
|
|
writer.writeHeadRow(CollUtil.newArrayList("四个一批工业项目表"));
|
|
|
writer.merge(0, 0, 0, 8, "“四个一批”工业项目表(在建项目库)", true);
|
|
|
|
|
|
// 写入子标题行
|
|
|
- writer.writeHeadRow(CollUtil.newArrayList("序号", "项目名称", "项目所在地", "项目建设内容", "计划总投资(亿元)", "建成投产时间","年度投资(亿元)","进展情况", "备注"));
|
|
|
+ writer.writeHeadRow(CollUtil.newArrayList("序号", "项目名称", "项目所在地", "项目建设内容", "计划总投资(亿元)", "建成投产时间", "年度投资(亿元)", "进展情况", "备注"));
|
|
|
|
|
|
// 设置每列的默认宽度
|
|
|
SXSSFSheet sheet = ((SXSSFWorkbook) writer.getWorkbook()).getSheetAt(0);
|
|
@@ -2472,7 +2466,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
// 写入合计行
|
|
|
BigDecimal totalAmt = subInfoTotalExcel.stream()
|
|
|
- .map(e->Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
+ .map(e -> Optional.ofNullable(e.getAmtTotal()).orElse(BigDecimal.ZERO))
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
writer.writeRow(CollUtil.newArrayList(
|
|
|
"合计(" + subInfoTotalExcel.size() + "个)", "", "", "", totalAmt.toString(), "", ""));
|
|
@@ -2503,7 +2497,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
}
|
|
|
|
|
|
//写入行业标题行
|
|
|
- List<String> hyflTitleRow = CollUtil.newArrayList(newKey,newKey,newKey,newKey,hyflTotalAmt.toString(),"","");
|
|
|
+ List<String> hyflTitleRow = CollUtil.newArrayList(newKey, newKey, newKey, newKey, hyflTotalAmt.toString(), "", "");
|
|
|
valueList.add(hyflTitleRow);
|
|
|
mergeRowList.add(startRow);
|
|
|
startRow++;
|
|
@@ -2570,14 +2564,14 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
// 获取数据
|
|
|
List<String> subjectIds = getSubjectIds();
|
|
|
- List<SubInfoFixTcDetail> subInfoTotalExcel = subInfoService.exportFixTcDetailExcel(vo,subjectIds);
|
|
|
+ List<SubInfoFixTcDetail> subInfoTotalExcel = subInfoService.exportFixTcDetailExcel(vo, subjectIds);
|
|
|
|
|
|
// 写入标题行
|
|
|
writer.writeHeadRow(CollUtil.newArrayList("四个一批工业项目表"));
|
|
|
writer.merge(0, 0, 0, 6, "“四个一批”工业项目表(投产项目库)", true);
|
|
|
|
|
|
// 写入子标题行
|
|
|
- writer.writeHeadRow(CollUtil.newArrayList("序号", "项目名称", "项目所在地", "项目基本情况", "升规入统时间","进展情况", "备注"));
|
|
|
+ writer.writeHeadRow(CollUtil.newArrayList("序号", "项目名称", "项目所在地", "项目基本情况", "升规入统时间", "进展情况", "备注"));
|
|
|
|
|
|
// 设置每列的默认宽度
|
|
|
SXSSFSheet sheet = ((SXSSFWorkbook) writer.getWorkbook()).getSheetAt(0);
|
|
@@ -2613,7 +2607,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
}
|
|
|
|
|
|
//写入行业标题行
|
|
|
- List<String> hyflTitleRow = CollUtil.newArrayList(newKey,newKey,newKey,newKey,"","","");
|
|
|
+ List<String> hyflTitleRow = CollUtil.newArrayList(newKey, newKey, newKey, newKey, "", "", "");
|
|
|
valueList.add(hyflTitleRow);
|
|
|
mergeRowList.add(startRow);
|
|
|
startRow++;
|