添加功能

This commit is contained in:
马宝龙
2026-06-28 17:50:00 +08:00
parent aadf5654de
commit 4b244922e6
10 changed files with 1765 additions and 215 deletions

View File

@@ -1,13 +1,11 @@
package com.ruoyi.cms.constant;
import com.ruoyi.cms.domain.vo.DictVo;
import reactor.util.function.Tuple2;
import reactor.util.function.Tuples;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -127,18 +125,27 @@ public class CommonConstant {
/**
* 高校类型列表
*/
public static final List<Tuple2<String, String>> UNIVERSITY_TYPE_LIST =
public static final List<Tuple2<String, String>> UNIVERSITY_TYPE_LIST =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", "一本院校"),
Tuples.of("2", "二本院校"),
Tuples.of("3", "专科院校"),
Tuples.of("4", "民办院校")
)));
/**
* 高校类型Map
*/
public static final Map<String, String> UNIVERSITY_TYPE_MAP =
Collections.unmodifiableMap(UNIVERSITY_TYPE_LIST.stream()
.collect(Collectors.toMap(
Tuple2::getT1,
Tuple2::getT2
)));
/**
* 产业列表
*/
public static final List<Tuple2<String, String>> SECTOR_LIST =
public static final List<Tuple2<String, String>> SECTOR_LIST =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", "新材料"),
Tuples.of("2", "新能源"),
@@ -151,7 +158,7 @@ public class CommonConstant {
/**
* 重点群体列表
*/
public static final List<Tuple2<String, String>> KEY_GROUP_LIST =
public static final List<Tuple2<String, String>> KEY_GROUP_LIST =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", "失业人员"),
Tuples.of("2", "高校毕业生"),
@@ -161,4 +168,107 @@ public class CommonConstant {
Tuples.of("6", "其他重点人群")
)));
/**
* 学历水平列表
*/
public static final List<Tuple2<String, String>> EDUCATION_LEVEL_LIST =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("11", "博士研究生"),
Tuples.of("14", "硕士研究生"),
Tuples.of("21", "大学本科"),
Tuples.of("31", "大学专科"),
Tuples.of("41", "中等专科"),
Tuples.of("44", "职业高中"),
Tuples.of("47", "技工学校"),
Tuples.of("61", "普通高中"),
Tuples.of("71", "初中"),
Tuples.of("81", "小学"),
Tuples.of("90", "其他")
)));
/**
* 学历水平Map
*/
public static final Map<String, String> EDUCATION_LEVEL_MAP =
Collections.unmodifiableMap(EDUCATION_LEVEL_LIST.stream()
.collect(Collectors.toMap(
Tuple2::getT1,
Tuple2::getT2
)));
/**
* 性别列表
*/
public static final List<Tuple2<String, String>> GENDER_LIST =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", ""),
Tuples.of("2", ""),
Tuples.of("9", "未说明性别")
)));
/**
* 性别Map
*/
public static final Map<String, String> GENDER_MAP =
Collections.unmodifiableMap(GENDER_LIST.stream()
.collect(Collectors.toMap(
Tuple2::getT1,
Tuple2::getT2
)));
/**
* 就业流向列表
*/
public static final List<Tuple2<String, String>> EMPLOYMENT_FLOW_LIST =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", "本地"),
Tuples.of("2", "省内"),
Tuples.of("3", "省外")
)));
/**
* 就业流向Map
*/
public static final Map<String, String> EMPLOYMENT_FLOW_MAP =
Collections.unmodifiableMap(EMPLOYMENT_FLOW_LIST.stream()
.collect(Collectors.toMap(
Tuple2::getT1,
Tuple2::getT2
)));
/**
* 就业去向列表
*/
public static final List<Tuple2<String, String>> EMPLOYMENT_CROWD_LIST =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("011", "党政机关就业"),
Tuples.of("012", "事业单位就业"),
Tuples.of("013", "国有企业就业"),
Tuples.of("014", "非国有企业就业"),
Tuples.of("015", "部队就业(无军籍)"),
Tuples.of("021", "个体经营"),
Tuples.of("022", "灵活就业等其他自主就业"),
Tuples.of("030", "公益性岗位安置"),
Tuples.of("040", "自主创业"),
Tuples.of("051", "社区岗位"),
Tuples.of("052", "基层项目"),
Tuples.of("053", "科研助理"),
Tuples.of("059", "其他形式就业"),
Tuples.of("060", "应征入伍"),
Tuples.of("070", "升学"),
Tuples.of("080", "出国(境)"),
Tuples.of("091", "就业见习"),
Tuples.of("092", "职业培训"),
Tuples.of("093", "正在求职"),
Tuples.of("094", "自愿暂时不就业"),
Tuples.of("095", "其他情况未就业"),
Tuples.of("990", "联系不上")
)));
/**
* 就业去向Map
*/
public static final Map<String, String> EMPLOYMENT_CROWD_MAP =
Collections.unmodifiableMap(EMPLOYMENT_CROWD_LIST.stream()
.collect(Collectors.toMap(
Tuple2::getT1,
Tuple2::getT2
)));
}

View File

@@ -0,0 +1,43 @@
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/28
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class GraduateEmploymentInfoSqlDto implements Serializable {
private static final long serialVersionUID = 7622992159887654746L;
/**
* 总人数
*/
private Long totalCount;
/**
* 工作环境满意人数
*/
private Long workEnvironmentSatisfiedCount;
/**
* 薪资福利满意人数
*/
private Long salaryWelfareSatisfiedCount;
/**
* 发展前景满意人数
*/
private Long developmentForegroundSatisfiedCount;
/**
* 工作综合满意人数
*/
private Long workComprehensiveSatisfiedCount;
}

View File

@@ -21,6 +21,10 @@ import java.math.BigDecimal;
public class GraduateEmploymentInfoStartupVo implements Serializable {
private static final long serialVersionUID = 7840585628012934541L;
/**
* 总人数
*/
private Long totalCount;
/**
* 创业总数
*/
@@ -33,6 +37,10 @@ public class GraduateEmploymentInfoStartupVo implements Serializable {
* 创业带动就业岗位数
*/
private Long startupEmploymentJobCount;
/**
* 创业成功数
*/
private Long startupSuccessCount;
/**
* 创业成功率
*/

View File

@@ -0,0 +1,163 @@
package com.ruoyi.cms.mapper;
import com.ruoyi.cms.domain.dto.GraduateEmploymentInfoSqlDto;
import com.ruoyi.cms.domain.dto.QueryParamDto;
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.QueryResultVo;
import java.math.BigDecimal;
import java.util.List;
/**
* 高校毕业生主题库
*
* @author 马宝龙
* @date 2026/6/28
*/
public interface ThemeGraduateInfoMapper {
/**
* 查询毕业生人数
*
* @param dto 查询参数
* @return 人数
*/
Long queryGraduateCount(QueryParamDto dto);
/**
* 查询就业登记人数
*
* @param dto 查询参数
* @return 人数
*/
Long queryEmploymentCount(QueryParamDto dto);
/**
* 查询平均薪资
*
* @param dto 查询参数
* @return 平均薪资
*/
BigDecimal queryAverageSalary(QueryParamDto dto);
/**
* 查询升学深造人数
*
* @param dto 查询参数
* @return 人数
*/
Long queryFurtherEducationCount(QueryParamDto dto);
/**
* 行业就业规模与增长趋势 - 年度
*
* @param dto 查询参数
* @return 趋势列表
*/
List<GraduateEmploymentInfoTreadVo> scaleAndTrendYear(QueryParamDto dto);
/**
* 行业就业规模与增长趋势 - 季度
*
* @param dto 查询参数
* @return 趋势列表
*/
List<GraduateEmploymentInfoTreadVo> scaleAndTrendQuarter(QueryParamDto dto);
/**
* 行业就业规模与增长趋势 - 月度
*
* @param dto 查询参数
* @return 趋势列表
*/
List<GraduateEmploymentInfoTreadVo> scaleAndTrendMonth(QueryParamDto dto);
/**
* 学历层次就业分析
*
* @param dto 查询参数
* @return 结果列表
*/
List<GraduateEmploymentInfoTreadVo> educationLevel(QueryParamDto dto);
/**
* 高校类型就业对比
*
* @param dto 查询参数
* @return 结果列表
*/
List<QueryResultVo> universityType(QueryParamDto dto);
/**
* 主要专业就业情况
*
* @param dto 查询参数
* @return 结果列表
*/
List<QueryResultVo> majorProfessional(QueryParamDto dto);
/**
* 性别就业差异分析
*
* @param dto 查询参数
* @return 结果列表
*/
List<QueryResultVo> gender(QueryParamDto dto);
/**
* 毕业生地区流向分析
*
* @param dto 查询参数
* @return 结果列表
*/
List<QueryResultVo> areaFlow(QueryParamDto dto);
/**
* 就业行业分布
*
* @param dto 查询参数
* @return 结果列表
*/
List<QueryResultVo> industryDistribution(QueryParamDto dto);
/**
* 薪资水平分析
*
* @param dto 查询参数
* @return 结果列表
*/
List<QueryResultVo> salaryLevel(QueryParamDto dto);
/**
* 就业满意度评估
*
* @param dto 查询参数
* @return 结果
*/
GraduateEmploymentInfoSqlDto satisfactionAssessment(QueryParamDto dto);
/**
* 毕业生创业情况
*
* @param dto 查询参数
* @return 结果列表
*/
GraduateEmploymentInfoStartupVo startupSituation(QueryParamDto dto);
/**
* 未就业人群分析
*
* @param dto 查询参数
* @return 结果列表
*/
List<QueryResultVo> notEmploymentCrowd(QueryParamDto dto);
/**
* 热力图
*
* @param dto 查询参数
* @return 热力图列表
*/
List<HeatmapVo> heatmap(QueryParamDto dto);
}

View File

@@ -2,11 +2,15 @@ package com.ruoyi.cms.service.impl;
import com.ruoyi.cms.domain.dto.ExcelRow;
import com.ruoyi.cms.domain.dto.QueryParamDto;
import com.ruoyi.cms.domain.vo.GraduateEmploymentInfoOverviewVo;
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.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.util.document.ExcelUtil;
import com.ruoyi.cms.util.document.MultiSheetExcelUtil;
@@ -39,6 +43,7 @@ import java.util.Objects;
public class AnalysisExportServiceImpl implements AnalysisExportService {
private final AnalysisIndustryEmploymentInfoService analysisIndustryEmploymentInfoService;
private final AnalysisGraduateEmploymentInfoService analysisGraduateEmploymentInfoService;
@Override
public void exportData(HttpServletResponse response, QueryParamDto dto) {
@@ -53,7 +58,7 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
break;
// 就业大数据专题分析平台-高校毕业生就业信息分析
case EMPLOYMENT_GRADUATE_EMPLOYMENT_INFO:
test(response, dto);
exportGraduateEmploymentInfo(response, dto);
break;
// 就业大数据专题分析平台-重点行业就失业监测分析
case EMPLOYMENT_MAJOR_INDUSTRY_EMPLOYMENT_MONITOR:
@@ -81,7 +86,7 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
break;
// 智慧就业大数据分析展示系统-高校毕业生就业信息分析
case WISDOM_EMPLOYMENT_GRADUATE_EMPLOYMENT_INFO:
test(response, dto);
exportWisdomGraduateEmploymentInfo(response, dto);
break;
// 智慧就业大数据分析展示系统-重点行业就失业监测分析
case WISDOM_EMPLOYMENT_MAJOR_INDUSTRY_EMPLOYMENT_MONITOR:
@@ -170,7 +175,7 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
"总就业人数(人)", transform(overview.getEmploymentCount()), transform(overview.getEmploymentCountMom())
));
basicExportList.add(new ExcelRow(
"失业率%", transform(overview.getUnemploymentRate()), transform(overview.getUnemploymentRateMom())
"失业率%", transform(overview.getUnemploymentRate()), transform(overview.getUnemploymentRateMom())
));
basicExportList.add(new ExcelRow(
"创业企业总数(家)", transform(overview.getStartupCompanyCount()),
@@ -331,6 +336,268 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
}
/**
* 导出 高校毕业生就业信息分析
*
* @param response 响应
* @param dto 查询参数
* @throws IOException 异常
*/
private void exportGraduateEmploymentInfo(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);
GraduateEmploymentInfoOverviewVo overview = analysisGraduateEmploymentInfoService.overview(newParam);
basicExportList.add(new ExcelRow(
"毕业生总数(人)", transform(overview.getGraduateCount()), transform(overview.getGraduateCountMom())
));
basicExportList.add(new ExcelRow(
"就业人数(人)", transform(overview.getEmploymentCount()), transform(overview.getEmploymentCountMom())
));
basicExportList.add(new ExcelRow(
"就业率(%", transform(overview.getEmploymentRate()), transform(overview.getEmploymentRateMom())
));
basicExportList.add(new ExcelRow(
"平均起薪(元)", transform(overview.getAverageSalary()),
transform(overview.getAverageSalaryMom())
));
basicExportList.add(new ExcelRow(
"升学深造(人)", transform(overview.getFurtherEducationCount()),
transform(overview.getFurtherEducationCountMom())
));
// 创建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<GraduateEmploymentInfoTreadVo> treadList = analysisGraduateEmploymentInfoService.scaleAndTrend(newParam);
for (GraduateEmploymentInfoTreadVo tread : treadList) {
basicExportList.add(new ExcelRow(
tread.getDesc(), transform(tread.getEmploymentCount()), transform(tread.getNotEmploymentCount()),
transform(tread.getFurtherEducationCount())
));
}
// 创建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);
treadList = analysisGraduateEmploymentInfoService.educationLevel(newParam);
for (GraduateEmploymentInfoTreadVo tread : treadList) {
basicExportList.add(new ExcelRow(
tread.getDesc(), transform(tread.getEmploymentCount()), transform(tread.getNotEmploymentCount()),
transform(tread.getFurtherEducationCount())
));
}
// 创建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 = analysisGraduateEmploymentInfoService.universityType(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.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);
resultList = analysisGraduateEmploymentInfoService.majorProfessional(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.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);
resultList = analysisGraduateEmploymentInfoService.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 = analysisGraduateEmploymentInfoService.areaFlow(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 = analysisGraduateEmploymentInfoService.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 = analysisGraduateEmploymentInfoService.salaryLevel(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.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);
resultList = analysisGraduateEmploymentInfoService.satisfactionAssessment(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.getAmount())
));
}
// 创建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);
GraduateEmploymentInfoStartupVo startupSituation = analysisGraduateEmploymentInfoService.startupSituation(newParam);
basicExportList.add(new ExcelRow(
"创业人数(人)", transform(startupSituation.getStartupCount())
));
basicExportList.add(new ExcelRow(
"创业占比(%", transform(startupSituation.getStartupPercentage())
));
basicExportList.add(new ExcelRow(
"带动就业(人)", transform(startupSituation.getStartupEmploymentJobCount())
));
basicExportList.add(new ExcelRow(
"创业成功率(%", transform(startupSituation.getStartupSuccessRate())
));
// 创建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 = analysisGraduateEmploymentInfoService.notEmploymentCrowd(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);
multiSheetExcelUtil.setFileName(dto.getExportModule().getDesc());
multiSheetExcelUtil.exportExcel(response);
}
/**
* 导出 行业就业情况信息分析
*
@@ -356,7 +623,7 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
"总就业人数(人)", transform(overview.getEmploymentCount()), transform(overview.getEmploymentCountMom())
));
basicExportList.add(new ExcelRow(
"失业率%", transform(overview.getUnemploymentRate()), transform(overview.getUnemploymentRateMom())
"失业率%", transform(overview.getUnemploymentRate()), transform(overview.getUnemploymentRateMom())
));
basicExportList.add(new ExcelRow(
"创业企业总数(家)", transform(overview.getStartupCompanyCount()),
@@ -535,6 +802,287 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
}
/**
* 导出 高校毕业生就业信息分析
*
* @param response 响应
* @param dto 查询参数
* @throws IOException 异常
*/
private void exportWisdomGraduateEmploymentInfo(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);
GraduateEmploymentInfoOverviewVo overview = analysisGraduateEmploymentInfoService.overview(newParam);
basicExportList.add(new ExcelRow(
"毕业生总数(人)", transform(overview.getGraduateCount()), transform(overview.getGraduateCountMom())
));
basicExportList.add(new ExcelRow(
"就业人数(人)", transform(overview.getEmploymentCount()), transform(overview.getEmploymentCountMom())
));
basicExportList.add(new ExcelRow(
"就业率(%", transform(overview.getEmploymentRate()), transform(overview.getEmploymentRateMom())
));
basicExportList.add(new ExcelRow(
"平均起薪(元)", transform(overview.getAverageSalary()),
transform(overview.getAverageSalaryMom())
));
basicExportList.add(new ExcelRow(
"升学深造(人)", transform(overview.getFurtherEducationCount()),
transform(overview.getFurtherEducationCountMom())
));
// 创建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 = analysisGraduateEmploymentInfoService.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<GraduateEmploymentInfoTreadVo> treadList = analysisGraduateEmploymentInfoService.scaleAndTrend(newParam);
for (GraduateEmploymentInfoTreadVo tread : treadList) {
basicExportList.add(new ExcelRow(
tread.getDesc(), transform(tread.getEmploymentCount()), transform(tread.getNotEmploymentCount()),
transform(tread.getFurtherEducationCount())
));
}
// 创建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);
treadList = analysisGraduateEmploymentInfoService.educationLevel(newParam);
for (GraduateEmploymentInfoTreadVo tread : treadList) {
basicExportList.add(new ExcelRow(
tread.getDesc(), transform(tread.getEmploymentCount()), transform(tread.getNotEmploymentCount()),
transform(tread.getFurtherEducationCount())
));
}
// 创建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 = analysisGraduateEmploymentInfoService.universityType(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.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);
resultList = analysisGraduateEmploymentInfoService.majorProfessional(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.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);
resultList = analysisGraduateEmploymentInfoService.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 = analysisGraduateEmploymentInfoService.areaFlow(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 = analysisGraduateEmploymentInfoService.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 = analysisGraduateEmploymentInfoService.salaryLevel(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.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);
resultList = analysisGraduateEmploymentInfoService.satisfactionAssessment(newParam);
for (QueryResultVo result : resultList) {
basicExportList.add(new ExcelRow(
result.getDesc(), transform(result.getAmount())
));
}
// 创建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);
GraduateEmploymentInfoStartupVo startupSituation = analysisGraduateEmploymentInfoService.startupSituation(newParam);
basicExportList.add(new ExcelRow(
"创业人数(人)", transform(startupSituation.getStartupCount())
));
basicExportList.add(new ExcelRow(
"创业占比(%", transform(startupSituation.getStartupPercentage())
));
basicExportList.add(new ExcelRow(
"带动就业(人)", transform(startupSituation.getStartupEmploymentJobCount())
));
basicExportList.add(new ExcelRow(
"创业成功率(%", transform(startupSituation.getStartupSuccessRate())
));
// 创建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 = analysisGraduateEmploymentInfoService.notEmploymentCrowd(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);
multiSheetExcelUtil.setFileName(dto.getExportModule().getDesc());
multiSheetExcelUtil.exportExcel(response);
}
private String transform(Long value) {
if (Objects.isNull(value)) {
return "";

View File

@@ -1,25 +1,27 @@
package com.ruoyi.cms.service.impl;
import com.ruoyi.cms.constant.CommonConstant;
import com.ruoyi.cms.domain.dto.GraduateEmploymentInfoSqlDto;
import com.ruoyi.cms.domain.dto.QueryParamDto;
import com.ruoyi.cms.domain.vo.GraduateEmploymentInfoOverviewVo;
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.QueryResultVo;
import com.ruoyi.cms.mapper.ThemeGraduateInfoMapper;
import com.ruoyi.cms.service.AnalysisGraduateEmploymentInfoService;
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.Comparator;
import java.util.List;
/**
@@ -31,244 +33,219 @@ import java.util.List;
@Service
@Validated
@Slf4j
@RequiredArgsConstructor
public class AnalysisGraduateEmploymentInfoServiceImpl implements AnalysisGraduateEmploymentInfoService {
private final ThemeGraduateInfoMapper themeGraduateInfoMapper;
@Override
public GraduateEmploymentInfoOverviewVo overview(QueryParamDto dto) {
// 计算当前时间段数据
ParamUtil.dealParam(dto);
Long graduateCount = themeGraduateInfoMapper.queryGraduateCount(dto);
Long employmentCount = themeGraduateInfoMapper.queryEmploymentCount(dto);
BigDecimal employmentRate = MathUtil.calculatePercentage(graduateCount, employmentCount);
BigDecimal averageSalary = themeGraduateInfoMapper.queryAverageSalary(dto);
Long furtherEducationCount = themeGraduateInfoMapper.queryFurtherEducationCount(dto);
// 计算上一时间段数据
QueryParamDto lastDto = new QueryParamDto();
BeanUtils.copyProperties(dto, lastDto);
ParamUtil.calculateLastTime(lastDto);
Long lastGraduateCount = themeGraduateInfoMapper.queryGraduateCount(lastDto);
Long lastEmploymentCount = themeGraduateInfoMapper.queryEmploymentCount(lastDto);
BigDecimal lastEmploymentRate = MathUtil.calculatePercentage(lastGraduateCount, lastEmploymentCount);
BigDecimal lastAverageSalary = themeGraduateInfoMapper.queryAverageSalary(lastDto);
Long lastFurtherEducationCount = themeGraduateInfoMapper.queryFurtherEducationCount(lastDto);
return GraduateEmploymentInfoOverviewVo.builder()
.graduateCount(12000L)
.graduateCountMom(BigDecimal.valueOf(5.2))
.employmentCount(10380L)
.employmentCountMom(BigDecimal.valueOf(3.8))
.employmentRate(BigDecimal.valueOf(86.5))
.employmentRateMom(BigDecimal.valueOf(2.1))
.averageSalary(BigDecimal.valueOf(6850.50))
.averageSalaryMom(BigDecimal.valueOf(4.2))
.furtherEducationCount(1850L)
.furtherEducationCountMom(BigDecimal.valueOf(8.6))
.graduateCount(graduateCount)
.graduateCountMom(MathUtil.calculatePercentageGrowthRate(lastGraduateCount, graduateCount))
.employmentCount(employmentCount)
.employmentCountMom(MathUtil.calculatePercentageGrowthRate(lastEmploymentCount, employmentCount))
.employmentRate(employmentRate)
.employmentRateMom(MathUtil.calculatePercentageGrowthRate(lastEmploymentRate, employmentRate))
.averageSalary(averageSalary)
.averageSalaryMom(MathUtil.calculatePercentageGrowthRate(lastAverageSalary, averageSalary))
.furtherEducationCount(furtherEducationCount)
.furtherEducationCountMom(
MathUtil.calculatePercentageGrowthRate(lastFurtherEducationCount, furtherEducationCount))
.build();
}
@Override
public List<GraduateEmploymentInfoTreadVo> scaleAndTrend(QueryParamDto dto) {
List<GraduateEmploymentInfoTreadVo> list = new ArrayList<>();
for (int i = 0; i < 12; i++) {
list.add(GraduateEmploymentInfoTreadVo.builder()
.code(i + 1 + "")
.desc(i + 1 + "")
.employmentCount((long) Math.floor(Math.random() * 10000) + 1)
.notEmploymentCount((long) Math.floor(Math.random() * 10000) + 1)
.furtherEducationCount((long) Math.floor(Math.random() * 2000) + 1)
.build());
}
ParamUtil.dealParam(dto);
List<GraduateEmploymentInfoTreadVo> 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 = themeGraduateInfoMapper.scaleAndTrendYear(dto);
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 = themeGraduateInfoMapper.scaleAndTrendQuarter(dto);
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 = themeGraduateInfoMapper.scaleAndTrendMonth(dto);
break;
}
default:
throw new ServiceException("时间类型错误");
}
return list;
}
@Override
public List<GraduateEmploymentInfoTreadVo> educationLevel(QueryParamDto dto) {
List<GraduateEmploymentInfoTreadVo> list = new ArrayList<>();
List<Tuple2<String, String>> educationLevelList =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", "大学专科"),
Tuples.of("2", "大学本科"),
Tuples.of("3", "研究生及以上")
)));
for (Tuple2<String, String> educationLevel : educationLevelList) {
list.add(GraduateEmploymentInfoTreadVo.builder()
.code(educationLevel.getT1())
.desc(educationLevel.getT2())
.employmentCount((long) Math.floor(Math.random() * 10000) + 1)
.notEmploymentCount((long) Math.floor(Math.random() * 10000) + 1)
.furtherEducationCount((long) Math.floor(Math.random() * 2000) + 1)
.build());
}
ParamUtil.dealParam(dto);
List<GraduateEmploymentInfoTreadVo> list = themeGraduateInfoMapper.educationLevel(dto);
ParamUtil.fillDictNameGraduateEmploymentInfoTread(list, "educationLevel");
return list;
}
@Override
public List<QueryResultVo> universityType(QueryParamDto dto) {
List<QueryResultVo> list = new ArrayList<>();
for (Tuple2<String, String> type : CommonConstant.UNIVERSITY_TYPE_LIST) {
list.add(QueryResultVo.builder()
.code(type.getT1())
.desc(type.getT2())
.count((long) Math.floor(Math.random() * 100000) + 1)
.build());
}
ParamUtil.dealParam(dto);
List<QueryResultVo> list = themeGraduateInfoMapper.universityType(dto);
ParamUtil.fillDictName(list, "universityType");
return list;
}
@Override
public List<QueryResultVo> majorProfessional(QueryParamDto dto) {
List<QueryResultVo> list = new ArrayList<>();
List<Tuple2<String, String>> majorList =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", "计算机科学与技术"),
Tuples.of("2", "软件工程"),
Tuples.of("3", "金融学"),
Tuples.of("4", "临床医学"),
Tuples.of("5", "电子信息工程"),
Tuples.of("6", "机械设计制造及其自动化"),
Tuples.of("7", "土木工程"),
Tuples.of("8", "会计学"),
Tuples.of("9", "工商管理"),
Tuples.of("10", "法学")
)));
for (Tuple2<String, String> major : majorList) {
list.add(QueryResultVo.builder()
.code(major.getT1())
.desc(major.getT2())
.count((long) Math.floor(Math.random() * 100000) + 1)
.build());
}
ParamUtil.dealParam(dto);
List<QueryResultVo> list = themeGraduateInfoMapper.majorProfessional(dto);
list.sort(Comparator.comparingLong(QueryResultVo::getCount).reversed());
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());
}
ParamUtil.dealParam(dto);
List<QueryResultVo> list = themeGraduateInfoMapper.gender(dto);
MathUtil.calculatePercentage(list);
ParamUtil.fillDictName(list, "gender");
return list;
}
@Override
public List<QueryResultVo> areaFlow(QueryParamDto dto) {
List<QueryResultVo> list = new ArrayList<>();
List<Tuple2<String, String>> areaList =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", "本地"),
Tuples.of("2", "省内"),
Tuples.of("3", "省外")
)));
for (Tuple2<String, String> area : areaList) {
list.add(QueryResultVo.builder()
.code(area.getT1())
.desc(area.getT2())
.count((long) Math.floor(Math.random() * 100000) + 1)
.build());
}
ParamUtil.dealParam(dto);
List<QueryResultVo> list = themeGraduateInfoMapper.areaFlow(dto);
MathUtil.calculatePercentage(list);
ParamUtil.fillDictName(list, "employmentFlow");
return list;
}
@Override
public List<QueryResultVo> industryDistribution(QueryParamDto dto) {
List<QueryResultVo> list = new ArrayList<>();
for (Tuple2<String, String> industry : CommonConstant.INDUSTRY_LIST) {
list.add(QueryResultVo.builder()
.code(industry.getT1())
.desc(industry.getT2())
.count((long) Math.floor(Math.random() * 100000) + 1)
.build());
}
ParamUtil.dealParam(dto);
List<QueryResultVo> list = themeGraduateInfoMapper.industryDistribution(dto);
MathUtil.calculatePercentage(list);
ParamUtil.fillDictName(list, "industry");
return list;
}
@Override
public List<QueryResultVo> salaryLevel(QueryParamDto dto) {
List<QueryResultVo> list = new ArrayList<>();
List<Tuple2<String, String>> salaryList =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", "5K以下"),
Tuples.of("2", "5-8K"),
Tuples.of("3", "8-12K"),
Tuples.of("4", "12-15K"),
Tuples.of("5", "15K以上")
)));
for (Tuple2<String, String> salary : salaryList) {
list.add(QueryResultVo.builder()
.code(salary.getT1())
.desc(salary.getT2())
.count((long) Math.floor(Math.random() * 100000) + 1)
.build());
}
return list;
}
@Override
public List<QueryResultVo> satisfactionAssessment(QueryParamDto dto) {
List<QueryResultVo> list = new ArrayList<>();
List<Tuple2<String, String>> satisfactionList =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", "工作环境"),
Tuples.of("2", "薪酬福利"),
Tuples.of("3", "发展前景"),
Tuples.of("4", "综合满意度")
)));
for (Tuple2<String, String> satisfaction : satisfactionList) {
list.add(QueryResultVo.builder()
.code(satisfaction.getT1())
.desc(satisfaction.getT2())
.amount(new BigDecimal(Math.random() * 100 + 1).setScale(2, RoundingMode.HALF_UP))
.build());
}
return list;
}
@Override
public GraduateEmploymentInfoStartupVo startupSituation(QueryParamDto dto) {
return GraduateEmploymentInfoStartupVo.builder()
.startupCount(156L)
.startupPercentage(BigDecimal.valueOf(10.3))
.startupEmploymentJobCount(890L)
.startupSuccessRate(BigDecimal.valueOf(72.5))
.build();
}
@Override
public List<QueryResultVo> notEmploymentCrowd(QueryParamDto dto) {
List<QueryResultVo> list = new ArrayList<>();
List<Tuple2<String, String>> crowdList =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", "继续求职"),
Tuples.of("2", "备考公招/考研"),
Tuples.of("3", "其他")
)));
for (Tuple2<String, String> crowd : crowdList) {
list.add(QueryResultVo.builder()
.code(crowd.getT1())
.desc(crowd.getT2())
.count((long) Math.floor(Math.random() * 100000) + 1)
.build());
}
ParamUtil.dealParam(dto);
List<QueryResultVo> list = themeGraduateInfoMapper.salaryLevel(dto);
MathUtil.calculatePercentage(list);
return list;
}
@Override
public List<QueryResultVo> satisfactionAssessment(QueryParamDto dto) {
ParamUtil.dealParam(dto);
GraduateEmploymentInfoSqlDto sqlDto = themeGraduateInfoMapper.satisfactionAssessment(dto);
List<QueryResultVo> list = new ArrayList<>();
list.add(QueryResultVo.builder()
.code("1")
.desc("工作环境")
.amount(MathUtil.calculatePercentage(sqlDto.getTotalCount(), sqlDto.getWorkEnvironmentSatisfiedCount()))
.build());
list.add(QueryResultVo.builder()
.code("2")
.desc("薪酬福利")
.amount(MathUtil.calculatePercentage(sqlDto.getTotalCount(), sqlDto.getSalaryWelfareSatisfiedCount()))
.build());
list.add(QueryResultVo.builder()
.code("3")
.desc("发展前景")
.amount(MathUtil.calculatePercentage(sqlDto.getTotalCount(),
sqlDto.getDevelopmentForegroundSatisfiedCount()))
.build());
list.add(QueryResultVo.builder()
.code("4")
.desc("综合满意度")
.amount(MathUtil.calculatePercentage(sqlDto.getTotalCount(),
sqlDto.getWorkComprehensiveSatisfiedCount()))
.build());
return list;
}
@Override
public GraduateEmploymentInfoStartupVo startupSituation(QueryParamDto dto) {
ParamUtil.dealParam(dto);
GraduateEmploymentInfoStartupVo vo = themeGraduateInfoMapper.startupSituation(dto);
vo.setStartupPercentage(MathUtil.calculatePercentage(vo.getTotalCount(), vo.getStartupCount()));
vo.setStartupSuccessRate(MathUtil.calculatePercentage(vo.getStartupCount(), vo.getStartupSuccessCount()));
return vo;
}
@Override
public List<QueryResultVo> notEmploymentCrowd(QueryParamDto dto) {
ParamUtil.dealParam(dto);
List<QueryResultVo> list = themeGraduateInfoMapper.notEmploymentCrowd(dto);
MathUtil.calculatePercentage(list);
ParamUtil.fillDictName(list, "employmentCrowd");
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));
}
}
ParamUtil.dealParam(dto);
List<HeatmapVo> list = themeGraduateInfoMapper.heatmap(dto);
// 计算占比
MathUtil.calculatePercentageHeatmap(list);
return list;
}
}

View File

@@ -2,6 +2,7 @@ package com.ruoyi.cms.util;
import com.ruoyi.cms.constant.CommonConstant;
import com.ruoyi.cms.domain.dto.QueryParamDto;
import com.ruoyi.cms.domain.vo.GraduateEmploymentInfoTreadVo;
import com.ruoyi.cms.domain.vo.QueryResultVo;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
@@ -140,13 +141,48 @@ public class ParamUtil {
if (CollectionUtils.isEmpty(list) || StringUtils.isBlank(dictName)) {
return;
}
for (QueryResultVo vo : list) {
vo.setDesc(fillDictName(vo.getCode(), dictName));
}
}
/**
* 填充字典名称
*
* @param list 列表
* @param dictName 字典名称
*/
public static void fillDictNameGraduateEmploymentInfoTread(
List<GraduateEmploymentInfoTreadVo> list, String dictName) {
if (CollectionUtils.isEmpty(list) || StringUtils.isBlank(dictName)) {
return;
}
for (GraduateEmploymentInfoTreadVo vo : list) {
vo.setDesc(fillDictName(vo.getCode(), dictName));
}
}
private static String fillDictName(String code, String dictName){
switch (dictName) {
case "industry": {
for (QueryResultVo vo : list) {
vo.setDesc(Optional.ofNullable(CommonConstant.INDUSTRY_MAP.get(vo.getCode())).orElse("未知"));
}
break;
return Optional.ofNullable(CommonConstant.INDUSTRY_MAP.get(code)).orElse("未知");
}
case "educationLevel": {
return Optional.ofNullable(CommonConstant.EDUCATION_LEVEL_MAP.get(code)).orElse("未知");
}
case "universityType": {
return Optional.ofNullable(CommonConstant.UNIVERSITY_TYPE_MAP.get(code)).orElse("未知");
}
case "gender": {
return Optional.ofNullable(CommonConstant.GENDER_MAP.get(code)).orElse("未知");
}
case "employmentFlow": {
return Optional.ofNullable(CommonConstant.EMPLOYMENT_FLOW_MAP.get(code)).orElse("未知");
}
case "employmentCrowd": {
return Optional.ofNullable(CommonConstant.EMPLOYMENT_CROWD_MAP.get(code)).orElse("未知");
}
default:
throw new ServiceException("字典名称错误");