Browse Source

Merge remote-tracking branch 'remotes/upstream/branch-1.0.2' into branch-1.0.2

pull/2/head
ligang 6 years ago
parent
commit
c86153d78e
  1. 2
      escheduler-api/src/main/java/cn/escheduler/api/controller/AccessTokenController.java
  2. 2
      escheduler-api/src/main/java/cn/escheduler/api/controller/AlertGroupController.java
  3. 2
      escheduler-api/src/main/java/cn/escheduler/api/controller/DataSourceController.java
  4. 2
      escheduler-api/src/main/java/cn/escheduler/api/controller/ProcessDefinitionController.java
  5. 2
      escheduler-api/src/main/java/cn/escheduler/api/controller/ProcessInstanceController.java
  6. 2
      escheduler-api/src/main/java/cn/escheduler/api/controller/ProjectController.java
  7. 2
      escheduler-api/src/main/java/cn/escheduler/api/controller/QueueController.java
  8. 2
      escheduler-api/src/main/java/cn/escheduler/api/controller/ResourcesController.java
  9. 2
      escheduler-api/src/main/java/cn/escheduler/api/controller/SchedulerController.java
  10. 2
      escheduler-api/src/main/java/cn/escheduler/api/controller/TaskInstanceController.java
  11. 3
      escheduler-api/src/main/java/cn/escheduler/api/controller/TenantController.java
  12. 2
      escheduler-api/src/main/java/cn/escheduler/api/controller/UsersController.java
  13. 2
      escheduler-api/src/main/java/cn/escheduler/api/controller/WorkerGroupController.java
  14. 1
      escheduler-api/src/main/java/cn/escheduler/api/enums/Status.java
  15. 11
      escheduler-api/src/main/java/cn/escheduler/api/service/ProjectService.java
  16. 14
      escheduler-common/src/main/java/cn/escheduler/common/utils/ParameterUtils.java
  17. 3
      escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ProjectMapperProvider.java
  18. 8
      escheduler-dao/src/main/java/cn/escheduler/dao/mapper/UserMapperProvider.java

2
escheduler-api/src/main/java/cn/escheduler/api/controller/AccessTokenController.java

@ -22,6 +22,7 @@ import cn.escheduler.api.service.AccessTokenService;
import cn.escheduler.api.service.UsersService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.common.utils.ParameterUtils;
import cn.escheduler.dao.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -113,6 +114,7 @@ public class AccessTokenController extends BaseController{
if(result.get(Constants.STATUS) != Status.SUCCESS){
return returnDataListPaging(result);
}
searchVal = ParameterUtils.handleEscapes(searchVal);
result = accessTokenService.queryAccessTokenList(loginUser, searchVal, pageNo, pageSize);
return returnDataListPaging(result);
}catch (Exception e){

2
escheduler-api/src/main/java/cn/escheduler/api/controller/AlertGroupController.java

@ -20,6 +20,7 @@ import cn.escheduler.api.service.AlertGroupService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.common.enums.AlertType;
import cn.escheduler.common.utils.ParameterUtils;
import cn.escheduler.dao.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -109,6 +110,7 @@ public class AlertGroupController extends BaseController{
return returnDataListPaging(result);
}
searchVal = ParameterUtils.handleEscapes(searchVal);
result = alertGroupService.listPaging(loginUser, searchVal, pageNo, pageSize);
return returnDataListPaging(result);
}catch (Exception e){

2
escheduler-api/src/main/java/cn/escheduler/api/controller/DataSourceController.java

@ -21,6 +21,7 @@ import cn.escheduler.api.service.DataSourceService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.common.enums.DbType;
import cn.escheduler.common.utils.ParameterUtils;
import cn.escheduler.dao.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -182,6 +183,7 @@ public class DataSourceController extends BaseController {
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return returnDataListPaging(result);
}
searchVal = ParameterUtils.handleEscapes(searchVal);
result = dataSourceService.queryDataSourceListPaging(loginUser, searchVal, pageNo, pageSize);
return returnDataListPaging(result);
} catch (Exception e) {

2
escheduler-api/src/main/java/cn/escheduler/api/controller/ProcessDefinitionController.java

@ -20,6 +20,7 @@ import cn.escheduler.api.enums.Status;
import cn.escheduler.api.service.ProcessDefinitionService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.common.utils.ParameterUtils;
import cn.escheduler.dao.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -235,6 +236,7 @@ public class ProcessDefinitionController extends BaseController{
if(result.get(Constants.STATUS) != Status.SUCCESS){
return returnDataListPaging(result);
}
searchVal = ParameterUtils.handleEscapes(searchVal);
result = processDefinitionService.queryProcessDefinitionListPaging(loginUser, projectName, searchVal, pageNo, pageSize, userId);
return returnDataListPaging(result);
}catch (Exception e){

2
escheduler-api/src/main/java/cn/escheduler/api/controller/ProcessInstanceController.java

@ -22,6 +22,7 @@ import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.common.enums.ExecutionStatus;
import cn.escheduler.common.enums.Flag;
import cn.escheduler.common.utils.ParameterUtils;
import cn.escheduler.dao.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -72,6 +73,7 @@ public class ProcessInstanceController extends BaseController{
"search value:{},state type:{},host:{},start time:{}, end time:{},page number:{}, page size:{}",
loginUser.getUserName(), projectName, processDefinitionId, searchVal, stateType,host,
startTime, endTime, pageNo, pageSize);
searchVal = ParameterUtils.handleEscapes(searchVal);
Map<String, Object> result = processInstanceService.queryProcessInstanceList(
loginUser, projectName, processDefinitionId, startTime, endTime, searchVal, stateType, host, pageNo, pageSize);
return returnDataListPaging(result);

2
escheduler-api/src/main/java/cn/escheduler/api/controller/ProjectController.java

@ -21,6 +21,7 @@ import cn.escheduler.api.enums.Status;
import cn.escheduler.api.service.ProjectService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.common.utils.ParameterUtils;
import cn.escheduler.dao.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -134,6 +135,7 @@ public class ProjectController extends BaseController {
try {
logger.info("login user {}, query project list paging", loginUser.getUserName());
searchVal = ParameterUtils.handleEscapes(searchVal);
Map<String, Object> result = projectService.queryProjectListPaging(loginUser, pageSize, pageNo, searchVal);
return returnDataListPaging(result);
} catch (Exception e) {

2
escheduler-api/src/main/java/cn/escheduler/api/controller/QueueController.java

@ -21,6 +21,7 @@ import cn.escheduler.api.enums.Status;
import cn.escheduler.api.service.QueueService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.common.utils.ParameterUtils;
import cn.escheduler.dao.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -82,6 +83,7 @@ public class QueueController extends BaseController{
return returnDataListPaging(result);
}
searchVal = ParameterUtils.handleEscapes(searchVal);
result = queueService.queryList(loginUser,searchVal,pageNo,pageSize);
return returnDataListPaging(result);
}catch (Exception e){

2
escheduler-api/src/main/java/cn/escheduler/api/controller/ResourcesController.java

@ -23,6 +23,7 @@ import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.common.enums.ResourceType;
import cn.escheduler.common.enums.UdfType;
import cn.escheduler.common.utils.ParameterUtils;
import cn.escheduler.dao.model.User;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
@ -146,6 +147,7 @@ public class ResourcesController extends BaseController{
return returnDataListPaging(result);
}
searchVal = ParameterUtils.handleEscapes(searchVal);
result = resourceService.queryResourceListPaging(loginUser,type,searchVal,pageNo, pageSize);
return returnDataListPaging(result);
}catch (Exception e){

2
escheduler-api/src/main/java/cn/escheduler/api/controller/SchedulerController.java

@ -24,6 +24,7 @@ import cn.escheduler.common.enums.FailureStrategy;
import cn.escheduler.common.enums.Priority;
import cn.escheduler.common.enums.ReleaseState;
import cn.escheduler.common.enums.WarningType;
import cn.escheduler.common.utils.ParameterUtils;
import cn.escheduler.dao.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -201,6 +202,7 @@ public class SchedulerController extends BaseController{
logger.info("login user {}, query schedule, project name: {}, process definition id: {}",
loginUser.getUserName(), projectName, processDefinitionId);
try {
searchVal = ParameterUtils.handleEscapes(searchVal);
Map<String, Object> result = schedulerService.querySchedule(loginUser, projectName, processDefinitionId, searchVal, pageNo, pageSize);
return returnDataListPaging(result);
}catch (Exception e){

2
escheduler-api/src/main/java/cn/escheduler/api/controller/TaskInstanceController.java

@ -21,6 +21,7 @@ import cn.escheduler.api.service.TaskInstanceService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.common.enums.ExecutionStatus;
import cn.escheduler.common.utils.ParameterUtils;
import cn.escheduler.dao.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -68,6 +69,7 @@ public class TaskInstanceController extends BaseController{
try{
logger.info("query task instance list, project name:{},process instance:{}, search value:{},task name:{}, state type:{}, host:{}, start:{}, end:{}",
projectName, processInstanceId, searchVal, taskName, stateType, host, startTime, endTime);
searchVal = ParameterUtils.handleEscapes(searchVal);
Map<String, Object> result = taskInstanceService.queryTaskListPaging(
loginUser, projectName, processInstanceId, taskName, startTime, endTime, searchVal, stateType, host, pageNo, pageSize);
return returnDataListPaging(result);

3
escheduler-api/src/main/java/cn/escheduler/api/controller/TenantController.java

@ -21,7 +21,9 @@ import cn.escheduler.api.enums.Status;
import cn.escheduler.api.service.TenantService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.common.utils.ParameterUtils;
import cn.escheduler.dao.model.User;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -98,6 +100,7 @@ public class TenantController extends BaseController{
if(result.get(Constants.STATUS) != Status.SUCCESS){
return returnDataListPaging(result);
}
searchVal = ParameterUtils.handleEscapes(searchVal);
result = tenantService.queryTenantList(loginUser, searchVal, pageNo, pageSize);
return returnDataListPaging(result);
}catch (Exception e){

2
escheduler-api/src/main/java/cn/escheduler/api/controller/UsersController.java

@ -21,6 +21,7 @@ import cn.escheduler.api.enums.Status;
import cn.escheduler.api.service.UsersService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.common.utils.ParameterUtils;
import cn.escheduler.dao.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -101,6 +102,7 @@ public class UsersController extends BaseController{
if(result.get(Constants.STATUS) != Status.SUCCESS){
return returnDataListPaging(result);
}
searchVal = ParameterUtils.handleEscapes(searchVal);
result = usersService.queryUserList(loginUser, searchVal, pageNo, pageSize);
return returnDataListPaging(result);
}catch (Exception e){

2
escheduler-api/src/main/java/cn/escheduler/api/controller/WorkerGroupController.java

@ -21,6 +21,7 @@ import cn.escheduler.api.enums.Status;
import cn.escheduler.api.service.WorkerGroupService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.common.utils.ParameterUtils;
import cn.escheduler.dao.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -90,6 +91,7 @@ public class WorkerGroupController extends BaseController{
loginUser.getUserName() , pageNo, pageSize, searchVal);
try {
searchVal = ParameterUtils.handleEscapes(searchVal);
Map<String, Object> result = workerGroupService.queryAllGroupPaging(pageNo, pageSize, searchVal);
return returnDataListPaging(result);
}catch (Exception e){

1
escheduler-api/src/main/java/cn/escheduler/api/enums/Status.java

@ -159,6 +159,7 @@ public enum Status {
NAME_NULL(10134,"name must be not null"),
NAME_EXIST(10135, "name {0} already exists"),
SAVE_ERROR(10136, "save error"),
DELETE_PROJECT_ERROR_DEFINES_NOT_NULL(10137, "please delete the process definitions in project first!"),

11
escheduler-api/src/main/java/cn/escheduler/api/service/ProjectService.java

@ -20,9 +20,11 @@ import cn.escheduler.api.enums.Status;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.PageInfo;
import cn.escheduler.common.enums.UserType;
import cn.escheduler.dao.mapper.ProcessDefinitionMapper;
import cn.escheduler.dao.mapper.ProjectMapper;
import cn.escheduler.dao.mapper.ProjectUserMapper;
import cn.escheduler.dao.mapper.UserMapper;
import cn.escheduler.dao.model.ProcessDefinition;
import cn.escheduler.dao.model.Project;
import cn.escheduler.dao.model.ProjectUser;
import cn.escheduler.dao.model.User;
@ -55,6 +57,9 @@ public class ProjectService extends BaseService{
@Autowired
private ProjectUserMapper projectUserMapper;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
/**
* create project
*
@ -199,6 +204,12 @@ public class ProjectService extends BaseService{
if (checkResult != null) {
return checkResult;
}
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryAllDefinitionList(projectId);
if(processDefinitionList.size() > 0){
putMsg(result, Status.DELETE_PROJECT_ERROR_DEFINES_NOT_NULL);
return result;
}
int delete = projectMapper.delete(projectId);
if (delete > 0) {

14
escheduler-common/src/main/java/cn/escheduler/common/utils/ParameterUtils.java

@ -159,4 +159,18 @@ public class ParameterUtils {
}
return null;
}
/**
* handle escapes
* @param inputString
* @return
*/
public static String handleEscapes(String inputString){
if(StringUtils.isNotEmpty(inputString)){
return inputString.replace("%", "////%");
}
return inputString;
}
}

3
escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ProjectMapperProvider.java

@ -55,8 +55,7 @@ public class ProjectMapperProvider {
public String delete(Map<String, Object> parameter) {
return new SQL() {
{
UPDATE(TABLE_NAME);
SET("flag=0");
DELETE_FROM(TABLE_NAME);
WHERE("`id`=#{projectId}");
}
}.toString();

8
escheduler-dao/src/main/java/cn/escheduler/dao/mapper/UserMapperProvider.java

@ -204,13 +204,17 @@ public class UserMapperProvider {
return new SQL() {
{
SELECT("u.*,t.tenant_name as tenantName,q.queue_name as queueName");
FROM(TABLE_NAME +" u,t_escheduler_tenant t,t_escheduler_queue q");
WHERE("u.user_type = 1 AND u.tenant_id = t.id and t.queue_id = q.id");
FROM(TABLE_NAME + " u ");
LEFT_OUTER_JOIN("t_escheduler_tenant t on u.tenant_id = t.id");
LEFT_OUTER_JOIN("t_escheduler_queue q on t.queue_id = q.id");
WHERE("u.user_type = 1");
Object searchVal = parameter.get("searchVal");
if(searchVal != null && StringUtils.isNotEmpty(searchVal.toString())){
WHERE( " u.user_name like concat('%', #{searchVal}, '%') ");
}
ORDER_BY(" u.update_time desc limit #{offset},#{pageSize} ");
}
}.toString();

Loading…
Cancel
Save