1.company添加isAbnormal 字段

2.岗位分析-添加educationSalary方法
This commit is contained in:
sh
2025-10-09 18:42:03 +08:00
parent 22ffa7db9c
commit 10cf0369c4
5 changed files with 119 additions and 5 deletions

View File

@@ -85,4 +85,19 @@ public class StaticsController extends BaseController {
Map<String,Object> result = service.education(staticsquery);
return success(result);
}
//分学历-分薪资
@GetMapping("/educationSalaryGen")
public AjaxResult educationSalaryGen()
{
service.educationSalaryGen();
return success();
}
@GetMapping("/educationSalary")
public AjaxResult educationSalary(Staticsquery staticsquery)
{
Map<String,Object> result = service.educationSalary(staticsquery);
return success(result);
}
}

View File

@@ -1,13 +1,10 @@
package com.ruoyi.cms.domain;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.List;
@@ -101,4 +98,7 @@ public class Company extends BaseEntity
@ApiModelProperty("注册地址")
private String registeredAddress;
@ApiModelProperty("是否异常")
private String isAbnormal;
}

View File

@@ -23,4 +23,8 @@ public interface StaticsqueryService {
void educationGen();
Map<String, Object> education(Staticsquery staticsquery);
void educationSalaryGen();
Map<String, Object> educationSalary(Staticsquery staticsquery);
}

View File

@@ -457,4 +457,98 @@ public class StaticsqueryServiceImpl extends ServiceImpl<StaticsMapper, Statics>
}
public void educationSalaryGen() {
// 定义岗位分类
String[] jobCategories = {
"初中及以下",
"中专/中技",
"高中",
"大专",
"本科",
"硕士",
"博士",
"MBA/EMBA",
"留学-学士",
"留学-硕士",
"留学-博士",
"不限"
};
//薪资类型
String[] salarys = {
"3k-5k",
"5k-8k",
"10k-15K",
"15k-20k",
"20k+"
};
// 定义时间周期
String[] timePeriods = {
"2025-01", "2025-02", "2025-03", "2025-04", "2025-05",
"2024-11", "2024-12"
};
// 所有支持的类型
Map<String, List<String>> typeMap = new HashMap<>();
typeMap.put("month", Arrays.asList(
"分学历/分薪资/月/岗位发布数量"
));
for (String time : timePeriods) {
String granularity;
// 判断时间粒度:月、季度、年
if (time.matches("\\d{4}-\\d{2}")) {
granularity = "month"; // 如 "2025-01"
} else if (time.matches("\\d{4}-第[一二三四]季度")) {
granularity = "quarter"; // 如 "2024-第一季度"
} else if (time.matches("\\d{4}")) {
granularity = "year"; // 如 "2025"
} else {
continue; // 非法格式跳过
}
List<String> applicableTypes = typeMap.get(granularity);
for (String type : applicableTypes) {
for (String category : jobCategories) {
for(String salary:salarys){
Statics stat = new Statics();
stat.setTime(time);
stat.setType(type);
stat.setName(category+"/"+salary);
// 设置数据值
if (type.contains("岗位发布数量")) {
int baseValue = 1000;
if (granularity.equals("quarter")) baseValue = 300;
if (granularity.equals("year")) baseValue = 1200;
int variation = (int)(baseValue * 0.2 * (Math.random() - 0.5));
stat.setData(String.valueOf(baseValue + variation));
} else {
double baseRate = 0.05;
double variation = 0.01 * (Math.random() - 0.5);
stat.setData(String.format("%.2f", baseRate + variation));
}
stat.setDelFlag("0");
staticsMapper.insert(stat);
}
}
}
}
}
@Override
public Map<String, Object> educationSalary(Staticsquery staticsquery) {
HashMap<String, Object> result = new HashMap<>();
List<String> query = staticsquery.generateTimeRange();
for (String time : query) {
List<Statics> statics = staticsMapper.selectList(Wrappers.<Statics>lambdaQuery().eq(Statics::getType, "分学历/分薪资/" + staticsquery.getTimeDimension()+"/"+staticsquery.getType()).eq(Statics::getTime, time));
result.put(time, statics);
}
return result;
}
}