Merge remote-tracking branch 'origin/cc_20230520_partner' into cc_20230520_partner

This commit is contained in:
苏竹红
2023-06-21 16:16:03 +08:00
10 changed files with 136 additions and 33 deletions

View File

@@ -80,6 +80,11 @@
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>dysmsapi20170525</artifactId>
<version>2.0.1</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,13 @@
package com.cool.store.service;
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
import com.cool.store.exception.ApiException;
/**
* @Author: young.yu
* @Date: 2023-06-21 10:55
* @Description:
*/
public interface SmsService {
public SendSmsResponse sendSms(String params, String templateCode, String mobile) throws ApiException;
}

View File

@@ -51,13 +51,13 @@ import java.util.Objects;
@Service
public class FlowServiceImpl implements FlowService {
@Value("${hs.mdm.baseUrl}")
@Value("${hs.mdm.baseUrl:null}")
private String mdmBaseUrl;
@Value("${hs.mdm.appkey}")
@Value("${hs.mdm.appkey:null}")
private String mdmAppKey;
@Value("${hs.mdm.appsec}")
@Value("${hs.mdm.appsec:null}")
private String mdmAppSec;
@Autowired

View File

@@ -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 {

View File

@@ -0,0 +1,55 @@
package com.cool.store.service.impl;
import com.aliyun.dysmsapi20170525.Client;
import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
import com.aliyun.teaopenapi.models.Config;
import com.cool.store.exception.ApiException;
import com.cool.store.service.SmsService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
/**
* @Author: young.yu
* @Date: 2023-06-21 10:55
* @Description:
*/
@Service
public class SmsServiceImpl implements SmsService {
@Value("${hs.sms.accessKeyId:null}")
private String accessKeyId ;
@Value("${hs.sms.accessKeySecret:null}")
private String accessKeySecret;
/**
* 发送短信
* @param params Json格式的参数
* @param mobile
* @return
*/
@Override
@Async
public SendSmsResponse sendSms(String params,String templateCode, String mobile) throws ApiException {
try {
Config config = new Config()
// 您的AccessKey ID
.setAccessKeyId(accessKeyId)
// 您的AccessKey Secret
.setAccessKeySecret(accessKeySecret);
SendSmsRequest sendSmsRequest = new SendSmsRequest()
.setPhoneNumbers(mobile)
.setSignName("沪上阿姨")
.setTemplateCode(templateCode)
.setTemplateParam(params);
Client client = new Client(config);
return client.sendSms(sendSmsRequest);
}catch (ApiException e){
throw new ApiException(e.getMessage());
} catch (Exception exception) {
throw new ApiException(exception.getMessage());
}
}
}