面谈/面试

This commit is contained in:
zhangchenbiao
2024-03-20 11:44:29 +08:00
parent 1744150906
commit a2a58c57a1
15 changed files with 244 additions and 31 deletions

View File

@@ -1,7 +1,6 @@
package com.cool.store.enums;
import com.cool.store.constants.CommonConstants;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.tuple.Pair;
import java.time.LocalDate;
@@ -9,7 +8,6 @@ import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author zhangchenbiao
@@ -93,8 +91,4 @@ public enum InterviewTypeEnum {
return result;
}
public static void main(String[] args) {
System.out.println(getTimeSlots(LocalDate.now(), InterviewTypeEnum.INTERVIEW));
}
}

View File

@@ -0,0 +1,23 @@
package com.cool.store.enums;
/**
* @author zhangchenbiao
* @FileName: InterviewUserTypeEnum
* @Description:
* @date 2024-03-20 9:53
*/
public enum InterviewUserTypeEnum {
LINE("加盟商线索"),
INTERVIEWER("面试官"),;
private String message;
InterviewUserTypeEnum(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
}

View File

@@ -0,0 +1,45 @@
package com.cool.store.enums;
/**
* @author zhangchenbiao
* @FileName: JoinInterviewStatusEnum
* @Description:
* @date 2024-03-20 11:05
*/
public enum JoinInterviewStatusEnum {
NO_JOIN(0, "未参加"),
LINE_JOIN(1,"加盟商先进入"),
INTERVIEW_JOIN(2,"面试官先进入"),
JOIN(3,"双方都参加");
private Integer code;
private String message;
JoinInterviewStatusEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public String getMessage() {
return message;
}
public static Integer getJoinInterviewStatus(Integer joinInterviewStatus, InterviewUserTypeEnum userType){
if(NO_JOIN.getCode().equals(joinInterviewStatus)){
return InterviewUserTypeEnum.LINE.equals(userType) ? LINE_JOIN.getCode() : INTERVIEW_JOIN.getCode();
}
if(LINE_JOIN.getCode().equals(joinInterviewStatus)){
return InterviewUserTypeEnum.LINE.equals(userType) ? LINE_JOIN.getCode() : JOIN.getCode();
}
if(INTERVIEW_JOIN.getCode().equals(joinInterviewStatus)){
return InterviewUserTypeEnum.LINE.equals(userType) ? JOIN.getCode() : INTERVIEW_JOIN.getCode();
}
return JOIN.getCode();
}
}

View File

@@ -16,10 +16,10 @@ public class TRTCUtils {
*/
private static final Long expired = 60 * 60 * 24L;
@Value("${trtc.sdkAppId:null}")
@Value("${trtc.sdkAppId}")
private Long sdkAppId;
@Value("${trtc.secretKey:null}")
@Value("${trtc.secretKey}")
private String key;
/**

View File

@@ -23,7 +23,11 @@ public class LineInfoDAO {
public LineInfoDO getLineInfo(Long lineId) {
return lineInfoMapper.selectByPrimaryKey(lineId);
LineInfoDO lineInfo = lineInfoMapper.selectByPrimaryKey(lineId);
if(Objects.nonNull(lineInfo) && !lineInfo.getDeleted()){
return lineInfo;
}
return null;
}
public Integer updateLineInfo(LineInfoDO param){

View File

@@ -51,4 +51,13 @@ public class LineInterviewDAO {
return lineInterviewMapper.getInterviewerPage(request);
}
/**
* 获取面试信息
* @param interviewId
* @return
*/
public LineInterviewDO getInterviewInfoById(Long interviewId){
return lineInterviewMapper.selectByPrimaryKey(interviewId);
}
}

View File

@@ -9,7 +9,7 @@
<result column="interview_date" jdbcType="DATE" property="interviewDate" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="is_partner_interview" jdbcType="TINYINT" property="isPartnerInterview" />
<result column="join_interview_status" jdbcType="TINYINT" property="joinInterviewStatus" />
<result column="actual_start_time" jdbcType="TIMESTAMP" property="actualStartTime" />
<result column="actual_end_time" jdbcType="TIMESTAMP" property="actualEndTime" />
<result column="room_id" jdbcType="VARCHAR" property="roomId" />
@@ -32,6 +32,7 @@
<select id="getInterviewerPage" resultType="com.cool.store.dto.interview.LineInterviewPageDTO">
select
a.id as interviewId,
a.line_id as lineId,
a.start_time as startTime,
a.end_time as endTime,

View File

@@ -12,6 +12,9 @@ import lombok.Data;
@Data
public class LineInterviewPageDTO {
@ApiModelProperty("面试id")
private Long interviewId;
@ApiModelProperty("线索id")
private Long lineId;

View File

@@ -49,10 +49,10 @@ public class LineInterviewDO {
private Date endTime;
/**
* 0未参加1参加
* 0未参加1加盟商先进入 2面试官先进入 3双方都参加
*/
@Column(name = "is_partner_interview")
private Integer isPartnerInterview;
@Column(name = "join_interview_status")
private Integer joinInterviewStatus;
/**
* 实际开始时间

View File

@@ -0,0 +1,27 @@
package com.cool.store.vo.interview;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class EnterInterviewVO {
@ApiModelProperty("userSig 进入会议需要的用户签名")
private String userSign;
@ApiModelProperty("面试官id")
private String interviewerId;
@ApiModelProperty("面试官姓名")
private String interviewerName;
@ApiModelProperty("加盟商姓名")
private String partnerName;
public EnterInterviewVO(String userSign, String interviewerId, String interviewerName, String partnerName) {
this.userSign = userSign;
this.interviewerId = interviewerId;
this.interviewerName = interviewerName;
this.partnerName = partnerName;
}
}

View File

@@ -21,6 +21,9 @@ import java.util.Map;
@Data
public class LineInterviewPageVO {
@ApiModelProperty("面试id")
private Long interviewId;
@ApiModelProperty("线索id")
private Long lineId;

View File

@@ -1,9 +1,11 @@
package com.cool.store.service;
import com.cool.store.enums.InterviewUserTypeEnum;
import com.cool.store.request.AppointmentTimeRequest;
import com.cool.store.request.LineInterviewPageRequest;
import com.cool.store.request.ModifyInterviewerRequest;
import com.cool.store.vo.interview.AppointmentTimeVO;
import com.cool.store.vo.interview.EnterInterviewVO;
import com.cool.store.vo.interview.LineInterviewPageVO;
import com.github.pagehelper.PageInfo;
@@ -54,4 +56,13 @@ public interface LineInterviewService {
* @return
*/
PageInfo<LineInterviewPageVO> getInterviewerPage(LineInterviewPageRequest request);
/**
* 进入面试间
* @param interviewId
* @param interviewUserId
* @param userType
* @return
*/
EnterInterviewVO enterInterviewRoom(Long interviewId, String interviewUserId, InterviewUserTypeEnum userType);
}

View File

@@ -6,22 +6,25 @@ import com.cool.store.entity.HyOpenAreaInfoDO;
import com.cool.store.entity.LineCalendarsEventDO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.LineInterviewDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.InterviewTypeEnum;
import com.cool.store.enums.*;
import com.cool.store.exception.ApiException;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.AppointmentTimeRequest;
import com.cool.store.request.LineInterviewPageRequest;
import com.cool.store.request.ModifyInterviewerRequest;
import com.cool.store.service.LabelService;
import com.cool.store.service.LineInterviewService;
import com.cool.store.utils.TRTCUtils;
import com.cool.store.utils.UUIDUtils;
import com.cool.store.utils.poi.DateUtils;
import com.cool.store.vo.interview.AppointmentTimeVO;
import com.cool.store.vo.interview.EnterInterviewVO;
import com.cool.store.vo.interview.LineInterviewPageVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -42,6 +45,10 @@ import java.util.stream.Stream;
@Service
public class LineInterviewServiceImpl implements LineInterviewService {
@Value("${trtc.sdkAppId}")
private Long sdkAppId;
@Value("${trtc.secretKey}")
private String key;
@Resource
private LineInfoDAO lineInfoDAO;
@Resource
@@ -190,4 +197,31 @@ public class LineInterviewServiceImpl implements LineInterviewService {
resultPage.setList(resultList);
return resultPage;
}
@Override
public EnterInterviewVO enterInterviewRoom(Long interviewId, String interviewUserId, InterviewUserTypeEnum userType) {
LineInterviewDO interviewInfo = lineInterviewDAO.getInterviewInfoById(interviewId);
if(Objects.isNull(interviewInfo)){
throw new ServiceException(ErrorCodeEnum.INTERVIEW_NOT_EXIST);
}
//已关闭就禁止进入房间了
if (interviewInfo.getRoomStatus().equals(RoomStatus.CLOSED.getCode())) {
throw new ServiceException(ErrorCodeEnum.ROOM_STATUS_ERROR);
}
String userName = enterpriseUserDAO.getUserName(interviewInfo.getInterviewer());
Long lineId = interviewInfo.getLineId();
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
if(Objects.isNull(lineInfo)){
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
}
Integer joinInterviewStatus = JoinInterviewStatusEnum.getJoinInterviewStatus(interviewInfo.getJoinInterviewStatus(), userType);
if(!joinInterviewStatus.equals(interviewInfo.getJoinInterviewStatus()) && JoinInterviewStatusEnum.JOIN.getCode().equals(joinInterviewStatus)){
interviewInfo.setActualStartTime(new Date());
interviewInfo.setRoomStatus(RoomStatus.OPEN.getCode());
}
interviewInfo.setJoinInterviewStatus(joinInterviewStatus);
lineInterviewDAO.updateInterviewInfo(interviewInfo);
String userSig = TRTCUtils.genUserSig(sdkAppId, key, interviewUserId);
return new EnterInterviewVO(userSig, interviewInfo.getInterviewer(), userName, lineInfo.getUsername());
}
}

View File

@@ -0,0 +1,66 @@
package com.cool.store.controller.webb;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.enums.InterviewUserTypeEnum;
import com.cool.store.request.AppointmentTimeRequest;
import com.cool.store.request.LineInterviewPageRequest;
import com.cool.store.request.ModifyInterviewerRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.LineInterviewService;
import com.cool.store.vo.interview.AppointmentTimeVO;
import com.cool.store.vo.interview.EnterInterviewVO;
import com.cool.store.vo.interview.LineInterviewPageVO;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;
/**
* @author zhangchenbiao
* @FileName: LineInterviewController
* @Description:
* @date 2024-03-15 16:04
*/
@RestController
@RequestMapping("/interview")
@Api(tags = "面试&面谈")
@Slf4j
public class LineInterviewController {
@Resource
private LineInterviewService lineInterviewService;
@ApiOperation("修改面审时间")
@PostMapping("/appointment/time/modify")
public ResponseResult<Boolean> modifyAppointmentTime(@RequestBody @Validated AppointmentTimeRequest request) {
return ResponseResult.success(lineInterviewService.modifyAppointmentTime(request));
}
@ApiOperation("修改面试官")
@PostMapping("/interviewer/modify")
public ResponseResult<Boolean> modifyInterviewer(@RequestBody @Validated ModifyInterviewerRequest request) {
return ResponseResult.success(lineInterviewService.modifyInterviewer(request));
}
@ApiOperation("面试列表")
@PostMapping("/interviewer/page")
public ResponseResult<PageInfo<LineInterviewPageVO>> getInterviewerPage(@RequestBody LineInterviewPageRequest request) {
return ResponseResult.success(lineInterviewService.getInterviewerPage(request));
}
@ApiOperation("进入房间")
@GetMapping("/interviewer/room/enter")
public ResponseResult<EnterInterviewVO> enterInterviewRoom(@RequestParam("interviewId")Long interviewId) {
String userId = CurrentUserHolder.getUserId();
return ResponseResult.success(lineInterviewService.enterInterviewRoom(interviewId, userId, InterviewUserTypeEnum.INTERVIEWER));
}
}

View File

@@ -1,11 +1,15 @@
package com.cool.store.controller.webc;
import com.cool.store.context.PartnerUserHolder;
import com.cool.store.enums.InterviewUserTypeEnum;
import com.cool.store.request.AppointmentTimeRequest;
import com.cool.store.request.LineInterviewPageRequest;
import com.cool.store.request.ModifyInterviewerRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.LineInterviewService;
import com.cool.store.vo.PartnerUserInfoVO;
import com.cool.store.vo.interview.AppointmentTimeVO;
import com.cool.store.vo.interview.EnterInterviewVO;
import com.cool.store.vo.interview.LineInterviewPageVO;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
@@ -56,22 +60,11 @@ public class LineInterviewController {
return ResponseResult.success(lineInterviewService.appointmentTime(request));
}
@ApiOperation("修改面审时间")
@PostMapping("/appointment/time/modify")
public ResponseResult<Boolean> modifyAppointmentTime(@RequestBody @Validated AppointmentTimeRequest request) {
return ResponseResult.success(lineInterviewService.modifyAppointmentTime(request));
@ApiOperation("进入房间")
@GetMapping("/interviewer/room/enter")
public ResponseResult<EnterInterviewVO> enterInterviewRoom(@RequestParam("interviewId")Long interviewId) {
PartnerUserInfoVO partnerUser = PartnerUserHolder.getUser();
return ResponseResult.success(lineInterviewService.enterInterviewRoom(interviewId, partnerUser.getPartnerId(), InterviewUserTypeEnum.LINE));
}
@ApiOperation("修改面试官")
@PostMapping("/interviewer/modify")
public ResponseResult<Boolean> modifyInterviewer(@RequestBody @Validated ModifyInterviewerRequest request) {
return ResponseResult.success(lineInterviewService.modifyInterviewer(request));
}
@ApiOperation("面试列表")
@PostMapping("/interviewer/page")
public ResponseResult<PageInfo<LineInterviewPageVO>> getInterviewerPage(@RequestBody LineInterviewPageRequest request) {
return ResponseResult.success(lineInterviewService.getInterviewerPage(request));
}
}