岗位- AI问题业务逻辑完善
This commit is contained in:
@@ -0,0 +1,161 @@
|
||||
package com.vetti.hotake.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.vetti.common.core.service.BaseServiceImpl;
|
||||
import com.vetti.common.enums.FillTypeEnum;
|
||||
import com.vetti.hotake.domain.HotakeAiInterviewQuestionsInfo;
|
||||
import com.vetti.hotake.domain.dto.AiQuestionDto;
|
||||
import com.vetti.hotake.mapper.HotakeAiInterviewQuestionsInfoMapper;
|
||||
import com.vetti.hotake.service.IHotakeAiInterviewQuestionsInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* AI面试问题信息Service业务层处理
|
||||
*
|
||||
* @author wangxiangshun
|
||||
* @date 2025-12-14
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
@Service
|
||||
public class HotakeAiInterviewQuestionsInfoServiceImpl extends BaseServiceImpl implements IHotakeAiInterviewQuestionsInfoService
|
||||
{
|
||||
@Autowired
|
||||
private HotakeAiInterviewQuestionsInfoMapper hotakeAiInterviewQuestionsInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询AI面试问题信息
|
||||
*
|
||||
* @param id AI面试问题信息主键
|
||||
* @return AI面试问题信息
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
@Override
|
||||
public HotakeAiInterviewQuestionsInfo selectHotakeAiInterviewQuestionsInfoById(Long id)
|
||||
{
|
||||
HotakeAiInterviewQuestionsInfo questionsInfo = hotakeAiInterviewQuestionsInfoMapper.selectHotakeAiInterviewQuestionsInfoById(id);
|
||||
if(questionsInfo != null){
|
||||
Integer questionNum = 0;
|
||||
String times = "0";
|
||||
if(StrUtil.isNotEmpty(questionsInfo.getQuestionJson())){
|
||||
List<AiQuestionDto> aiQuestionList = JSONUtil.toList(questionsInfo.getQuestionJson(), AiQuestionDto.class);
|
||||
questionsInfo.setAiQuestionList(aiQuestionList);
|
||||
questionNum = aiQuestionList.size();
|
||||
times = String.valueOf(aiQuestionList.size() * 1.5);
|
||||
}
|
||||
questionsInfo.setQuestionNum(questionNum);
|
||||
questionsInfo.setTimes(times);
|
||||
}
|
||||
return questionsInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询AI面试问题信息列表
|
||||
*
|
||||
* @param hotakeAiInterviewQuestionsInfo AI面试问题信息
|
||||
* @return AI面试问题信息
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
@Override
|
||||
public List<HotakeAiInterviewQuestionsInfo> selectHotakeAiInterviewQuestionsInfoList(HotakeAiInterviewQuestionsInfo hotakeAiInterviewQuestionsInfo)
|
||||
{
|
||||
List<HotakeAiInterviewQuestionsInfo> questionsInfoList = hotakeAiInterviewQuestionsInfoMapper.selectHotakeAiInterviewQuestionsInfoList(hotakeAiInterviewQuestionsInfo);
|
||||
if(CollectionUtil.isNotEmpty(questionsInfoList)){
|
||||
for (HotakeAiInterviewQuestionsInfo questionsInfo : questionsInfoList) {
|
||||
if(questionsInfo != null){
|
||||
Integer questionNum = 0;
|
||||
String times = "0";
|
||||
if(StrUtil.isNotEmpty(questionsInfo.getQuestionJson())){
|
||||
List<AiQuestionDto> aiQuestionList = JSONUtil.toList(questionsInfo.getQuestionJson(), AiQuestionDto.class);
|
||||
questionsInfo.setAiQuestionList(aiQuestionList);
|
||||
questionNum = aiQuestionList.size();
|
||||
times = String.valueOf(aiQuestionList.size() * 1.5);
|
||||
}
|
||||
questionsInfo.setQuestionNum(questionNum);
|
||||
questionsInfo.setTimes(times);
|
||||
}
|
||||
}
|
||||
}
|
||||
return questionsInfoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增AI面试问题信息
|
||||
*
|
||||
* @param hotakeAiInterviewQuestionsInfo AI面试问题信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor=Exception.class)
|
||||
@Override
|
||||
public int insertHotakeAiInterviewQuestionsInfo(HotakeAiInterviewQuestionsInfo hotakeAiInterviewQuestionsInfo)
|
||||
{
|
||||
fill(FillTypeEnum.INSERT.getCode(), hotakeAiInterviewQuestionsInfo);
|
||||
if(CollectionUtil.isNotEmpty(hotakeAiInterviewQuestionsInfo.getAiQuestionList())){
|
||||
hotakeAiInterviewQuestionsInfo.setQuestionJson(JSONUtil.toJsonStr(hotakeAiInterviewQuestionsInfo.getAiQuestionList()));
|
||||
}else{
|
||||
hotakeAiInterviewQuestionsInfo.setQuestionJson("");
|
||||
}
|
||||
return hotakeAiInterviewQuestionsInfoMapper.insertHotakeAiInterviewQuestionsInfo(hotakeAiInterviewQuestionsInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改AI面试问题信息
|
||||
*
|
||||
* @param hotakeAiInterviewQuestionsInfo AI面试问题信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor=Exception.class)
|
||||
@Override
|
||||
public int updateHotakeAiInterviewQuestionsInfo(HotakeAiInterviewQuestionsInfo hotakeAiInterviewQuestionsInfo)
|
||||
{
|
||||
fill(FillTypeEnum.UPDATE.getCode(), hotakeAiInterviewQuestionsInfo);
|
||||
if(CollectionUtil.isNotEmpty(hotakeAiInterviewQuestionsInfo.getAiQuestionList())){
|
||||
hotakeAiInterviewQuestionsInfo.setQuestionJson(JSONUtil.toJsonStr(hotakeAiInterviewQuestionsInfo.getAiQuestionList()));
|
||||
}else{
|
||||
hotakeAiInterviewQuestionsInfo.setQuestionJson("");
|
||||
}
|
||||
return hotakeAiInterviewQuestionsInfoMapper.updateHotakeAiInterviewQuestionsInfo(hotakeAiInterviewQuestionsInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除AI面试问题信息
|
||||
*
|
||||
* @param ids 需要删除的AI面试问题信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor=Exception.class)
|
||||
@Override
|
||||
public int deleteHotakeAiInterviewQuestionsInfoByIds(Long[] ids)
|
||||
{
|
||||
return hotakeAiInterviewQuestionsInfoMapper.deleteHotakeAiInterviewQuestionsInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除AI面试问题信息信息
|
||||
*
|
||||
* @param id AI面试问题信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor=Exception.class)
|
||||
@Override
|
||||
public int deleteHotakeAiInterviewQuestionsInfoById(Long id)
|
||||
{
|
||||
return hotakeAiInterviewQuestionsInfoMapper.deleteHotakeAiInterviewQuestionsInfoById(id);
|
||||
}
|
||||
/**
|
||||
* 批量新增AI面试问题信息
|
||||
*
|
||||
* @param hotakeAiInterviewQuestionsInfoList AI面试问题信息列表
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor=Exception.class)
|
||||
@Override
|
||||
public int batchInsertHotakeAiInterviewQuestionsInfo(List<HotakeAiInterviewQuestionsInfo> hotakeAiInterviewQuestionsInfoList){
|
||||
return hotakeAiInterviewQuestionsInfoMapper.batchInsertHotakeAiInterviewQuestionsInfo(hotakeAiInterviewQuestionsInfoList);
|
||||
}
|
||||
}
|
||||
@@ -13,17 +13,21 @@ import com.vetti.common.utils.DateUtils;
|
||||
import com.vetti.common.utils.MessageUtils;
|
||||
import com.vetti.common.utils.SecurityUtils;
|
||||
import com.vetti.common.utils.uuid.IdUtils;
|
||||
import com.vetti.hotake.domain.HotakeAiInterviewQuestionsInfo;
|
||||
import com.vetti.hotake.domain.HotakeInitialScreeningQuestionsInfo;
|
||||
import com.vetti.hotake.domain.HotakeRolesInfo;
|
||||
import com.vetti.hotake.domain.dto.AiQuestionDto;
|
||||
import com.vetti.hotake.domain.dto.HotakeRolesInfoDto;
|
||||
import com.vetti.hotake.domain.dto.roleDto.*;
|
||||
import com.vetti.hotake.mapper.HotakeRolesInfoMapper;
|
||||
import com.vetti.hotake.service.IHotakeAiInterviewQuestionsInfoService;
|
||||
import com.vetti.hotake.service.IHotakeInitialScreeningQuestionsInfoService;
|
||||
import com.vetti.hotake.service.IHotakeRolesInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -42,6 +46,9 @@ public class HotakeRolesInfoServiceImpl extends BaseServiceImpl implements IHota
|
||||
@Autowired
|
||||
private IHotakeInitialScreeningQuestionsInfoService hotakeInitialScreeningQuestionsInfoService;
|
||||
|
||||
@Autowired
|
||||
private IHotakeAiInterviewQuestionsInfoService hotakeAiInterviewQuestionsInfoService;
|
||||
|
||||
/**
|
||||
* 查询岗位信息
|
||||
*
|
||||
@@ -106,6 +113,11 @@ public class HotakeRolesInfoServiceImpl extends BaseServiceImpl implements IHota
|
||||
queryQuestion.setRoleId(id);
|
||||
List<HotakeInitialScreeningQuestionsInfo> questionsInfoList = hotakeInitialScreeningQuestionsInfoService.selectHotakeInitialScreeningQuestionsInfoList(queryQuestion);
|
||||
dto.setInitialScreeningQuestionsInfoList(questionsInfoList);
|
||||
|
||||
HotakeAiInterviewQuestionsInfo queryAiQuestion = new HotakeAiInterviewQuestionsInfo();
|
||||
queryAiQuestion.setRoleId(id);
|
||||
List<HotakeAiInterviewQuestionsInfo> aiInterviewQuestionsInfoList = hotakeAiInterviewQuestionsInfoService.selectHotakeAiInterviewQuestionsInfoList(queryAiQuestion);
|
||||
dto.setAiInterviewQuestionsInfoList(aiInterviewQuestionsInfoList);
|
||||
}
|
||||
|
||||
return dto;
|
||||
@@ -273,6 +285,8 @@ public class HotakeRolesInfoServiceImpl extends BaseServiceImpl implements IHota
|
||||
}else{
|
||||
rolesInfo.setRoleBenefitsJson("");
|
||||
}
|
||||
//todo 暂时加在这里,完成第3步的时候,初始化第5步的内容
|
||||
createAiQuestion(rolesInfoId);
|
||||
}
|
||||
if(RoleOperStepsEnum.STEPS_4.getCode().equals(hotakeRolesInfo.getOperStep())){
|
||||
|
||||
@@ -306,4 +320,26 @@ public class HotakeRolesInfoServiceImpl extends BaseServiceImpl implements IHota
|
||||
HotakeRolesInfoDto rolesInfoDto = selectHotakeRolesInfoDtoById(rolesInfo.getId());
|
||||
return rolesInfoDto;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化AI面试问题-临时的
|
||||
* @param roleId 岗位ID
|
||||
*/
|
||||
private void createAiQuestion(Long roleId){
|
||||
HotakeAiInterviewQuestionsInfo questionsInfo = new HotakeAiInterviewQuestionsInfo();
|
||||
questionsInfo.setQuestionTitle("General Questions");
|
||||
questionsInfo.setFocusType("Personality & Culture");
|
||||
questionsInfo.setRoleId(roleId);
|
||||
questionsInfo.setRecruiterId(SecurityUtils.getUserId());
|
||||
questionsInfo.setOverview("This is General Questions Overview");
|
||||
|
||||
List<AiQuestionDto> questionDtoList = new ArrayList<>();
|
||||
AiQuestionDto questionDto = new AiQuestionDto();
|
||||
questionDto.setQuestions("Can you provide an example of a situation where you had to work in a physically demanding environment?,How do you plan to handle tasks that require specific construction knowledge or skills that you may not have yet?");
|
||||
questionDtoList.add(questionDto);
|
||||
questionsInfo.setAiQuestionList(questionDtoList);
|
||||
|
||||
hotakeAiInterviewQuestionsInfoService.insertHotakeAiInterviewQuestionsInfo(questionsInfo);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user