|
@@ -110,7 +110,8 @@ public class SubInfoExportController extends BaseController {
|
|
|
private SubRptContService subRptContService;
|
|
|
@Autowired
|
|
|
private ISubHisService subHisService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private ISubPreGxjInfoService subPreGxjInfoService;
|
|
|
/**
|
|
|
* 导出汇总表
|
|
|
*
|
|
@@ -897,6 +898,8 @@ 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();
|
|
|
|
|
|
ExportParams exportParams = new ExportParams("“四个一批”工业项目表(新建项目库)","新建项目库",ExcelType.XSSF);
|
|
|
exportParams.setStyle(ExcelStyleUtil.class);
|
|
@@ -931,18 +934,36 @@ public class SubInfoExportController extends BaseController {
|
|
|
SubInfoXjVO.PreNewInfo preNewInfo = new SubInfoXjVO.PreNewInfo();
|
|
|
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());
|
|
|
+ preNewInfo.setRecord(e.getDateConfirm() != null ? e.getDateConfirm() :subInfoPreNewVO!=null? subInfoPreNewVO.getRecord():null); // 备案核准
|
|
|
} else if ("2".equals(e.getPreFlowId())) {
|
|
|
- preNewInfo.setPrePlan(e.getDateConfirm());
|
|
|
+ preNewInfo.setPrePlan(e.getDateConfirm() != null ? e.getDateConfirm() : subInfoPreNewVO == null ? null : subInfoPreNewVO.getPrePlan()); // 用地预审与选址意见书
|
|
|
} else if ("13".equals(e.getPreFlowId())) {
|
|
|
- preNewInfo.setProPlanPermit(e.getDateConfirm());
|
|
|
+ preNewInfo.setProPlanPermit(e.getDateConfirm()!= null ? e.getDateConfirm() : subInfoPreNewVO== null ? null : subInfoPreNewVO.getProPlanPermit()); // 建设工程规划许可证
|
|
|
} else if ("14".equals(e.getPreFlowId())) {
|
|
|
- preNewInfo.setWorkPermit(e.getDateConfirm());
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
hyList.add(vo);
|
|
|
}
|
|
@@ -1116,6 +1137,51 @@ public class SubInfoExportController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/exportProcedureExcel")
|
|
|
+ public void exportProcedureExcel(@RequestBody SubInfoQueryTzVO queryVO) {
|
|
|
+ queryVO.setSubjectAuthIds(getSubjectIds());
|
|
|
+ List<SubInfoGxj> list = subInfoQueryService.queryAll(getCurUser().getLoginUser(), queryVO);
|
|
|
+ // 查询工信局设置的手续
|
|
|
+ Map<String, SubInfoPreNewVO> collect = subPreGxjInfoService.getGxjPreNewInfoList();
|
|
|
+
|
|
|
+ ExportParams exportParams = new ExportParams("手续明细","手续明细",ExcelType.XSSF);
|
|
|
+ exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
+
|
|
|
+ List<SubInfoProcedureVO> exportList = new ArrayList<>();
|
|
|
+ int index = 1;
|
|
|
+ for (SubInfoGxj subInfoGxj : list) {
|
|
|
+ SubInfoProcedureVO vo = new SubInfoProcedureVO();
|
|
|
+ BeanUtil.copyProperties(subInfoGxj, vo);
|
|
|
+ vo.setAmtTotal(convertAmount(subInfoGxj.getAmtTotal()));
|
|
|
+ vo.setIndex(String.valueOf(index++));
|
|
|
+ // 手续
|
|
|
+ SubInfoPreNewVO subInfoPreNewVO = collect.get(subInfoGxj.getSubId());
|
|
|
+ if (subInfoPreNewVO != null) {
|
|
|
+ BeanUtils.copyProperties(subInfoPreNewVO, vo);
|
|
|
+ }
|
|
|
+ exportList.add(vo);
|
|
|
+ }
|
|
|
+ Workbook workbook = ExcelExportUtil.exportExcel(exportParams, SubInfoProcedureVO.class, exportList);
|
|
|
+ response.setContentType("application/xlsx;charset=utf-8");
|
|
|
+ response.setHeader("Content-Disposition", "attachment; filename=" + URLEncodeUtil.encode("项目明细表") + System.currentTimeMillis() + ".xlsx");
|
|
|
+ Sheet sheet = workbook.getSheetAt(0);
|
|
|
+ // 设置自适应行高
|
|
|
+ for (int i = 3; i <= list.size() + exportList.size() + 3; i++) {
|
|
|
+ Optional.ofNullable(sheet.getRow(i)).ifPresent(row -> row.setHeight((short) -1));
|
|
|
+ }
|
|
|
+ list.clear();
|
|
|
+ try (OutputStream outputStream = response.getOutputStream()) {
|
|
|
+ workbook.write(outputStream);
|
|
|
+ workbook.close();
|
|
|
+ }catch (IOException e) {
|
|
|
+ // 处理 IO 异常
|
|
|
+ handleErrorResponse(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "导出 Excel 文件时出现错误:" + e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ // 处理其他异常
|
|
|
+ handleErrorResponse(response, HttpServletResponse.SC_BAD_REQUEST, "请求参数错误或发生其他错误:" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 总库 导出明细
|
|
|
*/
|
|
@@ -1248,7 +1314,45 @@ public class SubInfoExportController extends BaseController {
|
|
|
}));
|
|
|
ExportParams exportParams = new ExportParams("“四个一批”工业项目表(储备项目库)", "储备项目库", ExcelType.XSSF);
|
|
|
exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
- exportDetail(response, exportParams, SubInfoCbVO.class, list, hyDictMap, groupMap);
|
|
|
+
|
|
|
+ List<SubInfoCbVO> exportList = new ArrayList<>();
|
|
|
+ // 合计行
|
|
|
+ SubInfoCbVO hjCount = BeanUtils.instantiateClass(SubInfoCbVO.class);
|
|
|
+ hjCount.setIndex(String.format("合计(%s个)", list.size()));
|
|
|
+ BigDecimal total = list.stream().reduce(BigDecimal.ZERO, (a, b) -> a.add(b.getAmtTotal()), BigDecimal::add);
|
|
|
+ hjCount.setAmtTotal(convertAmount(total));
|
|
|
+ exportList.add(hjCount);
|
|
|
+
|
|
|
+ int index = 1;
|
|
|
+ List<Integer> allSize = new ArrayList<>();
|
|
|
+ for (Map.Entry<String, List<SubInfoGxj>> entry : groupMap.entrySet()) {
|
|
|
+ String key = entry.getKey();
|
|
|
+ List<SubInfoGxj> value = entry.getValue();
|
|
|
+ List<SubInfoCbVO> hyList = new ArrayList<>();
|
|
|
+ // 行业合计行
|
|
|
+ SubInfoCbVO hyCount = BeanUtils.instantiateClass(SubInfoCbVO.class);
|
|
|
+ hyCount.setIndex(String.format("%s、%s( %s个 )", toChineseNumber(index), hyDictMap.getOrDefault(key, key), value.size()));
|
|
|
+ BigDecimal reduce = value.stream().reduce(BigDecimal.ZERO, (a, b) -> a.add(b.getAmtTotal()), BigDecimal::add);
|
|
|
+ hyCount.setAmtTotal(convertAmount(reduce));
|
|
|
+ // 每条数据行
|
|
|
+ hyList.add(hyCount);
|
|
|
+ for (int i = 0; i < value.size(); i++) {
|
|
|
+ SubInfoGxj subInfoGxj = value.get(i);
|
|
|
+ SubInfoCbVO vo = BeanUtils.instantiateClass(SubInfoCbVO.class);
|
|
|
+ BeanUtils.copyProperties(subInfoGxj, vo);
|
|
|
+ vo.setAmtTotal(convertAmount(subInfoGxj.getAmtTotal()));
|
|
|
+ vo.setIndex(i + 1 + "");
|
|
|
+ hyList.add(vo);
|
|
|
+ }
|
|
|
+ // allSize 需要合并的行
|
|
|
+ allSize.add(exportList.size() + 2);
|
|
|
+ allSize.add(2);
|
|
|
+ exportList.addAll(hyList);
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ Workbook workbook = ExcelExportUtil.exportExcel(exportParams, SubInfoCbVO.class, exportList);
|
|
|
+ extracted(response, list, workbook, allSize);
|
|
|
+ // exportDetail(response, exportParams, SubInfoCbVO.class, list, hyDictMap, groupMap);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1737,11 +1841,11 @@ public class SubInfoExportController extends BaseController {
|
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
|
// allSize.add(2);
|
|
|
for (Integer row : new HashSet<>(allSize)) {
|
|
|
- sheet.addMergedRegion(new CellRangeAddress(row, row, 0, 3));
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(row, row, 1, 4));
|
|
|
// 获取合并区域的左上角单元格并设置样式
|
|
|
Row mergedRow = sheet.getRow(row);
|
|
|
if (mergedRow != null) {
|
|
|
- Cell cell = mergedRow.getCell(0);
|
|
|
+ Cell cell = mergedRow.getCell(1);
|
|
|
if (cell != null) {
|
|
|
cell.setCellStyle(nonCenterCellStyle);
|
|
|
}
|