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

This commit is contained in:
zhangchenbiao
2023-06-21 17:04:37 +08:00
30 changed files with 320 additions and 65 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

@@ -1,5 +1,6 @@
package com.cool.store.service;
import com.cool.store.entity.HyPartnerBaseInfoDO;
import com.cool.store.request.AddTagsRequest;
import com.cool.store.request.PartnerBaseInfoRequest;
import com.cool.store.vo.PartnerBaseInfoVO;
@@ -26,7 +27,7 @@ public interface HyPartnerBaseInfoService {
PartnerBaseInfoVO getByPartnerLineId(Long lineId);
Long getLineIdByIdCard(String idCard);
HyPartnerBaseInfoDO getByIdCard(String idCard);
Boolean changeBinding(String idCard, Long lineId, PartnerUserInfoVO currentUser);

View File

@@ -78,7 +78,7 @@ public interface HyPartnerLineInfoService {
* @param joinReason
* @return
*/
Boolean joinBlackList( Long lineId, Integer status, String joinReason);
Boolean joinBlackList(String userId, Long lineId, Integer status, String joinReason);
/**
* 移除黑名单
@@ -128,7 +128,7 @@ public interface HyPartnerLineInfoService {
* @param lineId
* @return
*/
Boolean assignFollowUser(String partnerId);
Boolean assignFollowUser(String partnerId, String wantShopArea, Integer acceptAdjustType);
/**
* 线索状态

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

@@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.MessageFormat;
import java.util.Date;
/**
* @Author suzhuhong
@@ -120,15 +121,15 @@ public class HyPartnerBaseInfoServiceImpl implements HyPartnerBaseInfoService {
}
@Override
public Long getLineIdByIdCard(String idCard) {
return hyPartnerBaseInfoDAO.getLineIdByIdCard(idCard);
public HyPartnerBaseInfoDO getByIdCard(String idCard) {
return hyPartnerBaseInfoDAO.getByIdCard(idCard);
}
@Override
public Boolean changeBinding(String idCard, Long lineId, PartnerUserInfoVO currentUser) {
// 把旧线索的身份证号置空,状态改为待提交
Long oldLineId = hyPartnerBaseInfoDAO.getLineIdByIdCard(idCard);
HyPartnerLineInfoDO oldLineInfo = hyPartnerLineInfoDAO.selectByPrimaryKeySelective(oldLineId);
HyPartnerBaseInfoDO oldBaseInfo = hyPartnerBaseInfoDAO.getByIdCard(idCard);
HyPartnerLineInfoDO oldLineInfo = hyPartnerLineInfoDAO.selectByPrimaryKeySelective(oldBaseInfo.getPartnerLineId());
// 该身份证当前申请状态同步至该账号下,原账号变为【加盟意向申请 待提交状态】
HyPartnerLineInfoDO newLineInfo = hyPartnerLineInfoDAO.selectByPrimaryKeySelective(lineId);
newLineInfo.setWorkflowStage(oldLineInfo.getWorkflowStage());
@@ -139,11 +140,32 @@ public class HyPartnerBaseInfoServiceImpl implements HyPartnerBaseInfoService {
oldLineInfo.setWorkflowStatus(WorkflowStatusEnum.INTENT_0.getCode());
oldLineInfo.setLineStatus(LineStatusEnum.PUBLIC_SEAS.getCode());
hyPartnerLineInfoDAO.updateByPrimaryKeySelective(oldLineInfo);
hyPartnerBaseInfoDAO.cleanIdCardInfoByPartnerLineId(null, null, null, oldLineId);
// 新线索绑定身份证号
HyPartnerBaseInfoDO newBaseInfo = hyPartnerBaseInfoDAO.getByPartnerIdAndLineId(currentUser.getPartnerId(), lineId);
fillBaseInfoIdCard(newBaseInfo, oldBaseInfo.getIdCard(), oldBaseInfo.getIdCardPhotoFront(), oldBaseInfo.getIdCardPhotoBlack(), oldBaseInfo.getUsername(),
oldBaseInfo.getSex(), oldBaseInfo.getBirthdate(), oldBaseInfo.getNation(), oldBaseInfo.getLiveAddress(), oldBaseInfo.getStatus());
newBaseInfo.setStatus(oldBaseInfo.getStatus());
hyPartnerBaseInfoDAO.updateByPrimaryKeySelective(newBaseInfo);
// 老的身份证信息置空
fillBaseInfoIdCard(oldBaseInfo, null, null, null, null, null, null, null, null, null);
oldBaseInfo.setStatus(Integer.valueOf(WorkflowStatusEnum.INTENT_0.getCode()));
hyPartnerBaseInfoDAO.updateByPrimaryKey(oldBaseInfo);
return true;
}
private void fillBaseInfoIdCard(HyPartnerBaseInfoDO newBaseInfo, String idCard, String idCardPhotoFront, String idCardPhotoBlack,
String username, Integer sex, Date birthdate, String nation, String liveAddress, Integer status) {
newBaseInfo.setIdCard(idCard);
newBaseInfo.setIdCardPhotoBlack(idCardPhotoFront);
newBaseInfo.setIdCardPhotoFront(idCardPhotoBlack);
newBaseInfo.setUsername(username);
newBaseInfo.setSex(sex);
newBaseInfo.setBirthdate(birthdate);
newBaseInfo.setNation(nation);
newBaseInfo.setLiveAddress(liveAddress);
newBaseInfo.setStatus(status);
}
private void fillBaseInfo(HyPartnerBaseInfoDO baseInfoDO, PartnerBaseInfoRequest request) {
baseInfoDO.setPartnerId(request.getPartnerId());
baseInfoDO.setPartnerLineId(request.getPartnerLineId());

View File

@@ -173,7 +173,7 @@ public class HyPartnerIntentInfoServiceImpl implements HyPartnerIntentInfoServic
intentInfoDO.setMaxBudget(request.getMaxBudget());
intentInfoDO.setMoneySource(request.getMoneySource());
if(CollectionUtils.isNotEmpty(request.getMoneyProve())){
intentInfoDO.setMoneyProve(String.join(",", request.getMoneyProve()));
intentInfoDO.setMoneyProve(JSONObject.toJSONString(request.getMoneyProve()));
}
intentInfoDO.setEducation(request.getEducation());
intentInfoDO.setWorkYear(request.getWorkYear());

View File

@@ -29,6 +29,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.sql.Array;
import java.text.MessageFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -57,6 +58,8 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
EnterpriseUserService enterpriseUserService;
@Resource
AliyunService aliyunService;
@Resource
HyPartnerBaseInfoDAO hyPartnerBaseInfoDAO;
@Override
public StageCountVO selectStagePendingCount(String userId) {
@@ -130,6 +133,7 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
//过滤出已结束的线索 这块线索需要重新生成新的线索
List<HyPartnerLineInfoDO> closeLineList = partnerLineInfoList.stream().filter(x -> x.getCloseTime() != null).collect(Collectors.toList());
List<Long> closeLineIdList = closeLineList.stream().map(HyPartnerLineInfoDO::getId).collect(Collectors.toList());
//已结束的线索 需要重新生成一条新的线索
List<HyPartnerLineInfoDO> list = new ArrayList<>();
closeLineList.stream().forEach(x->{
@@ -142,6 +146,14 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
list.add(hyPartnerLineInfoDO);
});
hyPartnerLineInfoDAO.batchInsert(list);
List<HyPartnerBaseInfoDO> hyPartnerBaseInfoDOS = new ArrayList<>();
list.forEach(x->{
HyPartnerBaseInfoDO newHyPartnerBaseInfoDO = new HyPartnerBaseInfoDO();
newHyPartnerBaseInfoDO.setPartnerId(x.getPartnerId());
newHyPartnerBaseInfoDO.setPartnerLineId(x.getId());
hyPartnerBaseInfoDOS.add(newHyPartnerBaseInfoDO);
});
hyPartnerBaseInfoDAO.batchInsert(hyPartnerBaseInfoDOS);
//将老的线索置为删除状态
hyPartnerLineInfoDAO.batchDeleted(closeLineIdList);
//没有结束的线索直接分配招商经理
@@ -149,7 +161,7 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
List<Long> otherLineIdList = otherLineList.stream().map(HyPartnerLineInfoDO::getId).collect(Collectors.toList());
hyPartnerLineInfoDAO.updateInvestmentManager(userId, otherLineIdList);
return null;
return Boolean.TRUE;
}
@Override
@@ -163,6 +175,7 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
list.stream().forEach(x->{
BlackListVO blackListVO = convertPartnerBlackListDTOToVo(x);
blackListVO.setCloseUserPhone(userPhoneMap.get(x.getCloseUserId()));
blackListVO.setCloseUserName(userPhoneMap.get(x.getCloseUserId()));
if (StringUtils.isNotEmpty(x.getMobile())){
blackListVO.setPhoneAddress(aliyunService.getPhoneNumberAttribute(x.getMobile()).getCity());
}
@@ -173,7 +186,7 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
}
@Override
public Boolean joinBlackList(Long lineId, Integer status, String joinReason) {
public Boolean joinBlackList(String userId,Long lineId, Integer status, String joinReason) {
if (lineId==null){
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
@@ -182,6 +195,8 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
hyPartnerLineInfoDO.setId(lineId);
hyPartnerLineInfoDO.setLineStatus(status);
hyPartnerLineInfoDO.setJoinBlackReason(joinReason);
hyPartnerLineInfoDO.setCloseTime(new Date());
hyPartnerLineInfoDO.setCloseUserId(userId);
hyPartnerLineInfoDO.setWorkflowStage(WorkflowStageEnum.INTENT.getCode());
hyPartnerLineInfoDO.setWorkflowStatus(WorkflowStatusEnum.INTENT_0.getCode());
@@ -287,6 +302,8 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
List<LineCountDTO> followCountList = hyPartnerLineInfoDAO.getFollowCountList(partnerIdList);
Map<String, Integer> countMap = followCountList.stream().collect(Collectors.toMap(LineCountDTO::getPartnerId, LineCountDTO::getFollowCount));
List<Long> wantShopAreaList = list.stream().map(PublicSeaLineDTO::getWantShopArea).map(Long::parseLong).distinct().collect(Collectors.toList());
Map<String, String> wantShopAreaNameMap = hyOpenAreaInfoDAO.selectNameMapByIds(wantShopAreaList);
List<PublicSeaLineListVo> result = new ArrayList<>();
list.forEach(x->{
PublicSeaLineListVo publicSeaLineListVo = new PublicSeaLineListVo();
@@ -303,6 +320,7 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
HyPartnerLineInfoDO hy = hyPartnerLineInfoDOMap.getOrDefault(x.getPartnerId(), new HyPartnerLineInfoDO());
publicSeaLineListVo.setRejectPublicReason(hy.getRejectPublicReason());
publicSeaLineListVo.setRejectRealReason(hy.getRejectRealReason());
publicSeaLineListVo.setWantShopAreaName(wantShopAreaNameMap.get(x.getWantShopArea()));
String closeTime = DateUtil.format(hy.getCloseTime(), CoolDateUtils.DATE_FORMAT_SEC);
publicSeaLineListVo.setLastCloseDate(closeTime);
publicSeaLineListVo.setLastInvestmentManager(nameMobileMap.get(hy.getInvestmentManager()));
@@ -372,10 +390,14 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
}
@Override
public Boolean assignFollowUser(String partnerId) {
public Boolean assignFollowUser(String partnerId, String wantShopArea, Integer acceptAdjustType) {
List<HyPartnerLineInfoDO> lineFollowHistoryList = hyPartnerLineInfoDAO.getLineFollowHistoryList(partnerId);
//当前加盟商线索
HyPartnerLineInfoDO HyPartnerLineInfo = hyPartnerLineInfoDAO.getByPartnerId(partnerId);
if(HyPartnerLineInfo == null){
Boolean lineStatus = getLineStatus(Long.valueOf(wantShopArea), acceptAdjustType);
return lineStatus;
}
//如果是私海线索 不需要重新分配招商经理 或者跟进次数大于1
if (HyPartnerLineInfo.getLineStatus()==1||CollectionUtils.isEmpty(lineFollowHistoryList)){
return Boolean.FALSE;

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

@@ -107,7 +107,7 @@ public class PartnerUserInfoServiceImpl implements PartnerUserInfoService {
hyPartnerLineInfoDO.setPartnerId(hyPartnerUserInfoDO.getPartnerId());
hyPartnerLineInfoDO.setWorkflowStage(WorkflowStageEnum.INTENT.getCode());
hyPartnerLineInfoDO.setWorkflowStatus(WorkflowStatusEnum.INTENT_0.getCode());
Boolean flag = hyPartnerLineInfoService.assignFollowUser(hyPartnerLineInfoDO.getPartnerId());
Boolean flag = hyPartnerLineInfoService.assignFollowUser(hyPartnerLineInfoDO.getPartnerId(), partnerUserInfoRequest.getWantShopArea(), partnerUserInfoRequest.getAcceptAdjustType());
hyPartnerLineInfoDO.setLineStatus(flag ? LineStatusEnum.PRIVATE_SEAS.getCode() : LineStatusEnum.PUBLIC_SEAS.getCode());
if (flag){
hyPartnerLineInfoDO.setInvestmentManager("ou_7a6a19ae800afde783b0ec2dabaabf95");

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());
}
}
}