添加功能

This commit is contained in:
马宝龙
2026-07-06 12:27:51 +08:00
parent c4f44345e2
commit 2b29ea6618
6 changed files with 155 additions and 32 deletions

View File

@@ -0,0 +1,38 @@
package com.ruoyi.cms.domain.vo;
import com.ruoyi.cms.domain.ModelDemandMonitorIndustryTrend;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* 劳动力需求分行业需求趋势分析
*
* @author 马宝龙
* @date 2026/7/3
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ModelDemandMonitorIndustryTrendDataVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 年月
*/
private String yearMonth;
/**
* 总数
*/
private Integer totalCount;
/**
* 数据列表
*/
private List<ModelDemandMonitorIndustryTrend> industryList;
}

View File

@@ -1,6 +1,5 @@
package com.ruoyi.cms.domain.vo;
import com.ruoyi.cms.domain.dto.ExcelRow;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -25,10 +24,10 @@ public class ModelDemandMonitorIndustryTrendVo implements Serializable {
/**
* 标题列表
*/
// private List<String> titleList;
private List<String> titleList;
/**
* 数据列表
*/
private List<ExcelRow> dataList;
private List<ModelDemandMonitorIndustryTrendDataVo> dataList;
}

View File

@@ -0,0 +1,38 @@
package com.ruoyi.cms.domain.vo;
import com.ruoyi.cms.domain.ModelDemandMonitorMajorIndustryTrend;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* 劳动力需求重点产业需求趋势分析
*
* @author 马宝龙
* @date 2026/7/3
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ModelDemandMonitorMajorIndustryTrendDataVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 年月
*/
private String yearMonth;
/**
* 总数
*/
private Integer totalCount;
/**
* 数据列表
*/
private List<ModelDemandMonitorMajorIndustryTrend> majorIndustryList;
}

View File

@@ -1,6 +1,5 @@
package com.ruoyi.cms.domain.vo;
import com.ruoyi.cms.domain.dto.ExcelRow;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -22,8 +21,13 @@ import java.util.List;
public class ModelDemandMonitorMajorIndustryTrendVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 标题列表
*/
private List<String> titleList;
/**
* 数据列表
*/
private List<ExcelRow> dataList;
private List<ModelDemandMonitorMajorIndustryTrendDataVo> dataList;
}

View File

@@ -2,9 +2,9 @@ package com.ruoyi.cms.service.impl;
import com.ruoyi.cms.constant.enums.ModelTemplateTypeEnum;
import com.ruoyi.cms.domain.ModelDemandMonitorIndustryTrend;
import com.ruoyi.cms.domain.ModelDemandMonitorMajorIndustryTrend;
import com.ruoyi.cms.domain.dto.ExcelRow;
import com.ruoyi.cms.domain.dto.ModelExportParamDto;
import com.ruoyi.cms.domain.vo.ModelDemandMonitorIndustryTrendDataVo;
import com.ruoyi.cms.domain.vo.ModelDemandMonitorIndustryTrendVo;
import com.ruoyi.cms.mapper.ModelDemandMonitorIndustryTrendMapper;
import com.ruoyi.cms.service.ModelDemandMonitorIndustryTrendService;
@@ -164,36 +164,42 @@ public class ModelDemandMonitorIndustryTrendServiceImpl implements ModelDemandMo
map.put(trend.getYearMonth(), trendList);
}
List<ExcelRow> dataList = new ArrayList<>();
List<ModelDemandMonitorIndustryTrendDataVo> dataList = new ArrayList<>();
List<String> industryCodeList = new ArrayList<>(industryCodeSet);
Collections.sort(industryCodeList);
List<String> firstRow = new ArrayList<>();
firstRow.add("年月");
firstRow.add("总需求人数");
List<String> titleList = new ArrayList<>();
titleList.add("年月");
titleList.add("总需求人数");
for (String industryCode : industryCodeList) {
firstRow.add(industryName.get(industryCode));
titleList.add(industryName.get(industryCode));
}
dataList.add(new ExcelRow(firstRow.toArray(new String[0])));
for (Map.Entry<String, List<ModelDemandMonitorIndustryTrend>> entry : map.entrySet()) {
List<String> rows = new ArrayList<>();
rows.add(entry.getKey());
ModelDemandMonitorIndustryTrendDataVo dataVo = ModelDemandMonitorIndustryTrendDataVo.builder()
.yearMonth(entry.getKey())
.totalCount(0)
.industryList(new ArrayList<>())
.build();
List<ModelDemandMonitorIndustryTrend> trends = entry.getValue();
Map<String, ModelDemandMonitorIndustryTrend> trendMap = new HashMap<>();
for (ModelDemandMonitorIndustryTrend trend : trends) {
trendMap.put(trend.getIndustryCode(), trend);
}
int totalDemandCount = 0;
List<ModelDemandMonitorIndustryTrend> industryList = new ArrayList<>();
for (String industryCode : industryCodeList) {
Integer demandCount = Optional.ofNullable(trendMap.get(industryCode))
.map(ModelDemandMonitorIndustryTrend::getDemandCount)
.orElse(0);
totalDemandCount += demandCount;
rows.add(demandCount.toString());
industryList.add(trendMap.get(industryCode));
}
rows.add(1, Integer.toString(totalDemandCount));
dataList.add(new ExcelRow(rows.toArray(new String[0])));
dataVo.setTotalCount(totalDemandCount);
dataVo.setIndustryList(industryList);
dataList.add(dataVo);
}
vo.setTitleList(titleList);
vo.setDataList(dataList);
return vo;
}
@@ -258,9 +264,24 @@ public class ModelDemandMonitorIndustryTrendServiceImpl implements ModelDemandMo
.yearMonth(dto.getYearMonth())
.build());
List<ExcelRow> dataList = new ArrayList<>();
List<String> titleList = vo.getTitleList();
dataList.add(new ExcelRow(titleList.toArray(new String[0])));
for (ModelDemandMonitorIndustryTrendDataVo dataVo : vo.getDataList()) {
List<String> dataStr = new ArrayList<>();
dataStr.add(dataVo.getYearMonth());
dataStr.add(String.valueOf(dataVo.getTotalCount()));
for (ModelDemandMonitorIndustryTrend trend : dataVo.getIndustryList()) {
dataStr.add(String.valueOf(trend.getDemandCount()));
}
dataList.add(new ExcelRow(dataStr.toArray(new String[0])));
}
MultiSheetExcelUtil multiSheetExcelUtil = new MultiSheetExcelUtil();
ExcelUtil<ExcelRow> basicSituationExcelUtil = new com.ruoyi.cms.util.document.ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(vo.getDataList());
basicSituationExcelUtil.setDataList(dataList);
basicSituationExcelUtil.setSheetName("分行业需求趋势分析");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
multiSheetExcelUtil.setFileName(ModelTemplateTypeEnum.MODEL_DEMAND_MONITOR_INDUSTRY_TREND.getDesc());

View File

@@ -4,6 +4,7 @@ import com.ruoyi.cms.constant.enums.ModelTemplateTypeEnum;
import com.ruoyi.cms.domain.ModelDemandMonitorMajorIndustryTrend;
import com.ruoyi.cms.domain.dto.ExcelRow;
import com.ruoyi.cms.domain.dto.ModelExportParamDto;
import com.ruoyi.cms.domain.vo.ModelDemandMonitorMajorIndustryTrendDataVo;
import com.ruoyi.cms.domain.vo.ModelDemandMonitorMajorIndustryTrendVo;
import com.ruoyi.cms.mapper.ModelDemandMonitorMajorIndustryTrendMapper;
import com.ruoyi.cms.service.ModelDemandMonitorMajorIndustryTrendService;
@@ -163,36 +164,43 @@ public class ModelDemandMonitorMajorIndustryTrendServiceImpl implements ModelDem
map.put(trend.getYearMonth(), trendList);
}
List<ExcelRow> dataList = new ArrayList<>();
List<ModelDemandMonitorMajorIndustryTrendDataVo> dataList = new ArrayList<>();
List<String> industryCodeList = new ArrayList<>(industryCodeSet);
Collections.sort(industryCodeList);
List<String> firstRow = new ArrayList<>();
firstRow.add("年月");
firstRow.add("总需求人数");
List<String> titleList = new ArrayList<>();
titleList.add("年月");
titleList.add("总需求人数");
for (String industryCode : industryCodeList) {
firstRow.add(industryName.get(industryCode));
titleList.add(industryName.get(industryCode));
}
dataList.add(new ExcelRow(firstRow.toArray(new String[0])));
for (Map.Entry<String, List<ModelDemandMonitorMajorIndustryTrend>> entry : map.entrySet()) {
List<String> rows = new ArrayList<>();
rows.add(entry.getKey());
ModelDemandMonitorMajorIndustryTrendDataVo dataVo = ModelDemandMonitorMajorIndustryTrendDataVo.builder()
.yearMonth(entry.getKey())
.totalCount(0)
.majorIndustryList(new ArrayList<>())
.build();
List<ModelDemandMonitorMajorIndustryTrend> trends = entry.getValue();
Map<String, ModelDemandMonitorMajorIndustryTrend> trendMap = new HashMap<>();
for (ModelDemandMonitorMajorIndustryTrend trend : trends) {
trendMap.put(trend.getIndustryCode(), trend);
}
int totalDemandCount = 0;
List<ModelDemandMonitorMajorIndustryTrend> industryList = new ArrayList<>();
for (String industryCode : industryCodeList) {
Integer demandCount = Optional.ofNullable(trendMap.get(industryCode))
.map(ModelDemandMonitorMajorIndustryTrend::getDemandCount)
.orElse(0);
totalDemandCount += demandCount;
rows.add(demandCount.toString());
industryList.add(trendMap.get(industryCode));
}
rows.add(1, Integer.toString(totalDemandCount));
dataList.add(new ExcelRow(rows.toArray(new String[0])));
dataVo.setTotalCount(totalDemandCount);
dataVo.setMajorIndustryList(industryList);
dataList.add(dataVo);
}
vo.setTitleList(titleList);
vo.setDataList(dataList);
return vo;
}
@@ -258,9 +266,24 @@ public class ModelDemandMonitorMajorIndustryTrendServiceImpl implements ModelDem
.yearMonth(dto.getYearMonth())
.build());
List<ExcelRow> dataList = new ArrayList<>();
List<String> titleList = vo.getTitleList();
dataList.add(new ExcelRow(titleList.toArray(new String[0])));
for (ModelDemandMonitorMajorIndustryTrendDataVo dataVo : vo.getDataList()) {
List<String> dataStr = new ArrayList<>();
dataStr.add(dataVo.getYearMonth());
dataStr.add(String.valueOf(dataVo.getTotalCount()));
for (ModelDemandMonitorMajorIndustryTrend trend : dataVo.getMajorIndustryList()) {
dataStr.add(String.valueOf(trend.getDemandCount()));
}
dataList.add(new ExcelRow(dataStr.toArray(new String[0])));
}
MultiSheetExcelUtil multiSheetExcelUtil = new MultiSheetExcelUtil();
ExcelUtil<ExcelRow> basicSituationExcelUtil = new com.ruoyi.cms.util.document.ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(vo.getDataList());
basicSituationExcelUtil.setDataList(dataList);
basicSituationExcelUtil.setSheetName("重点产业需求趋势分析");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
multiSheetExcelUtil.setFileName(ModelTemplateTypeEnum.MODEL_DEMAND_MONITOR_MAJOR_INDUSTRY_TREND.getDesc());