添加功能

This commit is contained in:
马宝龙
2026-06-27 02:34:00 +08:00
parent c40c32ce8c
commit 0b24148e67
5 changed files with 440 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
package com.ruoyi.cms.service;
import com.ruoyi.cms.domain.dto.QueryParamDto;
import com.ruoyi.cms.domain.vo.HeatmapVo;
import com.ruoyi.cms.domain.vo.LaborForceEmploymentOverviewVo;
import com.ruoyi.cms.domain.vo.LaborForceEmploymentTargetVo;
import com.ruoyi.cms.domain.vo.QueryResultVo;
import java.util.List;
/**
* 劳动力就业失业数据分析
*
* @author 马宝龙
* @date 2026/6/27
*/
public interface AnalysisLaborForceEmploymentService {
/**
* 数据总览
*
* @param dto 查询参数
* @return 数据总览
*/
LaborForceEmploymentOverviewVo overview(QueryParamDto dto);
/**
* 城镇新增就业完成情况
*
* @param dto 查询参数
* @return 结果
*/
LaborForceEmploymentTargetVo taget(QueryParamDto dto);
/**
* 就业产业情况分析
*
* @param dto 查询参数
* @return 结果列表
*/
List<QueryResultVo> employIndustrySituation(QueryParamDto dto);
/**
* 就业人员性别分布
*
* @param dto 查询参数
* @return 结果列表
*/
List<QueryResultVo> employmentGender(QueryParamDto dto);
/**
* 就业形式
*
* @param dto 查询参数
* @return 结果列表
*/
List<QueryResultVo> employmentMode(QueryParamDto dto);
/**
* 就业热力图
*
* @param dto 查询参数
* @return 热力图列表
*/
List<HeatmapVo> employmentHeatmap(QueryParamDto dto);
/**
* 失业热力图
*
* @param dto 查询参数
* @return 热力图列表
*/
List<HeatmapVo> unemploymentHeatmap(QueryParamDto dto);
}

View File

@@ -0,0 +1,151 @@
package com.ruoyi.cms.service.impl;
import com.ruoyi.cms.constant.CommonConstant;
import com.ruoyi.cms.domain.dto.QueryParamDto;
import com.ruoyi.cms.domain.vo.HeatmapVo;
import com.ruoyi.cms.domain.vo.LaborForceEmploymentOverviewVo;
import com.ruoyi.cms.domain.vo.LaborForceEmploymentTargetVo;
import com.ruoyi.cms.domain.vo.QueryResultVo;
import com.ruoyi.cms.service.AnalysisLaborForceEmploymentService;
import com.ruoyi.cms.util.MathUtil;
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.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* 劳动力就业失业数据分析
*
* @author 马宝龙
* @date 2026/6/27
*/
@Service
@Validated
@Slf4j
public class AnalysisLaborForceEmploymentServiceImpl implements AnalysisLaborForceEmploymentService {
@Override
public LaborForceEmploymentOverviewVo overview(QueryParamDto dto) {
return LaborForceEmploymentOverviewVo.builder()
.totalEmploymentCount(120000L)
.totalEmploymentCountMom(BigDecimal.valueOf(3.2))
.townEmploymentCount(10000L)
.townEmploymentCountMom(BigDecimal.valueOf(-2.1))
.unEmploymentEmploymentCount(2000L)
.unEmploymentEmploymentCountMom(BigDecimal.valueOf(6.05))
.employmentDifficultyEmploymentCount(5000L)
.employmentDifficultyEmploymentCountMom(BigDecimal.valueOf(3.03))
.unemploymentCount(4000L)
.unemploymentCountMom(BigDecimal.valueOf(-1.02))
.unemploymentBenefitCount(3000L)
.unemploymentBenefitCountMom(BigDecimal.valueOf(4.01))
.receiveUnemploymentServiceCount(1000L)
.receiveUnemploymentServiceCountMom(BigDecimal.valueOf(-3.01))
.build();
}
@Override
public LaborForceEmploymentTargetVo taget(QueryParamDto dto) {
return LaborForceEmploymentTargetVo.builder()
.currentFinishCount(8500L)
.overallYearFinishCount(12000L)
.finishRate(BigDecimal.valueOf(70.83))
.build();
}
@Override
public List<QueryResultVo> employIndustrySituation(QueryParamDto dto) {
List<QueryResultVo> list = new ArrayList<>();
List<Tuple2<String, String>> industryList =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", "第一产业"),
Tuples.of("2", "第二产业"),
Tuples.of("2", "第三产业")
)));
for (Tuple2<String, String> industry : industryList) {
list.add(QueryResultVo.builder()
.code(industry.getT1())
.desc(industry.getT2())
.count((long) Math.floor(Math.random() * 100000) + 1)
.build());
}
MathUtil.calculatePercentage(list);
return list;
}
@Override
public List<QueryResultVo> employmentGender(QueryParamDto dto) {
List<QueryResultVo> list = new ArrayList<>();
List<Tuple2<String, String>> genderList =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", ""),
Tuples.of("2", "")
)));
for (Tuple2<String, String> gender : genderList) {
list.add(QueryResultVo.builder()
.code(gender.getT1())
.desc(gender.getT2())
.count((long) Math.floor(Math.random() * 100000) + 1)
.build());
}
MathUtil.calculatePercentage(list);
return list;
}
@Override
public List<QueryResultVo> employmentMode(QueryParamDto dto) {
List<QueryResultVo> list = new ArrayList<>();
List<Tuple2<String, String>> modeList =
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
Tuples.of("1", "单位就业"),
Tuples.of("2", "灵活就业"),
Tuples.of("3", "个体经营"),
Tuples.of("4", "公益性岗位")
)));
for (Tuple2<String, String> mode : modeList) {
list.add(QueryResultVo.builder()
.code(mode.getT1())
.desc(mode.getT2())
.count((long) Math.floor(Math.random() * 100000) + 1)
.build());
}
MathUtil.calculatePercentage(list);
return list;
}
@Override
public List<HeatmapVo> employmentHeatmap(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());
}
MathUtil.calculatePercentageHeatmap(list);
return list;
}
@Override
public List<HeatmapVo> unemploymentHeatmap(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() * 5000) + 1)
.build());
}
MathUtil.calculatePercentageHeatmap(list);
return list;
}
}