|
@@ -16,6 +16,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
|
import cn.afterturn.easypoi.word.WordExportUtil;
|
|
|
import cn.afterturn.easypoi.word.entity.MyXWPFDocument;
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.io.IoUtil;
|
|
@@ -30,10 +31,8 @@ import com.rtrh.common.util.StringUtil;
|
|
|
import com.rtrh.projects.modules.projects.dao.SubSourceDao;
|
|
|
import com.rtrh.projects.modules.projects.enums.ProjectStatusEnum;
|
|
|
import com.rtrh.projects.modules.projects.enums.SubInfoStatusEnum;
|
|
|
-import com.rtrh.projects.modules.projects.po.LogOperate;
|
|
|
-import com.rtrh.projects.modules.projects.po.SubIndu;
|
|
|
-import com.rtrh.projects.modules.projects.po.SubInfoGxj;
|
|
|
-import com.rtrh.projects.modules.projects.service.ILogOperateService;
|
|
|
+import com.rtrh.projects.modules.projects.po.*;
|
|
|
+import com.rtrh.projects.modules.projects.service.*;
|
|
|
import com.rtrh.projects.modules.projects.vo.LogOperateVO;
|
|
|
import com.rtrh.projects.modules.projects.vo.StatusChangeCountersVO;
|
|
|
import com.rtrh.projects.modules.projects.vo.SubInfoTotalExcel;
|
|
@@ -67,9 +66,6 @@ import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import com.rtrh.common.util.CollectionUtil;
|
|
|
import com.rtrh.core.repository.Page;
|
|
|
-import com.rtrh.projects.modules.projects.service.SubInfoExportService;
|
|
|
-import com.rtrh.projects.modules.projects.service.SubInfoQueryService;
|
|
|
-import com.rtrh.projects.modules.projects.service.SubInfoService;
|
|
|
import com.rtrh.projects.modules.projects.vo.SubInfoQueryTzVO;
|
|
|
import com.rtrh.projects.modules.system.enums.SysTableKind;
|
|
|
import com.rtrh.projects.modules.system.po.TSystable;
|
|
@@ -108,6 +104,11 @@ public class SubInfoExportController extends BaseController {
|
|
|
private HttpServletResponse response;
|
|
|
@Autowired
|
|
|
private ILogOperateService logOperateService;
|
|
|
+ @Autowired
|
|
|
+ private SubPreNewService subPreNewService;
|
|
|
+ @Autowired
|
|
|
+ private SubRptContService subRptContService;
|
|
|
+
|
|
|
/**
|
|
|
* 导出汇总表
|
|
|
*
|
|
@@ -872,12 +873,253 @@ public class SubInfoExportController extends BaseController {
|
|
|
|
|
|
return result.toString();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新建库 导出明细
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @PostMapping("/exportNewDetailExcel")
|
|
|
+ public void exportNewDetailExcel(@RequestBody SubInfoQueryTzVO queryVO) {
|
|
|
+ queryVO.setSubjectAuthIds(getSubjectIds());
|
|
|
+ List<SubInfoGxj> list = subInfoQueryService.queryAll(getCurUser().getLoginUser(), queryVO);
|
|
|
+ // 行业字典
|
|
|
+ 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 -> {
|
|
|
+ if (StringUtils.isNotBlank(e.getIndusKind())){
|
|
|
+ return e.getIndusKind().substring(0, 2);
|
|
|
+ }
|
|
|
+ return "未知行业";
|
|
|
+ }));
|
|
|
+ // 查询手续
|
|
|
+ List<SubPreNew> subPreNewList = subPreNewService.findList();
|
|
|
+ Map<String, List<SubPreNew>> subIdGroups = subPreNewList.stream().collect(Collectors.groupingBy(SubPreNew::getSubId));
|
|
|
+
|
|
|
+ ExportParams exportParams = new ExportParams("“四个一批”工业项目表(新建项目库)","新建项目库",ExcelType.XSSF);
|
|
|
+ exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
+
|
|
|
+ List<SubInfoXjVO> exportList = new ArrayList<>();
|
|
|
+ // 合计行
|
|
|
+ SubInfoXjVO hjCount = BeanUtils.instantiateClass(SubInfoXjVO.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<SubInfoXjVO> hyList = new ArrayList<>();
|
|
|
+ // 行业合计行
|
|
|
+ SubInfoXjVO hyCount = BeanUtils.instantiateClass(SubInfoXjVO.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);
|
|
|
+ SubInfoXjVO vo = BeanUtils.instantiateClass(SubInfoXjVO.class);
|
|
|
+ BeanUtils.copyProperties(subInfoGxj, vo);
|
|
|
+ vo.setAmtTotal(convertAmount(subInfoGxj.getAmtTotal()));
|
|
|
+ vo.setIndex(i + 1 + "");
|
|
|
+ SubInfoXjVO.PreNewInfo preNewInfo = new SubInfoXjVO.PreNewInfo();
|
|
|
+ vo.setPreNewInfo(Collections.singletonList(preNewInfo));
|
|
|
+ List<SubPreNew> preNews = subIdGroups.get(subInfoGxj.getSubId());
|
|
|
+ if (CollUtil.isNotEmpty(preNews)){
|
|
|
+ preNews.forEach(e -> {
|
|
|
+ if ("3".equals(e.getPreFlowId()) || "5".equals(e.getPreFlowId())) {
|
|
|
+ preNewInfo.setRecord(e.getDateConfirm());
|
|
|
+ } else if ("2".equals(e.getPreFlowId())) {
|
|
|
+ preNewInfo.setPrePlan(e.getDateConfirm());
|
|
|
+ } else if ("13".equals(e.getPreFlowId())) {
|
|
|
+ preNewInfo.setProPlanPermit(e.getDateConfirm());
|
|
|
+ } else if ("14".equals(e.getPreFlowId())) {
|
|
|
+ preNewInfo.setWorkPermit(e.getDateConfirm());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ hyList.add(vo);
|
|
|
+ }
|
|
|
+ // 添加前计算行业类型合并行
|
|
|
+ allSize.add(exportList.size() + 3);
|
|
|
+ // 合计(832个)行
|
|
|
+ allSize.add(3);
|
|
|
+ exportList.addAll(hyList);
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ Workbook workbook = ExcelExportUtil.exportExcel(exportParams, SubInfoXjVO.class, exportList);
|
|
|
+ extracted(response, list, workbook, allSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 在建库 导出明细
|
|
|
+ */
|
|
|
+ @PostMapping("/exportMainDetailExcel")
|
|
|
+ public void exportMainDetailExcel(@RequestBody SubInfoQueryTzVO queryVO) {
|
|
|
+ queryVO.setSubjectAuthIds(getSubjectIds());
|
|
|
+ List<SubInfoGxj> list = subInfoQueryService.queryAll(getCurUser().getLoginUser(), queryVO);
|
|
|
+ // 行业字典
|
|
|
+ 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 -> {
|
|
|
+ if (StringUtils.isNotBlank(e.getIndusKind())){
|
|
|
+ return e.getIndusKind().substring(0, 2);
|
|
|
+ }
|
|
|
+ return "未知行业";
|
|
|
+ }));
|
|
|
+
|
|
|
+ ExportParams exportParams = new ExportParams("“四个一批”工业项目表(在建项目库)","在建项目库",ExcelType.XSSF);
|
|
|
+ exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
+ List<SubInfoZjVO> exportList = new ArrayList<>();
|
|
|
+ // 合计行
|
|
|
+ SubInfoZjVO hjCount = BeanUtils.instantiateClass(SubInfoZjVO.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 year = DateUtil.thisYear();
|
|
|
+ List<RptCont> rptContList = subRptContService.listByYear(year);
|
|
|
+ Map<String, List<RptCont>> rptContGroup = rptContList.stream().collect(Collectors.groupingBy(RptCont::getSubId));
|
|
|
+
|
|
|
+ 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<SubInfoZjVO> hyList = new ArrayList<>();
|
|
|
+ // 行业合计行
|
|
|
+ SubInfoZjVO hyCount = BeanUtils.instantiateClass(SubInfoZjVO.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);
|
|
|
+ SubInfoZjVO vo = BeanUtils.instantiateClass(SubInfoZjVO.class);
|
|
|
+ BeanUtils.copyProperties(subInfoGxj, vo);
|
|
|
+ vo.setAmtTotal(convertAmount(subInfoGxj.getAmtTotal()));
|
|
|
+ vo.setIndex(i + 1 + "");
|
|
|
+
|
|
|
+ // 每月完成工程量
|
|
|
+ List<RptCont> subRptConts = rptContGroup.get(subInfoGxj.getSubId());
|
|
|
+ if (CollUtil.isNotEmpty(subRptConts)) {
|
|
|
+ SubInfoZjVO.MonthNumBl monthNumBl = new SubInfoZjVO.MonthNumBl();
|
|
|
+ Map<String, BigDecimal> map = subRptConts.stream().collect(Collectors.toMap(RptCont::getKjMonth, RptCont::getNumBl, (a, b) -> a));
|
|
|
+ monthNumBl.setMonth1(map.getOrDefault(DateUtil.thisYear() + "01", BigDecimal.ZERO) + "%");
|
|
|
+ monthNumBl.setMonth2(map.getOrDefault(DateUtil.thisYear() + "02", BigDecimal.ZERO) + "%");
|
|
|
+ monthNumBl.setMonth3(map.getOrDefault(DateUtil.thisYear() + "03", BigDecimal.ZERO) + "%");
|
|
|
+ monthNumBl.setMonth4(map.getOrDefault(DateUtil.thisYear() + "04", BigDecimal.ZERO) + "%");
|
|
|
+ monthNumBl.setMonth5(map.getOrDefault(DateUtil.thisYear() + "05", BigDecimal.ZERO) + "%");
|
|
|
+ monthNumBl.setMonth6(map.getOrDefault(DateUtil.thisYear() + "06", BigDecimal.ZERO) + "%");
|
|
|
+ monthNumBl.setMonth7(map.getOrDefault(DateUtil.thisYear() + "07", BigDecimal.ZERO) + "%");
|
|
|
+ monthNumBl.setMonth8(map.getOrDefault(DateUtil.thisYear() + "08", BigDecimal.ZERO) + "%");
|
|
|
+ monthNumBl.setMonth9(map.getOrDefault(DateUtil.thisYear() + "09", BigDecimal.ZERO) + "%");
|
|
|
+ monthNumBl.setMonth10(map.getOrDefault(DateUtil.thisYear() + "10", BigDecimal.ZERO) + "%");
|
|
|
+ monthNumBl.setMonth11(map.getOrDefault(DateUtil.thisYear() + "11", BigDecimal.ZERO) + "%");
|
|
|
+ monthNumBl.setMonth12(map.getOrDefault(DateUtil.thisYear() + "12", BigDecimal.ZERO) + "%");
|
|
|
+ vo.setMonthNumBlList(Collections.singletonList(monthNumBl));
|
|
|
+ } else {
|
|
|
+ SubInfoZjVO.MonthNumBl monthNumBl = new SubInfoZjVO.MonthNumBl();
|
|
|
+ monthNumBl.setMonth1(BigDecimal.ZERO + "%");
|
|
|
+ monthNumBl.setMonth2(BigDecimal.ZERO + "%");
|
|
|
+ monthNumBl.setMonth3(BigDecimal.ZERO + "%");
|
|
|
+ monthNumBl.setMonth4(BigDecimal.ZERO + "%");
|
|
|
+ monthNumBl.setMonth5(BigDecimal.ZERO + "%");
|
|
|
+ monthNumBl.setMonth6(BigDecimal.ZERO + "%");
|
|
|
+ monthNumBl.setMonth7(BigDecimal.ZERO + "%");
|
|
|
+ monthNumBl.setMonth8(BigDecimal.ZERO + "%");
|
|
|
+ monthNumBl.setMonth9(BigDecimal.ZERO + "%");
|
|
|
+ monthNumBl.setMonth10(BigDecimal.ZERO + "%");
|
|
|
+ monthNumBl.setMonth11(BigDecimal.ZERO + "%");
|
|
|
+ monthNumBl.setMonth12(BigDecimal.ZERO + "%");
|
|
|
+ vo.setMonthNumBlList(Collections.singletonList(monthNumBl));
|
|
|
+ }
|
|
|
+ hyList.add(vo);
|
|
|
+ }
|
|
|
+ // 添加前计算合并行
|
|
|
+ allSize.add(exportList.size() + 3);
|
|
|
+ allSize.add(3);
|
|
|
+ exportList.addAll(hyList);
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ // 构建表头
|
|
|
+ List<ExcelExportEntity> entityList = new ArrayList<ExcelExportEntity>(){{
|
|
|
+ add(new ExcelExportEntity("序号", "index", 12));
|
|
|
+ add(new ExcelExportEntity("项目名称", "subName", 20));
|
|
|
+ add(new ExcelExportEntity("项目所在地", "subjectName", 15));
|
|
|
+ add(new ExcelExportEntity("项目建设内容", "content", 70));
|
|
|
+ add(new ExcelExportEntity("计划总投资(亿元)", "amtTotal", 20));
|
|
|
+ add(new ExcelExportEntity("建成投产时间", "endDate", 15));
|
|
|
+
|
|
|
+ ExcelExportEntity monthNumBlEntity = new ExcelExportEntity(year + "年1-12月项目工程进度(每月完成工程量)", "monthNumBlList", 12);
|
|
|
+ List<ExcelExportEntity> subHeadEntities = new ArrayList<ExcelExportEntity>(){{
|
|
|
+ add(new ExcelExportEntity("1月", "month1"));
|
|
|
+ add(new ExcelExportEntity("2月", "month2"));
|
|
|
+ add(new ExcelExportEntity("3月", "month3"));
|
|
|
+ add(new ExcelExportEntity("4月", "month4"));
|
|
|
+ add(new ExcelExportEntity("5月", "month5"));
|
|
|
+ add(new ExcelExportEntity("6月", "month6"));
|
|
|
+ add(new ExcelExportEntity("7月", "month7"));
|
|
|
+ add(new ExcelExportEntity("8月", "month8"));
|
|
|
+ add(new ExcelExportEntity("9月", "month9"));
|
|
|
+ add(new ExcelExportEntity("10月", "month10"));
|
|
|
+ add(new ExcelExportEntity("11月", "month11"));
|
|
|
+ add(new ExcelExportEntity("12月", "month12"));
|
|
|
+ }};
|
|
|
+ monthNumBlEntity.setList(subHeadEntities);
|
|
|
+ add(monthNumBlEntity);
|
|
|
+
|
|
|
+ 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->{
|
|
|
+ Map<String, Object> map = BeanUtil.beanToMap(e);
|
|
|
+ Object o = map.get("endDate");
|
|
|
+ if (o != null) {
|
|
|
+ map.put("endDate", DateUtil.format((Date) o, "yyyy年MM月"));
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, collect);
|
|
|
+ extracted(response, list, workbook, allSize);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 4库/总库 导出明细
|
|
|
*
|
|
|
*/
|
|
|
@PostMapping("/exportDetailExcel")
|
|
|
public void exportDetailExcel(@RequestBody SubInfoQueryTzVO queryVO) {
|
|
|
+ WebLogAspect.content.set(String.format("页面:【项目四库管理-%s库】,执行操作:导出明细", StringUtils.isBlank(queryVO.getStatus()) ? "项目总" : SubInfoStatusEnum.getDesc(queryVO.getStatus())));
|
|
|
+ if (SubInfoStatusEnum.CB.getCode().equals(queryVO.getStatus())) {
|
|
|
+ exportCbDetailExcel(queryVO);
|
|
|
+ }else if (SubInfoStatusEnum.XJ.getCode().equals(queryVO.getStatus())){
|
|
|
+ exportNewDetailExcel(queryVO);
|
|
|
+ }else if (SubInfoStatusEnum.ZJ.getCode().equals(queryVO.getStatus())){
|
|
|
+ exportMainDetailExcel(queryVO);
|
|
|
+ } else if (SubInfoStatusEnum.TC.getCode().equals(queryVO.getStatus())) {
|
|
|
+ exportTcDetailExcel(queryVO);
|
|
|
+ } else {
|
|
|
+ exportZkDetailExcel(queryVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 总库 导出明细
|
|
|
+ */
|
|
|
+ private void exportZkDetailExcel(SubInfoQueryTzVO queryVO) {
|
|
|
WebLogAspect.content.set(String.format("页面:【项目四库管理-%s库】,执行操作:导出明细", StringUtils.isBlank(queryVO.getStatus()) ? "项目总" : SubInfoStatusEnum.getDesc(queryVO.getStatus())));
|
|
|
queryVO.setSubjectAuthIds(getSubjectIds());
|
|
|
List<SubInfoGxj> list = subInfoQueryService.queryAll(getCurUser().getLoginUser(), queryVO);
|
|
@@ -892,93 +1134,121 @@ public class SubInfoExportController extends BaseController {
|
|
|
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<>();
|
|
|
- // 合计行
|
|
|
- SubInfoTcVO hjCount = new SubInfoTcVO();
|
|
|
- hjCount.setIndex(String.format("合计(%s个)", list.size()));
|
|
|
- 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<SubInfoTcVO> hyList = new ArrayList<>();
|
|
|
- // 行业合计行
|
|
|
- SubInfoTcVO hyCount = new SubInfoTcVO();
|
|
|
- hyCount.setIndex(String.format("%s、%s( %s个 )", toChineseNumber(index), hyDictMap.getOrDefault(key, key), value.size()));
|
|
|
- // 每条数据行
|
|
|
- hyList.add(hyCount);
|
|
|
- for (int i = 0; i < value.size(); i++) {
|
|
|
- SubInfoGxj subInfoGxj = value.get(i);
|
|
|
- SubInfoTcVO vo = new SubInfoTcVO();
|
|
|
- BeanUtils.copyProperties(subInfoGxj, vo);
|
|
|
- // BigDecimal divide = subInfoGxj.getAmtTotal() != null ? subInfoGxj.getAmtTotal().divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
|
|
|
- // vo.setAmtTotal(divide);
|
|
|
- vo.setIndex(i + 1 + "");
|
|
|
- hyList.add(vo);
|
|
|
- }
|
|
|
- // 添加前计算合并行
|
|
|
- allSize.add(exportList.size() + 2);
|
|
|
- exportList.addAll(hyList);
|
|
|
- index++;
|
|
|
+ // 项目总库
|
|
|
+ List<SubInfoZkVO> exportList = new ArrayList<>();
|
|
|
+ // 合计行
|
|
|
+ SubInfoZkVO hjCount = new SubInfoZkVO();
|
|
|
+ hjCount.setIndex(String.format("合计(%s个)", list.size()));
|
|
|
+ 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<SubInfoZkVO> hyList = new ArrayList<>();
|
|
|
+ // 行业合计行
|
|
|
+ SubInfoZkVO hyCount = new SubInfoZkVO();
|
|
|
+ hyCount.setIndex(String.format("%s、%s( %s个 )", toChineseNumber(index), hyDictMap.getOrDefault(key, key), value.size()));
|
|
|
+ // 每条数据行
|
|
|
+ hyList.add(hyCount);
|
|
|
+ for (int i = 0; i < value.size(); i++) {
|
|
|
+ SubInfoGxj subInfoGxj = value.get(i);
|
|
|
+ SubInfoZkVO vo = new SubInfoZkVO();
|
|
|
+ BeanUtils.copyProperties(subInfoGxj, vo);
|
|
|
+ vo.setAmtTotal(convertAmount(subInfoGxj.getAmtTotal()));
|
|
|
+ vo.setIndex(i + 1 + "");
|
|
|
+ hyList.add(vo);
|
|
|
}
|
|
|
- ExportParams exportParams = new ExportParams("“四个一批”工业项目表(投产项目库)", "投产项目库", ExcelType.XSSF);
|
|
|
- exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
- // 设置默认样式(这里设置所有单元格都有边框)
|
|
|
- workbook = ExcelExportUtil.exportExcel(exportParams, SubInfoTcVO.class, exportList);
|
|
|
- extracted(response, list, workbook, allSize);
|
|
|
- } else {
|
|
|
- // 项目总库
|
|
|
- List<SubInfoZkVO> exportList = new ArrayList<>();
|
|
|
- // 合计行
|
|
|
- SubInfoZkVO hjCount = new SubInfoZkVO();
|
|
|
- hjCount.setIndex(String.format("合计(%s个)", list.size()));
|
|
|
- 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<SubInfoZkVO> hyList = new ArrayList<>();
|
|
|
- // 行业合计行
|
|
|
- SubInfoZkVO hyCount = new SubInfoZkVO();
|
|
|
- hyCount.setIndex(String.format("%s、%s( %s个 )", toChineseNumber(index), hyDictMap.getOrDefault(key, key), value.size()));
|
|
|
- // 每条数据行
|
|
|
- hyList.add(hyCount);
|
|
|
- for (int i = 0; i < value.size(); i++) {
|
|
|
- SubInfoGxj subInfoGxj = value.get(i);
|
|
|
- SubInfoZkVO vo = new SubInfoZkVO();
|
|
|
- BeanUtils.copyProperties(subInfoGxj, vo);
|
|
|
- vo.setAmtTotal(convertAmount(subInfoGxj.getAmtTotal()));
|
|
|
- vo.setIndex(i + 1 + "");
|
|
|
- hyList.add(vo);
|
|
|
- }
|
|
|
- // 添加前计算合并行
|
|
|
- allSize.add(exportList.size() + 2);
|
|
|
- exportList.addAll(hyList);
|
|
|
- index++;
|
|
|
+ // 添加前计算合并行
|
|
|
+ allSize.add(exportList.size() + 2);
|
|
|
+ allSize.add(2);
|
|
|
+ exportList.addAll(hyList);
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ ExportParams exportParams = new ExportParams("“四个一批”工业项目表(项目总库)", "项目总库", ExcelType.XSSF);
|
|
|
+ exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
+ // exportParams.setHeight((short) -1);
|
|
|
+ workbook = ExcelExportUtil.exportExcel(exportParams, SubInfoZkVO.class, exportList);
|
|
|
+ extracted(response, list, workbook, allSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 投产 导出明细
|
|
|
+ */
|
|
|
+ private void exportTcDetailExcel(SubInfoQueryTzVO queryVO) {
|
|
|
+ WebLogAspect.content.set(String.format("页面:【项目四库管理-%s库】,执行操作:导出明细", StringUtils.isBlank(queryVO.getStatus()) ? "项目总" : SubInfoStatusEnum.getDesc(queryVO.getStatus())));
|
|
|
+ queryVO.setSubjectAuthIds(getSubjectIds());
|
|
|
+ List<SubInfoGxj> list = subInfoQueryService.queryAll(getCurUser().getLoginUser(), queryVO);
|
|
|
+ // 行业字典
|
|
|
+ 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 -> {
|
|
|
+ if (StringUtils.isNotBlank(e.getIndusKind())){
|
|
|
+ return e.getIndusKind().substring(0, 2);
|
|
|
+ }
|
|
|
+ return "未知行业";
|
|
|
+ }));
|
|
|
+ Workbook workbook;
|
|
|
+ List<SubInfoTcVO> exportList = new ArrayList<>();
|
|
|
+ // 合计行
|
|
|
+ SubInfoTcVO hjCount = new SubInfoTcVO();
|
|
|
+ hjCount.setIndex(String.format("合计(%s个)", list.size()));
|
|
|
+ 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<SubInfoTcVO> hyList = new ArrayList<>();
|
|
|
+ // 行业合计行
|
|
|
+ SubInfoTcVO hyCount = new SubInfoTcVO();
|
|
|
+ hyCount.setIndex(String.format("%s、%s( %s个 )", toChineseNumber(index), hyDictMap.getOrDefault(key, key), value.size()));
|
|
|
+ // 每条数据行
|
|
|
+ hyList.add(hyCount);
|
|
|
+ for (int i = 0; i < value.size(); i++) {
|
|
|
+ SubInfoGxj subInfoGxj = value.get(i);
|
|
|
+ SubInfoTcVO vo = new SubInfoTcVO();
|
|
|
+ BeanUtils.copyProperties(subInfoGxj, vo);
|
|
|
+ // BigDecimal divide = subInfoGxj.getAmtTotal() != null ? subInfoGxj.getAmtTotal().divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
|
|
|
+ // vo.setAmtTotal(divide);
|
|
|
+ vo.setIndex(i + 1 + "");
|
|
|
+ hyList.add(vo);
|
|
|
}
|
|
|
- ExportParams exportParams = new ExportParams("“四个一批”工业项目表(项目总库)", "项目总库", ExcelType.XSSF);
|
|
|
- exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
- // exportParams.setHeight((short) -1);
|
|
|
- workbook = ExcelExportUtil.exportExcel(exportParams, SubInfoZkVO.class, exportList);
|
|
|
- extracted(response, list, workbook, allSize);
|
|
|
+ // 添加前计算合并行
|
|
|
+ allSize.add(exportList.size() + 2);
|
|
|
+ allSize.add(2);
|
|
|
+ exportList.addAll(hyList);
|
|
|
+ index++;
|
|
|
}
|
|
|
+ ExportParams exportParams = new ExportParams("“四个一批”工业项目表(投产项目库)", "投产项目库", ExcelType.XSSF);
|
|
|
+ exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
+ // 设置默认样式(这里设置所有单元格都有边框)
|
|
|
+ workbook = ExcelExportUtil.exportExcel(exportParams, SubInfoTcVO.class, exportList);
|
|
|
+ extracted(response, list, workbook, allSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 储备库 导出明细
|
|
|
+ */
|
|
|
+ private void exportCbDetailExcel(SubInfoQueryTzVO queryVO) {
|
|
|
+ queryVO.setSubjectAuthIds(getSubjectIds());
|
|
|
+ List<SubInfoGxj> list = subInfoQueryService.queryAll(getCurUser().getLoginUser(), queryVO);
|
|
|
+ // 行业字典
|
|
|
+ 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 -> {
|
|
|
+ if (StringUtils.isNotBlank(e.getIndusKind())){
|
|
|
+ return e.getIndusKind().substring(0, 2);
|
|
|
+ }
|
|
|
+ return "未知行业";
|
|
|
+ }));
|
|
|
+ ExportParams exportParams = new ExportParams("“四个一批”工业项目表(储备项目库)", "储备项目库", ExcelType.XSSF);
|
|
|
+ exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
+ exportDetail(response, exportParams, SubInfoCbVO.class, list, hyDictMap, groupMap);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1093,36 +1363,64 @@ public class SubInfoExportController extends BaseController {
|
|
|
data.put("lastXjToCbNum", lastCounterVo.xjToCbNum);
|
|
|
data.put("lastRgToZjNum", lastCounterVo.rgToZjNum);
|
|
|
|
|
|
- // 分属地看
|
|
|
- Map<String, List<LogOperateVO>> subjectZhGroups = logList.stream().collect(Collectors.groupingBy(LogOperateVO::getSubjectId));
|
|
|
+
|
|
|
String text = "%s年1-%s月,%s储备项目转新建%s个、新建项目转在建%s个、在建项目转投产%s个、投产项目转入规%s个,新建项目降级为储备%s个、入规项目转为在建%s个。" +
|
|
|
"其中,%s月当月,储备项目转新建%s个、新建项目转在建%s个、在建项目转投产%s个、投产项目转入规%s个,新建项目降级为储备%s个、入规项目转为在建%s个。" +
|
|
|
"1-%s月,项目开工率%s、投产率%s、入规率%s,较1-(%s)月,分别增长%s、%s、%s个百分点。";
|
|
|
+ // 分属地看
|
|
|
+ Map<String, List<LogOperateVO>> subjectZhGroups = logList.stream().collect(Collectors.groupingBy(LogOperateVO::getSubjectId));
|
|
|
StringBuilder subjectZhStr = new StringBuilder();
|
|
|
subjectZhGroups.forEach((key, value) -> {
|
|
|
StatusChangeCountersVO tempVo = new StatusChangeCountersVO();
|
|
|
+ addNum(value, tempVo);
|
|
|
subjectZhStr.append(String.format(text,
|
|
|
year, month, jsddMap.get(key), tempVo.cbToXjNum, tempVo.xjToZjNum, tempVo.zjToTcNum, tempVo.tcToRgNum, tempVo.xjToCbNum, tempVo.rgToZjNum,
|
|
|
- month, totalCounterVo.cbToXjNum, tempVo.xjToZjNum, tempVo.zjToTcNum, tempVo.tcToRgNum, tempVo.xjToCbNum, tempVo.rgToZjNum,
|
|
|
+ month, tempVo.cbToXjNum, tempVo.xjToZjNum, tempVo.zjToTcNum, tempVo.tcToRgNum, tempVo.xjToCbNum, tempVo.rgToZjNum,
|
|
|
month, "0%", "0%", "0%", lastMonth, "0", "0", "0"));
|
|
|
});
|
|
|
-
|
|
|
data.put("subjectZhStr", subjectZhStr);
|
|
|
+
|
|
|
// 分规模看
|
|
|
- Map<String, List<LogOperateVO>> scaleZhGroups = logList.stream().collect(Collectors.groupingBy(LogOperateVO::getSubjectId));
|
|
|
- String scaleZhStr = String.format(text,
|
|
|
- year, month, "计划总投资100亿元以上", totalCounterVo.cbToXjNum, totalCounterVo.xjToZjNum, totalCounterVo.zjToTcNum, totalCounterVo.tcToRgNum, totalCounterVo.xjToCbNum, totalCounterVo.rgToZjNum,
|
|
|
- month, totalCounterVo.cbToXjNum, totalCounterVo.xjToZjNum, totalCounterVo.zjToTcNum, totalCounterVo.tcToRgNum, totalCounterVo.xjToCbNum, totalCounterVo.rgToZjNum,
|
|
|
- month, "0%", "0%", "0%", lastMonth, "0", "0", "0"
|
|
|
- );
|
|
|
+ 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) {
|
|
|
+ return entry.getKey();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "100亿元以上";
|
|
|
+ }));
|
|
|
+ StringBuilder scaleZhStr = new StringBuilder();
|
|
|
+ scaleZhGroups.forEach((key, value) -> {
|
|
|
+ StatusChangeCountersVO tempVo = new StatusChangeCountersVO();
|
|
|
+ addNum(value, tempVo);
|
|
|
+ scaleZhStr.append(String.format(text,
|
|
|
+ year, month, "计划总投资" + key, tempVo.cbToXjNum, tempVo.xjToZjNum, tempVo.zjToTcNum, tempVo.tcToRgNum, tempVo.xjToCbNum, tempVo.rgToZjNum,
|
|
|
+ month, tempVo.cbToXjNum, tempVo.xjToZjNum, tempVo.zjToTcNum, tempVo.tcToRgNum, tempVo.xjToCbNum, tempVo.rgToZjNum,
|
|
|
+ month, "0%", "0%", "0%", lastMonth, "0", "0", "0"
|
|
|
+ ));
|
|
|
+ });
|
|
|
data.put("scaleZhStr", scaleZhStr);
|
|
|
+
|
|
|
// 分行业看
|
|
|
- Map<String, List<LogOperateVO>> hyZhGroups = logList.stream().collect(Collectors.groupingBy(LogOperateVO::getSubjectId));
|
|
|
- String hyZhStr = String.format(text,
|
|
|
- year, month, "制造业", totalCounterVo.cbToXjNum, totalCounterVo.xjToZjNum, totalCounterVo.zjToTcNum, totalCounterVo.tcToRgNum, totalCounterVo.xjToCbNum, totalCounterVo.rgToZjNum,
|
|
|
- month, totalCounterVo.cbToXjNum, totalCounterVo.xjToZjNum, totalCounterVo.zjToTcNum, totalCounterVo.tcToRgNum, totalCounterVo.xjToCbNum, totalCounterVo.rgToZjNum,
|
|
|
- month, "0%", "0%", "0%", lastMonth, "0", "0", "0"
|
|
|
- );
|
|
|
+ Map<String, List<LogOperateVO>> hyZhGroups = logList.stream()
|
|
|
+ .collect(Collectors.groupingBy(transaction -> {
|
|
|
+ String code = transaction.getIndusKind();
|
|
|
+ // 确保code不为空且长度至少为2
|
|
|
+ if (code == null || code.length() < 2) {
|
|
|
+ return "未知行业"; // 默认未知行业
|
|
|
+ }
|
|
|
+ return code.substring(0, 2);
|
|
|
+ }));
|
|
|
+ StringBuilder hyZhStr = new StringBuilder();
|
|
|
+ hyZhGroups.forEach((key, value) -> {
|
|
|
+ StatusChangeCountersVO tempVo = new StatusChangeCountersVO();
|
|
|
+ addNum(value, tempVo);
|
|
|
+ hyZhStr.append(String.format(text,
|
|
|
+ year, month, hyflMap.get(key), tempVo.cbToXjNum, tempVo.xjToZjNum, tempVo.zjToTcNum, tempVo.tcToRgNum, tempVo.xjToCbNum, tempVo.rgToZjNum,
|
|
|
+ month, tempVo.cbToXjNum, tempVo.xjToZjNum, tempVo.zjToTcNum, tempVo.tcToRgNum, tempVo.xjToCbNum, tempVo.rgToZjNum,
|
|
|
+ month, "0%", "0%", "0%", lastMonth, "0", "0", "0"
|
|
|
+ ));
|
|
|
+ });
|
|
|
data.put("hyZhStr", hyZhStr);
|
|
|
// 二、存在问题
|
|
|
// (一)项目落地方面
|
|
@@ -1311,6 +1609,7 @@ public class SubInfoExportController extends BaseController {
|
|
|
}
|
|
|
// 添加前计算合并行
|
|
|
allSize.add(exportList.size() + 2);
|
|
|
+ allSize.add(2);
|
|
|
exportList.addAll(hyList);
|
|
|
index++;
|
|
|
}
|
|
@@ -1329,8 +1628,8 @@ public class SubInfoExportController extends BaseController {
|
|
|
// 合并单元格
|
|
|
CellStyle nonCenterCellStyle = createNonCenterBoldCellStyle(workbook);
|
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
|
- allSize.add(2);
|
|
|
- for (Integer row : allSize) {
|
|
|
+ // allSize.add(2);
|
|
|
+ for (Integer row : new HashSet<>(allSize)) {
|
|
|
sheet.addMergedRegion(new CellRangeAddress(row, row, 0, 3));
|
|
|
// 获取合并区域的左上角单元格并设置样式
|
|
|
Row mergedRow = sheet.getRow(row);
|