From 00e27f6a59ba5aecf4aef6968707d11479b34c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E5=AE=9D=E9=BE=99?= Date: Wed, 15 Jul 2026 12:58:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cms/mapper/ThemeAssistRecordMapper.java | 46 +++++ .../impl/AnalysisExportServiceImpl.java | 192 +++++++++++++++++- ...isKeyGroupServiceSituationServiceImpl.java | 131 +++--------- .../mapper/ThemeAssistRecordMapper.xml | 106 ++++++++++ 4 files changed, 368 insertions(+), 107 deletions(-) diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/ThemeAssistRecordMapper.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/ThemeAssistRecordMapper.java index 4882393..45d70c1 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/ThemeAssistRecordMapper.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/ThemeAssistRecordMapper.java @@ -1,11 +1,15 @@ package com.ruoyi.cms.mapper; +import com.ruoyi.cms.domain.dto.KeyGroupQueryDTO; import com.ruoyi.cms.domain.dto.QueryParamDto; +import com.ruoyi.cms.domain.vo.HeatmapVo; +import com.ruoyi.cms.domain.vo.KeyGroupResultVo; import com.ruoyi.cms.domain.vo.KeyGroupServiceSituationHelpScoreVo; import com.ruoyi.cms.domain.vo.KeyGroupServiceSituationHelpTypeVo; import com.ruoyi.cms.domain.vo.KeyGroupServiceSituationKeyGroupScoreVo; import com.ruoyi.cms.domain.vo.QueryResultVo; +import java.math.BigDecimal; import java.util.List; /** @@ -40,6 +44,22 @@ public interface ThemeAssistRecordMapper { */ Long queryEmploymentCount(QueryParamDto dto); + /** + * 查询整体满意度 + * + * @param dto 查询参数 + * @return 结果 + */ + BigDecimal queryOverallSatisfaction(QueryParamDto dto); + + /** + * 查询问题与建议 + * + * @param dto 查询参数 + * @return 结果 + */ + QueryResultVo queryProblem(QueryParamDto dto); + /** * 按人员类型分组 @@ -60,6 +80,7 @@ public interface ThemeAssistRecordMapper { /** * 帮扶成效评估 - 年度 + * * @param dto 查询参数 * @return 结果 */ @@ -68,6 +89,7 @@ public interface ThemeAssistRecordMapper { /** * 帮扶成效评估 - 季度 + * * @param dto 查询参数 * @return 结果 */ @@ -76,6 +98,7 @@ public interface ThemeAssistRecordMapper { /** * 帮扶成效评估 - 月度 + * * @param dto 查询参数 * @return 结果 */ @@ -104,4 +127,27 @@ public interface ThemeAssistRecordMapper { * @return 结果列表 */ List questionAndSuggestion(QueryParamDto dto); + + /** + * 热力图 + * + * @param dto 查询参数 + * @return 热力图列表 + */ + List heatmap(QueryParamDto dto); + + /** + * 查询数量 + * + * @param dto 查询参数 + * @return 结果 + */ + Long count(KeyGroupQueryDTO dto); + + /** + * 查询列表 + * @param dto 查询参数 + * @return 结果 + */ + List list(KeyGroupQueryDTO dto); } \ No newline at end of file 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 8d9a393..0ace99d 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 @@ -130,7 +130,7 @@ public class AnalysisExportServiceImpl implements AnalysisExportService { break; // 智慧就业大数据分析展示系统-重点人群跟踪服务情况分析 case WISDOM_EMPLOYMENT_KEY_GROUP_SERVICE_SITUATION: - test(response, dto); + exportWisdomKeyGroupServiceSituation(response, dto); break; // 智慧就业大数据分析展示系统-劳动力就业失业数据分析 case WISDOM_EMPLOYMENT_LABOR_FORCE_EMPLOYMENT: @@ -2452,7 +2452,197 @@ public class AnalysisExportServiceImpl implements AnalysisExportService { } + /** + * 导出 重点人群跟踪服务情况分析 + * + * @param response 响应 + * @param dto 查询参数 + * @throws IOException 异常 + */ + private void exportWisdomKeyGroupServiceSituation(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); + KeyGroupServiceSituationOverviewVo overview = + analysisKeyGroupServiceSituationService.overview(newParam); + + basicExportList.add(new ExcelRow( + "服务对象人数(人)", transform(overview.getServiceTargetCount()), + transform(overview.getServiceTargetCountMom()) + )); + basicExportList.add(new ExcelRow( + "服务需求人数(人)", transform(overview.getServiceDemandCount()), + transform(overview.getServiceDemandCountMom()) + )); + basicExportList.add(new ExcelRow( + "实际服务人数(人)", transform(overview.getActualServiceCount()), + transform(overview.getActualServiceCountMom()) + )); + basicExportList.add(new ExcelRow( + "实际服务人次(人次)", transform(overview.getActualServiceTimes()), + transform(overview.getActualServiceTimesMom()) + )); + basicExportList.add(new ExcelRow( + "服务覆盖率(%)", transform(overview.getServiceCoverageRate()), + transform(overview.getServiceCoverageRateMom()) + )); + basicExportList.add(new ExcelRow( + "帮扶后就业率(%)", transform(overview.getAfterHelpEmploymentRate()), + transform(overview.getAfterHelpEmploymentRateMom()) + )); + basicExportList.add(new ExcelRow( + "整体满意度(分)", transform(overview.getOverallSatisfaction()), + transform(overview.getOverallSatisfactionMom()) + )); + basicExportList.add(new ExcelRow( + "主要问题提及(次)", transform(overview.getMajorProblemMentionedCount()) + )); + basicExportList.add(new ExcelRow( + "主要问题类型(种)", transform(overview.getMajorProblemTypeCount()) + )); + + // 创建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 heatmapList = analysisKeyGroupServiceSituationService.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 serviceSituationHelpScoreList = + analysisKeyGroupServiceSituationService.helpResultScore(newParam); + for (KeyGroupServiceSituationHelpScoreVo result : serviceSituationHelpScoreList) { + basicExportList.add(new ExcelRow( + result.getDesc(), transform(result.getEmploymentRate()),transform(result.getIncomeImprovement()), + transform(result.getLifeQualityImprovement()) + )); + } + // 创建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 situationKeyGroupScoreList = + analysisKeyGroupServiceSituationService.keyGroupDifferentiation(newParam); + for (KeyGroupServiceSituationKeyGroupScoreVo result : situationKeyGroupScoreList) { + basicExportList.add(new ExcelRow( + result.getDesc(), transform(result.getServiceCoverageRate()),transform(result.getEmploymentRate()), + transform(result.getIncomeImprovement()), transform(result.getServiceSatisfaction()) + )); + } + // 创建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 = + analysisKeyGroupServiceSituationService.serviceCoverage(newParam); + for (QueryResultVo result : resultList) { + basicExportList.add(new ExcelRow( + result.getDesc(), transform(result.getCount()), transform(result.getAnotherCount()), + transform(result.getRate()) + )); + } + // 创建Excel工具类并添加工作表 + basicSituationExcelUtil = new ExcelUtil<>(ExcelRow.class); + basicSituationExcelUtil.setDataList(basicExportList); + basicSituationExcelUtil.setSheetName("服务覆盖范围"); + multiSheetExcelUtil.addSheet(basicSituationExcelUtil); + + + // 帮扶过程与满意度 + basicExportList = new ArrayList<>(); + basicExportList.add(new ExcelRow("帮扶过程与满意度")); + basicExportList.add(new ExcelRow("类型", "满意度(分)")); + newParam = new QueryParamDto(); + BeanUtils.copyProperties(dto, newParam); + resultList = + analysisKeyGroupServiceSituationService.helpProcessSatisfaction(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); + resultList = + analysisKeyGroupServiceSituationService.questionAndSuggestion(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); + + } /** * 导出 劳动力招聘需求分析 diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisKeyGroupServiceSituationServiceImpl.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisKeyGroupServiceSituationServiceImpl.java index 4cd550b..315109f 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisKeyGroupServiceSituationServiceImpl.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AnalysisKeyGroupServiceSituationServiceImpl.java @@ -27,7 +27,6 @@ import org.springframework.validation.annotation.Validated; import reactor.util.function.Tuple2; import java.math.BigDecimal; -import java.math.RoundingMode; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.HashMap; @@ -74,6 +73,11 @@ public class AnalysisKeyGroupServiceSituationServiceImpl implements AnalysisKeyG .orElse(0L); BigDecimal afterHelpEmploymentRate = MathUtil.calculatePercentage(actualServiceCount, employmentCount); + BigDecimal overallSatisfaction = themeAssistRecordMapper.queryOverallSatisfaction(dto); + + QueryResultVo problem = Optional.ofNullable(themeAssistRecordMapper.queryProblem(dto)) + .orElse(QueryResultVo.builder().build()); + // 计算上一时间段数据 QueryParamDto lastDto = new QueryParamDto(); BeanUtils.copyProperties(dto, lastDto); @@ -96,6 +100,8 @@ public class AnalysisKeyGroupServiceSituationServiceImpl implements AnalysisKeyG BigDecimal lastAfterHelpEmploymentRate = MathUtil.calculatePercentage(lastActualServiceCount, lastEmploymentCount); + BigDecimal lastOverallSatisfaction = themeAssistRecordMapper.queryOverallSatisfaction(lastDto); + return KeyGroupServiceSituationOverviewVo.builder() .serviceTargetCount(serviceTargetCount) .serviceTargetCountMom( @@ -117,11 +123,11 @@ public class AnalysisKeyGroupServiceSituationServiceImpl implements AnalysisKeyG MathUtil.calculatePercentageGrowthRate(lastAfterHelpEmploymentRate, afterHelpEmploymentRate)) .helpFundPutCount(0L) .helpFundPutCountMom(BigDecimal.valueOf(0)) - // todo - .overallSatisfaction(BigDecimal.valueOf(0)) - .overallSatisfactionMom(BigDecimal.valueOf(0)) - .majorProblemMentionedCount(0L) - .majorProblemTypeCount(0L) + .overallSatisfaction(overallSatisfaction) + .overallSatisfactionMom( + MathUtil.calculatePercentageGrowthRate(lastOverallSatisfaction, overallSatisfaction)) + .majorProblemMentionedCount(problem.getCount()) + .majorProblemTypeCount(problem.getAnotherCount()) .build(); } @@ -262,23 +268,12 @@ public class AnalysisKeyGroupServiceSituationServiceImpl implements AnalysisKeyG @Override public List heatmap(QueryParamDto dto) { - List list = new ArrayList<>(); - for (Tuple2 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 list = themeAssistRecordMapper.heatmap(dto); + // 计算占比 + MathUtil.calculatePercentageHeatmap(list); + return list; } @@ -296,93 +291,17 @@ public class AnalysisKeyGroupServiceSituationServiceImpl implements AnalysisKeyG @Override public AjaxResult pageKeyGroup(KeyGroupQueryDTO dto) { // 查询总数 - long count = 8L; + long count = themeAssistRecordMapper.count(dto); if (0 == count) { return AjaxResult.success(PageUtil.empty()); } // 查询分页内容 - List voList = new ArrayList<>(); - KeyGroupResultVo vo = KeyGroupResultVo.builder() - .id(1L) - .name("张三") - .keyGroupType("1") - .keyGroupTypeDesc("失业人员") - .serviceContent("xxx") - .serviceTime(LocalDateTime.now()) - .skillLevelDesc("xxx") - .build(); - voList.add(vo); - vo = KeyGroupResultVo.builder() - .id(2L) - .name("李四") - .keyGroupType("2") - .keyGroupTypeDesc("高校毕业生") - .serviceContent("xxx") - .serviceTime(LocalDateTime.now()) - .skillLevelDesc("xxx") - .build(); - voList.add(vo); - vo = KeyGroupResultVo.builder() - .id(3L) - .name("王五") - .keyGroupType("3") - .keyGroupTypeDesc("残疾人") - .serviceContent("xxx") - .serviceTime(LocalDateTime.now()) - .skillLevelDesc("xxx") - .build(); - voList.add(vo); - vo = KeyGroupResultVo.builder() - .id(4L) - .name("郑六") - .keyGroupType("4") - .keyGroupTypeDesc("低收入家庭") - .serviceContent("xxx") - .serviceTime(LocalDateTime.now()) - .skillLevelDesc("xxx") - .build(); - voList.add(vo); - vo = KeyGroupResultVo.builder() - .id(5L) - .name("吕七") - .keyGroupType("5") - .keyGroupTypeDesc("零就业家庭") - .serviceContent("xxx") - .serviceTime(LocalDateTime.now()) - .skillLevelDesc("xxx") - .build(); - voList.add(vo); - vo = KeyGroupResultVo.builder() - .id(6L) - .name("陈九") - .keyGroupType("6") - .keyGroupTypeDesc("其他重点人群") - .serviceContent("xxx") - .serviceTime(LocalDateTime.now()) - .skillLevelDesc("xxx") - .build(); - voList.add(vo); - vo = KeyGroupResultVo.builder() - .id(7L) - .name("孙十") - .keyGroupType("1") - .keyGroupTypeDesc("失业人员") - .serviceContent("xxx") - .serviceTime(LocalDateTime.now()) - .skillLevelDesc("xxx") - .build(); - voList.add(vo); - vo = KeyGroupResultVo.builder() - .id(8L) - .name("赵一") - .keyGroupType("2") - .keyGroupTypeDesc("高校毕业生") - .serviceContent("xxx") - .serviceTime(LocalDateTime.now()) - .skillLevelDesc("xxx") - .build(); - voList.add(vo); - + List voList = themeAssistRecordMapper.list(dto); + for (KeyGroupResultVo vo : voList) { + vo.setKeyGroupTypeDesc(ParamUtil.fillDictName(vo.getKeyGroupType(), "groupType")); + vo.setServiceContent(ParamUtil.fillDictName(vo.getServiceContent(), "assistType")); + vo.setSkillLevelDesc(""); + } return AjaxResult.success(PageUtil.init(voList, count, dto.getPageNo(), dto.getPageSize())); } } \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/resources/mapper/ThemeAssistRecordMapper.xml b/ruoyi-bussiness/src/main/resources/mapper/ThemeAssistRecordMapper.xml index 633e449..7d02541 100644 --- a/ruoyi-bussiness/src/main/resources/mapper/ThemeAssistRecordMapper.xml +++ b/ruoyi-bussiness/src/main/resources/mapper/ThemeAssistRecordMapper.xml @@ -80,6 +80,44 @@ + + + + + + SELECT + areaCode, + COUNT(DISTINCT AAC044) AS count + FROM ( + SELECT + AAC044, + area_code AS areaCode + FROM theme_assist_record + WHERE + + + ) subquery + GROUP BY areaCode + ORDER BY areaCode + + + + + + \ No newline at end of file