|
|
@ -26,6 +26,9 @@ import java.util.Map; |
|
|
|
@Slf4j |
|
|
|
public class AliyunSmsUtils { |
|
|
|
|
|
|
|
public static String UPDATE = "update";//修改订单 |
|
|
|
public static String CANCEL = "cancel";//取消订单 |
|
|
|
|
|
|
|
private static Client client; |
|
|
|
|
|
|
|
@Autowired |
|
|
@ -48,6 +51,18 @@ public class AliyunSmsUtils { |
|
|
|
// 【猫妈狗爸】订单编号:【订单编号字段】长时间无人接单,请处理! |
|
|
|
private static String longTimeNoOrderAccepted = "SMS_488875138"; |
|
|
|
|
|
|
|
// 【猫妈狗爸】取消订单通知消费者 |
|
|
|
private static String NotifyOrderCancel = "SMS_493700126"; |
|
|
|
|
|
|
|
// 【猫妈狗爸】取消订单通知伴宠师 |
|
|
|
private static String NotifyOrderCancelTechnician = "SMS_493815144"; |
|
|
|
|
|
|
|
// 【猫妈狗爸】修改订单通知伴宠师 |
|
|
|
private static String NotifyOrderUpdateTechnician = "SMS_493705144"; |
|
|
|
|
|
|
|
// 【猫妈狗爸】修改订单通知消费者 |
|
|
|
private static String NotifyOrderUpdate = "SMS_493915117"; |
|
|
|
|
|
|
|
@SneakyThrows(Exception.class) |
|
|
|
public AliyunSmsUtils(SmsProperties smsProperties) { |
|
|
|
if (client == null) { |
|
|
@ -151,7 +166,7 @@ public class AliyunSmsUtils { |
|
|
|
} |
|
|
|
|
|
|
|
public static SmsResult sendBcshOrderBeginNextDaySMS(String phones, String address, String petName) { |
|
|
|
log.info("【短信发送】开始发送短信消费者:伴宠师订单服务开始通知"); |
|
|
|
log.info("【短信发送】开始发送短信伴宠师:伴宠师订单服务开始通知"); |
|
|
|
Map<String, String> param = new HashMap<>(); |
|
|
|
param.put("address", address); |
|
|
|
param.put("petName", petName); |
|
|
@ -160,21 +175,30 @@ public class AliyunSmsUtils { |
|
|
|
} |
|
|
|
|
|
|
|
public static SmsResult sendBcshOrderBeginTodaySMS(String phones, String address, String petName) { |
|
|
|
log.info("【短信发送】开始发送短信消费者:伴宠师-订单服务开始通知"); |
|
|
|
Map<String, String> param = new HashMap<>(); |
|
|
|
param.put("address", address); |
|
|
|
param.put("petName", petName); |
|
|
|
try { |
|
|
|
log.info("【短信发送】开始发送短信伴宠师:伴宠师-订单服务开始通知"); |
|
|
|
Map<String, String> param = new HashMap<>(); |
|
|
|
param.put("address", address); |
|
|
|
param.put("petName", petName); |
|
|
|
|
|
|
|
return send(phones, bcshOrderBeginToday, param); |
|
|
|
return send(phones, bcshOrderBeginToday, param); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("短信发生失败:", e); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
public static SmsResult sendBcshOrderCompleteSMS(String phones, String orderId, String amount) { |
|
|
|
log.info("【短信发送】开始发送短信消费者:伴宠师订单完成通知"); |
|
|
|
Map<String, String> param = new HashMap<>(); |
|
|
|
param.put("orderId", orderId); |
|
|
|
param.put("amount", amount); |
|
|
|
|
|
|
|
return send(phones, bcshOrderComplete, param); |
|
|
|
try { |
|
|
|
log.info("【短信发送】开始发送短信伴宠师:伴宠师订单完成通知"); |
|
|
|
Map<String, String> param = new HashMap<>(); |
|
|
|
param.put("orderId", orderId); |
|
|
|
param.put("amount", amount); |
|
|
|
return send(phones, bcshOrderComplete, param); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("短信发生失败:", e); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
public static SmsResult sendLongTimeNoOrderAccepted(String phones, String orderId) { |
|
|
@ -189,6 +213,52 @@ public class AliyunSmsUtils { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
public static SmsResult sendNotifyOrderUpdateTechnician(String phones, String orderId) { |
|
|
|
try { |
|
|
|
log.info("【短信发送】修改订单通知伴宠师"); |
|
|
|
Map<String, String> param = new HashMap<>(); |
|
|
|
param.put("orderId", orderId); |
|
|
|
return send(phones, NotifyOrderUpdateTechnician, param); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("短信发生失败:", e); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
public static SmsResult sendNotifyOrderUpdate(String phones) { |
|
|
|
try { |
|
|
|
log.info("【短信发送】修改订单通知消费者"); |
|
|
|
Map<String, String> param = new HashMap<>(); |
|
|
|
return send(phones, NotifyOrderUpdate, param); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("短信发生失败:", e); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
public static SmsResult sendNotifyOrderCancel(String phones) { |
|
|
|
try { |
|
|
|
log.info("【短信发送】取消订单通知消费者"); |
|
|
|
Map<String, String> param = new HashMap<>(); |
|
|
|
return send(phones, NotifyOrderCancel, param); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("短信发生失败:", e); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
public static SmsResult sendNotifyOrderCancelTechnician(String phones, String orderId) { |
|
|
|
try { |
|
|
|
log.info("【短信发送】取消订单通知消费者"); |
|
|
|
Map<String, String> param = new HashMap<>(); |
|
|
|
param.put("orderId", orderId); |
|
|
|
return send(phones, NotifyOrderCancelTechnician, param); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("短信发生失败:", e); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
public static SmsResult sendOrderUpdate(String phones, String type, String orderId) { |
|
|
|
// try { |
|
|
|
// log.info("【短信发送】通知管理员长时间无人接单,请处理!"); |
|
|
@ -199,6 +269,13 @@ public class AliyunSmsUtils { |
|
|
|
// }catch (Exception e){ |
|
|
|
// log.error("短信发生失败:", e); |
|
|
|
// } |
|
|
|
|
|
|
|
if (CANCEL.equals(type)){ |
|
|
|
sendNotifyOrderCancelTechnician(phones, orderId); |
|
|
|
}else if (UPDATE.equals(type)){ |
|
|
|
sendNotifyOrderUpdateTechnician(phones, orderId); |
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
} |