Merge branch 'dev/feat/partner1.5.2_20231121' into hxd/feat/partner1.5.2

This commit is contained in:
xiaodong.hu
2023-11-13 13:39:33 +08:00
35 changed files with 784 additions and 120 deletions

View File

@@ -21,6 +21,7 @@ public enum OperateTypeEnum {
CLOSE_FOLLOW("close_follow", "结束跟进", Arrays.asList(OPERATE_USER_ID,OPERATE_USER_NAME, MOBILE, OPERATE_TIME, REJECT_PUBLIC_REASON, REJECT_REAL_REASON, CERTIFY_FILE)),
TRANSFER_INVESTMENT_MANAGER("transfer_investment_manager", "转让招商经理", Arrays.asList(OPERATE_USER_ID,OPERATE_USER_NAME, MOBILE, OPERATE_TIME, BEFORE_INVESTMENT_MANAGER_USERNAME, BEFORE_INVESTMENT_MANAGER_MOBILE, AFTER_INVESTMENT_MANAGER_USERNAME, AFTER_INVESTMENT_MANAGER_MOBILE)),
INTERVIEW_APPOINTMENT("interview_appointment", "预约面试时间", Arrays.asList(OPERATE_USER_ID,OPERATE_USER_NAME, MOBILE, OPERATE_TIME)),
INTERVIEWER_BOOK_INTERVIEW("interviewer_book_interview", "招商经理主动预约面试时间", Arrays.asList(OPERATE_USER_ID,OPERATE_USER_NAME, MOBILE, OPERATE_TIME)),
MODIFY_INTERVIEW_TIME("modify_interview_time", "修改面试时间", Arrays.asList(OPERATE_USER_ID,OPERATE_USER_NAME, MOBILE, OPERATE_TIME, BEFORE_INTERVIEW_TIME, AFTER_INTERVIEW_TIME)),
ENTRUST_OTHERS("entrust_others", "委托他人", Arrays.asList(OPERATE_USER_ID,OPERATE_USER_NAME, MOBILE, BEFORE_INTERVIEWR_NAME, AFTER_INTERVIEWR_NAME, BEFORE_INTERVIEWR_MOBILE, AFTER_INTERVIEWR_MOBILE)),

View File

@@ -0,0 +1,36 @@
package com.cool.store.dao;
import com.cool.store.entity.SuperAdminConfigDO;
import com.cool.store.mapper.SuperAdminConfigMapper;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2023/11/9 14:26
* @Version 1.0
*/
@Repository
public class SuperAdminConfigDAO {
@Resource
SuperAdminConfigMapper superAdminConfigMapper;
public SuperAdminConfigDO selectByPrimaryKey(Long id){
if (id==null){
return null;
}
return superAdminConfigMapper.selectByPrimaryKey(id);
}
public SuperAdminConfigDO isSuperAdmin(String userId){
return superAdminConfigMapper.isSuperAdmin(userId);
}
}

View File

@@ -1,10 +1,12 @@
package com.cool.store.mapper;
import com.cool.store.dto.calendar.UserFreeBusyInfoDTO;
import com.cool.store.dto.message.RemindInterviewMsgDTO;
import com.cool.store.dto.partner.AdvanceLineDTO;
import com.cool.store.dto.partner.PartnerInterviewInfoDTO;
import com.cool.store.dto.partner.SpecialDateRangeInterviewCountDTO;
import com.cool.store.entity.HyInterviewRemindDO;
import com.cool.store.entity.HyPartnerInterviewBookSituation;
import com.cool.store.entity.HyPartnerInterviewPlanDO;
import com.cool.store.request.GetInterviewListReq;
import com.cool.store.vo.EnterpriseUserBaseInfoVO;
@@ -185,4 +187,13 @@ public interface HyPartnerInterviewPlanMapper {
* @return
*/
List<HyInterviewRemindDO> remindInterviewStartMinutes();
/**
* 获取招商经理各时段预约情况
* @param interviewerId 招商经理 id
* @param startTimeStr 开始时间点
* @param endTimeStr 结束时间点
* @return
*/
List<HyPartnerInterviewBookSituation> getInterviewBookSituation(@Param("interviewerId") String interviewerId, @Param("startTime") String startTimeStr, @Param("endTime") String endTimeStr);
}

View File

@@ -0,0 +1,18 @@
package com.cool.store.mapper;
import com.cool.store.entity.SuperAdminConfigDO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/**
* @author zhangchenbiao
* @date 2023-11-09 02:24
*/
public interface SuperAdminConfigMapper {
SuperAdminConfigDO selectByPrimaryKey(Long id);
SuperAdminConfigDO isSuperAdmin(@Param("userId") String userId);
}

View File

@@ -587,4 +587,31 @@
AND t1.update_time &lt;= NOW()
</select>
<select id="getInterviewBookSituation" resultType="com.cool.store.entity.HyPartnerInterviewBookSituation">
SELECT t_booking_times.*, IFNULL(application_approved, 0) AS booked, partner_id AS booked_partner_id
FROM (
-- 查询已被预约成功的时间段
SELECT t1.start_time, t1.end_time, t1.application_approved, t1.partner_id, t1.deleted
FROM hy_partner_interview_plan t1
LEFT JOIN hy_partner_interview t2 ON t1.id = t2.interview_plan_id
WHERE t1.interviewer = #{interviewerId}
AND t1.deleted = 0
AND t1.application_approved = 1
AND t1.start_time &gt;= #{startTime}
AND t1.end_time &lt;= #{endTime}
)
AS t_booking_success
RIGHT JOIN (
-- 查询所有时间段预约人数
SELECT COUNT(*) AS booking_count, start_time, end_time, deleted
FROM hy_partner_interview_plan
WHERE interviewer = #{interviewerId}
AND deleted = 0
AND start_time &gt;= #{startTime}
AND end_time &lt;= #{endTime}
GROUP BY start_time
)
AS t_booking_times ON t_booking_times.start_time = t_booking_success.start_time
</select>
</mapper>

View File

@@ -602,11 +602,6 @@
<if test="storeKeyword!=null and storeKeyword!='' and storeKeywordType!=null and storeKeywordType=='partnerMobile'">
AND hpuinfo.recommend_partner_mobile like concat('%',#{storeKeyword},'%')
</if>
<if test="userIdList!=null and userIdList.size>0 and developmentManagerList!=null and developmentManagerList.size==0">
<foreach collection="userIdList" item="userId" open="and hpli.investment_manager in (" close=")" separator=",">
#{userId}
</foreach>
</if>
<if test="userPortraitIdList!=null and userPortraitIdList.size>0 and userPortraitQueryType!=null and userPortraitQueryType=='contains'">
<foreach collection="userPortraitIdList" separator="or" open="and (" close=")" item="userPortraitId">
bi.user_portrait like concat("%,", #{userPortraitId}, ",%")
@@ -634,6 +629,11 @@
<if test="userChannelQueryType!=null and userChannelQueryType == 'blank' ">
AND hpuinfo.user_channel_id is null
</if>
<if test="userIdList!=null and userIdList.size>0 and developmentManagerList!=null and developmentManagerList.size==0">
<foreach collection="userIdList" item="userId" open="and hpli.investment_manager in (" close=")" separator=",">
#{userId}
</foreach>
</if>
<if test="userIdList!=null and userIdList.size==0 and developmentManagerList!=null and developmentManagerList.size>0">
<foreach collection="developmentManagerList" item="developmentManager" open="and hpli.development_manager in (" close=")" separator=",">
#{developmentManager}

View File

@@ -0,0 +1,30 @@
<?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.cool.store.mapper.SuperAdminConfigMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.SuperAdminConfigDO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="super_admin_user_id" jdbcType="VARCHAR" property="superAdminUserId" />
<result column="deleted" jdbcType="TINYINT" property="deleted" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId" />
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId" />
</resultMap>
<sql id="Base_Column_List">
id, super_admin_user_id, deleted, create_time, update_time, create_user_id, update_user_id
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from super_admin_config where
id = #{id,jdbcType=BIGINT}
</select>
<select id="isSuperAdmin" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from super_admin_config
where deleted = 0 and super_admin_user_id = #{userId} limit 1
</select>
</mapper>

View File

@@ -29,7 +29,7 @@
<!-- targetPackagemapper接口生成的位置 -->
<javaClientGenerator targetPackage="com.cool.store.mapper" targetProject="coolstore-partner-dao/src/main/java" type="XMLMAPPER" />
<table tableName="${table.name}" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
<table tableName="super_admin_config" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false">
<generatedKey column="id" sqlStatement="Mysql" identity="true" type=""/>
</table>

View File

@@ -0,0 +1,40 @@
package com.cool.store.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author Fun Li 2023/11/7 17:06
* @version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class HyPartnerInterviewBookSituation {
@ApiModelProperty("预约人数")
private Integer bookingCount;
@ApiModelProperty("预约的面试开始时间")
private String startTime;
@ApiModelProperty("预约的面试结束时间")
private String endTime;
@ApiModelProperty("是否已被预定成功")
private Boolean booked;
@ApiModelProperty("预约成功人的 partnerId")
private String bookedPartnerId;
public HyPartnerInterviewBookSituation(Integer bookingCount, Boolean booked) {
this.bookingCount = bookingCount;
this.booked = booked;
}
}

View File

@@ -0,0 +1,43 @@
package com.cool.store.entity;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* @author zhangchenbiao
* @date 2023-11-09 02:24
*/
@Table(name = "super_admin_config")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SuperAdminConfigDO implements Serializable {
@ApiModelProperty("")
private Long id;
@ApiModelProperty("超管用户ID")
private String superAdminUserId;
@ApiModelProperty("删除标志 0-正常 1-删除")
private Integer deleted;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("更新时间")
private Date updateTime;
@ApiModelProperty("新建人ID")
private String createUserId;
@ApiModelProperty("更新人ID")
private String updateUserId;
}

View File

@@ -7,7 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
public class CreateAppointmentReq {
@ApiModelProperty(value = "加盟商用户ID", required = true)
private String partnerId;
@ApiModelProperty(value = "面试官id")
@ApiModelProperty(value = "面试官idPC 端招商经理主动预约可以不传")
private String interviewerId;
@ApiModelProperty(value = "预约开始时间 (YYYY-MM-DD hh:mm:ss)", required = true)

View File

@@ -16,10 +16,12 @@ public class GetFreeBusyListReq {
private String startDate;
@ApiModelProperty(value = "结束时间",required = true)
private String endDate;
@ApiModelProperty("线索id(C端使用)")
@ApiModelProperty(value = "线索id", required = true)
private String lineId;
@ApiModelProperty("加盟商用户IDC端使用与面试官id两个字段中必传一个,该字段传值时线索id必传")
@ApiModelProperty(value = "加盟商用户ID", required = true)
private String partnerId;
@ApiModelProperty("面试官ID(B端使用,如果该字段传了,就查询该面试官的日程忙闲信息,否则查询加盟商对应的面试官的信息)")
@ApiModelProperty(value = "面试官ID", required = false)
private String interviewerId;
@ApiModelProperty(value = "是否是PC端请求", required = true)
private Boolean whetherPC;
}

View File

@@ -84,4 +84,11 @@ public class PartnerInterviewInfoVO {
@ApiModelProperty("来源名称")
private String userChannelName;
@ApiModelProperty("是否已被预约成功")
private Boolean booked;
@ApiModelProperty("该时间段面试预约人数")
private Integer appointmentCount;
}

View File

@@ -27,7 +27,7 @@ public class CalendarInfo {
@ApiModelProperty("日期字符串")
private String dateStr;
@ApiModelProperty("飞书日程忙闲清单")
@ApiModelProperty("忙闲清单")
private List<FreeBusyInfo> freeBusyList;
public CalendarInfo(Integer dayOfWeek, String year, String month, String day, String dateStr, List<FreeBusyInfo> freeBusyList) {

View File

@@ -13,6 +13,13 @@ public class CreateAppointmentVO {
@ApiModelProperty("面试安排id")
private String interviewPlanId;
public CreateAppointmentVO() {
}
public CreateAppointmentVO(String interviewPlanId) {
this.interviewPlanId = interviewPlanId;
}
public String getInterviewPlanId() {
return interviewPlanId;
}

View File

@@ -15,18 +15,43 @@ public class FreeBusyInfo {
private String endTime;
@ApiModelProperty("是否空闲")
private boolean isFree;
private boolean free;
public FreeBusyInfo(String startTime, String endTime, boolean isFree) {
@ApiModelProperty("预约人数")
private Integer appointmentCount;
@ApiModelProperty("是否被成功预约")
private Boolean booked;
@ApiModelProperty("是否是自己预约的时间段")
private Boolean selfBooked;
public FreeBusyInfo(String startTime, String endTime, boolean free) {
this.startTime = startTime;
this.endTime = endTime;
this.isFree = isFree;
this.free = free;
}
public FreeBusyInfo(String startTime, String endTime) {
this.startTime = startTime;
this.endTime = endTime;
this.isFree = isFree;
}
public FreeBusyInfo(String startTime, String endTime, boolean free, Integer appointmentCount, Boolean booked) {
this.startTime = startTime;
this.endTime = endTime;
this.free = free;
this.appointmentCount = appointmentCount;
this.booked = booked;
}
public FreeBusyInfo(String startTime, String endTime, boolean free, Integer appointmentCount, Boolean booked, Boolean selfBooked) {
this.startTime = startTime;
this.endTime = endTime;
this.free = free;
this.appointmentCount = appointmentCount;
this.booked = booked;
this.selfBooked = selfBooked;
}
public String getStartTime() {
@@ -45,11 +70,39 @@ public class FreeBusyInfo {
this.endTime = endTime;
}
public boolean isFree() {
return isFree;
public boolean getFree() {
return free;
}
public void setFree(boolean free) {
isFree = free;
this.free = free;
}
public Integer getAppointmentCount() {
return appointmentCount;
}
public void setAppointmentCount(Integer appointmentCount) {
this.appointmentCount = appointmentCount;
}
public Boolean getBooked() {
return booked;
}
public void setBooked(Boolean booked) {
this.booked = booked;
}
public boolean isFree() {
return free;
}
public Boolean getSelfBooked() {
return selfBooked;
}
public void setSelfBooked(Boolean selfBooked) {
this.selfBooked = selfBooked;
}
}

View File

@@ -127,4 +127,13 @@ public class InterviewVO {
@ApiModelProperty("所属战区id")
private String affiliationZone;
@ApiModelProperty("该时间段是否被预约成功")
private Boolean booked;
@ApiModelProperty("该时间段面试预约人数")
private Integer appointmentCount;
@ApiModelProperty("该时段是否是自己预约的(不一定代表预约成功)")
private Boolean selfBooked;
}

View File

@@ -233,8 +233,10 @@ public class ISVHttpRequest {
* @param userId
* @param startTime 开始时间 毫秒时间戳
* @param endTime 截止时间 毫秒时间戳
* @deprecated 1.5.2 后取消飞书日程的任何使用
* @return
*/
@Deprecated
public List<UserFreeBusyInfoDTO> getFreeBusyList(String userId, long startTime, long endTime) throws ApiException{
String url = isvDomain + "/user/getFreeBusyList";
HashMap requestMap = new HashMap();
@@ -259,8 +261,10 @@ public class ISVHttpRequest {
* 创建飞书日程
* @param param
* @return
* @deprecated 1.5.2 后取消操作飞书日程
* @throws ApiException
*/
@Deprecated
public UserCalendarsEventDTO createUserCalendarEvent(CreateCalendarEventDTO param) throws ApiException{
String url = isvDomain + "/user/createUserCalendarEvent";
ResultDTO responseEntity = null;
@@ -281,8 +285,10 @@ public class ISVHttpRequest {
* 更新飞书日程
* @param param
* @return
* @deprecated 1.5.2 后取消操作飞书日程
* @throws ApiException
*/
@Deprecated
public UserCalendarsEventDTO updateUserCalendarEvent(UpdateCalendarEventDTO param) throws ApiException{
String url = isvDomain + "/user/updateUserCalendarEvent";
ResultDTO responseEntity = null;
@@ -303,8 +309,10 @@ public class ISVHttpRequest {
* 取消飞书日程
* @param param
* @return
* @deprecated 1.5.2 后取消操作飞书日程
* @throws ApiException
*/
@Deprecated
public UserCalendarsEventDTO deleteUserCalendarEvent(DeleteCalendarEventDTO param) throws ApiException {
String url = isvDomain + "/user/deleteUserCalendarEvent";
ResultDTO responseEntity = null;
@@ -352,7 +360,9 @@ public class ISVHttpRequest {
/**
* 发送飞书卡片消息
* @param param
* @deprecated {@link EventCenterHttpRequest#sendFeiShuNotice(FeiShuNoticeMsgEnum, List, Object...)}
*/
@Deprecated
@Async
public void sendFeiShuCardMessage(SendCardMessageDTO param) throws ApiException{
if(CollectionUtils.isEmpty(param.getUserIds()) || StringUtils.isAnyBlank(param.getTitle(), param.getContent(), param.getMessageUrl()) || Objects.isNull(param.getMessageType())){

View File

@@ -47,8 +47,9 @@ public class JobHandler {
@XxlJob("updateInterviewOverTime")
public void updateInterviewOverTime(){
try {
log.info("面试超时预约定时任务开始");
hyPartnerInterviewPlanService.updateInterviewOverTime();
log.info("面试超时预约定时任务已取消,请勿再执行");
XxlJobHelper.log("面试超时预约定时任务已取消,请勿再执行");
// hyPartnerInterviewPlanService.updateInterviewOverTime();
log.info("面试超时预约定时任务结束");
XxlJobHelper.handleSuccess();
}catch (Exception e){

View File

@@ -33,6 +33,7 @@ public interface EnterpriseUserService {
List<EnterpriseUserSingleInfoVO> getDevelopmentDirectorList(String wantShopArea);
/**

View File

@@ -14,6 +14,11 @@ import javax.annotation.Resource;
* @Description:
*/
public interface FeiShuService {
/**
* @deprecated {@link com.cool.store.service.InterviewService#getFreeBusyList}
*/
@Deprecated
GetFreeBusyListVO getFreeBusyList(GetFreeBusyListReq request) throws ApiException;
}

View File

@@ -5,6 +5,7 @@ import com.cool.store.exception.ApiException;
import com.cool.store.request.*;
import com.cool.store.vo.EnterInterviewVO;
import com.cool.store.vo.interview.CreateAppointmentVO;
import com.cool.store.vo.interview.GetFreeBusyListVO;
import com.cool.store.vo.interview.InterviewVO;
import java.util.List;
@@ -71,4 +72,16 @@ public interface InterviewService {
public String generateFeiShuInterviewMsg(String partnerName, String partnerMobile, String interviewTime);
/**
* 获取预约时间段的预约信息
* @param request {@link GetFreeBusyListReq}
* @return {@link GetFreeBusyListVO}
*/
GetFreeBusyListVO getFreeBusyList(GetFreeBusyListReq request);
/**
* 招商经理主动预约面试
* @param request {@link com.cool.store.request.CreateAppointmentReq}
*/
CreateAppointmentVO bookInterview(CreateAppointmentReq request) throws ApiException;
}

View File

@@ -3,10 +3,12 @@ package com.cool.store.service;
import com.cool.store.dto.partner.EnterInterviewDto;
import com.cool.store.dto.partner.LineQueryInterviewDto;
import com.cool.store.exception.ApiException;
import com.cool.store.request.GetFreeBusyListReq;
import com.cool.store.request.ModifyInterviewTimeReq;
import com.cool.store.vo.EnterInterviewVO;
import com.cool.store.vo.PartnerInterviewInfoVO;
import com.cool.store.vo.PartnerPassLetterDetailVO;
import com.cool.store.vo.interview.GetFreeBusyListVO;
public interface PartnerInterviewService {
@@ -39,5 +41,10 @@ public interface PartnerInterviewService {
void modifyInterviewTime(ModifyInterviewTimeReq request) throws ApiException;
/**
* 获取面试预约时间列表
* @param request {@link GetFreeBusyListReq}
* @return {@link GetFreeBusyListVO}
*/
GetFreeBusyListVO getFreeBusyList(GetFreeBusyListReq request);
}

View File

@@ -57,13 +57,21 @@ public class CommonServiceImpl implements CommonService {
Long partnerLineId = hyPartnerLineInfoDO.getId();
if ((workflowStage.equals(WorkflowStageEnum.RESERVATION.getCode()) && workflowStatus.equals(WorkflowStatusEnum.RESERVATION_1.getCode()))||
(workflowStage.equals(WorkflowStageEnum.INTERVIEW.getCode()) && workflowStatus.equals(WorkflowStatusEnum.INTERVIEW_2.getCode()))) {
return getInterviewTips(partnerLineId, OperateTypeEnum.INTERVIEW_APPOINTMENT, "提交面试预约时间");
String interviewAppointmentTips = getInterviewTips(partnerLineId, OperateTypeEnum.INTERVIEW_APPOINTMENT, "提交面试预约时间");
if (StringUtils.isEmpty(interviewAppointmentTips)) {
interviewAppointmentTips = getInterviewTips(partnerLineId, OperateTypeEnum.INTERVIEWER_BOOK_INTERVIEW, "提交面试预约时间");
}
return interviewAppointmentTips;
} else if (workflowStage.equals(WorkflowStageEnum.INTERVIEW.getCode()) && workflowStatus.equals(WorkflowStatusEnum.INTERVIEW_3.getCode())) {
String tips = getInterviewTips(partnerLineId, OperateTypeEnum.MODIFY_INTERVIEW_TIME, "");
if (StringUtils.isNotEmpty(tips)) {
return tips + ("修改面试预约时间");
} else {
return getInterviewTips(partnerLineId, OperateTypeEnum.INTERVIEW_APPOINTMENT, "提交面试预约时间");
String interviewAppointmentTips = getInterviewTips(partnerLineId, OperateTypeEnum.INTERVIEW_APPOINTMENT, "提交面试预约时间");
if (StringUtils.isEmpty(interviewAppointmentTips)) {
interviewAppointmentTips = getInterviewTips(partnerLineId, OperateTypeEnum.INTERVIEWER_BOOK_INTERVIEW, "提交面试预约时间");
}
return interviewAppointmentTips;
}
} else if (workflowStage.equals(WorkflowStageEnum.INTERVIEW.getCode()) && workflowStatus.equals(WorkflowStatusEnum.INTERVIEW_4.getCode())) {
return getInterviewTips(partnerLineId, OperateTypeEnum.FINISH_INTERVIEW, "结束面试");

View File

@@ -42,6 +42,14 @@ public class FeiShuServiceImpl implements FeiShuService {
@Autowired
private InterviewService interviewService;
/**
*
* @param request
* @return
* @throws ApiException
* @deprecated {@link com.cool.store.service.impl.InterviewServiceImpl#getFreeBusyList}
*/
@Deprecated
@Override
public GetFreeBusyListVO getFreeBusyList(GetFreeBusyListReq request) throws ApiException {
GetFreeBusyListVO freeBusyListVO = new GetFreeBusyListVO();

View File

@@ -152,6 +152,17 @@ public class HyPartnerInterviewPlanServiceImpl implements HyPartnerInterviewPlan
Map<Long, HyPartnerLineInfoDO> hyPartnerLineInfoDOMap = hyPartnerLineInfoDOS.stream().collect(Collectors.toMap(HyPartnerLineInfoDO::getId, data -> data));
List<String> userPortraitList = list.stream().filter(x -> StringUtils.isNotEmpty(x.getUserPortrait() )).map(PartnerInterviewInfoDTO::getUserPortrait).collect(Collectors.toList());
Map<Long, String> userPortraitMap = labelService.getUserPortraitMap(userPortraitList);
//获取对应时间段的预约情况
Map<String, HyPartnerInterviewBookSituation> orderSituationMap;
if (CommonConstants.PENDING.equals(type)) {
Optional<PartnerInterviewInfoDTO> minInterviewStartTime = list.stream().min((info1, info2) -> info1.getStartTime().compareTo(info2.getStartTime()));
Optional<PartnerInterviewInfoDTO> maxInterviewEndTime = list.stream().max((info1, info2) -> info1.getEndTime().compareTo(info2.getEndTime()));
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<HyPartnerInterviewBookSituation> interviewBookSituation = hyPartnerInterviewPlanMapper.getInterviewBookSituation(userId, dateFormat.format(minInterviewStartTime.get().getStartTime()), dateFormat.format(maxInterviewEndTime.get().getEndTime()));
orderSituationMap = interviewBookSituation.stream().collect(Collectors.toMap(HyPartnerInterviewBookSituation::getStartTime, situation -> situation));
} else {
orderSituationMap = new HashMap<>();
}
list.stream().forEach(x->{
PartnerInterviewInfoVO partnerInterviewInfoVO = convertPartnerInterviewInfoDTOToVo(x,userPortraitMap,userNameMap.get(x.getPartnerId()),channelMap);
partnerInterviewInfoVO.setPartnerName(userNameMap.getOrDefault(x.getPartnerId(),new HyPartnerUserInfoDO()).getUsername());
@@ -160,6 +171,14 @@ public class HyPartnerInterviewPlanServiceImpl implements HyPartnerInterviewPlan
partnerInterviewInfoVO.setInterviewerPhone(interviewerUserMap.getOrDefault(x.getInterviewer(),new EnterpriseUserDO()).getMobile());
partnerInterviewInfoVO.setLineStatus(hyPartnerLineInfoDOMap.getOrDefault(x.getPartnerLineId(),new HyPartnerLineInfoDO()).getLineStatus());
partnerInterviewInfoVO.setLineId(hyPartnerLineInfoDOMap.getOrDefault(x.getPartnerLineId(),new HyPartnerLineInfoDO()).getId());
if (CommonConstants.PENDING.equals(type)) {
//设置对应时间段的被预约情况
HyPartnerInterviewBookSituation bookSituation = orderSituationMap.getOrDefault(partnerInterviewInfoVO.getStartTime().replace("/", "-"), new HyPartnerInterviewBookSituation(0, Boolean.FALSE));
//预约人数
partnerInterviewInfoVO.setAppointmentCount(bookSituation.getBookingCount());
//是否被预约
partnerInterviewInfoVO.setBooked(bookSituation.getBooked());
}
result.add(partnerInterviewInfoVO);
});
partnerInterviewInfoList.setList(result);

View File

@@ -99,6 +99,8 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
HyFollowTaskDAO hyFollowTaskDAO;
@Resource
private HyPartnerIntentInfoDAO hyPartnerIntentInfoDAO;
@Resource
SuperAdminConfigDAO superAdminConfigDAO;
@Autowired
private WechatMiniAppService wechatMiniAppService;
@@ -631,10 +633,19 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
@Override
public PageInfo<PrivateSeaLineListVo> privateSeaLineList(String userId, PrivateSeaLineListRequest request,Boolean allPrivateSeaFlag) {
//allPrivateSeaFlag 为true的时候 查询全量私海
// V1.5.2 修改allPrivateSeaFlag 为False 查询我的线索 为true时根据是否是超管或者主管查询数据
UserPositionAndUserScopeDTO userIdsByScope = new UserPositionAndUserScopeDTO();
if (!allPrivateSeaFlag){
//如果是查询团队线索 判断是否是超管 不是超管 判断是是否是主管
if (allPrivateSeaFlag){
//如果不是超管 查询个人数据或者主管数据 如果是超管 查询所有数据
if (!isSuperAdmin(userId)){
userIdsByScope = enterpriseUserService.getUserIdsByScope(userId);
}
}else {
//如果是查询我的线索 只需要查询招商经理或者开发经理是我的线索
userIdsByScope.setDevelopmentUserIds(Arrays.asList(userId));
userIdsByScope.setInvestmentUserIds(Arrays.asList(userId));
}
String intentAreaName = getIntentAreaName(request.getIntentAreaId());
PageHelper.startPage(request.getPageNum(),request.getPageSize());
PageInfo privateLineList = new PageInfo(hyPartnerLineInfoDAO.getPrivateSeaLineList(request.getKeyword(), request.getKeywordType(), request.getWorkflowStage(),
@@ -670,6 +681,15 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
return privateLineList;
}
private Boolean isSuperAdmin(String userId){
SuperAdminConfigDO superAdmin = superAdminConfigDAO.isSuperAdmin(userId);
if (superAdmin!=null){
return Boolean.TRUE;
}
return Boolean.FALSE;
}
@Override
public PartnerLineBaseInfoVO getPartnerLinBaseInfo(String partnerId) {
PartnerLineBaseInfoVO lineBaseInfoVO = new PartnerLineBaseInfoVO();

View File

@@ -5,8 +5,6 @@ import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.context.PartnerUserHolder;
@@ -15,7 +13,6 @@ import com.cool.store.dao.HyIntendDevMappingDAO;
import com.cool.store.dao.HyInterviewDAO;
import com.cool.store.dto.calendar.*;
import com.cool.store.dto.log.*;
import com.cool.store.dto.message.SendCardMessageDTO;
import com.cool.store.dto.partner.EnterInterviewDto;
import com.cool.store.entity.*;
import com.cool.store.enums.*;
@@ -32,8 +29,7 @@ import com.cool.store.utils.TRTCUtils;
import com.cool.store.vo.EnterInterviewVO;
import com.cool.store.vo.EnterpriseUserBaseInfoVO;
import com.cool.store.vo.PartnerUserInfoVO;
import com.cool.store.vo.interview.CreateAppointmentVO;
import com.cool.store.vo.interview.InterviewVO;
import com.cool.store.vo.interview.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@@ -43,6 +39,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@@ -83,7 +80,6 @@ public class InterviewServiceImpl implements InterviewService {
@Autowired
private EnterpriseUserService enterpriseUserService;
// @Autowired
// private SmsService smsService;
@@ -125,7 +121,7 @@ public class InterviewServiceImpl implements InterviewService {
vo.setVideoList(split);
vo.setProcessInfo("");
}
//查询面试官和记录人信息(面试官必须有)
//1. 查询面试官和记录人信息(面试官必须有)
EnterpriseUserBaseInfoVO interviewerInfo = hyPartnerInterviewPlanMapper.getEnterpriseUserBaseInfo(vo.getInterviewerId());
vo.setInterviewerName(interviewerInfo.getName());
vo.setInterviewerMobile(interviewerInfo.getMobile());
@@ -136,10 +132,10 @@ public class InterviewServiceImpl implements InterviewService {
vo.setRecorderMobile(recorderInfo.getMobile());
}
}
//查询开发主管信息
//2. 查询开发主管信息
if (request.getNeedDevelopmentDirector() != null && request.getNeedDevelopmentDirector()) {
//查询所属战区
String wantShopArea = hyPartnerLineInfoMapper.getAffiliationZoneIdByInterviewPlanId(interviewPlanId);
HyIntendDevelopementMappingDO hyIntendDevelopementMappingDO = hyIntendDevMappingDAO.selectByOpenAreaMappingId(Long.valueOf(wantShopArea), "dev");
if (hyIntendDevelopementMappingDO == null) {
@@ -149,6 +145,21 @@ public class InterviewServiceImpl implements InterviewService {
EnterpriseUserDO development = enterpriseUserService.getDevelopmentByZoneId(hyIntendDevelopementMappingDO.getMappingId());
vo.setDevelopmentDirector(development);
}
//3. 查询该时段预约情况
//如果还未提交预约申请就没有预约情况,面试完成以后也必要查询了
if (!vo.getStatus().equals(Integer.parseInt(WorkflowStatusEnum.INTERVIEW_2.getCode()))
&& !vo.getStatus().equals(Integer.parseInt(WorkflowStatusEnum.INTERVIEW_3.getCode()))
&& !vo.getStatus().equals(Integer.parseInt(WorkflowStatusEnum.RESERVATION_1.getCode()))) {
return vo;
}
List<HyPartnerInterviewBookSituation> bookSituations = hyPartnerInterviewPlanMapper.getInterviewBookSituation(vo.getInterviewerId(), vo.getStartTime(), vo.getEndTime());
if (CollectionUtils.isNotEmpty(bookSituations)) {
HyPartnerInterviewBookSituation bookSituation = bookSituations.get(0);
vo.setBooked(bookSituation.getBooked());
vo.setSelfBooked(Boolean.TRUE);
vo.setAppointmentCount(bookSituation.getBookingCount());
}
return vo;
}
@@ -187,35 +198,36 @@ public class InterviewServiceImpl implements InterviewService {
// throw new ApiException(ErrorCodeEnum.FEISHU_DELETE_SCHEDULE_ERROR);
// }
//1.5.2 后不再使用飞书日程
//有可能还未同意面试预约,这时候没有建立日程,只需要修改面试官
//1.4 优化多次转让,线索转让次数 >= 1 无需添加日程,只转让线索的招商经理及面试官
Integer transferTimes = hyPartnerLineInfoMapper.getTransferTimes(request.getPartnerLineId());
if (interviewInfo.getFeishuCalendarId() != null && interviewInfo.getFeishuScheduleId() != null
&& transferTimes < 1) {
//V1.3 需求变更为将新面试官拉入原面试官日程,而非删除和新增日程
//1. 原面试官面试日程信息
String oldInterviewerId = CurrentUserHolder.getUserId();
UpdateCalendarEventDTO updateCalendarEventDTO = new UpdateCalendarEventDTO();
updateCalendarEventDTO.setUserId(oldInterviewerId);
updateCalendarEventDTO.setCalendarId(interviewInfo.getFeishuCalendarId());
updateCalendarEventDTO.setEventId(interviewInfo.getFeishuScheduleId());
updateCalendarEventDTO.setStartTime(DateUtil.parse(interviewInfo.getStartTime()).getTime());
updateCalendarEventDTO.setEndTime(DateUtil.parse(interviewInfo.getEndTime()).getTime());
updateCalendarEventDTO.setSummary(generateInterviewTitle(request.getPartnerLineId()));
//2. 邀请新面试官加入日程
List<String> list = new ArrayList();
list.add(request.getNewInterviewerId());
//当前招商经理不是面试官,但是日程在招商经理这里
if (!oldInterviewerId.equals(list.get(0))) {
list.add(oldInterviewerId);
}
updateCalendarEventDTO.setJoinUserIds(list);
UserCalendarsEventDTO userCalendarsEventDTO = isvHttpRequest.updateUserCalendarEvent(updateCalendarEventDTO);
if(userCalendarsEventDTO == null ){
throw new ApiException(ErrorCodeEnum.FEISHU_UPDATE_SCHEDULE_ERROR);
}
}
// Integer transferTimes = hyPartnerLineInfoMapper.getTransferTimes(request.getPartnerLineId());
// if (interviewInfo.getFeishuCalendarId() != null && interviewInfo.getFeishuScheduleId() != null
// && transferTimes < 1) {
// //V1.3 需求变更为将新面试官拉入原面试官日程,而非删除和新增日程
// //1. 原面试官面试日程信息
// String oldInterviewerId = CurrentUserHolder.getUserId();
// UpdateCalendarEventDTO updateCalendarEventDTO = new UpdateCalendarEventDTO();
// updateCalendarEventDTO.setUserId(oldInterviewerId);
// updateCalendarEventDTO.setCalendarId(interviewInfo.getFeishuCalendarId());
// updateCalendarEventDTO.setEventId(interviewInfo.getFeishuScheduleId());
// updateCalendarEventDTO.setStartTime(DateUtil.parse(interviewInfo.getStartTime()).getTime());
// updateCalendarEventDTO.setEndTime(DateUtil.parse(interviewInfo.getEndTime()).getTime());
// updateCalendarEventDTO.setSummary(generateInterviewTitle(request.getPartnerLineId()));
//
// //2. 邀请新面试官加入日程
// List<String> list = new ArrayList();
// list.add(request.getNewInterviewerId());
// //当前招商经理不是面试官,但是日程在招商经理这里
// if (!oldInterviewerId.equals(list.get(0))) {
// list.add(oldInterviewerId);
// }
// updateCalendarEventDTO.setJoinUserIds(list);
// UserCalendarsEventDTO userCalendarsEventDTO = isvHttpRequest.updateUserCalendarEvent(updateCalendarEventDTO);
// if(userCalendarsEventDTO == null ){
// throw new ApiException(ErrorCodeEnum.FEISHU_UPDATE_SCHEDULE_ERROR);
// }
// }
// 3.面试信息计划变更
HyPartnerInterviewPlanDO record = new HyPartnerInterviewPlanDO();
@@ -266,38 +278,39 @@ public class InterviewServiceImpl implements InterviewService {
throw new ApiException(ErrorCodeEnum.ROOM_STATUS_ERROR);
}
HyPartnerInterviewPlanDO record = new HyPartnerInterviewPlanDO();
//被委托或者因转让导致的面试官变更的线索不操作日程
Integer transferTimes = hyPartnerLineInfoMapper.getTransferTimes(interviewInfo.getPartnerLineId());
if(transferTimes==0&&StringUtils.isNotEmpty(interviewInfo.getFeishuCalendarId())&&StringUtils.isNotEmpty(interviewInfo.getFeishuScheduleId())) {
//1.原面试官日程删除
DeleteCalendarEventDTO deleteCalendarEventDTO = new DeleteCalendarEventDTO();
deleteCalendarEventDTO.setCalendarId(interviewInfo.getFeishuCalendarId());
deleteCalendarEventDTO.setEventId(interviewInfo.getFeishuScheduleId());
deleteCalendarEventDTO.setUserId(interviewInfo.getInterviewerId());
UserCalendarsEventDTO userCalendarsEventDTO = isvHttpRequest.deleteUserCalendarEvent(deleteCalendarEventDTO);
if (userCalendarsEventDTO == null) {
throw new ApiException(ErrorCodeEnum.FEISHU_DELETE_SCHEDULE_ERROR);
}
//2.新面试官日程新增
CreateCalendarEventDTO createCalendarEventDTO = new CreateCalendarEventDTO();
createCalendarEventDTO.setStartTime(DateUtil.parse(request.getNewStartBookingTime()).getTime());
createCalendarEventDTO.setEndTime(DateUtil.parse(request.getNewEndBookingTime()).getTime());
createCalendarEventDTO.setUserId(interviewInfo.getInterviewerId());
List<String> list = Arrays.asList(interviewInfo.getInterviewerId());
//可能当前招商经理不是面试官,但是日程在招商经理这里
String userId = CurrentUserHolder.getUserId();
if (!userId.equals(list.get(0))) {
list.add(userId);
}
createCalendarEventDTO.setJoinUserIds(list);
createCalendarEventDTO.setSummary(generateInterviewTitle(interviewInfo.getPartnerLineId()));
UserCalendarsEventDTO userCalendarEvent = isvHttpRequest.createUserCalendarEvent(createCalendarEventDTO);
if (userCalendarEvent == null) {
throw new ApiException(ErrorCodeEnum.CREATE_CALENDAR_EVENT_FAIL);
}
record.setFeishuCalendarId(userCalendarEvent.getCalendarId());
record.setFeishuScheduleId(userCalendarEvent.getEventId());
}
//1.5.2 后不再使用飞书日程
// //被委托或者因转让导致的面试官变更的线索不操作日程
// Integer transferTimes = hyPartnerLineInfoMapper.getTransferTimes(interviewInfo.getPartnerLineId());
// if(transferTimes==0&&StringUtils.isNotEmpty(interviewInfo.getFeishuCalendarId())&&StringUtils.isNotEmpty(interviewInfo.getFeishuScheduleId())) {
// //1.原面试官日程删除
// DeleteCalendarEventDTO deleteCalendarEventDTO = new DeleteCalendarEventDTO();
// deleteCalendarEventDTO.setCalendarId(interviewInfo.getFeishuCalendarId());
// deleteCalendarEventDTO.setEventId(interviewInfo.getFeishuScheduleId());
// deleteCalendarEventDTO.setUserId(interviewInfo.getInterviewerId());
// UserCalendarsEventDTO userCalendarsEventDTO = isvHttpRequest.deleteUserCalendarEvent(deleteCalendarEventDTO);
// if (userCalendarsEventDTO == null) {
// throw new ApiException(ErrorCodeEnum.FEISHU_DELETE_SCHEDULE_ERROR);
// }
// //2.新面试官日程新增
// CreateCalendarEventDTO createCalendarEventDTO = new CreateCalendarEventDTO();
// createCalendarEventDTO.setStartTime(DateUtil.parse(request.getNewStartBookingTime()).getTime());
// createCalendarEventDTO.setEndTime(DateUtil.parse(request.getNewEndBookingTime()).getTime());
// createCalendarEventDTO.setUserId(interviewInfo.getInterviewerId());
// List<String> list = Arrays.asList(interviewInfo.getInterviewerId());
// //可能当前招商经理不是面试官,但是日程在招商经理这里
// String userId = CurrentUserHolder.getUserId();
// if (!userId.equals(list.get(0))) {
// list.add(userId);
// }
// createCalendarEventDTO.setJoinUserIds(list);
// createCalendarEventDTO.setSummary(generateInterviewTitle(interviewInfo.getPartnerLineId()));
// UserCalendarsEventDTO userCalendarEvent = isvHttpRequest.createUserCalendarEvent(createCalendarEventDTO);
// if (userCalendarEvent == null) {
// throw new ApiException(ErrorCodeEnum.CREATE_CALENDAR_EVENT_FAIL);
// }
// record.setFeishuCalendarId(userCalendarEvent.getCalendarId());
// record.setFeishuScheduleId(userCalendarEvent.getEventId());
// }
record.setId(Long.valueOf(request.getInterviewPlanId()));
record.setStartTime(Convert.toDate(request.getNewStartBookingTime()));
@@ -530,26 +543,23 @@ public class InterviewServiceImpl implements InterviewService {
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,partnerBaseInfo.getUsername(),partnerBaseInfo.getMobile());
}
//创建日程信息
CreateCalendarEventDTO createCalendarEventDTO = new CreateCalendarEventDTO();
createCalendarEventDTO.setStartTime(DateUtil.parse(interviewVO.getStartTime()).getTime());
createCalendarEventDTO.setEndTime(DateUtil.parse(interviewVO.getEndTime()).getTime());
createCalendarEventDTO.setUserId(request.getInterviewerId());
createCalendarEventDTO.setJoinUserIds(Arrays.asList(request.getInterviewerId()));
createCalendarEventDTO.setSummary(generateInterviewTitle(request.getPartnerLineId()));
UserCalendarsEventDTO userCalendarEvent = isvHttpRequest.createUserCalendarEvent(createCalendarEventDTO);
if (userCalendarEvent == null || StringUtil.isEmpty(userCalendarEvent.getEventId())) {
throw new ServiceException(ErrorCodeEnum.CREATE_CALENDAR_EVENT_FAIL);
}
// CreateCalendarEventDTO createCalendarEventDTO = new CreateCalendarEventDTO();
// createCalendarEventDTO.setStartTime(DateUtil.parse(interviewVO.getStartTime()).getTime());
// createCalendarEventDTO.setEndTime(DateUtil.parse(interviewVO.getEndTime()).getTime());
// createCalendarEventDTO.setUserId(request.getInterviewerId());
// createCalendarEventDTO.setJoinUserIds(Arrays.asList(request.getInterviewerId()));
// createCalendarEventDTO.setSummary(generateInterviewTitle(request.getPartnerLineId()));
// UserCalendarsEventDTO userCalendarEvent = isvHttpRequest.createUserCalendarEvent(createCalendarEventDTO);
// if (userCalendarEvent == null || StringUtil.isEmpty(userCalendarEvent.getEventId())) {
// throw new ServiceException(ErrorCodeEnum.CREATE_CALENDAR_EVENT_FAIL);
// }
//更新面试计划信息
HyPartnerInterviewPlanDO record = new HyPartnerInterviewPlanDO();
record.setId(Long.valueOf(request.getInterviewPlanId()));
record.setFeishuCalendarId(userCalendarEvent.getCalendarId());
record.setFeishuScheduleId(userCalendarEvent.getEventId());
// record.setFeishuCalendarId(userCalendarEvent.getCalendarId());
// record.setFeishuScheduleId(userCalendarEvent.getEventId());
record.setApplicationApproved(1);
//如果同意的时候已经超过预约的时间前 5 分钟,直接进入面试已开始阶段
DateTime interviewStartTime = DateUtil.offsetMinute(DateUtil.parseDateTime(interviewVO.getStartTime()), -5);
@@ -692,4 +702,176 @@ public class InterviewServiceImpl implements InterviewService {
hyPartnerInterviewPlanMapper.updateByPrimaryKeySelective(hyPartnerInterviewPlanDO);
}
@Override
public GetFreeBusyListVO getFreeBusyList(GetFreeBusyListReq request) {
//1. 处理数据
//1.1 传参整理
GetFreeBusyListVO freeBusyListVO = new GetFreeBusyListVO();
String startDate = request.getStartDate();//开始日期
String endDate = request.getEndDate();//结束日期
String partnerId = request.getPartnerId();//加盟商用户ID
String interviewerId = null;//面试官ID
String lineId = request.getLineId();//线索id
//如果加盟商用户ID为空且面试官ID为空返回错误信息
if (!(StringUtils.isNotEmpty(partnerId) && StringUtils.isNotEmpty(lineId)) && StringUtils.isEmpty(interviewerId)) {
throw new ServiceException(ErrorCodeEnum.INTERVIEW_AND_PARTNER_ID_IS_NULL);
}
//如果加盟商用户ID不为空且面试官ID为空
if (StringUtils.isNotEmpty(partnerId) && StringUtils.isNotEmpty(lineId)) {
interviewerId = getInterviewerByPartner(partnerId, lineId);
}
//1.2 时间转换
DateTime startDateTime = null;
DateTime endDateTime = null;
if (!StringUtils.isEmpty(startDate)&&!StringUtils.isEmpty(endDate)) {
startDateTime = DateUtil.beginOfDay(DateUtil.parse(startDate));
endDateTime = DateUtil.endOfDay(DateUtil.parse(endDate));
}
//1.3 校验时间
if (startDateTime.isAfter(endDateTime)) {
throw new ServiceException(ErrorCodeEnum.DATE_PARAMS_IS_ERROR);
}
//2. 查询招商经理各个已被预约时间段(成功或未成功)的预约情况
//2.1 PC 端和小程序查询的开始和结束时间不同
String startTimeSuffix = " 10:00:00";
String endTimeSuffix = " 17:00:00";
if (Boolean.TRUE.equals(request.getWhetherPC())) {
startTimeSuffix = " 00:00:00";
endTimeSuffix = " 23:59:59";
}
String startTimeStr = DateUtil.format(startDateTime, "yyyy-MM-dd") + startTimeSuffix;
String endTimeStr = DateUtil.format(endDateTime, "yyyy-MM-dd") + endTimeSuffix;
List<HyPartnerInterviewBookSituation> bookSituations = hyPartnerInterviewPlanMapper.getInterviewBookSituation(interviewerId, startTimeStr, endTimeStr);
//2.2 查询该线索已有的面试预约开始时间
HyPartnerInterviewPlanDO interviewPlanDO = new HyPartnerInterviewPlanDO();
interviewPlanDO.setPartnerId(request.getPartnerId());
interviewPlanDO.setDeleted(false);
List<HyPartnerInterviewPlanDO> hyPartnerInterviewPlanDOS = hyPartnerInterviewPlanMapper.selectBySelective(interviewPlanDO);
String partnerAppointStartTime = "";
if (CollectionUtils.isNotEmpty(hyPartnerInterviewPlanDOS)) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
interviewPlanDO = hyPartnerInterviewPlanDOS.get(0);
partnerAppointStartTime = dateFormat.format(interviewPlanDO.getStartTime());
}
//3. 把数据装到各个时间槽里
//3.1 创建时间槽
// PC 端创建 8:00-24:00 的时间槽
// 小程序端创建 10:00-17:00 的时间槽并且不包含中午 12:00-13:00
List<CalendarInfo> daySlots;
if (request.getWhetherPC().equals(Boolean.TRUE)) {
daySlots = TimeSlotGenerator.generateDaySlotsForPc(startTimeStr, endTimeStr);
} else {
daySlots = TimeSlotGenerator.generateDaySlots(startTimeStr, endTimeStr);
}
freeBusyListVO.setCalendarList(daySlots);
//3.2 如果查询结果为空,则直接返回全部时间段都是空闲的
if (org.springframework.util.CollectionUtils.isEmpty(bookSituations)) {
return freeBusyListVO;
}
//3.3 装到槽里并返回
//3.3.1 外层循环每一天
for (CalendarInfo daySlot : daySlots) {
//3.3.2 内存循环每一天的每个时间段
List<FreeBusyInfo> freeBusyList = daySlot.getFreeBusyList();
for (FreeBusyInfo freeBusyInfo : freeBusyList) {
//把日期和时间拼接成yyyy-MM-dd HH:mm格式
String startStr = daySlot.getDateStr() + " " + freeBusyInfo.getStartTime() + ":00";
String endStr = daySlot.getDateStr() + " " + freeBusyInfo.getEndTime() + ":00";
for (HyPartnerInterviewBookSituation bookSituation : bookSituations) {
//比较两个时间段是否有重叠,重叠的就 set 数据进去
if (startStr.compareTo(bookSituation.getStartTime()) >= 0 && endStr.compareTo(bookSituation.getEndTime()) <= 0) {
freeBusyInfo.setBooked(bookSituation.getBooked());
freeBusyInfo.setSelfBooked(partnerAppointStartTime.equals(bookSituation.getStartTime()));
freeBusyInfo.setFree(!bookSituation.getBooked());
freeBusyInfo.setAppointmentCount(bookSituation.getBookingCount());
bookSituations.remove(bookSituation);
break;
}
}
}
}
return freeBusyListVO;
}
@Transactional
@Override
public CreateAppointmentVO bookInterview(CreateAppointmentReq request) throws ApiException {
if(request.getPartnerLineId() == null || request.getPartnerLineId()<=0){
throw new ApiException(ErrorCodeEnum.INTERVIEW_LINE_ID_IS_NULL);
}
//如果开始时间小于当前时间需要报错
if(DateUtil.date().isAfter(DateUtil.parse(request.getStartBookingTime()))){
throw new ApiException(ErrorCodeEnum.CREATE_APPOINTMENT_TIME_ERROR);
}
HyPartnerInterviewPlanDO hyPartnerInterviewPlanDO = new HyPartnerInterviewPlanDO();
hyPartnerInterviewPlanDO.setPartnerLineId(request.getPartnerLineId());
hyPartnerInterviewPlanDO.setDeleted(false);
List<HyPartnerInterviewPlanDO> hyPartnerInterviewPlanDOS = hyPartnerInterviewPlanMapper.selectBySelective(hyPartnerInterviewPlanDO);
if(CollectionUtils.isNotEmpty(hyPartnerInterviewPlanDOS)&&hyPartnerInterviewPlanDOS.get(0).getId()!=null){
throw new ApiException(ErrorCodeEnum.INTERVIEW_PLAN_ALREADY_EXIST);
}
String interviewrId = request.getInterviewerId();
if(StringUtils.isEmpty(interviewrId)){
interviewrId = getInterviewerByPartner(request.getPartnerId(),String.valueOf(request.getPartnerLineId()));
}
//1.创建面试计划
Date now = new Date();
HyPartnerInterviewPlanDO interviewPlanDO = new HyPartnerInterviewPlanDO();
String startBookingTime = request.getStartBookingTime();
String startDate = startBookingTime.substring(0, 10);
interviewPlanDO.setInterviewDate(Convert.toDate(startDate));
interviewPlanDO.setCreateTime(now);
interviewPlanDO.setUpdateTime(now);
interviewPlanDO.setStartTime(Convert.toDate(request.getStartBookingTime()));
interviewPlanDO.setEndTime(Convert.toDate(request.getEndBookingTime()));
interviewPlanDO.setPartnerId(request.getPartnerId());
interviewPlanDO.setPartnerLineId(request.getPartnerLineId());
interviewPlanDO.setInterviewer(interviewrId);
interviewPlanDO.setIsPartnerInterview(0);
interviewPlanDO.setApplicationApproved(1);
//1.2 生成房间号
interviewPlanDO.setRoomId(StringUtil.generateRoomId(startBookingTime));
interviewPlanDO.setRoomStatus(RoomStatus.WAIT_FOR_OPEN.getCode());
hyPartnerInterviewPlanMapper.insertSelective(interviewPlanDO);
//2.创建面试信息
HyPartnerInterviewDO hyPartnerInterviewDO = new HyPartnerInterviewDO();
hyPartnerInterviewDO.setInterviewPlanId(interviewPlanDO.getId());
hyPartnerInterviewDO.setStatus(Integer.parseInt(WorkflowStatusEnum.INTERVIEW_2.getCode()));
hyPartnerInterviewDO.setPartnerLineId(request.getPartnerLineId());
hyPartnerInterviewDO.setPartnerId(request.getPartnerId());
hyPartnerInterviewDO.setInterviewer(interviewrId);
hyPartnerInterviewDO.setCreateTime(now);
hyPartnerInterviewDO.setUpdateTime(now);
hyPartnerInterviewDO.setDeleted(false);
HyPartnerLineInfoDO hyPartnerLineDO = new HyPartnerLineInfoDO();
hyPartnerInterviewDO.setUpdateTime(now);
hyPartnerInterviewMapper.insertSelective(hyPartnerInterviewDO);
//3. 修改线索流程状态
hyPartnerLineDO.setId(request.getPartnerLineId());
hyPartnerLineDO.setUpdateTime(now);
hyPartnerLineDO.setWorkflowStage(WorkflowStageEnum.INTERVIEW.getCode());
hyPartnerLineDO.setWorkflowStatus(WorkflowStatusEnum.INTERVIEW_2.getCode());
hyPartnerLineInfoMapper.updateByPrimaryKeySelective(hyPartnerLineDO);
//4. 异步发送短信给加盟商
HyPartnerBaseInfoDO partnerBaseInfo = hyPartnerBaseInfoMapper.getByPartnerLineId(request.getPartnerLineId());
if(partnerBaseInfo == null){
throw new ServiceException(ErrorCodeEnum.INTERVIEW_PARTNER_NOT_EXIST);
}
eventCenterHttpRequest.sendSmsVariable(partnerBaseInfo.getMobile(), SMSMsgEnum.INTERVIEW_APPOINTMENT_PASS, DateUtil.format(DateUtil.parseDateTime(request.getStartBookingTime()), DatePattern.NORM_DATETIME_MINUTE_PATTERN), wechatMiniAppService.getMiniAppUrl());
//5. 记录日志
PartnerUserInfoVO operator = PartnerUserHolder.getUser();
LogBasicDTO log = LogBasicDTO.builder().mobile(operator.getMobile()).operateUserId(operator.getPartnerId()).operateUsername(operator.getUsername()).operateTime(DateUtil.format(new Date(), CoolDateUtils.DATE_FORMAT_SEC)).mobile(operator.getMobile()).build();
logService.recordPartnerBizLog(operator, request.getPartnerLineId(), OperateTypeEnum.INTERVIEWER_BOOK_INTERVIEW,log);
return new CreateAppointmentVO(interviewPlanDO.getId().toString());
}
}

View File

@@ -8,6 +8,7 @@ import com.cool.store.dao.HyInterviewDAO;
import com.cool.store.dto.log.ModifyInterviewTimeDTO;
import com.cool.store.dto.partner.EnterInterviewDto;
import com.cool.store.dto.partner.LineQueryInterviewDto;
import com.cool.store.entity.HyPartnerInterviewBookSituation;
import com.cool.store.entity.HyPartnerInterviewDO;
import com.cool.store.entity.HyPartnerInterviewPlanDO;
import com.cool.store.enums.ErrorCodeEnum;
@@ -18,7 +19,9 @@ import com.cool.store.exception.ApiException;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.HyPartnerInterviewMapper;
import com.cool.store.mapper.HyPartnerInterviewPlanMapper;
import com.cool.store.request.GetFreeBusyListReq;
import com.cool.store.request.ModifyInterviewTimeReq;
import com.cool.store.service.InterviewService;
import com.cool.store.service.LogService;
import com.cool.store.service.PartnerInterviewService;
import com.cool.store.utils.CoolDateUtils;
@@ -27,14 +30,21 @@ import com.cool.store.vo.EnterInterviewVO;
import com.cool.store.vo.PartnerInterviewInfoVO;
import com.cool.store.vo.PartnerPassLetterDetailVO;
import com.cool.store.vo.PartnerUserInfoVO;
import com.cool.store.vo.interview.CalendarInfo;
import com.cool.store.vo.interview.FreeBusyInfo;
import com.cool.store.vo.interview.GetFreeBusyListVO;
import com.cool.store.vo.interview.InterviewVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@Service
@Slf4j
@@ -49,6 +59,9 @@ public class PartnerInterviewServiceImpl implements PartnerInterviewService {
@Autowired
private HyInterviewDAO interviewDAO;
@Autowired
private InterviewService interviewService;
@Value("${trtc.sdkAppId}")
private Long sdkAppId;
@@ -204,4 +217,9 @@ public class PartnerInterviewServiceImpl implements PartnerInterviewService {
logService.recordPartnerBizLog(operator,interviewInfo.getPartnerLineId(), OperateTypeEnum.MODIFY_INTERVIEW_TIME,log);
}
@Override
public GetFreeBusyListVO getFreeBusyList(GetFreeBusyListReq request) {
return interviewService.getFreeBusyList(request);
}
}

View File

@@ -52,6 +52,36 @@ public class TimeSlotGenerator {
return daySlots;
}
public static List<CalendarInfo> generateDaySlotsForPc(String startDate, String endDate) {
List<CalendarInfo> daySlots = new ArrayList<>();
Date start = DateUtil.parse(startDate);
Date end = DateUtil.parse(endDate);
Calendar startCal = DateUtil.calendar(start);
Calendar endCal = DateUtil.calendar(end);
while (!startCal.after(endCal)) {
int year = startCal.get(Calendar.YEAR);
int month = startCal.get(Calendar.MONTH) + 1;
int day = startCal.get(Calendar.DAY_OF_MONTH);
int dayOfWeek = startCal.get(Calendar.DAY_OF_WEEK);
List<FreeBusyInfo> hourSlots = generateHalfHourSlotsForPC();
CalendarInfo daySlot = new CalendarInfo(transDayOfWeek(dayOfWeek),
String.valueOf(year),
StringUtil.addZeroForNum(String.valueOf(month),2),
StringUtil.addZeroForNum(String.valueOf(day),2),
DateUtil.format(startCal.getTime(), "yyyy-MM-dd"),
hourSlots);
daySlots.add(daySlot);
startCal.add(Calendar.DATE, 1);
}
return daySlots;
}
private static List<FreeBusyInfo> generateHourSlots() {
List<FreeBusyInfo> hourSlots = new ArrayList<>();
@@ -59,7 +89,7 @@ public class TimeSlotGenerator {
String startTime = String.format("%02d:00", hour);
String endTime = String.format("%02d:00", hour + 1);
//默认空闲
FreeBusyInfo hourSlot = new FreeBusyInfo(startTime, endTime, true);
FreeBusyInfo hourSlot = new FreeBusyInfo(startTime, endTime, true, 0, false, false);
hourSlots.add(hourSlot);
}
@@ -77,13 +107,33 @@ public class TimeSlotGenerator {
String startTime = String.format("%02d:00", hour);
String endTime = String.format("%02d:30", hour);
//默认空闲
FreeBusyInfo hourSlot = new FreeBusyInfo(startTime, endTime, true);
FreeBusyInfo hourSlot = new FreeBusyInfo(startTime, endTime, true, 0, false, false);
hourSlots.add(hourSlot);
String startTime2 = String.format("%02d:30", hour);
String endTime2 = String.format("%02d:00", hour + 1);
//默认空闲
FreeBusyInfo hourSlot2 = new FreeBusyInfo(startTime2, endTime2, true);
FreeBusyInfo hourSlot2 = new FreeBusyInfo(startTime2, endTime2, true, 0, false, false);
hourSlots.add(hourSlot2);
}
return hourSlots;
}
private static List<FreeBusyInfo> generateHalfHourSlotsForPC() {
List<FreeBusyInfo> hourSlots = new ArrayList<>();
//循环打印半小时的时间段
for (int hour = 8; hour < 24; hour++) {
String startTime = String.format("%02d:00", hour);
String endTime = String.format("%02d:30", hour);
//默认空闲
FreeBusyInfo hourSlot = new FreeBusyInfo(startTime, endTime, true, 0, false, false);
hourSlots.add(hourSlot);
String startTime2 = String.format("%02d:30", hour);
String endTime2 = String.format("%02d:00", hour + 1);
//默认空闲,预约人数为 0
FreeBusyInfo hourSlot2 = new FreeBusyInfo(startTime2, endTime2, true, 0, false, false);
hourSlots.add(hourSlot2);
}
return hourSlots;

View File

@@ -88,15 +88,16 @@ public class InterviewWorkFlowService extends WorkFlowBaseService {
&& StringUtils.isNotEmpty(interviewInfo.getFeishuCalendarId())
&& StringUtils.isNotEmpty(interviewInfo.getFeishuScheduleId())
&& interviewInfo.getInterviewerId().equals(operator.getUserId())){
//1.5.2 后不再使用飞书日程
// 原面试官日程删除
DeleteCalendarEventDTO deleteCalendarEventDTO = new DeleteCalendarEventDTO();
deleteCalendarEventDTO.setCalendarId(interviewInfo.getFeishuCalendarId());
deleteCalendarEventDTO.setEventId(interviewInfo.getFeishuScheduleId());
deleteCalendarEventDTO.setUserId(interviewInfo.getInterviewerId());
UserCalendarsEventDTO userCalendarsEventDTO = isvHttpRequest.deleteUserCalendarEvent(deleteCalendarEventDTO);
if(userCalendarsEventDTO == null ){
throw new ApiException(ErrorCodeEnum.FEISHU_DELETE_SCHEDULE_ERROR);
}
// DeleteCalendarEventDTO deleteCalendarEventDTO = new DeleteCalendarEventDTO();
// deleteCalendarEventDTO.setCalendarId(interviewInfo.getFeishuCalendarId());
// deleteCalendarEventDTO.setEventId(interviewInfo.getFeishuScheduleId());
// deleteCalendarEventDTO.setUserId(interviewInfo.getInterviewerId());
// UserCalendarsEventDTO userCalendarsEventDTO = isvHttpRequest.deleteUserCalendarEvent(deleteCalendarEventDTO);
// if(userCalendarsEventDTO == null ){
// throw new ApiException(ErrorCodeEnum.FEISHU_DELETE_SCHEDULE_ERROR);
// }
} else if (Integer.parseInt(WorkflowStatusEnum.INTERVIEW_6.getCode()) == interviewBaseInfo.getStatus()) {
//删除稽核信息
HyInspectionDO rawHyInspection = inspectionMapper.selectByInterviewPlanId(interviewBaseInfo.getInterviewPlanId());

View File

@@ -17,16 +17,22 @@ import org.springframework.web.bind.annotation.RestController;
* @Author: young.yu
* @Date: 2023-06-16 13:06
* @Description:
* @deprecated {@link com.cool.store.controller.InterviewController}
*/
@Api(tags = "飞书相关接口")
@RestController
@RequestMapping({"/feishu"})
@Deprecated
public class FeiShuController {
/**
* @deprecated {@link com.cool.store.controller.InterviewController#getFreeBusyList(GetFreeBusyListReq)}
*/
@Autowired
private FeiShuService feiShuService;
@PostMapping("/interviewer/freebusy/list")
@ApiOperation("查询日程忙闲信息")
@Deprecated
public ResponseResult<GetFreeBusyListVO> getFreeBusyList(@RequestBody GetFreeBusyListReq request) throws ApiException {
GetFreeBusyListVO getFreeBusyListVO= feiShuService.getFreeBusyList(request);
return ResponseResult.success(getFreeBusyListVO);

View File

@@ -4,8 +4,11 @@ import com.cool.store.dto.partner.EnterInterviewDto;
import com.cool.store.exception.ApiException;
import com.cool.store.request.*;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.FeiShuService;
import com.cool.store.service.InterviewService;
import com.cool.store.vo.EnterInterviewVO;
import com.cool.store.vo.interview.CreateAppointmentVO;
import com.cool.store.vo.interview.GetFreeBusyListVO;
import com.cool.store.vo.interview.InterviewVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@@ -54,6 +57,19 @@ public class InterviewController {
return ResponseResult.success();
}
@PostMapping("/freebusy/list")
@ApiOperation("查询各预约时间段情况")
public ResponseResult<GetFreeBusyListVO> getFreeBusyList(@RequestBody GetFreeBusyListReq request) throws ApiException {
GetFreeBusyListVO getFreeBusyListVO= interviewService.getFreeBusyList(request);
return ResponseResult.success(getFreeBusyListVO);
}
@PostMapping("/appointment/booking")
@ApiOperation("招商经理主动预约面试")
public ResponseResult<CreateAppointmentVO> bookInterview(@RequestBody CreateAppointmentReq request) throws ApiException {
return ResponseResult.success(interviewService.bookInterview(request));
}
@PostMapping("/modifyInterviewTime")
@ApiOperation("修改面试时间")
public ResponseResult modifyInterviewTime(@RequestBody ModifyInterviewTimeReq request) throws ApiException {

View File

@@ -17,16 +17,22 @@ import org.springframework.web.bind.annotation.RestController;
* @Author: young.yu
* @Date: 2023-06-16 13:06
* @Description:
* @deprecated {@link InterviewController}
*/
@Api(tags = "飞书相关接口")
@RestController
@RequestMapping({"/feishu"})
@Deprecated
public class FeiShuController {
/**
* @deprecated {@link InterviewController#getFreeBusyList(GetFreeBusyListReq)}
*/
@Autowired
private FeiShuService feiShuService;
@PostMapping("/interviewer/freebusy/list")
@ApiOperation("查询日程忙闲信息")
@Deprecated
public ResponseResult<GetFreeBusyListVO> getFreeBusyList(@RequestBody GetFreeBusyListReq request) throws ApiException {
GetFreeBusyListVO getFreeBusyListVO= feiShuService.getFreeBusyList(request);
return ResponseResult.success(getFreeBusyListVO);

View File

@@ -6,6 +6,7 @@ import com.cool.store.dto.partner.PartnerGetPassLetterDetailDto;
import com.cool.store.dto.partner.PartnerQueryInterviewDto;
import com.cool.store.exception.ApiException;
import com.cool.store.request.CreateAppointmentReq;
import com.cool.store.request.GetFreeBusyListReq;
import com.cool.store.request.ModifyInterviewTimeReq;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.InterviewService;
@@ -14,6 +15,7 @@ import com.cool.store.vo.EnterInterviewVO;
import com.cool.store.vo.PartnerInterviewInfoVO;
import com.cool.store.vo.PartnerPassLetterDetailVO;
import com.cool.store.vo.interview.CreateAppointmentVO;
import com.cool.store.vo.interview.GetFreeBusyListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,6 +39,13 @@ public class InterviewController {
// return ResponseResult.success(interviewService.queryByPartnerId(dto.getPartnerId()));
// }
@PostMapping("/freebusy/list")
@ApiOperation("查询各预约时间段情况")
public ResponseResult<GetFreeBusyListVO> getFreeBusyList(@RequestBody GetFreeBusyListReq request) throws ApiException {
GetFreeBusyListVO getFreeBusyListVO= interviewService.getFreeBusyList(request);
return ResponseResult.success(getFreeBusyListVO);
}
@PostMapping("/queryByPartnerLineId")
@ApiOperation("根据线索id查询面试信息")
public ResponseResult<PartnerInterviewInfoVO> queryByPartnerLineId(@RequestBody LineQueryInterviewDto dto) throws ApiException {