Commit 6e6299f8 authored by unset's avatar unset

添加通知信息

parent 5bd63a31
......@@ -26,6 +26,11 @@
<version>2.0-rscp-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.tencentcloudapi</groupId>
<artifactId>tencentcloud-sdk-java</artifactId>
<version>4.0.11</version><!-- 注:这里只是示例版本号,请获取并替换为 最新的版本号 -->
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
......
......@@ -11,8 +11,14 @@ import com.aliyuncs.profile.IClientProfile;
import com.github.wxiaoqi.security.common.util.RandomUtil;
import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.sms.v20190711.SmsClient;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.regex.Matcher;
......@@ -22,6 +28,10 @@ import java.util.regex.Pattern;
@Service
@Slf4j
public class SmsService {
@Autowired
TencentSmsService tencentSmsService;
//产品名称:云通信短信API产品,开发者无需替换
static final String product = "Dysmsapi";
//产品域名,开发者无需替换
......@@ -40,16 +50,8 @@ public class SmsService {
public JSONObject smsCode(String mobile){
String code = RandomUtil.getRandomStr(6);// 6位短信验证码
try {
if(StringUtils.isNotBlank(mobile)){
mobile=mobile.replace(" ", "");
}
code=sendSms(mobile,code);
return JsonResultUtil.createSuccessResultWithObj(code);
} catch (ClientException e) {
log.error(e.getMessage(), e);
return JsonResultUtil.createDefaultFail();
}
tencentSmsService.sendSms(mobile, code);
return JsonResultUtil.createSuccessResult();
}
public JSONObject smsByCode(String mobile,String pwd,String templateCode){
......@@ -276,42 +278,5 @@ public class SmsService {
return true;
}
public static void main(String[] args) throws ClientException, InterruptedException {
SmsService smsService=new SmsService();
//发短信
String[] params={"1","2","3","2019-08-29","【松山湖】"};
SmsService.sendTemplateToJson("13612688539",params,"SMS_169904346");
/*System.out.println("短信接口返回的数据----------------");
System.out.println("Code=" + response.getCode());
System.out.println("Message=" + response.getMessage());
System.out.println("RequestId=" + response.getRequestId());
System.out.println("BizId=" + response.getBizId());*//*
Thread.sleep(3000L);
/*
//查明细
if(response.getCode() != null && response.getCode().equals("OK")) {
QuerySendDetailsResponse querySendDetailsResponse = querySendDetails(response.getBizId());
System.out.println("短信明细查询接口返回数据----------------");
System.out.println("Code=" + querySendDetailsResponse.getCode());
System.out.println("Message=" + querySendDetailsResponse.getMessage());
int i = 0;
for(QuerySendDetailsResponse.SmsSendDetailDTO smsSendDetailDTO : querySendDetailsResponse.getSmsSendDetailDTOs())
{
System.out.println("SmsSendDetailDTO["+i+"]:");
System.out.println("Content=" + smsSendDetailDTO.getContent());
System.out.println("ErrCode=" + smsSendDetailDTO.getErrCode());
System.out.println("OutId=" + smsSendDetailDTO.getOutId());
System.out.println("PhoneNum=" + smsSendDetailDTO.getPhoneNum());
System.out.println("ReceiveDate=" + smsSendDetailDTO.getReceiveDate());
System.out.println("SendDate=" + smsSendDetailDTO.getSendDate());
System.out.println("SendStatus=" + smsSendDetailDTO.getSendStatus());
System.out.println("Template=" + smsSendDetailDTO.getTemplateCode());
}
System.out.println("TotalCount=" + querySendDetailsResponse.getTotalCount());
System.out.println("RequestId=" + querySendDetailsResponse.getRequestId());
}*/
}
}
package com.upyuns.platform.rs.universal.service;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.sms.v20190711.SmsClient;
import com.tencentcloudapi.sms.v20190711.models.SendSmsRequest;
import com.tencentcloudapi.sms.v20190711.models.SendSmsResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @ClassName : TencentSmsService
* @Description : 腾讯云短信服务
* @Author : jiaoruizhen
* @Date: 2020-12-29 14:39
*/
@Service
@Slf4j
public class TencentSmsService {
public ObjectRestResponse sendSms(String phone, String message) {
try{
Credential cred = new Credential("AKIDkfPxIRmqxlgOuDv2XVKgqtlII6waAzPe", "FZhqmqjOQGtJl1PehXD8uhJ1ItHSTH7o");
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint("sms.tencentcloudapi.com");
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
SmsClient client = new SmsClient(cred, "", clientProfile);
String params = "{\"PhoneNumberSet\":[\"+86"+ phone +"\"],\"TemplateID\":\"365123\",\"Sign\":\"中科光启\",\"TemplateParamSet\":[\""+message+"\"],\"SmsSdkAppid\":\"1400227859\"}";
SendSmsRequest req = SendSmsRequest.fromJsonString(params, SendSmsRequest.class);
SendSmsResponse resp = client.SendSms(req);
return ObjectRestResponse.succ(resp);
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
return ObjectRestResponse.succ();
}
public static void main(String [] args) {
}
}
......@@ -1027,18 +1027,11 @@ public class OrderInfoBiz extends BaseBiz<OrderInfoMapper, OrderInfo> {
if (old == null) {
return ObjectRestResponse.createFailedResult(ResultCode.ORDER_NOT_EXIST, ResultCode.getMsg(ResultCode.ORDER_NOT_EXIST));
}
if (orderInfo.getAuditStatus() == 1) {
old.setPayImg(orderInfo.getPayImg());
old.setPayCode(orderInfo.getPayCode());
old.setPayType(3);
old.setPayTime(new Date());
old.setAuditStatus(1);
updateSelectiveByIdRe(old);
} else {
old.setAuditStatus(2);
old.setAuditReason(orderInfo.getAuditReason());
updateSelectiveByIdRe(old);
}
return ObjectRestResponse.succ();
}
......@@ -1056,10 +1049,19 @@ public class OrderInfoBiz extends BaseBiz<OrderInfoMapper, OrderInfo> {
if (old == null) {
return ObjectRestResponse.createFailedResult(ResultCode.ORDER_NOT_EXIST, ResultCode.getMsg(ResultCode.ORDER_NOT_EXIST));
}
old.setStatus(OrderStatusEnum.ORDER_SEND.getType());
old.setPayStatus(2);
if (orderInfo.getAuditStatus() == 1) {
old.setPayImg(orderInfo.getPayImg());
old.setPayCode(orderInfo.getPayCode());
old.setPayType(3);
old.setPayTime(new Date());
old.setAuditStatus(1);
old.setStatus(OrderStatusEnum.ORDER_SEND.getType());
updateSelectiveByIdRe(old);
} else {
old.setAuditStatus(2);
old.setAuditReason(orderInfo.getAuditReason());
updateSelectiveByIdRe(old);
}
return ObjectRestResponse.succ();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment