添加agent相关配置

This commit is contained in:
zk
2026-04-23 20:55:08 +08:00
parent 2a8bb4b718
commit 699cac64d5
7 changed files with 305 additions and 0 deletions
@@ -0,0 +1,36 @@
package org.jiayunet.controller;
import org.jiayunet.pojo.dto.jobAgent.JobAgentConfigDto;
import org.jiayunet.pojo.param.jobAgent.JobAgentConfigParam;
import org.jiayunet.service.JobAgentConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 求职助手配置接口
*
* @author zk
*/
@RestController
@RequestMapping("/job-agent")
public class JobAgentConfigController {
@Autowired
private JobAgentConfigService configService;
/**
* 查询当前用户的求职助手配置
*/
@GetMapping("/config")
public JobAgentConfigDto getConfig() {
return configService.getConfig();
}
/**
* 保存/更新求职助手配置
*/
@PostMapping("/config/save")
public void saveConfig(@RequestBody JobAgentConfigParam param) {
configService.saveConfig(param);
}
}
@@ -0,0 +1,51 @@
package org.jiayunet.pojo.dto.jobAgent;
import lombok.Data;
import org.jiayunet.pojo.vo.LanguageAbility;
import java.util.List;
/**
* 求职助手配置出参
*
* @author zk
*/
@Data
public class JobAgentConfigDto {
/** 工作类型 1=实习 2=全职 */
private Integer jobType;
/** Agent模式 1=协作模式 2=托管模式 */
private Integer agentMode;
/** 每周投递目标数量 1=少于20个 2=20到50个 3=多于50个 */
private Integer weeklyTarget;
/** 投递时自动针对岗位优化简历 0=关闭 1=开启 */
private Integer autoOptimizeResume;
/** 是否愿意接受部门调剂 */
private String acceptDeptTransfer;
/** 是否接受地点调剂 */
private String acceptLocationTransfer;
/** 可参加的面试方式 */
private List<String> interviewType;
/** 语言能力 */
private List<LanguageAbility> languages;
/** 预计到岗时间 */
private String availableDate;
/** 每周可实习天数 */
private String internDaysPerWeek;
/** 预计实习时长 */
private String internDuration;
/** 状态 0=未启用 1=已启用 */
private Integer status;
}
@@ -0,0 +1,48 @@
package org.jiayunet.pojo.param.jobAgent;
import lombok.Data;
import org.jiayunet.pojo.vo.LanguageAbility;
import java.util.List;
/**
* 求职助手配置入参
*
* @author zk
*/
@Data
public class JobAgentConfigParam {
/** 工作类型 1=实习 2=全职 */
private Integer jobType;
/** Agent模式 1=协作模式 2=托管模式 */
private Integer agentMode;
/** 每周投递目标数量 1=少于20个 2=20到50个 3=多于50个 */
private Integer weeklyTarget;
/** 投递时自动针对岗位优化简历 0=关闭 1=开启 */
private Integer autoOptimizeResume;
/** 是否愿意接受部门调剂,可选值:是/否 */
private String acceptDeptTransfer;
/** 是否接受地点调剂,可选值:是/否 */
private String acceptLocationTransfer;
/** 可参加的面试方式,可选值:线下面试/线上远程 */
private List<String> interviewType;
/** 语言能力 */
private List<LanguageAbility> languages;
/** 预计到岗时间,可选值:一周以内/两周以内/一个月以内/一个月以上 */
private String availableDate;
/** 每周可实习天数,可选值:3天及以上/4天及以上/5天及以上 */
private String internDaysPerWeek;
/** 预计实习时长,可选值:3个月/4个月/5个月/6个月及以上 */
private String internDuration;
}
@@ -0,0 +1,65 @@
package org.jiayunet.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jiayunet.mapper.JobAgentConfigMapper;
import org.jiayunet.pojo.dto.jobAgent.JobAgentConfigDto;
import org.jiayunet.pojo.param.jobAgent.JobAgentConfigParam;
import org.jiayunet.pojo.po.JobAgentConfig;
import org.jiayunet.tool.UserSecurityTool;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.Instant;
/**
* 求职助手配置服务
* <p>主要功能:求职助手配置的查询和保存</p>
* <p>使用表:bg_job_agent_config(查询/新增/更新)</p>
*
* @author zk
*/
@Service
public class JobAgentConfigService {
@Autowired
private JobAgentConfigMapper configMapper;
/**
* 查询当前用户的求职助手配置
* <p>根据userId查询,不存在返回null</p>
*/
public JobAgentConfigDto getConfig() {
Long userId = UserSecurityTool.getUserId();
JobAgentConfig po = configMapper.selectOne(new LambdaQueryWrapper<JobAgentConfig>().eq(JobAgentConfig::getUserId, userId));
if (po == null) {
return null;
}
JobAgentConfigDto dto = new JobAgentConfigDto();
BeanUtils.copyProperties(po, dto);
return dto;
}
/**
* 保存/更新求职助手配置
* <p>先查询是否存在,存在则更新业务字段,不存在则新增(status默认0=未启用)</p>
*/
public void saveConfig(JobAgentConfigParam param) {
Long userId = UserSecurityTool.getUserId();
JobAgentConfig po = configMapper.selectOne(new LambdaQueryWrapper<JobAgentConfig>().eq(JobAgentConfig::getUserId, userId));
if (po == null) {
po = new JobAgentConfig();
po.setUserId(userId);
BeanUtils.copyProperties(param, po);
po.setStatus(0);
po.setCreateTime(Instant.now());
po.setUpdateTime(Instant.now());
configMapper.insert(po);
} else {
BeanUtils.copyProperties(param, po);
po.setUpdateTime(Instant.now());
configMapper.updateById(po);
}
}
}