Commit cf6dedc5 authored by hezhen's avatar hezhen

123

parent 1f04c7a6
......@@ -66,6 +66,10 @@ public class SmsTemplateDTO {
public static final int PAY_H = 24;
//取消旅游订单(客服)
public static final int CANCEL_F = 25;
//租车(取车提醒)26
public static final int PAY_I= 26;
//旅游(上车通知)27
public static final int PAY_J= 27;
......
package com.xxfc.platform.universal.biz;
import com.xxfc.platform.universal.service.SmsService;
import com.xxfc.platform.universal.utils.CCPRestSmsUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
......@@ -28,42 +29,58 @@ public class AliYunSmsBiz {
//租车(通用)10
public static final String TEMPLATE_ID_PAY_A = "460759";
//public static final String TEMPLATE_ID_PAY_A = "460759";
public static final String TEMPLATE_ID_PAY_A = "SMS_171112286";
//租车(使用会员权益)11
public static final String TEMPLATE_ID_PAY_B = "460760";
//public static final String TEMPLATE_ID_PAY_B = "460760";
public static final String TEMPLATE_ID_PAY_B = "SMS_173340577";
//租车内部通知(客服)12
public static final String TEMPLATE_ID_PAY_C = "460763";
//public static final String TEMPLATE_ID_PAY_C = "460763";
public static final String TEMPLATE_ID_PAY_C = "SMS_173345572";
//租车内部通知(出车人)13
public static final String TEMPLATE_ID_PAY_D = "460762";
//public static final String TEMPLATE_ID_PAY_D = "460762";
public static final String TEMPLATE_ID_PAY_D = "SMS_173340609";
//租车内部通知(收车人)14
public static final String TEMPLATE_ID_PAY_E = "460764";
//public static final String TEMPLATE_ID_PAY_E = "460764";
public static final String TEMPLATE_ID_PAY_E = "SMS_173345589";
//旅游(通用)15
public static final String TEMPLATE_ID_PAY_F = "460765";
//public static final String TEMPLATE_ID_PAY_F = "460765";
public static final String TEMPLATE_ID_PAY_F = "SMS_173345597";
//会员购买(通用)16
public static final String TEMPLATE_ID_PAY_G = "460766";
//public static final String TEMPLATE_ID_PAY_G = "460766";
public static final String TEMPLATE_ID_PAY_G = "SMS_173340637";
//取消租车(通用)17
public static final String TEMPLATE_ID_CANCEL_A= "460767";
//public static final String TEMPLATE_ID_CANCEL_A= "460767";
public static final String TEMPLATE_ID_CANCEL_A= "SMS_173345633";
//取消租车(使用会员权益)18
public static final String TEMPLATE_ID_CANCEL_B = "460768";
//public static final String TEMPLATE_ID_CANCEL_B = "460768";
public static final String TEMPLATE_ID_CANCEL_B = "SMS_173340658";
//取消租车(通用扣违约金)19
public static final String TEMPLATE_ID_CANCEL_C = "460769";
//public static final String TEMPLATE_ID_CANCEL_C = "460769";
public static final String TEMPLATE_ID_CANCEL_C = "SMS_173345646";
//取消租车(会员权益&扣违 20
public static final String TEMPLATE_ID_CANCEL_D = "460770";
//public static final String TEMPLATE_ID_CANCEL_D = "460770";
public static final String TEMPLATE_ID_CANCEL_D = "SMS_173340671";
//取消租车(出车人)21
public static final String TEMPLATE_ID_CANCEL_E = "460771";
//public static final String TEMPLATE_ID_CANCEL_E = "460771";
public static final String TEMPLATE_ID_CANCEL_E = "SMS_173345667";
//租车押金退还 22
public static final String TEMPLATE_ID_FINISH_A = "460772";
//public static final String TEMPLATE_ID_FINISH_A = "460772";
public static final String TEMPLATE_ID_FINISH_A = "SMS_173340710";
//违章押金退还 23
public static final String TEMPLATE_ID_FINISH_B = "460773";
//public static final String TEMPLATE_ID_FINISH_B = "460773";
public static final String TEMPLATE_ID_FINISH_B = "SMS_173340712";
//旅游内部通知(客服)24
public static final String TEMPLATE_ID_PAY_H = "461421";
//public static final String TEMPLATE_ID_PAY_H = "461421";
public static final String TEMPLATE_ID_PAY_H = "SMS_173340630";
//取消旅游订单(客服)25
public static final String TEMPLATE_ID_CANCEL_F = "461424";
//public static final String TEMPLATE_ID_CANCEL_F = "461424";
public static final String TEMPLATE_ID_CANCEL_F = "SMS_173340695";
//租车(取车提醒)26
public static final String TEMPLATE_ID_PAY_I= "SMS_173345539";
//旅游(上车通知)27
public static final String TEMPLATE_ID_PAY_J= "SMS_173345606";
......@@ -95,52 +112,59 @@ public class AliYunSmsBiz {
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_CANCEL);
break;
case 10 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_A);
//CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_A);
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_PAY_A);
break;
case 11:
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_B);
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_PAY_B);
break;
case 12 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_C);
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_PAY_C);
break;
case 13 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_D);
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_PAY_D);
break;
case 14 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_E);
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_PAY_E);
break;
case 15 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_F);
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_PAY_F);
break;
case 16 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_G);
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_PAY_G);
break;
case 17 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_CANCEL_A);
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_CANCEL_A);
break;
case 18 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_CANCEL_B);
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_CANCEL_B);
break;
case 19 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_CANCEL_C);
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_CANCEL_C);
break;
case 20 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_CANCEL_D);
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_CANCEL_D);
break;
case 21 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_CANCEL_E);
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_CANCEL_E);
break;
case 22 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_FINISH_A);
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_FINISH_A);
break;
case 23 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_FINISH_B);
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_FINISH_B);
break;
case 24 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_H);
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_PAY_H);
break;
case 25 :
CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_CANCEL_F);
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_CANCEL_F);
break;
case 26 :
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_PAY_I);
break;
case 27 :
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_PAY_J);
break;
}
......
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import com.xxfc.platform.universal.biz.AliYunSmsBiz;
import com.xxfc.platform.universal.biz.CCPRestSmsBiz;
import com.xxfc.platform.universal.dto.SmsTemplateDTO;
import com.xxfc.platform.universal.service.SmsService;
......@@ -32,6 +33,9 @@ public class SmsController {
@Autowired
CCPRestSmsBiz smsBiz;
@Autowired
AliYunSmsBiz aliYunSmsBiz;
@RequestMapping(value = "/app/unauth/send", method = RequestMethod.GET) //匹配的是href中的download请求
public JSONObject sendSms(@RequestParam("phone") String phone) throws Exception {
return smsService.smsCode(phone);
......@@ -52,7 +56,7 @@ public class SmsController {
Integer type=smsTemplateDTO.getType();
String[] params=smsTemplateDTO.getParams();
String phoneNumbers=smsTemplateDTO.getPhoneNumbers();
smsBiz.sendTemplateSMS(type,phoneNumbers,params);
aliYunSmsBiz.sendTemplateSMS(type,phoneNumbers,params);
return ObjectRestResponse.succ();
}
}
......
......@@ -148,7 +148,7 @@ public class SmsService {
return false;
}
public boolean sendTemplate(String PhoneNumbers,String params,String templateCode) throws ClientException {
public static boolean sendTemplate(String PhoneNumbers,String params,String templateCode) throws ClientException {
//可自助调整超时时间
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
......@@ -191,12 +191,13 @@ public class SmsService {
return false;
}
public void sendTemplateToJson(String PhoneNumbers,String[] params,String templateCode){
public static void sendTemplateToJson(String PhoneNumbers,String[] params,String templateCode){
try {
JSONObject jsonParams=new JSONObject();
for (int i=0;i<params.length;i++){
jsonParams.put(param+(i+1),params[i]);
}
sendTemplate(PhoneNumbers,jsonParams.toJSONString(),templateCode);
}catch (Exception e){
e.printStackTrace();
......@@ -209,7 +210,7 @@ public class SmsService {
SmsService smsService=new SmsService();
//发短信
String[] params={"1","2","3","2019-08-29","松山湖"};
smsService.sendTemplateToJson("13612688539,13265487972",params,"SMS_169904346");
SmsService.sendTemplateToJson("13612688539,13265487972",params,"SMS_169904346");
/*System.out.println("短信接口返回的数据----------------");
System.out.println("Code=" + response.getCode());
System.out.println("Message=" + response.getMessage());
......
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