2025008071805

This commit is contained in:
张潘 2025-08-16 17:57:02 +08:00
parent 656a75b226
commit 325512b168
3 changed files with 21 additions and 15 deletions

View File

@ -2963,11 +2963,11 @@ public class DispatchUtil {
//给师傅派单的时候的推送 //给师傅派单的时候的推送
WXsendMsgUtil.sendMsgForWorkerInfo(worker.getOpenid(), order, serviceGoods); WXsendMsgUtil.sendMsgForWorkerInfo(worker.getOpenid(), order, serviceGoods);
Map<String, Object> map= OrderBindWorkerUtil.getOrderBindWorker(order.getId()); Map<String, Object> map= OrderBindWorkerUtil.getOrderBindWorker(order.getId());
YunXinPhoneUtilAPI.httpsAxbTransfer(order.getWorkerPhone()); YunXinPhoneUtilAPI.httpsAxbTransfer(order.getWorkerPhone(), order.getId());
if (map.get("code").equals("200")) { // if (map.get("code").equals("200")) {
//电话通知 // //电话通知
YunXinPhoneUtilAPI.httpsAxbTransfer(order.getWorkerPhone()); // YunXinPhoneUtilAPI.httpsAxbTransfer(order.getWorkerPhone());
} // }
return worker; return worker;

View File

@ -293,9 +293,10 @@ public class ScheduledTaskUtil implements CommandLineRunner {
* 使用说明 * 使用说明
* - 用于测试定时任务的执行情况 * - 用于测试定时任务的执行情况
*/ */
@Scheduled(fixedRate = 3000) // 每3秒执行一次 @Scheduled(fixedRate = 3 * 60 * 1000) // // 每3分钟执行一次
public void testScheduledTask() { public void TheCallWordercheduledTask() throws Exception {
log.info("测试定时任务执行中... 当前时间: {}", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); OrderUtil.TheCallWorder();
log.info("每3分钟执行一次师傅的语音通知... 当前时间: {}", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
} }
/** /**

View File

@ -7,6 +7,7 @@ import com.winnerlook.util.Base64;
import com.winnerlook.util.MD5Util; import com.winnerlook.util.MD5Util;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map;
/** /**
* 云信小号相关API工具类 * 云信小号相关API工具类
@ -36,7 +37,7 @@ public class YunXinPhoneUtilAPI {
// 回调地址常量可通过set方法动态设置 // 回调地址常量可通过set方法动态设置
private static String AXB_CALLBACK_URL = ""; private static String AXB_CALLBACK_URL = "";
private static String NOTIFY_CALLBACK_URL = ""; private static String NOTIFY_CALLBACK_URL = "https://552e105d.r3.cpolar.top/api/YunXin/notify";
// 回调地址常量可通过set方法动态设置 // 回调地址常量可通过set方法动态设置
@ -64,16 +65,20 @@ public class YunXinPhoneUtilAPI {
* @throws Exception 异常 * @throws Exception 异常
* <p>回调地址使用 NOTIFY_CALLBACK_URL 常量如需动态设置请调用 setNotifyCallbackUrl 方法</p> * <p>回调地址使用 NOTIFY_CALLBACK_URL 常量如需动态设置请调用 setNotifyCallbackUrl 方法</p>
*/ */
public static VoiceResponseResult httpsAxbTransfer(String phone) throws Exception { public static VoiceResponseResult httpsAxbTransfer(String phone,Long oid) throws Exception {
VoiceResponseResult resultObj = new VoiceResponseResult(); VoiceResponseResult resultObj = new VoiceResponseResult();
String url = NOTIFY_URL; String url = NOTIFY_URL;
try { try {
LinkedHashMap<String, String> templateArgsDATA = new LinkedHashMap<String, String>();
templateArgsDATA.put("orderid", oid.toString());
// 组装请求体 // 组装请求体
VoiceNotifyBody transfer = new VoiceNotifyBody(); VoiceNotifyBody transfer = new VoiceNotifyBody();
transfer.setCalleeNumber(phone); transfer.setCalleeNumber(phone);
transfer.setTemplateId(templateID); transfer.setTemplateId(templateID);
transfer.setTemplateArgs( new LinkedHashMap<String, String>()); // 可根据需要传递参数 transfer.setTemplateArgs( new LinkedHashMap<String, String>()); // 可根据需要传递参数
transfer.setCallbackUrl(NOTIFY_CALLBACK_URL); transfer.setCallbackUrl(NOTIFY_CALLBACK_URL);
JSONObject json = JSONObject.parseObject(JSON.toJSONString(transfer));
json.put("customerData", String.valueOf(oid));
// 获取当前时间戳 // 获取当前时间戳
long timestamp = System.currentTimeMillis(); long timestamp = System.currentTimeMillis();
@ -82,7 +87,7 @@ public class YunXinPhoneUtilAPI {
String sig = MD5Util.getMD5(APP_ID + TOKEN + timestamp); String sig = MD5Util.getMD5(APP_ID + TOKEN + timestamp);
// 拼接最终URL // 拼接最终URL
url = url + "/" + APP_ID + "/" + sig; url = url + "/" + APP_ID + "/" + sig;
String body = JSON.toJSONString(transfer); String body = json.toJSONString();
// 调用HTTPS服务 // 调用HTTPS服务
HttpsService httpsService = new HttpsService(); HttpsService httpsService = new HttpsService();
@ -183,10 +188,10 @@ public class YunXinPhoneUtilAPI {
*/ */
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
// 设置回调地址如有需要 // 设置回调地址如有需要
setAxbCallbackUrl("http://your-callback-url.com/axb"); // setAxbCallbackUrl("http://your-callback-url.com/axb");
setNotifyCallbackUrl("http://your-callback-url.com/notify"); // setNotifyCallbackUrl("http://your-callback-url.com/notify");
// 示例解绑操作 // 示例解绑操作
VoiceResponseResult res = httpsPrivacyUnbind("15270824290", "18339212639", "13279237164"); VoiceResponseResult res = httpsAxbTransfer("18339212639",3252L);
System.out.println("解绑结果:" + JSON.toJSONString(res)); System.out.println("解绑结果:" + JSON.toJSONString(res));
} }
} }