加盟商短信逻辑修改
This commit is contained in:
@@ -0,0 +1,38 @@
|
|||||||
|
package com.cool.store.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: young.yu
|
||||||
|
* @Date: 2023-09-14 14:27
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
public enum SMSMsgEnum {
|
||||||
|
INTENTION_APPLY_PASS("意向申请通过","【沪上阿姨】恭喜您通过了加盟意向申请审核,请务必于{$var}前登录沪姨合伙人小程序完成面试预约时间申请,感谢您对沪上阿姨的关注与支持!点击转跳沪姨合伙人小程序:{$var}"),
|
||||||
|
|
||||||
|
INTERVIEW_APPOINTMENT_PASS("预约面试通过通知","【沪上阿姨】你已成功预约{$var}进行沪上阿姨加盟资格面试,届时请通过沪姨合伙人小程序进行面试,面试时间约40分钟,请提前仔细阅读面试准备材料以及观看加盟说明视频,做好面试相应准备。请务必提前安排好您的时间。点击转跳沪姨合伙人小程序:{$var}"),
|
||||||
|
|
||||||
|
INTERVIEW_PASS("面试通过通知","【沪上阿姨】恭喜您通过了加盟资格面试,接下来我们会为您安排专业的选址开发顾问协助您进行选址,请保持电话畅通,祝您早日选址成功!点击转跳沪姨合伙人小程序:{$var}");
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
SMSMsgEnum(String title, String content) {
|
||||||
|
this.title = title;
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.cool.store.dto.wx;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: young.yu
|
||||||
|
* @Date: 2023-09-12 14:48
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MiniAppUrlLinkDTO extends WXBaseResultDTO{
|
||||||
|
@JSONField(name = "url_link")
|
||||||
|
private String urlLink;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.cool.store.dto.wx;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: young.yu
|
||||||
|
* @Date: 2023-09-12 14:48
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MiniAppUrlLinkReqDTO{
|
||||||
|
private String path;
|
||||||
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package com.cool.store.request;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: young.yu
|
|
||||||
* @Date: 2023-06-21 11:17
|
|
||||||
* @Description:
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class IntentSmsReq {
|
|
||||||
private String deadLine;
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package com.cool.store.request;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: young.yu
|
|
||||||
* @Date: 2023-06-21 11:17
|
|
||||||
* @Description:
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class InterviewSmsReq {
|
|
||||||
private String interviewStartTime;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.cool.store.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zw.yang
|
||||||
|
* @date 2023-07-03
|
||||||
|
* @Description:普通短信发送实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SmsSendRequest {
|
||||||
|
/**
|
||||||
|
* 用户账号,必填
|
||||||
|
*/
|
||||||
|
private String account;
|
||||||
|
/**
|
||||||
|
* 用户密码,必填
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
/**
|
||||||
|
* 短信内容。长度不能超过536个字符,必填
|
||||||
|
*/
|
||||||
|
private String msg;
|
||||||
|
/**
|
||||||
|
* 手机号码和变量参数,多组参数使用英文分号;区分,必填
|
||||||
|
*/
|
||||||
|
private String params;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时发送短信时间。格式为yyyyMMddHHmm,值小于或等于当前时间则立即发送,默认立即发送,选填
|
||||||
|
*/
|
||||||
|
private String sendtime;
|
||||||
|
/**
|
||||||
|
* 是否需要状态报告(默认false),选填
|
||||||
|
*/
|
||||||
|
private String report;
|
||||||
|
/**
|
||||||
|
* 下发短信号码扩展码,纯数字,建议1-3位,选填
|
||||||
|
*/
|
||||||
|
private String extend;
|
||||||
|
/**
|
||||||
|
* 该条短信在您业务系统内的ID,如订单号或者短信发送记录流水号,选填
|
||||||
|
*/
|
||||||
|
private String uid;
|
||||||
|
|
||||||
|
public SmsSendRequest(String account, String password, String msg, String params) {
|
||||||
|
this.account = account;
|
||||||
|
this.password = password;
|
||||||
|
this.msg = msg;
|
||||||
|
this.params = params;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.cool.store.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zw.yang
|
||||||
|
* @date 2023-07-03
|
||||||
|
* @Description:普通短信发送响应实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SmsSendResponse {
|
||||||
|
/**
|
||||||
|
* 响应时间
|
||||||
|
*/
|
||||||
|
private String time;
|
||||||
|
/**
|
||||||
|
* 消息id
|
||||||
|
*/
|
||||||
|
private String msgId;
|
||||||
|
/**
|
||||||
|
* 状态码说明(成功返回空)
|
||||||
|
*/
|
||||||
|
private String errorMsg;
|
||||||
|
/**
|
||||||
|
* 状态码(详细参考提交响应状态码)
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败的个数
|
||||||
|
*/
|
||||||
|
private String failNum;
|
||||||
|
/**
|
||||||
|
* 成功的个数
|
||||||
|
*/
|
||||||
|
private String successNum;
|
||||||
|
}
|
||||||
@@ -99,6 +99,16 @@
|
|||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-ooxml</artifactId>
|
<artifactId>poi-ooxml</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -2,6 +2,8 @@ package com.cool.store.http;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.cool.store.dto.wx.CodeSessionDTO;
|
import com.cool.store.dto.wx.CodeSessionDTO;
|
||||||
|
import com.cool.store.dto.wx.MiniAppUrlLinkDTO;
|
||||||
|
import com.cool.store.dto.wx.MiniAppUrlLinkReqDTO;
|
||||||
import com.cool.store.dto.wx.PhoneInfoDTO;
|
import com.cool.store.dto.wx.PhoneInfoDTO;
|
||||||
import com.cool.store.enums.ErrorCodeEnum;
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
import com.cool.store.exception.ServiceException;
|
import com.cool.store.exception.ServiceException;
|
||||||
@@ -41,6 +43,8 @@ public class WechatRest {
|
|||||||
*/
|
*/
|
||||||
String GET_USERPHONENUMBER = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=%s";
|
String GET_USERPHONENUMBER = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=%s";
|
||||||
|
|
||||||
|
String GET_MINIAPP_URL_LINK = "https://api.weixin.qq.com/wxa/generate_urllink?access_token=%s";
|
||||||
|
|
||||||
|
|
||||||
public CodeSessionDTO miniProgramJsCodeSession(String appId, String secret, String jsCode){
|
public CodeSessionDTO miniProgramJsCodeSession(String appId, String secret, String jsCode){
|
||||||
log.info("WechatRest#miniProgramJsCodeSession, jsCode:{}", jsCode);
|
log.info("WechatRest#miniProgramJsCodeSession, jsCode:{}", jsCode);
|
||||||
@@ -90,4 +94,19 @@ public class WechatRest {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MiniAppUrlLinkDTO getMiniAppUrlLink(String accessToken, MiniAppUrlLinkReqDTO miniAppUrlLinkReqDTO){
|
||||||
|
String reqUrl = String.format(GET_MINIAPP_URL_LINK, accessToken);
|
||||||
|
String responseStr = null;
|
||||||
|
try {
|
||||||
|
responseStr = httpRestTemplateService.postForObject(reqUrl, miniAppUrlLinkReqDTO, String.class);
|
||||||
|
log.info("WechatRest#getUserPhoneNumber, reqUrl:{}, response:{}", reqUrl, responseStr);
|
||||||
|
if(StringUtils.isNotBlank(responseStr)){
|
||||||
|
return JSONObject.parseObject(responseStr, MiniAppUrlLinkDTO.class);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取手机号异常", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
package com.cool.store.service;
|
package com.cool.store.service;
|
||||||
|
|
||||||
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
||||||
|
import com.cool.store.enums.SMSMsgEnum;
|
||||||
import com.cool.store.exception.ApiException;
|
import com.cool.store.exception.ApiException;
|
||||||
|
import com.cool.store.response.SmsSendResponse;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: young.yu
|
* @Author: young.yu
|
||||||
@@ -9,5 +13,8 @@ import com.cool.store.exception.ApiException;
|
|||||||
* @Description:
|
* @Description:
|
||||||
*/
|
*/
|
||||||
public interface SmsService {
|
public interface SmsService {
|
||||||
public SendSmsResponse sendSms(String params, String templateCode, String mobile) throws ApiException;
|
public SmsSendResponse sendSmsNormal(String phone, SMSMsgEnum smsMsgEnum, Object... objects);
|
||||||
|
|
||||||
|
public SmsSendResponse sendSmsVariable(String phone, SMSMsgEnum smsMsgEnum,String... objects);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,4 +19,6 @@ public interface WechatMiniAppService {
|
|||||||
String updateUserPhoneNumber(MobileUpdateRequest request, PartnerUserInfoVO userInfoVO);
|
String updateUserPhoneNumber(MobileUpdateRequest request, PartnerUserInfoVO userInfoVO);
|
||||||
|
|
||||||
PartnerUserInfoVO getUserInfo(String mobile, String openId);
|
PartnerUserInfoVO getUserInfo(String mobile, String openId);
|
||||||
|
|
||||||
|
String getMiniAppUrl();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,10 +16,7 @@ import com.cool.store.dto.log.LogBasicDTO;
|
|||||||
import com.cool.store.dto.mdm.AccessTokenDTO;
|
import com.cool.store.dto.mdm.AccessTokenDTO;
|
||||||
import com.cool.store.dto.response.MDMResultDTO;
|
import com.cool.store.dto.response.MDMResultDTO;
|
||||||
import com.cool.store.entity.*;
|
import com.cool.store.entity.*;
|
||||||
import com.cool.store.enums.ErrorCodeEnum;
|
import com.cool.store.enums.*;
|
||||||
import com.cool.store.enums.InspectionTyeEnum;
|
|
||||||
import com.cool.store.enums.OperateTypeEnum;
|
|
||||||
import com.cool.store.enums.WorkflowStatusEnum;
|
|
||||||
import com.cool.store.exception.ApiException;
|
import com.cool.store.exception.ApiException;
|
||||||
import com.cool.store.exception.ServiceException;
|
import com.cool.store.exception.ServiceException;
|
||||||
import com.cool.store.mapper.*;
|
import com.cool.store.mapper.*;
|
||||||
@@ -27,10 +24,7 @@ import com.cool.store.oss.OSSServer;
|
|||||||
import com.cool.store.request.*;
|
import com.cool.store.request.*;
|
||||||
import com.cool.store.request.data.flow.KeyText;
|
import com.cool.store.request.data.flow.KeyText;
|
||||||
import com.cool.store.request.data.flow.SkrRelshipProve;
|
import com.cool.store.request.data.flow.SkrRelshipProve;
|
||||||
import com.cool.store.service.FlowService;
|
import com.cool.store.service.*;
|
||||||
import com.cool.store.service.HyPartnerLineInfoService;
|
|
||||||
import com.cool.store.service.LogService;
|
|
||||||
import com.cool.store.service.SmsService;
|
|
||||||
import com.cool.store.utils.*;
|
import com.cool.store.utils.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -103,7 +97,8 @@ public class FlowServiceImpl implements FlowService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HyInspectionMapper inspectionMapper;
|
private HyInspectionMapper inspectionMapper;
|
||||||
|
@Autowired
|
||||||
|
private WechatMiniAppService wechatMiniAppService;
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void createQualifyVerify(CreateQualifyVerifyReq request) throws ApiException, IOException {
|
public void createQualifyVerify(CreateQualifyVerifyReq request) throws ApiException, IOException {
|
||||||
@@ -279,7 +274,7 @@ public class FlowServiceImpl implements FlowService {
|
|||||||
inspectionMapper.insertSelective(hyInspectionDO);
|
inspectionMapper.insertSelective(hyInspectionDO);
|
||||||
//发送加盟商资质审核通过短信
|
//发送加盟商资质审核通过短信
|
||||||
HyPartnerBaseInfoDO hyPartnerBaseInfoDO = hyPartnerBaseInfoDAO.getByPartnerLineId(partnerLineId);
|
HyPartnerBaseInfoDO hyPartnerBaseInfoDO = hyPartnerBaseInfoDAO.getByPartnerLineId(partnerLineId);
|
||||||
smsService.sendSms(null, CommonConstants.SMS_TEMPLATE_CODE_VERIFY, hyPartnerBaseInfoDO.getMobile());
|
smsService.sendSmsVariable(hyPartnerBaseInfoDO.getMobile(), SMSMsgEnum.INTERVIEW_PASS,wechatMiniAppService.getMiniAppUrl());
|
||||||
//记录日志
|
//记录日志
|
||||||
//这里记录的日志时间为 passTime,而不是当前时间,否则 getTipsInfo 接口返回的时间是这里记录的当前时间,与 passTime 不符
|
//这里记录的日志时间为 passTime,而不是当前时间,否则 getTipsInfo 接口返回的时间是这里记录的当前时间,与 passTime 不符
|
||||||
LogBasicDTO log = LogBasicDTO.builder().operateTime(DateUtil.format(passDate, CoolDateUtils.DATE_FORMAT_SEC))
|
LogBasicDTO log = LogBasicDTO.builder().operateTime(DateUtil.format(passDate, CoolDateUtils.DATE_FORMAT_SEC))
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
|
|||||||
@Resource
|
@Resource
|
||||||
HyFollowTaskDAO hyFollowTaskDAO;
|
HyFollowTaskDAO hyFollowTaskDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WechatMiniAppService wechatMiniAppService;
|
||||||
@Override
|
@Override
|
||||||
public StageCountVO selectStagePendingCount(String userId) {
|
public StageCountVO selectStagePendingCount(String userId) {
|
||||||
StageCountDTO stageCountDTO = hyPartnerLineInfoDAO.selectStagePendingCount(userId);
|
StageCountDTO stageCountDTO = hyPartnerLineInfoDAO.selectStagePendingCount(userId);
|
||||||
@@ -474,9 +476,7 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
|
|||||||
hy.setCertifyFile(JSONObject.toJSONString(closeFollowRequest.getCertifyFile()));
|
hy.setCertifyFile(JSONObject.toJSONString(closeFollowRequest.getCertifyFile()));
|
||||||
}
|
}
|
||||||
hyPartnerBaseInfoDAO.updateByPrimaryKeySelective(hy);
|
hyPartnerBaseInfoDAO.updateByPrimaryKeySelective(hy);
|
||||||
IntentSmsReq intentSmsReq = new IntentSmsReq();
|
smsService.sendSmsVariable(hy.getMobile(), SMSMsgEnum.INTENTION_APPLY_PASS,DateUtil.formatDateTime(hyPartnerLineInfoDO.getDeadline()),wechatMiniAppService.getMiniAppUrl());
|
||||||
intentSmsReq.setDeadLine(DateUtil.formatDateTime(hyPartnerLineInfoDO.getDeadline()));
|
|
||||||
smsService.sendSms(JSON.toJSONString(intentSmsReq),CommonConstants.SMS_TEMPLATE_CODE_INTENT, hy.getMobile());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//拒绝
|
//拒绝
|
||||||
|
|||||||
@@ -24,10 +24,7 @@ import com.cool.store.exception.ServiceException;
|
|||||||
import com.cool.store.http.ISVHttpRequest;
|
import com.cool.store.http.ISVHttpRequest;
|
||||||
import com.cool.store.mapper.*;
|
import com.cool.store.mapper.*;
|
||||||
import com.cool.store.request.*;
|
import com.cool.store.request.*;
|
||||||
import com.cool.store.service.EnterpriseUserService;
|
import com.cool.store.service.*;
|
||||||
import com.cool.store.service.InterviewService;
|
|
||||||
import com.cool.store.service.LogService;
|
|
||||||
import com.cool.store.service.SmsService;
|
|
||||||
import com.cool.store.utils.CoolDateUtils;
|
import com.cool.store.utils.CoolDateUtils;
|
||||||
import com.cool.store.utils.StringUtil;
|
import com.cool.store.utils.StringUtil;
|
||||||
import com.cool.store.utils.TRTCUtils;
|
import com.cool.store.utils.TRTCUtils;
|
||||||
@@ -100,6 +97,9 @@ public class InterviewServiceImpl implements InterviewService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EnterpriseUserDAO enterpriseUserDAO;
|
private EnterpriseUserDAO enterpriseUserDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WechatMiniAppService wechatMiniAppService;
|
||||||
@Override
|
@Override
|
||||||
public List<InterviewVO> getInterviewList(GetInterviewListReq request) {
|
public List<InterviewVO> getInterviewList(GetInterviewListReq request) {
|
||||||
List<InterviewVO> interviewList = hyPartnerInterviewPlanMapper.getInterviewList(request);
|
List<InterviewVO> interviewList = hyPartnerInterviewPlanMapper.getInterviewList(request);
|
||||||
@@ -568,10 +568,7 @@ public class InterviewServiceImpl implements InterviewService {
|
|||||||
hyPartnerLineDO.setUpdateTime(new Date());
|
hyPartnerLineDO.setUpdateTime(new Date());
|
||||||
hyPartnerLineInfoMapper.updateByPrimaryKeySelective(hyPartnerLineDO);
|
hyPartnerLineInfoMapper.updateByPrimaryKeySelective(hyPartnerLineDO);
|
||||||
//异步发送短信给加盟商
|
//异步发送短信给加盟商
|
||||||
InterviewSmsReq interviewSmsReq = new InterviewSmsReq();
|
smsService.sendSmsVariable(partnerBaseInfo.getMobile(), SMSMsgEnum.INTERVIEW_APPOINTMENT_PASS,DateUtil.format(DateUtil.parse(interviewVO.getStartTime()), DatePattern.NORM_DATETIME_MINUTE_PATTERN),wechatMiniAppService.getMiniAppUrl());
|
||||||
interviewSmsReq.setInterviewStartTime(DateUtil.format(DateUtil.parse(interviewVO.getStartTime()), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
|
|
||||||
smsService.sendSms(JSON.toJSONString(interviewSmsReq),templateCode, partnerBaseInfo.getMobile());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,55 +1,100 @@
|
|||||||
package com.cool.store.service.impl;
|
package com.cool.store.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.aliyun.dysmsapi20170525.Client;
|
import com.aliyun.dysmsapi20170525.Client;
|
||||||
import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
|
import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
|
||||||
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
||||||
import com.aliyun.teaopenapi.models.Config;
|
import com.aliyun.teaopenapi.models.Config;
|
||||||
|
import com.cool.store.enums.SMSMsgEnum;
|
||||||
import com.cool.store.exception.ApiException;
|
import com.cool.store.exception.ApiException;
|
||||||
|
import com.cool.store.mq.util.HttpRestTemplateService;
|
||||||
|
import com.cool.store.request.SmsSendRequest;
|
||||||
|
import com.cool.store.response.SmsSendResponse;
|
||||||
import com.cool.store.service.SmsService;
|
import com.cool.store.service.SmsService;
|
||||||
|
import com.cool.store.utils.StringUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: young.yu
|
* @Author: young.yu
|
||||||
* @Date: 2023-06-21 10:55
|
* @Date: 2023-06-21 10:55
|
||||||
* @Description:
|
* @Description:
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class SmsServiceImpl implements SmsService {
|
public class SmsServiceImpl implements SmsService {
|
||||||
|
|
||||||
@Value("${hs.sms.accessKeyId:null}")
|
/**
|
||||||
private String accessKeyId ;
|
* 普通短信请求url
|
||||||
|
*/
|
||||||
@Value("${hs.sms.accessKeySecret:null}")
|
private final static String NORMAL_SMS_URL = "https://smssh1.253.com/msg/v1/send/json";
|
||||||
private String accessKeySecret;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送短信
|
* 普通短信请求url
|
||||||
* @param params Json格式的参数
|
*/
|
||||||
* @param mobile
|
private final static String VARIABLE_SMS_URL = "https://smssh1.253.com/msg/variable/json";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户平台API账号
|
||||||
|
*/
|
||||||
|
private final static String ACCOUNT = "N7567896";
|
||||||
|
/**
|
||||||
|
* 用户平台API密码
|
||||||
|
*/
|
||||||
|
public final static String PASS_WORD = "MpGD8g15v2cea3";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HttpRestTemplateService httpRestTemplateService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送普通短信
|
||||||
|
* @param phone 手机号码
|
||||||
|
* @param smsMsgEnum 短信内容
|
||||||
* @return
|
* @return
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Async
|
@Async
|
||||||
public SendSmsResponse sendSms(String params,String templateCode, String mobile) throws ApiException {
|
public SmsSendResponse sendSmsNormal(String phone, SMSMsgEnum smsMsgEnum,Object... objects) {
|
||||||
try {
|
try {
|
||||||
Config config = new Config()
|
SmsSendRequest smsSingleRequest = new SmsSendRequest(ACCOUNT, PASS_WORD, MessageFormat.format(smsMsgEnum.getContent(), objects), phone);
|
||||||
// 您的AccessKey ID
|
String requestJson = JSON.toJSONString(smsSingleRequest);
|
||||||
.setAccessKeyId(accessKeyId)
|
String response = httpRestTemplateService.postForObject(NORMAL_SMS_URL, requestJson, String.class);
|
||||||
// 您的AccessKey Secret
|
SmsSendResponse smsSingleResponse = JSON.parseObject(response, SmsSendResponse.class);
|
||||||
.setAccessKeySecret(accessKeySecret);
|
return smsSingleResponse;
|
||||||
SendSmsRequest sendSmsRequest = new SendSmsRequest()
|
}catch (Exception e){
|
||||||
.setPhoneNumbers(mobile)
|
log.error("短信发送异常:"+e.getMessage());
|
||||||
.setSignName("沪上阿姨")
|
}
|
||||||
.setTemplateCode(templateCode)
|
return null;
|
||||||
.setTemplateParam(params);
|
}
|
||||||
Client client = new Client(config);
|
|
||||||
return client.sendSms(sendSmsRequest);
|
/**
|
||||||
}catch (ApiException e){
|
* 发送变量短信
|
||||||
throw new ApiException(e.getMessage());
|
* @param params 手机号,参数 多个使用;隔开 例: 手机号1,参数A,参数B;手机号2,参数C,参数D
|
||||||
} catch (Exception exception) {
|
* @param msg 短信内容,变量使用{$var}标识
|
||||||
throw new ApiException(exception.getMessage());
|
* @return
|
||||||
}
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Async
|
||||||
|
public SmsSendResponse sendSmsVariable(String phone, SMSMsgEnum smsMsgEnum,String... objects){
|
||||||
|
//
|
||||||
|
//params 手机号,参数 多个使用;隔开 例: 手机号1,参数A,参数B;手机号2,参数C,参数D
|
||||||
|
StringBuffer params = new StringBuffer(phone);
|
||||||
|
for (String object : objects) {
|
||||||
|
params.append(",").append(object);
|
||||||
|
}
|
||||||
|
SmsSendRequest smsSingleRequest = new SmsSendRequest(ACCOUNT, PASS_WORD, smsMsgEnum.getContent(), params.toString());
|
||||||
|
String requestJson = JSON.toJSONString(smsSingleRequest);
|
||||||
|
String response = httpRestTemplateService.postForObject(VARIABLE_SMS_URL, requestJson,String.class);
|
||||||
|
SmsSendResponse smsSingleResponse = JSON.parseObject(response, SmsSendResponse.class);
|
||||||
|
return smsSingleResponse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,9 @@ package com.cool.store.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
|
|
||||||
import com.cool.store.constants.CommonConstants;
|
import com.cool.store.constants.CommonConstants;
|
||||||
import com.cool.store.dao.*;
|
import com.cool.store.dao.*;
|
||||||
import com.cool.store.dto.wx.CodeSessionDTO;
|
import com.cool.store.dto.wx.*;
|
||||||
import com.cool.store.dto.wx.MiniProgramLoginDTO;
|
|
||||||
import com.cool.store.dto.wx.PhoneInfoDTO;
|
|
||||||
import com.cool.store.entity.HyOpenAreaInfoDO;
|
import com.cool.store.entity.HyOpenAreaInfoDO;
|
||||||
import com.cool.store.entity.HyPartnerLineInfoDO;
|
import com.cool.store.entity.HyPartnerLineInfoDO;
|
||||||
import com.cool.store.entity.HyPartnerUserInfoDO;
|
import com.cool.store.entity.HyPartnerUserInfoDO;
|
||||||
@@ -26,6 +23,7 @@ import com.cool.store.utils.UUIDUtils;
|
|||||||
import com.cool.store.vo.PartnerUserInfoVO;
|
import com.cool.store.vo.PartnerUserInfoVO;
|
||||||
import com.cool.store.vo.wx.MiniProgramUserVO;
|
import com.cool.store.vo.wx.MiniProgramUserVO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -71,7 +69,6 @@ public class WechatMiniAppServiceImpl implements WechatMiniAppService {
|
|||||||
@Value("${recommended.channel.id}")
|
@Value("${recommended.channel.id}")
|
||||||
private Integer recommended;
|
private Integer recommended;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PartnerUserInfoVO miniProgramLogin(MiniProgramLoginDTO param) {
|
public PartnerUserInfoVO miniProgramLogin(MiniProgramLoginDTO param) {
|
||||||
log.info("miniProgramLogin #param {}", JSONObject.toJSONString(param));
|
log.info("miniProgramLogin #param {}", JSONObject.toJSONString(param));
|
||||||
@@ -211,4 +208,17 @@ public class WechatMiniAppServiceImpl implements WechatMiniAppService {
|
|||||||
return userInfoVO;
|
return userInfoVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMiniAppUrl() {
|
||||||
|
// 获取小程序token
|
||||||
|
String accessToken = wechatRest.getAccessToken(wxAppId, wxAppSecret);
|
||||||
|
MiniAppUrlLinkReqDTO miniAppUrlLinkReqDTO = new MiniAppUrlLinkReqDTO();
|
||||||
|
// miniAppUrlLinkReqDTO.setPath(weixinIndexUrl);
|
||||||
|
MiniAppUrlLinkDTO miniAppUrlLink = wechatRest.getMiniAppUrlLink(accessToken, miniAppUrlLinkReqDTO);
|
||||||
|
if (miniAppUrlLink != null){
|
||||||
|
return miniAppUrlLink.getUrlLink();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.cool.store.service;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: young.yu
|
||||||
|
* @Date: 2023-09-14 15:22
|
||||||
|
* @Description:
|
||||||
|
*/class SmsServiceTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void sendSmsNormal() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@ import com.cool.store.service.*;
|
|||||||
import com.cool.store.vo.cuser.IdentityCardInfoVO;
|
import com.cool.store.vo.cuser.IdentityCardInfoVO;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -63,6 +64,9 @@ public class TestController {
|
|||||||
@Resource
|
@Resource
|
||||||
private FollowTaskService followTaskService;
|
private FollowTaskService followTaskService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WechatMiniAppService wechatMiniAppService;
|
||||||
|
|
||||||
@PostMapping("/post")
|
@PostMapping("/post")
|
||||||
public ResponseResult<Boolean> get(@RequestBody List<TestRequest> testRequestList){
|
public ResponseResult<Boolean> get(@RequestBody List<TestRequest> testRequestList){
|
||||||
log.info(JSONObject.toJSONString(testRequestList));
|
log.info(JSONObject.toJSONString(testRequestList));
|
||||||
@@ -285,4 +289,9 @@ public class TestController {
|
|||||||
public ResponseResult initOpenArea() {
|
public ResponseResult initOpenArea() {
|
||||||
return ResponseResult.success(openAreaService.addOpenArea());
|
return ResponseResult.success(openAreaService.addOpenArea());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getMiniAppUrl")
|
||||||
|
public ResponseResult getMiniAppUrl(){
|
||||||
|
return ResponseResult.success(wechatMiniAppService.getMiniAppUrl());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public class SignValidateFilter implements Filter {
|
|||||||
|
|
||||||
private static List<String> patternList =
|
private static List<String> patternList =
|
||||||
Lists.newArrayList("/web/check/ok","/check/ok",
|
Lists.newArrayList("/web/check/ok","/check/ok",
|
||||||
|
"/partner/mini/program/**",
|
||||||
"/partner/mini/program/doc.html","/partner/mini/program/v2/api-docs","/**/test/**",
|
"/partner/mini/program/doc.html","/partner/mini/program/v2/api-docs","/**/test/**",
|
||||||
"/partner/mini/program/oss/getUploadFileConfig",
|
"/partner/mini/program/oss/getUploadFileConfig",
|
||||||
"/partner/mini/program/v1/partnerManage/partner/getIdentityCardInfo",
|
"/partner/mini/program/v1/partnerManage/partner/getIdentityCardInfo",
|
||||||
|
|||||||
Reference in New Issue
Block a user