动态管理修改及加盟商资格面试

This commit is contained in:
pserimal
2023-06-13 18:54:47 +08:00
parent eb9dc4116a
commit ee2372c8f8
37 changed files with 689 additions and 31 deletions

View File

@@ -4,6 +4,7 @@ import com.cool.store.dto.content.ContentAddDto;
import com.cool.store.dto.content.ContentQueryListDto;
import com.cool.store.dto.content.ContentUpdateDto;
import com.cool.store.entity.HyContentInfoDO;
import com.cool.store.vo.HyContentInfoVO;
import java.util.List;
@@ -31,7 +32,7 @@ public interface ContentService {
/**
* 查询动态列表
*/
List<HyContentInfoDO> queryContentList(ContentQueryListDto dto);
List<HyContentInfoVO> queryContentList(ContentQueryListDto dto);
/**
* 查询动态详情

View File

@@ -1,6 +1,9 @@
package com.cool.store.service;
import com.cool.store.dto.partner.EnterInterviewDto;
import com.cool.store.vo.PartnerEnterInterviewVO;
import com.cool.store.vo.PartnerInterviewInfoVO;
import com.cool.store.vo.PartnerPassLetterDetailVO;
public interface PartnerInterviewService {
@@ -11,4 +14,17 @@ public interface PartnerInterviewService {
*/
PartnerInterviewInfoVO queryByPartnerId(String partnerId);
/**
* 进入面试间的方法
* 修改一些面试状态
* 最后返回 userSign 用于进入腾讯云音视频房间
* @return userSign 进入视频所需签名
*/
PartnerEnterInterviewVO enterInterviewRoom(EnterInterviewDto dto);
/**
* 获取通知函详情
*/
PartnerPassLetterDetailVO passLetterDetail(String interviewId);
}

View File

@@ -8,6 +8,7 @@ import com.cool.store.dto.content.ContentUpdateDto;
import com.cool.store.entity.HyContentInfoDO;
import com.cool.store.mapper.HyContentInfoMapper;
import com.cool.store.service.ContentService;
import com.cool.store.vo.HyContentInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -60,7 +61,7 @@ public class ContentServiceImpl implements ContentService {
* 查询动态列表
*/
@Override
public List<HyContentInfoDO> queryContentList(ContentQueryListDto dto) {
public List<HyContentInfoVO> queryContentList(ContentQueryListDto dto) {
return contentInfoMapper.queryContentList(dto);
}

View File

@@ -1,10 +1,26 @@
package com.cool.store.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import com.cool.store.dto.partner.EnterInterviewDto;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.HyPartnerInterviewMapper;
import com.cool.store.service.PartnerInterviewService;
import com.cool.store.utils.PDFUtils;
import com.cool.store.utils.PassLetterUtils;
import com.cool.store.utils.TRTCUtils;
import com.cool.store.vo.PartnerEnterInterviewVO;
import com.cool.store.vo.PartnerInterviewInfoVO;
import com.cool.store.vo.PartnerPassLetterDetailVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
@Service
public class PartnerInterviewServiceImpl implements PartnerInterviewService {
@@ -12,8 +28,15 @@ public class PartnerInterviewServiceImpl implements PartnerInterviewService {
@Autowired
private HyPartnerInterviewMapper interviewMapper;
@Value("${trtc.sdkAppId}")
private Long sdkAppId;
@Value("${trtc.secretKey}")
private String key;
/**
* 加盟商查询面试信息
*
* @param partnerId
* @return
*/
@@ -22,4 +45,70 @@ public class PartnerInterviewServiceImpl implements PartnerInterviewService {
return interviewMapper.queryByPartnerId(partnerId);
}
/**
* 进入面试间的方法
* 修改一些面试状态
* 最后返回 userSign 用于进入腾讯云音视频房间
*
* @return userSign 进入视频所需签名
*/
@Override
@Transactional
public PartnerEnterInterviewVO enterInterviewRoom(EnterInterviewDto dto) {
try {
//1. 将面试状态改为 --> 2已开始
interviewMapper.updateInterviewStatus(dto.getInterviewId(), 2);
//3. 修改面试实际开始时间,以第一个人进来的时间为准,后续不再修改
interviewMapper.updateActualStartTime(dto.getInterviewId(), DateUtil.now());
//4. 修改加盟商或面试官进入面试时间
interviewMapper.updateEnterTime(dto.getInterviewId(), dto.getUserType(), DateUtil.now());
//5. 加盟商如果进入了,就修改面试计划表 is_partner_interview 字段
interviewMapper.updateWhetherPartnerEnter(dto.getInterviewId());
//6. 查询对应的面试官id
String interviewId = interviewMapper.getInterviewerByInterviewId(dto.getInterviewId());
//生成 userSign
String userSig = TRTCUtils.genUserSig(sdkAppId, key, dto.getUserId());
PartnerEnterInterviewVO vo = new PartnerEnterInterviewVO();
vo.setUserSign(userSig);
vo.setInterviewerId(interviewId);
return vo;
} catch (Exception e) {
throw new ServiceException(ErrorCodeEnum.INTERVIEW_ENTER_FAIL);
}
}
/**
* 获取通知函详情
* TODO 暂时将生成通过函文件的功能放在这里方便测试和联调,审批通过的回调方法完成后应该放到该方法中
*/
@Override
public PartnerPassLetterDetailVO passLetterDetail(String interviewId) {
PartnerPassLetterDetailVO vo = interviewMapper.getPassLetterDetail(interviewId);
//有效期为审批通过次日起第 60 天的 23:59:59由此倒推 createTime
DateTime expiryDate = DateUtil.parseDate(vo.getExpiryDate());
DateTime createTime = DateUtil.offsetDay(expiryDate, -61);
vo.setCreateTime(DateUtil.format(createTime, "yyyy-MM-dd"));
//解析意向开店区域为市级行政区
String verifyCity = vo.getVerifyCity();
if (verifyCity == null) {
String passCode = PassLetterUtils.genPassLetter(vo.getPartnerName(), verifyCity, vo.getPassCode(), createTime);
vo.setPassCode(passCode);
return vo;
}
String[] split = verifyCity.split("/");
//根据长度来取市级行政区域
if (split.length == 2) {
vo.setVerifyCity(split[1]);
} else if (split.length == 3) {
vo.setVerifyCity(split[1]);
} else if (split.length == 4) {
vo.setVerifyCity(split[2]);
} else {
System.out.println("wrong");
}
String passCode = PassLetterUtils.genPassLetter(vo.getPartnerName(), verifyCity, vo.getPassCode(), createTime);
vo.setPassCode(passCode);
return vo;
}
}