diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/AnalysisLaborForceRecruitmentDemandService.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/AnalysisLaborForceRecruitmentDemandService.java index 0d5fa5e..750ef8d 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/AnalysisLaborForceRecruitmentDemandService.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/AnalysisLaborForceRecruitmentDemandService.java @@ -2,7 +2,6 @@ package com.ruoyi.cms.service; import com.ruoyi.cms.domain.dto.QueryParamDto; import com.ruoyi.cms.domain.vo.EchartsVo; -import com.ruoyi.cms.domain.vo.HeatmapVo; import com.ruoyi.cms.domain.vo.LaborForceRecruitmentDemandOverviewVo; import com.ruoyi.cms.domain.vo.QueryResultVo; import com.ruoyi.cms.domain.vo.TreadVo; diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisExportServiceImpl.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisExportServiceImpl.java index 6ad5f0e..5381b96 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisExportServiceImpl.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisExportServiceImpl.java @@ -2,11 +2,14 @@ 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.EchartsSeriesVo; +import com.ruoyi.cms.domain.vo.EchartsVo; 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.LaborForceRecruitmentDemandOverviewVo; import com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorOverviewVo; import com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo; import com.ruoyi.cms.domain.vo.QueryResultVo; @@ -14,6 +17,7 @@ import com.ruoyi.cms.domain.vo.TreadVo; import com.ruoyi.cms.service.AnalysisExportService; import com.ruoyi.cms.service.AnalysisGraduateEmploymentInfoService; import com.ruoyi.cms.service.AnalysisIndustryEmploymentInfoService; +import com.ruoyi.cms.service.AnalysisLaborForceRecruitmentDemandService; import com.ruoyi.cms.service.AnalysisMajorIndustryEmploymentMonitorService; import com.ruoyi.cms.util.document.ExcelUtil; import com.ruoyi.cms.util.document.MultiSheetExcelUtil; @@ -32,6 +36,7 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.Optional; /** * 分析导出 @@ -48,6 +53,7 @@ public class AnalysisExportServiceImpl implements AnalysisExportService { private final AnalysisIndustryEmploymentInfoService analysisIndustryEmploymentInfoService; private final AnalysisGraduateEmploymentInfoService analysisGraduateEmploymentInfoService; private final AnalysisMajorIndustryEmploymentMonitorService analysisMajorIndustryEmploymentMonitorService; + private final AnalysisLaborForceRecruitmentDemandService analysisLaborForceRecruitmentDemandService; @Override public void exportData(HttpServletResponse response, QueryParamDto dto) { @@ -110,7 +116,7 @@ public class AnalysisExportServiceImpl implements AnalysisExportService { break; // 劳动力动态监测系统-劳动力招聘需求分析 case LABOR_FORCE_RECRUITMENT_DEMAND: - test(response, dto); + exportLaborForceRecruitmentDemand(response, dto); break; // 可以添加更多导出格式的处理 default: @@ -1505,6 +1511,228 @@ public class AnalysisExportServiceImpl implements AnalysisExportService { } + /** + * 导出 劳动力招聘需求分析 + * + * @param response 响应 + * @param dto 查询参数 + * @throws IOException 异常 + */ + private void exportLaborForceRecruitmentDemand(HttpServletResponse response, QueryParamDto dto) throws IOException { + + MultiSheetExcelUtil multiSheetExcelUtil = new MultiSheetExcelUtil(); + + String exportTime = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS); + + // 数据总览 + List basicExportList = new ArrayList<>(); + basicExportList.add(new ExcelRow("导出时间", exportTime)); + basicExportList.add(new ExcelRow("数据总览")); + basicExportList.add(new ExcelRow("指标名称(单位)", "指标值", "较上期变化(%)")); + QueryParamDto newParam = new QueryParamDto(); + BeanUtils.copyProperties(dto, newParam); + LaborForceRecruitmentDemandOverviewVo overview = + analysisLaborForceRecruitmentDemandService.overview(newParam); + + basicExportList.add(new ExcelRow( + "招聘岗位数(个)", transform(overview.getRecruitmentJobCount()), + transform(overview.getRecruitmentJobCountMom()) + )); + basicExportList.add(new ExcelRow( + "招聘总人数(人)", transform(overview.getRecruitmentCount()), + transform(overview.getRecruitmentCountMom()) + )); + basicExportList.add(new ExcelRow( + "市场承诺薪酬(元)", transform(overview.getMarketCommitmentSalary()), + transform(overview.getMarketCommitmentSalaryMom()) + )); + basicExportList.add(new ExcelRow( + "求人倍率(%)", transform(overview.getDemandSupplyRate()), + transform(overview.getDemandSupplyRateMom()) + )); + basicExportList.add(new ExcelRow( + "求人倍率标签", overview.getDemandSupplyRateTag() + )); + basicExportList.add(new ExcelRow( + "求人倍率描述", overview.getDemandSupplyRateDesc() + )); + basicExportList.add(new ExcelRow( + "活跃企业数(人)", transform(overview.getActiveCompanyCount()), + transform(overview.getActiveCompanyCountMom()) + )); + + // 创建Excel工具类并添加工作表 + ExcelUtil 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 treadList = + analysisLaborForceRecruitmentDemandService.recruitmentTrend(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 resultList = + analysisLaborForceRecruitmentDemandService.majorIndustryRecruitment(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("重点监测行业劳动力动态走势")); + newParam = new QueryParamDto(); + BeanUtils.copyProperties(dto, newParam); + EchartsVo echarts = analysisLaborForceRecruitmentDemandService.majorIndustryLaborForceTread(newParam); + List xAxis = echarts.getXAxis(); + xAxis.add(0, "行业\\时间"); + basicExportList.add(new ExcelRow(xAxis.toArray(new String[0]))); + for (EchartsSeriesVo vo : echarts.getSeries()) { + List dataList = vo.getData(); + List dataStr = new ArrayList<>(); + dataStr.add(vo.getName()); + dataList.forEach(data -> dataStr.add(transform(Optional.ofNullable(data).orElse(0L)))); + basicExportList.add(new ExcelRow(dataStr.toArray(new String[0]))); + } + // 创建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 = analysisLaborForceRecruitmentDemandService.companyRecruitmentCount(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("不同企业类型招聘活跃度")); + newParam = new QueryParamDto(); + BeanUtils.copyProperties(dto, newParam); + echarts = analysisLaborForceRecruitmentDemandService.companyRecruitmentWay(newParam); + xAxis = echarts.getXAxis(); + xAxis.add(0, "招聘方式\\企业类型"); + basicExportList.add(new ExcelRow(xAxis.toArray(new String[0]))); + for (EchartsSeriesVo vo : echarts.getSeries()) { + List dataList = vo.getData(); + List dataStr = new ArrayList<>(); + dataStr.add(vo.getName()); + dataList.forEach(data -> dataStr.add(transform(Optional.ofNullable(data).orElse(0L)))); + basicExportList.add(new ExcelRow(dataStr.toArray(new String[0]))); + } + // 创建Excel工具类并添加工作表 + basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class); + basicSituationExcelUtil.setDataList(basicExportList); + basicSituationExcelUtil.setSheetName("不同企业类型招聘活跃度"); + multiSheetExcelUtil.addSheet(basicSituationExcelUtil); + + // 不同类型企业的人才结构需求 + basicExportList = new ArrayList<>(); + basicExportList.add(new ExcelRow("不同类型企业的人才结构需求")); + newParam = new QueryParamDto(); + BeanUtils.copyProperties(dto, newParam); + echarts = analysisLaborForceRecruitmentDemandService.companyRecruitmentEducationLevel(newParam); + xAxis = echarts.getXAxis(); + xAxis.add(0, "学历\\企业类型"); + basicExportList.add(new ExcelRow(xAxis.toArray(new String[0]))); + for (EchartsSeriesVo vo : echarts.getSeries()) { + List dataList = vo.getData(); + List dataStr = new ArrayList<>(); + dataStr.add(vo.getName()); + dataList.forEach(data -> dataStr.add(transform(Optional.ofNullable(data).orElse(0L)))); + basicExportList.add(new ExcelRow(dataStr.toArray(new String[0]))); + } + // 创建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 = analysisLaborForceRecruitmentDemandService.recruitmentArea(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 = analysisLaborForceRecruitmentDemandService.commitmentSalary(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)) { diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisIndustryEmploymentInfoServiceImpl.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisIndustryEmploymentInfoServiceImpl.java index c05dfd9..691b282 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisIndustryEmploymentInfoServiceImpl.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisIndustryEmploymentInfoServiceImpl.java @@ -23,6 +23,7 @@ import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Optional; /** * 行业就业情况信息分析 @@ -49,7 +50,8 @@ public class AnalysisIndustryEmploymentInfoServiceImpl implements AnalysisIndust Long unemploymentCount = themeUnemploymentRegisterMapper.queryUnemploymentCount(dto); BigDecimal unemploymentRate = MathUtil.calculatePercentage( - (unemploymentCount + employmentCount), unemploymentCount); + (Optional.ofNullable(unemploymentCount).orElse(0L) + + Optional.ofNullable(employmentCount).orElse(0L)), unemploymentCount); Long startupCompanyCount = themeEmploymentRegisterMapper.queryStartupCompanyCount(dto); @@ -69,7 +71,8 @@ public class AnalysisIndustryEmploymentInfoServiceImpl implements AnalysisIndust Long lastUnemploymentCount = themeUnemploymentRegisterMapper.queryUnemploymentCount(lastDto); BigDecimal lastUnemploymentRate = MathUtil.calculatePercentage( - (lastUnemploymentCount + lastEmploymentCount), lastUnemploymentCount); + (Optional.ofNullable(lastUnemploymentCount).orElse(0L) + + Optional.ofNullable(lastEmploymentCount).orElse(0L)), lastUnemploymentCount); Long lastStartupCompanyCount = themeEmploymentRegisterMapper.queryStartupCompanyCount(lastDto); diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisLaborForceRecruitmentDemandServiceImpl.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisLaborForceRecruitmentDemandServiceImpl.java index 3af6641..6a01a49 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisLaborForceRecruitmentDemandServiceImpl.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisLaborForceRecruitmentDemandServiceImpl.java @@ -202,7 +202,7 @@ public class AnalysisLaborForceRecruitmentDemandServiceImpl implements AnalysisL .minusYears(5L)); dto.setEndTime(LocalDateTime.of(dto.getYear(), 12, 31, 23, 59, 59)); list = themeRecruitmentJobMapper.majorIndustryLaborForceTreadYear(dto); - vo = transform(list); + vo = transform(list,false); ParamUtil.fillDictName(vo, "majorIndustry"); break; } @@ -210,7 +210,7 @@ public class AnalysisLaborForceRecruitmentDemandServiceImpl implements AnalysisL dto.setStartTime(LocalDateTime.of(dto.getYear(), 1, 1, 0, 0, 0)); dto.setEndTime(LocalDateTime.of(dto.getYear(), 12, 31, 23, 59, 59)); list = themeRecruitmentJobMapper.majorIndustryLaborForceTreadQuarter(dto); - vo = transform(list); + vo = transform(list,false); ParamUtil.fillDictName(vo, "majorIndustry"); break; } @@ -218,7 +218,7 @@ public class AnalysisLaborForceRecruitmentDemandServiceImpl implements AnalysisL dto.setStartTime(LocalDateTime.of(dto.getYear(), 1, 1, 0, 0, 0)); dto.setEndTime(LocalDateTime.of(dto.getYear(), 12, 31, 23, 59, 59)); list = themeRecruitmentJobMapper.majorIndustryLaborForceTreadMonth(dto); - vo = transform(list); + vo = transform(list,false); ParamUtil.fillDictName(vo, "majorIndustry"); break; } @@ -228,7 +228,7 @@ public class AnalysisLaborForceRecruitmentDemandServiceImpl implements AnalysisL return vo; } - private EchartsVo transform(List list) { + private EchartsVo transform(List list, boolean isCode) { EchartsVo vo = EchartsVo.builder() .xAxis(new ArrayList<>()) @@ -249,12 +249,22 @@ public class AnalysisLaborForceRecruitmentDemandServiceImpl implements AnalysisL anotherCodeMap.get(tread.getAnotherCode()).add(tread); } - List xAxis = anotherCodeMap.values().stream() - .findFirst() - .map(firstGroup -> firstGroup.stream() - .map(TreadVo::getDesc) - .collect(Collectors.toList())) - .orElse(new ArrayList<>()); + List xAxis; + if (isCode) { + xAxis = anotherCodeMap.values().stream() + .findFirst() + .map(firstGroup -> firstGroup.stream() + .map(TreadVo::getCode) + .collect(Collectors.toList())) + .orElse(new ArrayList<>()); + } else { + xAxis = anotherCodeMap.values().stream() + .findFirst() + .map(firstGroup -> firstGroup.stream() + .map(TreadVo::getDesc) + .collect(Collectors.toList())) + .orElse(new ArrayList<>()); + } List series = new ArrayList<>(); for (Map.Entry> entry : anotherCodeMap.entrySet()) { @@ -289,7 +299,7 @@ public class AnalysisLaborForceRecruitmentDemandServiceImpl implements AnalysisL ParamUtil.dealParam(dto); List list = themeRecruitmentJobMapper.companyRecruitmentWay(dto); - EchartsVo vo = transform(list); + EchartsVo vo = transform(list,true); ParamUtil.fillDictName(vo, "recruitmentWay"); // 填充重点行业 @@ -297,7 +307,7 @@ public class AnalysisLaborForceRecruitmentDemandServiceImpl implements AnalysisL if (CollectionUtils.isNotEmpty(xAxis)) { List xAxisDesc = new ArrayList<>(); for (String x : xAxis) { - xAxisDesc.add(ParamUtil.fillDictName(x, "majorIndustry")); + xAxisDesc.add(ParamUtil.fillDictName(x, "companyType")); } vo.setXAxis(xAxisDesc); } @@ -310,7 +320,7 @@ public class AnalysisLaborForceRecruitmentDemandServiceImpl implements AnalysisL ParamUtil.dealParam(dto); List list = themeRecruitmentJobMapper.companyRecruitmentEducationLevel(dto); - EchartsVo vo = transform(list); + EchartsVo vo = transform(list, true); ParamUtil.fillDictName(vo, "educationLevel"); // 填充重点行业 @@ -318,7 +328,7 @@ public class AnalysisLaborForceRecruitmentDemandServiceImpl implements AnalysisL if (CollectionUtils.isNotEmpty(xAxis)) { List xAxisDesc = new ArrayList<>(); for (String x : xAxis) { - xAxisDesc.add(ParamUtil.fillDictName(x, "majorIndustry")); + xAxisDesc.add(ParamUtil.fillDictName(x, "companyType")); } vo.setXAxis(xAxisDesc); } diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisMajorIndustryEmploymentMonitorServiceImpl.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisMajorIndustryEmploymentMonitorServiceImpl.java index cb2437f..4dab57c 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisMajorIndustryEmploymentMonitorServiceImpl.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisMajorIndustryEmploymentMonitorServiceImpl.java @@ -80,7 +80,8 @@ public class AnalysisMajorIndustryEmploymentMonitorServiceImpl implements Analys Long employmentCount = themeEmploymentRegisterMapper.queryEmploymentCount(dto); BigDecimal unemploymentRate = MathUtil.calculatePercentage( - (unemploymentCount + employmentCount), unemploymentCount); + (Optional.ofNullable(unemploymentCount).orElse(0L) + + Optional.ofNullable(employmentCount).orElse(0L)), unemploymentCount); // 计算上一时间段数据 QueryParamDto lastDto = new QueryParamDto(); @@ -99,7 +100,8 @@ public class AnalysisMajorIndustryEmploymentMonitorServiceImpl implements Analys Long lastEmploymentCount = themeEmploymentRegisterMapper.queryEmploymentCount(lastDto); BigDecimal lastUnemploymentRate = MathUtil.calculatePercentage( - (lastUnemploymentCount + lastEmploymentCount), lastUnemploymentCount); + (Optional.ofNullable(lastUnemploymentCount).orElse(0L) + + Optional.ofNullable(lastEmploymentCount).orElse(0L)), lastUnemploymentCount); return MajorIndustryEmploymentMonitorOverviewVo.builder() .monitorIndustryCount(monitorIndustryCount) @@ -225,12 +227,14 @@ public class AnalysisMajorIndustryEmploymentMonitorServiceImpl implements Analys .employmentCount(employment.getEmploymentCount()) .unemploymentCount(unemployment.getUnemploymentCount()) .unEmploymentRate( - MathUtil.calculatePercentage((employment.getEmploymentCount() + unemployment.getUnemploymentCount()), + MathUtil.calculatePercentage((Optional.ofNullable(employment.getEmploymentCount()).orElse(0L) + + Optional.ofNullable(unemployment.getUnemploymentCount()).orElse(0L)), unemployment.getUnemploymentCount())) .cityAverageEmploymentCount(employment.getCityAverageEmploymentCount()) .cityAverageUnemploymentCount(unemployment.getCityAverageUnemploymentCount()) .cityAverageUnEmploymentRate( - MathUtil.calculatePercentage((employment.getCityAverageEmploymentCount() + unemployment.getCityAverageUnemploymentCount()), + MathUtil.calculatePercentage((Optional.ofNullable(employment.getCityAverageEmploymentCount()).orElse(0L) + + Optional.ofNullable(unemployment.getCityAverageUnemploymentCount()).orElse(0L)), unemployment.getCityAverageUnemploymentCount())) .build() ); @@ -277,7 +281,8 @@ public class AnalysisMajorIndustryEmploymentMonitorServiceImpl implements Analys .orElse(QueryResultVo.builder().build()); BigDecimal unEmploymentRate = - MathUtil.calculatePercentage((employment.getCount() + unemployment.getCount()), + MathUtil.calculatePercentage((Optional.ofNullable(employment.getCount()).orElse(0L) + + Optional.ofNullable(unemployment.getCount()).orElse(0L)), unemployment.getCount()); QueryResultVo vo = QueryResultVo.builder() diff --git a/ruoyi-bussiness/src/main/resources/mapper/ThemeRecruitmentJobMapper.xml b/ruoyi-bussiness/src/main/resources/mapper/ThemeRecruitmentJobMapper.xml index 2f2b0e2..5e26eda 100644 --- a/ruoyi-bussiness/src/main/resources/mapper/ThemeRecruitmentJobMapper.xml +++ b/ruoyi-bussiness/src/main/resources/mapper/ThemeRecruitmentJobMapper.xml @@ -780,11 +780,11 @@ SELECT vacancies, CASE - WHEN COALESCE(ROUND(AVG(((min_salary + max_salary)/2)), 2), 0) < 5000 THEN '5K以下' - WHEN COALESCE(ROUND(AVG(((min_salary + max_salary)/2)), 2), 0) BETWEEN 5000 AND 8000 THEN '5-8K' - WHEN COALESCE(ROUND(AVG(((min_salary + max_salary)/2)), 2), 0) BETWEEN 8001 AND 12000 THEN '8-12K' - WHEN COALESCE(ROUND(AVG(((min_salary + max_salary)/2)), 2), 0) BETWEEN 12001 AND 15000 THEN '12-15K' - WHEN COALESCE(ROUND(AVG(((min_salary + max_salary)/2)), 2), 0) > 15000 THEN '15K以上' + WHEN COALESCE(ROUND(((min_salary + max_salary)/2), 0), 0) < 5000 THEN '5K以下' + WHEN COALESCE(ROUND(((min_salary + max_salary)/2), 0), 0) BETWEEN 5000 AND 8000 THEN '5-8K' + WHEN COALESCE(ROUND(((min_salary + max_salary)/2), 0), 0) BETWEEN 8001 AND 12000 THEN '8-12K' + WHEN COALESCE(ROUND(((min_salary + max_salary)/2), 0), 0) BETWEEN 12001 AND 15000 THEN '12-15K' + WHEN COALESCE(ROUND(((min_salary + max_salary)/2), 0), 0) > 15000 THEN '15K以上' ELSE '未知' END AS "desc" FROM theme_recruitment_job @@ -795,7 +795,7 @@ GROUP BY "desc" ) WHERE - COALESCE(SUM(vacancies), 0) > 0; + count > 0 ORDER BY CASE "desc" WHEN '5K以下' THEN 1