添加功能

This commit is contained in:
马宝龙
2026-06-29 20:01:46 +08:00
parent dd57a43aac
commit 0d417b2393
16 changed files with 2384 additions and 126 deletions

View File

@@ -82,6 +82,15 @@ public class CommonConstant {
Tuples.of("S", "公共管理、社会保障和社会组织"),
Tuples.of("T", "国际组织")
)));
/**
* 行业Map
*/
public static final Map<String, String> INDUSTRY_MAP =
Collections.unmodifiableMap(INDUSTRY_LIST.stream()
.collect(Collectors.toMap(
Tuple2::getT1,
Tuple2::getT2
)));
/**
* 重点行业列表
@@ -115,8 +124,8 @@ public class CommonConstant {
/**
* 重点行业Map
*/
public static final Map<String, String> INDUSTRY_MAP =
Collections.unmodifiableMap(INDUSTRY_LIST.stream()
public static final Map<String, String> MAJOR_INDUSTRY_MAP =
Collections.unmodifiableMap(MAJOR_INDUSTRY_LIST.stream()
.collect(Collectors.toMap(
Tuple2::getT1,
Tuple2::getT2
@@ -271,4 +280,26 @@ public class CommonConstant {
Tuple2::getT1,
Tuple2::getT2
)));
/**
* 岗位类型列表
*/
public static final List<Tuple2<String, String>> JOB_TYPE_LIST =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", "管理人员"),
Tuples.of("2", "专业技术人员"),
Tuples.of("3", "技能工人"),
Tuples.of("4", "一般员工"),
Tuples.of("5", "其他")
)));
/**
* 岗位类型Map
*/
public static final Map<String, String> JOB_TYPE_MAP =
Collections.unmodifiableMap(JOB_TYPE_LIST.stream()
.collect(Collectors.toMap(
Tuple2::getT1,
Tuple2::getT2
)));
}

View File

@@ -0,0 +1,39 @@
package com.ruoyi.cms.domain.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 就业登记 - sql
*
* @author 马宝龙
* @date 2026/6/29
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class EmploymentRegisterSqlDto implements Serializable {
private static final long serialVersionUID = 9063231507432460113L;
/**
* 总人数
*/
private Long totalEmploymentCount;
/**
* 累计城镇新增就业人数
*/
private Long totalTownEmploymentCount;
/**
* 失业人员再就业人数
*/
private Long unEmploymentEmploymentCount;
/**
* 就业困难人员就业人数
*/
private Long employmentDifficultyEmploymentCount;
}

View File

@@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* 查询参数
@@ -47,6 +48,10 @@ public class QueryParamDto implements Serializable {
* 行业
*/
private String industry;
/**
* 行业列表
*/
private List<String> industryList;
/**
* 产业
*/

View File

@@ -30,11 +30,11 @@ public class MajorIndustryEmploymentMonitorOverviewVo implements Serializable {
*/
private BigDecimal monitorIndustryCountMom;
/**
* 测企业数
* 测企业数
*/
private Long monitorCompanyCount;
/**
* 测企业数环比
* 测企业数环比
*/
private BigDecimal monitorCompanyCountMom;
/**

View File

@@ -40,8 +40,24 @@ public class MajorIndustryEmploymentMonitorTreadVo implements Serializable {
* 失业率
*/
private BigDecimal unEmploymentRate;
/**
* 就业人数
*/
private Long employmentCount;
/**
* 失业人数
*/
private Long unemploymentCount;
/**
* 全市平均失业率
*/
private BigDecimal cityAverageUnEmploymentRate;
/**
* 全市就业人数
*/
private Long cityAverageEmploymentCount;
/**
* 全市失业人数
*/
private Long cityAverageUnemploymentCount;
}

View File

@@ -1,8 +1,10 @@
package com.ruoyi.cms.mapper;
import com.ruoyi.cms.domain.dto.EmploymentRegisterSqlDto;
import com.ruoyi.cms.domain.dto.IndustryEmploymentInfoSqlDto;
import com.ruoyi.cms.domain.dto.QueryParamDto;
import com.ruoyi.cms.domain.vo.HeatmapVo;
import com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo;
import com.ruoyi.cms.domain.vo.QueryResultVo;
import com.ruoyi.cms.domain.vo.TreadVo;
@@ -26,6 +28,14 @@ public interface ThemeEmploymentRegisterMapper {
*/
Long queryEmploymentCount(QueryParamDto dto);
/**
* 获取各种就业登记人数
*
* @param dto 获取参数
* @return 人数
*/
EmploymentRegisterSqlDto queryKindEmploymentCount(QueryParamDto dto);
/**
* 查询创业企业总数
*
@@ -129,4 +139,46 @@ public interface ThemeEmploymentRegisterMapper {
* @return 热力图列表
*/
List<HeatmapVo> heatmap(QueryParamDto dto);
/**
* 就业增长趋势 - 年度
*
* @param dto 查询参数
* @return 趋势列表
*/
List<MajorIndustryEmploymentMonitorTreadVo> employmentTrendYear(QueryParamDto dto);
/**
* 就业增长趋势 - 季度
*
* @param dto 查询参数
* @return 趋势列表
*/
List<MajorIndustryEmploymentMonitorTreadVo> employmentTrendQuarter(QueryParamDto dto);
/**
* 就业增长趋势 - 月度
*
* @param dto 查询参数
* @return 趋势列表
*/
List<MajorIndustryEmploymentMonitorTreadVo> employmentTrendMonth(QueryParamDto dto);
/**
* 查询各行业就业人数
*
* @param dto 查询参数
* @return 数
*/
List<QueryResultVo> queryEmploymentCountByIndustry(QueryParamDto dto);
/**
* 查询各岗位类型就业人数
*
* @param dto 查询参数
* @return 数
*/
List<QueryResultVo> queryEmploymentCountByJobType(QueryParamDto dto);
}

View File

@@ -0,0 +1,109 @@
package com.ruoyi.cms.mapper;
import com.ruoyi.cms.domain.dto.QueryParamDto;
import com.ruoyi.cms.domain.vo.HeatmapVo;
import com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo;
import com.ruoyi.cms.domain.vo.QueryResultVo;
import java.util.List;
/**
* 招聘岗位主题库
*
* @author 马宝龙
* @date 2026/6/28
*/
public interface ThemeRecruitmentJobMapper {
/**
* 查询监测行业数
*
* @param dto 查询参数
* @return 数
*/
Long queryMonitorIndustryCount(QueryParamDto dto);
/**
* 查询监测企业数
*
* @param dto 查询参数
* @return 数
*/
Long queryMonitorCompanyCount(QueryParamDto dto);
/**
* 查询就业需求数
*
* @param dto 查询参数
* @return 数
*/
Long queryEmploymentDemandCount(QueryParamDto dto);
/**
* 用工需求增长趋势 - 年度
*
* @param dto 查询参数
* @return 趋势列表
*/
List<MajorIndustryEmploymentMonitorTreadVo> laborDemandTrendYear(QueryParamDto dto);
/**
* 用工需求增长趋势 - 季度
*
* @param dto 查询参数
* @return 趋势列表
*/
List<MajorIndustryEmploymentMonitorTreadVo> laborDemandTrendQuarter(QueryParamDto dto);
/**
* 用工需求增长趋势 - 月度
*
* @param dto 查询参数
* @return 趋势列表
*/
List<MajorIndustryEmploymentMonitorTreadVo> laborDemandTrendMonth(QueryParamDto dto);
/**
* 查询各行业就业需求数
*
* @param dto 查询参数
* @return 数
*/
List<QueryResultVo> queryEmploymentDemandCountByIndustry(QueryParamDto dto);
/**
* 薪资水平监测
*
* @param dto 查询参数
* @return 结果列表
*/
List<QueryResultVo> salaryLevel(QueryParamDto dto);
/**
* 查询各岗位类型就业需求数
*
* @param dto 查询参数
* @return 数
*/
List<QueryResultVo> queryEmploymentDemandCountByJobType(QueryParamDto dto);
/**
* 查询各行业用工缺口数
*
* @param dto 查询参数
* @return 数
*/
List<QueryResultVo> queryLaborGapCountByIndustry(QueryParamDto dto);
/**
* 热力图
*
* @param dto 查询参数
* @return 热力图列表
*/
List<HeatmapVo> heatmap(QueryParamDto dto);
}

View File

@@ -0,0 +1,98 @@
package com.ruoyi.cms.mapper;
import com.ruoyi.cms.domain.dto.QueryParamDto;
import com.ruoyi.cms.domain.vo.HeatmapVo;
import com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo;
import com.ruoyi.cms.domain.vo.QueryResultVo;
import java.util.List;
/**
* 失业登记主题库
*
* @author 马宝龙
* @date 2026/6/27
*/
public interface ThemeUnemploymentRegisterMapper {
/**
* 查询失业登记人数
*
* @param dto 查询参数
* @return 人数
*/
Long queryUnemploymentCount(QueryParamDto dto);
/**
* 失业增长趋势 - 年度
*
* @param dto 查询参数
* @return 趋势列表
*/
List<MajorIndustryEmploymentMonitorTreadVo> unemploymentTrendYear(QueryParamDto dto);
/**
* 失业增长趋势 - 季度
*
* @param dto 查询参数
* @return 趋势列表
*/
List<MajorIndustryEmploymentMonitorTreadVo> unemploymentTrendQuarter(QueryParamDto dto);
/**
* 失业增长趋势 - 月度
*
* @param dto 查询参数
* @return 趋势列表
*/
List<MajorIndustryEmploymentMonitorTreadVo> unemploymentTrendMonth(QueryParamDto dto);
/**
* 查询各行业失业人数
*
* @param dto 查询参数
* @return 数
*/
List<QueryResultVo> queryUnemploymentCountByIndustry(QueryParamDto dto);
/**
* 失业人员行业分布
*
* @param dto 查询参数
* @return 结果列表
*/
List<QueryResultVo> industryDistribution(QueryParamDto dto);
/**
* 性别就业差异分析
*
* @param dto 查询参数
* @return 结果列表
*/
List<QueryResultVo> gender(QueryParamDto dto);
/**
* 查询各行业失业人数
*
* @param dto 查询参数
* @return 数
*/
List<QueryResultVo> queryUnemploymentCountByJobType(QueryParamDto dto);
/**
* 查询各行业裁员人数
*
* @param dto 查询参数
* @return 数
*/
List<QueryResultVo> queryLayoffCountByIndustry(QueryParamDto dto);
/**
* 热力图
*
* @param dto 查询参数
* @return 热力图列表
*/
List<HeatmapVo> heatmap(QueryParamDto dto);
}

View File

@@ -7,11 +7,14 @@ import com.ruoyi.cms.domain.vo.GraduateEmploymentInfoStartupVo;
import com.ruoyi.cms.domain.vo.GraduateEmploymentInfoTreadVo;
import com.ruoyi.cms.domain.vo.HeatmapVo;
import com.ruoyi.cms.domain.vo.IndustryEmploymentInfoOverviewVo;
import com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorOverviewVo;
import com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo;
import com.ruoyi.cms.domain.vo.QueryResultVo;
import com.ruoyi.cms.domain.vo.TreadVo;
import com.ruoyi.cms.service.AnalysisExportService;
import com.ruoyi.cms.service.AnalysisGraduateEmploymentInfoService;
import com.ruoyi.cms.service.AnalysisIndustryEmploymentInfoService;
import com.ruoyi.cms.service.AnalysisMajorIndustryEmploymentMonitorService;
import com.ruoyi.cms.util.document.ExcelUtil;
import com.ruoyi.cms.util.document.MultiSheetExcelUtil;
import com.ruoyi.common.exception.ServiceException;
@@ -44,6 +47,7 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
private final AnalysisIndustryEmploymentInfoService analysisIndustryEmploymentInfoService;
private final AnalysisGraduateEmploymentInfoService analysisGraduateEmploymentInfoService;
private final AnalysisMajorIndustryEmploymentMonitorService analysisMajorIndustryEmploymentMonitorService;
@Override
public void exportData(HttpServletResponse response, QueryParamDto dto) {
@@ -62,7 +66,7 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
break;
// 就业大数据专题分析平台-重点行业就失业监测分析
case EMPLOYMENT_MAJOR_INDUSTRY_EMPLOYMENT_MONITOR:
test(response, dto);
exportMajorIndustryEmploymentMonitor(response, dto);
break;
// 就业大数据专题分析平台-产业发展与人才供需分析
case EMPLOYMENT_SECTOR_TALENT:
@@ -90,7 +94,7 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
break;
// 智慧就业大数据分析展示系统-重点行业就失业监测分析
case WISDOM_EMPLOYMENT_MAJOR_INDUSTRY_EMPLOYMENT_MONITOR:
test(response, dto);
exportWisdomMajorIndustryEmploymentMonitor(response, dto);
break;
// 智慧就业大数据分析展示系统-产业与人才供需技能提升分析
case WISDOM_EMPLOYMENT_SECTOR_TALENT_SKILL:
@@ -552,7 +556,8 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
basicExportList.add(new ExcelRow("指标(单位)", "指标值"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
GraduateEmploymentInfoStartupVo startupSituation = analysisGraduateEmploymentInfoService.startupSituation(newParam);
GraduateEmploymentInfoStartupVo startupSituation =
analysisGraduateEmploymentInfoService.startupSituation(newParam);
basicExportList.add(new ExcelRow(
"创业人数(人)", transform(startupSituation.getStartupCount())
@@ -597,6 +602,203 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
}
/**
* 导出 重点行业就失业监测分析
*
* @param response 响应
* @param dto 查询参数
* @throws IOException 异常
*/
private void exportMajorIndustryEmploymentMonitor(HttpServletResponse response, QueryParamDto dto) throws IOException {
MultiSheetExcelUtil multiSheetExcelUtil = new MultiSheetExcelUtil();
String exportTime = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS);
// 数据总览
List<ExcelRow> basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("导出时间", exportTime));
basicExportList.add(new ExcelRow("数据总览"));
basicExportList.add(new ExcelRow("指标名称(单位)", "指标值", "较上期变化(%"));
QueryParamDto newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
MajorIndustryEmploymentMonitorOverviewVo overview =
analysisMajorIndustryEmploymentMonitorService.overview(newParam);
basicExportList.add(new ExcelRow(
"监测行业数(个)", transform(overview.getMonitorIndustryCount()),
transform(overview.getMonitorIndustryCountMom())
));
basicExportList.add(new ExcelRow(
"监测企业数(家)", transform(overview.getMonitorCompanyCount()),
transform(overview.getMonitorCompanyCountMom())
));
basicExportList.add(new ExcelRow(
"累计城镇新增就业人数(人)", transform(overview.getTotalTownEmploymentCount()),
transform(overview.getTotalTownEmploymentCountMom())
));
basicExportList.add(new ExcelRow(
"失业人员再就业人数(人)", transform(overview.getUnEmploymentEmploymentCount()),
transform(overview.getUnEmploymentEmploymentCountMom())
));
basicExportList.add(new ExcelRow(
"就业困难人员就业人数(人)", transform(overview.getEmploymentDifficultyEmploymentCount()),
transform(overview.getEmploymentDifficultyEmploymentCountMom())
));
basicExportList.add(new ExcelRow(
"就业需求(人)", transform(overview.getEmploymentDemandCount()),
transform(overview.getEmploymentDemandCountMom())
));
basicExportList.add(new ExcelRow(
"失业人数(人)", transform(overview.getUnEmploymentCount()),
transform(overview.getUnEmploymentCountMom())
));
basicExportList.add(new ExcelRow(
"失业率(%", transform(overview.getUnEmploymentRate()),
transform(overview.getUnEmploymentRateMom())
));
// 创建Excel工具类并添加工作表
ExcelUtil<ExcelRow> basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("数据总览");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
// 用工需求和失业率趋势
basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("用工需求和失业率趋势"));
basicExportList.add(new ExcelRow("时间", "用工需求(人)", "城镇新增就业(人)", "失业率(%", "全市平均失业率(%"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
List<MajorIndustryEmploymentMonitorTreadVo> monitorTreadList =
analysisMajorIndustryEmploymentMonitorService.demandAndUnemploymentRate(newParam);
for (MajorIndustryEmploymentMonitorTreadVo tread : monitorTreadList) {
basicExportList.add(new ExcelRow(
tread.getDesc(), transform(tread.getLaborDemandCount()), transform(tread.getTownEmploymentCount()),
transform(tread.getUnEmploymentRate()), transform(tread.getCityAverageUnEmploymentRate())
));
}
// 创建Excel工具类并添加工作表
basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("用工需求和失业率趋势");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
// 行业失业率对比
basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("行业失业率对比"));
basicExportList.add(new ExcelRow("行业", "用工需求(人)", "失业率(%"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
List<QueryResultVo> treadList =
analysisMajorIndustryEmploymentMonitorService.industryUnemploymentRate(newParam);
for (QueryResultVo tread : treadList) {
basicExportList.add(new ExcelRow(
tread.getDesc(), transform(tread.getCount()), transform(tread.getRate())
));
}
// 创建Excel工具类并添加工作表
basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("行业失业率对比");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
// 薪资水平监测
basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("薪资水平监测"));
basicExportList.add(new ExcelRow("行业", "平均薪资(元)", "中位数薪资(元)"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
List<QueryResultVo> resultList = analysisMajorIndustryEmploymentMonitorService.salaryLevel(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.getAmount()), transform(result.getAnotherAmount())
));
}
// 创建Excel工具类并添加工作表
basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("薪资水平监测");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
// 失业人员行业分布
basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("失业人员行业分布"));
basicExportList.add(new ExcelRow("行业", "人数(人)", "占比(%"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
resultList = analysisMajorIndustryEmploymentMonitorService.industryDistribution(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.getCount()), transform(result.getCountPercentage())
));
}
// 创建Excel工具类并添加工作表
basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("失业人员行业分布");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
// 性别失业差异分析
basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("性别失业差异分析"));
basicExportList.add(new ExcelRow("性别", "失业人数(人)", "占比(%"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
resultList = analysisMajorIndustryEmploymentMonitorService.gender(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.getCount()), transform(result.getCountPercentage())
));
}
// 创建Excel工具类并添加工作表
basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("性别失业差异分析");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
// 岗位类型就业分析
basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("岗位类型就业分析"));
basicExportList.add(new ExcelRow("岗位类型", "用工需求(人)", "失业率(%"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
resultList = analysisMajorIndustryEmploymentMonitorService.jobType(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.getCount()), transform(result.getRate())
));
}
// 创建Excel工具类并添加工作表
basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("岗位类型就业分析");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
// 裁员和用工缺口监测
basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("裁员和用工缺口监测"));
basicExportList.add(new ExcelRow("行业", "裁员(人)", "用工缺口(人)"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
resultList = analysisMajorIndustryEmploymentMonitorService.layoffAndLaborGap(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.getCount()), transform(result.getAnotherCount())
));
}
// 创建Excel工具类并添加工作表
basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("裁员和用工缺口监测");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
multiSheetExcelUtil.setFileName(dto.getExportModule().getDesc());
multiSheetExcelUtil.exportExcel(response);
}
/**
* 导出 行业就业情况信息分析
@@ -802,7 +1004,6 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
}
/**
* 导出 高校毕业生就业信息分析
*
@@ -1037,7 +1238,8 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
basicExportList.add(new ExcelRow("指标(单位)", "指标值"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
GraduateEmploymentInfoStartupVo startupSituation = analysisGraduateEmploymentInfoService.startupSituation(newParam);
GraduateEmploymentInfoStartupVo startupSituation =
analysisGraduateEmploymentInfoService.startupSituation(newParam);
basicExportList.add(new ExcelRow(
"创业人数(人)", transform(startupSituation.getStartupCount())
@@ -1083,6 +1285,223 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
}
/**
* 导出 重点行业就失业监测分析
*
* @param response 响应
* @param dto 查询参数
* @throws IOException 异常
*/
private void exportWisdomMajorIndustryEmploymentMonitor(HttpServletResponse response, QueryParamDto dto) throws IOException {
MultiSheetExcelUtil multiSheetExcelUtil = new MultiSheetExcelUtil();
String exportTime = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS);
// 数据总览
List<ExcelRow> basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("导出时间", exportTime));
basicExportList.add(new ExcelRow("数据总览"));
basicExportList.add(new ExcelRow("指标名称(单位)", "指标值", "较上期变化(%"));
QueryParamDto newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
MajorIndustryEmploymentMonitorOverviewVo overview =
analysisMajorIndustryEmploymentMonitorService.overview(newParam);
basicExportList.add(new ExcelRow(
"监测行业数(个)", transform(overview.getMonitorIndustryCount()),
transform(overview.getMonitorIndustryCountMom())
));
basicExportList.add(new ExcelRow(
"监测企业数(家)", transform(overview.getMonitorCompanyCount()),
transform(overview.getMonitorCompanyCountMom())
));
basicExportList.add(new ExcelRow(
"累计城镇新增就业人数(人)", transform(overview.getTotalTownEmploymentCount()),
transform(overview.getTotalTownEmploymentCountMom())
));
basicExportList.add(new ExcelRow(
"失业人员再就业人数(人)", transform(overview.getUnEmploymentEmploymentCount()),
transform(overview.getUnEmploymentEmploymentCountMom())
));
basicExportList.add(new ExcelRow(
"就业困难人员就业人数(人)", transform(overview.getEmploymentDifficultyEmploymentCount()),
transform(overview.getEmploymentDifficultyEmploymentCountMom())
));
basicExportList.add(new ExcelRow(
"就业需求(人)", transform(overview.getEmploymentDemandCount()),
transform(overview.getEmploymentDemandCountMom())
));
basicExportList.add(new ExcelRow(
"失业人数(人)", transform(overview.getUnEmploymentCount()),
transform(overview.getUnEmploymentCountMom())
));
basicExportList.add(new ExcelRow(
"失业率(%", transform(overview.getUnEmploymentRate()),
transform(overview.getUnEmploymentRateMom())
));
// 创建Excel工具类并添加工作表
ExcelUtil<ExcelRow> basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("数据总览");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
// 重点行业企业分布热力图
basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("重点行业企业分布热力图"));
basicExportList.add(new ExcelRow("地区", "就业人数(人)"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
List<HeatmapVo> heatmapList = analysisMajorIndustryEmploymentMonitorService.heatmap(newParam);
for (HeatmapVo heatmap : heatmapList) {
basicExportList.add(new ExcelRow(
heatmap.getAreaName(), transform(heatmap.getCount())
));
}
// 创建Excel工具类并添加工作表
basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("重点行业企业分布热力图");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
// 用工需求和失业率趋势
basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("用工需求和失业率趋势"));
basicExportList.add(new ExcelRow("时间", "用工需求(人)", "城镇新增就业(人)", "失业率(%", "全市平均失业率(%"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
List<MajorIndustryEmploymentMonitorTreadVo> monitorTreadList =
analysisMajorIndustryEmploymentMonitorService.demandAndUnemploymentRate(newParam);
for (MajorIndustryEmploymentMonitorTreadVo tread : monitorTreadList) {
basicExportList.add(new ExcelRow(
tread.getDesc(), transform(tread.getLaborDemandCount()), transform(tread.getTownEmploymentCount()),
transform(tread.getUnEmploymentRate()), transform(tread.getCityAverageUnEmploymentRate())
));
}
// 创建Excel工具类并添加工作表
basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("用工需求和失业率趋势");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
// 行业失业率对比
basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("行业失业率对比"));
basicExportList.add(new ExcelRow("行业", "用工需求(人)", "失业率(%"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
List<QueryResultVo> treadList =
analysisMajorIndustryEmploymentMonitorService.industryUnemploymentRate(newParam);
for (QueryResultVo tread : treadList) {
basicExportList.add(new ExcelRow(
tread.getDesc(), transform(tread.getCount()), transform(tread.getRate())
));
}
// 创建Excel工具类并添加工作表
basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("行业失业率对比");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
// 薪资水平监测
basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("薪资水平监测"));
basicExportList.add(new ExcelRow("行业", "平均薪资(元)", "中位数薪资(元)"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
List<QueryResultVo> resultList = analysisMajorIndustryEmploymentMonitorService.salaryLevel(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.getAmount()), transform(result.getAnotherAmount())
));
}
// 创建Excel工具类并添加工作表
basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("薪资水平监测");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
// 失业人员行业分布
basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("失业人员行业分布"));
basicExportList.add(new ExcelRow("行业", "人数(人)", "占比(%"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
resultList = analysisMajorIndustryEmploymentMonitorService.industryDistribution(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.getCount()), transform(result.getCountPercentage())
));
}
// 创建Excel工具类并添加工作表
basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("失业人员行业分布");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
// 性别失业差异分析
basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("性别失业差异分析"));
basicExportList.add(new ExcelRow("性别", "失业人数(人)", "占比(%"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
resultList = analysisMajorIndustryEmploymentMonitorService.gender(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.getCount()), transform(result.getCountPercentage())
));
}
// 创建Excel工具类并添加工作表
basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("性别失业差异分析");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
// 岗位类型就业分析
basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("岗位类型就业分析"));
basicExportList.add(new ExcelRow("岗位类型", "用工需求(人)", "失业率(%"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
resultList = analysisMajorIndustryEmploymentMonitorService.jobType(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.getCount()), transform(result.getRate())
));
}
// 创建Excel工具类并添加工作表
basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("岗位类型就业分析");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
// 裁员和用工缺口监测
basicExportList = new ArrayList<>();
basicExportList.add(new ExcelRow("裁员和用工缺口监测"));
basicExportList.add(new ExcelRow("行业", "裁员(人)", "用工缺口(人)"));
newParam = new QueryParamDto();
BeanUtils.copyProperties(dto, newParam);
resultList = analysisMajorIndustryEmploymentMonitorService.layoffAndLaborGap(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.getCount()), transform(result.getAnotherCount())
));
}
// 创建Excel工具类并添加工作表
basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(basicExportList);
basicSituationExcelUtil.setSheetName("裁员和用工缺口监测");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
multiSheetExcelUtil.setFileName(dto.getExportModule().getDesc());
multiSheetExcelUtil.exportExcel(response);
}
private String transform(Long value) {
if (Objects.isNull(value)) {
return "";

View File

@@ -7,6 +7,8 @@ import com.ruoyi.cms.domain.vo.IndustryEmploymentInfoOverviewVo;
import com.ruoyi.cms.domain.vo.QueryResultVo;
import com.ruoyi.cms.domain.vo.TreadVo;
import com.ruoyi.cms.mapper.ThemeEmploymentRegisterMapper;
import com.ruoyi.cms.mapper.ThemeRecruitmentJobMapper;
import com.ruoyi.cms.mapper.ThemeUnemploymentRegisterMapper;
import com.ruoyi.cms.service.AnalysisIndustryEmploymentInfoService;
import com.ruoyi.cms.util.MathUtil;
import com.ruoyi.cms.util.ParamUtil;
@@ -35,6 +37,8 @@ import java.util.List;
public class AnalysisIndustryEmploymentInfoServiceImpl implements AnalysisIndustryEmploymentInfoService {
private final ThemeEmploymentRegisterMapper themeEmploymentRegisterMapper;
private final ThemeUnemploymentRegisterMapper themeUnemploymentRegisterMapper;
private final ThemeRecruitmentJobMapper themeRecruitmentJobMapper;
@Override
public IndustryEmploymentInfoOverviewVo overview(QueryParamDto dto) {
@@ -43,8 +47,7 @@ public class AnalysisIndustryEmploymentInfoServiceImpl implements AnalysisIndust
ParamUtil.dealParam(dto);
Long employmentCount = themeEmploymentRegisterMapper.queryEmploymentCount(dto);
// todo 失业人数
Long unemploymentCount = 13L;
Long unemploymentCount = themeUnemploymentRegisterMapper.queryUnemploymentCount(dto);
BigDecimal unemploymentRate = MathUtil.calculatePercentage(
(unemploymentCount + employmentCount), unemploymentCount);
@@ -54,8 +57,7 @@ public class AnalysisIndustryEmploymentInfoServiceImpl implements AnalysisIndust
Long flexibleEmploymentCount = themeEmploymentRegisterMapper.queryFlexibleEmploymentCount(dto);
// todo 岗位表 招聘需求
Long recruitmentDemand = 1234L;
Long recruitmentDemand = themeRecruitmentJobMapper.queryEmploymentDemandCount(dto);
BigDecimal averageSalary = themeEmploymentRegisterMapper.queryAverageSalary(dto);
@@ -65,10 +67,9 @@ public class AnalysisIndustryEmploymentInfoServiceImpl implements AnalysisIndust
ParamUtil.calculateLastTime(lastDto);
Long lastEmploymentCount = themeEmploymentRegisterMapper.queryEmploymentCount(lastDto);
// todo 失业人数
Long lastUnemploymentCount = 17L;
Long lastUnemploymentCount = themeUnemploymentRegisterMapper.queryUnemploymentCount(lastDto);
BigDecimal lastUnemploymentRate = MathUtil.calculatePercentage(
(lastUnemploymentCount + employmentCount), lastUnemploymentCount);
(lastUnemploymentCount + lastEmploymentCount), lastUnemploymentCount);
Long lastStartupCompanyCount = themeEmploymentRegisterMapper.queryStartupCompanyCount(lastDto);
@@ -76,8 +77,7 @@ public class AnalysisIndustryEmploymentInfoServiceImpl implements AnalysisIndust
Long lastFlexibleEmploymentCount = themeEmploymentRegisterMapper.queryFlexibleEmploymentCount(lastDto);
// todo 岗位表 招聘需求
Long lastRecruitmentDemand = 634L;
Long lastRecruitmentDemand = themeRecruitmentJobMapper.queryEmploymentDemandCount(lastDto);
BigDecimal lastAverageSalary = themeEmploymentRegisterMapper.queryAverageSalary(lastDto);

View File

@@ -1,25 +1,35 @@
package com.ruoyi.cms.service.impl;
import com.ruoyi.cms.constant.CommonConstant;
import com.ruoyi.cms.domain.dto.EmploymentRegisterSqlDto;
import com.ruoyi.cms.domain.dto.QueryParamDto;
import com.ruoyi.cms.domain.vo.HeatmapVo;
import com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorOverviewVo;
import com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo;
import com.ruoyi.cms.domain.vo.QueryResultVo;
import com.ruoyi.cms.mapper.ThemeEmploymentRegisterMapper;
import com.ruoyi.cms.mapper.ThemeRecruitmentJobMapper;
import com.ruoyi.cms.mapper.ThemeUnemploymentRegisterMapper;
import com.ruoyi.cms.service.AnalysisMajorIndustryEmploymentMonitorService;
import com.ruoyi.cms.util.MathUtil;
import com.ruoyi.cms.util.ParamUtil;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.bean.BeanUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import reactor.util.function.Tuple2;
import reactor.util.function.Tuples;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
/**
* 重点行业就失业监测分析
@@ -30,162 +40,387 @@ import java.util.List;
@Service
@Validated
@Slf4j
@RequiredArgsConstructor
public class AnalysisMajorIndustryEmploymentMonitorServiceImpl implements AnalysisMajorIndustryEmploymentMonitorService {
private final ThemeRecruitmentJobMapper themeRecruitmentJobMapper;
private final ThemeEmploymentRegisterMapper themeEmploymentRegisterMapper;
private final ThemeUnemploymentRegisterMapper themeUnemploymentRegisterMapper;
/**
* 处理参数
*
* @param dto 参数
*/
private void dealParam(QueryParamDto dto) {
ParamUtil.dealParam(dto);
// 设置重点行业
List<String> industryList = new ArrayList<>();
for (Tuple2<String, String> industry : CommonConstant.MAJOR_INDUSTRY_LIST) {
industryList.add(industry.getT1());
}
dto.setIndustryList(industryList);
}
@Override
public MajorIndustryEmploymentMonitorOverviewVo overview(QueryParamDto dto) {
// 计算当前时间段数据
dealParam(dto);
Long monitorIndustryCount = themeRecruitmentJobMapper.queryMonitorIndustryCount(dto);
Long monitorCompanyCount = themeRecruitmentJobMapper.queryMonitorCompanyCount(dto);
EmploymentRegisterSqlDto kindEmploymentCount = themeEmploymentRegisterMapper.queryKindEmploymentCount(dto);
Long employmentDemandCount = themeRecruitmentJobMapper.queryEmploymentDemandCount(dto);
Long unemploymentCount = themeUnemploymentRegisterMapper.queryUnemploymentCount(dto);
Long employmentCount = themeEmploymentRegisterMapper.queryEmploymentCount(dto);
BigDecimal unemploymentRate = MathUtil.calculatePercentage(
(unemploymentCount + employmentCount), unemploymentCount);
// 计算上一时间段数据
QueryParamDto lastDto = new QueryParamDto();
BeanUtils.copyProperties(dto, lastDto);
ParamUtil.calculateLastTime(lastDto);
Long lastMonitorIndustryCount = themeRecruitmentJobMapper.queryMonitorIndustryCount(lastDto);
Long lastMonitorCompanyCount = themeRecruitmentJobMapper.queryMonitorCompanyCount(lastDto);
EmploymentRegisterSqlDto lastKindEmploymentCount =
themeEmploymentRegisterMapper.queryKindEmploymentCount(lastDto);
Long lastEmploymentDemandCount = themeRecruitmentJobMapper.queryEmploymentDemandCount(lastDto);
Long lastUnemploymentCount = themeUnemploymentRegisterMapper.queryUnemploymentCount(lastDto);
Long lastEmploymentCount = themeEmploymentRegisterMapper.queryEmploymentCount(lastDto);
BigDecimal lastUnemploymentRate = MathUtil.calculatePercentage(
(lastUnemploymentCount + lastEmploymentCount), lastUnemploymentCount);
return MajorIndustryEmploymentMonitorOverviewVo.builder()
.monitorIndustryCount(12L)
.monitorIndustryCountMom(BigDecimal.valueOf(3.2))
.monitorCompanyCount(856L)
.monitorCompanyCountMom(BigDecimal.valueOf(5.1))
.totalTownEmploymentCount(32500L)
.totalTownEmploymentCountMom(BigDecimal.valueOf(4.5))
.unEmploymentEmploymentCount(12800L)
.unEmploymentEmploymentCountMom(BigDecimal.valueOf(6.3))
.employmentDifficultyEmploymentCount(5600L)
.employmentDifficultyEmploymentCountMom(BigDecimal.valueOf(-2.1))
.employmentDemandCount(45000L)
.employmentDemandCountMom(BigDecimal.valueOf(8.7))
.unEmploymentCount(3800L)
.unEmploymentCountMom(BigDecimal.valueOf(-1.5))
.unEmploymentRate(BigDecimal.valueOf(4.2))
.unEmploymentRateMom(BigDecimal.valueOf(-0.3))
.monitorIndustryCount(monitorIndustryCount)
.monitorIndustryCountMom(
MathUtil.calculatePercentageGrowthRate(lastMonitorIndustryCount, monitorIndustryCount))
.monitorCompanyCount(monitorCompanyCount)
.monitorCompanyCountMom(
MathUtil.calculatePercentageGrowthRate(lastMonitorCompanyCount, monitorCompanyCount))
.totalTownEmploymentCount(kindEmploymentCount.getTotalTownEmploymentCount())
.totalTownEmploymentCountMom(
MathUtil.calculatePercentageGrowthRate(lastKindEmploymentCount.getTotalTownEmploymentCount(),
kindEmploymentCount.getTotalEmploymentCount()))
.unEmploymentEmploymentCount(kindEmploymentCount.getUnEmploymentEmploymentCount())
.unEmploymentEmploymentCountMom(
MathUtil.calculatePercentageGrowthRate(lastKindEmploymentCount.getUnEmploymentEmploymentCount(),
kindEmploymentCount.getUnEmploymentEmploymentCount()))
.employmentDifficultyEmploymentCount(kindEmploymentCount.getEmploymentDifficultyEmploymentCount())
.employmentDifficultyEmploymentCountMom(
MathUtil.calculatePercentageGrowthRate(lastKindEmploymentCount.getEmploymentDifficultyEmploymentCount(),
kindEmploymentCount.getEmploymentDifficultyEmploymentCount()))
.employmentDemandCount(employmentDemandCount)
.employmentDemandCountMom(
MathUtil.calculatePercentageGrowthRate(lastEmploymentDemandCount, employmentDemandCount))
.unEmploymentCount(unemploymentCount)
.unEmploymentCountMom(MathUtil.calculatePercentageGrowthRate(lastUnemploymentCount, unemploymentCount))
.unEmploymentRate(unemploymentRate)
.unEmploymentRateMom(MathUtil.calculatePercentageGrowthRate(lastUnemploymentRate, unemploymentRate))
.build();
}
@Override
public List<MajorIndustryEmploymentMonitorTreadVo> demandAndUnemploymentRate(QueryParamDto dto) {
dealParam(dto);
List<MajorIndustryEmploymentMonitorTreadVo> list;
switch (dto.getQueryTimeType()) {
case YEAR: {
dto.setStartTime(LocalDateTime.of(dto.getYear(), 1, 1, 0, 0, 0)
.minusYears(5L));
dto.setEndTime(LocalDateTime.of(dto.getYear(), 12, 31, 23, 59, 59));
// 用工需求
List<MajorIndustryEmploymentMonitorTreadVo> labarDemandList =
themeRecruitmentJobMapper.laborDemandTrendYear(dto);
// 就业
List<MajorIndustryEmploymentMonitorTreadVo> employmentList =
themeEmploymentRegisterMapper.employmentTrendYear(dto);
// 失业
List<MajorIndustryEmploymentMonitorTreadVo> unemploymentList =
themeUnemploymentRegisterMapper.unemploymentTrendYear(dto);
list = dealResult(labarDemandList, employmentList, unemploymentList);
break;
}
case QUARTER: {
dto.setStartTime(LocalDateTime.of(dto.getYear(), 1, 1, 0, 0, 0));
dto.setEndTime(LocalDateTime.of(dto.getYear(), 12, 31, 23, 59, 59));
// 用工需求
List<MajorIndustryEmploymentMonitorTreadVo> labarDemandList =
themeRecruitmentJobMapper.laborDemandTrendQuarter(dto);
// 就业
List<MajorIndustryEmploymentMonitorTreadVo> employmentList =
themeEmploymentRegisterMapper.employmentTrendQuarter(dto);
// 失业
List<MajorIndustryEmploymentMonitorTreadVo> unemploymentList =
themeUnemploymentRegisterMapper.unemploymentTrendQuarter(dto);
list = dealResult(labarDemandList, employmentList, unemploymentList);
break;
}
case MONTH: {
dto.setStartTime(LocalDateTime.of(dto.getYear(), 1, 1, 0, 0, 0));
dto.setEndTime(LocalDateTime.of(dto.getYear(), 12, 31, 23, 59, 59));
// 用工需求
List<MajorIndustryEmploymentMonitorTreadVo> labarDemandList =
themeRecruitmentJobMapper.laborDemandTrendMonth(dto);
// 就业
List<MajorIndustryEmploymentMonitorTreadVo> employmentList =
themeEmploymentRegisterMapper.employmentTrendMonth(dto);
// 失业
List<MajorIndustryEmploymentMonitorTreadVo> unemploymentList =
themeUnemploymentRegisterMapper.unemploymentTrendMonth(dto);
list = dealResult(labarDemandList, employmentList, unemploymentList);
break;
}
default:
throw new ServiceException("时间类型错误");
}
return list;
}
/**
* 处理结果
*
* @param labarDemandList 用工需求
* @param employmentList 就业
* @param unemploymentList 失业
* @return 结果
*/
private List<MajorIndustryEmploymentMonitorTreadVo> dealResult(List<MajorIndustryEmploymentMonitorTreadVo> labarDemandList,
List<MajorIndustryEmploymentMonitorTreadVo> employmentList,
List<MajorIndustryEmploymentMonitorTreadVo> unemploymentList) {
List<MajorIndustryEmploymentMonitorTreadVo> list = new ArrayList<>();
for (int i = 0; i < 12; i++) {
Map<String, MajorIndustryEmploymentMonitorTreadVo> employmentMap = new HashMap<>();
for (MajorIndustryEmploymentMonitorTreadVo employment : employmentList) {
employmentMap.put(employment.getCode(), employment);
}
Map<String, MajorIndustryEmploymentMonitorTreadVo> unemploymentMap = new HashMap<>();
for (MajorIndustryEmploymentMonitorTreadVo unemployment : unemploymentList) {
unemploymentMap.put(unemployment.getCode(), unemployment);
}
for (MajorIndustryEmploymentMonitorTreadVo vo : labarDemandList) {
MajorIndustryEmploymentMonitorTreadVo employment = Optional.ofNullable(employmentMap.get(vo.getCode()))
.orElse(MajorIndustryEmploymentMonitorTreadVo.builder().build());
MajorIndustryEmploymentMonitorTreadVo unemployment = Optional.ofNullable(unemploymentMap.get(vo.getCode()))
.orElse(MajorIndustryEmploymentMonitorTreadVo.builder().build());
list.add(MajorIndustryEmploymentMonitorTreadVo.builder()
.code(i + 1 + "")
.desc(i + 1 + "")
.laborDemandCount((long) Math.floor(Math.random() * 30000) + 1000)
.townEmploymentCount((long) Math.floor(Math.random() * 20000) + 500)
.unEmploymentRate(BigDecimal.valueOf(Math.random() * 5 + 2).setScale(1, RoundingMode.HALF_UP))
.cityAverageUnEmploymentRate(BigDecimal.valueOf(Math.random() * 4 + 3).setScale(1, RoundingMode.HALF_UP))
.build());
.code(vo.getCode())
.desc(vo.getDesc())
.laborDemandCount(vo.getLaborDemandCount())
.townEmploymentCount(Optional.ofNullable(vo.getTownEmploymentCount()).orElse(0L))
.employmentCount(employment.getEmploymentCount())
.unemploymentCount(unemployment.getUnemploymentCount())
.unEmploymentRate(
MathUtil.calculatePercentage((employment.getEmploymentCount() + unemployment.getUnemploymentCount()),
unemployment.getUnemploymentCount()))
.cityAverageEmploymentCount(employment.getCityAverageEmploymentCount())
.cityAverageUnemploymentCount(unemployment.getCityAverageUnemploymentCount())
.cityAverageUnEmploymentRate(
MathUtil.calculatePercentage((employment.getCityAverageEmploymentCount() + unemployment.getCityAverageUnemploymentCount()),
unemployment.getCityAverageUnemploymentCount()))
.build()
);
}
return list;
}
@Override
public List<QueryResultVo> industryUnemploymentRate(QueryParamDto dto) {
List<QueryResultVo> list = new ArrayList<>();
for (Tuple2<String, String> industry : CommonConstant.MAJOR_INDUSTRY_LIST) {
list.add(QueryResultVo.builder()
.code(industry.getT1())
.desc(industry.getT2())
.count((long) Math.floor(Math.random() * 10000) + 1)
.rate(BigDecimal.valueOf(Math.random() * 30 + 2).setScale(1, RoundingMode.HALF_UP))
.build());
dealParam(dto);
// 用工需求
List<QueryResultVo> laborDemandList = themeRecruitmentJobMapper.queryEmploymentDemandCountByIndustry(dto);
// 就业人数
List<QueryResultVo> employmentList = themeEmploymentRegisterMapper.queryEmploymentCountByIndustry(dto);
// 失业人数
List<QueryResultVo> unemploymentList = themeUnemploymentRegisterMapper.queryUnemploymentCountByIndustry(dto);
Set<String> industrySet = new HashSet<>();
Map<String, QueryResultVo> loborDemandMap = new HashMap<>();
for (QueryResultVo vo : laborDemandList) {
industrySet.add(vo.getCode());
loborDemandMap.put(vo.getCode(), vo);
}
Map<String, QueryResultVo> employmentMap = new HashMap<>();
for (QueryResultVo vo : employmentList) {
industrySet.add(vo.getCode());
employmentMap.put(vo.getCode(), vo);
}
Map<String, QueryResultVo> unemploymentMap = new HashMap<>();
for (QueryResultVo vo : unemploymentList) {
industrySet.add(vo.getCode());
unemploymentMap.put(vo.getCode(), vo);
}
List<QueryResultVo> list = new ArrayList<>();
for (String industry : industrySet) {
QueryResultVo laborDemand = Optional.ofNullable(loborDemandMap.get(industry))
.orElse(QueryResultVo.builder().build());
QueryResultVo employment = Optional.ofNullable(employmentMap.get(industry))
.orElse(QueryResultVo.builder().build());
QueryResultVo unemployment = Optional.ofNullable(unemploymentMap.get(industry))
.orElse(QueryResultVo.builder().build());
BigDecimal unEmploymentRate =
MathUtil.calculatePercentage((employment.getCount() + unemployment.getCount()),
unemployment.getCount());
QueryResultVo vo = QueryResultVo.builder()
.code(industry)
.count(Optional.ofNullable(laborDemand.getCount()).orElse(0L))
.rate(unEmploymentRate)
.build();
list.add(vo);
}
ParamUtil.fillDictName(list, "majorIndustry");
return list;
}
@Override
public List<QueryResultVo> industryDistribution(QueryParamDto dto) {
List<QueryResultVo> list = new ArrayList<>();
for (Tuple2<String, String> industry : CommonConstant.MAJOR_INDUSTRY_LIST) {
list.add(QueryResultVo.builder()
.code(industry.getT1())
.desc(industry.getT2())
.count((long) Math.floor(Math.random() * 100000) + 1)
.build());
}
dealParam(dto);
List<QueryResultVo> list = themeUnemploymentRegisterMapper.industryDistribution(dto);
MathUtil.calculatePercentage(list);
ParamUtil.fillDictName(list, "majorIndustry");
return list;
}
@Override
public List<QueryResultVo> salaryLevel(QueryParamDto dto) {
List<QueryResultVo> list = new ArrayList<>();
for (Tuple2<String, String> industry : CommonConstant.MAJOR_INDUSTRY_LIST) {
list.add(QueryResultVo.builder()
.code(industry.getT1())
.desc(industry.getT2())
.amount(BigDecimal.valueOf(Math.random() * 20000 + 2).setScale(1, RoundingMode.HALF_UP))
.anotherAmount(BigDecimal.valueOf(Math.random() * 20000 + 2).setScale(1, RoundingMode.HALF_UP))
.build());
}
dealParam(dto);
List<QueryResultVo> list = themeRecruitmentJobMapper.salaryLevel(dto);
ParamUtil.fillDictName(list, "majorIndustry");
return list;
}
@Override
public List<QueryResultVo> gender(QueryParamDto dto) {
List<QueryResultVo> list = new ArrayList<>();
List<Tuple2<String, String>> genderList =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", ""),
Tuples.of("2", "")
)));
for (Tuple2<String, String> gender : genderList) {
list.add(QueryResultVo.builder()
.code(gender.getT1())
.desc(gender.getT2())
.count((long) Math.floor(Math.random() * 100000) + 1)
.build());
}
dealParam(dto);
List<QueryResultVo> list = themeUnemploymentRegisterMapper.gender(dto);
MathUtil.calculatePercentage(list);
ParamUtil.fillDictName(list, "gender");
return list;
}
@Override
public List<QueryResultVo> jobType(QueryParamDto dto) {
List<QueryResultVo> list = new ArrayList<>();
List<Tuple2<String, String>> jobTypeList =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", "管理人员"),
Tuples.of("2", "专业技术人员"),
Tuples.of("3", "技能工人"),
Tuples.of("4", "一般员工"),
Tuples.of("5", "其他")
)));
for (Tuple2<String, String> jobType : jobTypeList) {
list.add(QueryResultVo.builder()
.code(jobType.getT1())
.desc(jobType.getT2())
.count((long) Math.floor(Math.random() * 100000) + 1)
.build());
// 用工需求
List<QueryResultVo> laborDemandList = themeRecruitmentJobMapper.queryEmploymentDemandCountByJobType(dto);
// 就业
List<QueryResultVo> employmentList = themeEmploymentRegisterMapper.queryEmploymentCountByJobType(dto);
// 失业
List<QueryResultVo> unemploymentList = themeUnemploymentRegisterMapper.queryUnemploymentCountByJobType(dto);
Set<String> jobTypeSet = new HashSet<>();
Map<String, QueryResultVo> loborDemandMap = new HashMap<>();
for (QueryResultVo vo : laborDemandList) {
jobTypeSet.add(vo.getCode());
loborDemandMap.put(vo.getCode(), vo);
}
MathUtil.calculatePercentage(list);
Map<String, QueryResultVo> employmentMap = new HashMap<>();
for (QueryResultVo vo : employmentList) {
jobTypeSet.add(vo.getCode());
employmentMap.put(vo.getCode(), vo);
}
Map<String, QueryResultVo> unemploymentMap = new HashMap<>();
for (QueryResultVo vo : unemploymentList) {
jobTypeSet.add(vo.getCode());
unemploymentMap.put(vo.getCode(), vo);
}
List<QueryResultVo> list = new ArrayList<>();
for (String jobType : jobTypeSet) {
QueryResultVo laborDemand = Optional.ofNullable(loborDemandMap.get(jobType))
.orElse(QueryResultVo.builder().build());
QueryResultVo employment = Optional.ofNullable(employmentMap.get(jobType))
.orElse(QueryResultVo.builder().build());
QueryResultVo unemployment = Optional.ofNullable(unemploymentMap.get(jobType))
.orElse(QueryResultVo.builder().build());
BigDecimal unEmploymentRate =
MathUtil.calculatePercentage((employment.getCount() + unemployment.getCount()),
unemployment.getCount());
QueryResultVo vo = QueryResultVo.builder()
.code(jobType)
.count(Optional.ofNullable(laborDemand.getCount()).orElse(0L))
.rate(unEmploymentRate)
.build();
list.add(vo);
}
ParamUtil.fillDictName(list, "jobType");
return list;
}
@Override
public List<QueryResultVo> layoffAndLaborGap(QueryParamDto dto) {
List<QueryResultVo> list = new ArrayList<>();
for (Tuple2<String, String> industry : CommonConstant.MAJOR_INDUSTRY_LIST) {
list.add(QueryResultVo.builder()
.code(industry.getT1())
.desc(industry.getT2())
.count((long) Math.floor(Math.random() * 5000) + 1)
.anotherCount((long) Math.floor(Math.random() * 5000) + 1)
.build());
dealParam(dto);
// 裁员
List<QueryResultVo> layoffList = themeUnemploymentRegisterMapper.queryLayoffCountByIndustry(dto);
// 用工缺口
List<QueryResultVo> laborGapList = themeRecruitmentJobMapper.queryLaborGapCountByIndustry(dto);
Set<String> industrySet = new HashSet<>();
Map<String, QueryResultVo> layoffMap = new HashMap<>();
for (QueryResultVo vo : layoffList) {
industrySet.add(vo.getCode());
layoffMap.put(vo.getCode(), vo);
}
Map<String, QueryResultVo> laborGapMap = new HashMap<>();
for (QueryResultVo vo : laborGapList) {
industrySet.add(vo.getCode());
laborGapMap.put(vo.getCode(), vo);
}
List<QueryResultVo> list = new ArrayList<>();
for (String industry : industrySet) {
QueryResultVo layoff = Optional.ofNullable(layoffMap.get(industry))
.orElse(QueryResultVo.builder().build());
QueryResultVo laborGap = Optional.ofNullable(laborGapMap.get(industry))
.orElse(QueryResultVo.builder().build());
QueryResultVo vo = QueryResultVo.builder()
.code(industry)
.count(Optional.ofNullable(layoff.getCount()).orElse(0L))
.anotherCount(Optional.ofNullable(laborGap.getCount()).orElse(0L))
.build();
list.add(vo);
}
ParamUtil.fillDictName(list, "majorIndustry");
return list;
}
@Override
public List<HeatmapVo> heatmap(QueryParamDto dto) {
List<HeatmapVo> list = new ArrayList<>();
for (Tuple2<String, String> area : CommonConstant.AREA_LIST) {
list.add(HeatmapVo.builder()
.areaCode(area.getT1())
.areaName(area.getT2())
.count((long) Math.floor(Math.random() * 10000) + 1)
.build());
}
long totalCount = list.stream().mapToLong(HeatmapVo::getCount).sum();
for (HeatmapVo vo : list) {
if (totalCount > 0) {
vo.setPercentage(new BigDecimal(vo.getCount())
.divide(BigDecimal.valueOf(totalCount), 4, RoundingMode.HALF_UP)
.multiply(BigDecimal.valueOf(100))
.setScale(2, RoundingMode.HALF_UP));
}
}
dealParam(dto);
List<HeatmapVo> list = themeRecruitmentJobMapper.heatmap(dto);
// 计算占比
MathUtil.calculatePercentageHeatmap(list);
return list;
}
}

View File

@@ -169,6 +169,9 @@ public class ParamUtil {
case "industry": {
return Optional.ofNullable(CommonConstant.INDUSTRY_MAP.get(code)).orElse("未知");
}
case "majorIndustry": {
return Optional.ofNullable(CommonConstant.MAJOR_INDUSTRY_MAP.get(code)).orElse("未知");
}
case "educationLevel": {
return Optional.ofNullable(CommonConstant.EDUCATION_LEVEL_MAP.get(code)).orElse("未知");
}
@@ -184,6 +187,9 @@ public class ParamUtil {
case "employmentCrowd": {
return Optional.ofNullable(CommonConstant.EMPLOYMENT_CROWD_MAP.get(code)).orElse("未知");
}
case "jobType": {
return Optional.ofNullable(CommonConstant.JOB_TYPE_MAP.get(code)).orElse("未知");
}
default:
throw new ServiceException("字典名称错误");
}