diff --git a/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/filter/RepeatableReadServletRequestResponseFilter.java b/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/filter/RepeatableReadWriteServletRequestResponseFilter.java similarity index 79% rename from src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/filter/RepeatableReadServletRequestResponseFilter.java rename to src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/filter/RepeatableReadWriteServletRequestResponseFilter.java index fe4c138947..a48aeebe73 100644 --- a/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/filter/RepeatableReadServletRequestResponseFilter.java +++ b/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/filter/RepeatableReadWriteServletRequestResponseFilter.java @@ -24,26 +24,31 @@ package com.tencent.bk.job.common.web.filter; -import com.tencent.bk.job.common.web.model.RepeatableReadHttpServletRequest; import com.tencent.bk.job.common.web.model.RepeatableReadHttpServletResponse; +import com.tencent.bk.job.common.web.model.RepeatableReadWriteHttpServletRequest; import lombok.extern.slf4j.Slf4j; -import javax.servlet.*; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @Slf4j -public class RepeatableReadServletRequestResponseFilter implements Filter { +public class RepeatableReadWriteServletRequestResponseFilter implements Filter { @Override - public void init(FilterConfig filterConfig) throws ServletException { + public void init(FilterConfig filterConfig) { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { - ServletRequest requestWrapper = new RepeatableReadHttpServletRequest((HttpServletRequest) request); + ServletRequest requestWrapper = new RepeatableReadWriteHttpServletRequest((HttpServletRequest) request); ServletResponse responseWrapper = new RepeatableReadHttpServletResponse((HttpServletResponse) response); chain.doFilter(requestWrapper, responseWrapper); } diff --git a/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/interceptor/EsbApiLogInterceptor.java b/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/interceptor/EsbApiLogInterceptor.java index 18fb3e3fe7..6188a730c2 100644 --- a/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/interceptor/EsbApiLogInterceptor.java +++ b/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/interceptor/EsbApiLogInterceptor.java @@ -27,8 +27,8 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode; import com.tencent.bk.job.common.util.json.JsonUtils; -import com.tencent.bk.job.common.web.model.RepeatableReadHttpServletRequest; import com.tencent.bk.job.common.web.model.RepeatableReadHttpServletResponse; +import com.tencent.bk.job.common.web.model.RepeatableReadWriteHttpServletRequest; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpMethod; @@ -45,10 +45,10 @@ public class EsbApiLogInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { - if (!(request instanceof RepeatableReadHttpServletRequest)) { + if (!(request instanceof RepeatableReadWriteHttpServletRequest)) { return true; } - RepeatableReadHttpServletRequest wrapperRequest = (RepeatableReadHttpServletRequest) request; + RepeatableReadWriteHttpServletRequest wrapperRequest = (RepeatableReadWriteHttpServletRequest) request; String desensitizedBody = ""; String desensitizedQueryParams = ""; String username = ""; diff --git a/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/interceptor/EsbReqRewriteInterceptor.java b/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/interceptor/EsbReqRewriteInterceptor.java new file mode 100644 index 0000000000..79b12cefc4 --- /dev/null +++ b/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/interceptor/EsbReqRewriteInterceptor.java @@ -0,0 +1,95 @@ +/* + * Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. + * + * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. + * + * BK-JOB蓝鲸智云作业平台 is licensed under the MIT License. + * + * License for BK-JOB蓝鲸智云作业平台: + * -------------------------------------------------------------------- + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and + * to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of + * the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO + * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +package com.tencent.bk.job.common.web.interceptor; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.fasterxml.jackson.databind.node.TextNode; +import com.tencent.bk.job.common.constant.JobCommonHeaders; +import com.tencent.bk.job.common.util.json.JsonUtils; +import com.tencent.bk.job.common.web.model.RepeatableReadWriteHttpServletRequest; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.http.HttpMethod; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@Slf4j +@Component +public class EsbReqRewriteInterceptor extends HandlerInterceptorAdapter { + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { + if (!(request instanceof RepeatableReadWriteHttpServletRequest)) { + return true; + } + RepeatableReadWriteHttpServletRequest wrapperRequest = (RepeatableReadWriteHttpServletRequest) request; + + String appCode = request.getHeader(JobCommonHeaders.APP_CODE); + String username = request.getHeader(JobCommonHeaders.USERNAME); + + try { + if (request.getMethod().equals(HttpMethod.POST.name()) + || request.getMethod().equals(HttpMethod.PUT.name())) { + if (StringUtils.isNotBlank(wrapperRequest.getBody())) { + ObjectNode jsonBody = (ObjectNode) JsonUtils.toJsonNode(wrapperRequest.getBody()); + if (jsonBody == null) { + return true; + } + // reset username and appCode + if (StringUtils.isNotBlank(username)) { + String usernameInBody = jsonBody.get("bk_username").asText(); + if (StringUtils.isNotEmpty(usernameInBody) && !usernameInBody.equals(username)) { + log.error("Invalid username, usernameInBody: {}, username: {}", usernameInBody, username); + } + jsonBody.set("bk_username", new TextNode(username)); + } else { + log.error("Header {} is missing", JobCommonHeaders.USERNAME); + } + + if (StringUtils.isNotBlank(appCode)) { + String appCodeInBody = jsonBody.get("bk_app_code").asText(); + if (StringUtils.isNotEmpty(appCodeInBody) && !appCodeInBody.equals(appCode)) { + log.error("Invalid appCode, appCodeInBody: {}, appCode: {}", appCodeInBody, appCode); + } + jsonBody.set("bk_app_code", new TextNode(appCode)); + } else { + log.error("Header {} is missing", JobCommonHeaders.APP_CODE); + } + + // hidden sensitive data + jsonBody.set("bk_app_secret", TextNode.valueOf("***")); + wrapperRequest.setBody(jsonBody.toString()); + } + } + } catch (Throwable e) { + log.warn("Rewrite EsbReq error", e); + return true; + } + return true; + } +} diff --git a/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/model/RepeatableReadHttpServletRequest.java b/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/model/RepeatableReadWriteHttpServletRequest.java similarity index 88% rename from src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/model/RepeatableReadHttpServletRequest.java rename to src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/model/RepeatableReadWriteHttpServletRequest.java index b5ee66ac90..c627dde9a6 100644 --- a/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/model/RepeatableReadHttpServletRequest.java +++ b/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/model/RepeatableReadWriteHttpServletRequest.java @@ -30,17 +30,21 @@ import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; -import java.io.*; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; /** - * 由于HttpServletRequest的InputStream只允许读取一次,为了能够重复读取body,需要用装饰模式来包装 + * 由于HttpServletRequest的InputStream只允许读取一次,为了能够重复读写body,需要用装饰模式来包装 */ @Slf4j -public class RepeatableReadHttpServletRequest extends HttpServletRequestWrapper { - private final String body; +public class RepeatableReadWriteHttpServletRequest extends HttpServletRequestWrapper { + private String body; - public RepeatableReadHttpServletRequest(HttpServletRequest request) { + public RepeatableReadWriteHttpServletRequest(HttpServletRequest request) { super(request); StringBuilder stringBuilder = new StringBuilder(); BufferedReader br = null; @@ -103,4 +107,8 @@ public BufferedReader getReader() { public String getBody() { return this.body; } + + public void setBody(String newBody) { + this.body = newBody; + } } diff --git a/src/backend/commons/esb-sdk/src/main/java/com/tencent/bk/job/common/esb/consts/BkConsts.java b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/constant/JobCommonHeaders.java similarity index 65% rename from src/backend/commons/esb-sdk/src/main/java/com/tencent/bk/job/common/esb/consts/BkConsts.java rename to src/backend/commons/common/src/main/java/com/tencent/bk/job/common/constant/JobCommonHeaders.java index 0e915ff9da..e6331df457 100644 --- a/src/backend/commons/esb-sdk/src/main/java/com/tencent/bk/job/common/esb/consts/BkConsts.java +++ b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/constant/JobCommonHeaders.java @@ -22,25 +22,10 @@ * IN THE SOFTWARE. */ -package com.tencent.bk.job.common.esb.consts; - -/** - * 常量定义 - */ -public final class BkConsts { - - public static final String X_CSRF_KEY = "X-CSRFToken"; - public static final String CSRF_KEY = "csrftoken"; - public static final String C_BK_TOKEN = "bk_token"; - public static final String C_BK_UID = "bk_uid"; - public static final String C_BK_TICKET = "bk_ticket"; - public static final String SYS_LANGUAGE = "lang"; - public static final String USER_SESSION = "user"; - - public static final String STATIC_VERSION = "STATIC_VERSION"; // 静态资源URL - public static final String APP_ID = "APP_ID"; - public static final String SITE_URL = "SITE_URL"; //APP URL +package com.tencent.bk.job.common.constant; +public interface JobCommonHeaders { - public static final String TZ_ASIA_SHANGHAI = "Asia/Shanghai"; + String APP_CODE = "X-AppCode"; + String USERNAME = "X-Username"; } diff --git a/src/backend/commons/esb-sdk/build.gradle b/src/backend/commons/esb-sdk/build.gradle index 2679231c55..90a4ba57b6 100644 --- a/src/backend/commons/esb-sdk/build.gradle +++ b/src/backend/commons/esb-sdk/build.gradle @@ -31,6 +31,7 @@ dependencies { implementation 'io.springfox:springfox-swagger2' compile 'org.apache.commons:commons-lang3' implementation "org.springframework:spring-jdbc" + implementation 'org.springframework:spring-web' implementation "net.sf.dozer:dozer" implementation 'org.apache.commons:commons-collections4' implementation 'net.sourceforge.jchardet:jchardet' diff --git a/src/backend/commons/esb-sdk/src/main/java/com/tencent/bk/job/common/esb/metrics/EsbApiTimedAspect.java b/src/backend/commons/esb-sdk/src/main/java/com/tencent/bk/job/common/esb/metrics/EsbApiTimedAspect.java index a47b93011e..156bd6b8ba 100644 --- a/src/backend/commons/esb-sdk/src/main/java/com/tencent/bk/job/common/esb/metrics/EsbApiTimedAspect.java +++ b/src/backend/commons/esb-sdk/src/main/java/com/tencent/bk/job/common/esb/metrics/EsbApiTimedAspect.java @@ -24,7 +24,7 @@ package com.tencent.bk.job.common.esb.metrics; -import com.tencent.bk.job.common.esb.model.EsbReq; +import com.tencent.bk.job.common.constant.JobCommonHeaders; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.Tags; @@ -35,7 +35,11 @@ import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import javax.servlet.http.HttpServletRequest; import java.lang.reflect.Method; @@ -61,29 +65,21 @@ public static Tag exception(Throwable exception) { @Around("execution (@com.tencent.bk.job.common.esb.metrics.EsbApiTimed * *.*(..))") public Object timedMethod(ProceedingJoinPoint pjp) throws Throwable { - Object[] args = pjp.getArgs(); - if (args == null || args.length == 0) { - return pjp.proceed(); + RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); + HttpServletRequest request = null; + if (requestAttributes != null) { + request = ((ServletRequestAttributes)requestAttributes).getRequest(); } - - String appCode = ""; - try { - for (Object arg : args) { - if (arg instanceof EsbReq) { - EsbReq esbReq = (EsbReq) arg; - appCode = esbReq.getAppCode(); - break; - } - } - } catch (Throwable e) { - log.error("Process EsbReq fail!", e); + if (request == null) { return pjp.proceed(); } + String appCode = request.getHeader(JobCommonHeaders.APP_CODE); + Tags tags = Tags.of("app_code", StringUtils.isNotBlank(appCode) ? appCode : "None"); + Method method = ((MethodSignature) pjp.getSignature()).getMethod(); EsbApiTimed timed = method.getAnnotation(EsbApiTimed.class); final String metricName = timed.value(); - Tags tags = Tags.of("app_code", StringUtils.isNotBlank(appCode) ? appCode : "None"); return processWithTimer(pjp, timed, metricName, tags); } diff --git a/src/backend/job-analysis/boot-job-analysis/src/main/java/com/tencent/bk/job/analysis/config/FilterConfig.java b/src/backend/job-analysis/boot-job-analysis/src/main/java/com/tencent/bk/job/analysis/config/FilterConfig.java index b4869f34e2..9b4c38af10 100644 --- a/src/backend/job-analysis/boot-job-analysis/src/main/java/com/tencent/bk/job/analysis/config/FilterConfig.java +++ b/src/backend/job-analysis/boot-job-analysis/src/main/java/com/tencent/bk/job/analysis/config/FilterConfig.java @@ -24,7 +24,7 @@ package com.tencent.bk.job.analysis.config; -import com.tencent.bk.job.common.web.filter.RepeatableReadServletRequestResponseFilter; +import com.tencent.bk.job.common.web.filter.RepeatableReadWriteServletRequestResponseFilter; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -33,7 +33,7 @@ public class FilterConfig { @Bean public FilterRegistrationBean repeatableRSRRFilterRegister() { - FilterRegistrationBean registration = + FilterRegistrationBean registration = new FilterRegistrationBean<>(); registration.setFilter(repeatableRRRFilter()); registration.addUrlPatterns("/esb/api/*"); @@ -43,7 +43,7 @@ public FilterRegistrationBean repeatableRSRRFilterRegister() { } @Bean(name = "repeatableReadRequestResponseFilter") - public RepeatableReadServletRequestResponseFilter repeatableRRRFilter() { - return new RepeatableReadServletRequestResponseFilter(); + public RepeatableReadWriteServletRequestResponseFilter repeatableRRRFilter() { + return new RepeatableReadWriteServletRequestResponseFilter(); } } diff --git a/src/backend/job-analysis/boot-job-analysis/src/main/java/com/tencent/bk/job/analysis/config/InterceptorConfiguration.java b/src/backend/job-analysis/boot-job-analysis/src/main/java/com/tencent/bk/job/analysis/config/InterceptorConfiguration.java index a6dd081fbb..3d08819ebc 100644 --- a/src/backend/job-analysis/boot-job-analysis/src/main/java/com/tencent/bk/job/analysis/config/InterceptorConfiguration.java +++ b/src/backend/job-analysis/boot-job-analysis/src/main/java/com/tencent/bk/job/analysis/config/InterceptorConfiguration.java @@ -25,7 +25,6 @@ package com.tencent.bk.job.analysis.config; import com.tencent.bk.job.analysis.interceptor.UriPermissionInterceptor; -import com.tencent.bk.job.common.web.interceptor.EsbApiLogInterceptor; import com.tencent.bk.job.common.web.interceptor.JobCommonInterceptor; import com.tencent.bk.job.common.web.interceptor.ServiceSecurityInterceptor; import org.springframework.beans.factory.annotation.Autowired; @@ -37,17 +36,14 @@ public class InterceptorConfiguration implements WebMvcConfigurer { private final JobCommonInterceptor jobCommonInterceptor; - private final EsbApiLogInterceptor esbApiLogInterceptor; private final ServiceSecurityInterceptor serviceSecurityInterceptor; private final UriPermissionInterceptor uriPermissionInterceptor; @Autowired public InterceptorConfiguration(JobCommonInterceptor jobCommonInterceptor, - EsbApiLogInterceptor esbApiLogInterceptor, ServiceSecurityInterceptor serviceSecurityInterceptor, UriPermissionInterceptor uriPermissionInterceptor) { this.jobCommonInterceptor = jobCommonInterceptor; - this.esbApiLogInterceptor = esbApiLogInterceptor; this.serviceSecurityInterceptor = serviceSecurityInterceptor; this.uriPermissionInterceptor = uriPermissionInterceptor; } @@ -59,6 +55,5 @@ public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(jobCommonInterceptor).addPathPatterns("/**").order(1); registry.addInterceptor(uriPermissionInterceptor) .addPathPatterns(uriPermissionInterceptor.getControlUriPatterns()).order(2); - registry.addInterceptor(esbApiLogInterceptor).addPathPatterns("/esb/api/**").order(10); } } diff --git a/src/backend/job-crontab/api-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/esb/EsbCronJobResource.java b/src/backend/job-crontab/api-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/esb/EsbCronJobResource.java index 3dae523379..4bd83229ca 100644 --- a/src/backend/job-crontab/api-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/esb/EsbCronJobResource.java +++ b/src/backend/job-crontab/api-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/esb/EsbCronJobResource.java @@ -49,16 +49,11 @@ public interface EsbCronJobResource { @PostMapping("/get_cron_list") - EsbResp> getCronList( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, - @RequestBody EsbGetCronListRequest request); + EsbResp> getCronList(@RequestBody EsbGetCronListRequest request); @PostMapping(value = "/update_cron_status") - EsbResp updateCronStatus( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, - @RequestBody EsbUpdateCronStatusRequest request); + EsbResp updateCronStatus(@RequestBody EsbUpdateCronStatusRequest request); @PostMapping(value = "/save_cron") - EsbResp saveCron(@RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, - @RequestBody EsbSaveCronRequest request); + EsbResp saveCron(@RequestBody EsbSaveCronRequest request); } diff --git a/src/backend/job-crontab/api-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/esb/v3/EsbCronJobV3Resource.java b/src/backend/job-crontab/api-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/esb/v3/EsbCronJobV3Resource.java index 2ef70c2c85..b305b580a9 100644 --- a/src/backend/job-crontab/api-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/esb/v3/EsbCronJobV3Resource.java +++ b/src/backend/job-crontab/api-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/esb/v3/EsbCronJobV3Resource.java @@ -25,6 +25,7 @@ package com.tencent.bk.job.crontab.api.esb.v3; import com.tencent.bk.job.common.annotation.EsbAPI; +import com.tencent.bk.job.common.constant.JobCommonHeaders; import com.tencent.bk.job.common.esb.model.EsbResp; import com.tencent.bk.job.common.esb.model.job.v3.EsbPageDataV3; import com.tencent.bk.job.crontab.model.esb.v3.request.EsbGetCronDetailV3Request; @@ -32,14 +33,14 @@ import com.tencent.bk.job.crontab.model.esb.v3.request.EsbSaveCronV3Request; import com.tencent.bk.job.crontab.model.esb.v3.request.EsbUpdateCronStatusV3Request; import com.tencent.bk.job.crontab.model.esb.v3.response.EsbCronInfoV3Response; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import static com.tencent.bk.job.common.i18n.locale.LocaleUtils.COMMON_LANG_HEADER; - /** * @since 26/2/2020 16:24 */ @@ -48,51 +49,68 @@ @EsbAPI public interface EsbCronJobV3Resource { + @GetMapping("/get_cron_list") + EsbResp> getCronList( + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestParam(value = "bk_biz_id") Long appId, + @RequestParam(value = "id", required = false) Long id, + @RequestParam(value = "creator", required = false) String creator, + @RequestParam(value = "name", required = false) String name, + @RequestParam(value = "status", required = false) Integer status, + @RequestParam(value = "create_time_start", required = false) Long createTimeStart, + @RequestParam(value = "create_time_end", required = false) Long createTimeEnd, + @RequestParam(value = "last_modify_user", required = false) String lastModifyUser, + @RequestParam(value = "last_modify_time_start", required = false) Long lastModifyTimeStart, + @RequestParam(value = "last_modify_time_end", required = false) Long lastModifyTimeEnd, + @RequestParam(value = "start", required = false) Integer start, + @RequestParam(value = "length", required = false) Integer length); + + @GetMapping("/get_cron_detail") + EsbResp getCronDetail( + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestParam(value = "bk_biz_id") Long appId, + @RequestParam(value = "id") Long id); + + /** * 获取定时任务列表 * - * @param lang 用户语言 * @param request 查询请求 * @return 定时任务列表 */ @PostMapping("/get_cron_list") - EsbResp> getCronList( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, + EsbResp> getCronListUsingPost( @RequestBody EsbGetCronListV3Request request); /** * 获取定时任务详情 * - * @param lang 用户语言 * @param request 查询请求 * @return 定时任务详情 */ @PostMapping("/get_cron_detail") - EsbResp getCronDetail( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, + EsbResp getCronDetailUsingPost( @RequestBody EsbGetCronDetailV3Request request); /** * 更新定时任务状态 * - * @param lang 用户语言 * @param request 更新请求 * @return 定时任务详情 */ @PostMapping(value = "/update_cron_status") EsbResp updateCronStatus( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbUpdateCronStatusV3Request request); /** * 更新定时任务详情 * - * @param lang 用户语言 * @param request 更新请求 * @return 定时任务详情 */ @PostMapping(value = "/save_cron") EsbResp saveCron( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbSaveCronV3Request request); } diff --git a/src/backend/job-crontab/boot-job-crontab/src/main/java/com/tencent/bk/job/crontab/config/FilterConfig.java b/src/backend/job-crontab/boot-job-crontab/src/main/java/com/tencent/bk/job/crontab/config/FilterConfig.java index ec8d76b380..3dcd1283fd 100644 --- a/src/backend/job-crontab/boot-job-crontab/src/main/java/com/tencent/bk/job/crontab/config/FilterConfig.java +++ b/src/backend/job-crontab/boot-job-crontab/src/main/java/com/tencent/bk/job/crontab/config/FilterConfig.java @@ -24,7 +24,7 @@ package com.tencent.bk.job.crontab.config; -import com.tencent.bk.job.common.web.filter.RepeatableReadServletRequestResponseFilter; +import com.tencent.bk.job.common.web.filter.RepeatableReadWriteServletRequestResponseFilter; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -33,7 +33,7 @@ public class FilterConfig { @Bean public FilterRegistrationBean repeatableRSRRFilterRegister() { - FilterRegistrationBean registration = + FilterRegistrationBean registration = new FilterRegistrationBean<>(); registration.setFilter(repeatableRRRFilter()); registration.addUrlPatterns("/esb/api/*"); @@ -43,7 +43,7 @@ public FilterRegistrationBean repeatableRSRRFilterRegister() { } @Bean(name = "repeatableReadRequestResponseFilter") - public RepeatableReadServletRequestResponseFilter repeatableRRRFilter() { - return new RepeatableReadServletRequestResponseFilter(); + public RepeatableReadWriteServletRequestResponseFilter repeatableRRRFilter() { + return new RepeatableReadWriteServletRequestResponseFilter(); } } diff --git a/src/backend/job-crontab/boot-job-crontab/src/main/java/com/tencent/bk/job/crontab/config/InterceptorConfiguration.java b/src/backend/job-crontab/boot-job-crontab/src/main/java/com/tencent/bk/job/crontab/config/InterceptorConfiguration.java index 4b50467859..3c210e96d3 100644 --- a/src/backend/job-crontab/boot-job-crontab/src/main/java/com/tencent/bk/job/crontab/config/InterceptorConfiguration.java +++ b/src/backend/job-crontab/boot-job-crontab/src/main/java/com/tencent/bk/job/crontab/config/InterceptorConfiguration.java @@ -26,6 +26,7 @@ import com.tencent.bk.job.common.iam.interceptor.JobIamInterceptor; import com.tencent.bk.job.common.web.interceptor.EsbApiLogInterceptor; +import com.tencent.bk.job.common.web.interceptor.EsbReqRewriteInterceptor; import com.tencent.bk.job.common.web.interceptor.JobCommonInterceptor; import com.tencent.bk.job.common.web.interceptor.ServiceSecurityInterceptor; import org.springframework.beans.factory.annotation.Autowired; @@ -43,16 +44,19 @@ public class InterceptorConfiguration implements WebMvcConfigurer { private final EsbApiLogInterceptor esbApiLogInterceptor; private final ServiceSecurityInterceptor serviceSecurityInterceptor; private final JobIamInterceptor iamInterceptor; + private final EsbReqRewriteInterceptor esbReqRewriteInterceptor; @Autowired public InterceptorConfiguration(JobCommonInterceptor jobCommonInterceptor, EsbApiLogInterceptor esbApiLogInterceptor, ServiceSecurityInterceptor serviceSecurityInterceptor, - JobIamInterceptor iamInterceptor) { + JobIamInterceptor iamInterceptor, + EsbReqRewriteInterceptor esbReqRewriteInterceptor) { this.jobCommonInterceptor = jobCommonInterceptor; this.esbApiLogInterceptor = esbApiLogInterceptor; this.serviceSecurityInterceptor = serviceSecurityInterceptor; this.iamInterceptor = iamInterceptor; + this.esbReqRewriteInterceptor = esbReqRewriteInterceptor; } @Override @@ -62,6 +66,7 @@ public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(jobCommonInterceptor).addPathPatterns("/**").order(1); registry.addInterceptor(iamInterceptor).addPathPatterns("/iam/api/v1/resources/**").order(2); registry.addInterceptor(esbApiLogInterceptor).addPathPatterns("/esb/api/**").order(10); + registry.addInterceptor(esbReqRewriteInterceptor).addPathPatterns("/esb/api/**").order(11); } } diff --git a/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/esb/impl/EsbCronJobResourceImpl.java b/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/esb/impl/EsbCronJobResourceImpl.java index 96fbea0f1e..dad6777a0d 100644 --- a/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/esb/impl/EsbCronJobResourceImpl.java +++ b/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/esb/impl/EsbCronJobResourceImpl.java @@ -77,7 +77,7 @@ public EsbCronJobResourceImpl(CronJobService cronJobService, MessageI18nService @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_get_cron_list"}) - public EsbResp> getCronList(String lang, EsbGetCronListRequest request) { + public EsbResp> getCronList(EsbGetCronListRequest request) { if (request == null) { return EsbResp.buildCommonFailResp(ErrorCode.ILLEGAL_PARAM, i18nService.getI18n(String.valueOf(ErrorCode.ILLEGAL_PARAM))); @@ -135,7 +135,7 @@ public EsbResp> getCronList(String lang, EsbGetCronLis @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_update_cron_status"}) - public EsbResp updateCronStatus(String lang, EsbUpdateCronStatusRequest request) { + public EsbResp updateCronStatus(EsbUpdateCronStatusRequest request) { String username = request.getUserName(); Long appId = request.getAppId(); if (request.validate()) { @@ -173,7 +173,7 @@ public EsbResp updateCronStatus(String lang, EsbUpdateCronS @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_save_cron"}) - public EsbResp saveCron(String lang, EsbSaveCronRequest request) { + public EsbResp saveCron(EsbSaveCronRequest request) { CronJobInfoDTO cronJobInfo = new CronJobInfoDTO(); EsbCronInfoResponse esbCronInfoResponse = new EsbCronInfoResponse(); esbCronInfoResponse.setId(0L); diff --git a/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/esb/v3/impl/EsbCronJobV3ResourceImpl.java b/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/esb/v3/impl/EsbCronJobV3ResourceImpl.java index 90ca21e4b3..d9f9a1c870 100644 --- a/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/esb/v3/impl/EsbCronJobV3ResourceImpl.java +++ b/src/backend/job-crontab/service-job-crontab/src/main/java/com/tencent/bk/job/crontab/api/esb/v3/impl/EsbCronJobV3ResourceImpl.java @@ -83,9 +83,52 @@ public EsbCronJobV3ResourceImpl(CronJobService cronJobService, MessageI18nServic this.taskPlanResource = taskPlanResource; } + @Override + public EsbResp> getCronList(String username, + String appCode, + Long appId, + Long id, + String creator, + String name, + Integer status, + Long createTimeStart, + Long createTimeEnd, + String lastModifyUser, + Long lastModifyTimeStart, + Long lastModifyTimeEnd, + Integer start, + Integer length) { + EsbGetCronListV3Request request = new EsbGetCronListV3Request(); + request.setUserName(username); + request.setAppCode(appCode); + request.setAppId(appId); + request.setId(id); + request.setCreator(creator); + request.setName(name); + request.setStatus(status); + request.setCreateTimeStart(createTimeStart); + request.setLastModifyUser(lastModifyUser); + request.setCreateTimeEnd(createTimeEnd); + request.setLastModifyTimeEnd(lastModifyTimeEnd); + request.setLastModifyTimeStart(lastModifyTimeStart); + request.setStart(start); + request.setLength(length); + return getCronListUsingPost(request); + } + + @Override + public EsbResp getCronDetail(String username, String appCode, Long appId, Long id) { + EsbGetCronDetailV3Request request = new EsbGetCronDetailV3Request(); + request.setUserName(username); + request.setAppCode(appCode); + request.setAppId(appId); + request.setId(id); + return getCronDetailUsingPost(request); + } + @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_get_cron_list"}) - public EsbResp> getCronList(String lang, EsbGetCronListV3Request request) { + public EsbResp> getCronListUsingPost(EsbGetCronListV3Request request) { if (request == null) { return EsbResp.buildCommonFailResp(ErrorCode.ILLEGAL_PARAM, i18nService.getI18n(String.valueOf(ErrorCode.ILLEGAL_PARAM))); @@ -154,7 +197,7 @@ public EsbResp> getCronList(String lang, Es @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_update_cron_status"}) - public EsbResp updateCronStatus(String lang, EsbUpdateCronStatusV3Request request) { + public EsbResp updateCronStatus(EsbUpdateCronStatusV3Request request) { String username = request.getUserName(); Long appId = request.getAppId(); if (request.validate()) { @@ -192,7 +235,7 @@ public EsbResp updateCronStatus(String lang, EsbUpdateCro @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_save_cron"}) - public EsbResp saveCron(String lang, EsbSaveCronV3Request request) { + public EsbResp saveCron(EsbSaveCronV3Request request) { CronJobInfoDTO cronJobInfo = new CronJobInfoDTO(); EsbCronInfoV3Response esbCronInfoV3Response = new EsbCronInfoV3Response(); esbCronInfoV3Response.setId(0L); @@ -295,7 +338,7 @@ public EsbResp saveCron(String lang, EsbSaveCronV3Request } @Override - public EsbResp getCronDetail(String lang, EsbGetCronDetailV3Request request) { + public EsbResp getCronDetailUsingPost(EsbGetCronDetailV3Request request) { AuthResult authResult = authService.auth(true, request.getUserName(), ActionId.LIST_BUSINESS, ResourceTypeEnum.BUSINESS, request.getAppId().toString(), null); if (!authResult.isPass()) { diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/GseGetProcResultResource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/GseGetProcResultResource.java index 54487527be..4360d37bb5 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/GseGetProcResultResource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/GseGetProcResultResource.java @@ -46,9 +46,7 @@ public interface GseGetProcResultResource { @PostMapping("/get_proc_result") - EsbResp> gseGetProcResult( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, - @RequestBody EsbGseGetProcResultRequest request); + EsbResp> gseGetProcResult(@RequestBody EsbGseGetProcResultRequest request); } diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/GseManageProcessResource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/GseManageProcessResource.java index d4d38e25e3..332b63ce73 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/GseManageProcessResource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/GseManageProcessResource.java @@ -45,9 +45,7 @@ public interface GseManageProcessResource { @PostMapping("/manage_proc") - EsbResp gseManageProc( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, - @RequestBody EsbGseManageProcRequest request); + EsbResp gseManageProc(@RequestBody EsbGseManageProcRequest request); } diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/GseOperateProcessResource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/GseOperateProcessResource.java index 2cd892f869..34ba1ec8bf 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/GseOperateProcessResource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/GseOperateProcessResource.java @@ -45,9 +45,7 @@ public interface GseOperateProcessResource { @PostMapping("/operate_proc") - EsbResp gseOperateProcess( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, - @RequestBody EsbGseOperateProcessRequest request); + EsbResp gseOperateProcess(@RequestBody EsbGseOperateProcessRequest request); } diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/GseOperateProcessV2Resource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/GseOperateProcessV2Resource.java index 2e6b6bb477..1046ac3c3b 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/GseOperateProcessV2Resource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/GseOperateProcessV2Resource.java @@ -45,9 +45,7 @@ public interface GseOperateProcessV2Resource { @PostMapping("/operate_process") - EsbResp gseOperateProcessV2( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, - @RequestBody EsbGseOperateProcessRequest request); + EsbResp gseOperateProcessV2(@RequestBody EsbGseOperateProcessRequest request); } diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbExecuteTaskResource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbExecuteTaskResource.java index 03694e7e66..6c0ff57eaa 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbExecuteTaskResource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbExecuteTaskResource.java @@ -45,9 +45,7 @@ public interface EsbExecuteTaskResource { @PostMapping("/execute_job") - EsbResp executeJob( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, - @RequestBody EsbExecuteJobRequest request); + EsbResp executeJob(@RequestBody EsbExecuteJobRequest request); } diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbFastExecuteSQLResource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbFastExecuteSQLResource.java index a5de6625b0..21d9ec0135 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbFastExecuteSQLResource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbFastExecuteSQLResource.java @@ -46,7 +46,6 @@ public interface EsbFastExecuteSQLResource { @PostMapping("/fast_execute_sql") EsbResp fastExecuteSQL( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbFastExecuteSQLRequest request); diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbFastExecuteScriptResource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbFastExecuteScriptResource.java index 67b3d47036..e8d9d97394 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbFastExecuteScriptResource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbFastExecuteScriptResource.java @@ -45,9 +45,7 @@ public interface EsbFastExecuteScriptResource { @PostMapping("/fast_execute_script") - EsbResp fastExecuteScript( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, - @RequestBody EsbFastExecuteScriptRequest request); + EsbResp fastExecuteScript(@RequestBody EsbFastExecuteScriptRequest request); } diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbFastPushFileResource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbFastPushFileResource.java index 0224953de0..1ca78b652f 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbFastPushFileResource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbFastPushFileResource.java @@ -46,7 +46,6 @@ public interface EsbFastPushFileResource { @PostMapping("/fast_push_file") EsbResp fastPushFile( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbFastPushFileRequest request); diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbGetJobInstanceGlobalVarValueResource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbGetJobInstanceGlobalVarValueResource.java index f66578329e..5fae90b01f 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbGetJobInstanceGlobalVarValueResource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbGetJobInstanceGlobalVarValueResource.java @@ -46,7 +46,6 @@ public interface EsbGetJobInstanceGlobalVarValueResource { @PostMapping("/get_job_instance_global_var_value") EsbResp getJobInstanceGlobalVarValue( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbGetJobInstanceGlobalVarValueRequest request); diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbGetJobInstanceLogResource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbGetJobInstanceLogResource.java index 3efa6327e5..70555fe74e 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbGetJobInstanceLogResource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbGetJobInstanceLogResource.java @@ -25,6 +25,7 @@ package com.tencent.bk.job.execute.api.esb.v2; import com.tencent.bk.job.common.annotation.EsbAPI; +import com.tencent.bk.job.common.constant.JobCommonHeaders; import com.tencent.bk.job.common.esb.model.EsbResp; import com.tencent.bk.job.execute.model.esb.v2.EsbStepInstanceResultAndLog; import com.tencent.bk.job.execute.model.esb.v2.request.EsbGetJobInstanceLogRequest; @@ -38,8 +39,6 @@ import java.util.List; -import static com.tencent.bk.job.common.i18n.locale.LocaleUtils.COMMON_LANG_HEADER; - /** * 根据作业实例ID查询作业执行日志-V2 */ @@ -50,14 +49,12 @@ public interface EsbGetJobInstanceLogResource { @PostMapping("/get_job_instance_log") EsbResp> getJobInstanceLogUsingPost( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbGetJobInstanceLogRequest request); @GetMapping("/get_job_instance_log") EsbResp> getJobInstanceLog( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, - @RequestParam(value = "bk_app_code") String appCode, - @RequestParam(value = "bk_username") String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, @RequestParam(value = "bk_biz_id") Long appId, @RequestParam(value = "job_instance_id") Long taskInstanceId); diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbGetJobInstanceStatusResource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbGetJobInstanceStatusResource.java index b31daee0fd..e08533e319 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbGetJobInstanceStatusResource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbGetJobInstanceStatusResource.java @@ -25,6 +25,7 @@ package com.tencent.bk.job.execute.api.esb.v2; import com.tencent.bk.job.common.annotation.EsbAPI; +import com.tencent.bk.job.common.constant.JobCommonHeaders; import com.tencent.bk.job.common.esb.model.EsbResp; import com.tencent.bk.job.execute.model.esb.v2.EsbJobInstanceStatusDTO; import com.tencent.bk.job.execute.model.esb.v2.request.EsbGetJobInstanceStatusRequest; @@ -36,8 +37,6 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import static com.tencent.bk.job.common.i18n.locale.LocaleUtils.COMMON_LANG_HEADER; - /** * 根据作业实例 ID 查询作业执行状态API-V2 */ @@ -48,14 +47,12 @@ public interface EsbGetJobInstanceStatusResource { @PostMapping("/get_job_instance_status") EsbResp getJobInstanceStatusUsingPost( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbGetJobInstanceStatusRequest request); @GetMapping("/get_job_instance_status") EsbResp getJobInstanceStatus( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, - @RequestParam(value = "bk_app_code") String appCode, - @RequestParam(value = "bk_username") String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, @RequestParam(value = "bk_biz_id") Long appId, @RequestParam(value = "job_instance_id") Long taskInstanceId); diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbGetStepInstanceStatusResource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbGetStepInstanceStatusResource.java index 1797cd0cfc..1eb9388cb4 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbGetStepInstanceStatusResource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbGetStepInstanceStatusResource.java @@ -46,7 +46,6 @@ public interface EsbGetStepInstanceStatusResource { @PostMapping("/get_step_instance_status") EsbResp getJobStepInstanceStatus( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbGetStepInstanceStatusRequest request); diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbOperateJobInstanceResource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbOperateJobInstanceResource.java index e8bc47ce12..fcfbe0f056 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbOperateJobInstanceResource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbOperateJobInstanceResource.java @@ -46,7 +46,6 @@ public interface EsbOperateJobInstanceResource { @PostMapping("/operate_job_instance") EsbResp operateJobInstance( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbOperateJobInstanceRequest request); diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbOperateStepInstanceResource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbOperateStepInstanceResource.java index 349d38b28a..7e082b6256 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbOperateStepInstanceResource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbOperateStepInstanceResource.java @@ -46,7 +46,6 @@ public interface EsbOperateStepInstanceResource { @PostMapping("/operate_step_instance") EsbResp operateStepInstance( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbOperateStepInstanceRequest request); diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbPushConfigFileResource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbPushConfigFileResource.java index 79218ea0c1..54a6371a51 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbPushConfigFileResource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/EsbPushConfigFileResource.java @@ -49,7 +49,6 @@ public interface EsbPushConfigFileResource { */ @PostMapping("/push_config_file") EsbResp pushConfigFile( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbPushConfigFileRequest request); diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbBatchGetJobInstanceIpLogV3Resource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbBatchGetJobInstanceIpLogV3Resource.java index 36f4331193..df56e715ba 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbBatchGetJobInstanceIpLogV3Resource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbBatchGetJobInstanceIpLogV3Resource.java @@ -44,7 +44,6 @@ public interface EsbBatchGetJobInstanceIpLogV3Resource { @PostMapping("/batch_get_job_instance_ip_log") EsbResp batchGetJobInstanceIpLogs( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbBatchGetJobInstanceIpLogV3Request request); } diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbExecuteJobPlanV3Resource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbExecuteJobPlanV3Resource.java index 097deeb736..be6b76a7a0 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbExecuteJobPlanV3Resource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbExecuteJobPlanV3Resource.java @@ -46,7 +46,6 @@ public interface EsbExecuteJobPlanV3Resource { @PostMapping("/execute_job_plan") EsbResp executeJobPlan( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbExecuteJobV3Request request); diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastExecuteSQLV3Resource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastExecuteSQLV3Resource.java index 4941b80a68..a001c4c4ed 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastExecuteSQLV3Resource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastExecuteSQLV3Resource.java @@ -46,7 +46,6 @@ public interface EsbFastExecuteSQLV3Resource { @PostMapping("/fast_execute_sql") EsbResp fastExecuteSQL( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbFastExecuteSQLV3Request request); diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastExecuteScriptV3Resource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastExecuteScriptV3Resource.java index 1f031b93f9..85bac20e37 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastExecuteScriptV3Resource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastExecuteScriptV3Resource.java @@ -28,9 +28,10 @@ import com.tencent.bk.job.common.esb.model.EsbResp; import com.tencent.bk.job.execute.model.esb.v3.EsbJobExecuteV3DTO; import com.tencent.bk.job.execute.model.esb.v3.request.EsbFastExecuteScriptV3Request; -import org.springframework.web.bind.annotation.*; - -import static com.tencent.bk.job.common.i18n.locale.LocaleUtils.COMMON_LANG_HEADER; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; /** * 快速执行脚本ESB-API-V3 @@ -42,7 +43,6 @@ public interface EsbFastExecuteScriptV3Resource { @PostMapping("/fast_execute_script") EsbResp fastExecuteScript( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbFastExecuteScriptV3Request request); diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastTransferFileV3Resource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastTransferFileV3Resource.java index d1fc7d4759..09746dfd86 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastTransferFileV3Resource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastTransferFileV3Resource.java @@ -46,7 +46,6 @@ public interface EsbFastTransferFileV3Resource { @PostMapping("/fast_transfer_file") EsbResp fastTransferFile( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbFastTransferFileV3Request request); diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceGlobalVarValueV3Resource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceGlobalVarValueV3Resource.java index 99cb84f4c4..7d55d89c53 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceGlobalVarValueV3Resource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceGlobalVarValueV3Resource.java @@ -25,17 +25,18 @@ package com.tencent.bk.job.execute.api.esb.v3; import com.tencent.bk.job.common.annotation.EsbAPI; +import com.tencent.bk.job.common.constant.JobCommonHeaders; import com.tencent.bk.job.common.esb.model.EsbResp; import com.tencent.bk.job.execute.model.esb.v3.EsbJobInstanceGlobalVarValueV3DTO; import com.tencent.bk.job.execute.model.esb.v3.request.EsbGetJobInstanceGlobalVarValueV3Request; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import static com.tencent.bk.job.common.i18n.locale.LocaleUtils.COMMON_LANG_HEADER; - /** * 获取作业实例全局变量的值-V3 */ @@ -45,9 +46,15 @@ public interface EsbGetJobInstanceGlobalVarValueV3Resource { @PostMapping("/get_job_instance_global_var_value") - EsbResp getJobInstanceGlobalVarValue( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, + EsbResp getJobInstanceGlobalVarValueUsingPost( @RequestBody EsbGetJobInstanceGlobalVarValueV3Request request); + @GetMapping("/get_job_instance_global_var_value") + EsbResp getJobInstanceGlobalVarValue( + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestParam(value = "bk_biz_id") Long appId, + @RequestParam(value = "job_instance_id") Long taskInstanceId); + } diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceIpLogV3Resource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceIpLogV3Resource.java index b1ca5140ba..b118522d34 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceIpLogV3Resource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceIpLogV3Resource.java @@ -25,17 +25,18 @@ package com.tencent.bk.job.execute.api.esb.v3; import com.tencent.bk.job.common.annotation.EsbAPI; +import com.tencent.bk.job.common.constant.JobCommonHeaders; import com.tencent.bk.job.common.esb.model.EsbResp; import com.tencent.bk.job.execute.model.esb.v3.EsbIpLogV3DTO; import com.tencent.bk.job.execute.model.esb.v3.request.EsbGetJobInstanceIpLogV3Request; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import static com.tencent.bk.job.common.i18n.locale.LocaleUtils.COMMON_LANG_HEADER; - /** * 根据ip查询作业执行日志 -V3 */ @@ -45,9 +46,17 @@ public interface EsbGetJobInstanceIpLogV3Resource { @PostMapping("/get_job_instance_ip_log") - EsbResp getJobInstanceIpLog( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, + EsbResp getJobInstanceIpLogUsingPost( @RequestBody EsbGetJobInstanceIpLogV3Request request); + @GetMapping("/get_job_instance_ip_log") + EsbResp getJobInstanceIpLog( + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestParam(value = "bk_biz_id") Long appId, + @RequestParam(value = "job_instance_id") Long taskInstanceId, + @RequestParam(value = "step_instance_id") Long stepInstanceId, + @RequestParam(value = "bk_cloud_id") Long cloudAreaId, + @RequestParam(value = "ip") String ip); } diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceListV3Resource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceListV3Resource.java index 9879df7cb5..da25f902fd 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceListV3Resource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceListV3Resource.java @@ -25,20 +25,21 @@ package com.tencent.bk.job.execute.api.esb.v3; import com.tencent.bk.job.common.annotation.EsbAPI; +import com.tencent.bk.job.common.constant.JobCommonHeaders; import com.tencent.bk.job.common.esb.model.EsbResp; import com.tencent.bk.job.common.esb.model.job.v3.EsbPageDataV3; import com.tencent.bk.job.execute.model.esb.v3.EsbTaskInstanceV3DTO; import com.tencent.bk.job.execute.model.esb.v3.request.EsbGetJobInstanceListV3Request; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import static com.tencent.bk.job.common.i18n.locale.LocaleUtils.COMMON_LANG_HEADER; - /** - * 根据ip查询作业执行日志 -V3 + * 查询作业执行历史 -V3 */ @RequestMapping("/esb/api/v3") @RestController @@ -46,9 +47,25 @@ public interface EsbGetJobInstanceListV3Resource { @PostMapping("/get_job_instance_list") - EsbResp> getJobInstanceList( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, + EsbResp> getJobInstanceListUsingPost( @RequestBody EsbGetJobInstanceListV3Request request); + @GetMapping("/get_job_instance_list") + EsbResp> getJobInstanceList( + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestParam(value = "bk_biz_id") Long appId, + @RequestParam(value = "create_time_start") Long createTimeStart, + @RequestParam(value = "create_time_end") Long createTimeEnd, + @RequestParam(value = "job_instance_id", required = false) Long taskInstanceId, + @RequestParam(value = "operator", required = false) String operator, + @RequestParam(value = "name", required = false) String taskName, + @RequestParam(value = "launch_mode", required = false) Integer startupMode, + @RequestParam(value = "type", required = false) Integer taskType, + @RequestParam(value = "status", required = false) Integer taskStatus, + @RequestParam(value = "ip", required = false) String ip, + @RequestParam(value = "start", required = false) Integer start, + @RequestParam(value = "length", required = false) Integer length); + } diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceStatusV3Resource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceStatusV3Resource.java index fb293ab207..696bf274ae 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceStatusV3Resource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceStatusV3Resource.java @@ -25,17 +25,18 @@ package com.tencent.bk.job.execute.api.esb.v3; import com.tencent.bk.job.common.annotation.EsbAPI; +import com.tencent.bk.job.common.constant.JobCommonHeaders; import com.tencent.bk.job.common.esb.model.EsbResp; import com.tencent.bk.job.execute.model.esb.v3.EsbJobInstanceStatusV3DTO; import com.tencent.bk.job.execute.model.esb.v3.request.EsbGetJobInstanceStatusV3Request; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import static com.tencent.bk.job.common.i18n.locale.LocaleUtils.COMMON_LANG_HEADER; - /** * 根据作业实例 ID 查询作业执行状态API-V3 */ @@ -45,9 +46,15 @@ public interface EsbGetJobInstanceStatusV3Resource { @PostMapping("/get_job_instance_status") - EsbResp getJobInstanceStatus( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, + EsbResp getJobInstanceStatusUsingPost( @RequestBody EsbGetJobInstanceStatusV3Request request); + @GetMapping("/get_job_instance_status") + EsbResp getJobInstanceStatus( + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestParam(value = "bk_biz_id") Long appId, + @RequestParam(value = "job_instance_id") Long taskInstanceId, + @RequestParam(value = "return_ip_result", required = false, defaultValue = "false") boolean returnIpResult); } diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbOperateJobInstanceV3Resource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbOperateJobInstanceV3Resource.java index 1636a849ea..3be1ab9349 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbOperateJobInstanceV3Resource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbOperateJobInstanceV3Resource.java @@ -46,7 +46,6 @@ public interface EsbOperateJobInstanceV3Resource { @PostMapping("/operate_job_instance") EsbResp operateJobInstance( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbOperateJobInstanceV3Request request); diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbOperateStepInstanceV3Resource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbOperateStepInstanceV3Resource.java index 410eb55785..6acd5a6c19 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbOperateStepInstanceV3Resource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbOperateStepInstanceV3Resource.java @@ -46,7 +46,6 @@ public interface EsbOperateStepInstanceV3Resource { @PostMapping("/operate_step_instance") EsbResp operateStepInstance( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbOperateStepInstanceV3Request request); diff --git a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbPushConfigFileV3Resource.java b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbPushConfigFileV3Resource.java index ec3e6b3b42..fd33cf103c 100644 --- a/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbPushConfigFileV3Resource.java +++ b/src/backend/job-execute/api-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbPushConfigFileV3Resource.java @@ -49,7 +49,6 @@ public interface EsbPushConfigFileV3Resource { */ @PostMapping("/push_config_file") EsbResp pushConfigFile( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbPushConfigFileV3Request request); diff --git a/src/backend/job-execute/boot-job-execute/src/main/java/com/tencent/bk/job/execute/config/FilterConfig.java b/src/backend/job-execute/boot-job-execute/src/main/java/com/tencent/bk/job/execute/config/FilterConfig.java index 93f638c91e..d5f85336d9 100644 --- a/src/backend/job-execute/boot-job-execute/src/main/java/com/tencent/bk/job/execute/config/FilterConfig.java +++ b/src/backend/job-execute/boot-job-execute/src/main/java/com/tencent/bk/job/execute/config/FilterConfig.java @@ -24,7 +24,7 @@ package com.tencent.bk.job.execute.config; -import com.tencent.bk.job.common.web.filter.RepeatableReadServletRequestResponseFilter; +import com.tencent.bk.job.common.web.filter.RepeatableReadWriteServletRequestResponseFilter; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -33,7 +33,7 @@ public class FilterConfig { @Bean public FilterRegistrationBean repeatableRSRRFilterRegister() { - FilterRegistrationBean registration = + FilterRegistrationBean registration = new FilterRegistrationBean<>(); registration.setFilter(repeatableRRRFilter()); registration.addUrlPatterns("/esb/api/*"); @@ -43,7 +43,7 @@ public FilterRegistrationBean repeatableRSRRFilterRegister() { } @Bean(name = "repeatableReadRequestResponseFilter") - public RepeatableReadServletRequestResponseFilter repeatableRRRFilter() { - return new RepeatableReadServletRequestResponseFilter(); + public RepeatableReadWriteServletRequestResponseFilter repeatableRRRFilter() { + return new RepeatableReadWriteServletRequestResponseFilter(); } } diff --git a/src/backend/job-execute/boot-job-execute/src/main/java/com/tencent/bk/job/execute/config/InterceptorConfiguration.java b/src/backend/job-execute/boot-job-execute/src/main/java/com/tencent/bk/job/execute/config/InterceptorConfiguration.java index e2e5f35653..acdb07035e 100644 --- a/src/backend/job-execute/boot-job-execute/src/main/java/com/tencent/bk/job/execute/config/InterceptorConfiguration.java +++ b/src/backend/job-execute/boot-job-execute/src/main/java/com/tencent/bk/job/execute/config/InterceptorConfiguration.java @@ -25,6 +25,7 @@ package com.tencent.bk.job.execute.config; import com.tencent.bk.job.common.web.interceptor.EsbApiLogInterceptor; +import com.tencent.bk.job.common.web.interceptor.EsbReqRewriteInterceptor; import com.tencent.bk.job.common.web.interceptor.JobCommonInterceptor; import com.tencent.bk.job.common.web.interceptor.ServiceSecurityInterceptor; import org.springframework.beans.factory.annotation.Autowired; @@ -38,14 +39,17 @@ public class InterceptorConfiguration implements WebMvcConfigurer { private final JobCommonInterceptor jobCommonInterceptor; private final EsbApiLogInterceptor esbApiLogInterceptor; private final ServiceSecurityInterceptor serviceSecurityInterceptor; + private final EsbReqRewriteInterceptor esbReqRewriteInterceptor; @Autowired public InterceptorConfiguration(JobCommonInterceptor jobCommonInterceptor, EsbApiLogInterceptor esbApiLogInterceptor, - ServiceSecurityInterceptor serviceSecurityInterceptor) { + ServiceSecurityInterceptor serviceSecurityInterceptor, + EsbReqRewriteInterceptor esbReqRewriteInterceptor) { this.jobCommonInterceptor = jobCommonInterceptor; this.esbApiLogInterceptor = esbApiLogInterceptor; this.serviceSecurityInterceptor = serviceSecurityInterceptor; + this.esbReqRewriteInterceptor = esbReqRewriteInterceptor; } @Override @@ -54,5 +58,6 @@ public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(serviceSecurityInterceptor).addPathPatterns("/**").order(0); registry.addInterceptor(jobCommonInterceptor).addPathPatterns("/**").order(1); registry.addInterceptor(esbApiLogInterceptor).addPathPatterns("/esb/api/**").order(10); + registry.addInterceptor(esbReqRewriteInterceptor).addPathPatterns("/esb/api/**").order(11); } } diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/impl/GseGetProcResultResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/impl/GseGetProcResultResourceImpl.java index c3754be1b5..60665f27d2 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/impl/GseGetProcResultResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/impl/GseGetProcResultResourceImpl.java @@ -55,7 +55,7 @@ public GseGetProcResultResourceImpl(MessageI18nService i18nService) { } @Override - public EsbResp> gseGetProcResult(String lang, EsbGseGetProcResultRequest request) { + public EsbResp> gseGetProcResult(EsbGseGetProcResultRequest request) { log.info("Gse process result, request={}", request); if (!checkRequest(request)) { return EsbResp.buildCommonFailResp(ErrorCode.ILLEGAL_PARAM, i18nService); diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/impl/GseManageProcessResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/impl/GseManageProcessResourceImpl.java index a941f5fbea..4f83628014 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/impl/GseManageProcessResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/impl/GseManageProcessResourceImpl.java @@ -56,7 +56,7 @@ public GseManageProcessResourceImpl(MessageI18nService i18nService) { } @Override - public EsbResp gseManageProc(String lang, EsbGseManageProcRequest request) { + public EsbResp gseManageProc(EsbGseManageProcRequest request) { log.info("Gse manage process, request={}", request); if (!checkRequest(request)) { return EsbResp.buildCommonFailResp(ErrorCode.ILLEGAL_PARAM, i18nService); diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/impl/GseOperateProcessResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/impl/GseOperateProcessResourceImpl.java index 098ac7b230..b41799b4e0 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/impl/GseOperateProcessResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/impl/GseOperateProcessResourceImpl.java @@ -56,7 +56,7 @@ public GseOperateProcessResourceImpl(MessageI18nService i18nService) { } @Override - public EsbResp gseOperateProcess(String lang, EsbGseOperateProcessRequest request) { + public EsbResp gseOperateProcess(EsbGseOperateProcessRequest request) { log.info("Gse operate process, request={}", request); if (!checkRequest(request)) { return EsbResp.buildCommonFailResp(ErrorCode.ILLEGAL_PARAM, i18nService); diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/impl/GseOperateProcessV2ResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/impl/GseOperateProcessV2ResourceImpl.java index 39d2cbd324..d34de9ca2b 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/impl/GseOperateProcessV2ResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/gse/impl/GseOperateProcessV2ResourceImpl.java @@ -57,7 +57,7 @@ public GseOperateProcessV2ResourceImpl(MessageI18nService i18nService) { } @Override - public EsbResp gseOperateProcessV2(String lang, EsbGseOperateProcessRequest request) { + public EsbResp gseOperateProcessV2(EsbGseOperateProcessRequest request) { log.info("Gse operate process v2, request={}", request); if (!checkRequest(request)) { return EsbResp.buildCommonFailResp(ErrorCode.ILLEGAL_PARAM, i18nService); diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbExecuteTaskResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbExecuteTaskResourceImpl.java index 074211baeb..184858bb8b 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbExecuteTaskResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbExecuteTaskResourceImpl.java @@ -72,7 +72,7 @@ public EsbExecuteTaskResourceImpl(TaskExecuteService taskExecuteService, Message @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_execute_job"}) - public EsbResp executeJob(String lang, EsbExecuteJobRequest request) { + public EsbResp executeJob(EsbExecuteJobRequest request) { log.info("Execute task, request={}", JsonUtils.toJson(request)); ValidateResult checkResult = checkExecuteTaskRequest(request); if (!checkResult.isPass()) { diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbFastExecuteSQLResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbFastExecuteSQLResourceImpl.java index 5738b112d7..73fd07a9ad 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbFastExecuteSQLResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbFastExecuteSQLResourceImpl.java @@ -84,7 +84,7 @@ public EsbFastExecuteSQLResourceImpl(TaskExecuteService taskExecuteService, Acco @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_fast_execute_sql"}) - public EsbResp fastExecuteSQL(String lang, EsbFastExecuteSQLRequest request) { + public EsbResp fastExecuteSQL(EsbFastExecuteSQLRequest request) { ValidateResult validateResult = checkFastExecuteSQLRequest(request); if (!validateResult.isPass()) { log.warn("Fast execute SQL request is illegal!"); diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbFastExecuteScriptResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbFastExecuteScriptResourceImpl.java index 69a486d1c1..7795cb6a93 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbFastExecuteScriptResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbFastExecuteScriptResourceImpl.java @@ -86,7 +86,7 @@ public EsbFastExecuteScriptResourceImpl(TaskExecuteService taskExecuteService, A @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_fast_execute_script"}) - public EsbResp fastExecuteScript(String lang, EsbFastExecuteScriptRequest request) { + public EsbResp fastExecuteScript(EsbFastExecuteScriptRequest request) { ValidateResult checkResult = checkFastExecuteScriptRequest(request); if (!checkResult.isPass()) { log.warn("Fast execute script request is illegal!"); diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbFastPushFileResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbFastPushFileResourceImpl.java index 56fee4fdb0..b992db8217 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbFastPushFileResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbFastPushFileResourceImpl.java @@ -82,7 +82,7 @@ public EsbFastPushFileResourceImpl(TaskExecuteService taskExecuteService, Messag @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_fast_push_file"}) - public EsbResp fastPushFile(String lang, EsbFastPushFileRequest request) { + public EsbResp fastPushFile(EsbFastPushFileRequest request) { ValidateResult checkResult = checkFastPushFileRequest(request); if (!checkResult.isPass()) { log.warn("Fast transfer file request is illegal!"); diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbGetJobInstanceGlobalVarValueResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbGetJobInstanceGlobalVarValueResourceImpl.java index 910829a8a1..80e9469368 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbGetJobInstanceGlobalVarValueResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbGetJobInstanceGlobalVarValueResourceImpl.java @@ -64,7 +64,6 @@ public EsbGetJobInstanceGlobalVarValueResourceImpl( @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_get_job_instance_global_var_value"}) public EsbResp getJobInstanceGlobalVarValue( - String lang, EsbGetJobInstanceGlobalVarValueRequest request) { ValidateResult checkResult = checkRequest(request); @@ -76,7 +75,7 @@ public EsbResp getJobInstanceGlobalVarValue( EsbGetJobInstanceGlobalVarValueV3Request newRequest = convertToEsbGetJobInstanceGlobalVarValueV3Request(request); EsbResp esbResp = - proxyGetJobInstanceGlobalVarService.getJobInstanceGlobalVarValue(lang, newRequest); + proxyGetJobInstanceGlobalVarService.getJobInstanceGlobalVarValueUsingPost(newRequest); return EsbResp.convertData(esbResp, this::convertToEsbJobInstanceGlobalVarValueDTO); } diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbGetJobInstanceLogResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbGetJobInstanceLogResourceImpl.java index e9ed0c0ff0..1f4b91fdfc 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbGetJobInstanceLogResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbGetJobInstanceLogResourceImpl.java @@ -60,8 +60,7 @@ public EsbGetJobInstanceLogResourceImpl(MessageI18nService i18nService, GseTaskL @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_get_job_instance_log"}) - public EsbResp> getJobInstanceLogUsingPost(String lang, - EsbGetJobInstanceLogRequest request) { + public EsbResp> getJobInstanceLogUsingPost(EsbGetJobInstanceLogRequest request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get job instance log request is illegal!"); @@ -147,13 +146,13 @@ private ValidateResult checkRequest(EsbGetJobInstanceLogRequest request) { } @Override - public EsbResp> getJobInstanceLog(String lang, String appCode, String username, + public EsbResp> getJobInstanceLog(String appCode, String username, Long appId, Long taskInstanceId) { EsbGetJobInstanceLogRequest req = new EsbGetJobInstanceLogRequest(); req.setAppCode(appCode); req.setUserName(username); req.setAppId(appId); req.setTaskInstanceId(taskInstanceId); - return getJobInstanceLogUsingPost(lang, req); + return getJobInstanceLogUsingPost(req); } } diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbGetJobInstanceStatusResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbGetJobInstanceStatusResourceImpl.java index 4d83207496..29a667a671 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbGetJobInstanceStatusResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbGetJobInstanceStatusResourceImpl.java @@ -67,8 +67,7 @@ public EsbGetJobInstanceStatusResourceImpl(MessageI18nService i18nService, GseTa @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_get_job_instance_status"}) - public EsbResp getJobInstanceStatusUsingPost(String lang, - EsbGetJobInstanceStatusRequest request) { + public EsbResp getJobInstanceStatusUsingPost(EsbGetJobInstanceStatusRequest request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get job instance status request is illegal!"); @@ -177,13 +176,13 @@ private EsbJobInstanceStatusDTO buildEsbJobInstanceStatusDTO(TaskInstanceDTO tas } @Override - public EsbResp getJobInstanceStatus(String lang, String appCode, String username, + public EsbResp getJobInstanceStatus(String appCode, String username, Long appId, Long taskInstanceId) { EsbGetJobInstanceStatusRequest req = new EsbGetJobInstanceStatusRequest(); req.setAppCode(appCode); req.setUserName(username); req.setAppId(appId); req.setTaskInstanceId(taskInstanceId); - return getJobInstanceStatusUsingPost(lang, req); + return getJobInstanceStatusUsingPost(req); } } diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbGetStepInstanceStatusResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbGetStepInstanceStatusResourceImpl.java index 21190c3d38..ab660649d2 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbGetStepInstanceStatusResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbGetStepInstanceStatusResourceImpl.java @@ -68,8 +68,7 @@ public EsbGetStepInstanceStatusResourceImpl(MessageI18nService i18nService, GseT @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_get_step_instance_status"}) - public EsbResp getJobStepInstanceStatus(String lang, - EsbGetStepInstanceStatusRequest request) { + public EsbResp getJobStepInstanceStatus(EsbGetStepInstanceStatusRequest request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get step instance status request is illegal!"); diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbOperateJobInstanceResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbOperateJobInstanceResourceImpl.java index 0736c22dcf..378b575dfe 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbOperateJobInstanceResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbOperateJobInstanceResourceImpl.java @@ -58,7 +58,7 @@ public EsbOperateJobInstanceResourceImpl(TaskExecuteService taskExecuteService, @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_operate_job_instance"}) - public EsbResp operateJobInstance(String lang, EsbOperateJobInstanceRequest request) { + public EsbResp operateJobInstance(EsbOperateJobInstanceRequest request) { log.info("Operate task instance, request={}", JsonUtils.toJson(request)); if (!checkRequest(request)) { return EsbResp.buildCommonFailResp(ErrorCode.ILLEGAL_PARAM, i18nService); diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbOperateStepInstanceResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbOperateStepInstanceResourceImpl.java index 308c689806..aa0ade85bd 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbOperateStepInstanceResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbOperateStepInstanceResourceImpl.java @@ -59,7 +59,7 @@ public EsbOperateStepInstanceResourceImpl(TaskExecuteService taskExecuteService, @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_operate_step_instance"}) - public EsbResp operateStepInstance(String lang, EsbOperateStepInstanceRequest request) { + public EsbResp operateStepInstance(EsbOperateStepInstanceRequest request) { log.info("Operate step instance, request={}", JsonUtils.toJson(request)); if (!checkRequest(request)) { return EsbResp.buildCommonFailResp(ErrorCode.ILLEGAL_PARAM, i18nService); diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbPushConfigFileResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbPushConfigFileResourceImpl.java index 66c48d67b7..8400850d1c 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbPushConfigFileResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v2/impl/EsbPushConfigFileResourceImpl.java @@ -86,7 +86,7 @@ public EsbPushConfigFileResourceImpl(TaskExecuteService taskExecuteService, Mess @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_push_config_file"}) - public EsbResp pushConfigFile(String lang, EsbPushConfigFileRequest request) { + public EsbResp pushConfigFile(EsbPushConfigFileRequest request) { ValidateResult checkResult = checkPushConfigFileRequest(request); if (!checkResult.isPass()) { log.warn("Fast transfer file request is illegal!"); diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbBatchGetJobInstanceIpLogV3ResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbBatchGetJobInstanceIpLogV3ResourceImpl.java index 1133ec1fa7..5a6f52b32f 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbBatchGetJobInstanceIpLogV3ResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbBatchGetJobInstanceIpLogV3ResourceImpl.java @@ -34,7 +34,7 @@ @Slf4j public class EsbBatchGetJobInstanceIpLogV3ResourceImpl implements EsbBatchGetJobInstanceIpLogV3Resource { @Override - public EsbResp batchGetJobInstanceIpLogs(String lang, EsbBatchGetJobInstanceIpLogV3Request request) { + public EsbResp batchGetJobInstanceIpLogs(EsbBatchGetJobInstanceIpLogV3Request request) { return null; } } diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbExecuteJobPlanV3ResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbExecuteJobPlanV3ResourceImpl.java index f509bf87e8..52c9c0a695 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbExecuteJobPlanV3ResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbExecuteJobPlanV3ResourceImpl.java @@ -74,7 +74,7 @@ public EsbExecuteJobPlanV3ResourceImpl(TaskExecuteService taskExecuteService, Me @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_execute_job_plan"}) - public EsbResp executeJobPlan(String lang, EsbExecuteJobV3Request request) { + public EsbResp executeJobPlan(EsbExecuteJobV3Request request) { log.info("Execute task, request={}", JsonUtils.toJson(request)); ValidateResult checkResult = checkExecuteTaskRequest(request); if (!checkResult.isPass()) { diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastExecuteSQLV3ResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastExecuteSQLV3ResourceImpl.java index d6313920ae..6c06f34aa6 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastExecuteSQLV3ResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastExecuteSQLV3ResourceImpl.java @@ -73,7 +73,7 @@ public EsbFastExecuteSQLV3ResourceImpl(TaskExecuteService taskExecuteService, @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_fast_execute_sql"}) - public EsbResp fastExecuteSQL(String lang, EsbFastExecuteSQLV3Request request) { + public EsbResp fastExecuteSQL(EsbFastExecuteSQLV3Request request) { ValidateResult validateResult = checkFastExecuteSQLRequest(request); if (!validateResult.isPass()) { log.warn("Fast execute sql request is illegal!"); diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastExecuteScriptV3ResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastExecuteScriptV3ResourceImpl.java index e022f4a127..0ae1f38818 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastExecuteScriptV3ResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastExecuteScriptV3ResourceImpl.java @@ -73,7 +73,7 @@ public EsbFastExecuteScriptV3ResourceImpl(TaskExecuteService taskExecuteService, @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_fast_execute_script"}) - public EsbResp fastExecuteScript(String lang, EsbFastExecuteScriptV3Request request) { + public EsbResp fastExecuteScript(EsbFastExecuteScriptV3Request request) { ValidateResult checkResult = checkFastExecuteScriptRequest(request); if (!checkResult.isPass()) { log.warn("Fast execute script request is illegal!"); diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastTransferFileV3ResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastTransferFileV3ResourceImpl.java index 8213a1868d..73d2bb9004 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastTransferFileV3ResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbFastTransferFileV3ResourceImpl.java @@ -89,7 +89,7 @@ public EsbFastTransferFileV3ResourceImpl(TaskExecuteService taskExecuteService, @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_fast_transfer_file"}) - public EsbResp fastTransferFile(String lang, EsbFastTransferFileV3Request request) { + public EsbResp fastTransferFile(EsbFastTransferFileV3Request request) { ValidateResult checkResult = checkFastTransferFileRequest(request); if (!checkResult.isPass()) { log.warn("Fast transfer file request is illegal!"); diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceGlobalVarValueV3ResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceGlobalVarValueV3ResourceImpl.java index 24d8b8f730..78e71bb33e 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceGlobalVarValueV3ResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceGlobalVarValueV3ResourceImpl.java @@ -65,8 +65,9 @@ public EsbGetJobInstanceGlobalVarValueV3ResourceImpl(MessageI18nService i18nServ @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_get_job_instance_var_value"}) - public EsbResp getJobInstanceGlobalVarValue(String lang, - EsbGetJobInstanceGlobalVarValueV3Request request) { + public EsbResp getJobInstanceGlobalVarValueUsingPost( + EsbGetJobInstanceGlobalVarValueV3Request request) { + ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get job instance global var value, request is illegal!"); @@ -122,4 +123,17 @@ private ValidateResult checkRequest(EsbGetJobInstanceGlobalVarValueV3Request req } return ValidateResult.pass(); } + + @Override + public EsbResp getJobInstanceGlobalVarValue(String username, + String appCode, + Long appId, + Long taskInstanceId) { + EsbGetJobInstanceGlobalVarValueV3Request request = new EsbGetJobInstanceGlobalVarValueV3Request(); + request.setUserName(username); + request.setAppCode(appCode); + request.setAppId(appId); + request.setTaskInstanceId(taskInstanceId); + return getJobInstanceGlobalVarValueUsingPost(request); + } } diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceIpLogV3ResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceIpLogV3ResourceImpl.java index e66fc2ac1d..6ae33d8ac2 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceIpLogV3ResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceIpLogV3ResourceImpl.java @@ -72,7 +72,7 @@ public EsbGetJobInstanceIpLogV3ResourceImpl(MessageI18nService i18nService, @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_get_job_instance_ip_log"}) - public EsbResp getJobInstanceIpLog(String lang, EsbGetJobInstanceIpLogV3Request request) { + public EsbResp getJobInstanceIpLogUsingPost(EsbGetJobInstanceIpLogV3Request request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get job instance ip log request is illegal!"); @@ -203,4 +203,23 @@ private EsbFileLogV3DTO toEsbFileLogV3DTO(ServiceFileTaskLogDTO fileTaskLog) { fileLog.setStatus(fileTaskLog.getStatus()); return fileLog; } + + @Override + public EsbResp getJobInstanceIpLog(String username, + String appCode, + Long appId, + Long taskInstanceId, + Long stepInstanceId, + Long cloudAreaId, + String ip) { + EsbGetJobInstanceIpLogV3Request request = new EsbGetJobInstanceIpLogV3Request(); + request.setUserName(username); + request.setAppCode(appCode); + request.setAppId(appId); + request.setTaskInstanceId(taskInstanceId); + request.setStepInstanceId(stepInstanceId); + request.setCloudAreaId(cloudAreaId); + request.setIp(ip); + return getJobInstanceIpLogUsingPost(request); + } } diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceListV3ResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceListV3ResourceImpl.java index 02a9c4a7b9..ed2a50e3c5 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceListV3ResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceListV3ResourceImpl.java @@ -64,8 +64,9 @@ public EsbGetJobInstanceListV3ResourceImpl(MessageI18nService i18nService, @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_get_job_instance_list"}) - public EsbResp> getJobInstanceList(String lang, - EsbGetJobInstanceListV3Request request) { + public EsbResp> getJobInstanceListUsingPost( + EsbGetJobInstanceListV3Request request) { + ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get job instance ip log request is illegal!"); @@ -155,4 +156,37 @@ private ValidateResult checkRequest(EsbGetJobInstanceListV3Request request) { } return ValidateResult.pass(); } + + @Override + public EsbResp> getJobInstanceList(String username, + String appCode, + Long appId, + Long createTimeStart, + Long createTimeEnd, + Long taskInstanceId, + String operator, + String taskName, + Integer startupMode, + Integer taskType, + Integer taskStatus, + String ip, + Integer start, + Integer length) { + EsbGetJobInstanceListV3Request request = new EsbGetJobInstanceListV3Request(); + request.setUserName(username); + request.setAppCode(appCode); + request.setAppId(appId); + request.setCreateTimeStart(createTimeStart); + request.setCreateTimeEnd(createTimeEnd); + request.setTaskInstanceId(taskInstanceId); + request.setOperator(operator); + request.setTaskName(taskName); + request.setStartupMode(startupMode); + request.setTaskType(taskType); + request.setTaskStatus(taskStatus); + request.setIp(ip); + request.setStart(start); + request.setLength(length); + return getJobInstanceListUsingPost(request); + } } diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceStatusV3ResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceStatusV3ResourceImpl.java index cb80c581f5..2ca523daf4 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceStatusV3ResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbGetJobInstanceStatusV3ResourceImpl.java @@ -63,8 +63,7 @@ public EsbGetJobInstanceStatusV3ResourceImpl(MessageI18nService i18nService, Gse @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_get_job_instance_status"}) - public EsbResp getJobInstanceStatus(String lang, - EsbGetJobInstanceStatusV3Request request) { + public EsbResp getJobInstanceStatusUsingPost(EsbGetJobInstanceStatusV3Request request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get job instance status request is illegal!"); @@ -74,7 +73,7 @@ public EsbResp getJobInstanceStatus(String lang, long taskInstanceId = request.getTaskInstanceId(); TaskInstanceDTO taskInstance = taskInstanceService.getTaskInstance(request.getTaskInstanceId()); - EsbResp authResult = authViewTaskInstance(request.getUserName(), request.getAppId(), taskInstance); + EsbResp authResult = authViewTaskInstance(request.getUserName(), request.getAppId(), taskInstance); if (!authResult.getCode().equals(EsbResp.SUCCESS_CODE)) { return authResult; } @@ -163,4 +162,19 @@ private EsbJobInstanceStatusV3DTO buildEsbJobInstanceStatusDTO(TaskInstanceDTO t return jobInstanceStatus; } + + @Override + public EsbResp getJobInstanceStatus(String username, + String appCode, + Long appId, + Long taskInstanceId, + boolean returnIpResult) { + EsbGetJobInstanceStatusV3Request request = new EsbGetJobInstanceStatusV3Request(); + request.setUserName(username); + request.setAppCode(appCode); + request.setAppId(appId); + request.setTaskInstanceId(taskInstanceId); + request.setReturnIpResult(returnIpResult); + return getJobInstanceStatusUsingPost(request); + } } diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbOperateJobInstanceV3ResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbOperateJobInstanceV3ResourceImpl.java index 9e57543443..4f55102862 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbOperateJobInstanceV3ResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbOperateJobInstanceV3ResourceImpl.java @@ -57,7 +57,7 @@ public EsbOperateJobInstanceV3ResourceImpl(TaskExecuteService taskExecuteService @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_operate_job_instance"}) - public EsbResp operateJobInstance(String lang, EsbOperateJobInstanceV3Request request) { + public EsbResp operateJobInstance(EsbOperateJobInstanceV3Request request) { log.info("Operate task instance, request={}", JsonUtils.toJson(request)); if (!checkRequest(request)) { return EsbResp.buildCommonFailResp(ErrorCode.ILLEGAL_PARAM, i18nService); diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbOperateStepInstanceV3ResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbOperateStepInstanceV3ResourceImpl.java index fc859945c8..7b94fa08a8 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbOperateStepInstanceV3ResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbOperateStepInstanceV3ResourceImpl.java @@ -58,7 +58,7 @@ public EsbOperateStepInstanceV3ResourceImpl(TaskExecuteService taskExecuteServic @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_operate_step_instance"}) - public EsbResp operateStepInstance(String lang, EsbOperateStepInstanceV3Request request) { + public EsbResp operateStepInstance(EsbOperateStepInstanceV3Request request) { log.info("Operate step instance, request={}", JsonUtils.toJson(request)); if (!checkRequest(request)) { return EsbResp.buildCommonFailResp(ErrorCode.ILLEGAL_PARAM, i18nService); diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbPushConfigFileResourceV3Impl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbPushConfigFileResourceV3Impl.java index 272e3e6c83..f79bef205a 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbPushConfigFileResourceV3Impl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/esb/v3/EsbPushConfigFileResourceV3Impl.java @@ -86,7 +86,7 @@ public EsbPushConfigFileResourceV3Impl(TaskExecuteService taskExecuteService, @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_push_config_file"}) - public EsbResp pushConfigFile(String lang, EsbPushConfigFileV3Request request) { + public EsbResp pushConfigFile(EsbPushConfigFileV3Request request) { ValidateResult checkResult = checkPushConfigFileRequest(request); if (!checkResult.isPass()) { log.warn("Fast transfer file request is illegal!"); diff --git a/src/backend/job-file-gateway/boot-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/config/InterceptorConfiguration.java b/src/backend/job-file-gateway/boot-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/config/InterceptorConfiguration.java index dc56287fb7..d3f17dd3ff 100644 --- a/src/backend/job-file-gateway/boot-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/config/InterceptorConfiguration.java +++ b/src/backend/job-file-gateway/boot-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/config/InterceptorConfiguration.java @@ -25,6 +25,7 @@ package com.tencent.bk.job.file_gateway.config; import com.tencent.bk.job.common.web.interceptor.EsbApiLogInterceptor; +import com.tencent.bk.job.common.web.interceptor.EsbReqRewriteInterceptor; import com.tencent.bk.job.common.web.interceptor.JobCommonInterceptor; import com.tencent.bk.job.common.web.interceptor.ServiceSecurityInterceptor; import com.tencent.bk.job.file_gateway.interceptor.UriPermissionInterceptor; @@ -38,16 +39,19 @@ public class InterceptorConfiguration implements WebMvcConfigurer { private final JobCommonInterceptor jobCommonInterceptor; private final EsbApiLogInterceptor esbApiLogInterceptor; + private final EsbReqRewriteInterceptor esbReqRewriteInterceptor; private final ServiceSecurityInterceptor serviceSecurityInterceptor; private final UriPermissionInterceptor uriPermissionInterceptor; @Autowired public InterceptorConfiguration(JobCommonInterceptor jobCommonInterceptor, EsbApiLogInterceptor esbApiLogInterceptor, + EsbReqRewriteInterceptor esbReqRewriteInterceptor, ServiceSecurityInterceptor serviceSecurityInterceptor, UriPermissionInterceptor uriPermissionInterceptor) { this.jobCommonInterceptor = jobCommonInterceptor; this.esbApiLogInterceptor = esbApiLogInterceptor; + this.esbReqRewriteInterceptor = esbReqRewriteInterceptor; this.serviceSecurityInterceptor = serviceSecurityInterceptor; this.uriPermissionInterceptor = uriPermissionInterceptor; } @@ -60,5 +64,6 @@ public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(uriPermissionInterceptor) .addPathPatterns(uriPermissionInterceptor.getControlUriPatternsList()).order(2); registry.addInterceptor(esbApiLogInterceptor).addPathPatterns("/esb/api/**").order(10); + registry.addInterceptor(esbReqRewriteInterceptor).addPathPatterns("/esb/api/**").order(11); } } diff --git a/src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/filter/esb/CheckEsbJwtGatewayFilterFactory.java b/src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/filter/esb/CheckEsbJwtGatewayFilterFactory.java index 6dc911d290..4d68adbd18 100644 --- a/src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/filter/esb/CheckEsbJwtGatewayFilterFactory.java +++ b/src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/filter/esb/CheckEsbJwtGatewayFilterFactory.java @@ -24,6 +24,7 @@ package com.tencent.bk.job.gateway.filter.esb; +import com.tencent.bk.job.common.constant.JobCommonHeaders; import com.tencent.bk.job.common.util.RequestUtil; import com.tencent.bk.job.gateway.model.esb.EsbJwtInfo; import com.tencent.bk.job.gateway.service.EsbJwtService; @@ -38,7 +39,7 @@ import org.springframework.stereotype.Component; /** - * ESB JWT 校验,用于确认ESB-API调用方式来自于ESB + * ESB JWT 解析与校验,用于确认ESB-API调用方式来自于ESB */ @Slf4j @Component @@ -70,6 +71,10 @@ public GatewayFilter apply(Config config) { response.setStatusCode(HttpStatus.UNAUTHORIZED); return response.setComplete(); } + + // set app code header + request.mutate().header(JobCommonHeaders.APP_CODE, new String[]{authInfo.getAppCode()}).build(); + request.mutate().header(JobCommonHeaders.USERNAME, new String[]{authInfo.getUsername()}).build(); return chain.filter(exchange.mutate().request(request).build()); }; } diff --git a/src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/filter/AuthorizeGatewayFilterFactory.java b/src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/filter/web/AuthorizeGatewayFilterFactory.java similarity index 98% rename from src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/filter/AuthorizeGatewayFilterFactory.java rename to src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/filter/web/AuthorizeGatewayFilterFactory.java index 126cdb78b5..cab36a47cb 100644 --- a/src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/filter/AuthorizeGatewayFilterFactory.java +++ b/src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/filter/web/AuthorizeGatewayFilterFactory.java @@ -22,7 +22,7 @@ * IN THE SOFTWARE. */ -package com.tencent.bk.job.gateway.filter; +package com.tencent.bk.job.gateway.filter.web; import com.tencent.bk.job.common.model.dto.BkUserDTO; import com.tencent.bk.job.common.util.RequestUtil; diff --git a/src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/filter/CsrfCheckGatewayFilterFactory.java b/src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/filter/web/CsrfCheckGatewayFilterFactory.java similarity index 99% rename from src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/filter/CsrfCheckGatewayFilterFactory.java rename to src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/filter/web/CsrfCheckGatewayFilterFactory.java index 623220038f..a481e8d0bc 100644 --- a/src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/filter/CsrfCheckGatewayFilterFactory.java +++ b/src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/filter/web/CsrfCheckGatewayFilterFactory.java @@ -22,7 +22,7 @@ * IN THE SOFTWARE. */ -package com.tencent.bk.job.gateway.filter; +package com.tencent.bk.job.gateway.filter.web; import com.tencent.bk.job.common.util.RequestUtil; import com.tencent.bk.job.gateway.common.util.UrlUtil; diff --git a/src/backend/job-gateway/src/test/java/com/tencent/bk/job/gateway/filter/CsrfCheckGatewayFilterFactoryTest.java b/src/backend/job-gateway/src/test/java/com/tencent/bk/job/gateway/filter/CsrfCheckGatewayFilterFactoryTest.java index 1f71c22601..872ad28205 100644 --- a/src/backend/job-gateway/src/test/java/com/tencent/bk/job/gateway/filter/CsrfCheckGatewayFilterFactoryTest.java +++ b/src/backend/job-gateway/src/test/java/com/tencent/bk/job/gateway/filter/CsrfCheckGatewayFilterFactoryTest.java @@ -25,6 +25,7 @@ package com.tencent.bk.job.gateway.filter; import com.tencent.bk.job.gateway.config.BkConfig; +import com.tencent.bk.job.gateway.filter.web.CsrfCheckGatewayFilterFactory; import com.tencent.bk.job.gateway.web.service.LoginService; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -41,7 +42,13 @@ import org.springframework.util.MultiValueMap; import org.springframework.web.server.ServerWebExchange; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; public class CsrfCheckGatewayFilterFactoryTest { private static final String COOKIE_CSRF_KEY_NAME = "job_csrf_key"; diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetDBAccountListResource.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetDBAccountListResource.java index 3593f89766..769f82b8ed 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetDBAccountListResource.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetDBAccountListResource.java @@ -48,7 +48,6 @@ public interface EsbGetDBAccountListResource { @PostMapping("/get_own_db_account_list") EsbResp> getUserOwnDbAccountList( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbGetDBAccountListRequest request); } diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetJobDetailResource.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetJobDetailResource.java index 5347a3fa16..3e34dbb707 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetJobDetailResource.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetJobDetailResource.java @@ -46,6 +46,5 @@ public interface EsbGetJobDetailResource { @PostMapping("/get_job_detail") EsbResp getJobDetail( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbGetJobDetailRequest request); } diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetJobListResource.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetJobListResource.java index 2a1fe526ce..2f50aee6fa 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetJobListResource.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetJobListResource.java @@ -48,6 +48,5 @@ public interface EsbGetJobListResource { @PostMapping("/get_job_list") EsbResp> getJobList( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbGetJobListRequest request); } diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetOSAccountResource.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetOSAccountResource.java index dc5b4e51f9..182b6ec535 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetOSAccountResource.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetOSAccountResource.java @@ -48,7 +48,6 @@ public interface EsbGetOSAccountResource { @PostMapping("/get_os_account") EsbResp> getAppOsAccountList( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbGetOSAccountListRequest request); } diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetPublicScriptListResource.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetPublicScriptListResource.java index c38ae4f2f3..378dd74634 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetPublicScriptListResource.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetPublicScriptListResource.java @@ -47,7 +47,6 @@ public interface EsbGetPublicScriptListResource { @PostMapping("/get_public_script_list") EsbResp> getPublicScriptList( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbGetPublicScriptListRequest request); } diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetScriptDetailResource.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetScriptDetailResource.java index ea52587dfb..7be17a5ecd 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetScriptDetailResource.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetScriptDetailResource.java @@ -46,7 +46,6 @@ public interface EsbGetScriptDetailResource { @PostMapping("/get_script_detail") EsbResp getScriptDetail( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbGetScriptDetailRequest request); } diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetScriptListResource.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetScriptListResource.java index 0e0ab5e58b..5518516b41 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetScriptListResource.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/EsbGetScriptListResource.java @@ -47,7 +47,6 @@ public interface EsbGetScriptListResource { @PostMapping("/get_script_list") EsbResp> getScriptList( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, @RequestBody EsbGetScriptListRequest request); } diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbAccountV3Resource.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbAccountV3Resource.java index 53c37381fe..837354ffc6 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbAccountV3Resource.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbAccountV3Resource.java @@ -25,18 +25,19 @@ package com.tencent.bk.job.manage.api.esb.v3; import com.tencent.bk.job.common.annotation.EsbAPI; +import com.tencent.bk.job.common.constant.JobCommonHeaders; import com.tencent.bk.job.common.esb.model.EsbResp; import com.tencent.bk.job.common.esb.model.job.v3.EsbPageDataV3; import com.tencent.bk.job.manage.model.esb.v3.request.EsbGetAccountListV3Req; import com.tencent.bk.job.manage.model.esb.v3.response.EsbAccountV3DTO; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import static com.tencent.bk.job.common.i18n.locale.LocaleUtils.COMMON_LANG_HEADER; - /** * 账号API-V3 */ @@ -46,8 +47,16 @@ public interface EsbAccountV3Resource { @PostMapping("/get_account_list") - EsbResp> getAccountList( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, + EsbResp> getAccountListUsingPost( @RequestBody EsbGetAccountListV3Req request); + @GetMapping("/get_account_list") + EsbResp> getAccountList( + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestParam(value = "bk_biz_id") Long appId, + @RequestParam(value = "category", required = false) Integer category, + @RequestParam(value = "start", required = false) Integer start, + @RequestParam(value = "length", required = false) Integer length); + } diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbPlanV3Resource.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbPlanV3Resource.java index 4ad372a3e6..6bbf30dbc9 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbPlanV3Resource.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbPlanV3Resource.java @@ -25,20 +25,21 @@ package com.tencent.bk.job.manage.api.esb.v3; import com.tencent.bk.job.common.annotation.EsbAPI; +import com.tencent.bk.job.common.constant.JobCommonHeaders; import com.tencent.bk.job.common.esb.model.EsbResp; import com.tencent.bk.job.common.esb.model.job.v3.EsbPageDataV3; import com.tencent.bk.job.manage.model.esb.v3.request.EsbGetPlanDetailV3Request; import com.tencent.bk.job.manage.model.esb.v3.request.EsbGetPlanListV3Request; import com.tencent.bk.job.manage.model.esb.v3.response.EsbPlanBasicInfoV3DTO; import com.tencent.bk.job.manage.model.esb.v3.response.EsbPlanInfoV3DTO; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import static com.tencent.bk.job.common.i18n.locale.LocaleUtils.COMMON_LANG_HEADER; - /** * @since 15/10/2020 16:20 */ @@ -46,13 +47,35 @@ @RestController @EsbAPI public interface EsbPlanV3Resource { - @PostMapping("/get_job_plan_list") + + @GetMapping("/get_job_plan_list") EsbResp> getPlanList( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestParam(value = "bk_biz_id") Long appId, + @RequestParam(value = "job_template_id", required = false) Long templateId, + @RequestParam(value = "creator", required = false) String creator, + @RequestParam(value = "name", required = false) String name, + @RequestParam(value = "create_time_start", required = false) Long createTimeStart, + @RequestParam(value = "create_time_end", required = false) Long createTimeEnd, + @RequestParam(value = "last_modify_user", required = false) String lastModifyUser, + @RequestParam(value = "last_modify_time_start", required = false) Long lastModifyTimeStart, + @RequestParam(value = "last_modify_time_end", required = false) Long lastModifyTimeEnd, + @RequestParam(value = "start", required = false) Integer start, + @RequestParam(value = "length", required = false) Integer length); + + @GetMapping("/get_job_plan_detail") + EsbResp getPlanDetail( + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestParam(value = "bk_biz_id") Long appId, + @RequestParam(value = "job_plan_id") Long planId); + + @PostMapping("/get_job_plan_list") + EsbResp> getPlanListUsingPost( @RequestBody EsbGetPlanListV3Request request); @PostMapping("/get_job_plan_detail") - EsbResp getPlanDetail( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, + EsbResp getPlanDetailUsingPost( @RequestBody EsbGetPlanDetailV3Request request); } diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbPublicScriptV3Resource.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbPublicScriptV3Resource.java index 0844988c24..268b406453 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbPublicScriptV3Resource.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbPublicScriptV3Resource.java @@ -25,6 +25,7 @@ package com.tencent.bk.job.manage.api.esb.v3; import com.tencent.bk.job.common.annotation.EsbAPI; +import com.tencent.bk.job.common.constant.JobCommonHeaders; import com.tencent.bk.job.common.esb.model.EsbResp; import com.tencent.bk.job.common.esb.model.job.v3.EsbPageDataV3; import com.tencent.bk.job.manage.model.esb.v3.request.EsbGetScriptListV3Req; @@ -32,14 +33,14 @@ import com.tencent.bk.job.manage.model.esb.v3.request.EsbGetScriptVersionListV3Req; import com.tencent.bk.job.manage.model.esb.v3.response.EsbScriptV3DTO; import com.tencent.bk.job.manage.model.esb.v3.response.EsbScriptVersionDetailV3DTO; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import static com.tencent.bk.job.common.i18n.locale.LocaleUtils.COMMON_LANG_HEADER; - /** * 公共脚本相关API-V3 */ @@ -48,19 +49,43 @@ @EsbAPI public interface EsbPublicScriptV3Resource { - @PostMapping("/get_public_script_list") + @GetMapping("/get_public_script_list") EsbResp> getPublicScriptList( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestParam(value = "name", required = false) String name, + @RequestParam(value = "script_language", required = false) Integer scriptLanguage, + @RequestParam(value = "start", required = false) Integer start, + @RequestParam(value = "length", required = false) Integer length); + + @GetMapping("/get_public_script_version_list") + EsbResp> getPublicScriptVersionList( + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestParam(value = "script_id") String scriptId, + @RequestParam(value = "return_script_content", required = false, defaultValue = "false") + boolean returnScriptContent, + @RequestParam(value = "start", required = false) Integer start, + @RequestParam(value = "length", required = false) Integer length); + + @GetMapping("/get_public_script_version_detail") + EsbResp getPublicScriptVersionDetail( + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestParam(value = "id", required = false) Long scriptVersionId, + @RequestParam(value = "script_id", required = false) String scriptId, + @RequestParam(value = "version", required = false) String version); + + @PostMapping("/get_public_script_list") + EsbResp> getPublicScriptListUsingPost( @RequestBody EsbGetScriptListV3Req request); @PostMapping("/get_public_script_version_list") - EsbResp> getPublicScriptVersionList( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, + EsbResp> getPublicScriptVersionListUsingPost( @RequestBody EsbGetScriptVersionListV3Req request); @PostMapping("/get_public_script_version_detail") - EsbResp getPublicScriptVersionDetail( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, + EsbResp getPublicScriptVersionDetailUsingPost( @RequestBody EsbGetScriptVersionDetailV3Req request); } diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbScriptV3Resource.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbScriptV3Resource.java index d00fb05ee7..b93ba00e16 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbScriptV3Resource.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbScriptV3Resource.java @@ -25,6 +25,7 @@ package com.tencent.bk.job.manage.api.esb.v3; import com.tencent.bk.job.common.annotation.EsbAPI; +import com.tencent.bk.job.common.constant.JobCommonHeaders; import com.tencent.bk.job.common.esb.model.EsbResp; import com.tencent.bk.job.common.esb.model.job.v3.EsbPageDataV3; import com.tencent.bk.job.manage.model.esb.v3.request.EsbGetScriptListV3Req; @@ -32,14 +33,14 @@ import com.tencent.bk.job.manage.model.esb.v3.request.EsbGetScriptVersionListV3Req; import com.tencent.bk.job.manage.model.esb.v3.response.EsbScriptV3DTO; import com.tencent.bk.job.manage.model.esb.v3.response.EsbScriptVersionDetailV3DTO; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import static com.tencent.bk.job.common.i18n.locale.LocaleUtils.COMMON_LANG_HEADER; - /** * 脚本相关API-V3 */ @@ -48,19 +49,46 @@ @EsbAPI public interface EsbScriptV3Resource { - @PostMapping("/get_script_list") + @GetMapping("/get_script_list") EsbResp> getScriptList( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestParam(value = "bk_biz_id") Long appId, + @RequestParam(value = "name", required = false) String name, + @RequestParam(value = "script_language", required = false) Integer scriptLanguage, + @RequestParam(value = "start", required = false) Integer start, + @RequestParam(value = "length", required = false) Integer length); + + @GetMapping("/get_script_version_list") + EsbResp> getScriptVersionList( + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestParam(value = "bk_biz_id") Long appId, + @RequestParam(value = "script_id") String scriptId, + @RequestParam(value = "return_script_content", required = false, defaultValue = "false") + boolean returnScriptContent, + @RequestParam(value = "start", required = false) Integer start, + @RequestParam(value = "length", required = false) Integer length); + + @GetMapping("/get_script_version_detail") + EsbResp getScriptVersionDetail( + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestParam(value = "bk_biz_id") Long appId, + @RequestParam(value = "id", required = false) Long scriptVersionId, + @RequestParam(value = "script_id", required = false) String scriptId, + @RequestParam(value = "version", required = false) String version); + + @PostMapping("/get_script_list") + EsbResp> getScriptListUsingPost( @RequestBody EsbGetScriptListV3Req request); @PostMapping("/get_script_version_list") - EsbResp> getScriptVersionList( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, + EsbResp> getScriptVersionListUsingPost( @RequestBody EsbGetScriptVersionListV3Req request); @PostMapping("/get_script_version_detail") - EsbResp getScriptVersionDetail( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, + EsbResp getScriptVersionDetailUsingPost( @RequestBody EsbGetScriptVersionDetailV3Req request); } diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbTemplateV3Resource.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbTemplateV3Resource.java index 77509438d0..ed8bdf0acb 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbTemplateV3Resource.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/v3/EsbTemplateV3Resource.java @@ -25,18 +25,19 @@ package com.tencent.bk.job.manage.api.esb.v3; import com.tencent.bk.job.common.annotation.EsbAPI; +import com.tencent.bk.job.common.constant.JobCommonHeaders; import com.tencent.bk.job.common.esb.model.EsbResp; import com.tencent.bk.job.common.esb.model.job.v3.EsbPageDataV3; import com.tencent.bk.job.manage.model.esb.v3.request.EsbGetTemplateListV3Request; import com.tencent.bk.job.manage.model.esb.v3.response.EsbTemplateBasicInfoV3DTO; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import static com.tencent.bk.job.common.i18n.locale.LocaleUtils.COMMON_LANG_HEADER; - /** * @since 15/10/2020 16:19 */ @@ -44,8 +45,23 @@ @RestController @EsbAPI public interface EsbTemplateV3Resource { - @PostMapping("/get_job_template_list") + + @GetMapping("/get_job_template_list") EsbResp> getTemplateList( - @RequestHeader(value = COMMON_LANG_HEADER, required = false) String lang, + @RequestHeader(value = JobCommonHeaders.USERNAME) String username, + @RequestHeader(value = JobCommonHeaders.APP_CODE) String appCode, + @RequestParam(value = "bk_biz_id") Long appId, + @RequestParam(value = "creator", required = false) String creator, + @RequestParam(value = "name", required = false) String name, + @RequestParam(value = "create_time_start", required = false) Long createTimeStart, + @RequestParam(value = "create_time_end", required = false) Long createTimeEnd, + @RequestParam(value = "last_modify_user", required = false) String lastModifyUser, + @RequestParam(value = "last_modify_time_start", required = false) Long lastModifyTimeStart, + @RequestParam(value = "last_modify_time_end", required = false) Long lastModifyTimeEnd, + @RequestParam(value = "start", required = false) Integer start, + @RequestParam(value = "length", required = false) Integer length); + + @PostMapping("/get_job_template_list") + EsbResp> getTemplateListUsingPost( @RequestBody EsbGetTemplateListV3Request request); } diff --git a/src/backend/job-manage/boot-job-manage/src/main/java/com/tencent/bk/job/manage/config/FilterConfig.java b/src/backend/job-manage/boot-job-manage/src/main/java/com/tencent/bk/job/manage/config/FilterConfig.java index dbc9c022da..de0003b896 100644 --- a/src/backend/job-manage/boot-job-manage/src/main/java/com/tencent/bk/job/manage/config/FilterConfig.java +++ b/src/backend/job-manage/boot-job-manage/src/main/java/com/tencent/bk/job/manage/config/FilterConfig.java @@ -24,7 +24,7 @@ package com.tencent.bk.job.manage.config; -import com.tencent.bk.job.common.web.filter.RepeatableReadServletRequestResponseFilter; +import com.tencent.bk.job.common.web.filter.RepeatableReadWriteServletRequestResponseFilter; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -33,7 +33,7 @@ public class FilterConfig { @Bean public FilterRegistrationBean repeatableRSRRFilterRegister() { - FilterRegistrationBean registration = + FilterRegistrationBean registration = new FilterRegistrationBean<>(); registration.setFilter(repeatableRRRFilter()); registration.addUrlPatterns("/esb/api/*"); @@ -43,7 +43,7 @@ public FilterRegistrationBean repeatableRSRRFilterRegister() { } @Bean(name = "repeatableReadRequestResponseFilter") - public RepeatableReadServletRequestResponseFilter repeatableRRRFilter() { - return new RepeatableReadServletRequestResponseFilter(); + public RepeatableReadWriteServletRequestResponseFilter repeatableRRRFilter() { + return new RepeatableReadWriteServletRequestResponseFilter(); } } diff --git a/src/backend/job-manage/boot-job-manage/src/main/java/com/tencent/bk/job/manage/config/InterceptorConfiguration.java b/src/backend/job-manage/boot-job-manage/src/main/java/com/tencent/bk/job/manage/config/InterceptorConfiguration.java index 140f00bb06..6fe98def29 100644 --- a/src/backend/job-manage/boot-job-manage/src/main/java/com/tencent/bk/job/manage/config/InterceptorConfiguration.java +++ b/src/backend/job-manage/boot-job-manage/src/main/java/com/tencent/bk/job/manage/config/InterceptorConfiguration.java @@ -26,6 +26,7 @@ import com.tencent.bk.job.common.iam.interceptor.JobIamInterceptor; import com.tencent.bk.job.common.web.interceptor.EsbApiLogInterceptor; +import com.tencent.bk.job.common.web.interceptor.EsbReqRewriteInterceptor; import com.tencent.bk.job.common.web.interceptor.JobCommonInterceptor; import com.tencent.bk.job.common.web.interceptor.ServiceSecurityInterceptor; import com.tencent.bk.job.manage.common.interceptor.UriPermissionInterceptor; @@ -43,6 +44,7 @@ public class InterceptorConfiguration implements WebMvcConfigurer { private final JobCommonInterceptor jobCommonInterceptor; private final UriPermissionInterceptor uriPermissionInterceptor; private final EsbApiLogInterceptor esbApiLogInterceptor; + private final EsbReqRewriteInterceptor esbReqRewriteInterceptor; private final ServiceSecurityInterceptor serviceSecurityInterceptor; private final JobIamInterceptor iamInterceptor; @@ -50,11 +52,13 @@ public class InterceptorConfiguration implements WebMvcConfigurer { public InterceptorConfiguration(JobCommonInterceptor jobCommonInterceptor, UriPermissionInterceptor uriPermissionInterceptor, EsbApiLogInterceptor esbApiLogInterceptor, + EsbReqRewriteInterceptor esbReqRewriteInterceptor, ServiceSecurityInterceptor serviceSecurityInterceptor, JobIamInterceptor iamInterceptor) { this.jobCommonInterceptor = jobCommonInterceptor; this.uriPermissionInterceptor = uriPermissionInterceptor; this.esbApiLogInterceptor = esbApiLogInterceptor; + this.esbReqRewriteInterceptor = esbReqRewriteInterceptor; this.serviceSecurityInterceptor = serviceSecurityInterceptor; this.iamInterceptor = iamInterceptor; } @@ -70,5 +74,6 @@ public void addInterceptors(InterceptorRegistry registry) { ).order(2); registry.addInterceptor(iamInterceptor).addPathPatterns("/iam/api/v1/resources/**").order(3); registry.addInterceptor(esbApiLogInterceptor).addPathPatterns("/esb/api/**").order(10); + registry.addInterceptor(esbReqRewriteInterceptor).addPathPatterns("/esb/api/**").order(11); } } diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetDBAccountListResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetDBAccountListResourceImpl.java index 162d4ff7d8..5f006223cc 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetDBAccountListResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetDBAccountListResourceImpl.java @@ -61,7 +61,7 @@ public EsbGetDBAccountListResourceImpl(AccountService accountService, MessageI18 @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_get_own_db_account_list"}) - public EsbResp> getUserOwnDbAccountList(String lang, EsbGetDBAccountListRequest request) { + public EsbResp> getUserOwnDbAccountList(EsbGetDBAccountListRequest request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get db account list, request is illegal!"); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetJobDetailResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetJobDetailResourceImpl.java index 6a685c5217..28651f882f 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetJobDetailResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetJobDetailResourceImpl.java @@ -85,7 +85,7 @@ public EsbGetJobDetailResourceImpl(TaskPlanService taskPlanService, ScriptServic @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_get_job_detail"}) - public EsbResp getJobDetail(String lang, EsbGetJobDetailRequest request) { + public EsbResp getJobDetail(EsbGetJobDetailRequest request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get job detail, request is illegal!"); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetJobListResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetJobListResourceImpl.java index f24108213e..0de1b63024 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetJobListResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetJobListResourceImpl.java @@ -69,7 +69,7 @@ public EsbGetJobListResourceImpl(TaskPlanService taskPlanService, MessageI18nSer @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_get_job_list"}) - public EsbResp> getJobList(String lang, EsbGetJobListRequest request) { + public EsbResp> getJobList(EsbGetJobListRequest request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get job list, request is illegal!"); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetOSAccountResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetOSAccountResourceImpl.java index ed9124952f..4d6dd91760 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetOSAccountResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetOSAccountResourceImpl.java @@ -63,7 +63,7 @@ public EsbGetOSAccountResourceImpl(AccountService accountService, MessageI18nSer @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_get_os_account"}) - public EsbResp> getAppOsAccountList(String lang, EsbGetOSAccountListRequest request) { + public EsbResp> getAppOsAccountList(EsbGetOSAccountListRequest request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get system account list, request is illegal!"); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetPublicScriptListResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetPublicScriptListResourceImpl.java index 7fab8c5eee..65a7fa3c14 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetPublicScriptListResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetPublicScriptListResourceImpl.java @@ -65,7 +65,7 @@ public EsbGetPublicScriptListResourceImpl(ScriptService scriptService, MessageI1 @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_get_public_script_list"}) - public EsbResp> getPublicScriptList(String lang, EsbGetPublicScriptListRequest request) { + public EsbResp> getPublicScriptList(EsbGetPublicScriptListRequest request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get public script list, request is illegal!"); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetScriptDetailResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetScriptDetailResourceImpl.java index e566f35dc2..62c2cdb43f 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetScriptDetailResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetScriptDetailResourceImpl.java @@ -61,7 +61,7 @@ public EsbGetScriptDetailResourceImpl(ScriptService scriptService, MessageI18nSe @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_get_script_detail"}) - public EsbResp getScriptDetail(String lang, EsbGetScriptDetailRequest request) { + public EsbResp getScriptDetail(EsbGetScriptDetailRequest request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get script detail, request is illegal!"); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetScriptListResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetScriptListResourceImpl.java index 15ecd17080..3b900c0be1 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetScriptListResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/EsbGetScriptListResourceImpl.java @@ -70,7 +70,7 @@ public EsbGetScriptListResourceImpl(ScriptService scriptService, MessageI18nServ @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v2_get_script_list"}) - public EsbResp> getScriptList(String lang, EsbGetScriptListRequest request) { + public EsbResp> getScriptList(EsbGetScriptListRequest request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get script list, request is illegal!"); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbAccountResourceV3Impl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbAccountResourceV3Impl.java index 08838ae3df..2e396f53e2 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbAccountResourceV3Impl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbAccountResourceV3Impl.java @@ -61,7 +61,7 @@ public EsbAccountResourceV3Impl(AccountService accountService, MessageI18nServic @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_get_account_list"}) - public EsbResp> getAccountList(String lang, EsbGetAccountListV3Req request) { + public EsbResp> getAccountListUsingPost(EsbGetAccountListV3Req request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get account list, request is illegal!"); @@ -122,4 +122,16 @@ private ValidateResult checkRequest(EsbGetAccountListV3Req request) { return ValidateResult.pass(); } + @Override + public EsbResp> getAccountList(String username, String appCode, Long appId, + Integer category, Integer start, Integer length) { + EsbGetAccountListV3Req request = new EsbGetAccountListV3Req(); + request.setUserName(username); + request.setAppCode(appCode); + request.setAppId(appId); + request.setCategory(category); + request.setStart(start); + request.setLength(length); + return getAccountListUsingPost(request); + } } diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbPlanV3ResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbPlanV3ResourceImpl.java index b03e80680d..e5501c1fbd 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbPlanV3ResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbPlanV3ResourceImpl.java @@ -68,9 +68,50 @@ public EsbPlanV3ResourceImpl(TaskPlanService taskPlanService, MessageI18nService this.authService = authService; } + @Override + public EsbResp> getPlanList(String username, + String appCode, + Long appId, + Long templateId, + String creator, + String name, + Long createTimeStart, + Long createTimeEnd, + String lastModifyUser, + Long lastModifyTimeStart, + Long lastModifyTimeEnd, + Integer start, + Integer length) { + EsbGetPlanListV3Request request = new EsbGetPlanListV3Request(); + request.setUserName(username); + request.setAppCode(appCode); + request.setAppId(appId); + request.setTemplateId(templateId); + request.setCreator(creator); + request.setName(name); + request.setCreateTimeStart(createTimeStart); + request.setCreateTimeEnd(createTimeEnd); + request.setLastModifyUser(lastModifyUser); + request.setLastModifyTimeStart(lastModifyTimeStart); + request.setLastModifyTimeEnd(lastModifyTimeEnd); + request.setStart(start); + request.setLength(length); + return getPlanListUsingPost(request); + } + + @Override + public EsbResp getPlanDetail(String username, String appCode, Long appId, Long planId) { + EsbGetPlanDetailV3Request request = new EsbGetPlanDetailV3Request(); + request.setUserName(username); + request.setAppCode(appCode); + request.setAppId(appId); + request.setPlanId(planId); + return getPlanDetailUsingPost(request); + } + @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_get_job_plan_list"}) - public EsbResp> getPlanList(String lang, EsbGetPlanListV3Request request) { + public EsbResp> getPlanListUsingPost(EsbGetPlanListV3Request request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get plan list, request is illegal!"); @@ -118,7 +159,7 @@ public EsbResp> getPlanList(String lang, Es @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_get_job_plan_detail"}) - public EsbResp getPlanDetail(String lang, EsbGetPlanDetailV3Request request) { + public EsbResp getPlanDetailUsingPost(EsbGetPlanDetailV3Request request) { ValidateResult validateResult = request.validate(); if (validateResult.isPass()) { TaskPlanInfoDTO taskPlanInfo = taskPlanService.getTaskPlanById(request.getAppId(), request.getPlanId()); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbPublicScriptResourceV3Impl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbPublicScriptResourceV3Impl.java index fb65605b97..dd5e487200 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbPublicScriptResourceV3Impl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbPublicScriptResourceV3Impl.java @@ -49,29 +49,75 @@ public EsbPublicScriptResourceV3Impl(EsbScriptV3Resource esbScriptV3Resource) { this.esbScriptV3Resource = esbScriptV3Resource; } + @Override + public EsbResp> getPublicScriptList(String username, + String appCode, + String name, + Integer scriptLanguage, + Integer start, + Integer length) { + EsbGetScriptListV3Req request = new EsbGetScriptListV3Req(); + request.setUserName(username); + request.setAppCode(appCode); + request.setName(name); + request.setScriptLanguage(scriptLanguage); + request.setStart(start); + request.setLength(length); + return getPublicScriptListUsingPost(request); + } + + @Override + public EsbResp> getPublicScriptVersionList(String username, + String appCode, + String scriptId, + boolean returnScriptContent, + Integer start, + Integer length) { + EsbGetScriptVersionListV3Req request = new EsbGetScriptVersionListV3Req(); + request.setUserName(username); + request.setAppCode(appCode); + request.setScriptId(scriptId); + request.setReturnScriptContent(returnScriptContent); + request.setStart(start); + request.setLength(length); + return getPublicScriptVersionListUsingPost(request); + } + + @Override + public EsbResp getPublicScriptVersionDetail(String username, + String appCode, + Long scriptVersionId, + String scriptId, + String version) { + EsbGetScriptVersionDetailV3Req request = new EsbGetScriptVersionDetailV3Req(); + request.setUserName(username); + request.setAppCode(appCode); + request.setId(scriptVersionId); + request.setScriptId(scriptId); + request.setVersion(version); + return getPublicScriptVersionDetailUsingPost(request); + } @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_get_public_script_list"}) - public EsbResp> getPublicScriptList(String lang, EsbGetScriptListV3Req request) { + public EsbResp> getPublicScriptListUsingPost(EsbGetScriptListV3Req request) { request.setAppId(JobManageConstants.PUBLIC_APP_ID); - return esbScriptV3Resource.getScriptList(lang, request); + return esbScriptV3Resource.getScriptListUsingPost(request); } @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_get_public_script_version_list"}) - public EsbResp> getPublicScriptVersionList( - String lang, + public EsbResp> getPublicScriptVersionListUsingPost( EsbGetScriptVersionListV3Req request ) { request.setAppId(JobManageConstants.PUBLIC_APP_ID); - return esbScriptV3Resource.getScriptVersionList(lang, request); + return esbScriptV3Resource.getScriptVersionListUsingPost(request); } @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_get_public_script_version_detail"}) - public EsbResp getPublicScriptVersionDetail(String lang, - EsbGetScriptVersionDetailV3Req request) { + public EsbResp getPublicScriptVersionDetailUsingPost(EsbGetScriptVersionDetailV3Req request) { request.setAppId(JobManageConstants.PUBLIC_APP_ID); - return esbScriptV3Resource.getScriptVersionDetail(lang, request); + return esbScriptV3Resource.getScriptVersionDetailUsingPost(request); } } diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbScriptResourceV3Impl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbScriptResourceV3Impl.java index b4b264c93c..b19c6b9df9 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbScriptResourceV3Impl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbScriptResourceV3Impl.java @@ -51,7 +51,11 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.RestController; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; @RestController @@ -69,9 +73,64 @@ public EsbScriptResourceV3Impl(ScriptService scriptService, MessageI18nService i } + @Override + public EsbResp> getScriptList(String username, + String appCode, + Long appId, + String name, + Integer scriptLanguage, + Integer start, + Integer length) { + EsbGetScriptListV3Req request = new EsbGetScriptListV3Req(); + request.setUserName(username); + request.setAppCode(appCode); + request.setAppId(appId); + request.setName(name); + request.setScriptLanguage(scriptLanguage); + request.setStart(start); + request.setLength(length); + return getScriptListUsingPost(request); + } + + @Override + public EsbResp> getScriptVersionList(String username, + String appCode, + Long appId, + String scriptId, + boolean returnScriptContent, + Integer start, + Integer length) { + EsbGetScriptVersionListV3Req request = new EsbGetScriptVersionListV3Req(); + request.setUserName(username); + request.setAppCode(appCode); + request.setAppId(appId); + request.setScriptId(scriptId); + request.setReturnScriptContent(returnScriptContent); + request.setStart(start); + request.setLength(length); + return getScriptVersionListUsingPost(request); + } + + @Override + public EsbResp getScriptVersionDetail(String username, + String appCode, + Long appId, + Long scriptVersionId, + String scriptId, + String version) { + EsbGetScriptVersionDetailV3Req request = new EsbGetScriptVersionDetailV3Req(); + request.setUserName(username); + request.setAppCode(appCode); + request.setAppId(appId); + request.setId(scriptVersionId); + request.setScriptId(scriptId); + request.setVersion(version); + return getScriptVersionDetailUsingPost(request); + } + @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_get_script_list"}) - public EsbResp> getScriptList(String lang, EsbGetScriptListV3Req request) { + public EsbResp> getScriptListUsingPost(EsbGetScriptListV3Req request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get script list, request is illegal!"); @@ -267,8 +326,7 @@ private ValidateResult checkRequest(EsbGetScriptVersionListV3Req request) { @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_get_script_version_list"}) - public EsbResp> getScriptVersionList( - String lang, + public EsbResp> getScriptVersionListUsingPost( EsbGetScriptVersionListV3Req request ) { ValidateResult checkResult = checkRequest(request); @@ -346,8 +404,7 @@ private ValidateResult checkRequest(EsbGetScriptVersionDetailV3Req request) { @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_get_script_version_detail"}) - public EsbResp getScriptVersionDetail(String lang, - EsbGetScriptVersionDetailV3Req request) { + public EsbResp getScriptVersionDetailUsingPost(EsbGetScriptVersionDetailV3Req request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get scriptVersion list, request is illegal!"); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbTemplateV3ResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbTemplateV3ResourceImpl.java index 4178379c80..02abb88980 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbTemplateV3ResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/esb/impl/v3/EsbTemplateV3ResourceImpl.java @@ -63,10 +63,38 @@ public EsbTemplateV3ResourceImpl(TaskTemplateService taskTemplateService, Messag this.authService = authService; } + @Override + public EsbResp> getTemplateList(String username, + String appCode, + Long appId, + String creator, + String name, + Long createTimeStart, + Long createTimeEnd, + String lastModifyUser, + Long lastModifyTimeStart, + Long lastModifyTimeEnd, + Integer start, + Integer length) { + EsbGetTemplateListV3Request request = new EsbGetTemplateListV3Request(); + request.setUserName(username); + request.setAppCode(appCode); + request.setAppId(appId); + request.setCreator(creator); + request.setName(name); + request.setCreateTimeStart(createTimeStart); + request.setLastModifyUser(lastModifyUser); + request.setCreateTimeEnd(createTimeEnd); + request.setLastModifyTimeEnd(lastModifyTimeEnd); + request.setLastModifyTimeStart(lastModifyTimeStart); + request.setStart(start); + request.setLength(length); + return getTemplateListUsingPost(request); + } + @Override @EsbApiTimed(value = "esb.api", extraTags = {"api_name", "v3_get_job_template_list"}) - public EsbResp> getTemplateList(String lang, - EsbGetTemplateListV3Request request) { + public EsbResp> getTemplateListUsingPost(EsbGetTemplateListV3Request request) { ValidateResult checkResult = checkRequest(request); if (!checkResult.isPass()) { log.warn("Get template list, request is illegal!");