ligang
6 years ago
82 changed files with 2614 additions and 790 deletions
@ -0,0 +1,169 @@
|
||||
/* |
||||
* 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.controller; |
||||
|
||||
|
||||
import cn.escheduler.api.enums.Status; |
||||
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.dao.model.User; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.http.HttpStatus; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.Map; |
||||
|
||||
import static cn.escheduler.api.enums.Status.*; |
||||
|
||||
|
||||
/** |
||||
* user controller |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/access-token") |
||||
public class AccessTokenController extends BaseController{ |
||||
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AccessTokenController.class); |
||||
|
||||
|
||||
@Autowired |
||||
private AccessTokenService accessTokenService; |
||||
|
||||
/** |
||||
* create token |
||||
* @param loginUser |
||||
* @return |
||||
*/ |
||||
@PostMapping(value = "/create") |
||||
@ResponseStatus(HttpStatus.CREATED) |
||||
public Result createToken(@RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
||||
@RequestParam(value = "userId") int userId, |
||||
@RequestParam(value = "expireTime") String expireTime, |
||||
@RequestParam(value = "token") String token){ |
||||
logger.info("login user {}, create token , userId : {} , token expire time : {} , token : {}", loginUser.getUserName(), |
||||
userId,expireTime,token); |
||||
|
||||
try { |
||||
Map<String, Object> result = accessTokenService.createToken(userId, expireTime, token); |
||||
return returnDataList(result); |
||||
}catch (Exception e){ |
||||
logger.error(CREATE_ACCESS_TOKEN_ERROR.getMsg(),e); |
||||
return error(CREATE_ACCESS_TOKEN_ERROR.getCode(), CREATE_ACCESS_TOKEN_ERROR.getMsg()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* create token |
||||
* @param loginUser |
||||
* @return |
||||
*/ |
||||
@PostMapping(value = "/generate") |
||||
@ResponseStatus(HttpStatus.CREATED) |
||||
public Result generateToken(@RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
||||
@RequestParam(value = "userId") int userId, |
||||
@RequestParam(value = "expireTime") String expireTime){ |
||||
logger.info("login user {}, generate token , userId : {} , token expire time : {}",loginUser,userId,expireTime); |
||||
try { |
||||
Map<String, Object> result = accessTokenService.generateToken(userId, expireTime); |
||||
return returnDataList(result); |
||||
}catch (Exception e){ |
||||
logger.error(GENERATE_TOKEN_ERROR.getMsg(),e); |
||||
return error(GENERATE_TOKEN_ERROR.getCode(), GENERATE_TOKEN_ERROR.getMsg()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* query access token list paging |
||||
* |
||||
* @param loginUser |
||||
* @param pageNo |
||||
* @param searchVal |
||||
* @param pageSize |
||||
* @return |
||||
*/ |
||||
@GetMapping(value="/list-paging") |
||||
@ResponseStatus(HttpStatus.OK) |
||||
public Result queryAccessTokenList(@RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
||||
@RequestParam("pageNo") Integer pageNo, |
||||
@RequestParam(value = "searchVal", required = false) String searchVal, |
||||
@RequestParam("pageSize") Integer pageSize){ |
||||
logger.info("login user {}, list access token paging, pageNo: {}, searchVal: {}, pageSize: {}", |
||||
loginUser.getUserName(),pageNo,searchVal,pageSize); |
||||
try{ |
||||
Map<String, Object> result = checkPageParams(pageNo, pageSize); |
||||
if(result.get(Constants.STATUS) != Status.SUCCESS){ |
||||
return returnDataListPaging(result); |
||||
} |
||||
result = accessTokenService.queryAccessTokenList(loginUser, searchVal, pageNo, pageSize); |
||||
return returnDataListPaging(result); |
||||
}catch (Exception e){ |
||||
logger.error(QUERY_ACCESSTOKEN_LIST_PAGING_ERROR.getMsg(),e); |
||||
return error(QUERY_ACCESSTOKEN_LIST_PAGING_ERROR.getCode(),QUERY_ACCESSTOKEN_LIST_PAGING_ERROR.getMsg()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* delete access token by id |
||||
* @param loginUser |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
@PostMapping(value = "/delete") |
||||
@ResponseStatus(HttpStatus.OK) |
||||
public Result delAccessTokenById(@RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
||||
@RequestParam(value = "id") int id) { |
||||
logger.info("login user {}, delete access token, id: {},", loginUser.getUserName(), id); |
||||
try { |
||||
Map<String, Object> result = accessTokenService.delAccessTokenById(loginUser, id); |
||||
return returnDataList(result); |
||||
}catch (Exception e){ |
||||
logger.error(DELETE_USER_BY_ID_ERROR.getMsg(),e); |
||||
return error(Status.DELETE_USER_BY_ID_ERROR.getCode(), Status.DELETE_USER_BY_ID_ERROR.getMsg()); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* update token |
||||
* @param loginUser |
||||
* @return |
||||
*/ |
||||
@PostMapping(value = "/update") |
||||
@ResponseStatus(HttpStatus.CREATED) |
||||
public Result updateToken(@RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
||||
@RequestParam(value = "id") int id, |
||||
@RequestParam(value = "userId") int userId, |
||||
@RequestParam(value = "expireTime") String expireTime, |
||||
@RequestParam(value = "token") String token){ |
||||
logger.info("login user {}, update token , userId : {} , token expire time : {} , token : {}", loginUser.getUserName(), |
||||
userId,expireTime,token); |
||||
|
||||
try { |
||||
Map<String, Object> result = accessTokenService.updateToken(id,userId, expireTime, token); |
||||
return returnDataList(result); |
||||
}catch (Exception e){ |
||||
logger.error(CREATE_ACCESS_TOKEN_ERROR.getMsg(),e); |
||||
return error(CREATE_ACCESS_TOKEN_ERROR.getCode(), CREATE_ACCESS_TOKEN_ERROR.getMsg()); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,184 @@
|
||||
/* |
||||
* 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.service; |
||||
|
||||
import cn.escheduler.api.enums.Status; |
||||
import cn.escheduler.api.utils.CheckUtils; |
||||
import cn.escheduler.api.utils.Constants; |
||||
import cn.escheduler.api.utils.PageInfo; |
||||
import cn.escheduler.api.utils.Result; |
||||
import cn.escheduler.common.enums.UserType; |
||||
import cn.escheduler.common.utils.*; |
||||
import cn.escheduler.dao.mapper.*; |
||||
import cn.escheduler.dao.model.*; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.*; |
||||
|
||||
/** |
||||
* user service |
||||
*/ |
||||
@Service |
||||
public class AccessTokenService extends BaseService { |
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AccessTokenService.class); |
||||
|
||||
@Autowired |
||||
private AccessTokenMapper accessTokenMapper; |
||||
|
||||
|
||||
/** |
||||
* query access token list |
||||
* |
||||
* @param loginUser |
||||
* @param searchVal |
||||
* @param pageNo |
||||
* @param pageSize |
||||
* @return |
||||
*/ |
||||
public Map<String, Object> queryAccessTokenList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) { |
||||
Map<String, Object> result = new HashMap<>(5); |
||||
|
||||
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM, Constants.STATUS)) { |
||||
return result; |
||||
} |
||||
|
||||
Integer count = accessTokenMapper.countAccessTokenPaging(searchVal); |
||||
|
||||
PageInfo<AccessToken> pageInfo = new PageInfo<>(pageNo, pageSize); |
||||
|
||||
List<AccessToken> accessTokenList = accessTokenMapper.queryAccessTokenPaging(searchVal, pageInfo.getStart(), pageSize); |
||||
|
||||
pageInfo.setTotalCount(count); |
||||
pageInfo.setLists(accessTokenList); |
||||
result.put(Constants.DATA_LIST, pageInfo); |
||||
putMsg(result, Status.SUCCESS); |
||||
|
||||
return result; |
||||
} |
||||
|
||||
/** |
||||
* check |
||||
* |
||||
* @param result |
||||
* @param bool |
||||
* @param userNoOperationPerm |
||||
* @param status |
||||
* @return |
||||
*/ |
||||
private boolean check(Map<String, Object> result, boolean bool, Status userNoOperationPerm, String status) { |
||||
//only admin can operate
|
||||
if (bool) { |
||||
result.put(Constants.STATUS, userNoOperationPerm); |
||||
result.put(status, userNoOperationPerm.getMsg()); |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* create token |
||||
* |
||||
* @param userId |
||||
* @param expireTime |
||||
* @param token |
||||
* @return |
||||
*/ |
||||
public Map<String, Object> createToken(int userId, String expireTime, String token) { |
||||
Map<String, Object> result = new HashMap<>(5); |
||||
|
||||
AccessToken accessToken = new AccessToken(); |
||||
accessToken.setUserId(userId); |
||||
accessToken.setExpireTime(DateUtils.stringToDate(expireTime)); |
||||
accessToken.setToken(token); |
||||
accessToken.setCreateTime(new Date()); |
||||
accessToken.setUpdateTime(new Date()); |
||||
|
||||
// insert
|
||||
int insert = accessTokenMapper.insert(accessToken); |
||||
|
||||
if (insert > 0) { |
||||
putMsg(result, Status.SUCCESS); |
||||
} else { |
||||
putMsg(result, Status.CREATE_ALERT_GROUP_ERROR); |
||||
} |
||||
|
||||
return result; |
||||
} |
||||
|
||||
/** |
||||
* generate token |
||||
* @param userId |
||||
* @param expireTime |
||||
* @return |
||||
*/ |
||||
public Map<String, Object> generateToken(int userId, String expireTime) { |
||||
Map<String, Object> result = new HashMap<>(5); |
||||
String token = EncryptionUtils.getMd5(userId + expireTime + String.valueOf(System.currentTimeMillis())); |
||||
result.put(Constants.DATA_LIST, token); |
||||
putMsg(result, Status.SUCCESS); |
||||
return result; |
||||
} |
||||
|
||||
/** |
||||
* delete access token |
||||
* @param loginUser |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
public Map<String, Object> delAccessTokenById(User loginUser, int id) { |
||||
Map<String, Object> result = new HashMap<>(5); |
||||
//only admin can operate
|
||||
if (!isAdmin(loginUser)) { |
||||
putMsg(result, Status.USER_NOT_EXIST, id); |
||||
return result; |
||||
} |
||||
|
||||
accessTokenMapper.delete(id); |
||||
putMsg(result, Status.SUCCESS); |
||||
return result; |
||||
} |
||||
|
||||
/** |
||||
* update token by id |
||||
* @param id |
||||
* @param userId |
||||
* @param expireTime |
||||
* @param token |
||||
* @return |
||||
*/ |
||||
public Map<String, Object> updateToken(int id,int userId, String expireTime, String token) { |
||||
Map<String, Object> result = new HashMap<>(5); |
||||
AccessToken accessToken = new AccessToken(); |
||||
accessToken.setId(id); |
||||
accessToken.setUserId(userId); |
||||
accessToken.setExpireTime(DateUtils.stringToDate(expireTime)); |
||||
accessToken.setToken(token); |
||||
accessToken.setUpdateTime(new Date()); |
||||
|
||||
accessTokenMapper.update(accessToken); |
||||
|
||||
putMsg(result, Status.SUCCESS); |
||||
return result; |
||||
} |
||||
} |
@ -0,0 +1,162 @@
|
||||
/* |
||||
* 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; |
||||
|
||||
import java.io.File; |
||||
import java.net.URI; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
import java.util.UUID; |
||||
|
||||
import cn.escheduler.common.utils.EncryptionUtils; |
||||
import org.apache.commons.io.FileUtils; |
||||
import org.apache.http.NameValuePair; |
||||
import org.apache.http.client.entity.UrlEncodedFormEntity; |
||||
import org.apache.http.client.methods.CloseableHttpResponse; |
||||
import org.apache.http.client.methods.HttpGet; |
||||
import org.apache.http.client.methods.HttpPost; |
||||
import org.apache.http.client.utils.URIBuilder; |
||||
import org.apache.http.impl.client.CloseableHttpClient; |
||||
import org.apache.http.impl.client.HttpClients; |
||||
import org.apache.http.message.BasicNameValuePair; |
||||
import org.apache.http.util.EntityUtils; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
public class HttpClientTest { |
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(HttpClientTest.class); |
||||
|
||||
public static void main(String[] args) throws Exception { |
||||
// doGETParamPathVariableAndChinese();
|
||||
// doGETParam();
|
||||
// doPOSTParam();
|
||||
|
||||
String md5 = EncryptionUtils.getMd5(String.valueOf(System.currentTimeMillis()) + "张三"); |
||||
System.out.println(md5); |
||||
System.out.println(md5.length()); |
||||
} |
||||
|
||||
public static void doPOSTParam()throws Exception{ |
||||
// create Httpclient
|
||||
CloseableHttpClient httpclient = HttpClients.createDefault(); |
||||
// 创建http POST请求
|
||||
HttpPost httpPost = new HttpPost("http://127.0.0.1:12345/escheduler/projects/create"); |
||||
httpPost.setHeader("token", "123"); |
||||
// set parameters
|
||||
List<NameValuePair> parameters = new ArrayList<NameValuePair>(); |
||||
parameters.add(new BasicNameValuePair("projectName", "qzw")); |
||||
parameters.add(new BasicNameValuePair("desc", "qzw")); |
||||
|
||||
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(parameters); |
||||
httpPost.setEntity(formEntity); |
||||
|
||||
|
||||
CloseableHttpResponse response = null; |
||||
try { |
||||
// execute
|
||||
response = httpclient.execute(httpPost); |
||||
// eponse status code 200
|
||||
if (response.getStatusLine().getStatusCode() == 200) { |
||||
String content = EntityUtils.toString(response.getEntity(), "UTF-8"); |
||||
System.out.println(content); |
||||
} |
||||
} finally { |
||||
if (response != null) { |
||||
response.close(); |
||||
} |
||||
httpclient.close(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* |
||||
* @throws Exception |
||||
*/ |
||||
public static void doGETParamPathVariableAndChinese()throws Exception{ |
||||
// create HttpClient
|
||||
CloseableHttpClient httpclient = HttpClients.createDefault(); |
||||
|
||||
List<NameValuePair> parameters = new ArrayList<NameValuePair>(); |
||||
// parameters.add(new BasicNameValuePair("pageSize", "10"));
|
||||
|
||||
// define the parameters of the request
|
||||
URI uri = new URIBuilder("http://127.0.0.1:12345/escheduler/projects/%E5%85%A8%E9%83%A8%E6%B5%81%E7%A8%8B%E6%B5%8B%E8%AF%95/process/list") |
||||
.build(); |
||||
|
||||
// create http GET request
|
||||
HttpGet httpGet = new HttpGet(uri); |
||||
httpGet.setHeader("token","123"); |
||||
//response object
|
||||
CloseableHttpResponse response = null; |
||||
try { |
||||
// execute http get request
|
||||
response = httpclient.execute(httpGet); |
||||
// reponse status code 200
|
||||
if (response.getStatusLine().getStatusCode() == 200) { |
||||
String content = EntityUtils.toString(response.getEntity(), "UTF-8"); |
||||
logger.info("start--------------->"); |
||||
logger.info(content); |
||||
logger.info("end----------------->"); |
||||
} |
||||
} finally { |
||||
if (response != null) { |
||||
response.close(); |
||||
} |
||||
httpclient.close(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* |
||||
* @throws Exception |
||||
*/ |
||||
public static void doGETParam()throws Exception{ |
||||
// create HttpClient
|
||||
CloseableHttpClient httpclient = HttpClients.createDefault(); |
||||
|
||||
List<NameValuePair> parameters = new ArrayList<NameValuePair>(); |
||||
parameters.add(new BasicNameValuePair("processInstanceId", "41415")); |
||||
|
||||
// define the parameters of the request
|
||||
URI uri = new URIBuilder("http://127.0.0.1:12345/escheduler/projects/%E5%85%A8%E9%83%A8%E6%B5%81%E7%A8%8B%E6%B5%8B%E8%AF%95/instance/view-variables") |
||||
.setParameters(parameters) |
||||
.build(); |
||||
|
||||
// create http GET request
|
||||
HttpGet httpGet = new HttpGet(uri); |
||||
httpGet.setHeader("token","123"); |
||||
//response object
|
||||
CloseableHttpResponse response = null; |
||||
try { |
||||
// execute http get request
|
||||
response = httpclient.execute(httpGet); |
||||
// reponse status code 200
|
||||
if (response.getStatusLine().getStatusCode() == 200) { |
||||
String content = EntityUtils.toString(response.getEntity(), "UTF-8"); |
||||
logger.info("start--------------->"); |
||||
logger.info(content); |
||||
logger.info("end----------------->"); |
||||
} |
||||
} finally { |
||||
if (response != null) { |
||||
response.close(); |
||||
} |
||||
httpclient.close(); |
||||
} |
||||
} |
||||
|
||||
} |
@ -1 +1,32 @@
|
||||
alter table t_escheduler_user add queue varchar(64); |
||||
-- 用户指定队列 |
||||
alter table t_escheduler_user add queue varchar(64); |
||||
|
||||
-- 访问token |
||||
CREATE TABLE `t_escheduler_access_token` ( |
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', |
||||
`user_id` int(11) DEFAULT NULL COMMENT '用户id', |
||||
`token` varchar(64) DEFAULT NULL COMMENT 'token令牌', |
||||
`expire_time` datetime DEFAULT NULL COMMENT 'token有效结束时间', |
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间', |
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间', |
||||
PRIMARY KEY (`id`) |
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; |
||||
|
||||
CREATE TABLE `escheduler`.`t_escheduler_error_command` ( |
||||
`id` int(11) NOT NULL COMMENT '主键', |
||||
`command_type` tinyint(4) NULL DEFAULT NULL COMMENT '命令类型:0 启动工作流,1 从当前节点开始执行,2 恢复被容错的工作流,3 恢复暂停流程 4 从失败节点开始执行', |
||||
`executor_id` int(11) NULL DEFAULT NULL COMMENT '命令执行者', |
||||
`process_definition_id` int(11) NULL DEFAULT NULL COMMENT '流程定义id', |
||||
`command_param` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '命令的参数(json格式)', |
||||
`task_depend_type` tinyint(4) NULL DEFAULT NULL COMMENT '节点依赖类型', |
||||
`failure_strategy` tinyint(4) NULL DEFAULT 0 COMMENT '失败策略:0结束,1继续', |
||||
`warning_type` tinyint(4) NULL DEFAULT 0 COMMENT '告警类型', |
||||
`warning_group_id` int(11) NULL DEFAULT NULL COMMENT '告警组', |
||||
`schedule_time` datetime(0) NULL DEFAULT NULL COMMENT '预期运行时间', |
||||
`start_time` datetime(0) NULL DEFAULT NULL COMMENT '开始时间', |
||||
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', |
||||
`dependence` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '依赖字段', |
||||
`process_instance_priority` int(11) NULL DEFAULT NULL COMMENT '流程实例优先级:0 Highest,1 High,2 Medium,3 Low,4 Lowest', |
||||
`message` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '执行信息', |
||||
PRIMARY KEY (`id`) USING BTREE |
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; |
||||
|
@ -0,0 +1,88 @@
|
||||
/* |
||||
* 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.dao.mapper; |
||||
|
||||
import cn.escheduler.common.enums.UserType; |
||||
import cn.escheduler.dao.model.AccessToken; |
||||
import cn.escheduler.dao.model.User; |
||||
import org.apache.ibatis.annotations.*; |
||||
import org.apache.ibatis.type.EnumOrdinalTypeHandler; |
||||
import org.apache.ibatis.type.JdbcType; |
||||
|
||||
import java.sql.Timestamp; |
||||
import java.util.List; |
||||
|
||||
public interface AccessTokenMapper { |
||||
|
||||
/** |
||||
* insert accessToken |
||||
* @param accessToken |
||||
* @return |
||||
*/ |
||||
@InsertProvider(type = AccessTokenMapperProvider.class, method = "insert") |
||||
@Options(useGeneratedKeys = true,keyProperty = "accessToken.id") |
||||
@SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "accessToken.id", before = false, resultType = int.class) |
||||
int insert(@Param("accessToken") AccessToken accessToken); |
||||
|
||||
|
||||
/** |
||||
* delete accessToken |
||||
* @param accessTokenId |
||||
* @return |
||||
*/ |
||||
@DeleteProvider(type = AccessTokenMapperProvider.class, method = "delete") |
||||
int delete(@Param("accessTokenId") int accessTokenId); |
||||
|
||||
|
||||
/** |
||||
* update accessToken |
||||
* |
||||
* @param accessToken |
||||
* @return |
||||
*/ |
||||
@UpdateProvider(type = AccessTokenMapperProvider.class, method = "update") |
||||
int update(@Param("accessToken") AccessToken accessToken); |
||||
|
||||
|
||||
/** |
||||
* query access token list paging |
||||
* @param searchVal |
||||
* @param offset |
||||
* @param pageSize |
||||
* @return |
||||
*/ |
||||
@Results(value = {@Result(property = "id", column = "id", id = true, javaType = Integer.class, jdbcType = JdbcType.INTEGER), |
||||
@Result(property = "userId", column = "user_id", javaType = Integer.class, jdbcType = JdbcType.INTEGER), |
||||
@Result(property = "token", column = "token", javaType = String.class, jdbcType = JdbcType.VARCHAR), |
||||
@Result(property = "userName", column = "user_name", javaType = String.class, jdbcType = JdbcType.VARCHAR), |
||||
@Result(property = "expireTime", column = "expire_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE), |
||||
@Result(property = "createTime", column = "create_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE), |
||||
@Result(property = "updateTime", column = "update_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE) |
||||
}) |
||||
@SelectProvider(type = AccessTokenMapperProvider.class, method = "queryAccessTokenPaging") |
||||
List<AccessToken> queryAccessTokenPaging(@Param("searchVal") String searchVal, |
||||
@Param("offset") Integer offset, |
||||
@Param("pageSize") Integer pageSize); |
||||
|
||||
/** |
||||
* count access token by search value |
||||
* @param searchVal |
||||
* @return |
||||
*/ |
||||
@SelectProvider(type = AccessTokenMapperProvider.class, method = "countAccessTokenPaging") |
||||
Integer countAccessTokenPaging(@Param("searchVal") String searchVal); |
||||
} |
@ -0,0 +1,130 @@
|
||||
/* |
||||
* 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.dao.mapper; |
||||
|
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* access token mapper provider |
||||
* |
||||
*/ |
||||
public class AccessTokenMapperProvider { |
||||
|
||||
private static final String TABLE_NAME = "t_escheduler_access_token"; |
||||
|
||||
/** |
||||
* insert accessToken |
||||
* |
||||
* @param parameter |
||||
* @return |
||||
*/ |
||||
public String insert(Map<String, Object> parameter) { |
||||
return new SQL() { |
||||
{ |
||||
INSERT_INTO(TABLE_NAME); |
||||
VALUES("`user_id`", "#{accessToken.userId}"); |
||||
VALUES("`token`", "#{accessToken.token}"); |
||||
VALUES("`expire_time`", "#{accessToken.expireTime}");; |
||||
VALUES("`create_time`", "#{accessToken.createTime}"); |
||||
VALUES("`update_time`", "#{accessToken.updateTime}"); |
||||
} |
||||
}.toString(); |
||||
} |
||||
|
||||
/** |
||||
* delete accessToken |
||||
* |
||||
* @param parameter |
||||
* @return |
||||
*/ |
||||
public String delete(Map<String, Object> parameter) { |
||||
return new SQL() { |
||||
{ |
||||
DELETE_FROM(TABLE_NAME); |
||||
|
||||
WHERE("`id`=#{accessTokenId}"); |
||||
} |
||||
}.toString(); |
||||
} |
||||
|
||||
/** |
||||
* update accessToken |
||||
* |
||||
* @param parameter |
||||
* @return |
||||
*/ |
||||
public String update(Map<String, Object> parameter) { |
||||
return new SQL() { |
||||
{ |
||||
UPDATE(TABLE_NAME); |
||||
|
||||
SET("`user_id`=#{accessToken.userId}"); |
||||
SET("`token`=#{accessToken.token}"); |
||||
SET("`expire_time`=#{accessToken.expireTime}"); |
||||
SET("`update_time`=#{accessToken.updateTime}"); |
||||
|
||||
WHERE("`id`=#{user.id}"); |
||||
} |
||||
}.toString(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* count user number by search value |
||||
* @param parameter |
||||
* @return |
||||
*/ |
||||
public String countAccessTokenPaging(Map<String, Object> parameter) { |
||||
return new SQL() {{ |
||||
SELECT("count(0)"); |
||||
FROM(TABLE_NAME + " t,t_escheduler_user u"); |
||||
Object searchVal = parameter.get("searchVal"); |
||||
WHERE("u.id = t.user_id"); |
||||
if(searchVal != null && StringUtils.isNotEmpty(searchVal.toString())){ |
||||
WHERE(" u.user_name like concat('%', #{searchVal}, '%')"); |
||||
} |
||||
}}.toString(); |
||||
} |
||||
|
||||
/** |
||||
* query user list paging |
||||
* @param parameter |
||||
* @return |
||||
*/ |
||||
public String queryAccessTokenPaging(Map<String, Object> parameter) { |
||||
return new SQL() { |
||||
{ |
||||
SELECT("t.*,u.user_name"); |
||||
FROM(TABLE_NAME + " t,t_escheduler_user u"); |
||||
Object searchVal = parameter.get("searchVal"); |
||||
WHERE("u.id = t.user_id"); |
||||
if(searchVal != null && StringUtils.isNotEmpty(searchVal.toString())){ |
||||
WHERE(" u.user_name like concat('%', #{searchVal}, '%') "); |
||||
} |
||||
ORDER_BY(" t.update_time desc limit #{offset},#{pageSize} "); |
||||
} |
||||
}.toString(); |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,45 @@
|
||||
/* |
||||
* 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.dao.mapper; |
||||
|
||||
import cn.escheduler.common.enums.*; |
||||
import cn.escheduler.dao.model.Command; |
||||
import cn.escheduler.dao.model.ErrorCommand; |
||||
import org.apache.ibatis.annotations.*; |
||||
import org.apache.ibatis.type.EnumOrdinalTypeHandler; |
||||
import org.apache.ibatis.type.JdbcType; |
||||
|
||||
import java.sql.Timestamp; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* command mapper |
||||
*/ |
||||
public interface ErrorCommandMapper { |
||||
|
||||
/** |
||||
* inert error command |
||||
* @param errorCommand |
||||
* @return |
||||
*/ |
||||
@InsertProvider(type = ErrorCommandMapperProvider.class, method = "insert") |
||||
@Options(useGeneratedKeys = true,keyProperty = "errorCommand.id") |
||||
@SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "errorCommand.id", before = false, resultType = int.class) |
||||
int insert(@Param("errorCommand") ErrorCommand errorCommand); |
||||
|
||||
|
||||
} |
@ -0,0 +1,41 @@
|
||||
package cn.escheduler.dao.mapper; |
||||
|
||||
import cn.escheduler.common.enums.*; |
||||
import cn.escheduler.common.utils.EnumFieldUtil; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
import java.util.Map; |
||||
|
||||
public class ErrorCommandMapperProvider { |
||||
|
||||
|
||||
private static final String TABLE_NAME = "t_escheduler_error_command"; |
||||
|
||||
|
||||
/** |
||||
* inert command |
||||
* |
||||
* @param parameter |
||||
* @return |
||||
*/ |
||||
public String insert(Map<String, Object> parameter) { |
||||
return new SQL() { |
||||
{ |
||||
INSERT_INTO(TABLE_NAME); |
||||
VALUES("`command_type`", EnumFieldUtil.genFieldStr("errorCommand.commandType", CommandType.class)); |
||||
VALUES("`process_definition_id`", "#{errorCommand.processDefinitionId}"); |
||||
VALUES("`executor_id`", "#{errorCommand.executorId}"); |
||||
VALUES("`command_param`", "#{errorCommand.commandParam}"); |
||||
VALUES("`task_depend_type`", EnumFieldUtil.genFieldStr("errorCommand.taskDependType", TaskDependType.class)); |
||||
VALUES("`failure_strategy`", EnumFieldUtil.genFieldStr("errorCommand.failureStrategy", FailureStrategy.class)); |
||||
VALUES("`warning_type`", EnumFieldUtil.genFieldStr("errorCommand.warningType", WarningType.class)); |
||||
VALUES("`process_instance_priority`", EnumFieldUtil.genFieldStr("errorCommand.processInstancePriority", Priority.class)); |
||||
VALUES("`warning_group_id`", "#{errorCommand.warningGroupId}"); |
||||
VALUES("`schedule_time`", "#{errorCommand.scheduleTime}"); |
||||
VALUES("`update_time`", "#{errorCommand.updateTime}"); |
||||
VALUES("`start_time`", "#{errorCommand.startTime}"); |
||||
VALUES("`message`", "#{errorCommand.message}"); |
||||
} |
||||
}.toString(); |
||||
} |
||||
} |
@ -0,0 +1,126 @@
|
||||
package cn.escheduler.dao.model; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/* |
||||
* 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. |
||||
*/ |
||||
public class AccessToken { |
||||
|
||||
/** |
||||
* id |
||||
*/ |
||||
private int id; |
||||
|
||||
/** |
||||
* user id |
||||
*/ |
||||
private int userId; |
||||
|
||||
/** |
||||
* user name |
||||
*/ |
||||
private String userName; |
||||
|
||||
/** |
||||
* user token |
||||
*/ |
||||
private String token; |
||||
|
||||
/** |
||||
* token expire time |
||||
*/ |
||||
private Date expireTime; |
||||
|
||||
/** |
||||
* create time |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* update time |
||||
*/ |
||||
private Date updateTime; |
||||
|
||||
public int getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(int id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public int getUserId() { |
||||
return userId; |
||||
} |
||||
|
||||
public void setUserId(int userId) { |
||||
this.userId = userId; |
||||
} |
||||
|
||||
public String getToken() { |
||||
return token; |
||||
} |
||||
|
||||
public void setToken(String token) { |
||||
this.token = token; |
||||
} |
||||
|
||||
public Date getExpireTime() { |
||||
return expireTime; |
||||
} |
||||
|
||||
public void setExpireTime(Date expireTime) { |
||||
this.expireTime = expireTime; |
||||
} |
||||
|
||||
public Date getCreateTime() { |
||||
return createTime; |
||||
} |
||||
|
||||
public void setCreateTime(Date createTime) { |
||||
this.createTime = createTime; |
||||
} |
||||
|
||||
public Date getUpdateTime() { |
||||
return updateTime; |
||||
} |
||||
|
||||
public void setUpdateTime(Date updateTime) { |
||||
this.updateTime = updateTime; |
||||
} |
||||
|
||||
public String getUserName() { |
||||
return userName; |
||||
} |
||||
|
||||
public void setUserName(String userName) { |
||||
this.userName = userName; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return "AccessToken{" + |
||||
"id=" + id + |
||||
", userId=" + userId + |
||||
", userName='" + userName + '\'' + |
||||
", token='" + token + '\'' + |
||||
", expireTime=" + expireTime + |
||||
", createTime=" + createTime + |
||||
", updateTime=" + updateTime + |
||||
'}'; |
||||
} |
||||
} |
@ -0,0 +1,275 @@
|
||||
/* |
||||
* 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.dao.model; |
||||
|
||||
import cn.escheduler.common.enums.*; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* command |
||||
*/ |
||||
public class ErrorCommand { |
||||
|
||||
/** |
||||
* id |
||||
*/ |
||||
private int id; |
||||
|
||||
/** |
||||
* command type |
||||
*/ |
||||
private CommandType commandType; |
||||
|
||||
/** |
||||
* process definition id |
||||
*/ |
||||
private int processDefinitionId; |
||||
|
||||
/** |
||||
* executor id |
||||
*/ |
||||
private int executorId; |
||||
|
||||
/** |
||||
* command parameter, format json |
||||
*/ |
||||
private String commandParam; |
||||
|
||||
/** |
||||
* task depend type |
||||
*/ |
||||
private TaskDependType taskDependType; |
||||
|
||||
/** |
||||
* failure strategy |
||||
*/ |
||||
private FailureStrategy failureStrategy; |
||||
|
||||
/** |
||||
* warning type |
||||
*/ |
||||
private WarningType warningType; |
||||
|
||||
/** |
||||
* warning group id |
||||
*/ |
||||
private Integer warningGroupId; |
||||
|
||||
/** |
||||
* schedule time |
||||
*/ |
||||
private Date scheduleTime; |
||||
|
||||
/** |
||||
* start time |
||||
*/ |
||||
private Date startTime; |
||||
|
||||
/** |
||||
* process instance priority |
||||
*/ |
||||
private Priority processInstancePriority; |
||||
|
||||
/** |
||||
* update time |
||||
*/ |
||||
private Date updateTime; |
||||
|
||||
/** |
||||
* 执行信息 |
||||
*/ |
||||
private String message; |
||||
|
||||
|
||||
public ErrorCommand(Command command, String message){ |
||||
this.commandType = command.getCommandType(); |
||||
this.executorId = command.getExecutorId(); |
||||
this.processDefinitionId = command.getProcessDefinitionId(); |
||||
this.commandParam = command.getCommandParam(); |
||||
this.warningType = command.getWarningType(); |
||||
this.warningGroupId = command.getWarningGroupId(); |
||||
this.scheduleTime = command.getScheduleTime(); |
||||
this.taskDependType = command.getTaskDependType(); |
||||
this.failureStrategy = command.getFailureStrategy(); |
||||
this.startTime = command.getStartTime(); |
||||
this.updateTime = command.getUpdateTime(); |
||||
this.processInstancePriority = command.getProcessInstancePriority(); |
||||
this.message = message; |
||||
} |
||||
|
||||
public ErrorCommand( |
||||
CommandType commandType, |
||||
TaskDependType taskDependType, |
||||
FailureStrategy failureStrategy, |
||||
int executorId, |
||||
int processDefinitionId, |
||||
String commandParam, |
||||
WarningType warningType, |
||||
int warningGroupId, |
||||
Date scheduleTime, |
||||
Priority processInstancePriority, |
||||
String message){ |
||||
this.commandType = commandType; |
||||
this.executorId = executorId; |
||||
this.processDefinitionId = processDefinitionId; |
||||
this.commandParam = commandParam; |
||||
this.warningType = warningType; |
||||
this.warningGroupId = warningGroupId; |
||||
this.scheduleTime = scheduleTime; |
||||
this.taskDependType = taskDependType; |
||||
this.failureStrategy = failureStrategy; |
||||
this.startTime = new Date(); |
||||
this.updateTime = new Date(); |
||||
this.processInstancePriority = processInstancePriority; |
||||
this.message = message; |
||||
} |
||||
|
||||
|
||||
public TaskDependType getTaskDependType() { |
||||
return taskDependType; |
||||
} |
||||
|
||||
public void setTaskDependType(TaskDependType taskDependType) { |
||||
this.taskDependType = taskDependType; |
||||
} |
||||
|
||||
public int getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(int id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public CommandType getCommandType() { |
||||
return commandType; |
||||
} |
||||
|
||||
public void setCommandType(CommandType commandType) { |
||||
this.commandType = commandType; |
||||
} |
||||
|
||||
public int getProcessDefinitionId() { |
||||
return processDefinitionId; |
||||
} |
||||
|
||||
public void setProcessDefinitionId(int processDefinitionId) { |
||||
this.processDefinitionId = processDefinitionId; |
||||
} |
||||
|
||||
|
||||
public FailureStrategy getFailureStrategy() { |
||||
return failureStrategy; |
||||
} |
||||
|
||||
public void setFailureStrategy(FailureStrategy failureStrategy) { |
||||
this.failureStrategy = failureStrategy; |
||||
} |
||||
|
||||
public void setCommandParam(String commandParam) { |
||||
this.commandParam = commandParam; |
||||
} |
||||
|
||||
public String getCommandParam() { |
||||
return commandParam; |
||||
} |
||||
|
||||
public WarningType getWarningType() { |
||||
return warningType; |
||||
} |
||||
|
||||
public void setWarningType(WarningType warningType) { |
||||
this.warningType = warningType; |
||||
} |
||||
|
||||
public Integer getWarningGroupId() { |
||||
return warningGroupId; |
||||
} |
||||
|
||||
public void setWarningGroupId(Integer warningGroupId) { |
||||
this.warningGroupId = warningGroupId; |
||||
} |
||||
|
||||
public Date getScheduleTime() { |
||||
return scheduleTime; |
||||
} |
||||
|
||||
public void setScheduleTime(Date scheduleTime) { |
||||
this.scheduleTime = scheduleTime; |
||||
} |
||||
|
||||
public Date getStartTime() { |
||||
return startTime; |
||||
} |
||||
|
||||
public void setStartTime(Date startTime) { |
||||
this.startTime = startTime; |
||||
} |
||||
|
||||
public int getExecutorId() { |
||||
return executorId; |
||||
} |
||||
|
||||
public void setExecutorId(int executorId) { |
||||
this.executorId = executorId; |
||||
} |
||||
|
||||
public Priority getProcessInstancePriority() { |
||||
return processInstancePriority; |
||||
} |
||||
|
||||
public void setProcessInstancePriority(Priority processInstancePriority) { |
||||
this.processInstancePriority = processInstancePriority; |
||||
} |
||||
|
||||
public Date getUpdateTime() { |
||||
return updateTime; |
||||
} |
||||
|
||||
public void setUpdateTime(Date updateTime) { |
||||
this.updateTime = updateTime; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return "Command{" + |
||||
"id=" + id + |
||||
", commandType=" + commandType + |
||||
", processDefinitionId=" + processDefinitionId + |
||||
", executorId=" + executorId + |
||||
", commandParam='" + commandParam + '\'' + |
||||
", taskDependType=" + taskDependType + |
||||
", failureStrategy=" + failureStrategy + |
||||
", warningType=" + warningType + |
||||
", warningGroupId=" + warningGroupId + |
||||
", scheduleTime=" + scheduleTime + |
||||
", startTime=" + startTime + |
||||
", processInstancePriority=" + processInstancePriority + |
||||
", updateTime=" + updateTime + |
||||
", message=" + message + |
||||
'}'; |
||||
} |
||||
|
||||
public String getMessage() { |
||||
return message; |
||||
} |
||||
|
||||
public void setMessage(String message) { |
||||
this.message = message; |
||||
} |
||||
} |
@ -0,0 +1,62 @@
|
||||
/* |
||||
* 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.dao.mapper; |
||||
|
||||
import cn.escheduler.common.utils.EncryptionUtils; |
||||
import cn.escheduler.dao.datasource.ConnectionFactory; |
||||
import cn.escheduler.dao.model.AccessToken; |
||||
import org.junit.Assert; |
||||
import org.junit.Before; |
||||
import org.junit.Test; |
||||
|
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
|
||||
|
||||
public class AccessTokenMapperTest { |
||||
|
||||
|
||||
AccessTokenMapper accessTokenMapper; |
||||
|
||||
@Before |
||||
public void before(){ |
||||
accessTokenMapper = ConnectionFactory.getSqlSession().getMapper(AccessTokenMapper.class); |
||||
} |
||||
|
||||
@Test |
||||
public void testInsert(){ |
||||
AccessToken accessToken = new AccessToken(); |
||||
accessToken.setUserId(10); |
||||
accessToken.setExpireTime(new Date()); |
||||
accessToken.setToken("ssssssssssssssssssssssssss"); |
||||
accessToken.setCreateTime(new Date()); |
||||
accessToken.setUpdateTime(new Date()); |
||||
accessTokenMapper.insert(accessToken); |
||||
} |
||||
|
||||
@Test |
||||
public void testListPaging(){ |
||||
Integer count = accessTokenMapper.countAccessTokenPaging(""); |
||||
Assert.assertEquals(count, (Integer) 5); |
||||
|
||||
List<AccessToken> accessTokenList = accessTokenMapper.queryAccessTokenPaging("", 0, 2); |
||||
Assert.assertEquals(accessTokenList.size(), 5); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,65 @@
|
||||
package cn.escheduler.server.worker; |
||||
|
||||
import org.apache.commons.lang.StringUtils; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
|
||||
import java.io.BufferedReader; |
||||
import java.io.FileInputStream; |
||||
import java.io.IOException; |
||||
import java.io.InputStreamReader; |
||||
|
||||
/** |
||||
* Created by qiaozhanwei on 2019/4/15. |
||||
*/ |
||||
public class EnvFileTest { |
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(EnvFileTest.class); |
||||
|
||||
public static void main(String[] args) { |
||||
String path = System.getProperty("user.dir")+"\\script\\env\\.escheduler_env.sh"; |
||||
String pythonHome = getPythonHome(path); |
||||
logger.info(pythonHome); |
||||
|
||||
} |
||||
|
||||
/** |
||||
* get python home |
||||
* @param path |
||||
* @return |
||||
*/ |
||||
private static String getPythonHome(String path){ |
||||
BufferedReader br = null; |
||||
String line = null; |
||||
StringBuilder sb = new StringBuilder(); |
||||
try { |
||||
br = new BufferedReader(new InputStreamReader(new FileInputStream(path))); |
||||
while ((line = br.readLine()) != null){ |
||||
if (line.contains("PYTHON_HOME")){ |
||||
sb.append(line); |
||||
break; |
||||
} |
||||
} |
||||
String result = sb.toString(); |
||||
if (StringUtils.isEmpty(result)){ |
||||
return null; |
||||
} |
||||
String[] arrs = result.split("="); |
||||
if (arrs.length == 2){ |
||||
return arrs[1]; |
||||
} |
||||
|
||||
}catch (IOException e){ |
||||
logger.error("read file failed : " + e.getMessage(),e); |
||||
}finally { |
||||
try { |
||||
if (br != null){ |
||||
br.close(); |
||||
} |
||||
} catch (IOException e) { |
||||
logger.error(e.getMessage(),e); |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
} |
@ -1,87 +0,0 @@
|
||||
/* |
||||
* 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. |
||||
*/ |
||||
|
||||
const fs = require('fs'); |
||||
const path = require('path') |
||||
const glob = require('globby') |
||||
|
||||
function moduleName (modules) { |
||||
let filename = path.basename(modules) |
||||
let parts = filename.split('.') |
||||
parts.pop() |
||||
filename = parts.join('.') |
||||
return path.dirname(modules) + '/' + filename |
||||
} |
||||
|
||||
const jsEntry = () => { |
||||
const obj = {} |
||||
const files = glob.sync([ |
||||
'./src/js/conf/login/**/*.vue', |
||||
'./src/js/conf/login/**/*.js', |
||||
'./src/js/conf/home/**/**/**/**/**/**/**/**/*.vue', |
||||
'./src/js/conf/home/**/**/**/**/**/**/**/**/*.js', |
||||
'./src/js/module/**/**/**/**/**/*.vue', |
||||
'./src/js/module/**/**/**/**/**/*.js' |
||||
]) |
||||
files.forEach(val => { |
||||
let parts = val.split(/[\\/]/) |
||||
parts.shift() |
||||
parts.shift() |
||||
let modules = parts.join('/') |
||||
let entry = moduleName(modules) |
||||
obj[entry] = val |
||||
}) |
||||
return obj |
||||
} |
||||
/* eslint-disable */ |
||||
let reg = /\$t\([\w,""''“”~\-\s.?!,。:;《》、\+\/<>()?!\u4e00-\u9fa5]*\)/g |
||||
let map = {} |
||||
let entryPathList = '' |
||||
let matchPathList = '' |
||||
let jsEntryObj = jsEntry() |
||||
|
||||
for (let i in jsEntryObj) { |
||||
entryPathList += jsEntryObj[i] + '\n' |
||||
let data = fs.readFileSync(path.join(jsEntryObj[i]), 'utf-8') |
||||
if (reg.test(data)) { |
||||
matchPathList += jsEntryObj[i] + '\n' |
||||
let str = data.replace(/[""'']/g, '') |
||||
str.replace(reg, function () { |
||||
if (arguments && arguments[0]) { |
||||
let key = arguments[0] |
||||
key = key.substring(3, key.length - 1) |
||||
map[key] = key |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
let outPath = path.join(__dirname, '../src/js/module/i18n/locale/zh_CN.js') |
||||
fs.unlink(outPath, (err) => { |
||||
if (err) { |
||||
console.error('删除zh_CN.js文件出错 -- \n', err) |
||||
} else { |
||||
console.log('删除zh_CN.js文件成功') |
||||
} |
||||
}) |
||||
fs.writeFile(outPath, 'export default ' + JSON.stringify(map, null, 2), function (err) { |
||||
if (err) { |
||||
console.error('写入zh_CN.js文件出错 -- \n', err) |
||||
} else { |
||||
console.log('写入zh_CN.js文件成功') |
||||
} |
||||
}) |
@ -0,0 +1,40 @@
|
||||
<template> |
||||
<div class="index-model"> |
||||
index |
||||
</div> |
||||
</template> |
||||
<script> |
||||
export default { |
||||
name: 'monitor-index', |
||||
data () { |
||||
return {} |
||||
}, |
||||
props: {}, |
||||
methods: {}, |
||||
watch: {}, |
||||
beforeCreate () { |
||||
}, |
||||
created () { |
||||
}, |
||||
beforeMount () { |
||||
}, |
||||
mounted () { |
||||
}, |
||||
beforeUpdate () { |
||||
}, |
||||
updated () { |
||||
}, |
||||
beforeDestroy () { |
||||
}, |
||||
destroyed () { |
||||
}, |
||||
computed: {}, |
||||
components: {} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" rel="stylesheet/scss"> |
||||
.index-model { |
||||
|
||||
} |
||||
</style> |
@ -1,8 +1,13 @@
|
||||
<template> |
||||
<router-view></router-view> |
||||
<div class="main-layout-box"> |
||||
<m-secondary-menu :type="'resource'"></m-secondary-menu> |
||||
<router-view></router-view> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' |
||||
export default { |
||||
name: 'resource-index' |
||||
name: 'resource-index', |
||||
components: { mSecondaryMenu } |
||||
} |
||||
</script> |
||||
|
@ -1,8 +1,13 @@
|
||||
<template> |
||||
<router-view></router-view> |
||||
<div class="main-layout-box"> |
||||
<m-secondary-menu :type="'security'"></m-secondary-menu> |
||||
<router-view></router-view> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' |
||||
export default { |
||||
name: 'security-index' |
||||
name: 'security-index', |
||||
components: { mSecondaryMenu } |
||||
} |
||||
</script> |
||||
|
@ -1,8 +1,14 @@
|
||||
<template> |
||||
<router-view></router-view> |
||||
<div class="main-layout-box"> |
||||
<m-secondary-menu :type="'user'"></m-secondary-menu> |
||||
<router-view></router-view> |
||||
</div> |
||||
|
||||
</template> |
||||
<script> |
||||
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' |
||||
export default { |
||||
name: 'user-index' |
||||
name: 'user-index', |
||||
components: { mSecondaryMenu } |
||||
} |
||||
</script> |
@ -1,20 +1,16 @@
|
||||
<template> |
||||
<div class="main-layout-box"> |
||||
<m-secondary-menu :type="'user'"></m-secondary-menu> |
||||
<m-list-construction :title="$t('User Information')"> |
||||
<template slot="content"> |
||||
<m-info></m-info> |
||||
</template> |
||||
</m-list-construction> |
||||
</div> |
||||
<m-list-construction :title="$t('User Information')"> |
||||
<template slot="content"> |
||||
<m-info></m-info> |
||||
</template> |
||||
</m-list-construction> |
||||
</template> |
||||
<script> |
||||
import mInfo from './_source/info' |
||||
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' |
||||
import mListConstruction from '@/module/components/listConstruction/listConstruction' |
||||
|
||||
export default { |
||||
name: 'account-index', |
||||
components: { mSecondaryMenu, mListConstruction, mInfo } |
||||
components: { mListConstruction, mInfo } |
||||
} |
||||
</script> |
@ -1,20 +1,16 @@
|
||||
<template> |
||||
<div class="main-layout-box"> |
||||
<m-secondary-menu :type="'user'"></m-secondary-menu> |
||||
<m-list-construction :title="$t('Edit Password')"> |
||||
<template slot="content"> |
||||
<m-info></m-info> |
||||
</template> |
||||
</m-list-construction> |
||||
</div> |
||||
<m-list-construction :title="$t('Edit Password')"> |
||||
<template slot="content"> |
||||
<m-info></m-info> |
||||
</template> |
||||
</m-list-construction> |
||||
</template> |
||||
<script> |
||||
import mInfo from './_source/info' |
||||
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' |
||||
import mListConstruction from '@/module/components/listConstruction/listConstruction' |
||||
|
||||
export default { |
||||
name: 'password-index', |
||||
components: { mSecondaryMenu, mListConstruction, mInfo } |
||||
components: { mListConstruction, mInfo } |
||||
} |
||||
</script> |
@ -0,0 +1,152 @@
|
||||
<template> |
||||
<m-popup |
||||
ref="popup" |
||||
:ok-text="item ? $t('Edit') : $t('Submit')" |
||||
:nameText="item ? '编辑令牌' : '创建令牌'" |
||||
@ok="_ok"> |
||||
<template slot="content"> |
||||
<div class="create-token-model"> |
||||
<m-list-box-f> |
||||
<template slot="name"><b>*</b>失效时间</template> |
||||
<template slot="content"> |
||||
<x-datepicker |
||||
:disabled-date="disabledDate" |
||||
v-model="expireTime" |
||||
@on-change="_onChange" |
||||
format="YYYY-MM-DD HH:mm:ss" |
||||
:panelNum="1"> |
||||
</x-datepicker> |
||||
</template> |
||||
</m-list-box-f> |
||||
<m-list-box-f> |
||||
<template slot="name"><b>*</b>用户</template> |
||||
<template slot="content"> |
||||
<x-select v-model="userId" @on-change="_onChange"> |
||||
<x-option |
||||
v-for="city in userIdList" |
||||
:key="city.id" |
||||
:value="city.id" |
||||
:label="city.userName"> |
||||
</x-option> |
||||
</x-select> |
||||
</template> |
||||
</m-list-box-f> |
||||
<m-list-box-f> |
||||
<template slot="name">Token</template> |
||||
<template slot="content"> |
||||
<x-input |
||||
readonly |
||||
style="width: 330px;" |
||||
type="input" |
||||
v-model="token" |
||||
placeholder="请输入Token"> |
||||
</x-input> |
||||
<x-button type="ghost" @click="_generateToken" :loading="tokenLoading">生成Token</x-button> |
||||
</template> |
||||
</m-list-box-f> |
||||
</div> |
||||
</template> |
||||
</m-popup> |
||||
</template> |
||||
<script> |
||||
import _ from 'lodash' |
||||
import dayjs from 'dayjs' |
||||
// import i18n from '@/module/i18n' |
||||
import store from '@/conf/home/store' |
||||
import mPopup from '@/module/components/popup/popup' |
||||
import mListBoxF from '@/module/components/listBoxF/listBoxF' |
||||
|
||||
export default { |
||||
name: 'create-token', |
||||
data () { |
||||
return { |
||||
store, |
||||
expireTime: dayjs().format('YYYY-MM-DD 23:59:59'), |
||||
userId: null, |
||||
disabledDate: date => (date.getTime() - new Date(new Date().getTime() - 24 * 60 * 60 * 1000)) < 0, |
||||
token: '', |
||||
userIdList: [], |
||||
tokenLoading: false |
||||
} |
||||
}, |
||||
props: { |
||||
item: Object |
||||
}, |
||||
methods: { |
||||
_ok () { |
||||
if (this._verification()) { |
||||
this._submit() |
||||
} |
||||
}, |
||||
_verification () { |
||||
if (!this.token) { |
||||
this.$message.warning('请生成Token') |
||||
return false |
||||
} |
||||
return true |
||||
}, |
||||
_submit () { |
||||
let param = { |
||||
expireTime: dayjs(this.expireTime).format('YYYY-MM-DD HH:mm:ss'), |
||||
userId: this.userId, |
||||
token: this.token |
||||
} |
||||
if (this.item) { |
||||
param.id = this.item.id |
||||
} |
||||
this.$refs['popup'].spinnerLoading = true |
||||
this.store.dispatch(`user/${this.item ? 'updateToken' : 'createToken'}`, param).then(res => { |
||||
this.$emit('onUpdate') |
||||
this.$message.success(res.msg) |
||||
setTimeout(() => { |
||||
this.$refs['popup'].spinnerLoading = false |
||||
}, 800) |
||||
}).catch(e => { |
||||
this.$message.error(e.msg || '') |
||||
this.$refs['popup'].spinnerLoading = false |
||||
}) |
||||
}, |
||||
_generateToken () { |
||||
this.tokenLoading = true |
||||
this.store.dispatch(`user/generateToken`, { |
||||
userId: this.userId, |
||||
expireTime: this.expireTime |
||||
}).then(res => { |
||||
setTimeout(() => { |
||||
this.tokenLoading = false |
||||
this.token = res |
||||
}, 1200) |
||||
}).catch(e => { |
||||
this.token = '' |
||||
this.$message.error(e.msg || '') |
||||
this.tokenLoading = false |
||||
}) |
||||
}, |
||||
_onChange () { |
||||
this.token = '' |
||||
} |
||||
}, |
||||
watch: {}, |
||||
created () { |
||||
this.store.dispatch(`security/getUsersList`).then(res => { |
||||
this.userIdList = _.map(res, v => _.pick(v, ['id', 'userName'])) |
||||
if (this.item) { |
||||
this.expireTime = this.item.expireTime |
||||
this.userId = this.item.userId |
||||
this.token = this.item.token |
||||
} else { |
||||
this.userId = this.userIdList[0].id |
||||
} |
||||
}) |
||||
}, |
||||
mounted () { |
||||
}, |
||||
components: { mPopup, mListBoxF } |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" rel="stylesheet/scss"> |
||||
.create-token-model { |
||||
width: 640px; |
||||
} |
||||
</style> |
@ -0,0 +1,125 @@
|
||||
<template> |
||||
<div class="list-model"> |
||||
<div class="table-box"> |
||||
<table> |
||||
<tr> |
||||
<th> |
||||
<span>编号</span> |
||||
</th> |
||||
<th> |
||||
<span>用户</span> |
||||
</th> |
||||
<th> |
||||
<span>Token</span> |
||||
</th> |
||||
<th> |
||||
<span>开始时间</span> |
||||
</th> |
||||
<th> |
||||
<span>失效时间</span> |
||||
</th> |
||||
<th> |
||||
<span>创建时间</span> |
||||
</th> |
||||
<th> |
||||
<span>更新时间</span> |
||||
</th> |
||||
<th width="120"> |
||||
<span>{{$t('Operation')}}</span> |
||||
</th> |
||||
</tr> |
||||
<tr v-for="(item, $index) in list" :key="$index"> |
||||
<td> |
||||
<span>{{parseInt(pageNo === 1 ? ($index + 1) : (($index + 1) + (pageSize * (pageNo - 1))))}}</span> |
||||
</td> |
||||
<td> |
||||
<span> |
||||
<a href="javascript:" class="links">{{item.userName}}</a> |
||||
</span> |
||||
</td> |
||||
<td><span>{{item.token}}</span></td> |
||||
<td> |
||||
<span>{{item.createTime | formatDate}}</span> |
||||
</td> |
||||
<td> |
||||
<span>{{item.expireTime | formatDate}}</span> |
||||
</td> |
||||
<td><span>{{item.createTime | formatDate}}</span></td> |
||||
<td><span>{{item.updateTime | formatDate}}</span></td> |
||||
<td> |
||||
<x-button type="info" shape="circle" size="xsmall" data-toggle="tooltip" icon="iconfont icon-bianjixiugai" :title="$t('Edit')" @click="_edit(item)"> |
||||
</x-button> |
||||
<x-poptip |
||||
:ref="'poptip-delete-' + $index" |
||||
placement="bottom-end" |
||||
width="90"> |
||||
<p>{{$t('Delete?')}}</p> |
||||
<div style="text-align: right; margin: 0;padding-top: 4px;"> |
||||
<x-button type="text" size="xsmall" shape="circle" @click="_closeDelete($index)">{{$t('Cancel')}}</x-button> |
||||
<x-button type="primary" size="xsmall" shape="circle" @click="_delete(item,$index)">{{$t('Confirm')}}</x-button> |
||||
</div> |
||||
<template slot="reference"> |
||||
<x-button type="error" shape="circle" size="xsmall" data-toggle="tooltip" icon="iconfont icon-shanchu" :title="$t('delete')"> |
||||
</x-button> |
||||
</template> |
||||
</x-poptip> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import { mapActions } from 'vuex' |
||||
import '@/module/filter/formatDate' |
||||
import { findComponentDownward } from '@/module/util/' |
||||
|
||||
export default { |
||||
name: 'token-list', |
||||
data () { |
||||
return { |
||||
list: [] |
||||
} |
||||
}, |
||||
props: { |
||||
tokenList: Array, |
||||
pageNo: Number, |
||||
pageSize: Number |
||||
}, |
||||
methods: { |
||||
...mapActions('user', ['deleteToken']), |
||||
_closeDelete (i) { |
||||
this.$refs[`poptip-delete-${i}`][0].doClose() |
||||
}, |
||||
_delete (item, i) { |
||||
this.deleteToken({ |
||||
id: item.id |
||||
}).then(res => { |
||||
this.$refs[`poptip-delete-${i}`][0].doClose() |
||||
this.list.splice(i, 1) |
||||
this.$message.success(res.msg) |
||||
}).catch(e => { |
||||
this.$refs[`poptip-delete-${i}`][0].doClose() |
||||
this.$message.error(e.msg || '') |
||||
}) |
||||
}, |
||||
_edit (item) { |
||||
findComponentDownward(this.$root, 'token-index')._create(item) |
||||
} |
||||
}, |
||||
watch: { |
||||
tokenList (a) { |
||||
this.list = [] |
||||
setTimeout(() => { |
||||
this.list = a |
||||
}) |
||||
} |
||||
}, |
||||
created () { |
||||
this.list = this.tokenList |
||||
}, |
||||
mounted () { |
||||
}, |
||||
components: { } |
||||
} |
||||
</script> |
@ -0,0 +1,115 @@
|
||||
<template> |
||||
<m-list-construction :title="'令牌管理'"> |
||||
<template slot="conditions"> |
||||
<m-conditions @on-conditions="_onConditions"> |
||||
<template slot="button-group"> |
||||
<x-button type="ghost" size="small" @click="_create('')">创建令牌</x-button> |
||||
</template> |
||||
</m-conditions> |
||||
</template> |
||||
<template slot="content"> |
||||
<template v-if="tokenList.length"> |
||||
<m-list :token-list="tokenList" :page-no="searchParams.pageNo" :page-size="searchParams.pageSize"></m-list> |
||||
<div class="page-box"> |
||||
<x-page :current="parseInt(searchParams.pageNo)" :total="total" :page-size="searchParams.pageSize" show-elevator @on-change="_page"></x-page> |
||||
</div> |
||||
</template> |
||||
<template v-if="!tokenList.length"> |
||||
<m-no-data></m-no-data> |
||||
</template> |
||||
<m-spin :is-spin="isLoading"></m-spin> |
||||
</template> |
||||
</m-list-construction> |
||||
</template> |
||||
<script> |
||||
import _ from 'lodash' |
||||
import { mapActions } from 'vuex' |
||||
import mList from './_source/list' |
||||
import mSpin from '@/module/components/spin/spin' |
||||
import mCreateToken from './_source/createToken' |
||||
import mNoData from '@/module/components/noData/noData' |
||||
import listUrlParamHandle from '@/module/mixin/listUrlParamHandle' |
||||
import mConditions from '@/module/components/conditions/conditions' |
||||
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' |
||||
import mListConstruction from '@/module/components/listConstruction/listConstruction' |
||||
|
||||
export default { |
||||
name: 'token-index', |
||||
data () { |
||||
return { |
||||
total: null, |
||||
isLoading: false, |
||||
tokenList: [], |
||||
searchParams: { |
||||
pageSize: 10, |
||||
pageNo: 1, |
||||
searchVal: '' |
||||
} |
||||
} |
||||
}, |
||||
mixins: [listUrlParamHandle], |
||||
props: {}, |
||||
methods: { |
||||
...mapActions('user', ['getTokenListP']), |
||||
/** |
||||
* Inquire |
||||
*/ |
||||
_onConditions (o) { |
||||
this.searchParams = _.assign(this.searchParams, o) |
||||
this.searchParams.pageNo = 1 |
||||
}, |
||||
_page (val) { |
||||
this.searchParams.pageNo = val |
||||
}, |
||||
_create (item) { |
||||
let self = this |
||||
let modal = this.$modal.dialog({ |
||||
closable: false, |
||||
showMask: true, |
||||
escClose: true, |
||||
className: 'v-modal-custom', |
||||
transitionName: 'opacityp', |
||||
render (h) { |
||||
return h(mCreateToken, { |
||||
on: { |
||||
onUpdate () { |
||||
self._debounceGET('false') |
||||
modal.remove() |
||||
}, |
||||
close () { |
||||
modal.remove() |
||||
} |
||||
}, |
||||
props: { |
||||
item: item |
||||
} |
||||
}) |
||||
} |
||||
}) |
||||
}, |
||||
_getList (flag) { |
||||
this.isLoading = !flag |
||||
this.getTokenListP(this.searchParams).then(res => { |
||||
this.tokenList = [] |
||||
this.tokenList = res.totalList |
||||
this.total = res.total |
||||
this.isLoading = false |
||||
}).catch(e => { |
||||
this.isLoading = false |
||||
}) |
||||
} |
||||
}, |
||||
watch: { |
||||
// router |
||||
'$route' (a) { |
||||
// url no params get instance list |
||||
this.searchParams.pageNo = _.isEmpty(a.query) ? 1 : a.query.pageNo |
||||
} |
||||
}, |
||||
created () { |
||||
}, |
||||
mounted () { |
||||
}, |
||||
components: { mSecondaryMenu, mList, mListConstruction, mConditions, mSpin, mNoData } |
||||
} |
||||
</script> |
Before Width: | Height: | Size: 550 B After Width: | Height: | Size: 550 B |
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 586 B |
@ -0,0 +1,7 @@
|
||||
/** |
||||
* project external config |
||||
*/ |
||||
export default { |
||||
// qianfan task record switch
|
||||
recordSwitch:true |
||||
} |
@ -1,12 +0,0 @@
|
||||
import os |
||||
|
||||
HADOOP_HOME="/opt/soft/hadoop" |
||||
SPARK_HOME1="/opt/soft/spark1" |
||||
SPARK_HOME2="/opt/soft/spark2" |
||||
PYTHON_HOME="/opt/soft/python" |
||||
JAVA_HOME="/opt/soft/java" |
||||
HIVE_HOME="/opt/soft/hive" |
||||
PATH=os.environ['PATH'] |
||||
PATH="%s/bin:%s/bin:%s/bin:%s/bin:%s/bin:%s/bin:%s"%(HIVE_HOME,HADOOP_HOME,SPARK_HOME1,SPARK_HOME2,JAVA_HOME,PYTHON_HOME,PATH) |
||||
|
||||
os.putenv('PATH','%s'%PATH) |
Loading…
Reference in new issue