|
|
|
|
@@ -1,15 +1,13 @@
|
|
|
|
|
package com.cool.store.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
|
|
import cn.hutool.core.date.DatePattern;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.cool.store.dto.calendar.*;
|
|
|
|
|
import com.cool.store.dto.message.SendCardMessageDTO;
|
|
|
|
|
import com.cool.store.dto.partner.EnterInterviewDto;
|
|
|
|
|
import com.cool.store.entity.HyPartnerBaseInfoDO;
|
|
|
|
|
import com.cool.store.entity.EnterpriseUserDO;
|
|
|
|
|
import com.cool.store.entity.HyPartnerInterviewDO;
|
|
|
|
|
import com.cool.store.entity.HyPartnerInterviewPlanDO;
|
|
|
|
|
import com.cool.store.entity.HyPartnerLineInfoDO;
|
|
|
|
|
import com.cool.store.entity.*;
|
|
|
|
|
import com.cool.store.enums.ErrorCodeEnum;
|
|
|
|
|
import com.cool.store.enums.MessageTypeEnum;
|
|
|
|
|
import com.cool.store.enums.RoomStatus;
|
|
|
|
|
@@ -18,14 +16,13 @@ import com.cool.store.exception.ApiException;
|
|
|
|
|
import com.cool.store.exception.ServiceException;
|
|
|
|
|
import com.cool.store.http.ISVHttpRequest;
|
|
|
|
|
import com.cool.store.mapper.HyPartnerBaseInfoMapper;
|
|
|
|
|
import com.cool.store.mapper.EnterpriseUserMapper;
|
|
|
|
|
import com.cool.store.mapper.HyPartnerInterviewMapper;
|
|
|
|
|
import com.cool.store.mapper.HyPartnerInterviewPlanMapper;
|
|
|
|
|
import com.cool.store.mapper.HyPartnerLineInfoMapper;
|
|
|
|
|
import com.cool.store.request.*;
|
|
|
|
|
import com.cool.store.service.EnterpriseUserService;
|
|
|
|
|
import com.cool.store.service.HyPartnerInterviewPlanService;
|
|
|
|
|
import com.cool.store.service.InterviewService;
|
|
|
|
|
import com.cool.store.service.SmsService;
|
|
|
|
|
import com.cool.store.utils.StringUtil;
|
|
|
|
|
import com.cool.store.utils.TRTCUtils;
|
|
|
|
|
import com.cool.store.vo.EnterInterviewVO;
|
|
|
|
|
@@ -40,6 +37,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
@@ -53,18 +51,21 @@ import java.util.List;
|
|
|
|
|
@Service
|
|
|
|
|
public class InterviewServiceImpl implements InterviewService {
|
|
|
|
|
|
|
|
|
|
@Value("${trtc.sdkAppId}")
|
|
|
|
|
@Value("${trtc.sdkAppId:null}")
|
|
|
|
|
private Long sdkAppId;
|
|
|
|
|
|
|
|
|
|
@Value("${trtc.secretKey}")
|
|
|
|
|
@Value("${trtc.secretKey:null}")
|
|
|
|
|
private String key;
|
|
|
|
|
|
|
|
|
|
@Value("${hs.sms.templateCode:null}")
|
|
|
|
|
private String templateCode;
|
|
|
|
|
|
|
|
|
|
@Value("${feishu.notice.link.url:null}")
|
|
|
|
|
private String linkUrl;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private HyPartnerInterviewPlanMapper hyPartnerInterviewPlanMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private HyPartnerInterviewMapper interviewMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private HyPartnerInterviewMapper hyPartnerInterviewMapper;
|
|
|
|
|
|
|
|
|
|
@@ -80,6 +81,9 @@ public class InterviewServiceImpl implements InterviewService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private EnterpriseUserService enterpriseUserService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private SmsService smsService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<InterviewVO> getInterviewList(GetInterviewListReq request) {
|
|
|
|
|
List<InterviewVO> interviewList = hyPartnerInterviewPlanMapper.getInterviewList(request);
|
|
|
|
|
@@ -303,6 +307,17 @@ public class InterviewServiceImpl implements InterviewService {
|
|
|
|
|
hyPartnerInterviewDO.setStatus(Integer.valueOf(WorkflowStatusEnum.RESERVATION_1.getCode()));
|
|
|
|
|
hyPartnerInterviewMapper.insertSelective(hyPartnerInterviewDO);
|
|
|
|
|
|
|
|
|
|
//异步发送飞书信息给面试官
|
|
|
|
|
InterviewVO interviewVO = hyPartnerInterviewPlanMapper.getInterviewInfo(String.valueOf(interviewPlanId));
|
|
|
|
|
List<String> userIds = new ArrayList<>();
|
|
|
|
|
userIds.add(interviewrId);
|
|
|
|
|
SendCardMessageDTO sendCardMessageDTO = new SendCardMessageDTO();
|
|
|
|
|
sendCardMessageDTO.setUserIds(userIds);
|
|
|
|
|
sendCardMessageDTO.setMessageType(MessageTypeEnum.SCHEDULE_REMINDER);
|
|
|
|
|
sendCardMessageDTO.setMessageUrl(linkUrl);
|
|
|
|
|
sendCardMessageDTO.setTitle("面试预约申请");
|
|
|
|
|
sendCardMessageDTO.setContent(generateFeiShuInterviewMsg(interviewVO.getPartnerName(), interviewVO.getPartnerMobile(), interviewVO.getStartTime()));
|
|
|
|
|
isvHttpRequest.sendFeiShuCardMessage(sendCardMessageDTO);
|
|
|
|
|
return vo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -316,11 +331,13 @@ public class InterviewServiceImpl implements InterviewService {
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.INTERVIEW_PLAN_NOT_EXIST);
|
|
|
|
|
}
|
|
|
|
|
HyPartnerBaseInfoDO partnerBaseInfo = hyPartnerBaseInfoMapper.getByPartnerLineId(interviewVO.getPartnerLineId());
|
|
|
|
|
if(partnerBaseInfo == null){
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.INTERVIEW_PARTNER_NOT_EXIST);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<UserFreeBusyInfoDTO> UserFreeBusyInfoList = isvHttpRequest.getFreeBusyList(request.getInterviewerId(), DateUtil.parse(interviewVO.getStartTime()).getTime(), DateUtil.parse(interviewVO.getEndTime()).getTime());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(UserFreeBusyInfoList)) {
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.INTERVIEW_INTERVIEW_TIME_IS_UNUSABLE);
|
|
|
|
|
List<UserFreeBusyInfoDTO> userFreeBusyInfoList = isvHttpRequest.getFreeBusyList(request.getInterviewerId(), DateUtil.parse(interviewVO.getStartTime()).getTime(), DateUtil.parse(interviewVO.getEndTime()).getTime());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(userFreeBusyInfoList)) {
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.INTERVIEW_INTERVIEW_TIME_IS_UNUSABLE,partnerBaseInfo.getUsername(),partnerBaseInfo.getMobile());
|
|
|
|
|
}
|
|
|
|
|
//创建日程信息
|
|
|
|
|
CreateCalendarEventDTO createCalendarEventDTO = new CreateCalendarEventDTO();
|
|
|
|
|
@@ -348,15 +365,10 @@ public class InterviewServiceImpl implements InterviewService {
|
|
|
|
|
hyPartnerInterviewDO.setStatus(Integer.valueOf(WorkflowStatusEnum.INTERVIEW_2.getCode()));
|
|
|
|
|
hyPartnerInterviewDO.setUpdateTime(new Date());
|
|
|
|
|
hyPartnerInterviewMapper.updateByPrimaryKeySelective(hyPartnerInterviewDO);
|
|
|
|
|
//TODO 异步发送短信给加盟商
|
|
|
|
|
|
|
|
|
|
//异步发飞书消息给面试官
|
|
|
|
|
SendCardMessageDTO sendCardMessageDTO = new SendCardMessageDTO();
|
|
|
|
|
sendCardMessageDTO.setUserIds(Arrays.asList(request.getInterviewerId()));
|
|
|
|
|
sendCardMessageDTO.setMessageType(MessageTypeEnum.SCHEDULE_REMINDER);
|
|
|
|
|
sendCardMessageDTO.setTitle("面试预约申请");
|
|
|
|
|
sendCardMessageDTO.setContent(generateFeiShuInterviewMsg(interviewVO.getPartnerName(), interviewVO.getPartnerMobile(), interviewVO.getStartTime()));
|
|
|
|
|
isvHttpRequest.sendFeiShuCardMessage(sendCardMessageDTO);
|
|
|
|
|
//异步发送短信给加盟商
|
|
|
|
|
InterviewSmsReq interviewSmsReq = new InterviewSmsReq();
|
|
|
|
|
interviewSmsReq.setInterviewStartTime(DateUtil.format(DateUtil.parse(interviewVO.getStartTime()), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
|
|
|
|
|
smsService.sendSms(JSON.toJSONString(interviewSmsReq),templateCode, partnerBaseInfo.getMobile());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -390,7 +402,7 @@ public class InterviewServiceImpl implements InterviewService {
|
|
|
|
|
hyPartnerInterviewPlanDO.setPartnerId(partnerId);
|
|
|
|
|
List<HyPartnerInterviewPlanDO> hyPartnerInterviewPlanDOS = hyPartnerInterviewPlanMapper.selectBySelective(hyPartnerInterviewPlanDO);
|
|
|
|
|
//如果查询结果为空,则去线索中获取招商经理,面试官只有两个阶段,一个是在第一次申请时不存在面试安排直接取招商经理,第二个时面试信息中可修改面试官信息,这个时候以面试信息中为准
|
|
|
|
|
if (org.springframework.util.CollectionUtils.isEmpty(hyPartnerInterviewPlanDOS)) {
|
|
|
|
|
if (CollectionUtils.isEmpty(hyPartnerInterviewPlanDOS)) {
|
|
|
|
|
HyPartnerLineInfoDO hyPartnerLineInfoDO = hyPartnerLineInfoMapper.selectByPrimaryKeySelective(Long.valueOf(lineId));
|
|
|
|
|
interviewerId = hyPartnerLineInfoDO.getInvestmentManager();
|
|
|
|
|
}else {
|
|
|
|
|
|