添加功能
This commit is contained in:
@@ -10,6 +10,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CommonConstant {
|
||||
/**
|
||||
@@ -47,6 +48,15 @@ public class CommonConstant {
|
||||
Tuples.of("652324524000", "150团"),
|
||||
Tuples.of("659001500000", "152团")
|
||||
)));
|
||||
/**
|
||||
* 团场Map
|
||||
*/
|
||||
public static final Map<String, String> AREA_MAP =
|
||||
Collections.unmodifiableMap(AREA_LIST.stream()
|
||||
.collect(Collectors.toMap(
|
||||
Tuple2::getT1,
|
||||
Tuple2::getT2
|
||||
)));
|
||||
|
||||
/**
|
||||
* 行业列表
|
||||
@@ -104,6 +114,15 @@ public class CommonConstant {
|
||||
Tuples.of("C27", "医药制造业"),
|
||||
Tuples.of("M73", "研究和试验发展")
|
||||
)));
|
||||
/**
|
||||
* 重点行业Map
|
||||
*/
|
||||
public static final Map<String, String> INDUSTRY_MAP =
|
||||
Collections.unmodifiableMap(INDUSTRY_LIST.stream()
|
||||
.collect(Collectors.toMap(
|
||||
Tuple2::getT1,
|
||||
Tuple2::getT2
|
||||
)));
|
||||
|
||||
/**
|
||||
* 高校类型列表
|
||||
|
||||
@@ -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 IndustryEmploymentInfoSqlDto implements Serializable {
|
||||
private static final long serialVersionUID = 7039748681473387889L;
|
||||
|
||||
/**
|
||||
* 总人数
|
||||
*/
|
||||
private Long totalCount;
|
||||
/**
|
||||
* 签合同人数
|
||||
*/
|
||||
private Long signContractCount;
|
||||
/**
|
||||
* 交社保人数
|
||||
*/
|
||||
private Long socialInsuranceCount;
|
||||
/**
|
||||
* 薪资稳定人数
|
||||
*/
|
||||
private Long stableSalaryCount;
|
||||
/**
|
||||
* 工作满意人数
|
||||
*/
|
||||
private Long satisfiedWorkCount;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.ruoyi.cms.mapper;
|
||||
|
||||
/**
|
||||
* <类注释内容>
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/6/24
|
||||
*/
|
||||
public interface TestMapper {
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.ruoyi.cms.mapper;
|
||||
|
||||
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.QueryResultVo;
|
||||
import com.ruoyi.cms.domain.vo.TreadVo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 就业登记主题库
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/6/27
|
||||
*/
|
||||
public interface ThemeEmploymentRegisterMapper {
|
||||
|
||||
|
||||
/**
|
||||
* 查询就业登记人数
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 人数
|
||||
*/
|
||||
Long queryEmploymentCount(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 查询创业企业总数
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 数量
|
||||
*/
|
||||
Long queryStartupCompanyCount(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 查询创业企业总数
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 数量
|
||||
*/
|
||||
Long queryStartupEmploymentCount(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 查询灵活就业人数
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 数量
|
||||
*/
|
||||
Long queryFlexibleEmploymentCount(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 查询平均薪资
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 平均薪资
|
||||
*/
|
||||
BigDecimal queryAverageSalary(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 行业就业规模与增长趋势 - 年度
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 趋势列表
|
||||
*/
|
||||
List<TreadVo> scaleAndTrendYear(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 行业就业规模与增长趋势 - 季度
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 趋势列表
|
||||
*/
|
||||
List<TreadVo> scaleAndTrendQuarter(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 行业就业规模与增长趋势 - 月度
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 趋势列表
|
||||
*/
|
||||
List<TreadVo> scaleAndTrendMonth(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 行业就业规模对比
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 结果列表
|
||||
*/
|
||||
List<QueryResultVo> scaleComparison(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 就业结构分析
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 结果列表
|
||||
*/
|
||||
List<QueryResultVo> structure(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 人员年龄结构
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 结果列表
|
||||
*/
|
||||
List<QueryResultVo> ageStructure(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 薪酬水平对标
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 结果列表
|
||||
*/
|
||||
List<QueryResultVo> salaryLevel(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 就业质量指标
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 结果列表
|
||||
*/
|
||||
IndustryEmploymentInfoSqlDto qualityIndicator(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 热力图
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 热力图列表
|
||||
*/
|
||||
List<HeatmapVo> heatmap(QueryParamDto dto);
|
||||
}
|
||||
@@ -2,17 +2,25 @@ 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.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.AnalysisIndustryEmploymentInfoService;
|
||||
import com.ruoyi.cms.util.document.ExcelUtil;
|
||||
import com.ruoyi.cms.util.document.MultiSheetExcelUtil;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
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 javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -27,7 +35,11 @@ import java.util.Objects;
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class AnalysisExportServiceImpl implements AnalysisExportService {
|
||||
|
||||
private final AnalysisIndustryEmploymentInfoService analysisIndustryEmploymentInfoService;
|
||||
|
||||
@Override
|
||||
public void exportData(HttpServletResponse response, QueryParamDto dto) {
|
||||
if (Objects.isNull(dto.getExportModule())) {
|
||||
@@ -37,7 +49,7 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
|
||||
switch (dto.getExportModule()) {
|
||||
// 就业大数据专题分析平台-行业就业情况信息分析
|
||||
case EMPLOYMENT_INDUSTRY_EMPLOYMENT_INFO:
|
||||
test(response, dto);
|
||||
exportIndustryEmploymentInfo(response, dto);
|
||||
break;
|
||||
// 就业大数据专题分析平台-高校毕业生就业信息分析
|
||||
case EMPLOYMENT_GRADUATE_EMPLOYMENT_INFO:
|
||||
@@ -65,7 +77,7 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
|
||||
break;
|
||||
// 智慧就业大数据分析展示系统-行业就业情况信息分析
|
||||
case WISDOM_EMPLOYMENT_INDUSTRY_EMPLOYMENT_INFO:
|
||||
test(response, dto);
|
||||
exportWisdomIndustryEmploymentInfo(response, dto);
|
||||
break;
|
||||
// 智慧就业大数据分析展示系统-高校毕业生就业信息分析
|
||||
case WISDOM_EMPLOYMENT_GRADUATE_EMPLOYMENT_INFO:
|
||||
@@ -131,4 +143,409 @@ public class AnalysisExportServiceImpl implements AnalysisExportService {
|
||||
|
||||
return multiSheetExcelUtil;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出 行业就业情况信息分析
|
||||
*
|
||||
* @param response 响应
|
||||
* @param dto 查询参数
|
||||
* @throws IOException 异常
|
||||
*/
|
||||
private void exportIndustryEmploymentInfo(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);
|
||||
IndustryEmploymentInfoOverviewVo overview = analysisIndustryEmploymentInfoService.overview(newParam);
|
||||
|
||||
basicExportList.add(new ExcelRow(
|
||||
"总就业人数(人)", transform(overview.getEmploymentCount()), transform(overview.getEmploymentCountMom())
|
||||
));
|
||||
basicExportList.add(new ExcelRow(
|
||||
"失业率《%)", transform(overview.getUnemploymentRate()), transform(overview.getUnemploymentRateMom())
|
||||
));
|
||||
basicExportList.add(new ExcelRow(
|
||||
"创业企业总数(家)", transform(overview.getStartupCompanyCount()),
|
||||
transform(overview.getStartupCompanyCountMom())
|
||||
));
|
||||
basicExportList.add(new ExcelRow(
|
||||
"创业带动就业(人)", transform(overview.getStartupEmploymentCount()),
|
||||
transform(overview.getStartupEmploymentCountMom())
|
||||
));
|
||||
basicExportList.add(new ExcelRow(
|
||||
"灵活就业人数(人)", transform(overview.getFlexibleEmploymentCount()),
|
||||
transform(overview.getFlexibleEmploymentCountMom())
|
||||
));
|
||||
basicExportList.add(new ExcelRow(
|
||||
"招聘需求(岗)", transform(overview.getRecruitmentDemand()), transform(overview.getRecruitmentDemandMom())
|
||||
));
|
||||
basicExportList.add(new ExcelRow(
|
||||
"平均薪资(元)", transform(overview.getAverageSalary()), transform(overview.getAverageSalaryMom())
|
||||
));
|
||||
// 创建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<TreadVo> treadList = analysisIndustryEmploymentInfoService.scaleAndTrend(newParam);
|
||||
for (TreadVo tread : treadList) {
|
||||
basicExportList.add(new ExcelRow(
|
||||
tread.getDesc(), transform(tread.getLastYearCount()), transform(tread.getCurrentCount()),
|
||||
transform(tread.getYearOnYearGrowthRate()), transform(tread.getMonthOnMonthGrowthRate())
|
||||
));
|
||||
}
|
||||
// 创建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 = analysisIndustryEmploymentInfoService.scaleComparison(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 = analysisIndustryEmploymentInfoService.structure(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 = analysisIndustryEmploymentInfoService.ageStructure(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 = analysisIndustryEmploymentInfoService.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);
|
||||
|
||||
// 行业技能需求TOP10
|
||||
basicExportList = new ArrayList<>();
|
||||
basicExportList.add(new ExcelRow("行业技能需求TOP10"));
|
||||
basicExportList.add(new ExcelRow("技能", "需求人数(人)"));
|
||||
newParam = new QueryParamDto();
|
||||
BeanUtils.copyProperties(dto, newParam);
|
||||
resultList = analysisIndustryEmploymentInfoService.industrySkill(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("行业技能需求TOP10");
|
||||
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
|
||||
|
||||
// 就业质量指标
|
||||
basicExportList = new ArrayList<>();
|
||||
basicExportList.add(new ExcelRow("就业质量指标"));
|
||||
basicExportList.add(new ExcelRow("指标", "得分(分)"));
|
||||
newParam = new QueryParamDto();
|
||||
BeanUtils.copyProperties(dto, newParam);
|
||||
resultList = analysisIndustryEmploymentInfoService.qualityIndicator(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);
|
||||
|
||||
|
||||
multiSheetExcelUtil.setFileName(dto.getExportModule().getDesc());
|
||||
multiSheetExcelUtil.exportExcel(response);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出 行业就业情况信息分析
|
||||
*
|
||||
* @param response 响应
|
||||
* @param dto 查询参数
|
||||
* @throws IOException 异常
|
||||
*/
|
||||
private void exportWisdomIndustryEmploymentInfo(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);
|
||||
IndustryEmploymentInfoOverviewVo overview = analysisIndustryEmploymentInfoService.overview(newParam);
|
||||
|
||||
basicExportList.add(new ExcelRow(
|
||||
"总就业人数(人)", transform(overview.getEmploymentCount()), transform(overview.getEmploymentCountMom())
|
||||
));
|
||||
basicExportList.add(new ExcelRow(
|
||||
"失业率《%)", transform(overview.getUnemploymentRate()), transform(overview.getUnemploymentRateMom())
|
||||
));
|
||||
basicExportList.add(new ExcelRow(
|
||||
"创业企业总数(家)", transform(overview.getStartupCompanyCount()),
|
||||
transform(overview.getStartupCompanyCountMom())
|
||||
));
|
||||
basicExportList.add(new ExcelRow(
|
||||
"创业带动就业(人)", transform(overview.getStartupEmploymentCount()),
|
||||
transform(overview.getStartupEmploymentCountMom())
|
||||
));
|
||||
basicExportList.add(new ExcelRow(
|
||||
"灵活就业人数(人)", transform(overview.getFlexibleEmploymentCount()),
|
||||
transform(overview.getFlexibleEmploymentCountMom())
|
||||
));
|
||||
basicExportList.add(new ExcelRow(
|
||||
"招聘需求(岗)", transform(overview.getRecruitmentDemand()), transform(overview.getRecruitmentDemandMom())
|
||||
));
|
||||
basicExportList.add(new ExcelRow(
|
||||
"平均薪资(元)", transform(overview.getAverageSalary()), transform(overview.getAverageSalaryMom())
|
||||
));
|
||||
// 创建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 = analysisIndustryEmploymentInfoService.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<TreadVo> treadList = analysisIndustryEmploymentInfoService.scaleAndTrend(newParam);
|
||||
for (TreadVo tread : treadList) {
|
||||
basicExportList.add(new ExcelRow(
|
||||
tread.getDesc(), transform(tread.getLastYearCount()), transform(tread.getCurrentCount()),
|
||||
transform(tread.getYearOnYearGrowthRate()), transform(tread.getMonthOnMonthGrowthRate())
|
||||
));
|
||||
}
|
||||
// 创建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 = analysisIndustryEmploymentInfoService.scaleComparison(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 = analysisIndustryEmploymentInfoService.structure(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 = analysisIndustryEmploymentInfoService.ageStructure(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 = analysisIndustryEmploymentInfoService.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);
|
||||
|
||||
// 行业技能需求TOP10
|
||||
basicExportList = new ArrayList<>();
|
||||
basicExportList.add(new ExcelRow("行业技能需求TOP10"));
|
||||
basicExportList.add(new ExcelRow("技能", "需求人数(人)"));
|
||||
newParam = new QueryParamDto();
|
||||
BeanUtils.copyProperties(dto, newParam);
|
||||
resultList = analysisIndustryEmploymentInfoService.industrySkill(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("行业技能需求TOP10");
|
||||
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
|
||||
|
||||
// 就业质量指标
|
||||
basicExportList = new ArrayList<>();
|
||||
basicExportList.add(new ExcelRow("就业质量指标"));
|
||||
basicExportList.add(new ExcelRow("指标", "得分(分)"));
|
||||
newParam = new QueryParamDto();
|
||||
BeanUtils.copyProperties(dto, newParam);
|
||||
resultList = analysisIndustryEmploymentInfoService.qualityIndicator(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);
|
||||
|
||||
|
||||
multiSheetExcelUtil.setFileName(dto.getExportModule().getDesc());
|
||||
multiSheetExcelUtil.exportExcel(response);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private String transform(Long value) {
|
||||
if (Objects.isNull(value)) {
|
||||
return "";
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
private String transform(BigDecimal value) {
|
||||
if (Objects.isNull(value)) {
|
||||
return "";
|
||||
}
|
||||
return value.toPlainString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.ruoyi.cms.constant.CommonConstant;
|
||||
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.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.service.AnalysisIndustryEmploymentInfoService;
|
||||
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.List;
|
||||
|
||||
/**
|
||||
@@ -30,41 +31,107 @@ import java.util.List;
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class AnalysisIndustryEmploymentInfoServiceImpl implements AnalysisIndustryEmploymentInfoService {
|
||||
|
||||
private final ThemeEmploymentRegisterMapper themeEmploymentRegisterMapper;
|
||||
|
||||
@Override
|
||||
public IndustryEmploymentInfoOverviewVo overview(QueryParamDto dto) {
|
||||
|
||||
// 计算当前时间段数据
|
||||
ParamUtil.dealParam(dto);
|
||||
Long employmentCount = themeEmploymentRegisterMapper.queryEmploymentCount(dto);
|
||||
|
||||
// todo 失业人数
|
||||
Long unemploymentCount = 13L;
|
||||
BigDecimal unemploymentRate = MathUtil.calculatePercentage(
|
||||
(unemploymentCount + employmentCount), unemploymentCount);
|
||||
|
||||
Long startupCompanyCount = themeEmploymentRegisterMapper.queryStartupCompanyCount(dto);
|
||||
|
||||
Long startupEmploymentCount = themeEmploymentRegisterMapper.queryStartupEmploymentCount(dto);
|
||||
|
||||
Long flexibleEmploymentCount = themeEmploymentRegisterMapper.queryFlexibleEmploymentCount(dto);
|
||||
|
||||
// todo 岗位表 招聘需求
|
||||
Long recruitmentDemand = 1234L;
|
||||
|
||||
BigDecimal averageSalary = themeEmploymentRegisterMapper.queryAverageSalary(dto);
|
||||
|
||||
// 计算上一时间段数据
|
||||
QueryParamDto lastDto = new QueryParamDto();
|
||||
BeanUtils.copyProperties(dto, lastDto);
|
||||
ParamUtil.calculateLastTime(lastDto);
|
||||
Long lastEmploymentCount = themeEmploymentRegisterMapper.queryEmploymentCount(lastDto);
|
||||
|
||||
// todo 失业人数
|
||||
Long lastUnemploymentCount = 17L;
|
||||
BigDecimal lastUnemploymentRate = MathUtil.calculatePercentage(
|
||||
(lastUnemploymentCount + employmentCount), lastUnemploymentCount);
|
||||
|
||||
Long lastStartupCompanyCount = themeEmploymentRegisterMapper.queryStartupCompanyCount(lastDto);
|
||||
|
||||
Long lastStartupEmploymentCount = themeEmploymentRegisterMapper.queryStartupEmploymentCount(lastDto);
|
||||
|
||||
Long lastFlexibleEmploymentCount = themeEmploymentRegisterMapper.queryFlexibleEmploymentCount(lastDto);
|
||||
|
||||
// todo 岗位表 招聘需求
|
||||
Long lastRecruitmentDemand = 634L;
|
||||
|
||||
BigDecimal lastAverageSalary = themeEmploymentRegisterMapper.queryAverageSalary(lastDto);
|
||||
|
||||
|
||||
return IndustryEmploymentInfoOverviewVo.builder()
|
||||
.employmentCount(100L)
|
||||
.employmentCountMom(BigDecimal.valueOf(10))
|
||||
.unemploymentRate(BigDecimal.valueOf(3.4))
|
||||
.unemploymentRateMom(BigDecimal.valueOf(1.2))
|
||||
.startupCompanyCount(323L)
|
||||
.startupCompanyCountMom(BigDecimal.valueOf(23))
|
||||
.startupEmploymentCount(432L)
|
||||
.startupEmploymentCountMom(BigDecimal.valueOf(-12))
|
||||
.flexibleEmploymentCount(53L)
|
||||
.flexibleEmploymentCountMom(BigDecimal.valueOf(2.3))
|
||||
.recruitmentDemand(2443L)
|
||||
.recruitmentDemandMom(BigDecimal.valueOf(23.3))
|
||||
.averageSalary(BigDecimal.valueOf(3424.3))
|
||||
.averageSalaryMom(BigDecimal.valueOf(-3.3))
|
||||
.employmentCount(employmentCount)
|
||||
.employmentCountMom(MathUtil.calculatePercentageGrowthRate(lastEmploymentCount, employmentCount))
|
||||
.unemploymentRate(unemploymentRate)
|
||||
.unemploymentRateMom(MathUtil.calculatePercentageGrowthRate(lastUnemploymentRate, unemploymentRate))
|
||||
.startupCompanyCount(startupCompanyCount)
|
||||
.startupCompanyCountMom(
|
||||
MathUtil.calculatePercentageGrowthRate(lastStartupCompanyCount, startupCompanyCount))
|
||||
.startupEmploymentCount(startupEmploymentCount)
|
||||
.startupEmploymentCountMom(
|
||||
MathUtil.calculatePercentageGrowthRate(lastStartupEmploymentCount, startupEmploymentCount))
|
||||
.flexibleEmploymentCount(flexibleEmploymentCount)
|
||||
.flexibleEmploymentCountMom(
|
||||
MathUtil.calculatePercentageGrowthRate(lastFlexibleEmploymentCount, flexibleEmploymentCount))
|
||||
.recruitmentDemand(recruitmentDemand)
|
||||
.recruitmentDemandMom(
|
||||
MathUtil.calculatePercentageGrowthRate(lastRecruitmentDemand, recruitmentDemand))
|
||||
.averageSalary(averageSalary)
|
||||
.averageSalaryMom(MathUtil.calculatePercentageGrowthRate(lastAverageSalary, averageSalary))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TreadVo> scaleAndTrend(QueryParamDto dto) {
|
||||
|
||||
List<TreadVo> list = new ArrayList<>();
|
||||
for (int i = 0; i < 12; i++) {
|
||||
list.add(TreadVo.builder()
|
||||
.code(i + 1 + "")
|
||||
.sort(i)
|
||||
.desc(i + 1 + "月")
|
||||
.currentCount((long) Math.floor(Math.random() * 10000) + 1)
|
||||
.lastYearCount((long) Math.floor(Math.random() * 10000) + 1)
|
||||
.build());
|
||||
ParamUtil.dealParam(dto);
|
||||
|
||||
List<TreadVo> 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 = themeEmploymentRegisterMapper.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 = themeEmploymentRegisterMapper.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 = themeEmploymentRegisterMapper.scaleAndTrendMonth(dto);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new ServiceException("时间类型错误");
|
||||
}
|
||||
|
||||
// 计算同环比
|
||||
@@ -75,34 +142,19 @@ public class AnalysisIndustryEmploymentInfoServiceImpl implements AnalysisIndust
|
||||
|
||||
@Override
|
||||
public List<QueryResultVo> scaleComparison(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 = themeEmploymentRegisterMapper.scaleComparison(dto);
|
||||
MathUtil.calculatePercentage(list);
|
||||
ParamUtil.fillDictName(list, "industry");
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QueryResultVo> structure(QueryParamDto dto) {
|
||||
List<QueryResultVo> list = new ArrayList<>();
|
||||
List<Tuple2<String, String>> structureList =
|
||||
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
|
||||
Tuples.of("1", "管理层"),
|
||||
Tuples.of("2", "专业技术"),
|
||||
Tuples.of("3", "技能工人"),
|
||||
Tuples.of("4", "一般员工")
|
||||
)));
|
||||
for (Tuple2<String, String> structure : structureList) {
|
||||
list.add(QueryResultVo.builder()
|
||||
.code(structure.getT1())
|
||||
.desc(structure.getT2())
|
||||
.count((long) Math.floor(Math.random() * 100000) + 1)
|
||||
.build());
|
||||
}
|
||||
|
||||
ParamUtil.dealParam(dto);
|
||||
List<QueryResultVo> list = themeEmploymentRegisterMapper.structure(dto);
|
||||
// 计算占比
|
||||
MathUtil.calculatePercentage(list);
|
||||
return list;
|
||||
@@ -110,22 +162,8 @@ public class AnalysisIndustryEmploymentInfoServiceImpl implements AnalysisIndust
|
||||
|
||||
@Override
|
||||
public List<QueryResultVo> ageStructure(QueryParamDto dto) {
|
||||
List<QueryResultVo> list = new ArrayList<>();
|
||||
List<Tuple2<String, String>> structureList =
|
||||
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
|
||||
Tuples.of("1", "16-25岁"),
|
||||
Tuples.of("2", "26-35岁"),
|
||||
Tuples.of("3", "36-45岁"),
|
||||
Tuples.of("4", "46-55岁"),
|
||||
Tuples.of("5", "55岁以上")
|
||||
)));
|
||||
for (Tuple2<String, String> structure : structureList) {
|
||||
list.add(QueryResultVo.builder()
|
||||
.code(structure.getT1())
|
||||
.desc(structure.getT2())
|
||||
.count((long) Math.floor(Math.random() * 100000) + 1)
|
||||
.build());
|
||||
}
|
||||
ParamUtil.dealParam(dto);
|
||||
List<QueryResultVo> list = themeEmploymentRegisterMapper.ageStructure(dto);
|
||||
// 计算占比
|
||||
MathUtil.calculatePercentage(list);
|
||||
return list;
|
||||
@@ -133,15 +171,10 @@ public class AnalysisIndustryEmploymentInfoServiceImpl implements AnalysisIndust
|
||||
|
||||
@Override
|
||||
public List<QueryResultVo> salaryLevel(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())
|
||||
.amount(new BigDecimal(Math.random() * 100000 + 1).setScale(2, RoundingMode.HALF_UP))
|
||||
.anotherAmount(new BigDecimal(Math.random() * 100000 + 1).setScale(2, RoundingMode.HALF_UP))
|
||||
.build());
|
||||
}
|
||||
ParamUtil.dealParam(dto);
|
||||
List<QueryResultVo> list = themeEmploymentRegisterMapper.salaryLevel(dto);
|
||||
MathUtil.calculatePercentage(list);
|
||||
ParamUtil.fillDictName(list, "industry");
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -152,34 +185,39 @@ public class AnalysisIndustryEmploymentInfoServiceImpl implements AnalysisIndust
|
||||
|
||||
@Override
|
||||
public List<QueryResultVo> qualityIndicator(QueryParamDto dto) {
|
||||
|
||||
ParamUtil.dealParam(dto);
|
||||
IndustryEmploymentInfoSqlDto sqlDto = themeEmploymentRegisterMapper.qualityIndicator(dto);
|
||||
|
||||
List<QueryResultVo> list = new ArrayList<>();
|
||||
List<Tuple2<String, String>> structureList =
|
||||
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
|
||||
Tuples.of("1", "合同完整性"),
|
||||
Tuples.of("2", "社保覆盖度"),
|
||||
Tuples.of("3", "薪资稳定性"),
|
||||
Tuples.of("4", "工作满意度")
|
||||
)));
|
||||
for (Tuple2<String, String> structure : structureList) {
|
||||
list.add(QueryResultVo.builder()
|
||||
.code(structure.getT1())
|
||||
.desc(structure.getT2())
|
||||
.amount(new BigDecimal(Math.random() * 100 + 1).setScale(2, RoundingMode.HALF_UP))
|
||||
.code("1")
|
||||
.desc("合同完整性")
|
||||
.amount(MathUtil.calculatePercentage(sqlDto.getTotalCount(), sqlDto.getSignContractCount()))
|
||||
.build());
|
||||
list.add(QueryResultVo.builder()
|
||||
.code("2")
|
||||
.desc("社保覆盖度")
|
||||
.amount(MathUtil.calculatePercentage(sqlDto.getTotalCount(), sqlDto.getSocialInsuranceCount()))
|
||||
.build());
|
||||
list.add(QueryResultVo.builder()
|
||||
.code("3")
|
||||
.desc("薪资稳定性")
|
||||
.amount(MathUtil.calculatePercentage(sqlDto.getTotalCount(), sqlDto.getStableSalaryCount()))
|
||||
.build());
|
||||
list.add(QueryResultVo.builder()
|
||||
.code("4")
|
||||
.desc("工作满意度")
|
||||
.amount(MathUtil.calculatePercentage(sqlDto.getTotalCount(), sqlDto.getSatisfiedWorkCount()))
|
||||
.build());
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
ParamUtil.dealParam(dto);
|
||||
List<HeatmapVo> list = themeEmploymentRegisterMapper.heatmap(dto);
|
||||
// 计算占比
|
||||
MathUtil.calculatePercentageHeatmap(list);
|
||||
return list;
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.ruoyi.cms.util;
|
||||
|
||||
import com.ruoyi.cms.constant.CommonConstant;
|
||||
import com.ruoyi.cms.constant.enums.QueryTimeTypeEnum;
|
||||
import com.ruoyi.cms.domain.vo.HeatmapVo;
|
||||
import com.ruoyi.cms.domain.vo.QueryResultVo;
|
||||
import com.ruoyi.cms.domain.vo.TreadVo;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -92,10 +95,11 @@ public class MathUtil {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算占比
|
||||
*
|
||||
* @param list 热力图数据
|
||||
* @param list 数据
|
||||
*/
|
||||
public static void calculatePercentage(List<QueryResultVo> list) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
@@ -111,6 +115,33 @@ public class MathUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算环比
|
||||
*
|
||||
* @param lastCount 上期数据
|
||||
* @param currentCount 本期数据
|
||||
* @return 环比
|
||||
*/
|
||||
public static BigDecimal calculatePercentageGrowthRate(Long lastCount, Long currentCount) {
|
||||
lastCount = Optional.ofNullable(lastCount).orElse(0L);
|
||||
currentCount = Optional.ofNullable(currentCount).orElse(0L);
|
||||
return calculatePercentage(lastCount, (currentCount - lastCount));
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算环比
|
||||
*
|
||||
* @param lastBigDecimal 上期数据
|
||||
* @param currentBigDecimal 本期数据
|
||||
* @return 环比
|
||||
*/
|
||||
public static BigDecimal calculatePercentageGrowthRate(BigDecimal lastBigDecimal, BigDecimal currentBigDecimal) {
|
||||
lastBigDecimal = Optional.ofNullable(lastBigDecimal).orElse(BigDecimal.ZERO);
|
||||
currentBigDecimal = Optional.ofNullable(currentBigDecimal).orElse(BigDecimal.ZERO);
|
||||
|
||||
return calculatePercentage(lastBigDecimal, (currentBigDecimal.subtract(lastBigDecimal)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算同比和环比
|
||||
*
|
||||
@@ -189,6 +220,7 @@ public class MathUtil {
|
||||
|
||||
for (HeatmapVo vo : list) {
|
||||
vo.setPercentage(calculatePercentage(totalCount, vo.getCount()));
|
||||
vo.setAreaName(Optional.ofNullable(CommonConstant.AREA_MAP.get(vo.getAreaCode())).orElse("未知"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
155
ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/ParamUtil.java
Normal file
155
ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/ParamUtil.java
Normal file
@@ -0,0 +1,155 @@
|
||||
package com.ruoyi.cms.util;
|
||||
|
||||
import com.ruoyi.cms.constant.CommonConstant;
|
||||
import com.ruoyi.cms.domain.dto.QueryParamDto;
|
||||
import com.ruoyi.cms.domain.vo.QueryResultVo;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 参数工具类
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/6/27
|
||||
*/
|
||||
public class ParamUtil {
|
||||
private ParamUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理参数
|
||||
*
|
||||
* @param dto 参数
|
||||
*/
|
||||
public static void dealParam(QueryParamDto dto) {
|
||||
|
||||
if (Objects.isNull(dto)) {
|
||||
throw new ServiceException("参数不能为空");
|
||||
}
|
||||
if (Objects.isNull(dto.getQueryTimeType())) {
|
||||
throw new ServiceException("时间类型不能为空");
|
||||
}
|
||||
if (Objects.isNull(dto.getYear())) {
|
||||
throw new ServiceException("年份不能为空");
|
||||
}
|
||||
|
||||
LocalTime min = LocalTime.of(0, 0, 0);
|
||||
LocalTime max = LocalTime.of(23, 59, 59);
|
||||
|
||||
switch (dto.getQueryTimeType()) {
|
||||
case YEAR: {
|
||||
dto.setStartTime(LocalDateTime.of(LocalDate.of(dto.getYear(), 1, 1), min));
|
||||
dto.setEndTime(LocalDateTime.of(LocalDate.of(dto.getYear(), 12, 31), max));
|
||||
break;
|
||||
}
|
||||
case QUARTER: {
|
||||
if (Objects.isNull(dto.getQuarter())) {
|
||||
throw new ServiceException("季度不能为空");
|
||||
}
|
||||
switch (dto.getQuarter()) {
|
||||
case 1:
|
||||
dto.setStartTime(LocalDateTime.of(LocalDate.of(dto.getYear(), 1, 1), min));
|
||||
dto.setEndTime(LocalDateTime.of(LocalDate.of(dto.getYear(), 3, 31), max));
|
||||
break;
|
||||
case 2:
|
||||
dto.setStartTime(LocalDateTime.of(LocalDate.of(dto.getYear(), 4, 1), min));
|
||||
dto.setEndTime(LocalDateTime.of(LocalDate.of(dto.getYear(), 6, 30), max));
|
||||
break;
|
||||
case 3:
|
||||
dto.setStartTime(LocalDateTime.of(LocalDate.of(dto.getYear(), 7, 1), min));
|
||||
dto.setEndTime(LocalDateTime.of(LocalDate.of(dto.getYear(), 9, 30), max));
|
||||
break;
|
||||
case 4:
|
||||
dto.setStartTime(LocalDateTime.of(LocalDate.of(dto.getYear(), 10, 1), min));
|
||||
dto.setEndTime(LocalDateTime.of(LocalDate.of(dto.getYear(), 12, 31), max));
|
||||
break;
|
||||
default:
|
||||
throw new ServiceException("季度错误");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MONTH: {
|
||||
if (Objects.isNull(dto.getMonth())) {
|
||||
throw new ServiceException("月份不能为空");
|
||||
}
|
||||
LocalDateTime startTime = LocalDateTime.of(LocalDate.of(dto.getYear(), dto.getMonth(), 1), min);
|
||||
dto.setStartTime(startTime);
|
||||
dto.setEndTime(startTime.plusMonths(1L).minusSeconds(1L));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new ServiceException("时间类型错误");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算上一时间段时间
|
||||
*
|
||||
* @param dto 参数
|
||||
*/
|
||||
public static void calculateLastTime(QueryParamDto dto) {
|
||||
|
||||
if (Objects.isNull(dto)) {
|
||||
throw new ServiceException("参数不能为空");
|
||||
}
|
||||
if (Objects.isNull(dto.getQueryTimeType())) {
|
||||
throw new ServiceException("时间类型不能为空");
|
||||
}
|
||||
if (Objects.isNull(dto.getStartTime()) || Objects.isNull(dto.getEndTime())) {
|
||||
throw new ServiceException("时间不能为空");
|
||||
}
|
||||
switch (dto.getQueryTimeType()) {
|
||||
case YEAR: {
|
||||
dto.setStartTime(dto.getStartTime().minusYears(1L));
|
||||
dto.setEndTime(dto.getEndTime().minusYears(1L));
|
||||
break;
|
||||
}
|
||||
case QUARTER: {
|
||||
dto.setStartTime(dto.getStartTime().minusMonths(3L));
|
||||
dto.setEndTime(dto.getEndTime().minusMonths(3L));
|
||||
break;
|
||||
}
|
||||
case MONTH: {
|
||||
dto.setStartTime(dto.getStartTime().minusMonths(1L));
|
||||
dto.setEndTime(dto.getEndTime().minusMonths(1L));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new ServiceException("时间类型错误");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 填充字典名称
|
||||
*
|
||||
* @param list 列表
|
||||
* @param dictName 字典名称
|
||||
*/
|
||||
public static void fillDictName(List<QueryResultVo> list, String dictName) {
|
||||
|
||||
|
||||
if (CollectionUtils.isEmpty(list) || StringUtils.isBlank(dictName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (dictName) {
|
||||
case "industry": {
|
||||
for (QueryResultVo vo : list) {
|
||||
vo.setDesc(Optional.ofNullable(CommonConstant.INDUSTRY_MAP.get(vo.getCode())).orElse("未知"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new ServiceException("字典名称错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.cms.mapper.TestMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,364 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.cms.mapper.ThemeEmploymentRegisterMapper">
|
||||
|
||||
<!--公共条件 -->
|
||||
<sql id="commonConditions">
|
||||
|
||||
ADC110 BETWEEN #{startTime} AND #{endTime}
|
||||
<if test="area != null and area != ''">
|
||||
AND AAB301 = #{area}
|
||||
</if>
|
||||
<if test="industry != null and industry != ''">
|
||||
AND AAB022 LIKE #{industry} || '%'
|
||||
</if>
|
||||
-- 未注销就业登记
|
||||
AND (ABE585 IS NULL OR ABE585 > #{endTime})
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="queryEmploymentCount"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="java.lang.Long">
|
||||
|
||||
SELECT COUNT(DISTINCT AAC044)
|
||||
FROM theme_employment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryStartupCompanyCount"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="java.lang.Long">
|
||||
|
||||
SELECT COUNT(DISTINCT AAB998)
|
||||
FROM theme_employment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
AND ADC113 = '1'
|
||||
</select>
|
||||
|
||||
<select id="queryStartupEmploymentCount"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="java.lang.Long">
|
||||
|
||||
SELECT COALESCE(SUM(ACC321), 0)
|
||||
FROM theme_employment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
AND ADC113 = '1'
|
||||
</select>
|
||||
|
||||
<select id="queryFlexibleEmploymentCount"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="java.lang.Long">
|
||||
|
||||
SELECT COUNT(DISTINCT AAC044)
|
||||
FROM theme_employment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
AND ADC111 = '22'
|
||||
</select>
|
||||
|
||||
<select id="queryAverageSalary"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="java.math.BigDecimal">
|
||||
|
||||
SELECT COALESCE(ROUND(AVG(ACC328), 2), 0)
|
||||
FROM theme_employment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
</select>
|
||||
|
||||
<select id="scaleAndTrendYear"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.TreadVo">
|
||||
WITH params AS (
|
||||
SELECT CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) AS current_year
|
||||
),
|
||||
-- 一次性生成两年(当前年、去年)的所有月度时间范围
|
||||
month_ranges AS (
|
||||
SELECT
|
||||
m.month_num,
|
||||
y.year_offset,
|
||||
(make_timestamp(p.current_year - y.year_offset, 1, 1, 0, 0, 0)
|
||||
- (m.month_num - 1) * INTERVAL '1 year') AS start_time,
|
||||
(make_timestamp(p.current_year - y.year_offset , 12, 31, 23, 59, 59)
|
||||
- (m.month_num - 1) * INTERVAL '1 year') AS end_time
|
||||
FROM params p
|
||||
CROSS JOIN (SELECT 0 AS year_offset UNION ALL SELECT 1) y
|
||||
CROSS JOIN (SELECT generate_series(1, 5) AS month_num) m
|
||||
),
|
||||
-- 一次扫描表,按条件区分当前年和去年数据
|
||||
aggregated_data AS (
|
||||
SELECT
|
||||
r.month_num,
|
||||
COUNT(DISTINCT CASE WHEN r.year_offset = 0 THEN AAC044 END) AS current_count,
|
||||
COUNT(DISTINCT CASE WHEN r.year_offset = 1 THEN AAC044 END) AS last_count
|
||||
FROM month_ranges r
|
||||
LEFT JOIN theme_employment_register
|
||||
ON
|
||||
ADC110 BETWEEN r.start_time AND r.end_time
|
||||
<if test="area != null and area != ''">
|
||||
AND AAB301 = #{area}
|
||||
</if>
|
||||
<if test="industry != null and industry != ''">
|
||||
AND AAB022 LIKE #{industry} || '%'
|
||||
</if>
|
||||
-- 未注销就业登记
|
||||
AND (ABE585 IS NULL OR ABE585 > r.end_time)
|
||||
GROUP BY r.month_num
|
||||
)
|
||||
SELECT
|
||||
(CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) +1 - month_num) AS code,
|
||||
(CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) +1 - month_num) AS sort,
|
||||
(CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) +1 - month_num) || '年' AS desc,
|
||||
COALESCE(current_count, 0) AS currentCount,
|
||||
COALESCE(last_count, 0) AS lastYearCount
|
||||
FROM aggregated_data
|
||||
ORDER BY sort ;
|
||||
</select>
|
||||
|
||||
<select id="scaleAndTrendQuarter"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.TreadVo">
|
||||
WITH params AS (
|
||||
SELECT CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) AS current_year
|
||||
),
|
||||
-- 一次性生成两年(当前年、去年)的所有月度时间范围
|
||||
month_ranges AS (
|
||||
SELECT
|
||||
m.month_num,
|
||||
y.year_offset,
|
||||
(make_timestamp(p.current_year - y.year_offset, 1, 1, 0, 0, 0)
|
||||
+ (m.month_num - 1) * 3 * INTERVAL '1 month') AS start_time,
|
||||
(make_timestamp(p.current_year - y.year_offset , 1, 1, 0, 0, 0)
|
||||
+ m.month_num * 3 * INTERVAL '1 month' - INTERVAL '1 second') AS end_time
|
||||
FROM params p
|
||||
CROSS JOIN (SELECT 0 AS year_offset UNION ALL SELECT 1) y
|
||||
CROSS JOIN (SELECT generate_series(1, 4) AS month_num) m
|
||||
),
|
||||
-- 一次扫描表,按条件区分当前年和去年数据
|
||||
aggregated_data AS (
|
||||
SELECT
|
||||
r.month_num,
|
||||
COUNT(DISTINCT CASE WHEN r.year_offset = 0 THEN AAC044 END) AS current_count,
|
||||
COUNT(DISTINCT CASE WHEN r.year_offset = 1 THEN AAC044 END) AS last_count
|
||||
FROM month_ranges r
|
||||
LEFT JOIN theme_employment_register
|
||||
ON
|
||||
ADC110 BETWEEN r.start_time AND r.end_time
|
||||
<if test="area != null and area != ''">
|
||||
AND AAB301 = #{area}
|
||||
</if>
|
||||
<if test="industry != null and industry != ''">
|
||||
AND AAB022 LIKE #{industry} || '%'
|
||||
</if>
|
||||
-- 未注销就业登记
|
||||
AND (ABE585 IS NULL OR ABE585 > r.end_time)
|
||||
GROUP BY r.month_num
|
||||
)
|
||||
SELECT
|
||||
month_num AS code,
|
||||
month_num AS sort,
|
||||
'第' || month_num || '季度' AS desc,
|
||||
COALESCE(current_count, 0) AS currentCount,
|
||||
COALESCE(last_count, 0) AS lastYearCount
|
||||
FROM aggregated_data
|
||||
ORDER BY month_num;
|
||||
</select>
|
||||
|
||||
<select id="scaleAndTrendMonth"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.TreadVo">
|
||||
WITH params AS (
|
||||
SELECT CAST(EXTRACT(YEAR FROM #{endTime}) AS INT) AS current_year
|
||||
),
|
||||
-- 一次性生成两年(当前年、去年)的所有月度时间范围
|
||||
month_ranges AS (
|
||||
SELECT
|
||||
m.month_num,
|
||||
y.year_offset,
|
||||
(make_timestamp(p.current_year - y.year_offset, 1, 1, 0, 0, 0)
|
||||
+ (m.month_num - 1) * INTERVAL '1 month') AS start_time,
|
||||
(make_timestamp(p.current_year - y.year_offset , 1, 1, 0, 0, 0)
|
||||
+ m.month_num * INTERVAL '1 month' - INTERVAL '1 second') AS end_time
|
||||
FROM params p
|
||||
CROSS JOIN (SELECT 0 AS year_offset UNION ALL SELECT 1) y
|
||||
CROSS JOIN (SELECT generate_series(1, 12) AS month_num) m
|
||||
),
|
||||
-- 一次扫描表,按条件区分当前年和去年数据
|
||||
aggregated_data AS (
|
||||
SELECT
|
||||
r.month_num,
|
||||
COUNT(DISTINCT CASE WHEN r.year_offset = 0 THEN AAC044 END) AS current_count,
|
||||
COUNT(DISTINCT CASE WHEN r.year_offset = 1 THEN AAC044 END) AS last_count
|
||||
FROM month_ranges r
|
||||
LEFT JOIN theme_employment_register
|
||||
ON
|
||||
ADC110 BETWEEN r.start_time AND r.end_time
|
||||
<if test="area != null and area != ''">
|
||||
AND AAB301 = #{area}
|
||||
</if>
|
||||
<if test="industry != null and industry != ''">
|
||||
AND AAB022 LIKE #{industry} || '%'
|
||||
</if>
|
||||
-- 未注销就业登记
|
||||
AND (ABE585 IS NULL OR ABE585 > r.end_time)
|
||||
GROUP BY r.month_num
|
||||
)
|
||||
SELECT
|
||||
month_num AS code,
|
||||
month_num AS sort,
|
||||
month_num || '月' AS desc,
|
||||
COALESCE(current_count, 0) AS currentCount,
|
||||
COALESCE(last_count, 0) AS lastYearCount
|
||||
FROM aggregated_data
|
||||
ORDER BY month_num;
|
||||
</select>
|
||||
|
||||
|
||||
<select id="structure"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">
|
||||
|
||||
SELECT
|
||||
code,
|
||||
"desc",
|
||||
COUNT(DISTINCT AAC044) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
AAC044,
|
||||
ACA112 AS code,
|
||||
ACA112 AS "desc"
|
||||
FROM theme_employment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY code,"desc"
|
||||
ORDER BY code,"desc"
|
||||
</select>
|
||||
|
||||
|
||||
<select id="scaleComparison"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">
|
||||
|
||||
SELECT
|
||||
code,
|
||||
COUNT(DISTINCT AAC044) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
AAC044,
|
||||
AAB022 AS code
|
||||
FROM theme_employment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY code
|
||||
ORDER BY code
|
||||
</select>
|
||||
|
||||
|
||||
<select id="ageStructure"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">
|
||||
|
||||
SELECT
|
||||
"desc",
|
||||
COUNT(DISTINCT AAC044) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
AAC044,
|
||||
CASE
|
||||
WHEN EXTRACT(YEAR FROM AGE(#{endTime}, CAST(AAC006 AS DATE))) BETWEEN 15 AND 25 THEN '16-25岁'
|
||||
WHEN EXTRACT(YEAR FROM AGE(#{endTime}, CAST(AAC006 AS DATE))) BETWEEN 26 AND 35 THEN '26-35岁'
|
||||
WHEN EXTRACT(YEAR FROM AGE(#{endTime}, CAST(AAC006 AS DATE))) BETWEEN 36 AND 45 THEN '36-45岁'
|
||||
WHEN EXTRACT(YEAR FROM AGE(#{endTime}, CAST(AAC006 AS DATE))) BETWEEN 46 AND 55 THEN '46-55岁'
|
||||
WHEN EXTRACT(YEAR FROM AGE(#{endTime}, CAST(AAC006 AS DATE))) > 55 THEN '55岁以上'
|
||||
ELSE '年龄未知'
|
||||
END AS "desc"
|
||||
FROM theme_employment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY "desc"
|
||||
ORDER BY
|
||||
CASE "desc"
|
||||
WHEN '16-25岁' THEN 1
|
||||
WHEN '26-35岁' THEN 2
|
||||
WHEN '36-45岁' THEN 3
|
||||
WHEN '46-55岁' THEN 4
|
||||
WHEN '55岁以上' THEN 5
|
||||
ELSE 6
|
||||
END
|
||||
</select>
|
||||
|
||||
<select id="salaryLevel"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">
|
||||
|
||||
SELECT
|
||||
code,
|
||||
COALESCE(ROUND(AVG(ACC328), 2), 0) AS amount,
|
||||
COALESCE(ROUND((PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY ACC328))::NUMERIC, 2), 0) AS anotherAmount
|
||||
FROM (
|
||||
SELECT
|
||||
AAC044,
|
||||
AAB022 AS code,
|
||||
ACC328
|
||||
FROM theme_employment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY code
|
||||
ORDER BY code
|
||||
</select>
|
||||
|
||||
<select id="qualityIndicator"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.dto.IndustryEmploymentInfoSqlDto">
|
||||
|
||||
SELECT
|
||||
COUNT(DISTINCT AAC044) AS totalCount,
|
||||
COUNT(DISTINCT CASE WHEN ACC22B = '1' THEN AAC044 END) AS signContractCount,
|
||||
COUNT(DISTINCT CASE WHEN AAC008 = '1' THEN AAC044 END) AS socialInsuranceCount,
|
||||
COUNT(DISTINCT CASE WHEN ACC22D = '1' THEN AAC044 END) AS stableSalaryCount,
|
||||
COUNT(DISTINCT CASE WHEN ACC22C = '1' THEN AAC044 END) AS satisfiedWorkCount
|
||||
FROM theme_employment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="heatmap"
|
||||
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
|
||||
resultType="com.ruoyi.cms.domain.vo.HeatmapVo">
|
||||
|
||||
SELECT
|
||||
areaCode,
|
||||
COUNT(DISTINCT AAC044) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
AAC044,
|
||||
AAB301 AS areaCode
|
||||
FROM theme_employment_register
|
||||
WHERE
|
||||
<!-- 引入公共条件 -->
|
||||
<include refid="commonConditions"/>
|
||||
) subquery
|
||||
GROUP BY areaCode
|
||||
ORDER BY areaCode
|
||||
</select>
|
||||
</mapper>
|
||||
131
sql/datadashboard/table.sql
Normal file
131
sql/datadashboard/table.sql
Normal file
@@ -0,0 +1,131 @@
|
||||
-- 就业登记主题库
|
||||
CREATE TABLE shz_data_dashboard.theme_employment_register
|
||||
(
|
||||
"AAC043" character varying(2) COLLATE pg_catalog."default",
|
||||
"AAC044" character varying(20) COLLATE pg_catalog."default",
|
||||
"AAC003" character varying(200) COLLATE pg_catalog."default",
|
||||
"ADC111" character varying(10) COLLATE pg_catalog."default",
|
||||
"ADC110" timestamp without time zone,
|
||||
"AAE043" timestamp without time zone,
|
||||
"AAB301" character varying(50) COLLATE pg_catalog."default",
|
||||
"AAF001" character varying(255) COLLATE pg_catalog."default",
|
||||
"AAF011" character varying(128) COLLATE pg_catalog."default",
|
||||
"ABE587" character varying(255) COLLATE pg_catalog."default",
|
||||
"ABE585" timestamp without time zone,
|
||||
"ADC112" character varying(255) COLLATE pg_catalog."default",
|
||||
"ADC113" character varying(2) COLLATE pg_catalog."default",
|
||||
"AAB998" character varying(50) COLLATE pg_catalog."default",
|
||||
"AAB003" character varying(50) COLLATE pg_catalog."default",
|
||||
"AAB004" character varying(50) COLLATE pg_catalog."default",
|
||||
"AAC004" character varying(10) COLLATE pg_catalog."default",
|
||||
"AAC005" character varying(10) COLLATE pg_catalog."default",
|
||||
"AAC006" timestamp without time zone,
|
||||
"AAC011" character varying(10) COLLATE pg_catalog."default",
|
||||
"AAB019" character varying(10) COLLATE pg_catalog."default",
|
||||
"AAB022" character varying(10) COLLATE pg_catalog."default",
|
||||
"AAB020" character varying(10) COLLATE pg_catalog."default",
|
||||
"AAE006" character varying(255) COLLATE pg_catalog."default",
|
||||
"ACC321" integer,
|
||||
"ACC328" numeric(10, 2),
|
||||
"ACC22B" character varying(2) COLLATE pg_catalog."default",
|
||||
"AAC008" character varying(2) COLLATE pg_catalog."default",
|
||||
"ACA112" character varying(50) COLLATE pg_catalog."default",
|
||||
"ACC102" integer
|
||||
)
|
||||
;
|
||||
|
||||
ALTER TABLE shz_data_dashboard.theme_employment_register
|
||||
OWNER TO sysdba;
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAC043" IS '证件类型';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAC044" IS '证件号码';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAC003" IS '姓名';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."ADC111" IS '就业形式';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."ADC110" IS '就业日期';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAE043" IS '就业登记日期';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAB301" IS '经办机构所属地区行政区划代码';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAF001" IS '经办机构编号';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAF011" IS '经办机构名称';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."ABE587" IS '注销就业登记标识';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."ABE585" IS '注销就业登记日期';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."ADC112" IS '注销就业登记原因';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."ADC113" IS '创业标识';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAB998" IS '用人单位统一社会信用代码';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAB003" IS '用人单位组织机构代码';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAB004" IS '用人单位名称';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAC004" IS '性别';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAC005" IS '民族';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAC006" IS '出生日期';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAC011" IS '学历';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAB019" IS '单位类型';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAB022" IS '所属行业';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAB020" IS '经济类型';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAE006" IS '单位地址';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."ACC321" IS '创业带动就业人数';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."ACC328" IS '个人月收入';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."ACC22B" IS '是否已签订劳动合同';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."AAC008" IS '人员参保状态';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."ACA112" IS '工种名称';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.theme_employment_register."ACC102" IS '每周工作时间';
|
||||
|
||||
COMMENT
|
||||
ON TABLE shz_data_dashboard.theme_employment_register IS '就业登记主题库';
|
||||
Reference in New Issue
Block a user