md
This commit is contained in:
parent
dbf23ad80c
commit
4d8da413cc
@ -578,16 +578,48 @@ public class EmisBaseService {
|
||||
log.error("===>Start 发送短信:"+dt.getBillCode()+","+dt.getPhone()+" :smsType:"+dt.getSmsType());
|
||||
|
||||
try {
|
||||
// 发件短信
|
||||
if ("1".equals(dt.getSmsType())) {
|
||||
aliyunSMSService.sendMessage("探路速运", "SMS_465316363", dt.getPhone(), dt.getContent());
|
||||
|
||||
EmisWaybill waybill = getWaybillByBillCode(dt.getBillCode());
|
||||
// "尊敬的客户:您寄往${Nationalcity}的包裹已寄出,运单号${name}。如有疑问,详询服务热线4000257080,感谢您使用探路速运!";
|
||||
String nationalcity=waybill.getReceiveCountryName()+""+waybill.getReceiveProvinceName();
|
||||
JSONObject jObjParam = new JSONObject();
|
||||
jObjParam.put("Nationalcity",nationalcity);
|
||||
jObjParam.put("name",dt.getBillCode());
|
||||
|
||||
aliyunSMSService.sendMessage("探路速运", "SMS_465316363", dt.getPhone(), jObjParam.toJSONString());
|
||||
|
||||
}
|
||||
// 签收短信
|
||||
else if ("2".equals(dt.getSmsType())) {
|
||||
aliyunSMSService.sendMessage("探路速运", "SMS_465341331", dt.getPhone(), dt.getContent());
|
||||
|
||||
EmisWaybill waybill = getWaybillByBillCode(dt.getBillCode());
|
||||
// 尊敬的客户:您寄往${Nationalcity}的快递${name}已被签收,感谢您使用探路速运。
|
||||
String nationalcity=waybill.getReceiveCountryName()+""+waybill.getReceiveProvinceName();
|
||||
JSONObject jObjParam = new JSONObject();
|
||||
jObjParam.put("Nationalcity",nationalcity);
|
||||
jObjParam.put("name",dt.getBillCode());
|
||||
|
||||
aliyunSMSService.sendMessage("探路速运", "SMS_465341331", dt.getPhone(), jObjParam.toJSONString());
|
||||
|
||||
}
|
||||
// 问题件
|
||||
else if ("3".equals(dt.getSmsType())) {
|
||||
aliyunSMSService.sendMessage("探路速运", "SMS_465386407", dt.getPhone(), dt.getContent());
|
||||
|
||||
EmisWaybill waybill = getWaybillByBillCode(dt.getBillCode());
|
||||
|
||||
// "尊敬的用户:您的运单${name}从${Sendingcountry}寄往${Receivingcountry}因${Problemtype}的问题导致货物时效延误预计送达时间${time},详询400-025-7080感谢您对探路速运的支持!";
|
||||
String sendingcountry=waybill.getSendCountryName();
|
||||
String receivingcountry=waybill.getReceiveCountryName();
|
||||
JSONObject jObjParam = new JSONObject();
|
||||
jObjParam.put("${Sendingcountry}",sendingcountry);
|
||||
jObjParam.put("${Receivingcountry}",receivingcountry);
|
||||
jObjParam.put("${name}",waybill.getBillCode());
|
||||
jObjParam.put("${Problemtype}",waybill.getProblemCause());
|
||||
jObjParam.put"${time}",DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,waybill.getEstimateDate()));
|
||||
|
||||
aliyunSMSService.sendMessage("探路速运", "SMS_465386407", dt.getPhone(), jObjParam.toJSONString());
|
||||
}
|
||||
else{
|
||||
continue;
|
||||
|
||||
@ -24,16 +24,16 @@ public class AliyunSMSService {
|
||||
* @param signName 签名
|
||||
* @param templateCode 模板
|
||||
* @param phone 手机号
|
||||
* @param param 参数
|
||||
* @param tplParam 参数
|
||||
*/
|
||||
public int sendMessage(String signName, String templateCode, String phone, String param) throws EmisBizError {
|
||||
public int sendMessage(String signName,String phone, String templateCode,String tplParam) throws EmisBizError {
|
||||
|
||||
String jsonParamStr=configService.selectConfigByKey("sys.aliyun.sms");
|
||||
JSONObject jObjParam=JSONObject.parseObject(jsonParamStr);
|
||||
String accessKeyId=jObjParam.getString("accessKeyId");
|
||||
String accessKeySecret=jObjParam.getString("accessKeySecret");
|
||||
JSONObject jObjAliyunParam=JSONObject.parseObject(jsonParamStr);
|
||||
String accessKeyId=jObjAliyunParam.getString("accessKeyId");
|
||||
String accessKeySecret=jObjAliyunParam.getString("accessKeySecret");
|
||||
|
||||
return innerSendMessage(accessKeyId,accessKeySecret,signName,templateCode,phone,param);
|
||||
return innerSendMessage(accessKeyId,accessKeySecret,signName,templateCode,phone,tplParam);
|
||||
|
||||
}
|
||||
|
||||
@ -53,14 +53,15 @@ public class AliyunSMSService {
|
||||
return new Client(config);
|
||||
}
|
||||
|
||||
public static int innerSendMessage(String accessKeyId,String accessKeySecret,String signName, String templateCode, String phoneNumbers, String param) throws EmisBizError {
|
||||
public static int innerSendMessage(String accessKeyId,String accessKeySecret,String signName,String templateCode, String phone, String tplParam) throws EmisBizError {
|
||||
try {
|
||||
Client client = createClient(accessKeyId, accessKeySecret);
|
||||
com.aliyun.dysmsapi20170525.models.SendSmsRequest sendSmsRequest = new com.aliyun.dysmsapi20170525.models.SendSmsRequest();
|
||||
sendSmsRequest.setPhoneNumbers(phoneNumbers);
|
||||
sendSmsRequest.setPhoneNumbers(phone);
|
||||
sendSmsRequest.setSignName(signName);
|
||||
sendSmsRequest.setTemplateCode(templateCode);
|
||||
sendSmsRequest.setTemplateParam("{\"code\":\""+param+"\"}");
|
||||
// sendSmsRequest.setTemplateParam("{\"code\":\""+param+"\"}");
|
||||
sendSmsRequest.setTemplateParam(tplParam);
|
||||
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
||||
com.aliyun.dysmsapi20170525.models.SendSmsResponse response = client.sendSmsWithOptions(sendSmsRequest, runtime);
|
||||
String jsonStr=com.aliyun.teautil.Common.toJSONString(TeaModel.buildMap(response));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user