添加功能
This commit is contained in:
@@ -302,4 +302,45 @@ public class CommonConstant {
|
||||
Tuple2::getT1,
|
||||
Tuple2::getT2
|
||||
)));
|
||||
|
||||
/**
|
||||
* 企业类型列表
|
||||
*/
|
||||
public static final List<Tuple2<String, String>> COMPANY_TYPE_LIST =
|
||||
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
|
||||
Tuples.of("1", "国有企业"),
|
||||
Tuples.of("2", "民营企业"),
|
||||
Tuples.of("3", "外资企业"),
|
||||
Tuples.of("4", "合资企业"),
|
||||
Tuples.of("5", "事业单位")
|
||||
)));
|
||||
/**
|
||||
* 企业类型Map
|
||||
*/
|
||||
public static final Map<String, String> COMPANY_TYPE_MAP =
|
||||
Collections.unmodifiableMap(COMPANY_TYPE_LIST.stream()
|
||||
.collect(Collectors.toMap(
|
||||
Tuple2::getT1,
|
||||
Tuple2::getT2
|
||||
)));
|
||||
|
||||
/**
|
||||
* 招聘方式列表
|
||||
*/
|
||||
public static final List<Tuple2<String, String>> RECRUITMENT_WAY_LIST =
|
||||
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
|
||||
Tuples.of("1", "线上招聘"),
|
||||
Tuples.of("2", "线下招聘"),
|
||||
Tuples.of("3", "校园招聘"),
|
||||
Tuples.of("4", "内部推荐")
|
||||
)));
|
||||
/**
|
||||
* 企业类型Map
|
||||
*/
|
||||
public static final Map<String, String> RECRUITMENT_WAY_MAP =
|
||||
Collections.unmodifiableMap(RECRUITMENT_WAY_LIST.stream()
|
||||
.collect(Collectors.toMap(
|
||||
Tuple2::getT1,
|
||||
Tuple2::getT2
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -24,10 +24,18 @@ public class TreadVo implements Serializable {
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 另一个编码
|
||||
*/
|
||||
private String anotherCode;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String desc;
|
||||
/**
|
||||
* 另一个描述
|
||||
*/
|
||||
private String anotherDesc;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.ruoyi.cms.domain.dto.QueryParamDto;
|
||||
import com.ruoyi.cms.domain.vo.HeatmapVo;
|
||||
import com.ruoyi.cms.domain.vo.MajorIndustryEmploymentMonitorTreadVo;
|
||||
import com.ruoyi.cms.domain.vo.QueryResultVo;
|
||||
import com.ruoyi.cms.domain.vo.TreadVo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
@@ -123,4 +124,101 @@ public interface ThemeRecruitmentJobMapper {
|
||||
* @return 热力图列表
|
||||
*/
|
||||
List<HeatmapVo> heatmap(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 招聘需求规模趋势 - 年度
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 趋势列表
|
||||
*/
|
||||
List<TreadVo> recruitmentTrendYear(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 招聘需求规模趋势 - 季度
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 趋势列表
|
||||
*/
|
||||
List<TreadVo> recruitmentTrendQuarter(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 招聘需求规模趋势 - 月度
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 趋势列表
|
||||
*/
|
||||
List<TreadVo> recruitmentTrendMonth(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 重点产业招聘需求对比
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 结果列表
|
||||
*/
|
||||
List<QueryResultVo> majorIndustryRecruitment(QueryParamDto dto);
|
||||
|
||||
|
||||
/**
|
||||
* 重点监测行业劳动力动态走势 - 年度
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 趋势列表
|
||||
*/
|
||||
List<TreadVo> majorIndustryLaborForceTreadYear(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 重点监测行业劳动力动态走势 - 季度
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 趋势列表
|
||||
*/
|
||||
List<TreadVo> majorIndustryLaborForceTreadQuarter(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 重点监测行业劳动力动态走势 - 月度
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 趋势列表
|
||||
*/
|
||||
List<TreadVo> majorIndustryLaborForceTreadMonth(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 不同类型企业用工规模
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 结果列表
|
||||
*/
|
||||
List<QueryResultVo> companyRecruitmentCount(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 不同企业类型招聘活跃度
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 结果列表
|
||||
*/
|
||||
List<TreadVo> companyRecruitmentWay(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 不同类型企业的人才结构需求
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 结果列表
|
||||
*/
|
||||
List<TreadVo> companyRecruitmentEducationLevel(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 招聘需求区域分布
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 结果列表
|
||||
*/
|
||||
List<QueryResultVo> recruitmentArea(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 承诺薪酬分布分布
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 结果列表
|
||||
*/
|
||||
List<QueryResultVo> commitmentSalary(QueryParamDto dto);
|
||||
}
|
||||
|
||||
@@ -12,21 +12,24 @@ import com.ruoyi.cms.mapper.ThemeRecruitmentJobMapper;
|
||||
import com.ruoyi.cms.service.AnalysisLaborForceRecruitmentDemandService;
|
||||
import com.ruoyi.cms.util.MathUtil;
|
||||
import com.ruoyi.cms.util.ParamUtil;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
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.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
/**
|
||||
* 劳动力招聘需求分析
|
||||
@@ -140,178 +143,207 @@ public class AnalysisLaborForceRecruitmentDemandServiceImpl implements AnalysisL
|
||||
|
||||
@Override
|
||||
public List<TreadVo> recruitmentTrend(QueryParamDto dto) {
|
||||
List<TreadVo> list = new ArrayList<>();
|
||||
for (int i = 1; i <= 12; i++) {
|
||||
long currentCount = (long) Math.floor(Math.random() * 15000) + 5000;
|
||||
long lastYearCount = (long) Math.floor(Math.random() * 14000) + 4000;
|
||||
list.add(TreadVo.builder()
|
||||
.code(String.valueOf(i))
|
||||
.desc(i + "月")
|
||||
.sort(i)
|
||||
.currentCount(currentCount)
|
||||
.lastYearCount(lastYearCount)
|
||||
.build());
|
||||
|
||||
ParamUtil.dealParam(dto);
|
||||
|
||||
List<TreadVo> 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 = themeRecruitmentJobMapper.recruitmentTrendYear(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 = themeRecruitmentJobMapper.recruitmentTrendQuarter(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 = themeRecruitmentJobMapper.recruitmentTrendMonth(dto);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new ServiceException("时间类型错误");
|
||||
}
|
||||
|
||||
// 计算同环比
|
||||
MathUtil.calculatePercentageGrowthRate(dto.getQueryTimeType(), list);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QueryResultVo> majorIndustryRecruitment(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("3", "建筑业"),
|
||||
Tuples.of("4", "批发零售业"),
|
||||
Tuples.of("5", "住宿餐饮业"),
|
||||
Tuples.of("6", "交通运输业")
|
||||
)));
|
||||
for (Tuple2<String, String> industry : industryList) {
|
||||
list.add(QueryResultVo.builder()
|
||||
.code(industry.getT1())
|
||||
.desc(industry.getT2())
|
||||
.count((long) Math.floor(Math.random() * 5000) + 500)
|
||||
.build());
|
||||
}
|
||||
|
||||
dealParam(dto);
|
||||
List<QueryResultVo> list = themeRecruitmentJobMapper.majorIndustryRecruitment(dto);
|
||||
MathUtil.calculatePercentage(list);
|
||||
ParamUtil.fillDictName(list, "majorIndustry");
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EchartsVo majorIndustryLaborForceTread(QueryParamDto dto) {
|
||||
List<String> xAxis = IntStream.rangeClosed(1, 12)
|
||||
.mapToObj(i -> i + "月")
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<Tuple2<String, String>> industryList =
|
||||
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
|
||||
Tuples.of("1", "制造业"),
|
||||
Tuples.of("2", "信息技术"),
|
||||
Tuples.of("3", "建筑业")
|
||||
)));
|
||||
|
||||
List<EchartsSeriesVo> series = new ArrayList<>();
|
||||
for (Tuple2<String, String> industry : industryList) {
|
||||
List<Long> dataList = new ArrayList<>();
|
||||
for (int i = 0; i < 12; i++) {
|
||||
dataList.add((long) Math.floor(Math.random() * 4000) + 1000);
|
||||
ParamUtil.dealParam(dto);
|
||||
|
||||
EchartsVo vo;
|
||||
List<TreadVo> 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 = themeRecruitmentJobMapper.majorIndustryLaborForceTreadYear(dto);
|
||||
vo = transform(list);
|
||||
ParamUtil.fillDictName(vo, "majorIndustry");
|
||||
break;
|
||||
}
|
||||
series.add(EchartsSeriesVo.builder().name(industry.getT2()).data(dataList).build());
|
||||
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 = themeRecruitmentJobMapper.majorIndustryLaborForceTreadQuarter(dto);
|
||||
vo = transform(list);
|
||||
ParamUtil.fillDictName(vo, "majorIndustry");
|
||||
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 = themeRecruitmentJobMapper.majorIndustryLaborForceTreadMonth(dto);
|
||||
vo = transform(list);
|
||||
ParamUtil.fillDictName(vo, "majorIndustry");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new ServiceException("时间类型错误");
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
private EchartsVo transform(List<TreadVo> list) {
|
||||
|
||||
EchartsVo vo = EchartsVo.builder()
|
||||
.xAxis(new ArrayList<>())
|
||||
.series(new ArrayList<>())
|
||||
.build();
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return vo;
|
||||
}
|
||||
|
||||
return EchartsVo.builder().xAxis(xAxis).series(series).build();
|
||||
Map<String, List<TreadVo>> anotherCodeMap = new HashMap<>();
|
||||
for (TreadVo tread : list) {
|
||||
if (StringUtils.isBlank(tread.getAnotherCode())) {
|
||||
continue;
|
||||
}
|
||||
if (!anotherCodeMap.containsKey(tread.getAnotherCode())) {
|
||||
anotherCodeMap.put(tread.getAnotherCode(), new ArrayList<>());
|
||||
}
|
||||
anotherCodeMap.get(tread.getAnotherCode()).add(tread);
|
||||
}
|
||||
|
||||
List<String> xAxis = anotherCodeMap.values().stream()
|
||||
.findFirst()
|
||||
.map(firstGroup -> firstGroup.stream()
|
||||
.map(TreadVo::getDesc)
|
||||
.collect(Collectors.toList()))
|
||||
.orElse(new ArrayList<>());
|
||||
|
||||
List<EchartsSeriesVo> series = new ArrayList<>();
|
||||
for (Map.Entry<String, List<TreadVo>> entry : anotherCodeMap.entrySet()) {
|
||||
List<Long> dataList = new ArrayList<>();
|
||||
for (TreadVo tread : entry.getValue()) {
|
||||
dataList.add(tread.getCurrentCount());
|
||||
}
|
||||
series.add(EchartsSeriesVo.builder()
|
||||
.name(entry.getKey())
|
||||
.data(dataList)
|
||||
.build());
|
||||
}
|
||||
|
||||
vo.setXAxis(xAxis);
|
||||
vo.setSeries(series);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QueryResultVo> companyRecruitmentCount(QueryParamDto dto) {
|
||||
List<QueryResultVo> list = new ArrayList<>();
|
||||
List<Tuple2<String, String>> companyTypeList =
|
||||
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
|
||||
Tuples.of("1", "国有企业"),
|
||||
Tuples.of("2", "民营企业"),
|
||||
Tuples.of("3", "外资企业"),
|
||||
Tuples.of("4", "合资企业"),
|
||||
Tuples.of("5", "事业单位")
|
||||
)));
|
||||
for (Tuple2<String, String> type : companyTypeList) {
|
||||
list.add(QueryResultVo.builder()
|
||||
.code(type.getT1())
|
||||
.desc(type.getT2())
|
||||
.count((long) Math.floor(Math.random() * 3000) + 200)
|
||||
.build());
|
||||
}
|
||||
|
||||
ParamUtil.dealParam(dto);
|
||||
List<QueryResultVo> list = themeRecruitmentJobMapper.companyRecruitmentCount(dto);
|
||||
MathUtil.calculatePercentage(list);
|
||||
ParamUtil.fillDictName(list, "companyType");
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EchartsVo companyRecruitmentWay(QueryParamDto dto) {
|
||||
List<String> xAxis = IntStream.rangeClosed(1, 12)
|
||||
.mapToObj(i -> i + "月")
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<Tuple2<String, String>> wayList =
|
||||
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
|
||||
Tuples.of("1", "线上招聘"),
|
||||
Tuples.of("2", "线下招聘"),
|
||||
Tuples.of("3", "校园招聘"),
|
||||
Tuples.of("4", "内部推荐")
|
||||
)));
|
||||
ParamUtil.dealParam(dto);
|
||||
List<TreadVo> list = themeRecruitmentJobMapper.companyRecruitmentWay(dto);
|
||||
EchartsVo vo = transform(list);
|
||||
ParamUtil.fillDictName(vo, "recruitmentWay");
|
||||
|
||||
List<EchartsSeriesVo> series = new ArrayList<>();
|
||||
for (Tuple2<String, String> way : wayList) {
|
||||
List<Long> dataList = new ArrayList<>();
|
||||
for (int i = 0; i < 12; i++) {
|
||||
dataList.add((long) Math.floor(Math.random() * 300) + 50);
|
||||
// 填充重点行业
|
||||
List<String> xAxis = vo.getXAxis();
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
List<String> xAxisDesc = new ArrayList<>();
|
||||
for (String x : xAxis) {
|
||||
xAxisDesc.add(ParamUtil.fillDictName(x, "majorIndustry"));
|
||||
}
|
||||
series.add(EchartsSeriesVo.builder().name(way.getT2()).data(dataList).build());
|
||||
vo.setXAxis(xAxisDesc);
|
||||
}
|
||||
|
||||
return EchartsVo.builder().xAxis(xAxis).series(series).build();
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EchartsVo companyRecruitmentEducationLevel(QueryParamDto dto) {
|
||||
List<String> xAxis = IntStream.rangeClosed(1, 12)
|
||||
.mapToObj(i -> i + "月")
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<Tuple2<String, String>> levelList =
|
||||
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
|
||||
Tuples.of("1", "高中及以下"),
|
||||
Tuples.of("2", "大专"),
|
||||
Tuples.of("3", "本科"),
|
||||
Tuples.of("4", "硕士及以上")
|
||||
)));
|
||||
ParamUtil.dealParam(dto);
|
||||
List<TreadVo> list = themeRecruitmentJobMapper.companyRecruitmentEducationLevel(dto);
|
||||
EchartsVo vo = transform(list);
|
||||
ParamUtil.fillDictName(vo, "educationLevel");
|
||||
|
||||
List<EchartsSeriesVo> series = new ArrayList<>();
|
||||
for (Tuple2<String, String> level : levelList) {
|
||||
List<Long> dataList = new ArrayList<>();
|
||||
for (int i = 0; i < 12; i++) {
|
||||
dataList.add((long) Math.floor(Math.random() * 500) + 100);
|
||||
// 填充重点行业
|
||||
List<String> xAxis = vo.getXAxis();
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
List<String> xAxisDesc = new ArrayList<>();
|
||||
for (String x : xAxis) {
|
||||
xAxisDesc.add(ParamUtil.fillDictName(x, "majorIndustry"));
|
||||
}
|
||||
series.add(EchartsSeriesVo.builder().name(level.getT2()).data(dataList).build());
|
||||
vo.setXAxis(xAxisDesc);
|
||||
}
|
||||
|
||||
return EchartsVo.builder().xAxis(xAxis).series(series).build();
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QueryResultVo> recruitmentArea(QueryParamDto dto) {
|
||||
List<QueryResultVo> list = new ArrayList<>();
|
||||
for (Tuple2<String, String> area : CommonConstant.AREA_LIST) {
|
||||
list.add(QueryResultVo.builder()
|
||||
.code(area.getT1())
|
||||
.desc(area.getT2())
|
||||
.count((long) Math.floor(Math.random() * 2000) + 100)
|
||||
.build());
|
||||
}
|
||||
|
||||
ParamUtil.dealParam(dto);
|
||||
List<QueryResultVo> list = themeRecruitmentJobMapper.recruitmentArea(dto);
|
||||
MathUtil.calculatePercentage(list);
|
||||
ParamUtil.fillDictName(list, "area");
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QueryResultVo> commitmentSalary(QueryParamDto dto) {
|
||||
List<QueryResultVo> list = new ArrayList<>();
|
||||
List<Tuple2<String, String>> salaryList =
|
||||
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
|
||||
Tuples.of("1", "2000元以下"),
|
||||
Tuples.of("2", "2000-4000元"),
|
||||
Tuples.of("3", "4000-6000元"),
|
||||
Tuples.of("4", "6000-8000元"),
|
||||
Tuples.of("5", "8000-10000元"),
|
||||
Tuples.of("6", "10000元以上")
|
||||
)));
|
||||
for (Tuple2<String, String> salary : salaryList) {
|
||||
list.add(QueryResultVo.builder()
|
||||
.code(salary.getT1())
|
||||
.desc(salary.getT2())
|
||||
.count((long) Math.floor(Math.random() * 3000) + 200)
|
||||
.build());
|
||||
}
|
||||
|
||||
ParamUtil.dealParam(dto);
|
||||
List<QueryResultVo> list = themeRecruitmentJobMapper.commitmentSalary(dto);
|
||||
MathUtil.calculatePercentage(list);
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,11 @@ package com.ruoyi.cms.util;
|
||||
|
||||
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.GraduateEmploymentInfoTreadVo;
|
||||
import com.ruoyi.cms.domain.vo.QueryResultVo;
|
||||
import com.ruoyi.cms.domain.vo.TreadVo;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -146,6 +149,21 @@ public class ParamUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充字典名称
|
||||
*
|
||||
* @param echarts 数据
|
||||
* @param dictName 字典名称
|
||||
*/
|
||||
public static void fillDictName(EchartsVo echarts, String dictName) {
|
||||
if (Objects.isNull(echarts) || CollectionUtils.isEmpty(echarts.getSeries()) || StringUtils.isBlank(dictName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (EchartsSeriesVo vo : echarts.getSeries()) {
|
||||
vo.setName(fillDictName(vo.getName(), dictName));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充字典名称
|
||||
@@ -164,7 +182,13 @@ public class ParamUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static String fillDictName(String code, String dictName){
|
||||
/**
|
||||
* 填充字典名称
|
||||
* @param code 码值
|
||||
* @param dictName 字典名称
|
||||
* @return 字典值
|
||||
*/
|
||||
public static String fillDictName(String code, String dictName) {
|
||||
switch (dictName) {
|
||||
case "industry": {
|
||||
return Optional.ofNullable(CommonConstant.INDUSTRY_MAP.get(code)).orElse("未知");
|
||||
@@ -190,6 +214,15 @@ public class ParamUtil {
|
||||
case "jobType": {
|
||||
return Optional.ofNullable(CommonConstant.JOB_TYPE_MAP.get(code)).orElse("未知");
|
||||
}
|
||||
case "companyType": {
|
||||
return Optional.ofNullable(CommonConstant.COMPANY_TYPE_MAP.get(code)).orElse("未知");
|
||||
}
|
||||
case "recruitmentWay": {
|
||||
return Optional.ofNullable(CommonConstant.RECRUITMENT_WAY_MAP.get(code)).orElse("未知");
|
||||
}
|
||||
case "area": {
|
||||
return Optional.ofNullable(CommonConstant.AREA_MAP.get(code)).orElse("未知");
|
||||
}
|
||||
default:
|
||||
throw new ServiceException("字典名称错误");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user