添加功能
This commit is contained in:
@@ -165,4 +165,15 @@ public class AnalysisGraduateEmploymentInfoController {
|
||||
public AjaxResult notEmploymentCrowd(@RequestBody QueryParamDto dto) {
|
||||
return AjaxResult.success(analysisGraduateEmploymentInfoService.notEmploymentCrowd(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 热力图
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 热力图列表
|
||||
*/
|
||||
@PostMapping("/heatmap")
|
||||
public AjaxResult heatmap(@RequestBody QueryParamDto dto) {
|
||||
return AjaxResult.success(analysisGraduateEmploymentInfoService.heatmap(dto));
|
||||
}
|
||||
}
|
||||
@@ -117,4 +117,15 @@ public class AnalysisIndustryEmploymentInfoController {
|
||||
public AjaxResult qualityIndicator(@RequestBody QueryParamDto dto) {
|
||||
return AjaxResult.success(analysisIndustryEmploymentInfoService.qualityIndicator(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 热力图
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 热力图列表
|
||||
*/
|
||||
@PostMapping("/heatmap")
|
||||
public AjaxResult heatmap(@RequestBody QueryParamDto dto) {
|
||||
return AjaxResult.success(analysisIndustryEmploymentInfoService.heatmap(dto));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,4 +109,15 @@ public class AnalysisJobDemandTreadController {
|
||||
public AjaxResult skillKeyword(@RequestBody QueryParamDto dto) {
|
||||
return AjaxResult.success(analysisJobDemandTreadService.skillKeyword(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 热力图
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 热力图列表
|
||||
*/
|
||||
@PostMapping("/heatmap")
|
||||
public AjaxResult heatmap(@RequestBody QueryParamDto dto) {
|
||||
return AjaxResult.success(analysisJobDemandTreadService.heatmap(dto));
|
||||
}
|
||||
}
|
||||
@@ -98,4 +98,15 @@ public class AnalysisKeyGroupServiceSituationController {
|
||||
public AjaxResult questionAndSuggestion(@RequestBody QueryParamDto dto) {
|
||||
return AjaxResult.success(analysisKeyGroupServiceSituationService.questionAndSuggestion(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 热力图
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 热力图列表
|
||||
*/
|
||||
@PostMapping("/heatmap")
|
||||
public AjaxResult heatmap(@RequestBody QueryParamDto dto) {
|
||||
return AjaxResult.success(analysisKeyGroupServiceSituationService.heatmap(dto));
|
||||
}
|
||||
}
|
||||
@@ -109,4 +109,15 @@ public class AnalysisMajorIndustryEmploymentMonitorController {
|
||||
public AjaxResult layoffAndLaborGap(@RequestBody QueryParamDto dto) {
|
||||
return AjaxResult.success(analysisMajorIndustryEmploymentMonitorService.layoffAndLaborGap(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 热力图
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 热力图列表
|
||||
*/
|
||||
@PostMapping("/heatmap")
|
||||
public AjaxResult heatmap(@RequestBody QueryParamDto dto) {
|
||||
return AjaxResult.success(analysisMajorIndustryEmploymentMonitorService.heatmap(dto));
|
||||
}
|
||||
}
|
||||
@@ -87,4 +87,15 @@ public class AnalysisSectorOccupationSkillController {
|
||||
public AjaxResult talentSkillLevelDistribution(@RequestBody QueryParamDto dto) {
|
||||
return AjaxResult.success(analysisSectorOccupationSkillService.talentSkillLevelDistribution(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 热力图
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 热力图列表
|
||||
*/
|
||||
@PostMapping("/heatmap")
|
||||
public AjaxResult heatmap(@RequestBody QueryParamDto dto) {
|
||||
return AjaxResult.success(analysisSectorOccupationSkillService.heatmap(dto));
|
||||
}
|
||||
}
|
||||
@@ -98,4 +98,15 @@ public class AnalysisSectorTalentController {
|
||||
public AjaxResult talentSupplyDemandMatchingDegree(@RequestBody QueryParamDto dto) {
|
||||
return AjaxResult.success(analysisSectorTalentService.talentSupplyDemandMatchingDegree(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 热力图
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 热力图列表
|
||||
*/
|
||||
@PostMapping("/heatmap")
|
||||
public AjaxResult heatmap(@RequestBody QueryParamDto dto) {
|
||||
return AjaxResult.success(analysisSectorTalentService.heatmap(dto));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.ruoyi.cms.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 热力图
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/6/26
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class HeatmapVo implements Serializable {
|
||||
private static final long serialVersionUID = -2364992757394142572L;
|
||||
/**
|
||||
* 区划编码
|
||||
*/
|
||||
private String areaCode;
|
||||
/**
|
||||
* 区划名称
|
||||
*/
|
||||
private String areaName;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@Builder.Default
|
||||
private Long count = 0L;
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
@Builder.Default
|
||||
private BigDecimal percentage = BigDecimal.ZERO;
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.ruoyi.cms.domain.dto.QueryParamDto;
|
||||
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.QueryResultVo;
|
||||
|
||||
import java.util.List;
|
||||
@@ -111,4 +112,12 @@ public interface AnalysisGraduateEmploymentInfoService {
|
||||
* @return 结果列表
|
||||
*/
|
||||
List<QueryResultVo> notEmploymentCrowd(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 热力图
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 热力图列表
|
||||
*/
|
||||
List<HeatmapVo> heatmap(QueryParamDto dto);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
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.IndustryEmploymentInfoOverviewVo;
|
||||
import com.ruoyi.cms.domain.vo.QueryResultVo;
|
||||
import com.ruoyi.cms.domain.vo.TreadVo;
|
||||
@@ -80,4 +81,12 @@ public interface AnalysisIndustryEmploymentInfoService {
|
||||
* @return 结果列表
|
||||
*/
|
||||
List<QueryResultVo> qualityIndicator(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 热力图
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 热力图列表
|
||||
*/
|
||||
List<HeatmapVo> heatmap(QueryParamDto dto);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ruoyi.cms.service;
|
||||
import com.ruoyi.cms.domain.dto.QueryParamDto;
|
||||
import com.ruoyi.cms.domain.vo.DictVo;
|
||||
import com.ruoyi.cms.domain.vo.EchartsVo;
|
||||
import com.ruoyi.cms.domain.vo.HeatmapVo;
|
||||
import com.ruoyi.cms.domain.vo.JobDemandTreadDemandVo;
|
||||
import com.ruoyi.cms.domain.vo.JobDemandTreadEconomyCorrelationVo;
|
||||
import com.ruoyi.cms.domain.vo.JobDemandTreadGDPCorrelationVo;
|
||||
@@ -83,4 +84,12 @@ public interface AnalysisJobDemandTreadService {
|
||||
* @return 结果列表
|
||||
*/
|
||||
List<SkillKeywordVo> skillKeyword(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 热力图
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 热力图列表
|
||||
*/
|
||||
List<HeatmapVo> heatmap(QueryParamDto dto);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
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.KeyGroupServiceSituationHelpScoreVo;
|
||||
import com.ruoyi.cms.domain.vo.KeyGroupServiceSituationHelpTypeVo;
|
||||
import com.ruoyi.cms.domain.vo.KeyGroupServiceSituationKeyGroupScoreVo;
|
||||
@@ -73,4 +74,12 @@ public interface AnalysisKeyGroupServiceSituationService {
|
||||
* @return 结果列表
|
||||
*/
|
||||
List<QueryResultVo> questionAndSuggestion(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 热力图
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 热力图列表
|
||||
*/
|
||||
List<HeatmapVo> heatmap(QueryParamDto dto);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
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.MajorIndustryEmploymentMonitorOverviewVo;
|
||||
import com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo;
|
||||
import com.ruoyi.cms.domain.vo.QueryResultVo;
|
||||
@@ -79,4 +80,12 @@ public interface AnalysisMajorIndustryEmploymentMonitorService {
|
||||
* @return 结果列表
|
||||
*/
|
||||
List<QueryResultVo> layoffAndLaborGap(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 热力图
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 热力图列表
|
||||
*/
|
||||
List<HeatmapVo> heatmap(QueryParamDto dto);
|
||||
}
|
||||
@@ -2,6 +2,7 @@ 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.QueryResultVo;
|
||||
import com.ruoyi.cms.domain.vo.SectorOccupationSkillGapVo;
|
||||
import com.ruoyi.cms.domain.vo.SectorOccupationSkillOverviewVo;
|
||||
@@ -65,4 +66,11 @@ public interface AnalysisSectorOccupationSkillService {
|
||||
*/
|
||||
List<QueryResultVo> talentSkillLevelDistribution(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 热力图
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 热力图列表
|
||||
*/
|
||||
List<HeatmapVo> heatmap(QueryParamDto dto);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
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.QueryResultVo;
|
||||
import com.ruoyi.cms.domain.vo.SectorTalentOverviewVo;
|
||||
import com.ruoyi.cms.domain.vo.SectorTalentProsperityIndexVo;
|
||||
@@ -72,4 +73,12 @@ public interface AnalysisSectorTalentService {
|
||||
* @return 结果列表
|
||||
*/
|
||||
List<QueryResultVo> talentSupplyDemandMatchingDegree(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 热力图
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 热力图列表
|
||||
*/
|
||||
List<HeatmapVo> heatmap(QueryParamDto dto);
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.ruoyi.cms.domain.dto.QueryParamDto;
|
||||
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.QueryResultVo;
|
||||
import com.ruoyi.cms.service.AnalysisGraduateEmploymentInfoService;
|
||||
import com.ruoyi.cms.util.MathUtil;
|
||||
@@ -248,4 +249,26 @@ public class AnalysisGraduateEmploymentInfoServiceImpl implements AnalysisGradua
|
||||
MathUtil.calculatePercentage(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ 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.IndustryEmploymentInfoOverviewVo;
|
||||
import com.ruoyi.cms.domain.vo.QueryResultVo;
|
||||
import com.ruoyi.cms.domain.vo.TreadVo;
|
||||
@@ -168,4 +169,19 @@ public class AnalysisIndustryEmploymentInfoServiceImpl implements AnalysisIndust
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
// 计算占比
|
||||
MathUtil.calculatePercentageHeatmap(list);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
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.DictVo;
|
||||
import com.ruoyi.cms.domain.vo.EchartsSeriesVo;
|
||||
import com.ruoyi.cms.domain.vo.EchartsVo;
|
||||
import com.ruoyi.cms.domain.vo.HeatmapVo;
|
||||
import com.ruoyi.cms.domain.vo.JobDemandTreadDemandVo;
|
||||
import com.ruoyi.cms.domain.vo.JobDemandTreadEconomyCorrelationVo;
|
||||
import com.ruoyi.cms.domain.vo.JobDemandTreadGDPCorrelationVo;
|
||||
@@ -197,4 +199,26 @@ public class AnalysisJobDemandTreadServiceImpl implements AnalysisJobDemandTread
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
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.KeyGroupServiceSituationHelpScoreVo;
|
||||
import com.ruoyi.cms.domain.vo.KeyGroupServiceSituationHelpTypeVo;
|
||||
import com.ruoyi.cms.domain.vo.KeyGroupServiceSituationKeyGroupScoreVo;
|
||||
@@ -180,4 +182,26 @@ public class AnalysisKeyGroupServiceSituationServiceImpl implements AnalysisKeyG
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ 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.MajorIndustryEmploymentMonitorOverviewVo;
|
||||
import com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo;
|
||||
import com.ruoyi.cms.domain.vo.QueryResultVo;
|
||||
@@ -165,4 +166,26 @@ public class AnalysisMajorIndustryEmploymentMonitorServiceImpl implements Analys
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.ruoyi.cms.constant.CommonConstant;
|
||||
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.HeatmapVo;
|
||||
import com.ruoyi.cms.domain.vo.QueryResultVo;
|
||||
import com.ruoyi.cms.domain.vo.SectorOccupationSkillGapVo;
|
||||
import com.ruoyi.cms.domain.vo.SectorOccupationSkillOverviewVo;
|
||||
@@ -154,4 +155,26 @@ public class AnalysisSectorOccupationSkillServiceImpl implements AnalysisSectorO
|
||||
MathUtil.calculatePercentage(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ 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.QueryResultVo;
|
||||
import com.ruoyi.cms.domain.vo.SectorTalentOverviewVo;
|
||||
import com.ruoyi.cms.domain.vo.SectorTalentProsperityIndexVo;
|
||||
@@ -147,4 +148,26 @@ public class AnalysisSectorTalentServiceImpl implements AnalysisSectorTalentServ
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.cms.util;
|
||||
|
||||
import com.ruoyi.cms.constant.enums.QueryTimeTypeEnum;
|
||||
import com.ruoyi.cms.domain.vo.HeatmapVo;
|
||||
import com.ruoyi.cms.domain.vo.QueryResultVo;
|
||||
import com.ruoyi.cms.domain.vo.TreadVo;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -102,7 +103,7 @@ public class MathUtil {
|
||||
}
|
||||
long totalCount = 0;
|
||||
for (QueryResultVo dto : list) {
|
||||
totalCount = totalCount + dto.getCount();
|
||||
totalCount = totalCount + Optional.ofNullable(dto.getCount()).orElse(0L);
|
||||
}
|
||||
|
||||
for (QueryResultVo dto : list) {
|
||||
@@ -168,4 +169,26 @@ public class MathUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算占比 - 热力图
|
||||
*
|
||||
* @param list 热力图数据
|
||||
*/
|
||||
public static void calculatePercentageHeatmap(List<HeatmapVo> list) {
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 计算占比
|
||||
long totalCount = 0;
|
||||
for (HeatmapVo vo : list) {
|
||||
totalCount = totalCount + Optional.ofNullable(vo.getCount()).orElse(0L);
|
||||
}
|
||||
|
||||
for (HeatmapVo vo : list) {
|
||||
vo.setPercentage(calculatePercentage(totalCount, vo.getCount()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user