init
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
package com.newyetai.ai.interview.controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.newyetai.common.AlitaResult;
|
||||
import com.newyetai.common.util.JsonUtils;
|
||||
import com.newyetai.common.validation.Create;
|
||||
import com.newyetai.common.validation.Update;
|
||||
import com.newyetai.tkmybatis.pojo.Page;
|
||||
import com.newyetai.ai.interview.dto.*;
|
||||
import com.newyetai.ai.interview.service.InterviewRecordService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ai面试记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-11
|
||||
*/
|
||||
@Api(tags = "ai面试记录")
|
||||
@RestController
|
||||
@RequestMapping("/ai/interviewRecord")
|
||||
public class InterviewRecordController {
|
||||
|
||||
@Autowired
|
||||
private InterviewRecordService interviewRecordService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("ai面试记录-创建")
|
||||
public AlitaResult<InterviewRecordDTO> create(@RequestBody @Validated(value = Create.class) InterviewRecordOperatorDTO operatorDTO) {
|
||||
return AlitaResult.success(interviewRecordService.create(operatorDTO));
|
||||
}
|
||||
|
||||
@PutMapping("/modify")
|
||||
@ApiOperation("ai面试记录-修改")
|
||||
public AlitaResult<InterviewRecordDTO> modify(@RequestBody @Validated(value = Update.class) InterviewRecordOperatorDTO operatorDTO) {
|
||||
return AlitaResult.success(interviewRecordService.modify(operatorDTO));
|
||||
}
|
||||
|
||||
@DeleteMapping("{id}")
|
||||
@ApiOperation("ai面试记录-删除")
|
||||
public AlitaResult<InterviewRecordDTO> delete(@PathVariable("id") Long id) {
|
||||
return AlitaResult.success(interviewRecordService.delete(id));
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@ApiOperation("ai面试记录-查询单个")
|
||||
public AlitaResult<InterviewRecordDTO> findById(@PathVariable("id") Long id) {
|
||||
return AlitaResult.success(interviewRecordService.findById(id));
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
@ApiOperation("ai面试记录-列表查询")
|
||||
public AlitaResult<List<InterviewRecordDTO>> list(InterviewRecordQueryDTO queryDTO) {
|
||||
return AlitaResult.success(interviewRecordService.list(queryDTO));
|
||||
}
|
||||
|
||||
@GetMapping("page")
|
||||
@ApiOperation("ai面试记录-分页查询")
|
||||
public AlitaResult<Page<InterviewRecordDTO>> page(InterviewRecordPageQueryDTO queryDTO) {
|
||||
interviewRecordService.page(queryDTO);
|
||||
return AlitaResult.success(queryDTO.getPageResult());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.newyetai.ai.interview.convert;
|
||||
|
||||
import com.newyetai.ai.interview.entity.InterviewRecord;
|
||||
import com.newyetai.ai.interview.dto.InterviewRecordDTO;
|
||||
import com.newyetai.ai.interview.dto.InterviewRecordOperatorDTO;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ai面试记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-11
|
||||
*/
|
||||
@Mapper
|
||||
public interface InterviewRecordConvert {
|
||||
InterviewRecordConvert INSTANCE = Mappers.getMapper(InterviewRecordConvert.class);
|
||||
|
||||
InterviewRecord convert(InterviewRecordDTO dto);
|
||||
|
||||
InterviewRecordDTO convert(InterviewRecord entity);
|
||||
|
||||
InterviewRecord convert(InterviewRecordOperatorDTO dto);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.newyetai.ai.interview.dao;
|
||||
|
||||
import com.newyetai.tkmybatis.mybatis.MyMapper;
|
||||
import com.newyetai.ai.interview.entity.InterviewRecord;
|
||||
import com.newyetai.ai.interview.dto.InterviewRecordDTO;
|
||||
import com.newyetai.ai.interview.dto.InterviewRecordQueryDTO;
|
||||
import com.newyetai.ai.interview.dto.InterviewRecordPageQueryDTO;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ai面试记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-11
|
||||
*/
|
||||
@Mapper
|
||||
public interface InterviewRecordMapper extends MyMapper<InterviewRecord> {
|
||||
|
||||
List<InterviewRecordDTO> page(@Param("param") InterviewRecordPageQueryDTO queryDTO);
|
||||
|
||||
List<InterviewRecordDTO> list(@Param("param") InterviewRecordQueryDTO queryDTO);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.newyetai.ai.interview.dto;
|
||||
|
||||
import com.newyetai.common.dto.BaseDTO;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* ai面试记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-11
|
||||
*/
|
||||
@ApiModel("ai面试记录")
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class InterviewRecordDTO extends BaseDTO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("用户ID(xs_user)")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("模拟岗位名称")
|
||||
private String positionName;
|
||||
|
||||
@ApiModelProperty("面试状态(1.待开始、2.待继续、3.已完成)")
|
||||
private Integer state;
|
||||
|
||||
@ApiModelProperty("报告出具状态(1.未出具 2.已出具)")
|
||||
private Integer reportStatus;
|
||||
|
||||
private String jsonData;
|
||||
|
||||
@ApiModelProperty("节点")
|
||||
private Integer node;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.newyetai.ai.interview.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.newyetai.common.validation.Create;
|
||||
import com.newyetai.common.validation.Update;
|
||||
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* ai面试记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-11
|
||||
*/
|
||||
@ApiModel("ai面试记录")
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class InterviewRecordOperatorDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "id不能为空",groups = Update.class)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("用户ID(xs_user)")
|
||||
private Long userId;
|
||||
|
||||
|
||||
@Length(max = 32,message = "模拟岗位名称超长")
|
||||
@NotBlank(message = "模拟岗位名称不能为空",groups = {Create.class})
|
||||
@ApiModelProperty("模拟岗位名称")
|
||||
private String positionName;
|
||||
|
||||
@ApiModelProperty("面试状态(1.待开始、2.待继续、3.已完成)")
|
||||
private Integer state;
|
||||
|
||||
@ApiModelProperty("报告出具状态(1.未出具 2.已出具)")
|
||||
private Integer reportStatus;
|
||||
|
||||
@NotNull(message = "数据不能为空",groups = {Update.class})
|
||||
private String jsonData;
|
||||
|
||||
@NotNull(message = "节点不能为空",groups = {Update.class})
|
||||
@ApiModelProperty("节点")
|
||||
private Integer node;
|
||||
|
||||
//是否评分
|
||||
@Builder.Default
|
||||
private Boolean gradeInterview = Boolean.FALSE;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.newyetai.ai.interview.dto;
|
||||
|
||||
import com.newyetai.common.dto.PageQueryDTO;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* ai面试记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-11
|
||||
*/
|
||||
|
||||
@ApiModel("ai面试记录")
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class InterviewRecordPageQueryDTO extends PageQueryDTO<InterviewRecordDTO> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("用户ID(xs_user)")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("模拟岗位名称 (模糊匹配)")
|
||||
private String positionNameLike;
|
||||
|
||||
@ApiModelProperty("面试状态(1.待开始、2.待继续、3.已完成)")
|
||||
private Integer state;
|
||||
|
||||
@ApiModelProperty("报告出具状态(1.未出具 2.已出具)")
|
||||
private Integer reportStatus;
|
||||
|
||||
private String jsonData;
|
||||
|
||||
@ApiModelProperty("节点")
|
||||
private Integer node;
|
||||
|
||||
@ApiModelProperty("创建时间起,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTimeStart;
|
||||
|
||||
@ApiModelProperty("创建时间止,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTimeEnd;
|
||||
|
||||
@ApiModelProperty("修改时间起,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTimeStart;
|
||||
|
||||
@ApiModelProperty("修改时间止,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTimeEnd;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.newyetai.ai.interview.dto;
|
||||
|
||||
import com.newyetai.common.dto.BaseDTO;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* ai面试记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-11
|
||||
*/
|
||||
@ApiModel("ai面试记录")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class InterviewRecordQueryDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("用户ID(xs_user)")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("模拟岗位名称 (模糊匹配)")
|
||||
private String positionNameLike;
|
||||
|
||||
@ApiModelProperty("面试状态(1.待开始、2.待继续、3.已完成)")
|
||||
private Integer state;
|
||||
|
||||
@ApiModelProperty("报告出具状态(1.未出具 2.已出具)")
|
||||
private Integer reportStatus;
|
||||
|
||||
private String jsonData;
|
||||
|
||||
@ApiModelProperty("节点")
|
||||
private Integer node;
|
||||
|
||||
@ApiModelProperty("创建时间起,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTimeStart;
|
||||
|
||||
@ApiModelProperty("创建时间止,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTimeEnd;
|
||||
|
||||
@ApiModelProperty("修改时间起,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTimeStart;
|
||||
|
||||
@ApiModelProperty("修改时间止,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTimeEnd;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.newyetai.ai.interview.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.newyetai.common.entity.BaseEntity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* ai面试记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-11
|
||||
*/
|
||||
@TableName(value = "ai_interview_record")
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class InterviewRecord extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID(xs_user)
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 模拟岗位名称
|
||||
*/
|
||||
private String positionName;
|
||||
/**
|
||||
* 面试状态(1.待开始、2.待继续、3.已完成)
|
||||
*/
|
||||
private Integer state;
|
||||
/**
|
||||
* 报告出具状态(1.未出具 2.已出具)
|
||||
*/
|
||||
private Integer reportStatus;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String jsonData;
|
||||
/**
|
||||
* 节点
|
||||
*/
|
||||
private Integer node;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.newyetai.ai.interview.enums;
|
||||
/**
|
||||
* @description: 面试状态
|
||||
* @return:
|
||||
* @author: guixinman
|
||||
* @param:
|
||||
*/
|
||||
public enum InterviewRecordEnum {
|
||||
INIT(1,"待开始"),
|
||||
TO_BE_CONTINUED(2,"待继续"),
|
||||
SUCCESS(3,"已完成"),
|
||||
;
|
||||
|
||||
private Integer status;
|
||||
/**
|
||||
* 类型描述
|
||||
*/
|
||||
private String desc;
|
||||
|
||||
|
||||
InterviewRecordEnum(Integer status, String desc) {
|
||||
this.status = status;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.newyetai.ai.interview.enums;
|
||||
|
||||
/**
|
||||
* @description: 报告出具状态
|
||||
* @return:
|
||||
* @author: guixinman
|
||||
* @param:
|
||||
*/
|
||||
public enum InterviewRecordReportStatusEnum {
|
||||
INIT(1,"未出具"),
|
||||
SUCCESS(2,"已出具"),
|
||||
;
|
||||
|
||||
private Integer status;
|
||||
/**
|
||||
* 类型描述
|
||||
*/
|
||||
private String desc;
|
||||
|
||||
|
||||
InterviewRecordReportStatusEnum(Integer status, String desc) {
|
||||
this.status = status;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.newyetai.ai.interview.dao.InterviewRecordMapper">
|
||||
|
||||
<select id="list" resultType="com.newyetai.ai.interview.dto.InterviewRecordDTO">
|
||||
SELECT t.*
|
||||
<include refid="queryFromSql"></include>
|
||||
</select>
|
||||
|
||||
<select id="page" resultType="com.newyetai.ai.interview.dto.InterviewRecordDTO">
|
||||
SELECT t.*
|
||||
<include refid="queryFromSql"></include>
|
||||
</select>
|
||||
|
||||
<sql id="queryFromSql">
|
||||
FROM
|
||||
ai_interview_record t
|
||||
WHERE t.deleted = 0
|
||||
<if test='param.id != null'>
|
||||
AND t.id = #{param.id}
|
||||
</if>
|
||||
<if test='param.userId != null'>
|
||||
AND t.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test='param.positionNameLike != null and param.positionNameLike.trim() != ""'>
|
||||
<bind name="positionNameLike" value="'%' + param.positionNameLike + '%'"/>
|
||||
AND t.position_name like #{positionNameLike}
|
||||
</if>
|
||||
<if test='param.state != null'>
|
||||
AND t.state = #{param.state}
|
||||
</if>
|
||||
<if test='param.reportStatus != null'>
|
||||
AND t.report_status = #{param.reportStatus}
|
||||
</if>
|
||||
<if test='param.jsonData != null and param.jsonData.trim() != ""'>
|
||||
AND t.json_data = #{param.jsonData}
|
||||
</if>
|
||||
<if test='param.node != null'>
|
||||
AND t.node = #{param.node}
|
||||
</if>
|
||||
<if test='param.createTimeStart != null'>
|
||||
AND t.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test='param.createTimeEnd != null'>
|
||||
AND t.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test='param.updateTimeStart != null'>
|
||||
AND t.update_time >= #{param.updateTimeStart}
|
||||
</if>
|
||||
<if test='param.updateTimeEnd != null'>
|
||||
AND t.update_time <= #{param.updateTimeEnd}
|
||||
</if>
|
||||
ORDER BY t.id DESC
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.newyetai.ai.interview.service;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.newyetai.ai.interview.dto.*;
|
||||
|
||||
/**
|
||||
* ai面试记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-11
|
||||
*/
|
||||
@Validated(Default.class)
|
||||
public interface InterviewRecordService {
|
||||
|
||||
/**
|
||||
* ai面试记录 - 创建
|
||||
*
|
||||
* @param operatorDto 操作dto
|
||||
* @return {@link InterviewRecordDTO}
|
||||
*/
|
||||
InterviewRecordDTO create(@Valid InterviewRecordOperatorDTO operatorDto);
|
||||
|
||||
/**
|
||||
* ai面试记录 - 修改
|
||||
*
|
||||
* @param operatorDto 操作dto
|
||||
* @return {@link InterviewRecordDTO}
|
||||
*/
|
||||
InterviewRecordDTO modify(@Valid InterviewRecordOperatorDTO operatorDto);
|
||||
|
||||
/**
|
||||
* ai面试记录 - 删除
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link InterviewRecordDTO}
|
||||
*/
|
||||
InterviewRecordDTO delete(Long id);
|
||||
|
||||
/**
|
||||
* ai面试记录 - 根据ID查询单个
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link InterviewRecordDTO}
|
||||
*/
|
||||
InterviewRecordDTO findById(Long id);
|
||||
|
||||
/**
|
||||
* ai面试记录 - 列表查询
|
||||
*
|
||||
* @param queryDTO 列表查询dto
|
||||
* @return {@link List}<{@link InterviewRecordDTO}>
|
||||
*/
|
||||
List<InterviewRecordDTO> list(InterviewRecordQueryDTO queryDTO);
|
||||
|
||||
/**
|
||||
* ai面试记录 - 分页查询
|
||||
*
|
||||
* @param queryDTO 分页查询dto
|
||||
* @return {@link InterviewRecordDTO}
|
||||
*/
|
||||
List<InterviewRecordDTO> page(InterviewRecordPageQueryDTO queryDTO);
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.newyetai.ai.interview.service.impl;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import com.newyetai.ai.interview.convert.InterviewRecordConvert;
|
||||
import com.newyetai.ai.interview.entity.InterviewRecord;
|
||||
import com.newyetai.ai.interview.dto.*;
|
||||
import com.newyetai.ai.interview.dao.InterviewRecordMapper;
|
||||
import com.newyetai.ai.interview.enums.InterviewRecordEnum;
|
||||
import com.newyetai.ai.interview.enums.InterviewRecordReportStatusEnum;
|
||||
import com.newyetai.ai.interview.service.InterviewRecordService;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.newyetai.common.exception.BusinessException;
|
||||
import com.newyetai.common.util.JsonUtils;
|
||||
import com.newyetai.common.util.UserContextHolder;
|
||||
import com.newyetai.sdk.xf.dto.InterviewContentDTO;
|
||||
import com.newyetai.sdk.xf.util.XfUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* ai面试记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-11
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class InterviewRecordServiceImpl implements InterviewRecordService {
|
||||
|
||||
@Resource
|
||||
private InterviewRecordMapper interviewRecordMapper;
|
||||
|
||||
@Override
|
||||
public InterviewRecordDTO create(InterviewRecordOperatorDTO operatorDto) {
|
||||
InterviewRecord interviewRecord = InterviewRecordConvert.INSTANCE.convert(operatorDto);
|
||||
interviewRecord.setUserId(UserContextHolder.getExistLoginUserId());
|
||||
interviewRecord.setNode(1);
|
||||
interviewRecord.setState(InterviewRecordEnum.INIT.getStatus());
|
||||
interviewRecord.setReportStatus(InterviewRecordReportStatusEnum.INIT.getStatus());
|
||||
|
||||
String data = XfUtils.generateInterviewQuestion(InterviewContentDTO.builder().positionName(operatorDto.getPositionName()).build());
|
||||
interviewRecord.setJsonData(data);
|
||||
interviewRecordMapper.saveEntity(interviewRecord);
|
||||
return InterviewRecordConvert.INSTANCE.convert(interviewRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterviewRecordDTO modify(InterviewRecordOperatorDTO operatorDto) {
|
||||
InterviewRecordDTO interviewRecordDto = this.findById(operatorDto.getId());
|
||||
if (Objects.isNull(interviewRecordDto)) {
|
||||
return null;
|
||||
}
|
||||
InterviewRecord interviewRecord = InterviewRecordConvert.INSTANCE.convert(operatorDto);
|
||||
|
||||
String jsonData = interviewRecord.getJsonData();
|
||||
InterviewContentDTO interviewContentDTO = JsonUtils.toObject(jsonData, InterviewContentDTO.class);
|
||||
|
||||
if (Boolean.TRUE.equals(operatorDto.getGradeInterview())) {
|
||||
String jsonDataNew = XfUtils.gradeInterview(interviewContentDTO);
|
||||
interviewRecord.setReportStatus(InterviewRecordReportStatusEnum.SUCCESS.getStatus());
|
||||
interviewRecord.setJsonData(jsonDataNew);
|
||||
interviewRecord.setState(InterviewRecordEnum.SUCCESS.getStatus());
|
||||
}else {
|
||||
interviewRecord.setState(InterviewRecordEnum.TO_BE_CONTINUED.getStatus());
|
||||
}
|
||||
interviewRecordMapper.updateEntitySelective(interviewRecord);
|
||||
|
||||
return this.findById(operatorDto.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterviewRecordDTO delete(Long id) {
|
||||
InterviewRecordDTO interviewRecordDto = this.findById(id);
|
||||
if (Objects.isNull(interviewRecordDto)) {
|
||||
return null;
|
||||
}
|
||||
InterviewRecord interviewRecord = InterviewRecord.builder().build();
|
||||
interviewRecord.setId(id);
|
||||
interviewRecordMapper.deleteEntity(interviewRecord, UserContextHolder.getLoginUserId());
|
||||
return interviewRecordDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterviewRecordDTO findById(Long id) {
|
||||
InterviewRecord interviewRecord = interviewRecordMapper.getById(id);
|
||||
if (Objects.isNull(interviewRecord)) {
|
||||
return null;
|
||||
}
|
||||
return InterviewRecordConvert.INSTANCE.convert(interviewRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InterviewRecordDTO> list(InterviewRecordQueryDTO queryDTO) {
|
||||
return interviewRecordMapper.list(queryDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InterviewRecordDTO> page(InterviewRecordPageQueryDTO queryDTO) {
|
||||
queryDTO.setUserId(UserContextHolder.getExistLoginUserId());
|
||||
return interviewRecordMapper.page(queryDTO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.newyetai.ai.mbti.controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import com.newyetai.common.AlitaResult;
|
||||
import com.newyetai.common.validation.Create;
|
||||
import com.newyetai.common.validation.Update;
|
||||
import com.newyetai.tkmybatis.pojo.Page;
|
||||
import com.newyetai.ai.mbti.dto.*;
|
||||
import com.newyetai.ai.mbti.service.MbtiRecordService;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* AI测评记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-20
|
||||
*/
|
||||
@Api(tags = "AI测评记录")
|
||||
@RestController
|
||||
@RequestMapping("/ai/mbtiRecord")
|
||||
public class MbtiRecordController {
|
||||
|
||||
@Autowired
|
||||
private MbtiRecordService mbtiRecordService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("AI测评记录-创建")
|
||||
public AlitaResult<MbtiRecordDTO> create(@RequestBody @Validated(value = Create.class) MbtiRecordOperatorDTO operatorDTO) {
|
||||
return AlitaResult.success(mbtiRecordService.create(operatorDTO));
|
||||
}
|
||||
|
||||
@PutMapping("/modify")
|
||||
@ApiOperation("AI测评记录-修改")
|
||||
public AlitaResult<MbtiRecordDTO> modify(@RequestBody @Validated(value = Update.class) MbtiRecordOperatorDTO operatorDTO) {
|
||||
return AlitaResult.success(mbtiRecordService.modify(operatorDTO));
|
||||
}
|
||||
|
||||
@ApiOperation("AI测评记录-出具报告")
|
||||
@PostMapping("/report")
|
||||
public AlitaResult<Void> report(@RequestParam("id") Long id){
|
||||
mbtiRecordService.report(id);
|
||||
return AlitaResult.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("{id}")
|
||||
@ApiOperation("AI测评记录-删除")
|
||||
public AlitaResult<MbtiRecordDTO> delete(@PathVariable("id") Long id) {
|
||||
return AlitaResult.success(mbtiRecordService.delete(id));
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@ApiOperation("AI测评记录-查询单个")
|
||||
public AlitaResult<MbtiRecordDTO> findById(@PathVariable("id") Long id) {
|
||||
return AlitaResult.success(mbtiRecordService.findById(id));
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
@ApiOperation("AI测评记录-列表查询")
|
||||
public AlitaResult<List<MbtiRecordDTO>> list(MbtiRecordQueryDTO queryDTO) {
|
||||
return AlitaResult.success(mbtiRecordService.list(queryDTO));
|
||||
}
|
||||
|
||||
@GetMapping("page")
|
||||
@ApiOperation("AI测评记录-分页查询")
|
||||
public AlitaResult<Page<MbtiRecordDTO>> page(MbtiRecordPageQueryDTO queryDTO) {
|
||||
mbtiRecordService.page(queryDTO);
|
||||
return AlitaResult.success(queryDTO.getPageResult());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.newyetai.ai.mbti.convert;
|
||||
|
||||
import com.newyetai.ai.mbti.entity.MbtiRecord;
|
||||
import com.newyetai.ai.mbti.dto.MbtiRecordDTO;
|
||||
import com.newyetai.ai.mbti.dto.MbtiRecordOperatorDTO;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* AI测评记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-20
|
||||
*/
|
||||
@Mapper
|
||||
public interface MbtiRecordConvert {
|
||||
MbtiRecordConvert INSTANCE = Mappers.getMapper(MbtiRecordConvert.class);
|
||||
|
||||
MbtiRecord convert(MbtiRecordDTO dto);
|
||||
|
||||
MbtiRecordDTO convert(MbtiRecord entity);
|
||||
|
||||
MbtiRecord convert(MbtiRecordOperatorDTO dto);
|
||||
|
||||
}
|
||||
26
src/main/java/com/newyetai/ai/mbti/dao/MbtiRecordMapper.java
Normal file
26
src/main/java/com/newyetai/ai/mbti/dao/MbtiRecordMapper.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.newyetai.ai.mbti.dao;
|
||||
|
||||
import com.newyetai.tkmybatis.mybatis.MyMapper;
|
||||
import com.newyetai.ai.mbti.entity.MbtiRecord;
|
||||
import com.newyetai.ai.mbti.dto.MbtiRecordDTO;
|
||||
import com.newyetai.ai.mbti.dto.MbtiRecordQueryDTO;
|
||||
import com.newyetai.ai.mbti.dto.MbtiRecordPageQueryDTO;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* AI测评记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-20
|
||||
*/
|
||||
@Mapper
|
||||
public interface MbtiRecordMapper extends MyMapper<MbtiRecord> {
|
||||
|
||||
List<MbtiRecordDTO> page(@Param("param") MbtiRecordPageQueryDTO queryDTO);
|
||||
|
||||
List<MbtiRecordDTO> list(@Param("param") MbtiRecordQueryDTO queryDTO);
|
||||
}
|
||||
51
src/main/java/com/newyetai/ai/mbti/dto/MbtiRecordDTO.java
Normal file
51
src/main/java/com/newyetai/ai/mbti/dto/MbtiRecordDTO.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package com.newyetai.ai.mbti.dto;
|
||||
|
||||
import com.newyetai.common.dto.BaseDTO;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* AI测评记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-20
|
||||
*/
|
||||
@ApiModel("AI测评记录")
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MbtiRecordDTO extends BaseDTO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String liangBiaoId;
|
||||
|
||||
@ApiModelProperty("节点")
|
||||
private Integer node;
|
||||
|
||||
private String jsonData;
|
||||
|
||||
private String orderId;
|
||||
|
||||
@ApiModelProperty("状态(1.待开始、2.待继续、3.已完成)")
|
||||
private Integer state;
|
||||
|
||||
@ApiModelProperty("报告出具状态(1.未出具 2.已出具)")
|
||||
private Integer reportStatus;
|
||||
|
||||
private String content;
|
||||
|
||||
private String reportId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String phone;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.newyetai.ai.mbti.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.newyetai.common.validation.Create;
|
||||
import com.newyetai.common.validation.Update;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* AI测评记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-20
|
||||
*/
|
||||
@ApiModel("AI测评记录")
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MbtiRecordOperatorDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "id不能为空",groups = Update.class)
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
@NotBlank(message = "liangBiaoId不能为空",groups = {Create.class, Update.class})
|
||||
private String liangBiaoId;
|
||||
|
||||
@NotNull(message = "节点不能为空",groups = {Update.class})
|
||||
@ApiModelProperty("节点")
|
||||
private Integer node;
|
||||
|
||||
@NotNull(message = "数据不能为空",groups = {Update.class})
|
||||
private Map<String, String> answers;
|
||||
|
||||
private String orderId;
|
||||
|
||||
@ApiModelProperty("状态(2.待继续、3.已完成)")
|
||||
private Integer state;
|
||||
|
||||
@ApiModelProperty("报告出具状态(1.未出具 2.已出具)")
|
||||
private Integer reportStatus;
|
||||
|
||||
|
||||
@Builder.Default
|
||||
private Boolean submit = Boolean.FALSE;
|
||||
|
||||
private String content;
|
||||
|
||||
private String reportId;
|
||||
|
||||
@NotBlank(message = "name不能为空",groups = {Create.class, Update.class})
|
||||
private String name;
|
||||
|
||||
@NotBlank(message = "phone不能为空",groups = {Create.class, Update.class})
|
||||
private String phone;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.newyetai.ai.mbti.dto;
|
||||
|
||||
import com.newyetai.common.dto.PageQueryDTO;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* AI测评记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-20
|
||||
*/
|
||||
|
||||
@ApiModel("AI测评记录")
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MbtiRecordPageQueryDTO extends PageQueryDTO<MbtiRecordDTO> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String liangBiaoId;
|
||||
|
||||
@ApiModelProperty("节点")
|
||||
private Integer node;
|
||||
|
||||
private String jsonData;
|
||||
|
||||
private String orderId;
|
||||
|
||||
@ApiModelProperty("状态(1.待开始、2.待继续、3.已完成)")
|
||||
private Integer state;
|
||||
|
||||
@ApiModelProperty("报告出具状态(1.未出具 2.已出具)")
|
||||
private Integer reportStatus;
|
||||
|
||||
@ApiModelProperty("创建时间起,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTimeStart;
|
||||
|
||||
@ApiModelProperty("创建时间止,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTimeEnd;
|
||||
|
||||
@ApiModelProperty("更新时间起,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTimeStart;
|
||||
|
||||
@ApiModelProperty("更新时间止,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTimeEnd;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.newyetai.ai.mbti.dto;
|
||||
|
||||
import com.newyetai.common.dto.BaseDTO;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* AI测评记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-20
|
||||
*/
|
||||
@ApiModel("AI测评记录")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class MbtiRecordQueryDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String liangBiaoId;
|
||||
|
||||
@ApiModelProperty("节点")
|
||||
private Integer node;
|
||||
|
||||
private String jsonData;
|
||||
|
||||
private String orderId;
|
||||
|
||||
@ApiModelProperty("状态(1.待开始、2.待继续、3.已完成)")
|
||||
private Integer state;
|
||||
|
||||
@ApiModelProperty("报告出具状态(1.未出具 2.已出具)")
|
||||
private Integer reportStatus;
|
||||
|
||||
@ApiModelProperty("创建时间起,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTimeStart;
|
||||
|
||||
@ApiModelProperty("创建时间止,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTimeEnd;
|
||||
|
||||
@ApiModelProperty("更新时间起,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTimeStart;
|
||||
|
||||
@ApiModelProperty("更新时间止,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTimeEnd;
|
||||
|
||||
|
||||
}
|
||||
63
src/main/java/com/newyetai/ai/mbti/entity/MbtiRecord.java
Normal file
63
src/main/java/com/newyetai/ai/mbti/entity/MbtiRecord.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.newyetai.ai.mbti.entity;
|
||||
|
||||
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.newyetai.common.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* AI测评记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-20
|
||||
*/
|
||||
@TableName(value = "ai_mbti_record")
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MbtiRecord extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String liangBiaoId;
|
||||
/**
|
||||
* 节点
|
||||
*/
|
||||
private Integer node;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String jsonData;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String orderId;
|
||||
|
||||
/**
|
||||
* 状态(1.待开始、2.待继续、3.已完成)
|
||||
*/
|
||||
private Integer state;
|
||||
/**
|
||||
* 报告出具状态(1.未出具 2.已出具)
|
||||
*/
|
||||
private Integer reportStatus;
|
||||
|
||||
private String content;
|
||||
|
||||
private String reportId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String phone;
|
||||
}
|
||||
32
src/main/java/com/newyetai/ai/mbti/enums/MbtiRecordEnum.java
Normal file
32
src/main/java/com/newyetai/ai/mbti/enums/MbtiRecordEnum.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.newyetai.ai.mbti.enums;
|
||||
/**
|
||||
* @description: 状态
|
||||
* @return:
|
||||
* @author: guixinman
|
||||
* @param:
|
||||
*/
|
||||
public enum MbtiRecordEnum {
|
||||
TO_BE_CONTINUED(2,"待继续"),
|
||||
SUCCESS(3,"已完成"),
|
||||
;
|
||||
|
||||
private Integer status;
|
||||
/**
|
||||
* 类型描述
|
||||
*/
|
||||
private String desc;
|
||||
|
||||
|
||||
MbtiRecordEnum(Integer status, String desc) {
|
||||
this.status = status;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.newyetai.ai.mbti.enums;
|
||||
|
||||
/**
|
||||
* @description: 报告出具状态
|
||||
* @return:
|
||||
* @author: guixinman
|
||||
* @param:
|
||||
*/
|
||||
public enum MbtiRecordReportStatusEnum {
|
||||
INIT(1,"未出具"),
|
||||
SUCCESS(2,"已出具"),
|
||||
;
|
||||
|
||||
private Integer status;
|
||||
/**
|
||||
* 类型描述
|
||||
*/
|
||||
private String desc;
|
||||
|
||||
|
||||
MbtiRecordReportStatusEnum(Integer status, String desc) {
|
||||
this.status = status;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.newyetai.ai.mbti.dao.MbtiRecordMapper">
|
||||
|
||||
<select id="list" resultType="com.newyetai.ai.mbti.dto.MbtiRecordDTO">
|
||||
SELECT t.*
|
||||
<include refid="queryFromSql"></include>
|
||||
</select>
|
||||
|
||||
<select id="page" resultType="com.newyetai.ai.mbti.dto.MbtiRecordDTO">
|
||||
SELECT t.*
|
||||
<include refid="queryFromSql"></include>
|
||||
</select>
|
||||
|
||||
<sql id="queryFromSql">
|
||||
FROM
|
||||
ai_mbti_record t
|
||||
WHERE t.deleted = 0
|
||||
<if test='param.id != null'>
|
||||
AND t.id = #{param.id}
|
||||
</if>
|
||||
<if test='param.userId != null'>
|
||||
AND t.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test='param.liangBiaoId != null and param.liangBiaoId.trim() != ""'>
|
||||
AND t.liang_biao_id = #{param.liangBiaoId}
|
||||
</if>
|
||||
<if test='param.node != null'>
|
||||
AND t.node = #{param.node}
|
||||
</if>
|
||||
<if test='param.jsonData != null and param.jsonData.trim() != ""'>
|
||||
AND t.json_data = #{param.jsonData}
|
||||
</if>
|
||||
<if test='param.orderId != null'>
|
||||
AND t.order_id = #{param.orderId}
|
||||
</if>
|
||||
<if test='param.state != null'>
|
||||
AND t.state = #{param.state}
|
||||
</if>
|
||||
<if test='param.reportStatus != null'>
|
||||
AND t.report_status = #{param.reportStatus}
|
||||
</if>
|
||||
<if test='param.createTimeStart != null'>
|
||||
AND t.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test='param.createTimeEnd != null'>
|
||||
AND t.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test='param.updateTimeStart != null'>
|
||||
AND t.update_time >= #{param.updateTimeStart}
|
||||
</if>
|
||||
<if test='param.updateTimeEnd != null'>
|
||||
AND t.update_time <= #{param.updateTimeEnd}
|
||||
</if>
|
||||
ORDER BY t.id DESC
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.newyetai.ai.mbti.service;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.newyetai.ai.mbti.dto.*;
|
||||
|
||||
/**
|
||||
* AI测评记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-20
|
||||
*/
|
||||
@Validated(Default.class)
|
||||
public interface MbtiRecordService {
|
||||
|
||||
/**
|
||||
* AI测评记录 - 创建
|
||||
*
|
||||
* @param operatorDto 操作dto
|
||||
* @return {@link MbtiRecordDTO}
|
||||
*/
|
||||
MbtiRecordDTO create(@Valid MbtiRecordOperatorDTO operatorDto);
|
||||
|
||||
/**
|
||||
* AI测评记录 - 修改
|
||||
*
|
||||
* @param operatorDto 操作dto
|
||||
* @return {@link MbtiRecordDTO}
|
||||
*/
|
||||
MbtiRecordDTO modify(@Valid MbtiRecordOperatorDTO operatorDto);
|
||||
|
||||
/**
|
||||
* @description: 出具报告
|
||||
* @return:
|
||||
* @author: guixinman
|
||||
* @param:
|
||||
*/
|
||||
void report(Long id);
|
||||
|
||||
/**
|
||||
* AI测评记录 - 删除
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link MbtiRecordDTO}
|
||||
*/
|
||||
MbtiRecordDTO delete(Long id);
|
||||
|
||||
/**
|
||||
* AI测评记录 - 根据ID查询单个
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link MbtiRecordDTO}
|
||||
*/
|
||||
MbtiRecordDTO findById(Long id);
|
||||
|
||||
/**
|
||||
* AI测评记录 - 列表查询
|
||||
*
|
||||
* @param queryDTO 列表查询dto
|
||||
* @return {@link List}<{@link MbtiRecordDTO}>
|
||||
*/
|
||||
List<MbtiRecordDTO> list(MbtiRecordQueryDTO queryDTO);
|
||||
|
||||
/**
|
||||
* AI测评记录 - 分页查询
|
||||
*
|
||||
* @param queryDTO 分页查询dto
|
||||
* @return {@link MbtiRecordDTO}
|
||||
*/
|
||||
List<MbtiRecordDTO> page(MbtiRecordPageQueryDTO queryDTO);
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package com.newyetai.ai.mbti.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import com.newyetai.ai.interview.enums.InterviewRecordEnum;
|
||||
import com.newyetai.ai.interview.enums.InterviewRecordReportStatusEnum;
|
||||
import com.newyetai.ai.mbti.convert.MbtiRecordConvert;
|
||||
import com.newyetai.ai.mbti.entity.MbtiRecord;
|
||||
import com.newyetai.ai.mbti.dto.*;
|
||||
import com.newyetai.ai.mbti.dao.MbtiRecordMapper;
|
||||
import com.newyetai.ai.mbti.enums.MbtiRecordEnum;
|
||||
import com.newyetai.ai.mbti.enums.MbtiRecordReportStatusEnum;
|
||||
import com.newyetai.ai.mbti.service.MbtiRecordService;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.newyetai.common.AlitaResult;
|
||||
import com.newyetai.common.exception.BusinessException;
|
||||
import com.newyetai.common.exception.util.Assert;
|
||||
import com.newyetai.common.sensitive.SensitiveInfoUtils;
|
||||
import com.newyetai.common.util.JsonUtils;
|
||||
import com.newyetai.common.util.RandomUtils;
|
||||
import com.newyetai.common.util.UserContextHolder;
|
||||
import com.newyetai.sdk.mbti.mobel.AnswerReq;
|
||||
import com.newyetai.sdk.mbti.mobel.AnswerReqDTO;
|
||||
import com.newyetai.sdk.mbti.mobel.AnswerRes;
|
||||
import com.newyetai.sdk.mbti.mobel.OrderQueryReq;
|
||||
import com.newyetai.sdk.mbti.mobel.OrderQueryRes;
|
||||
import com.newyetai.sdk.mbti.mobel.ReportReq;
|
||||
import com.newyetai.sdk.mbti.mobel.ReportRes;
|
||||
import com.newyetai.sdk.mbti.service.MbtiProvider;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* AI测评记录
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-12-20
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MbtiRecordServiceImpl implements MbtiRecordService {
|
||||
|
||||
@Resource
|
||||
private MbtiRecordMapper mbtiRecordMapper;
|
||||
|
||||
@Autowired
|
||||
private MbtiProvider mbtiProvider;
|
||||
|
||||
@Override
|
||||
public MbtiRecordDTO create(MbtiRecordOperatorDTO operatorDto) {
|
||||
MbtiRecord mbtiRecord = MbtiRecordConvert.INSTANCE.convert(operatorDto);
|
||||
mbtiRecord.setUserId(UserContextHolder.getExistLoginUserId());
|
||||
mbtiRecord.setState(MbtiRecordEnum.TO_BE_CONTINUED.getStatus());
|
||||
mbtiRecord.setReportStatus(MbtiRecordReportStatusEnum.INIT.getStatus());
|
||||
mbtiRecord.setJsonData(JsonUtils.toJsonString(operatorDto.getAnswers()));
|
||||
mbtiRecord.setName(operatorDto.getName());
|
||||
mbtiRecord.setPhone(operatorDto.getPhone());
|
||||
|
||||
if (operatorDto.getSubmit()) {
|
||||
if (Objects.isNull(operatorDto.getAnswers())) {
|
||||
throw new BusinessException("answers不能为空");
|
||||
}
|
||||
AnswerReq answerReq = new AnswerReq();
|
||||
AnswerReqDTO answerData = AnswerReqDTO.builder()
|
||||
.Answers(operatorDto.getAnswers())
|
||||
.test_name(SensitiveInfoUtils.mobilePhone2(operatorDto.getPhone()) + RandomUtils.getRandomString(5))
|
||||
.test_email(RandomUtils.getRandomString(5))
|
||||
.build();
|
||||
answerReq.setLiangbiaoId(operatorDto.getLiangBiaoId());
|
||||
answerReq.setAnswerData(answerData);
|
||||
AlitaResult<AnswerRes> answerResAlitaResult = mbtiProvider.http(answerReq);
|
||||
Assert.isTrue(answerResAlitaResult.getSuccess(),answerResAlitaResult.getMsg());
|
||||
AnswerRes answerRes = answerResAlitaResult.getData();
|
||||
mbtiRecord.setOrderId(answerRes.getOrderId());
|
||||
mbtiRecord.setState(MbtiRecordEnum.SUCCESS.getStatus());
|
||||
}
|
||||
mbtiRecordMapper.saveEntity(mbtiRecord);
|
||||
return MbtiRecordConvert.INSTANCE.convert(mbtiRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MbtiRecordDTO modify(MbtiRecordOperatorDTO operatorDto) {
|
||||
MbtiRecordDTO mbtiRecordDto = this.findById(operatorDto.getId());
|
||||
if (Objects.isNull(mbtiRecordDto)) {
|
||||
return null;
|
||||
}
|
||||
MbtiRecord mbtiRecord = MbtiRecordConvert.INSTANCE.convert(operatorDto);
|
||||
mbtiRecord.setJsonData(JsonUtils.toJsonString(operatorDto.getAnswers()));
|
||||
mbtiRecord.setName(operatorDto.getName());
|
||||
mbtiRecord.setPhone(operatorDto.getPhone());
|
||||
if (operatorDto.getSubmit()) {
|
||||
AnswerReq answerReq = new AnswerReq();
|
||||
answerReq.setLiangbiaoId(operatorDto.getLiangBiaoId());
|
||||
answerReq.setAnswerData(AnswerReqDTO.builder()
|
||||
.Answers(operatorDto.getAnswers())
|
||||
.test_name(SensitiveInfoUtils.mobilePhone2(operatorDto.getPhone()) + RandomUtils.getRandomString(5))
|
||||
.test_email(RandomUtils.getRandomString(5))
|
||||
.build());
|
||||
AlitaResult<AnswerRes> answerResAlitaResult = mbtiProvider.http(answerReq);
|
||||
Assert.isTrue(answerResAlitaResult.getSuccess(),answerResAlitaResult.getMsg());
|
||||
AnswerRes answerRes = answerResAlitaResult.getData();
|
||||
mbtiRecord.setOrderId(answerRes.getOrderId());
|
||||
mbtiRecord.setState(MbtiRecordEnum.SUCCESS.getStatus());
|
||||
}
|
||||
mbtiRecordMapper.updateEntitySelective(mbtiRecord);
|
||||
return this.findById(operatorDto.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void report(Long id) {
|
||||
MbtiRecordDTO mbtiRecordDto = this.findById(id);
|
||||
if (Objects.isNull(mbtiRecordDto)) {
|
||||
return;
|
||||
}
|
||||
AlitaResult<OrderQueryRes> queryRes = mbtiProvider.http(OrderQueryReq.builder().liangbiaoId(mbtiRecordDto.getLiangBiaoId()).orderId(mbtiRecordDto.getOrderId()).build());
|
||||
Assert.isTrue(queryRes.getSuccess(),queryRes.getMsg());
|
||||
|
||||
AlitaResult<ReportRes> reportRes = mbtiProvider.http(ReportReq.builder().liangbiaoId(mbtiRecordDto.getLiangBiaoId()).reportId(queryRes.getData().getReportId()).build());
|
||||
Assert.isTrue(reportRes.getSuccess(),reportRes.getMsg());
|
||||
|
||||
MbtiRecord mbtiRecord = MbtiRecordConvert.INSTANCE.convert(mbtiRecordDto);
|
||||
mbtiRecord.setReportId(queryRes.getData().getReportId());
|
||||
mbtiRecord.setReportStatus(MbtiRecordReportStatusEnum.SUCCESS.getStatus());
|
||||
mbtiRecord.setContent(reportRes.getData().getContent());
|
||||
mbtiRecordMapper.updateEntitySelective(mbtiRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MbtiRecordDTO delete(Long id) {
|
||||
MbtiRecordDTO mbtiRecordDto = this.findById(id);
|
||||
if (Objects.isNull(mbtiRecordDto)) {
|
||||
return null;
|
||||
}
|
||||
MbtiRecord mbtiRecord = MbtiRecord.builder().build();
|
||||
mbtiRecord.setId(id);
|
||||
mbtiRecordMapper.deleteEntity(mbtiRecord, UserContextHolder.getLoginUserId());
|
||||
return mbtiRecordDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MbtiRecordDTO findById(Long id) {
|
||||
MbtiRecord mbtiRecord = mbtiRecordMapper.getById(id);
|
||||
if (Objects.isNull(mbtiRecord)) {
|
||||
return null;
|
||||
}
|
||||
return MbtiRecordConvert.INSTANCE.convert(mbtiRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MbtiRecordDTO> list(MbtiRecordQueryDTO queryDTO) {
|
||||
return mbtiRecordMapper.list(queryDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MbtiRecordDTO> page(MbtiRecordPageQueryDTO queryDTO) {
|
||||
queryDTO.setUserId(UserContextHolder.getExistLoginUserId());
|
||||
return mbtiRecordMapper.page(queryDTO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.newyetai.ai.resume.controller;
|
||||
|
||||
import com.newyetai.ai.resume.dto.AiResumeReqDTO;
|
||||
import com.newyetai.ai.resume.service.AiResumeService;
|
||||
import com.newyetai.common.AlitaResult;
|
||||
import com.newyetai.sdk.xf.util.XfUtils;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: guixinman
|
||||
* @create: 2024-12-12 10:03
|
||||
**/
|
||||
@Api(tags = "AI简历")
|
||||
@RestController
|
||||
@RequestMapping("/ai/resume")
|
||||
public class AiResumeController {
|
||||
|
||||
@Autowired
|
||||
private AiResumeService aiResumeService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("ai简历-创建")
|
||||
public AlitaResult<Long> create(@RequestBody @Validated AiResumeReqDTO reqDto) {
|
||||
aiResumeService.create(reqDto);
|
||||
return AlitaResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/iat")
|
||||
@ApiOperation("ai简历-语音听写")
|
||||
public AlitaResult<String> iat(@RequestParam("fileCode") String fileCode) {
|
||||
return AlitaResult.success(XfUtils.iat(fileCode));
|
||||
}
|
||||
|
||||
@PostMapping("/tts")
|
||||
@ApiOperation("ai简历-语音合成")
|
||||
public AlitaResult<String> tts(@RequestParam("text") String text) {
|
||||
return AlitaResult.success(XfUtils.tts(text));
|
||||
}
|
||||
|
||||
@PostMapping("/analyseResume")
|
||||
@ApiOperation("分析简历")
|
||||
public AlitaResult<String> analyseResume(@RequestParam("text") String text) {
|
||||
return AlitaResult.success(XfUtils.analyseResume(text));
|
||||
}
|
||||
|
||||
@PostMapping("/generateSelfEvaluate")
|
||||
@ApiOperation("生成自我评价")
|
||||
public AlitaResult<String> generateSelfEvaluate(@RequestBody Map<String,Object> map) {
|
||||
return AlitaResult.success(XfUtils.generateSelfEvaluate(JSONUtil.toJsonStr(map)));
|
||||
}
|
||||
|
||||
@PostMapping("/generateWorkExperience")
|
||||
@ApiOperation("生成工作经历")
|
||||
public AlitaResult<String> generateWorkExperience(@RequestBody Map<String,Object> map) {
|
||||
return AlitaResult.success(XfUtils.generateWorkExperience(JSONUtil.toJsonStr(map)));
|
||||
}
|
||||
|
||||
}
|
||||
43
src/main/java/com/newyetai/ai/resume/dto/AiResumeReqDTO.java
Normal file
43
src/main/java/com/newyetai/ai/resume/dto/AiResumeReqDTO.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.newyetai.ai.resume.dto;
|
||||
|
||||
import com.newyetai.common.validation.Create;
|
||||
import com.newyetai.common.validation.Update;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: guixinman
|
||||
* @create: 2024-12-12 10:07
|
||||
**/
|
||||
@ApiModel("ai面试记录")
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AiResumeReqDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotBlank(message = "请输入内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty("岗位类型")
|
||||
private String typeCode;
|
||||
|
||||
@ApiModelProperty("期望城市")
|
||||
private String expectCity;
|
||||
|
||||
@ApiModelProperty("期望月薪")
|
||||
private BigDecimal expectSalary;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.newyetai.ai.resume.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description: Ai生成简历返回model
|
||||
* @author: guixinman
|
||||
* @create: 2024-12-12 11:31
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AiResumeModel implements Serializable {
|
||||
|
||||
private String name;
|
||||
private String birthday;
|
||||
@ApiModelProperty("期望工作地")
|
||||
private String desiredWorkLocation;
|
||||
@ApiModelProperty("期望最低薪资")
|
||||
private String desiredSalaryMin;
|
||||
@ApiModelProperty("期望最高薪资")
|
||||
private String desiredSalaryMax;
|
||||
@ApiModelProperty("期望岗位性质")
|
||||
private String desiredPositionNature;
|
||||
@ApiModelProperty("期望岗位")
|
||||
private String desiredPosition;
|
||||
@ApiModelProperty("最高学历")
|
||||
private String highestDegree;
|
||||
@ApiModelProperty("到岗状态")
|
||||
private String reportStatus;
|
||||
@ApiModelProperty("自我介绍")
|
||||
private String selfIntroduction;
|
||||
// @ApiModelProperty("简历标签")
|
||||
// private String tags;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.newyetai.ai.resume.service;
|
||||
|
||||
import com.newyetai.ai.resume.dto.AiResumeReqDTO;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: guixinman
|
||||
* @create: 2024-12-12 10:57
|
||||
**/
|
||||
public interface AiResumeService {
|
||||
|
||||
void create(AiResumeReqDTO reqDto);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.newyetai.ai.resume.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.newyetai.ai.resume.dto.AiResumeReqDTO;
|
||||
import com.newyetai.ai.resume.model.AiResumeModel;
|
||||
import com.newyetai.ai.resume.service.AiResumeService;
|
||||
import com.newyetai.common.constant.CommonConstants;
|
||||
import com.newyetai.common.exception.BusinessException;
|
||||
import com.newyetai.common.util.JsonUtils;
|
||||
import com.newyetai.common.util.UserContextHolder;
|
||||
import com.newyetai.component.dict.util.DictUtils;
|
||||
import com.newyetai.config.service.ConfigService;
|
||||
import com.newyetai.recruit.position.dao.PositionTypeMapper;
|
||||
import com.newyetai.recruit.position.entity.PositionType;
|
||||
import com.newyetai.recruit.user.dao.JobExpectMapper;
|
||||
import com.newyetai.recruit.user.dao.ResumeMapper;
|
||||
import com.newyetai.recruit.user.dto.JobExpectOperateDTO;
|
||||
import com.newyetai.recruit.user.dto.ResumeDTO;
|
||||
import com.newyetai.recruit.user.dto.ResumeOperatorDTO;
|
||||
import com.newyetai.recruit.user.entity.Resume;
|
||||
import com.newyetai.recruit.user.enums.InductionCycleEnum;
|
||||
import com.newyetai.recruit.user.service.JobExpectService;
|
||||
import com.newyetai.recruit.user.service.ResumeService;
|
||||
import com.newyetai.sdk.xf.util.XfUtils;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: guixinman
|
||||
* @create: 2024-12-12 10:57
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class AiResumeServiceImpl implements AiResumeService {
|
||||
|
||||
@Autowired
|
||||
private ConfigService configService;
|
||||
@Autowired
|
||||
private ResumeService resumeService;
|
||||
@Resource
|
||||
private ResumeMapper resumeMapper;
|
||||
|
||||
@Autowired
|
||||
private JobExpectService jobExpectService;
|
||||
|
||||
@Autowired
|
||||
private PositionTypeMapper positionTypeMapper;
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void create(AiResumeReqDTO reqDto) {
|
||||
String errMsg = "抱歉,我无法回答,请告诉我你想找什么样的工作";
|
||||
try {
|
||||
String jsonData = XfUtils.generateResume(reqDto.getContent());
|
||||
if (StringUtils.equalsAny(jsonData, errMsg)) {
|
||||
throw new BusinessException(jsonData);
|
||||
}
|
||||
AiResumeModel aiResumeModel = JsonUtils.toObject(jsonData, AiResumeModel.class);
|
||||
|
||||
if (StringUtils.isBlank(aiResumeModel.getDesiredPosition())) {
|
||||
throw new BusinessException(errMsg);
|
||||
}
|
||||
//学历
|
||||
String education = DictUtils.getNameCodeMap("education").get(StringUtils.isNotBlank(aiResumeModel.getHighestDegree()) ? aiResumeModel.getHighestDegree() : "");
|
||||
|
||||
jobExpectService.removeByUserId();
|
||||
jobExpectService.create(
|
||||
JobExpectOperateDTO.builder()
|
||||
.userId(UserContextHolder.getExistLoginUserId())
|
||||
.typeCode(reqDto.getTypeCode())
|
||||
.expectCity(reqDto.getExpectCity())
|
||||
.expectSalary(reqDto.getExpectSalary())
|
||||
.onDuty(false)
|
||||
.inductionCycle(InductionCycleEnum.findTypeByDesc(aiResumeModel.getReportStatus()))
|
||||
.positionName(aiResumeModel.getDesiredPosition())
|
||||
.build());
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
throw new BusinessException(errMsg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user