添加功能

This commit is contained in:
马宝龙
2026-07-15 12:58:28 +08:00
parent d007c100f6
commit 00e27f6a59
4 changed files with 368 additions and 107 deletions

View File

@@ -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<QueryResultVo> questionAndSuggestion(QueryParamDto dto);
/**
* 热力图
*
* @param dto 查询参数
* @return 热力图列表
*/
List<HeatmapVo> heatmap(QueryParamDto dto);
/**
* 查询数量
*
* @param dto 查询参数
* @return 结果
*/
Long count(KeyGroupQueryDTO dto);
/**
* 查询列表
* @param dto 查询参数
* @return 结果
*/
List<KeyGroupResultVo> list(KeyGroupQueryDTO dto);
}

View File

@@ -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<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);
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<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 = 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<KeyGroupServiceSituationHelpScoreVo> 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<KeyGroupServiceSituationKeyGroupScoreVo> 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<QueryResultVo> 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);
}
/**
* 导出 劳动力招聘需求分析

View File

@@ -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<HeatmapVo> heatmap(QueryParamDto dto) {
List<HeatmapVo> list = new ArrayList<>();
for (Tuple2<String, String> area : CommonConstant.AREA_LIST) {
list.add(HeatmapVo.builder()
.areaCode(area.getT1())
.areaName(area.getT2())
.count((long) Math.floor(Math.random() * 10000) + 1)
.build());
}
long totalCount = list.stream().mapToLong(HeatmapVo::getCount).sum();
for (HeatmapVo vo : list) {
if (totalCount > 0) {
vo.setPercentage(new BigDecimal(vo.getCount())
.divide(BigDecimal.valueOf(totalCount), 4, RoundingMode.HALF_UP)
.multiply(BigDecimal.valueOf(100))
.setScale(2, RoundingMode.HALF_UP));
}
}
ParamUtil.dealParam(dto);
List<HeatmapVo> list = 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.<KeyGroupResultVo>empty());
}
// 查询分页内容
List<KeyGroupResultVo> 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<KeyGroupResultVo> 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()));
}
}

View File

@@ -80,6 +80,44 @@
</select>
<select id="queryOverallSatisfaction"
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
resultType="java.math.BigDecimal">
SELECT COALESCE(ROUND(AVG(satisfaction_service_whole), 2), 0)
FROM theme_assist_record
WHERE
<!-- 引入公共条件 -->
<include refid="commonConditions"/>
</select>
<select id="queryProblem"
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">
SELECT
-- 五个字段分别求和后再求总和
(COALESCE(SUM(problem_service_resource), 0) +
COALESCE(SUM(problem_service_professional), 0) +
COALESCE(SUM(problem_service_way), 0) +
COALESCE(SUM(problem_service_follow), 0) +
COALESCE(SUM(problem_info_system), 0)) AS count,
-- 每个字段求和后大于0则记1再求总和
(CASE WHEN SUM(problem_service_resource) > 0 THEN 1 ELSE 0 END +
CASE WHEN SUM(problem_service_professional) > 0 THEN 1 ELSE 0 END +
CASE WHEN SUM(problem_service_way) > 0 THEN 1 ELSE 0 END +
CASE WHEN SUM(problem_service_follow) > 0 THEN 1 ELSE 0 END +
CASE WHEN SUM(problem_info_system) > 0 THEN 1 ELSE 0 END) AS anotherCount
FROM theme_assist_record
WHERE
<!-- 引入公共条件 -->
<include refid="commonConditions"/>
</select>
<select id="queryByGroupType"
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
@@ -332,4 +370,72 @@
GROUP BY v.problem_type;
</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,
area_code AS areaCode
FROM theme_assist_record
WHERE
<!-- 引入公共条件 -->
<include refid="commonConditions"/>
) subquery
GROUP BY areaCode
ORDER BY areaCode
</select>
<select id="count"
parameterType="com.ruoyi.cms.domain.dto.KeyGroupQueryDTO"
resultType="java.lang.Long">
SELECT COUNT(1)
FROM theme_assist_record
<where>
<if test="area != null and area != ''">
AND area_code like '%' || #{area} || '%'
</if>
<if test="name != null and name != ''">
AND AAC003 like '%' || #{name} || '%'
</if>
<if test="keyGroupType != null and keyGroupType != ''">
AND group_type like '%' || #{keyGroupType} || '%'
</if>
</where>
</select>
<select id="list"
parameterType="com.ruoyi.cms.domain.dto.KeyGroupQueryDTO"
resultType="com.ruoyi.cms.domain.vo.KeyGroupResultVo">
SELECT
AAC003 AS name,
group_type AS keyGroupType,
assist_type AS serviceContent,
assist_time AS serviceTime
FROM theme_assist_record
<where>
<if test="area != null and area != ''">
AND area_code like '%' || #{area} || '%'
</if>
<if test="name != null and name != ''">
AND AAC003 like '%' || #{name} || '%'
</if>
<if test="keyGroupType != null and keyGroupType != ''">
AND group_type like '%' || #{keyGroupType} || '%'
</if>
</where>
ORDER BY assist_time DESC
LIMIT #{pageSize} OFFSET (#{pageSize})*(#{pageNo}-1);
</select>
</mapper>