feat:任务定时任务下发

This commit is contained in:
2026-07-24 10:06:35 +08:00
parent 6f566b7a69
commit 89c21e900e
14 changed files with 623 additions and 199 deletions

View File

@@ -0,0 +1,45 @@
package cn.code.nl.framework.common.util.http;
import cn.code.nl.framework.common.util.json.JsonUtils;
import cn.hutool.core.util.StrUtil;
import java.util.Collections;
import java.util.Map;
/**
* ACS 调用工具
*/
public class AcsUtil {
/**
* 发送 POST 请求并解析响应
*
* @param serverAddress ACS 服务地址
* @param api API 路径
* @param request 请求参数
* @param responseType 响应类型
* @return 响应对象
*/
public static <T> T post(String serverAddress, String api, Object request, Class<T> responseType) {
String url = buildUrl(serverAddress, api);
String response = HttpUtils.post(url, headers(), JsonUtils.toJsonString(request));
return JsonUtils.parseObject(response, responseType);
}
/**
* 拼接服务地址和 API
*/
private static String buildUrl(String serverAddress, String api) {
String baseUrl = StrUtil.removeSuffix(serverAddress, StrUtil.SLASH);
String apiPath = StrUtil.addPrefixIfNot(api, StrUtil.SLASH);
return baseUrl + apiPath;
}
/**
* 构建 JSON 请求头
*/
private static Map<String, String> headers() {
return Collections.singletonMap("Content-Type", "application/json;charset=UTF-8");
}
}