提交 06acbe5f 编写于 作者: L lidongdai

1.0.2文档发布

上级 5a8c8ef9
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>cn.analysys</groupId> <groupId>cn.analysys</groupId>
...@@ -10,13 +11,10 @@ ...@@ -10,13 +11,10 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>cn.analysys</groupId> <groupId>cn.analysys</groupId>
<artifactId>escheduler-dao</artifactId> <artifactId>escheduler-server</artifactId>
</dependency>
<dependency>
<groupId>cn.analysys</groupId>
<artifactId>escheduler-common</artifactId>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
...@@ -37,6 +35,33 @@ ...@@ -37,6 +35,33 @@
</exclusions> </exclusions>
</dependency> </dependency>
<!--<dependency>-->
<!--<groupId>cn.analysys</groupId>-->
<!--<artifactId>escheduler-dao</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>cn.analysys</groupId>-->
<!--<artifactId>escheduler-common</artifactId>-->
<!--<exclusions>-->
<!--<exclusion>-->
<!--<groupId>io.netty</groupId>-->
<!--<artifactId>netty</artifactId>-->
<!--</exclusion>-->
<!--<exclusion>-->
<!--<groupId>io.netty</groupId>-->
<!--<artifactId>netty-all</artifactId>-->
<!--</exclusion>-->
<!--<exclusion>-->
<!--<groupId>com.google</groupId>-->
<!--<artifactId>netty</artifactId>-->
<!--</exclusion>-->
<!--<exclusion>-->
<!--<artifactId>leveldbjni-all</artifactId>-->
<!--<groupId>org.fusesource.leveldbjni</groupId>-->
<!--</exclusion>-->
<!--</exclusions>-->
<!--</dependency>-->
<!--springboot--> <!--springboot-->
<dependency> <dependency>
...@@ -142,6 +167,17 @@ ...@@ -142,6 +167,17 @@
<artifactId>quartz-jobs</artifactId> <artifactId>quartz-jobs</artifactId>
</dependency> </dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version>
</dependency>
<dependency> <dependency>
<groupId>cn.analysys</groupId> <groupId>cn.analysys</groupId>
<artifactId>escheduler-rpc</artifactId> <artifactId>escheduler-rpc</artifactId>
...@@ -187,4 +223,4 @@ ...@@ -187,4 +223,4 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>
\ No newline at end of file
...@@ -20,6 +20,7 @@ import org.springframework.boot.SpringApplication; ...@@ -20,6 +20,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication @SpringBootApplication
@ServletComponentScan @ServletComponentScan
......
...@@ -33,8 +33,16 @@ public class AppConfiguration implements WebMvcConfigurer { ...@@ -33,8 +33,16 @@ public class AppConfiguration implements WebMvcConfigurer {
@Override @Override
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(loginInterceptor()).addPathPatterns(LOGIN_INTERCEPTOR_PATH_PATTERN).excludePathPatterns(LOGIN_PATH_PATTERN); registry.addInterceptor(loginInterceptor()).addPathPatterns(LOGIN_INTERCEPTOR_PATH_PATTERN).excludePathPatterns(LOGIN_PATH_PATTERN,"/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html");
} }
//
// @Override
// public void addResourceHandlers(ResourceHandlerRegistry registry) {
// registry.addResourceHandler("swagger-ui.html")
// .addResourceLocations("classpath:/META-INF/resources/");
// registry.addResourceHandler("/webjars/**")
// .addResourceLocations("classpath:/META-INF/resources/webjars/");
// }
@Bean @Bean
public LoginHandlerInterceptor loginInterceptor() { public LoginHandlerInterceptor loginInterceptor() {
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.escheduler.api.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
*
* swager2 config class <br/>
*
*/
@Configuration
@EnableSwagger2
public class Swagger2 implements WebMvcConfigurer {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
.apis(RequestHandlerSelectors.basePackage("cn.escheduler.api.controller")).paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("api docs").description("easy scheduler api docs")
.termsOfServiceUrl("https://www.analysys.com").version("1.0.0").build();
}
}
...@@ -23,6 +23,9 @@ import cn.escheduler.api.service.UsersService; ...@@ -23,6 +23,9 @@ import cn.escheduler.api.service.UsersService;
import cn.escheduler.api.utils.Constants; import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result; import cn.escheduler.api.utils.Result;
import cn.escheduler.dao.model.User; import cn.escheduler.dao.model.User;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -60,6 +63,11 @@ public class LoginController extends BaseController { ...@@ -60,6 +63,11 @@ public class LoginController extends BaseController {
* @param response * @param response
* @return * @return
*/ */
@ApiOperation(value="更新用户详细信息", notes="根据url的id来指定更新对象,并根据传过来的user信息来更新用户详细信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "userName", value = "用户名", required = true, dataType = "String"),
@ApiImplicitParam(name = "userPassword", value = "密码", required = true, dataType = "String")
})
@RequestMapping(value = "/login") @RequestMapping(value = "/login")
public Result login(@RequestParam(value = "userName") String userName, public Result login(@RequestParam(value = "userName") String userName,
@RequestParam(value = "userPassword") String userPassword, @RequestParam(value = "userPassword") String userPassword,
......
...@@ -19,8 +19,8 @@ package cn.escheduler.api.service; ...@@ -19,8 +19,8 @@ package cn.escheduler.api.service;
import cn.escheduler.api.dto.ScheduleParam; import cn.escheduler.api.dto.ScheduleParam;
import cn.escheduler.api.enums.Status; import cn.escheduler.api.enums.Status;
import cn.escheduler.api.quartz.ProcessScheduleJob; import cn.escheduler.server.quartz.ProcessScheduleJob;
import cn.escheduler.api.quartz.QuartzExecutors; import cn.escheduler.server.quartz.QuartzExecutors;
import cn.escheduler.api.utils.Constants; import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.PageInfo; import cn.escheduler.api.utils.PageInfo;
import cn.escheduler.common.enums.FailureStrategy; import cn.escheduler.common.enums.FailureStrategy;
......
...@@ -54,7 +54,7 @@ public interface ITaskQueue { ...@@ -54,7 +54,7 @@ public interface ITaskQueue {
* an element pops out of the queue * an element pops out of the queue
* *
* @param key queue name * @param key queue name
* @param remove where remove the element * @param remove whether remove the element
* @return * @return
*/ */
String poll(String key, boolean remove); String poll(String key, boolean remove);
......
...@@ -220,7 +220,7 @@ public class ProcessInstanceMapperProvider { ...@@ -220,7 +220,7 @@ public class ProcessInstanceMapperProvider {
public String queryDetailById(Map<String, Object> parameter) { public String queryDetailById(Map<String, Object> parameter) {
return new SQL() { return new SQL() {
{ {
SELECT("inst.*,q.queue_name as queue,t.tenant_code as tenantCode,UNIX_TIMESTAMP(inst.end_time)-UNIX_TIMESTAMP(inst.start_time) as duration"); SELECT("inst.*,q.queue_name as queue,t.tenant_code,UNIX_TIMESTAMP(inst.end_time)-UNIX_TIMESTAMP(inst.start_time) as duration");
FROM(TABLE_NAME + " inst, t_escheduler_user u,t_escheduler_tenant t,t_escheduler_queue q"); FROM(TABLE_NAME + " inst, t_escheduler_user u,t_escheduler_tenant t,t_escheduler_queue q");
......
...@@ -208,7 +208,7 @@ public class UserMapperProvider { ...@@ -208,7 +208,7 @@ public class UserMapperProvider {
public String queryDetailsById(Map<String, Object> parameter) { public String queryDetailsById(Map<String, Object> parameter) {
return new SQL() { return new SQL() {
{ {
SELECT("u.*,q.queue_name as queueName,t.tenant_name as tenantName"); SELECT("u.*,q.queue_name,t.tenant_name");
FROM(TABLE_NAME + " u,t_escheduler_tenant t,t_escheduler_queue q"); FROM(TABLE_NAME + " u,t_escheduler_tenant t,t_escheduler_queue q");
......
...@@ -72,4 +72,10 @@ public class UserMapperTest { ...@@ -72,4 +72,10 @@ public class UserMapperTest {
Assert.assertEquals(user.getUserName(), "qiaozhanwei"); Assert.assertEquals(user.getUserName(), "qiaozhanwei");
} }
@Test
public void test(){
User user = userMapper.queryDetailsById(19);
System.out.println(user);
}
} }
...@@ -46,10 +46,7 @@ ...@@ -46,10 +46,7 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>cn.analysys</groupId>
<artifactId>escheduler-api</artifactId>
</dependency>
<dependency> <dependency>
<groupId>cn.analysys</groupId> <groupId>cn.analysys</groupId>
<artifactId>escheduler-rpc</artifactId> <artifactId>escheduler-rpc</artifactId>
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
*/ */
package cn.escheduler.server.master; package cn.escheduler.server.master;
import cn.escheduler.api.quartz.ProcessScheduleJob; import cn.escheduler.server.quartz.ProcessScheduleJob;
import cn.escheduler.api.quartz.QuartzExecutors; import cn.escheduler.server.quartz.QuartzExecutors;
import cn.escheduler.common.Constants; import cn.escheduler.common.Constants;
import cn.escheduler.common.IStoppable; import cn.escheduler.common.IStoppable;
import cn.escheduler.common.thread.Stopper; import cn.escheduler.common.thread.Stopper;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package cn.escheduler.api.quartz; package cn.escheduler.server.quartz;
import cn.escheduler.common.Constants; import cn.escheduler.common.Constants;
...@@ -31,8 +31,8 @@ import org.springframework.util.Assert; ...@@ -31,8 +31,8 @@ import org.springframework.util.Assert;
import java.util.Date; import java.util.Date;
import static cn.escheduler.api.quartz.QuartzExecutors.buildJobGroupName; import static cn.escheduler.server.quartz.QuartzExecutors.buildJobGroupName;
import static cn.escheduler.api.quartz.QuartzExecutors.buildJobName; import static cn.escheduler.server.quartz.QuartzExecutors.buildJobName;
/** /**
* process schedule job * process schedule job
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package cn.escheduler.api.quartz; package cn.escheduler.server.quartz;
import cn.escheduler.common.Constants; import cn.escheduler.common.Constants;
import cn.escheduler.common.utils.JSONUtils; import cn.escheduler.common.utils.JSONUtils;
......
...@@ -134,7 +134,7 @@ public class FetchTaskThread implements Runnable{ ...@@ -134,7 +134,7 @@ public class FetchTaskThread implements Runnable{
public void run() { public void run() {
while (Stopper.isRunning()){ while (Stopper.isRunning()){
long start = System.currentTimeMillis();
InterProcessMutex mutex = null; InterProcessMutex mutex = null;
try { try {
if(OSUtils.checkResource(this.conf, false)) { if(OSUtils.checkResource(this.conf, false)) {
...@@ -221,7 +221,10 @@ public class FetchTaskThread implements Runnable{ ...@@ -221,7 +221,10 @@ public class FetchTaskThread implements Runnable{
logger.info("task : {} ready to submit to task scheduler thread",taskId); logger.info("task : {} ready to submit to task scheduler thread",taskId);
// submit task // submit task
workerExecService.submit(new TaskScheduleThread(taskInstance, processDao)); workerExecService.submit(new TaskScheduleThread(taskInstance, processDao));
logger.info("{} 耗时: {} ms",taskQueueStr,System.currentTimeMillis() - start );
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册