添加功能

This commit is contained in:
马宝龙
2026-07-13 18:09:40 +08:00
parent 66412dba7d
commit b18da2a666
5 changed files with 79 additions and 26 deletions

View File

@@ -13,6 +13,14 @@ import java.util.List;
*/
public interface ThemeProfessionalTrainMapper {
/**
* 查询数量
*
* @param dto 查询参数
* @return 结果
*/
Long queryCount(QueryParamDto dto);
/**
* 通过技能等级查询
*

View File

@@ -33,6 +33,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
@@ -60,8 +61,15 @@ public class AnalysisSectorTalentServiceImpl implements AnalysisSectorTalentServ
// 计算当前时间数据
ParamUtil.dealParam(dto);
BigDecimal sectorAmount = themeSectorDevelopMapper.querySectorAmount(dto);
if (Objects.nonNull(sectorAmount)) {
sectorAmount = MathUtil.divide(new BigDecimal("100000000"), sectorAmount);
}
BigDecimal companyNewInvestmentAmount = themeSectorDevelopMapper.queryCompanyNewInvestmentAmount(dto);
if (Objects.nonNull(companyNewInvestmentAmount)) {
companyNewInvestmentAmount = MathUtil.divide(new BigDecimal("100000000"),
companyNewInvestmentAmount);
}
Long talentDemandCount = Optional.ofNullable(themeRecruitmentJobMapper.queryDemandCount(dto))
.orElse(0L);
@@ -75,6 +83,8 @@ public class AnalysisSectorTalentServiceImpl implements AnalysisSectorTalentServ
Long startupCompanyCount = themeSectorDevelopMapper.queryStartupCompanyCount(dto);
Long skillTrainCount = themeProfessionalTrainMapper.queryCount(dto);
// 计算上一时间段数据
QueryParamDto lastDto = new QueryParamDto();
BeanUtils.copyProperties(dto, lastDto);
@@ -97,6 +107,8 @@ public class AnalysisSectorTalentServiceImpl implements AnalysisSectorTalentServ
Long lastStartupCompanyCount = themeSectorDevelopMapper.queryStartupCompanyCount(lastDto);
Long lastSkillTrainCount = themeProfessionalTrainMapper.queryCount(lastDto);
return SectorTalentOverviewVo.builder()
.sectorAmount(sectorAmount)
.sectorAmountMom(MathUtil.calculatePercentageGrowthRate(lastSectorAmount, sectorAmount))
@@ -117,6 +129,8 @@ public class AnalysisSectorTalentServiceImpl implements AnalysisSectorTalentServ
.startupCompanyCount(startupCompanyCount)
.startupCompanyCountMom(
MathUtil.calculatePercentageGrowthRate(lastStartupCompanyCount, startupCompanyCount))
.skillTrainCount(skillTrainCount)
.skillTrainCountMom(MathUtil.calculatePercentageGrowthRate(lastSkillTrainCount, skillTrainCount))
.build();
}
@@ -231,17 +245,32 @@ public class AnalysisSectorTalentServiceImpl implements AnalysisSectorTalentServ
.orElse(SectorTalentTreadVo.builder().build());
}
BigDecimal sectorInvestmentAmount = vo.getSectorInvestmentAmount();
if (Objects.nonNull(sectorInvestmentAmount)) {
sectorInvestmentAmount = MathUtil.divide(new BigDecimal("100000000"),
sectorInvestmentAmount);
}
BigDecimal lastSectorIncreaseValue = lastSector.getSectorIncreaseValue();
if (Objects.nonNull(lastSectorIncreaseValue)) {
lastSectorIncreaseValue = MathUtil.divide(new BigDecimal("100000000"),
lastSectorIncreaseValue);
}
BigDecimal sectorIncreaseValue = Optional.ofNullable(vo.getSectorIncreaseValue())
.orElse(BigDecimal.ZERO)
.subtract(Optional.ofNullable(lastSector.getSectorIncreaseValue()).orElse(BigDecimal.ZERO));
sectorInvestmentAmount = MathUtil.divide(new BigDecimal("100000000"),
sectorInvestmentAmount);
list.add(SectorTalentTreadVo.builder()
.code(vo.getCode())
.desc(vo.getDesc())
.jobDemandCount(lobarDemand.getLaborDemandCount())
.sectorInvestmentAmount(vo.getSectorInvestmentAmount())
.sectorInvestmentAmount(sectorInvestmentAmount)
.sectorIncreaseValue(sectorIncreaseValue)
.growthRate(MathUtil.calculatePercentage(lastSector.getSectorIncreaseValue(), sectorIncreaseValue))
.growthRate(MathUtil.calculatePercentage(lastSectorIncreaseValue, sectorIncreaseValue))
.build()
);
}
@@ -323,23 +352,12 @@ public class AnalysisSectorTalentServiceImpl implements AnalysisSectorTalentServ
@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 = themeRecruitmentJobMapper.heatmap(dto);
// 计算占比
MathUtil.calculatePercentageHeatmap(list);
return list;
}
}

View File

@@ -5,8 +5,6 @@ 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 com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import java.math.BigDecimal;
@@ -57,6 +55,24 @@ public class MathUtil {
return new BigDecimal(plainString);
}
/**
* 计算比率
*
* @param divisor 除数(分母)
* @param dividend 被除数(分子)
* @return 比率
*/
public static BigDecimal divide(BigDecimal divisor, BigDecimal dividend) {
if (Objects.isNull(divisor) || Objects.isNull(dividend)) {
return null;
}
String plainString = dividend.divide(divisor, 2, RoundingMode.HALF_UP)
.stripTrailingZeros().toPlainString();
return new BigDecimal(plainString);
}
/**
* 计算比率
@@ -99,7 +115,7 @@ public class MathUtil {
/**
* 计算占比
*
* @param list 数据
* @param list 数据
*/
public static void calculatePercentage(List<QueryResultVo> list) {
if (CollectionUtils.isEmpty(list)) {

View File

@@ -10,6 +10,17 @@
</if>
</sql>
<select id="queryCount"
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
resultType="java.lang.Long">
SELECT COUNT(DISTINCT AAC044)
FROM theme_professional_train
WHERE
<!-- 引入公共条件 -->
<include refid="commonConditions"/>
</select>
<select id="queryBySkillLevel"
parameterType="com.ruoyi.cms.domain.dto.QueryParamDto"
resultType="com.ruoyi.cms.domain.vo.QueryResultVo">

View File

@@ -761,7 +761,7 @@ CREATE TABLE shz_data_dashboard.theme_professional_train
jglx character varying(200) COLLATE pg_catalog."default",
qh character varying(200) COLLATE pg_catalog."default",
zsbh character varying(200) COLLATE pg_catalog."default",
sfzh character varying(200) COLLATE pg_catalog."default",
sfhg character varying(10) COLLATE pg_catalog."default",
jndj character varying(200) COLLATE pg_catalog."default",
cxxylb character varying(200) COLLATE pg_catalog."default",
cxxyzt character varying(200) COLLATE pg_catalog."default",
@@ -780,13 +780,13 @@ ALTER TABLE shz_data_dashboard.theme_professional_train
OWNER TO sysdba;
COMMENT
ON COLUMN shz_data_dashboard.theme_unemployment_register."AAC043" IS '证件类型';
ON COLUMN shz_data_dashboard.theme_professional_train."AAC043" IS '证件类型';
COMMENT
ON COLUMN shz_data_dashboard.theme_unemployment_register."AAC044" IS '证件号码';
ON COLUMN shz_data_dashboard.theme_professional_train."AAC044" IS '证件号码';
COMMENT
ON COLUMN shz_data_dashboard.theme_unemployment_register."AAC003" IS '姓名';
ON COLUMN shz_data_dashboard.theme_professional_train."AAC003" IS '姓名';
COMMENT
ON COLUMN shz_data_dashboard.theme_professional_train.pxkssj IS '培训开始时间';