diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/constant/CommonConstant.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/constant/CommonConstant.java index 8d61d63..18b2315 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/constant/CommonConstant.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/constant/CommonConstant.java @@ -363,4 +363,27 @@ public class CommonConstant { Tuple2::getT1, Tuple2::getT2 ))); + + /** + * 帮扶类型列表 + */ + public static final List> ASSIST_TYPE_LIST = + Collections.unmodifiableList(new ArrayList<>(Arrays.asList( + Tuples.of("1", "职业指导"), + Tuples.of("2", "创业服务"), + Tuples.of("3", "职业培训"), + Tuples.of("4", "就业援助"), + Tuples.of("5", "职业介绍"), + Tuples.of("6", "就业见习") + ))); + + /** + * 帮扶类型Map + */ + public static final Map ASSIST_TYPE_MAP = + Collections.unmodifiableMap(ASSIST_TYPE_LIST.stream() + .collect(Collectors.toMap( + Tuple2::getT1, + Tuple2::getT2 + ))); } diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/vo/KeyGroupServiceSituationKeyGroupScoreVo.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/vo/KeyGroupServiceSituationKeyGroupScoreVo.java index 4a2f213..a07fd79 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/vo/KeyGroupServiceSituationKeyGroupScoreVo.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/vo/KeyGroupServiceSituationKeyGroupScoreVo.java @@ -28,6 +28,10 @@ public class KeyGroupServiceSituationKeyGroupScoreVo implements Serializable { * 描述 */ private String desc; + /** + * 服务人数 + */ + private Long serviceCount; /** * 服务覆盖率 */ 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 new file mode 100644 index 0000000..4882393 --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/ThemeAssistRecordMapper.java @@ -0,0 +1,107 @@ +package com.ruoyi.cms.mapper; + +import com.ruoyi.cms.domain.dto.QueryParamDto; +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.util.List; + +/** + * 帮服记录主题库 + * + * @author 马宝龙 + * @date 2026/7/14 + */ +public interface ThemeAssistRecordMapper { + + /** + * 查询数量 + * + * @param dto 查询参数 + * @return 结果 + */ + Long queryCount(QueryParamDto dto); + + /** + * 查询次数 + * + * @param dto 查询参数 + * @return 结果 + */ + Long queryTimes(QueryParamDto dto); + + /** + * 查询就业数量 + * + * @param dto 查询参数 + * @return 结果 + */ + Long queryEmploymentCount(QueryParamDto dto); + + + /** + * 按人员类型分组 + * + * @param dto 查询参数 + * @return 结果列表 + */ + List queryByGroupType(QueryParamDto dto); + + /** + * 帮扶服务类型分析 + * + * @param dto 查询参数 + * @return 结果列表 + */ + List helpServiceType(QueryParamDto dto); + + + /** + * 帮扶成效评估 - 年度 + * @param dto 查询参数 + * @return 结果 + */ + List helpResultScoreYear(QueryParamDto dto); + + + /** + * 帮扶成效评估 - 季度 + * @param dto 查询参数 + * @return 结果 + */ + List helpResultScoreQuarter(QueryParamDto dto); + + + /** + * 帮扶成效评估 - 月度 + * @param dto 查询参数 + * @return 结果 + */ + List helpResultScoreMonth(QueryParamDto dto); + + /** + * 不同重点人群差异化分析 + * + * @param dto 查询参数 + * @return 结果列表 + */ + List keyGroupDifferentiation(QueryParamDto dto); + + /** + * 帮扶过程与满意度 + * + * @param dto 查询参数 + * @return 结果列表 + */ + List helpProcessSatisfaction(QueryParamDto dto); + + /** + * 问题与建议 + * + * @param dto 查询参数 + * @return 结果列表 + */ + List questionAndSuggestion(QueryParamDto dto); +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/ThemeKeyGroupMapper.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/ThemeKeyGroupMapper.java index df0bc91..73cfee4 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/ThemeKeyGroupMapper.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/ThemeKeyGroupMapper.java @@ -14,10 +14,26 @@ import java.util.List; public interface ThemeKeyGroupMapper { + /** + * 查询数量 + * + * @param dto 查询参数 + * @return 结果 + */ + Long queryCount(QueryParamDto dto); /** - * 重点产业招聘需求对比 + * 查询需求数量 + * + * @param dto 查询参数 + * @return 结果 + */ + Long queryDemandCount(QueryParamDto dto); + + + /** + * 按人员类型分组 * * @param dto 查询参数 * @return 结果列表 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 833fb2e..2f4c3f7 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 @@ -13,6 +13,10 @@ import com.ruoyi.cms.domain.vo.JobDemandTreadDemandVo; import com.ruoyi.cms.domain.vo.JobDemandTreadEconomyCorrelationVo; import com.ruoyi.cms.domain.vo.JobDemandTreadGDPCorrelationVo; import com.ruoyi.cms.domain.vo.JobDemandTreadOverviewVo; +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.KeyGroupServiceSituationOverviewVo; import com.ruoyi.cms.domain.vo.LaborForceRecruitmentDemandOverviewVo; import com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorOverviewVo; import com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo; @@ -28,6 +32,7 @@ import com.ruoyi.cms.service.AnalysisExportService; import com.ruoyi.cms.service.AnalysisGraduateEmploymentInfoService; import com.ruoyi.cms.service.AnalysisIndustryEmploymentInfoService; import com.ruoyi.cms.service.AnalysisJobDemandTreadService; +import com.ruoyi.cms.service.AnalysisKeyGroupServiceSituationService; import com.ruoyi.cms.service.AnalysisLaborForceRecruitmentDemandService; import com.ruoyi.cms.service.AnalysisMajorIndustryEmploymentMonitorService; import com.ruoyi.cms.service.AnalysisSectorOccupationSkillService; @@ -70,6 +75,7 @@ public class AnalysisExportServiceImpl implements AnalysisExportService { private final AnalysisSectorTalentService analysisSectorTalentService; private final AnalysisSectorOccupationSkillService analysisSectorOccupationSkillService; private final AnalysisJobDemandTreadService analysisJobDemandTreadService; + private final AnalysisKeyGroupServiceSituationService analysisKeyGroupServiceSituationService; @Override public void exportData(HttpServletResponse response, QueryParamDto dto) { @@ -104,7 +110,7 @@ public class AnalysisExportServiceImpl implements AnalysisExportService { break; // 就业大数据专题分析平台-重点人群跟踪服务情况分析 case EMPLOYMENT_KEY_GROUP_SERVICE_SITUATION: - test(response, dto); + exportKeyGroupServiceSituation(response, dto); break; // 智慧就业大数据分析展示系统-行业就业情况信息分析 case WISDOM_EMPLOYMENT_INDUSTRY_EMPLOYMENT_INFO: @@ -1321,6 +1327,190 @@ public class AnalysisExportServiceImpl implements AnalysisExportService { multiSheetExcelUtil.addSheet(basicSituationExcelUtil); + multiSheetExcelUtil.setFileName(dto.getExportModule().getDesc()); + multiSheetExcelUtil.exportExcel(response); + + } + + /** + * 导出 重点人群跟踪服务情况分析 + * + * @param response 响应 + * @param dto 查询参数 + * @throws IOException 异常 + */ + private void exportKeyGroupServiceSituation(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.getHelpFundPutCount()), + transform(overview.getHelpFundPutCountMom()) + )); + + // 创建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 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); + List situationHelpTypeList = + analysisKeyGroupServiceSituationService.helpServiceType(newParam); + for (KeyGroupServiceSituationHelpTypeVo result : situationHelpTypeList) { + basicExportList.add(new ExcelRow( + result.getDesc(), transform(result.getServiceCount()),transform(result.getServiceSatisfaction()), + transform(result.getResultScore()) + )); + } + // 创建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); + 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 b984e15..4cd550b 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 @@ -11,22 +11,31 @@ import com.ruoyi.cms.domain.vo.KeyGroupServiceSituationHelpTypeVo; import com.ruoyi.cms.domain.vo.KeyGroupServiceSituationKeyGroupScoreVo; import com.ruoyi.cms.domain.vo.KeyGroupServiceSituationOverviewVo; import com.ruoyi.cms.domain.vo.QueryResultVo; +import com.ruoyi.cms.mapper.ThemeAssistRecordMapper; +import com.ruoyi.cms.mapper.ThemeKeyGroupMapper; import com.ruoyi.cms.service.AnalysisKeyGroupServiceSituationService; +import com.ruoyi.cms.util.MathUtil; import com.ruoyi.cms.util.PageUtil; +import com.ruoyi.cms.util.ParamUtil; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.bean.BeanUtils; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import reactor.util.function.Tuple2; -import reactor.util.function.Tuples; import java.math.BigDecimal; import java.math.RoundingMode; import java.time.LocalDateTime; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; /** * 重点人群跟踪服务情况分析 @@ -37,160 +46,218 @@ import java.util.List; @Service @Validated @Slf4j +@RequiredArgsConstructor public class AnalysisKeyGroupServiceSituationServiceImpl implements AnalysisKeyGroupServiceSituationService { + private final ThemeKeyGroupMapper themeKeyGroupMapper; + private final ThemeAssistRecordMapper themeAssistRecordMapper; + + @Override public KeyGroupServiceSituationOverviewVo overview(QueryParamDto dto) { + + // 计算当前时间数据 + ParamUtil.dealParam(dto); + Long serviceTargetCount = themeKeyGroupMapper.queryCount(dto); + + Long serviceDemandCount = Optional.ofNullable(themeKeyGroupMapper.queryDemandCount(dto)) + .orElse(0L); + + Long actualServiceCount = Optional.ofNullable(themeAssistRecordMapper.queryCount(dto)) + .orElse(0L); + + Long actualServiceTimes = themeAssistRecordMapper.queryTimes(dto); + + BigDecimal serviceCoverageRate = MathUtil.calculatePercentage(serviceDemandCount, actualServiceCount); + + Long employmentCount = Optional.ofNullable(themeAssistRecordMapper.queryEmploymentCount(dto)) + .orElse(0L); + BigDecimal afterHelpEmploymentRate = MathUtil.calculatePercentage(actualServiceCount, employmentCount); + + // 计算上一时间段数据 + QueryParamDto lastDto = new QueryParamDto(); + BeanUtils.copyProperties(dto, lastDto); + ParamUtil.calculateLastTime(lastDto); + Long lastServiceTargetCount = themeKeyGroupMapper.queryCount(lastDto); + + Long lastServiceDemandCount = Optional.ofNullable(themeKeyGroupMapper.queryDemandCount(lastDto)) + .orElse(0L); + + Long lastActualServiceCount = Optional.ofNullable(themeAssistRecordMapper.queryCount(lastDto)) + .orElse(0L); + + Long lastActualServiceTimes = themeAssistRecordMapper.queryTimes(lastDto); + + BigDecimal lastServiceCoverageRate = MathUtil.calculatePercentage(lastServiceDemandCount, + lastActualServiceCount); + + Long lastEmploymentCount = Optional.ofNullable(themeAssistRecordMapper.queryEmploymentCount(lastDto)) + .orElse(0L); + BigDecimal lastAfterHelpEmploymentRate = MathUtil.calculatePercentage(lastActualServiceCount, + lastEmploymentCount); + return KeyGroupServiceSituationOverviewVo.builder() - .serviceTargetCount(15000L) - .serviceTargetCountMom(BigDecimal.valueOf(5.2)) - .serviceDemandCount(12000L) - .serviceDemandCountMom(BigDecimal.valueOf(3.8)) - .actualServiceCount(10800L) - .actualServiceCountMom(BigDecimal.valueOf(6.5)) - .actualServiceTimes(25600L) - .actualServiceTimesMom(BigDecimal.valueOf(8.1)) - .serviceCoverageRate(BigDecimal.valueOf(90.0)) - .serviceCoverageRateMom(BigDecimal.valueOf(2.3)) - .afterHelpEmploymentRate(BigDecimal.valueOf(72.5)) - .afterHelpEmploymentRateMom(BigDecimal.valueOf(1.8)) - .helpFundPutCount(3200L) - .helpFundPutCountMom(BigDecimal.valueOf(12.5)) - .overallSatisfaction(BigDecimal.valueOf(4.5)) - .overallSatisfactionMom(BigDecimal.valueOf(2.5)) - .majorProblemMentionedCount(657L) - .majorProblemTypeCount(5L) + .serviceTargetCount(serviceTargetCount) + .serviceTargetCountMom( + MathUtil.calculatePercentageGrowthRate(lastServiceTargetCount, serviceTargetCount)) + .serviceDemandCount(serviceDemandCount) + .serviceDemandCountMom( + MathUtil.calculatePercentageGrowthRate(lastServiceDemandCount, serviceDemandCount)) + .actualServiceCount(actualServiceCount) + .actualServiceCountMom( + MathUtil.calculatePercentageGrowthRate(lastActualServiceCount, actualServiceCount)) + .actualServiceTimes(actualServiceTimes) + .actualServiceTimesMom( + MathUtil.calculatePercentageGrowthRate(lastActualServiceTimes, actualServiceTimes)) + .serviceCoverageRate(serviceCoverageRate) + .serviceCoverageRateMom( + MathUtil.calculatePercentageGrowthRate(lastServiceCoverageRate, serviceCoverageRate)) + .afterHelpEmploymentRate(afterHelpEmploymentRate) + .afterHelpEmploymentRateMom( + MathUtil.calculatePercentageGrowthRate(lastAfterHelpEmploymentRate, afterHelpEmploymentRate)) + .helpFundPutCount(0L) + .helpFundPutCountMom(BigDecimal.valueOf(0)) + // todo + .overallSatisfaction(BigDecimal.valueOf(0)) + .overallSatisfactionMom(BigDecimal.valueOf(0)) + .majorProblemMentionedCount(0L) + .majorProblemTypeCount(0L) .build(); } @Override public List serviceCoverage(QueryParamDto dto) { - List list = new ArrayList<>(); - List> coverageList = - Collections.unmodifiableList(new ArrayList<>(Arrays.asList( - Tuples.of("1", "失业人员"), - Tuples.of("2", "高校毕业生"), - Tuples.of("3", "残疾人"), - Tuples.of("4", "低收入家庭"), - Tuples.of("5", "零就业家庭"), - Tuples.of("6", "其他重点人群") - ))); - for (Tuple2 item : coverageList) { - list.add(QueryResultVo.builder() - .code(item.getT1()) - .desc(item.getT2()) - .count((long) Math.floor(Math.random() * 10000) + 1) - .anotherCount((long) Math.floor(Math.random() * 10000) + 1) - .rate(BigDecimal.valueOf(Math.random() * 100 + 1).setScale(1, RoundingMode.HALF_UP)) - .build()); + + ParamUtil.dealParam(dto); + + List serviceTargetList = themeKeyGroupMapper.queryByGroupType(dto); + List actualServiceList = themeAssistRecordMapper.queryByGroupType(dto); + + Set groupTypeSet = new HashSet<>(); + Map serviceTargetMap = new HashMap<>(); + for (QueryResultVo vo : serviceTargetList) { + groupTypeSet.add(vo.getCode()); + serviceTargetMap.put(vo.getCode(), vo); } + Map actualServiceMap = new HashMap<>(); + for (QueryResultVo vo : actualServiceList) { + groupTypeSet.add(vo.getCode()); + actualServiceMap.put(vo.getCode(), vo); + } + + List list = new ArrayList<>(); + for (String groupType : groupTypeSet) { + QueryResultVo serviceTarget = Optional.ofNullable(serviceTargetMap.get(groupType)) + .orElse(QueryResultVo.builder().build()); + QueryResultVo actualService = Optional.ofNullable(actualServiceMap.get(groupType)) + .orElse(QueryResultVo.builder().build()); + BigDecimal serviceCoverageRate = MathUtil.calculatePercentage(serviceTarget.getCount(), + actualService.getCount()); + list.add(QueryResultVo.builder() + .code(groupType) + .desc(ParamUtil.fillDictName(groupType, "groupType")) + .count(serviceTarget.getCount()) + .anotherCount(actualService.getCount()) + .rate(serviceCoverageRate) + .build() + ); + } + return list; } @Override public List helpServiceType(QueryParamDto dto) { - List list = new ArrayList<>(); - List> typeList = - Collections.unmodifiableList(new ArrayList<>(Arrays.asList( - Tuples.of("1", "职业指导"), - Tuples.of("2", "创业服务"), - Tuples.of("3", "职业培训"), - Tuples.of("4", "就业援助"), - Tuples.of("5", "职业介绍"), - Tuples.of("6", "就业见习") - ))); - for (Tuple2 item : typeList) { - list.add(KeyGroupServiceSituationHelpTypeVo.builder() - .code(item.getT1()) - .desc(item.getT2()) - .serviceCount((long) Math.floor(Math.random() * 5000) + 1) - .serviceSatisfaction(new BigDecimal(Math.random() * 100).setScale(2, RoundingMode.HALF_UP)) - .resultScore(new BigDecimal(Math.random() * 100).setScale(2, RoundingMode.HALF_UP)) - .build()); + + ParamUtil.dealParam(dto); + + List list = themeAssistRecordMapper.helpServiceType(dto); + + for (KeyGroupServiceSituationHelpTypeVo vo : list) { + vo.setDesc(ParamUtil.fillDictName(vo.getCode(), "assistType")); } + return list; } @Override public List helpResultScore(QueryParamDto dto) { - List list = new ArrayList<>(); - for (int i = 0; i < 12; i++) { - list.add(KeyGroupServiceSituationHelpScoreVo.builder() - .code(i + 1 + "") - .desc(i + 1 + "月") - .employmentRate(new BigDecimal(Math.random() * 100).setScale(2, RoundingMode.HALF_UP)) - .incomeImprovement(new BigDecimal(Math.random() * 100).setScale(2, RoundingMode.HALF_UP)) - .lifeQualityImprovement(new BigDecimal(Math.random() * 100).setScale(2, RoundingMode.HALF_UP)) - .build()); + + + ParamUtil.dealParam(dto); + + List 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 = themeAssistRecordMapper.helpResultScoreYear(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 = themeAssistRecordMapper.helpResultScoreQuarter(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 = themeAssistRecordMapper.helpResultScoreMonth(dto); + break; + } + default: + throw new ServiceException("时间类型错误"); } return list; } @Override public List keyGroupDifferentiation(QueryParamDto dto) { + + ParamUtil.dealParam(dto); + + List serviceTargetList = themeKeyGroupMapper.queryByGroupType(dto); + List situationList = + themeAssistRecordMapper.keyGroupDifferentiation(dto); + Map serviceTargetMap = new HashMap<>(); + for (QueryResultVo vo : serviceTargetList) { + serviceTargetMap.put(vo.getCode(), vo); + } List list = new ArrayList<>(); - List> groupList = - Collections.unmodifiableList(new ArrayList<>(Arrays.asList( - Tuples.of("1", "失业人员"), - Tuples.of("2", "高校毕业生"), - Tuples.of("3", "残疾人"), - Tuples.of("4", "低收入家庭"), - Tuples.of("5", "零就业家庭"), - Tuples.of("6", "其他重点人群") - ))); - for (Tuple2 item : groupList) { + for (KeyGroupServiceSituationKeyGroupScoreVo vo : situationList) { + QueryResultVo serviceTarget = Optional.ofNullable(serviceTargetMap.get(vo.getCode())) + .orElse(QueryResultVo.builder().build()); list.add(KeyGroupServiceSituationKeyGroupScoreVo.builder() - .code(item.getT1()) - .desc(item.getT2()) - .serviceCoverageRate(new BigDecimal(Math.random() * 100).setScale(2, RoundingMode.HALF_UP)) - .employmentRate(new BigDecimal(Math.random() * 100).setScale(2, RoundingMode.HALF_UP)) - .incomeImprovement(new BigDecimal(Math.random() * 100).setScale(2, RoundingMode.HALF_UP)) - .serviceSatisfaction(new BigDecimal(Math.random() * 100).setScale(2, RoundingMode.HALF_UP)) - .build()); + .code(vo.getCode()) + .desc(ParamUtil.fillDictName(vo.getCode(), "groupType")) + .serviceCount(vo.getServiceCount()) + .serviceCoverageRate(MathUtil.calculatePercentage(serviceTarget.getCount(), vo.getServiceCount())) + .employmentRate(vo.getEmploymentRate()) + .incomeImprovement(vo.getIncomeImprovement()) + .serviceSatisfaction(vo.getServiceSatisfaction()) + .build() + ); } return list; } @Override public List helpProcessSatisfaction(QueryParamDto dto) { - List list = new ArrayList<>(); - List> satisfactionList = - Collections.unmodifiableList(new ArrayList<>(Arrays.asList( - Tuples.of("1", "服务态度"), - Tuples.of("2", "服务专业性"), - Tuples.of("3", "整体满意度"), - Tuples.of("4", "帮扶效果"), - Tuples.of("5", "服务响应时间") - ))); - for (Tuple2 item : satisfactionList) { - list.add(QueryResultVo.builder() - .code(item.getT1()) - .desc(item.getT2()) - .amount(new BigDecimal(Math.random() * 5).setScale(2, RoundingMode.HALF_UP)) - .build()); - } - return list; + + ParamUtil.dealParam(dto); + + return themeAssistRecordMapper.helpProcessSatisfaction(dto); } @Override public List questionAndSuggestion(QueryParamDto dto) { - List list = new ArrayList<>(); - List> suggestionList = - Collections.unmodifiableList(new ArrayList<>(Arrays.asList( - Tuples.of("1", "帮扶资源不足"), - Tuples.of("2", "服务人员专业性不够"), - Tuples.of("3", "帮扶方式单一"), - Tuples.of("4", "跟踪服务不及时"), - Tuples.of("5", "信息系统不完善") - ))); - for (Tuple2 item : suggestionList) { - list.add(QueryResultVo.builder() - .code(item.getT1()) - .desc(item.getT2()) - .count((long) Math.floor(Math.random() * 1000) + 1) - .build()); - } - return list; + + + ParamUtil.dealParam(dto); + + return themeAssistRecordMapper.questionAndSuggestion(dto); } @Override diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/ParamUtil.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/ParamUtil.java index 270aa73..01d35c0 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/ParamUtil.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/ParamUtil.java @@ -229,6 +229,9 @@ public class ParamUtil { case "groupType": { return Optional.ofNullable(CommonConstant.GROUP_TYPE_MAP.get(code)).orElse("未知"); } + case "assistType": { + return Optional.ofNullable(CommonConstant.ASSIST_TYPE_MAP.get(code)).orElse("未知"); + } default: throw new ServiceException("字典名称错误"); } diff --git a/ruoyi-bussiness/src/main/resources/mapper/ThemeAssistRecordMapper.xml b/ruoyi-bussiness/src/main/resources/mapper/ThemeAssistRecordMapper.xml new file mode 100644 index 0000000..649bfd2 --- /dev/null +++ b/ruoyi-bussiness/src/main/resources/mapper/ThemeAssistRecordMapper.xml @@ -0,0 +1,335 @@ + + + + + + + assist_time BETWEEN #{startTime} AND #{endTime} + + AND area_code = #{area} + + + AND industry LIKE #{industry} || '%' + + + AND ( + + industry LIKE #{industry} || '%' + + ) + + + AND sector = #{sector} + + + + + assist_time BETWEEN r.start_time AND r.end_time + + AND area_code = #{area} + + + AND industry LIKE #{industry} || '%' + + + AND ( + + industry LIKE #{industry} || '%' + + ) + + + AND sector = #{sector} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/resources/mapper/ThemeEconomyIndicatorMapper.xml b/ruoyi-bussiness/src/main/resources/mapper/ThemeEconomyIndicatorMapper.xml index 638b873..899693b 100644 --- a/ruoyi-bussiness/src/main/resources/mapper/ThemeEconomyIndicatorMapper.xml +++ b/ruoyi-bussiness/src/main/resources/mapper/ThemeEconomyIndicatorMapper.xml @@ -10,6 +10,13 @@ + + indicator_time BETWEEN r.start_time AND r.end_time + + AND area_code = #{area} + + + @@ -37,11 +44,7 @@ COALESCE(ROUND(AVG(pmi_index), 2), 0) AS pmiIndex FROM month_ranges r LEFT JOIN theme_economy_indicator - ON - indicator_time BETWEEN r.start_time AND r.end_time - - AND area_code = #{area} - + ON GROUP BY r.month_num ) SELECT @@ -81,11 +84,7 @@ COALESCE(ROUND(AVG(pmi_index), 2), 0) AS pmiIndex FROM month_ranges r LEFT JOIN theme_economy_indicator - ON - indicator_time BETWEEN r.start_time AND r.end_time - - AND area_code = #{area} - + ON GROUP BY r.month_num ) SELECT @@ -125,11 +124,7 @@ COALESCE(ROUND(AVG(pmi_index), 2), 0) AS pmiIndex FROM month_ranges r LEFT JOIN theme_economy_indicator - ON - indicator_time BETWEEN r.start_time AND r.end_time - - AND area_code = #{area} - + ON GROUP BY r.month_num ) SELECT diff --git a/ruoyi-bussiness/src/main/resources/mapper/ThemeKeyGroupMapper.xml b/ruoyi-bussiness/src/main/resources/mapper/ThemeKeyGroupMapper.xml index da95801..b032f42 100644 --- a/ruoyi-bussiness/src/main/resources/mapper/ThemeKeyGroupMapper.xml +++ b/ruoyi-bussiness/src/main/resources/mapper/ThemeKeyGroupMapper.xml @@ -23,6 +23,31 @@ + + + +